From 00b109d321658792cdfba618bccc433ad61befae Mon Sep 17 00:00:00 2001 From: Stefan Seyfried Date: Tue, 7 Mar 2017 19:46:30 +0100 Subject: [PATCH 1/4] msgbox: deobfuscate assignment of default result value Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/2cef61bd8e249cf9118566d9eaa54cdcfab7f965 Author: Stefan Seyfried Date: 2017-03-07 (Tue, 07 Mar 2017) ------------------ No further description and justification available within origin commit message! ------------------ This commit was generated by Migit --- src/gui/widget/msgbox.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/gui/widget/msgbox.cpp b/src/gui/widget/msgbox.cpp index 48921105b..b89220a13 100644 --- a/src/gui/widget/msgbox.cpp +++ b/src/gui/widget/msgbox.cpp @@ -101,10 +101,8 @@ void CMsgBox::init(const int& Height, const int& ShowButtons, const msg_result_t shadow = CC_SHADOW_ON; //set result - if (Default_result != mbrNone) - result = default_result = Default_result; - else - result = mbrNone; + result = default_result = Default_result; + //add and initialize footer buttons with required buttons and basic properties if (ShowButtons > -1) mb_show_button = ShowButtons; From ff2eb924011450972d3caccbf731d4199c3e9e59 Mon Sep 17 00:00:00 2001 From: Stefan Seyfried Date: Tue, 7 Mar 2017 19:55:25 +0100 Subject: [PATCH 2/4] bouquetlist: don't block RC keys while list is opened Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/c857fc49be6a27e9c5137893980841514892fb1d Author: Stefan Seyfried Date: 2017-03-07 (Tue, 07 Mar 2017) ------------------ No further description and justification available within origin commit message! ------------------ This commit was generated by Migit --- src/gui/bouquetlist.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/gui/bouquetlist.cpp b/src/gui/bouquetlist.cpp index f112c8d4f..4794e2579 100644 --- a/src/gui/bouquetlist.cpp +++ b/src/gui/bouquetlist.cpp @@ -2,7 +2,7 @@ Neutrino-GUI - DBoxII-Project Copyright (C) 2001 Steffen Hehn 'McClean' - Copyright (C) 2009,2011,2013,2015-2016 Stefan Seyfried + Copyright (C) 2009,2011,2013,2015-2017 Stefan Seyfried License: GPL @@ -579,7 +579,7 @@ int CBouquetList::show(bool bShowChannelList) g_RCInput->postMsg(msg, data); loop = false; res = CHANLIST_CANCEL_ALL; - } else if (msg > CRCInput::RC_MaxRC) { + } else { if ( CNeutrinoApp::getInstance()->handleMsg( msg, data ) & messages_return::cancel_all ) { loop = false; res = CHANLIST_CANCEL_ALL; From e7daf551b3c1e3f60be1281d63d984ca6e7f68c0 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Sat, 11 Mar 2017 00:45:25 +0100 Subject: [PATCH 3/4] CCDraw: add possibility to use background images as item background Provides functionality to use a backround image instead to render usual box. If an image is defined, box render is disabled, but behavior for hide, kill, cache... is not changed. TODO: - maybe needs global caching because images are not yet managed like icons in framebuffer class Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/ccb82083e26147214a782c7407c12bb1dc03b9a9 Author: Thilo Graf Date: 2017-03-11 (Sat, 11 Mar 2017) ------------------ This commit was generated by Migit --- src/gui/components/cc_draw.cpp | 180 ++++++++++++++++++++++----------- src/gui/components/cc_draw.h | 32 +++++- 2 files changed, 152 insertions(+), 60 deletions(-) diff --git a/src/gui/components/cc_draw.cpp b/src/gui/components/cc_draw.cpp index 9ca52c03c..5c4d8448b 100644 --- a/src/gui/components/cc_draw.cpp +++ b/src/gui/components/cc_draw.cpp @@ -3,7 +3,7 @@ Copyright (C) 2001 by Steffen Hehn 'McClean' Classes for generic GUI-related components. - Copyright (C) 2015, Thilo Graf 'dbt' + Copyright (C) 2012-2017, Thilo Graf 'dbt' Copyright (C) 2012, Michael Liebmann 'micha-bbg' License: GPL @@ -27,8 +27,9 @@ #include "cc_draw.h" #include "cc_timer.h" #include - +#include #include +extern CPictureViewer * g_PicViewer; CCDraw::CCDraw() : COSDFader(g_settings.theme.menu_Content_alpha) { @@ -44,6 +45,8 @@ CCDraw::CCDraw() : COSDFader(g_settings.theme.menu_Content_alpha) col_frame = col_frame_old = COL_FRAME_PLUS_0; col_shadow_clean = 0; + cc_body_image = cc_body_image_old = string(); + fr_thickness = fr_thickness_old = 0; corner_type = corner_type_old = CORNER_ALL; @@ -176,6 +179,11 @@ inline bool CCDraw::applyColChanges() cc_body_gradient_direction_old = cc_body_gradient_direction; ret = true; } + if (cc_body_image != cc_body_image_old){ + dprintf(DEBUG_INFO, "\033[33m[CCDraw]\t[%s - %d], col changes cc_body_image %s != cc_body_image_old %s...\033[0m\n", __func__, __LINE__, cc_body_image.c_str(), cc_body_image_old.c_str()); + cc_body_image_old = cc_body_image; + ret = true; + } return ret; } @@ -467,13 +475,13 @@ void CCDraw::enablePaintCache(bool enable) //paint framebuffer layers void CCDraw::paintFbItems(bool do_save_bg) { - //pick up signal if filled + //Pick up signal if filled and execute slots. OnBeforePaintLayers(); - //first modify background handling + //First we modify background handling. enableSaveBg(do_save_bg); - //save background before first paint, cc_save_bg must be true + //Save background before first paint, cc_save_bg must be true. if (firstPaint && cc_save_bg){ /* On first we must ensure that screen buffer is empty. * Here we clean possible screen buffers in bg layers, @@ -482,7 +490,7 @@ void CCDraw::paintFbItems(bool do_save_bg) clearSavedScreen(); /* On second step we check for - * usable item dimensions and exit here if found any problem + * usable item dimensions and exit here if found any problem. */ for(size_t i=0; i 0 && cc_allow_paint){ frameBuffer->paintBoxFrame(fbdata.x, fbdata.y, fbdata.dx, fbdata.dy, fbdata.frame_thickness, fbdata.color, fbdata.r, fbdata.rtype); @@ -550,10 +558,10 @@ void CCDraw::paintFbItems(bool do_save_bg) } if (fbtype == CC_FBDATA_TYPE_SHADOW_BOX && ((!is_painted || !fbdata.is_painted)|| shadow_force || force_paint_bg)) { if (fbdata.enabled) { - /* here we paint the shadow around the body - * on 1st step we check for already cached screen buffer, if true - * then restore this instead to call the paint methode. - * This could be usally, if we use existant instances of "this" object + /* Here we paint the shadow around the body. + * On 1st step we check for already cached screen buffer, if true + * then restore this instead to call the paint methode. + * This could be usally, if we use an existant instances of "this" object */ if (cc_allow_paint){ if (fbdata.pixbuf){ @@ -562,7 +570,7 @@ void CCDraw::paintFbItems(bool do_save_bg) }else{ frameBuffer->paintBoxRel(fbdata.x, fbdata.y, fbdata.dx, fbdata.dy, fbdata.color, fbdata.r, fbdata.rtype); } - //if is paint cache enabled + //If is paint cache enabled, catch screen into cache if (cc_paint_cache && fbdata.pixbuf == NULL) fbdata.pixbuf = getScreen(fbdata.x, fbdata.y, fbdata.dx, fbdata.dy); fbdata.is_painted = true; @@ -572,63 +580,104 @@ void CCDraw::paintFbItems(bool do_save_bg) if (paint_bg){ if (fbtype == CC_FBDATA_TYPE_BOX){ if(cc_allow_paint) { - /* here we paint the main body of box - * on 1st step we check for already cached background buffer, if true - * then restore this instead to call the paint methodes and gradient creation - * paint cache can be enable/disable with enablePaintCache() + /* Here we paint the main body of box. + * On 1st step we check for already cached background buffer, if true + * then restore this instead to call the paint methodes and gradient creation. + * Paint cache can be enable/disable with enablePaintCache() */ if (fbdata.pixbuf){ + /* If is paint cache enabled and cache is filled, it's prefered to paint + * from cache. Cache is also filled if body background images are used + */ dprintf(DEBUG_INFO, "\033[33m[CCDraw]\t[%s - %d], paint body from cache...\033[0m\n", __func__, __LINE__); frameBuffer->RestoreScreen(fbdata.x, fbdata.y, fbdata.dx, fbdata.dy, fbdata.pixbuf); }else{ - //ensure clean gradient data on disabled gradient + //Ensure clean gradient data on disabled gradient. if(cc_body_gradient_enable == CC_COLGRAD_OFF && fbdata.gradient_data){ dprintf(DEBUG_INFO, "\033[33m[CCDraw]\t[%s - %d], gradient mode is disabled but filled\033[0m\n", __func__, __LINE__); clearFbGradientData(); } - if (cc_body_gradient_enable != CC_COLGRAD_OFF){ - /* if color gradient enabled we create a gradient_data - * instance and add it to the fbdata object - * On disabled coloor gradient we do paint only a default box - */ - if (fbdata.gradient_data == NULL){ - dprintf(DEBUG_INFO, "\033[33m[CCDraw]\t[%s - %d], crate new gradient data)...\033[0m\n", __func__, __LINE__); - fbdata.gradient_data = getGradientData(); + + /* If background image is defined, + * we try to render an image instead to render default box. + * Paint of background image is prefered, next steps will be ignored! + */ + if (!cc_body_image.empty()){ + if (g_PicViewer->DisplayImage(cc_body_image, fbdata.x, fbdata.y, fbdata.dx, fbdata.dy)){ + // catch screen and store into paint cache + fbdata.pixbuf = getScreen(fbdata.x, fbdata.y, fbdata.dx, fbdata.dy); + fbdata.is_painted = true; + }else{ + if (fbdata.pixbuf){ + delete[] fbdata.pixbuf; + fbdata.pixbuf = NULL; + } + fbdata.is_painted = false; } - // if found empty gradient buffer, create it, otherwise paint from gradient cache - if (fbdata.gradient_data->boxBuf == NULL){ - if (!fbdata.pixbuf){ - // on enabled clean up, paint blank screen before create gradient box, this prevents possible ghost text with hw acceleration - if (cc_gradient_bg_cleanup) - frameBuffer->paintBoxRel(fbdata.x, fbdata.y, fbdata.dx, fbdata.dy, 0, fbdata.r, fbdata.rtype); + // On failed image paint, write this into log and reset image name. + if (!fbdata.is_painted){ + dprintf(DEBUG_NORMAL, "\033[33m\[CCDraw]\t[%s - %d], WARNING: bg image %s defined, but paint failed,\nfallback to default rendering...\033[0m\n", __func__, __LINE__, cc_body_image.c_str()); + cc_body_image = ""; + } + } - // create gradient buffer and paint gradient box - fbdata.gradient_data->boxBuf = frameBuffer->paintBoxRel(fbdata.x, fbdata.y, fbdata.dx, fbdata.dy, 0, fbdata.gradient_data, fbdata.r, fbdata.rtype); - dprintf(DEBUG_INFO, "\033[33m[CCDraw]\t[%s - %d], paint and cache new gradient into gradient cache...\033[0m\n", __func__, __LINE__); + /* If no background image is defined, we paint default box or box with gradient + * This is also possible if any background image is defined but image paint ist failed + */ + if (cc_body_image.empty()){ + if (cc_body_gradient_enable != CC_COLGRAD_OFF ){ + + /* If color gradient enabled we create a gradient_data + * instance and add it to the fbdata object + * On disabled color gradient or image paint was failed, we do paint only a default box + */ + if (fbdata.gradient_data == NULL){ + dprintf(DEBUG_INFO, "\033[33m[CCDraw]\t[%s - %d], create new gradient data)...\033[0m\n", __func__, __LINE__); + fbdata.gradient_data = getGradientData(); } - /* On enabled paint cache or clean up, catch the screen into paint cache and clean up unused gradient buffer. - * If we don't do this, gradient cache is used. - */ - if (cc_paint_cache || cc_gradient_bg_cleanup){ - dprintf(DEBUG_INFO, "\033[33m[CCDraw]\t[%s - %d], cache new created gradient into external cache...\033[0m\n", __func__, __LINE__); - fbdata.pixbuf = getScreen(fbdata.x, fbdata.y, fbdata.dx, fbdata.dy); - if (clearFbGradientData()) - dprintf(DEBUG_INFO, "\033[33m[CCDraw]\t[%s - %d], remove unused gradient data...\033[0m\n", __func__, __LINE__); + if (fbdata.gradient_data->boxBuf == NULL){ + if (fbdata.pixbuf == NULL){ + /* Before we paint any gradient box with hw acceleration, we must cleanup first. + * FIXME: This is only a workaround for this framebuffer behavior on enabled hw acceleration. + * Without this, ugly ghost letters or ghost images inside gradient boxes are possible. + */ + if (cc_gradient_bg_cleanup) + frameBuffer->paintBoxRel(fbdata.x, fbdata.y, fbdata.dx, fbdata.dy, 0, fbdata.r, fbdata.rtype); + + // create gradient buffer and paint gradient box + fbdata.gradient_data->boxBuf = frameBuffer->paintBoxRel(fbdata.x, fbdata.y, fbdata.dx, fbdata.dy, 0, fbdata.gradient_data, fbdata.r, fbdata.rtype); + dprintf(DEBUG_INFO, "\033[33m[CCDraw]\t[%s - %d], paint and cache new gradient into gradient cache...\033[0m\n", __func__, __LINE__); + } + + /* On enabled paint cache or clean up, catch the screen into paint cache and clean up unused gradient buffer. + * If we don't do this explicit, gradient cache is used. + */ + if (cc_paint_cache || cc_gradient_bg_cleanup){ + dprintf(DEBUG_INFO, "\033[33m[CCDraw]\t[%s - %d], cache new created gradient into external cache...\033[0m\n", __func__, __LINE__); + fbdata.pixbuf = getScreen(fbdata.x, fbdata.y, fbdata.dx, fbdata.dy); + if (clearFbGradientData()) + dprintf(DEBUG_INFO, "\033[33m[CCDraw]\t[%s - %d], remove unused gradient data...\033[0m\n", __func__, __LINE__); + } + }else{ + // If found gradient buffer, paint box from gradient cache. + dprintf(DEBUG_INFO, "\033[33m[CCDraw]\t[%s - %d], paint cached gradient)...\033[0m\n", __func__, __LINE__); + frameBuffer->checkFbArea(fbdata.x, fbdata.y, fbdata.dx, fbdata.dy, true); + frameBuffer->blitBox2FB(fbdata.gradient_data->boxBuf, fbdata.gradient_data->dx, fbdata.dy, fbdata.gradient_data->x, fbdata.y); + frameBuffer->checkFbArea(fbdata.x, fbdata.y, fbdata.dx, fbdata.dy, false); } }else{ - //use gradient cache to repaint gradient box - dprintf(DEBUG_INFO, "\033[33m[CCDraw]\t[%s - %d], paint cached gradient)...\033[0m\n", __func__, __LINE__); - frameBuffer->checkFbArea(fbdata.x, fbdata.y, fbdata.dx, fbdata.dy, true); - frameBuffer->blitBox2FB(fbdata.gradient_data->boxBuf, fbdata.gradient_data->dx, fbdata.dy, fbdata.gradient_data->x, fbdata.y); - frameBuffer->checkFbArea(fbdata.x, fbdata.y, fbdata.dx, fbdata.dy, false); + /* If is nothihng cached or no background image was defined or image paint was failed, + * render a default box. + */ + dprintf(DEBUG_INFO, "\033[33m[CCDraw]\t[%s - %d], paint default box)...\033[0m\n", __func__, __LINE__); + frameBuffer->paintBoxRel(fbdata.x, fbdata.y, fbdata.dx, fbdata.dy, fbdata.color, fbdata.r, fbdata.rtype); + + //If is paint cache enabled, catch screen into cache. + if (cc_paint_cache) + fbdata.pixbuf = getScreen(fbdata.x, fbdata.y, fbdata.dx, fbdata.dy); } - }else{ - dprintf(DEBUG_INFO, "\033[33m[CCDraw]\t[%s - %d], paint default box)...\033[0m\n", __func__, __LINE__); - frameBuffer->paintBoxRel(fbdata.x, fbdata.y, fbdata.dx, fbdata.dy, fbdata.color, fbdata.r, fbdata.rtype); - if (cc_paint_cache) - fbdata.pixbuf = getScreen(fbdata.x, fbdata.y, fbdata.dx, fbdata.dy); } } v_fbdata[i].is_painted = true; @@ -653,7 +702,6 @@ void CCDraw::paintFbItems(bool do_save_bg) //reset is painted ignore flag to default value force_paint_bg = false; - //pick up signal if filled OnAfterPaintLayers(); } @@ -797,3 +845,21 @@ bool CCDraw::cancelBlink(bool keep_on_screen) return res; } + +bool CCDraw::setBodyBGImage(const std::string& image_path) +{ + if (cc_body_image == image_path) + return false; + + cc_body_image = image_path; + + if (clearPaintCache()) + dprintf(DEBUG_NORMAL, "\033[33m\[CCDraw]\t[%s - %d], new body background image defined: %s , \033[0m\n", __func__, __LINE__, cc_body_image.c_str()); + + return true; +} + +bool CCDraw::setBodyBGImageName(const std::string& image_name) +{ + return setBodyBGImage(frameBuffer->getIconPath(image_name)); +} diff --git a/src/gui/components/cc_draw.h b/src/gui/components/cc_draw.h index 50be8a71d..26b8875d5 100644 --- a/src/gui/components/cc_draw.h +++ b/src/gui/components/cc_draw.h @@ -3,7 +3,7 @@ Copyright (C) 2001 by Steffen Hehn 'McClean' Classes for generic GUI-related components. - Copyright (C) 2015, Thilo Graf 'dbt' + Copyright (C) 2012-2017, Thilo Graf 'dbt' Copyright (C) 2012, Michael Liebmann 'micha-bbg' License: GPL @@ -78,6 +78,8 @@ class CCDraw : public COSDFader, public CComponentsSignals fb_pixel_t col_frame, col_frame_old; ///internal property: color for shadow clean up fb_pixel_t col_shadow_clean; + ///property: background image, see also setBodyBGImage() + std::string cc_body_image, cc_body_image_old; ///property: frame thickness, see also setFrameThickness() int fr_thickness, fr_thickness_old; @@ -407,8 +409,32 @@ class CCDraw : public COSDFader, public CComponentsSignals */ virtual void killShadow(const fb_pixel_t& bg_color = COL_BACKGROUND_PLUS_0, const int& corner_radius = -1); - virtual void enableGradientBgCleanUp(bool enable = true) { cc_gradient_bg_cleanup = enable; }; - virtual void disableGradientBgCleanUp(){ enableGradientBgCleanUp(false); }; + virtual void enableGradientBgCleanUp(bool enable = true) { cc_gradient_bg_cleanup = enable; } + virtual void disableGradientBgCleanUp(){ enableGradientBgCleanUp(false); } + + /**Sets an image path for body background, returns true if new image was applied. + * + * @return bool + * + * @param[in] image_path Path to image. + * + * @see + * cc_body_image + * setBodyBGImageName() + */ + virtual bool setBodyBGImage(const std::string& image_path); + + /**Sets an image name for body background, returns true if new image was applied. + * + * @return bool + * + * @param[in] image_name Basename of image. + * + * @see + * cc_body_image + * setBodyBGImage() + */ + virtual bool setBodyBGImageName(const std::string& image_name); }; #endif From 5368732f2ffd6655b5887e8fe0eb86d7dfcbfeb4 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Sat, 11 Mar 2017 00:45:25 +0100 Subject: [PATCH 4/4] CComponentsFooter: simplify implementation of button labels button_label_l and button_label_s are now merged to button_label_cc with prepared default values for text and locales.This type contains all possible button label properties. Values for locales and string are evaluated in setButtonLabels(), so it's possible to remove some overloaded methodes. Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/c766a970dc352eef77464a19a512758ff767535f Author: Thilo Graf Date: 2017-03-11 (Sat, 11 Mar 2017) ------------------ This commit was generated by Migit --- src/gui/components/cc_frm_footer.cpp | 48 +++++----------------------- src/gui/components/cc_frm_footer.h | 26 ++++----------- src/gui/lua/lua_cc_window.cpp | 10 +++--- src/gui/widget/msgbox.cpp | 6 ++-- 4 files changed, 23 insertions(+), 67 deletions(-) diff --git a/src/gui/components/cc_frm_footer.cpp b/src/gui/components/cc_frm_footer.cpp index 2b1c568ff..37372ba2f 100644 --- a/src/gui/components/cc_frm_footer.cpp +++ b/src/gui/components/cc_frm_footer.cpp @@ -3,7 +3,7 @@ Copyright (C) 2001 by Steffen Hehn 'McClean' Classes for generic GUI-related components. - Copyright (C) 2013-2014, Thilo Graf 'dbt' + Copyright (C) 2013-2017, Thilo Graf 'dbt' License: GPL @@ -102,7 +102,7 @@ void CComponentsFooter::initVarFooter( const int& x_pos, const int& y_pos, const initParent(parent); } -void CComponentsFooter::setButtonLabels(const struct button_label_s * const content, const size_t& label_count, const int& chain_width, const int& label_width) +void CComponentsFooter::setButtonLabels(const struct button_label_cc * const content, const size_t& label_count, const int& chain_width, const int& label_width) { /* clean up before init*/ if (chain) @@ -178,7 +178,7 @@ void CComponentsFooter::setButtonLabels(const struct button_label_s * const cont vector v_btns; int h_btn = /*(ccf_enable_button_bg ? */chain->getHeight()-2*fr_thickness/*-OFFSET_INNER_SMALL*//* : height)*/-ccf_button_shadow_width; for (size_t i= 0; i< label_count; i++){ - string txt = content[i].text; + string txt = content[i].locale == NONEXISTANT_LOCALE ? content[i].text : g_Locale->getText(content[i].locale); string icon_name = string(content[i].button); //ignore item, if no text and icon are defined; @@ -244,26 +244,10 @@ void CComponentsFooter::setButtonLabels(const struct button_label_s * const cont } } -void CComponentsFooter::setButtonLabels(const struct button_label_l * const content, const size_t& label_count, const int& chain_width, const int& label_width) -{ - button_label_s buttons[label_count]; - - for (size_t i= 0; i< label_count; i++){ - buttons[i].button = content[i].button; - buttons[i].text = content[i].locale != NONEXISTANT_LOCALE ? g_Locale->getText(content[i].locale) : ""; - buttons[i].directKey = content[i].directKey; - buttons[i].directKeyAlt = content[i].directKeyAlt; - buttons[i].btn_result = content[i].btn_result; - buttons[i].btn_alias = content[i].btn_alias; - } - - setButtonLabels(buttons, label_count, chain_width, label_width); -} - void CComponentsFooter::setButtonLabels(const struct button_label * const content, const size_t& label_count, const int& chain_width, const int& label_width) { //conversion for compatibility with older paintButtons() methode, find in /gui/widget/buttons.h - button_label_l buttons[label_count]; + button_label_cc buttons[label_count]; for (size_t i = 0; i< label_count; i++){ buttons[i].button = content[i].button; buttons[i].locale = content[i].locale; @@ -276,31 +260,15 @@ void CComponentsFooter::setButtonLabels(const struct button_label * const conten setButtonLabels(buttons, label_count, chain_width, label_width); } -void CComponentsFooter::setButtonLabels(const vector &v_content, const int& chain_width, const int& label_width) +void CComponentsFooter::setButtonLabels(const vector &v_content, const int& chain_width, const int& label_width) { size_t label_count = v_content.size(); - button_label_l buttons[label_count]; - - for (size_t i= 0; i< label_count; i++){ - buttons[i].button = v_content[i].button; - buttons[i].locale = v_content[i].locale; - buttons[i].directKey = v_content[i].directKey; - buttons[i].directKeyAlt = v_content[i].directKeyAlt; - buttons[i].btn_result = v_content[i].btn_result; - buttons[i].btn_alias = v_content[i].btn_alias; - } - - setButtonLabels(buttons, label_count, chain_width, label_width); -} - -void CComponentsFooter::setButtonLabels(const vector &v_content, const int& chain_width, const int& label_width) -{ - size_t label_count = v_content.size(); - button_label_s buttons[label_count]; + button_label_cc buttons[label_count]; for (size_t i= 0; i< label_count; i++){ buttons[i].button = v_content[i].button; buttons[i].text = v_content[i].text; + buttons[i].locale = v_content[i].locale; buttons[i].directKey = v_content[i].directKey; buttons[i].directKeyAlt = v_content[i].directKeyAlt; buttons[i].btn_result = v_content[i].btn_result; @@ -319,7 +287,7 @@ void CComponentsFooter::setButtonLabel( const char *button_icon, const int& alias_value, const neutrino_msg_t& directKeyAlt) { - button_label_s button[1]; + button_label_cc button[1]; button[0].button = button_icon; button[0].text = text; diff --git a/src/gui/components/cc_frm_footer.h b/src/gui/components/cc_frm_footer.h index 59a90e8f5..5add6ffae 100644 --- a/src/gui/components/cc_frm_footer.h +++ b/src/gui/components/cc_frm_footer.h @@ -3,7 +3,7 @@ Copyright (C) 2001 by Steffen Hehn 'McClean' Classes for generic GUI-related components. - Copyright (C) 2012, 2013, 2014, Thilo Graf 'dbt' + Copyright (C) 2012-2017, Thilo Graf 'dbt' License: GPL @@ -30,25 +30,17 @@ #include //for compatibility with 'button_label' type //for 'button_label' type with string -typedef struct button_label_s +typedef struct button_label_cc { const char * button; std::string text; + neutrino_locale_t locale; neutrino_msg_t directKey; neutrino_msg_t directKeyAlt; int btn_result; int btn_alias; -} button_label_s_struct; - -typedef struct button_label_l -{ - const char * button; - neutrino_locale_t locale; - neutrino_msg_t directKey; - neutrino_msg_t directKeyAlt; - int btn_result; - int btn_alias; -} button_label_l_struct; + button_label_cc(): text(std::string()), locale(NONEXISTANT_LOCALE){} +} button_label_cc_struct; /*! CComponentsFooter, sub class of CComponentsHeader provides prepared container for footer @@ -101,13 +93,9 @@ class CComponentsFooter : public CComponentsHeader fb_pixel_t color_shadow = COL_SHADOW_PLUS_0); ///add button labels with string label type as content, count as size_t, chain_width as int, label width as int - void setButtonLabels(const struct button_label_s * const content, const size_t& label_count, const int& chain_width = 0, const int& label_width = 0); - ///add button labels with locale label type as content, count as size_t, chain_width as int, label width as int - void setButtonLabels(const struct button_label_l * const content, const size_t& label_count, const int& chain_width = 0, const int& label_width = 0); - ///add button labels with locale label type as content, parameter 1 as vector, chain_width as int, label width as int - void setButtonLabels(const std::vector &v_content, const int& chain_width, const int& label_width); + void setButtonLabels(const struct button_label_cc * const content, const size_t& label_count, const int& chain_width = 0, const int& label_width = 0); ///add button labels with string label type as content, parameter 1 as vector, chain_width as int, label width as int - void setButtonLabels(const std::vector &v_content, const int& chain_width, const int& label_width); + void setButtonLabels(const std::vector &v_content, const int& chain_width, const int& label_width); ///enable/disable button frame in icon color, predefined for red, green, yellow and blue inline void enableButtonFrameColor(bool enable = true){btn_auto_frame_col = enable;} diff --git a/src/gui/lua/lua_cc_window.cpp b/src/gui/lua/lua_cc_window.cpp index 494487614..2225797bc 100644 --- a/src/gui/lua/lua_cc_window.cpp +++ b/src/gui/lua/lua_cc_window.cpp @@ -139,27 +139,27 @@ int CLuaInstCCWindow::CCWindowNew(lua_State *L) else { CComponentsFooter* footer = (*udata)->w->getFooterObject(); if (footer) { - vector buttons; + vector buttons; if (!btnRed.empty()) { - button_label_s btnSred; + button_label_cc btnSred; btnSred.button = NEUTRINO_ICON_BUTTON_RED; btnSred.text = btnRed; buttons.push_back(btnSred); } if (!btnGreen.empty()) { - button_label_s btnSgreen; + button_label_cc btnSgreen; btnSgreen.button = NEUTRINO_ICON_BUTTON_GREEN; btnSgreen.text = btnGreen; buttons.push_back(btnSgreen); } if (!btnYellow.empty()) { - button_label_s btnSyellow; + button_label_cc btnSyellow; btnSyellow.button = NEUTRINO_ICON_BUTTON_YELLOW; btnSyellow.text = btnYellow; buttons.push_back(btnSyellow); } if (!btnBlue.empty()) { - button_label_s btnSblue; + button_label_cc btnSblue; btnSblue.button = NEUTRINO_ICON_BUTTON_BLUE; btnSblue.text = btnBlue; buttons.push_back(btnSblue); diff --git a/src/gui/widget/msgbox.cpp b/src/gui/widget/msgbox.cpp index b89220a13..bcdd23e8a 100644 --- a/src/gui/widget/msgbox.cpp +++ b/src/gui/widget/msgbox.cpp @@ -7,7 +7,7 @@ Günther@tuxbox.berlios.org Implementation of CComponent Window class. - Copyright (C) 2014-2016 Thilo Graf 'dbt' + Copyright (C) 2014-2017 Thilo Graf 'dbt' License: GPL @@ -117,8 +117,8 @@ void CMsgBox::initTimeOut() void CMsgBox::initButtons() { - button_label_s btn; - vector v_buttons; + button_label_cc btn; + vector v_buttons; //evaluate combinations if (mb_show_button & mbAll)