From c88a6ff7b31b75cb8a1f5e9b348ae74883d162ef Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Mon, 7 Dec 2020 20:33:52 +0100 Subject: [PATCH] cc: rework color handling for select and focus status --- src/gui/components/cc_detailsline.cpp | 13 ++++- src/gui/components/cc_detailsline.h | 2 +- src/gui/components/cc_draw.cpp | 65 +++++++++++++++------- src/gui/components/cc_draw.h | 44 +++++++++++---- src/gui/components/cc_frm_button.cpp | 2 +- src/gui/components/cc_frm_chain.cpp | 2 +- src/gui/components/cc_frm_clock.cpp | 4 +- src/gui/components/cc_frm_ext_text.cpp | 6 +- src/gui/components/cc_frm_footer.cpp | 8 +-- src/gui/components/cc_frm_header.cpp | 12 ++-- src/gui/components/cc_frm_icons.cpp | 2 +- src/gui/components/cc_frm_scrollbar.cpp | 8 +-- src/gui/components/cc_frm_signalbars.cpp | 8 +-- src/gui/components/cc_frm_window.cpp | 4 +- src/gui/components/cc_item.cpp | 27 ++++++++- src/gui/components/cc_item_infobox.cpp | 4 +- src/gui/components/cc_item_picture.cpp | 6 +- src/gui/components/cc_item_progressbar.cpp | 4 +- src/gui/components/cc_item_shapes.cpp | 4 +- src/gui/components/cc_item_text.cpp | 4 +- src/gui/components/cc_item_text.h | 9 ++- src/gui/components/cc_item_tvpic.cpp | 2 +- src/gui/volumebar.cpp | 6 +- src/gui/widget/hintbox.cpp | 2 +- src/gui/widget/msgbox.cpp | 2 +- src/gui/widget/progresswindow.cpp | 4 +- 26 files changed, 168 insertions(+), 86 deletions(-) diff --git a/src/gui/components/cc_detailsline.cpp b/src/gui/components/cc_detailsline.cpp index 809e76491..e280d8255 100644 --- a/src/gui/components/cc_detailsline.cpp +++ b/src/gui/components/cc_detailsline.cpp @@ -51,7 +51,7 @@ void CComponentsDetailsLine::initVarDline( const int& x_pos, const int& y_pos_to x = x_pos; y = y_pos_top; col_shadow = color_shadow; - col_body = color_line; + col_body_std = color_line; shadow_w = 1; @@ -91,6 +91,9 @@ CComponentsDetailsLine::~CComponentsDetailsLine() void CComponentsDetailsLine::paint(const bool &do_save_bg) { hide(); + + col_body = col_body_std; + if (hasChanges()) clearFbData(); @@ -137,6 +140,12 @@ void CComponentsDetailsLine::paint(const bool &do_save_bg) //so you can ensure correct applied system colors in relevant objects with unchanged instances. void CComponentsDetailsLine::syncSysColors() { - col_body = COL_FRAME_PLUS_0; + col_body_std = COL_FRAME_PLUS_0; col_shadow = COL_SHADOW_PLUS_0; } + +void CComponentsDetailsLine::setColors(const fb_pixel_t &color_line, const fb_pixel_t &color_shadow) +{ + col_body_std = color_line; + col_shadow = color_shadow; +} diff --git a/src/gui/components/cc_detailsline.h b/src/gui/components/cc_detailsline.h index 44a054f99..b9bf82f0c 100644 --- a/src/gui/components/cc_detailsline.h +++ b/src/gui/components/cc_detailsline.h @@ -61,7 +61,7 @@ class CComponentsDetailsLine : public CComponents virtual~CComponentsDetailsLine(); ///set colors - void setColors(fb_pixel_t color_line, fb_pixel_t color_shadow){col_body = color_line; col_shadow = color_shadow;}; + void setColors(const fb_pixel_t &color_line, const fb_pixel_t &color_shadow); ///set colors with system settings void syncSysColors(); ///set property: lowest y position diff --git a/src/gui/components/cc_draw.cpp b/src/gui/components/cc_draw.cpp index a8a8efc82..e879cab54 100644 --- a/src/gui/components/cc_draw.cpp +++ b/src/gui/components/cc_draw.cpp @@ -43,12 +43,14 @@ CCDraw::CCDraw() : COSDFader(g_settings.theme.menu_Content_alpha) height = height_old = CC_HEIGHT_MIN; width = width_old = CC_WIDTH_MIN; - col_body = col_body_old = COL_MENUCONTENT_PLUS_0; - col_shadow = col_shadow_old = COL_SHADOW_PLUS_0; - col_frame = col_frame_old = COL_FRAME_PLUS_0; - col_shadow_clean = 0; + col_body_std = COL_MENUCONTENT_PLUS_0; + col_body_sel = COL_MENUCONTENTSELECTED_PLUS_0; + col_body_sec = COL_MENUCONTENTINACTIVE_PLUS_0; + col_shadow = col_shadow_old = COL_SHADOW_PLUS_0; + col_frame = col_frame_old = COL_FRAME_PLUS_0; + col_shadow_clean = 0; - cc_body_image = cc_body_image_old = std::string(); + cc_bg_image = cc_bg_image_old = cc_bg_sel_image = cc_bg_sec_image = ""; fr_thickness = fr_thickness_old = 0; @@ -184,9 +186,9 @@ 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; + if (cc_bg_image != cc_bg_image_old){ + dprintf(DEBUG_INFO, "\033[33m[CCDraw]\t[%s - %d], col changes cc_bg_image %s != cc_bg_image_old %s...\033[0m\n", __func__, __LINE__, cc_bg_image.c_str(), cc_bg_image_old.c_str()); + cc_bg_image_old = cc_bg_image; ret = true; } @@ -550,7 +552,7 @@ void CCDraw::paintFbItems(const bool &do_save_bg) /* Paint all fb relevant basic parts (shadow, frame and body) * with all specified properties, paint_bg must be enabled. */ - if (cc_enable_frame && cc_body_image.empty()){ + if (cc_enable_frame && cc_bg_image.empty()){ if (fbtype == CC_FBDATA_TYPE_FRAME) { if (v_fbdata.at(i).frame_thickness > 0 && cc_allow_paint){ frameBuffer->paintBoxFrame(v_fbdata.at(i).x, v_fbdata.at(i).y, v_fbdata.at(i).dx, v_fbdata.at(i).dy, v_fbdata.at(i).frame_thickness, v_fbdata.at(i).color, v_fbdata.at(i).r, v_fbdata.at(i).rtype); @@ -616,8 +618,8 @@ void CCDraw::paintFbItems(const bool &do_save_bg) * 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, v_fbdata.at(i).x, v_fbdata.at(i).y, v_fbdata.at(i).dx, v_fbdata.at(i).dy, CFrameBuffer::TM_NONE)){ + if (!cc_bg_image.empty()){ + if (g_PicViewer->DisplayImage(cc_bg_image, v_fbdata.at(i).x, v_fbdata.at(i).y, v_fbdata.at(i).dx, v_fbdata.at(i).dy, CFrameBuffer::TM_NONE)){ // catch screen and store into paint cache v_fbdata.at(i).pixbuf = getScreen(v_fbdata.at(i).x, v_fbdata.at(i).y, v_fbdata.at(i).dx, v_fbdata.at(i).dy); v_fbdata.at(i).is_painted = true; @@ -631,15 +633,15 @@ void CCDraw::paintFbItems(const bool &do_save_bg) // On failed image paint, write this into log and reset image name. if (!v_fbdata.at(i).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 = ""; + 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_bg_image.c_str()); + cc_bg_image = ""; } } /* 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_bg_image.empty()){ if (cc_body_gradient_enable != CC_COLGRAD_OFF ){ /* If color gradient enabled we create a gradient_data @@ -683,7 +685,7 @@ void CCDraw::paintFbItems(const bool &do_save_bg) } } }else{ - /* If is nothihng cached or no background image was defined or image paint was failed, + /* If is nothing 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__); @@ -871,22 +873,24 @@ bool CCDraw::cancelBlink(bool keep_on_screen) return false; } -bool CCDraw::setBodyBGImage(const std::string& image_path) +bool CCDraw::setBodyBGImage(const std::string& image_path, const std::string& sel_image_path, const std::string& sec_image_path) { - if (cc_body_image == image_path) + if (cc_bg_std_image == image_path && cc_bg_image == image_path && cc_bg_sel_image == sel_image_path && cc_bg_sec_image == sec_image_path) return false; - cc_body_image = image_path; + cc_bg_std_image = cc_bg_image = image_path; + cc_bg_sel_image = sel_image_path; + cc_bg_sec_image = sec_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()); + dprintf(DEBUG_NORMAL, "\033[33m\[CCDraw]\t[%s - %d], body background image defined standard: [%s] selected: [%s], secondary: [%s]\033[0m\n", __func__, __LINE__, cc_bg_image.c_str(), cc_bg_sel_image.c_str(), cc_bg_sec_image.c_str()); return true; } -bool CCDraw::setBodyBGImageName(const std::string& image_name) +bool CCDraw::setBodyBGImageName(const std::string& image_name, const std::string& sel_image_name, const std::string& sec_image_name) { - return setBodyBGImage(frameBuffer->getIconPath(image_name)); + return setBodyBGImage(frameBuffer->getIconPath(image_name), frameBuffer->getIconPath(sel_image_name), frameBuffer->getIconPath(sec_image_name)); } int CCDraw::getXPos() const @@ -931,3 +935,22 @@ bool CCDraw::paintAllowed() { return cc_allow_paint; } + +void CCDraw::setColorBody(const fb_pixel_t &color_std, const fb_pixel_t &color_sel, const fb_pixel_t &color_sec) +{ + if (col_body_std != color_std) + col_body_std = color_std; + + if (color_sel != col_body_sel) + col_body_sel = color_sel; + + if (color_sec != col_body_sec) + col_body_sec = color_sec; +} + +void CCDraw::setColorAll(const fb_pixel_t &color_frame, const fb_pixel_t &color_body, const fb_pixel_t &color_shadow, const fb_pixel_t &color_body_sel, const fb_pixel_t &color_body_sec) +{ + setColorBody(color_body, color_body_sel, color_body_sec); + setColorFrame(color_frame); + setColorShadow(color_shadow); +} diff --git a/src/gui/components/cc_draw.h b/src/gui/components/cc_draw.h index 95ddad29d..bf8544ae4 100644 --- a/src/gui/components/cc_draw.h +++ b/src/gui/components/cc_draw.h @@ -71,7 +71,7 @@ class CCDraw : public COSDFader, public CComponentsSignals, public CCTypes int width, width_old; ///property: color of body - fb_pixel_t col_body, col_body_old; + fb_pixel_t col_body, col_body_old, col_body_std, col_body_sel, col_body_sec; ///property: color of shadow fb_pixel_t col_shadow, col_shadow_old; ///property: color of frame @@ -79,7 +79,7 @@ class CCDraw : public COSDFader, public CComponentsSignals, public CCTypes ///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; + std::string cc_bg_image, cc_bg_image_old, cc_bg_std_image, cc_bg_sel_image, cc_bg_sec_image; ///property: frame thickness, see also setFrameThickness() int fr_thickness, fr_thickness_old; @@ -213,25 +213,29 @@ class CCDraw : public COSDFader, public CComponentsSignals, public CCTypes void setFrameThickness(const int& thickness); ///return of frame thickness int getFrameThickness() const {return fr_thickness;} - ///set frame color - void setColorFrame(fb_pixel_t color){col_frame = color;} void set2ndColor(fb_pixel_t col_2nd){cc_body_gradient_2nd_col = col_2nd;} ///get frame color fb_pixel_t getColorFrame() const {return col_frame;} ///get body color - fb_pixel_t getColorBody() const {return col_body;} + fb_pixel_t getColorBody() const {return col_body_std;} ///get shadow color fb_pixel_t getColorShadow() const {return col_shadow;} ///set body color - void setColorBody(fb_pixel_t color){col_body = color;} + void setColorBody(const fb_pixel_t &color_std, const fb_pixel_t &color_sel = COL_MENUCONTENTSELECTED_PLUS_0, const fb_pixel_t &color_sec = COL_MENUCONTENTINACTIVE_PLUS_0); ///set shadow color - void setColorShadow(fb_pixel_t color){col_shadow = color;} + void setColorShadow(const fb_pixel_t &color){col_shadow = color;} + ///set frame color + void setColorFrame(const fb_pixel_t &color){col_frame = color;} ///set all basic framebuffer element colors at once ///Note: Possible color values are defined in "gui/color.h" and "gui/color_custom.h" - void setColorAll(fb_pixel_t color_frame, fb_pixel_t color_body, fb_pixel_t color_shadow){col_frame = color_frame; col_body = color_body; col_shadow = color_shadow;}; + void setColorAll( const fb_pixel_t &color_frame, + const fb_pixel_t &color_body, + const fb_pixel_t &color_shadow, + const fb_pixel_t &color_body_sel = COL_MENUCONTENTSELECTED_PLUS_0, + const fb_pixel_t &color_body_sec = COL_MENUCONTENTINACTIVE_PLUS_0); ///set corner types ///Possible corner types are defined in CFrameBuffer (see: driver/framebuffer.h) @@ -411,24 +415,44 @@ class CCDraw : public COSDFader, public CComponentsSignals, public CCTypes * @return bool * * @param[in] image_path Path to image. + * @param[in] sel_image_path Path to select image. * * @see * cc_body_image * setBodyBGImageName() */ - bool setBodyBGImage(const std::string& image_path); + bool setBodyBGImage(const std::string& image_path, const std::string& sel_image_path = "", const std::string& sec_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. + * @param[in] sel_image_name Path to select image. * * @see * cc_body_image * setBodyBGImage() */ - bool setBodyBGImageName(const std::string& image_name); + bool setBodyBGImageName(const std::string& image_name, const std::string& sel_image_name = "", const std::string& sec_image_name = ""); + + /**Gets current Path of select background image + * + * @return std::string + */ + std::string getBodyBGImage() {return cc_bg_std_image;} + + /**Gets current Path of default background image + * + * @return std::string + */ + std::string getBodyBGSelectedImage() {return cc_bg_sel_image;} + + /**Gets current Path of secondary background image + * + * @return std::string + */ + std::string getBodyBGSecondaryImage() {return cc_bg_sec_image;} }; #endif diff --git a/src/gui/components/cc_frm_button.cpp b/src/gui/components/cc_frm_button.cpp index b5343f9b5..0458a10b7 100644 --- a/src/gui/components/cc_frm_button.cpp +++ b/src/gui/components/cc_frm_button.cpp @@ -107,7 +107,7 @@ void CComponentsButton::initVarButton( const int& x_pos, const int& y_pos, const cc_body_gradient_enable = CC_COLGRAD_OFF/*g_settings.gradiant*/; //TODO: gradient is prepared for use but disabled at the moment till some other parts of gui parts are provide gradient setColBodyGradient(cc_body_gradient_enable/*CColorGradient::gradientLight2Dark*/, CFrameBuffer::gradientVertical, CColorGradient::light); col_frame = color_frame; - col_body = col_body_old = cc_body_gradient_enable? COL_DARK_GRAY : color_body; + col_body_std = cc_body_gradient_enable? COL_DARK_GRAY : color_body; col_shadow = color_shadow; cc_item_enabled = enabled; diff --git a/src/gui/components/cc_frm_chain.cpp b/src/gui/components/cc_frm_chain.cpp index 432122cc5..efbefa1dd 100644 --- a/src/gui/components/cc_frm_chain.cpp +++ b/src/gui/components/cc_frm_chain.cpp @@ -84,7 +84,7 @@ void CComponentsFrmChain::initVarChain( const int& x_pos, const int& y_pos, cons shadow = shadow_mode; col_frame = color_frame; - col_body = color_body; + col_body_std = color_body; col_shadow = color_shadow; chn_direction = direction; diff --git a/src/gui/components/cc_frm_clock.cpp b/src/gui/components/cc_frm_clock.cpp index 319371814..c7e2a8a69 100644 --- a/src/gui/components/cc_frm_clock.cpp +++ b/src/gui/components/cc_frm_clock.cpp @@ -66,7 +66,7 @@ CComponentsFrmClock::CComponentsFrmClock( const int& x_pos, shadow = shadow_mode; shadow_w = OFFSET_SHADOW; col_frame = color_frame; - col_body = color_body; + col_body_std = color_body; col_shadow = color_shadow; corner_rad = RADIUS_SMALL; @@ -262,7 +262,7 @@ void CComponentsFrmClock::initCCLockItems() //set size, text, color of current item lbl->setDimensionsAll(x_tmp, y_tmp, w_tmp, h_tmp); lbl->setFrameThickness(0); - lbl->setColorAll(col_frame, col_body, col_shadow); + lbl->setColorAll(col_frame, col_body_std, col_shadow); lbl->forceTextPaint(force_repaint); lbl->setText(stmp, CTextBox::CENTER, cl_font, cl_col_text, cl_font_style); diff --git a/src/gui/components/cc_frm_ext_text.cpp b/src/gui/components/cc_frm_ext_text.cpp index 87e19e558..fc381e613 100644 --- a/src/gui/components/cc_frm_ext_text.cpp +++ b/src/gui/components/cc_frm_ext_text.cpp @@ -101,7 +101,7 @@ void CComponentsExtTextForm::initVarExtTextForm(const int& x_pos, const int& y_p ccx_label_color = label_color; ccx_text_color = text_color; col_frame = color_frame; - col_body = color_body; + col_body_std = color_body; col_shadow = color_shadow; ccx_label_obj = NULL; ccx_text_obj = NULL; @@ -125,7 +125,7 @@ void CComponentsExtTextForm::initLabel() if (ccx_label_obj){ //assign general properties ccx_label_obj->setDimensionsAll(0, y_text, ccx_label_width-2*fr_thickness, height-2*fr_thickness); - ccx_label_obj->setColorBody(col_body); + ccx_label_obj->setColorBody(col_body_std); if (cc_body_gradient_enable != cc_body_gradient_enable_old) ccx_label_obj->getCTextBoxObject()->clearScreenBuffer(); ccx_label_obj->setTextColor(ccx_label_color); @@ -149,7 +149,7 @@ void CComponentsExtTextForm::initText() if (ccx_text_obj){ //assign general properties ccx_text_obj->setDimensionsAll(ccx_label_obj->getWidth(), y_text, ccx_text_width-2*fr_thickness, height-2*fr_thickness); - ccx_text_obj->setColorBody(col_body); + ccx_text_obj->setColorBody(col_body_std); if (cc_body_gradient_enable != cc_body_gradient_enable_old) ccx_text_obj->getCTextBoxObject()->clearScreenBuffer(); ccx_text_obj->setTextColor(ccx_text_color); diff --git a/src/gui/components/cc_frm_footer.cpp b/src/gui/components/cc_frm_footer.cpp index a16353a94..74da78f62 100644 --- a/src/gui/components/cc_frm_footer.cpp +++ b/src/gui/components/cc_frm_footer.cpp @@ -88,9 +88,9 @@ void CComponentsFooter::initVarFooter( const int& x_pos, const int& y_pos, const ccf_button_shadow_width = shadow ? OFFSET_SHADOW/2 : 0; ccf_button_shadow_force_paint = false; ccf_button_container_y = -1; //centered as default - col_frame = col_frame_old = color_frame; - col_body = col_body_old = color_body; - col_shadow = col_shadow_old = color_shadow; + col_frame = color_frame; + col_body_std = color_body; + col_shadow = color_shadow; cc_body_gradient_enable = cc_body_gradient_enable_old = CC_COLGRAD_OFF/*g_settings.theme.menu_ButtonBar_gradient*/; //TODO: not complete implemented at the moment cc_body_gradient_direction = CFrameBuffer::gradientVertical; cc_body_gradient_mode = CColorGradient::gradientDark2Light; @@ -182,7 +182,7 @@ void CComponentsFooter::setButtonLabels(const struct button_label_cc * const con if (cch_icon_obj) x_container = cch_offset+cch_icon_obj->getWidth()+cch_offset; if (btn_container == NULL){ - btn_container = new CComponentsFrmChain(x_container, y_container, w_container, h_container, 0, CC_DIR_X, this, CC_SHADOW_OFF, COL_MENUCONTENT_PLUS_6, col_body); + btn_container = new CComponentsFrmChain(x_container, y_container, w_container, h_container, 0, CC_DIR_X, this, CC_SHADOW_OFF, COL_MENUCONTENT_PLUS_6, col_body_std); btn_container->setItemName(cc_parent ? cc_parent->getItemName() + ":" + getItemName() + ":btn_container" : ""); btn_container->setAppendOffset(0, 0); //btn_container->setCorner(this->corner_rad, this->corner_type); diff --git a/src/gui/components/cc_frm_header.cpp b/src/gui/components/cc_frm_header.cpp index 0aff321e1..57e6fe3c4 100644 --- a/src/gui/components/cc_frm_header.cpp +++ b/src/gui/components/cc_frm_header.cpp @@ -132,9 +132,9 @@ void CComponentsHeader::initVarHeader( const int& x_pos, const int& y_pos, const CNeutrinoApp::getInstance()->OnAfterSetupFonts.connect(sigc::mem_fun(this, &CComponentsHeader::resetFont)); - shadow = shadow_mode; - col_frame = col_frame_old = color_frame; - col_body = col_body_old = color_body; + shadow = shadow_mode; + col_frame = color_frame; + col_body_std = color_body; col_shadow = col_shadow_old = color_shadow; cc_body_gradient_enable = cc_body_gradient_enable_old = (cch_size_mode == CC_HEADER_SIZE_SMALL ? g_settings.theme.menu_SubHead_gradient : g_settings.theme.menu_Head_gradient); @@ -180,7 +180,7 @@ void CComponentsHeader::initVarHeader( const int& x_pos, const int& y_pos, const } void CComponentsHeader::initRepaintSlot(){ - sl_form_repaint = sigc::bind(sigc::mem_fun(*this, &CComponentsHeader::kill), cc_parent ? col_body : 0, -1, CC_FBDATA_TYPES, false); + sl_form_repaint = sigc::bind(sigc::mem_fun(*this, &CComponentsHeader::kill), cc_parent ? col_body_std : 0, -1, CC_FBDATA_TYPES, false); OnBeforeRePaint.connect(sl_form_repaint); } @@ -667,7 +667,7 @@ void CComponentsHeader::initCaption() //assign general properties cch_text_obj->setDimensionsAll(cch_text_x, cch_items_y, cc_text_w, height); - cch_text_obj->setColorBody(col_body); + cch_text_obj->setColorBody(col_body_std); if (cc_body_gradient_enable != cc_body_gradient_enable_old) cch_text_obj->getCTextBoxObject()->clearScreenBuffer(); cch_text_obj->setText(cch_text, cch_caption_align, cch_font, cch_col_text); @@ -694,7 +694,7 @@ void CComponentsHeader::initCCItems() initCaptionFont(); //set basic properties - Init(x, y, width, height, col_frame, col_body, col_shadow); + Init(x, y, width, height, col_frame, col_body_std, col_shadow); //init icon initIcon(); diff --git a/src/gui/components/cc_frm_icons.cpp b/src/gui/components/cc_frm_icons.cpp index c67e67d19..7ada19ff4 100644 --- a/src/gui/components/cc_frm_icons.cpp +++ b/src/gui/components/cc_frm_icons.cpp @@ -64,7 +64,7 @@ void CComponentsIconForm::initVarIconForm( const int &x_pos, const int &y_pos, c v_icons = v_icon_names; shadow = shadow_mode; col_frame = color_frame; - col_body = color_body; + col_body_std = color_body; col_shadow = color_shadow; chn_direction = CC_DIR_X; diff --git a/src/gui/components/cc_frm_scrollbar.cpp b/src/gui/components/cc_frm_scrollbar.cpp index 8a4a8137a..be317a3a2 100644 --- a/src/gui/components/cc_frm_scrollbar.cpp +++ b/src/gui/components/cc_frm_scrollbar.cpp @@ -40,7 +40,7 @@ using namespace std; | | sb_up_obj (icon)| |/color_frame | | /\ | | | +-----------------+ | |/color_shadow - | col_body | | + | col_body_std | | | | | +-sb_segments_obj+ | | | | | @@ -162,7 +162,7 @@ void CComponentsScrollBar::initSegments() sb_segments_obj->setDimensionsAll(CC_CENTERED, CC_APPEND, w_seg, h_seg_obj); //set current color for segment container - sb_segments_obj->setColorBody(col_body); + sb_segments_obj->setColorBody(col_body_std); //clean up segment container before add new segments sb_segments_obj->clear(); @@ -182,7 +182,7 @@ void CComponentsScrollBar::initSegments() tmp_quot = uint32_t((float)sb_segments_count/(float)tmp_segments + 0.5); } - fb_pixel_t passive_col = sb_visual_enable ? sb_segment_col : col_body; + fb_pixel_t passive_col = sb_visual_enable ? sb_segment_col : col_body_std; //create and add segments to segment container for(uint32_t i=0; isetCorner(RADIUS_MIN, CORNER_ALL); continue; }else if (tmp_segments == 1){ diff --git a/src/gui/components/cc_frm_signalbars.cpp b/src/gui/components/cc_frm_signalbars.cpp index dd05204b3..10b5262b6 100644 --- a/src/gui/components/cc_frm_signalbars.cpp +++ b/src/gui/components/cc_frm_signalbars.cpp @@ -109,7 +109,7 @@ void CSignalBar::initSBItems() { if (cc_parent){ //use backround color of parent form if signalbar is embedded - col_body = cc_parent->getColorBody(); + col_body_std = cc_parent->getColorBody(); //and set required color for text to name label CSignalBox *sbx = static_cast(cc_parent); @@ -133,7 +133,7 @@ void CSignalBar::initSBarScale() //move and set dimensions int scale_y = (sb_item_height/2 - sb_scale_height/2); sb_scale->setDimensionsAll(fr_thickness, scale_y, sb_scale_width, sb_scale_height); - sb_scale->setColorBody(col_body); + sb_scale->setColorBody(col_body_std); sb_scale->setActiveColor(sb_active_color); sb_scale->setPassiveColor(sb_passive_color); //add scale object to container @@ -160,7 +160,7 @@ void CSignalBar::initSBarValue() //set current text and body color color sb_vlbl->setTextColor(sb_caption_color); - sb_vlbl->setColorBody(col_body); + sb_vlbl->setColorBody(col_body_std); //add value label object to container if (!sb_vlbl->isAdded()) @@ -187,7 +187,7 @@ void CSignalBar::initSBarName() //set current text and body color sb_lbl->setTextColor(sb_caption_color); - sb_lbl->setColorBody(col_body); + sb_lbl->setColorBody(col_body_std); //add name label object to container if (!sb_lbl->isAdded()) diff --git a/src/gui/components/cc_frm_window.cpp b/src/gui/components/cc_frm_window.cpp index 7918f6b81..93671a3d4 100644 --- a/src/gui/components/cc_frm_window.cpp +++ b/src/gui/components/cc_frm_window.cpp @@ -152,7 +152,7 @@ void CComponentsWindow::init( const int& x_pos, const int& y_pos, const int& w, paint_bg = true; shadow = shadow_mode; col_frame = color_frame; - col_body = color_body; + col_body_std = color_body; col_shadow = color_shadow; ccw_head = NULL; @@ -317,7 +317,7 @@ void CComponentsWindow::initBody() ccw_body->setDimensionsAll(x_body, h_header, w_body, h_body); ccw_body->doPaintBg(paint_bg); - ccw_body->setColorBody(col_body); + ccw_body->setColorBody(col_body_std); //handle corner behavior if (!ccw_show_header) diff --git a/src/gui/components/cc_item.cpp b/src/gui/components/cc_item.cpp index 84a6cb477..4f97170f6 100644 --- a/src/gui/components/cc_item.cpp +++ b/src/gui/components/cc_item.cpp @@ -67,6 +67,21 @@ void CComponentsItem::initParent(CComponentsForm* parent) // If backround is not required, it's possible to override this with variable paint_bg=false, use doPaintBg(true/false) to set this! void CComponentsItem::paintInit(const bool &do_save_bg) { + if (cc_parent) + { //use defined background color and background images in dependency of focus mode + if (cc_parent->hasFocus()){ + col_body = cc_item_selected ? col_body_sel : col_body_std; + cc_bg_image = cc_item_selected ? cc_bg_sel_image : cc_bg_std_image; + } + else{ + col_body = cc_item_selected ? col_body_sec : col_body_std; + cc_bg_image = cc_item_selected ? cc_bg_sec_image : cc_bg_std_image; + } + } + else + col_body = cc_item_selected ? col_body_sel : col_body_std; + + // check possible changed properties and force reinit if required if (hasChanges()){ clearFbData(); is_painted = false; //force repaint if required @@ -292,12 +307,18 @@ void CComponentsItem::setFocus(bool focus) cc_has_focus = focus; } -void CComponentsItem::setSelected(bool selected, const fb_pixel_t& sel_frame_col, const fb_pixel_t& frame_col, const fb_pixel_t& sel_body_col, const fb_pixel_t& body_col, const int& frame_w, const int& sel_frame_w) +void CComponentsItem::setSelected( bool selected, + const fb_pixel_t& sel_frame_col, + const fb_pixel_t& frame_col, + const fb_pixel_t& sel_body_col, + const fb_pixel_t& body_col, + const int& frame_w, + const int& sel_frame_w) { cc_item_selected = selected; fr_thickness = cc_item_selected ? sel_frame_w : frame_w; - col_body = cc_item_selected ? sel_body_col : body_col; - col_frame = cc_item_selected ? sel_frame_col : frame_col; + col_frame = cc_item_selected ? sel_frame_col : frame_col; + setColorAll(col_frame, body_col, col_shadow, sel_body_col, COL_MENUCONTENT_PLUS_1); } uint8_t CComponentsItem::getPageNumber() const diff --git a/src/gui/components/cc_item_infobox.cpp b/src/gui/components/cc_item_infobox.cpp index 5c13d1d0e..d07ca8c5b 100644 --- a/src/gui/components/cc_item_infobox.cpp +++ b/src/gui/components/cc_item_infobox.cpp @@ -59,7 +59,7 @@ CComponentsInfoBox::CComponentsInfoBox( const int& x_pos, shadow = shadow_mode; col_frame = color_frame; cc_enable_frame = true; - col_body = color_body; + col_body_std = color_body; col_shadow = color_shadow; ct_text = info_text; @@ -124,7 +124,7 @@ void CComponentsInfoBox::paintPicture() string image = frameBuffer->getIconPath(pic_name); pic = new CComponentsPicture(x_pic+x_offset, y_pic, pic_width, min(pic_height, height-2*fr_thickness), image); //NOTE: icons do not scale! - pic->setColorBody(col_body); + pic->setColorBody(col_body_std); //set gradient behavior of pic object if (cc_body_gradient_enable) diff --git a/src/gui/components/cc_item_picture.cpp b/src/gui/components/cc_item_picture.cpp index 02f03519c..14b368617 100644 --- a/src/gui/components/cc_item_picture.cpp +++ b/src/gui/components/cc_item_picture.cpp @@ -82,9 +82,9 @@ void CComponentsPicture::init( const int &x_pos, const int &y_pos, const int &w, shadow = shadow_mode; shadow_w = OFFSET_SHADOW; col_frame = color_frame; - col_body = color_background; + col_body_std = color_background; col_shadow = color_shadow; - col_shadow_clean= col_body; + col_shadow_clean= col_body_std; do_scale = allow_scale; image_cache = NULL; //image enable_cache = false; @@ -323,7 +323,7 @@ void CComponentsPicture::paintPicture() if (do_scale) is_image_painted = g_PicViewer->DisplayImage(pic_name, x_pic, y_pic, width-2*fr_thickness, height-2*fr_thickness); else - is_image_painted = frameBuffer->paintIcon(pic_name, x_pic, y_pic, height, 1, do_paint, paint_bg, col_body); + is_image_painted = frameBuffer->paintIcon(pic_name, x_pic, y_pic, height, 1, do_paint, paint_bg, col_body_std); if (is_image_painted){ frameBuffer->SetTransparentDefault(); diff --git a/src/gui/components/cc_item_progressbar.cpp b/src/gui/components/cc_item_progressbar.cpp index 02c574666..c083efb09 100644 --- a/src/gui/components/cc_item_progressbar.cpp +++ b/src/gui/components/cc_item_progressbar.cpp @@ -64,7 +64,7 @@ CProgressBar::CProgressBar( const int x_pos, height = height_old = h; col_frame = color_frame; - col_body = color_body; + col_body_std = color_body; col_shadow = color_shadow; pb_red = R; @@ -396,7 +396,7 @@ void CProgressBar::paintProgress(const bool &do_save_bg) initDimensions(); //body - if (pb_last_width == -1 && col_body != 0) /* first paint */ + if (pb_last_width == -1 && col_body_std != 0) /* first paint */ paintInit(do_save_bg); //progress diff --git a/src/gui/components/cc_item_shapes.cpp b/src/gui/components/cc_item_shapes.cpp index e9f412453..fa38fafb1 100644 --- a/src/gui/components/cc_item_shapes.cpp +++ b/src/gui/components/cc_item_shapes.cpp @@ -51,7 +51,7 @@ CComponentsShapeSquare::CComponentsShapeSquare( const int x_pos, const int y_pos shadow = shadow_mode; shadow_w = OFFSET_SHADOW; col_frame = color_frame; - col_body = color_body; + col_body_std = color_body; col_shadow = color_shadow; initParent(parent); } @@ -83,7 +83,7 @@ CComponentsShapeCircle::CComponentsShapeCircle( int x_pos, int y_pos, int diam, shadow = shadow_mode; shadow_w = OFFSET_SHADOW; col_frame = color_frame; - col_body = color_body; + col_body_std = color_body; col_shadow = color_shadow; //CComponentsShapeCircle diff --git a/src/gui/components/cc_item_text.cpp b/src/gui/components/cc_item_text.cpp index ab3c8c3d3..f739a079f 100644 --- a/src/gui/components/cc_item_text.cpp +++ b/src/gui/components/cc_item_text.cpp @@ -103,7 +103,7 @@ void CComponentsText::initVarText( const int x_pos, const int y_pos, const int w ct_col_text = color_text; ct_old_col_text = ct_col_text; col_frame = color_frame; - col_body = color_body; + col_body_std = color_body; col_shadow = color_shadow; ct_text_sent = false; @@ -170,7 +170,7 @@ void CComponentsText::initCCText() ct_textbox->setWindowMinDimensions(ct_box.iWidth, ct_box.iHeight); ct_textbox->setTextBorderWidth(ct_text_Hborder, ct_text_Vborder); ct_textbox->enableBackgroundPaint(enable_bg_paint); - ct_textbox->setBackGroundColor(col_body); + ct_textbox->setBackGroundColor(col_body_std); ct_textbox->setBackGroundRadius(0/*(corner_type ? corner_rad-fr_thickness : 0), corner_type*/); ct_textbox->enableSaveScreen(enable_save_screen); diff --git a/src/gui/components/cc_item_text.h b/src/gui/components/cc_item_text.h index 66ad95938..aef449601 100644 --- a/src/gui/components/cc_item_text.h +++ b/src/gui/components/cc_item_text.h @@ -147,9 +147,14 @@ class CComponentsText : public CCTextScreen, public CComponentsItem void setTextColor(const fb_pixel_t& color_text); ///set all basic framebuffer element colors at once ///Note: Possible color values are defined in "gui/color.h" and "gui/color_custom.h" - void setColorAll(fb_pixel_t color_frame, fb_pixel_t color_body, fb_pixel_t color_shadow = COL_SHADOW_PLUS_0, fb_pixel_t color_text = COL_MENUCONTENT_TEXT) + void setColorAll( const fb_pixel_t& color_frame, + const fb_pixel_t& color_body, + const fb_pixel_t& color_shadow = COL_SHADOW_PLUS_0, + const fb_pixel_t& color_text = COL_MENUCONTENT_TEXT, + const fb_pixel_t& color_body_sel = COL_MENUCONTENTSELECTED_PLUS_0, + const fb_pixel_t& color_body_sec = COL_MENUCONTENTINACTIVE_PLUS_0) { - CCDraw::setColorAll(color_frame, color_body, color_shadow); + CCDraw::setColorAll(color_frame, color_body, color_shadow, color_body_sel, color_body_sec); setTextColor(color_text); }; ///get text color diff --git a/src/gui/components/cc_item_tvpic.cpp b/src/gui/components/cc_item_tvpic.cpp index a4926892d..6c589662f 100644 --- a/src/gui/components/cc_item_tvpic.cpp +++ b/src/gui/components/cc_item_tvpic.cpp @@ -62,7 +62,7 @@ CComponentsPIP::CComponentsPIP( const int x_pos, const int y_pos, const int perc shadow = shadow_mode; shadow_w = OFFSET_SHADOW; col_frame = color_frame; - col_body = color_body; + col_body_std = color_body; col_shadow = color_shadow; fr_thickness = 2; corner_rad = RADIUS_SMALL; diff --git a/src/gui/volumebar.cpp b/src/gui/volumebar.cpp index c19ac7919..b67bce4b3 100644 --- a/src/gui/volumebar.cpp +++ b/src/gui/volumebar.cpp @@ -50,7 +50,7 @@ CVolumeBar::CVolumeBar() void CVolumeBar::initVarVolumeBar() { - col_body = COL_MENUCONTENT_PLUS_0; + col_body_std = COL_MENUCONTENT_PLUS_0; corner_rad = CORNER_RADIUS_MID; vb_item_offset = OFFSET_INNER_SMALL; height = CFrameBuffer::getInstance()->scale2Res(g_settings.volume_size); @@ -183,7 +183,7 @@ void CVolumeBar::initVolumeBarIcon() } vb_icon->setDimensionsAll(vb_icon_x, CC_CENTERED, vb_icon_w, height); - vb_icon->setColorBody(col_body); + vb_icon->setColorBody(col_body_std); vb_icon->setCorner(corner_rad, CORNER_LEFT); } @@ -205,7 +205,7 @@ void CVolumeBar::initVolumeBarScale() //set digit text with current volume value void CVolumeBar::initVolumeBarDigitValue() { - vb_digit->kill(col_body); + vb_digit->kill(col_body_std); vb_digit->setText(*vb_vol ,vb_digit_mode, *(CVolumeHelper::getInstance()->vb_font)); } diff --git a/src/gui/widget/hintbox.cpp b/src/gui/widget/hintbox.cpp index 5a385ebd3..c74905471 100644 --- a/src/gui/widget/hintbox.cpp +++ b/src/gui/widget/hintbox.cpp @@ -163,7 +163,7 @@ void CHintBox::init( const std::string& Text, w_indentation = indent; col_frame = color_frame; - col_body = color_body; + col_body_std = color_body; col_shadow = color_shadow; fr_thickness = g_settings.theme.message_frame_enable ? frame_width : 0; diff --git a/src/gui/widget/msgbox.cpp b/src/gui/widget/msgbox.cpp index 1ab6713ad..70c1c68a8 100644 --- a/src/gui/widget/msgbox.cpp +++ b/src/gui/widget/msgbox.cpp @@ -103,7 +103,7 @@ void CMsgBox::init( const int& Height, initTimeOut(); col_frame = color_frame; - col_body = color_body; + col_body_std = color_body; col_shadow = color_shadow; fr_thickness = g_settings.theme.message_frame_enable || col_frame != HINTBOX_DEFAULT_FRAME_COLOR ? frame_width : 0; diff --git a/src/gui/widget/progresswindow.cpp b/src/gui/widget/progresswindow.cpp index 0c25cd43f..cdd34195e 100644 --- a/src/gui/widget/progresswindow.cpp +++ b/src/gui/widget/progresswindow.cpp @@ -93,7 +93,7 @@ void CProgressWindow::Init( signal *statusSignal, //create status text object status_txt = new CComponentsLabel(); status_txt->setDimensionsAll(OFFSET_INNER_MID, OFFSET_INNER_MID, width-2*OFFSET_INNER_MID, g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->getHeight()); - status_txt->setColorBody(col_body); + status_txt->setColorBody(col_body_std); status_txt->doPaintTextBoxBg(true); status_txt->doPaintBg(false); addWindowItem(status_txt); @@ -125,7 +125,7 @@ CProgressBar* CProgressWindow::getProgressItem() y_tmp += OFFSET_INNER_MID; } pBar->setDimensionsAll(OFFSET_INNER_MID, y_tmp, width-2*OFFSET_INNER_MID, g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->getHeight()); - pBar->setColorBody(col_body); + pBar->setColorBody(col_body_std); pBar->setActiveColor(COL_PROGRESSBAR_ACTIVE_PLUS_0); pBar->setFrameThickness(FRAME_WIDTH_MIN); pBar->setColorFrame(COL_PROGRESSBAR_ACTIVE_PLUS_0);