From be40e67b702708b747bea5b1bd3da3a0464e3b17 Mon Sep 17 00:00:00 2001 From: vanhofen Date: Mon, 10 Oct 2016 14:19:55 +0200 Subject: [PATCH] - colors: add COL_PROGRESSBAR wrapper --- src/gui/color.h | 5 +++++ src/gui/components/cc_frm_signalbars.cpp | 21 ++++++++++++++++----- src/gui/components/cc_frm_signalbars.h | 22 ++++++++++++++++++++++ src/gui/components/cc_item_progressbar.h | 4 ++-- src/gui/lua/lua_api_version.h | 2 +- src/gui/lua/luainstance.cpp | 4 ++++ src/gui/widget/progresswindow.cpp | 8 ++++---- 7 files changed, 54 insertions(+), 12 deletions(-) diff --git a/src/gui/color.h b/src/gui/color.h index be4ea41cb..e707c4318 100644 --- a/src/gui/color.h +++ b/src/gui/color.h @@ -128,6 +128,11 @@ #define COL_SCROLLBAR_PASSIVE COL_MENUCONTENT_PLUS_1 #define COL_SCROLLBAR_PASSIVE_PLUS_0 COL_SCROLLBAR_PASSIVE +#define COL_PROGRESSBAR_ACTIVE COL_MENUCONTENT_PLUS_7 +#define COL_PROGRESSBAR_ACTIVE_PLUS_0 COL_PROGRESSBAR_ACTIVE +#define COL_PROGRESSBAR_PASSIVE COL_MENUCONTENT_PLUS_1 +#define COL_PROGRESSBAR_PASSIVE_PLUS_0 COL_PROGRESSBAR_PASSIVE + int convertSetupColor2RGB(unsigned char r, unsigned char g, unsigned char b); int convertSetupAlpha2Alpha(unsigned char alpha); diff --git a/src/gui/components/cc_frm_signalbars.cpp b/src/gui/components/cc_frm_signalbars.cpp index 4dc677e93..8677bf3e3 100644 --- a/src/gui/components/cc_frm_signalbars.cpp +++ b/src/gui/components/cc_frm_signalbars.cpp @@ -59,7 +59,9 @@ void CSignalBar::initVarSigBar(const int& xpos, const int& ypos, const int& w, c sb_scale_height = -1; dy_font = CNeutrinoFonts::getInstance(); - sb_caption_color= COL_INFOBAR_TEXT; + sb_caption_color= COL_MENUCONTENT_TEXT; + sb_active_color = COL_PROGRESSBAR_ACTIVE_PLUS_0; + sb_passive_color= COL_PROGRESSBAR_PASSIVE_PLUS_0; sb_val_mode = CTextBox::NO_AUTO_LINEBREAK | CTextBox::RIGHT; sb_lastsig = 0; @@ -109,6 +111,8 @@ void CSignalBar::initSBItems() //and set required color for text to name label CSignalBox *sbx = static_cast(cc_parent); sb_caption_color = sbx->getTextColor(); + sb_active_color = sbx->getActiveColor(); + sb_passive_color = sbx->getPassiveColor(); } //init items scale, value and name @@ -127,11 +131,11 @@ void CSignalBar::initSBarScale() 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->setActiveColor(sb_active_color); + sb_scale->setPassiveColor(sb_passive_color); //add scale object to container if(!sb_scale->isAdded()) addCCItem(sb_scale); - } void CSignalBar::initSBarValue() @@ -182,7 +186,6 @@ void CSignalBar::initSBarName() sb_lbl->setTextColor(sb_caption_color); sb_lbl->setColorBody(col_body); - //add name label object to container if (!sb_lbl->isAdded()) addCCItem(sb_lbl); @@ -295,7 +298,9 @@ void CSignalBox::initVarSigBox() height = 3* SB_MIN_HEIGHT; sbx_bar_height = height/2; sbx_bar_x = corner_rad; - sbx_caption_color = COL_INFOBAR_TEXT; + sbx_caption_color = COL_MENUCONTENT_TEXT; + sbx_active_color = COL_PROGRESSBAR_ACTIVE_PLUS_0; + sbx_passive_color = COL_PROGRESSBAR_PASSIVE_PLUS_0; vertical = true; } @@ -316,12 +321,18 @@ void CSignalBox::initSignalItems() sbar->setDimensionsAll(sbar_x, 1, sbar_w, sbar_h); sbar->setFrontEnd(sbx_frontend); + sbar->setTextColor(sbx_caption_color); + sbar->setActiveColor(sbx_active_color); + sbar->setPassiveColor(sbx_passive_color); sbar->setCorner(0); sbar->setScaleHeight(scale_h); sbar->enableTboxSaveScreen(cc_txt_save_screen); snrbar->setDimensionsAll(vertical ? sbar_x : CC_APPEND, vertical ? CC_APPEND : 1, sbar_w, sbar_h); snrbar->setFrontEnd(sbx_frontend); + snrbar->setTextColor(sbx_caption_color); + snrbar->setActiveColor(sbx_active_color); + snrbar->setPassiveColor(sbx_passive_color); snrbar->setCorner(0); snrbar->setScaleHeight(scale_h); snrbar->enableTboxSaveScreen(cc_txt_save_screen); diff --git a/src/gui/components/cc_frm_signalbars.h b/src/gui/components/cc_frm_signalbars.h index b69516a6c..69ce46e09 100644 --- a/src/gui/components/cc_frm_signalbars.h +++ b/src/gui/components/cc_frm_signalbars.h @@ -69,6 +69,10 @@ class CSignalBar : public CComponentsForm, public CCTextScreen CNeutrinoFonts *dy_font; ///property: text color, see also setTextColor() fb_pixel_t sb_caption_color; + ///property: active color, see also setActiveColor() + fb_pixel_t sb_active_color; + ///property: passive color, see also setPassiveColor() + fb_pixel_t sb_passive_color; ///property: item top position int sb_item_top; @@ -121,6 +125,10 @@ class CSignalBar : public CComponentsForm, public CCTextScreen virtual void setTextFont(Font* font_text){sb_font = font_text;}; ///sets the caption color, see also property 'sb_caption_color' virtual void setTextColor(const fb_pixel_t& caption_color){ sb_caption_color = caption_color;}; + ///set active color, see also property 'sb_active_color' + virtual void setActiveColor(const fb_pixel_t& active_color){ sb_active_color = active_color;}; + ///set passive color, see also property 'sb_passive_color' + virtual void setPassiveColor(const fb_pixel_t& passive_color){ sb_passive_color = passive_color;}; ///assigns the height of scale virtual void setScaleHeight(const int& scale_height){sb_scale_height = scale_height;}; ///assigns the width of scale @@ -277,6 +285,10 @@ class CSignalBox : public CComponentsForm, public CCTextScreen int sbx_bar_x; ///property: text color, see also setTextColor() fb_pixel_t sbx_caption_color; + ///property: active color, see also setActiveColor() + fb_pixel_t sbx_active_color; + ///property: passive color, see also setPassiveColor() + fb_pixel_t sbx_passive_color; // true if vertical arrangement, false if horizontal bool vertical; @@ -306,6 +318,16 @@ class CSignalBox : public CComponentsForm, public CCTextScreen ///get caption color of signalbars, see also property 'sbx_caption_color' fb_pixel_t getTextColor(){return sbx_caption_color;}; + ///set active color of signalbars, see also property 'sbx_active_color' + void setActiveColor(const fb_pixel_t& active_color){ sbx_active_color = active_color;}; + ///get active color of signalbars, see also property 'sbx_active_color' + fb_pixel_t getActiveColor(){return sbx_active_color;}; + + ///set passive color of signalbars, see also property 'sbx_passive_color' + void setPassiveColor(const fb_pixel_t& passive_color){ sbx_passive_color = passive_color;}; + ///get passive color of signalbars, see also property 'sbx_passive_color' + fb_pixel_t getPassiveColor(){return sbx_passive_color;}; + ///paint items void paint(bool do_save_bg); diff --git a/src/gui/components/cc_item_progressbar.h b/src/gui/components/cc_item_progressbar.h index 8c9c94129..c346d600e 100644 --- a/src/gui/components/cc_item_progressbar.h +++ b/src/gui/components/cc_item_progressbar.h @@ -101,8 +101,8 @@ class CProgressBar : public CComponentsItem fb_pixel_t color_frame = 0, fb_pixel_t color_body = COL_MENUCONTENT_PLUS_0, fb_pixel_t color_shadow = COL_SHADOW_PLUS_0, - const fb_pixel_t active_col = COL_INFOBAR_PLUS_7, - const fb_pixel_t passive_col = COL_INFOBAR_PLUS_3, + const fb_pixel_t active_col = COL_PROGRESSBAR_ACTIVE_PLUS_0, + const fb_pixel_t passive_col = COL_PROGRESSBAR_PASSIVE_PLUS_0, const int R = 40, const int G = 100, const int Y = 70, diff --git a/src/gui/lua/lua_api_version.h b/src/gui/lua/lua_api_version.h index 416580970..9c36a6594 100644 --- a/src/gui/lua/lua_api_version.h +++ b/src/gui/lua/lua_api_version.h @@ -4,4 +4,4 @@ * to luainstance.h changes */ #define LUA_API_VERSION_MAJOR 1 -#define LUA_API_VERSION_MINOR 64 +#define LUA_API_VERSION_MINOR 65 diff --git a/src/gui/lua/luainstance.cpp b/src/gui/lua/luainstance.cpp index 7bd4764b5..dc6f5c2a0 100644 --- a/src/gui/lua/luainstance.cpp +++ b/src/gui/lua/luainstance.cpp @@ -174,6 +174,8 @@ static void set_lua_variables(lua_State *L) { "FRAME", MAGIC_COLOR | (COL_FRAME) }, { "SCROLLBAR_ACTIVE", MAGIC_COLOR | (COL_SCROLLBAR_ACTIVE) }, { "SCROLLBAR_PASSIVE", MAGIC_COLOR | (COL_SCROLLBAR_PASSIVE) }, + { "PROGRESSBAR_ACTIVE", MAGIC_COLOR | (COL_PROGRESSBAR_ACTIVE) }, + { "PROGRESSBAR_PASSIVE", MAGIC_COLOR | (COL_PROGRESSBAR_PASSIVE) }, { "BACKGROUND", MAGIC_COLOR | (COL_BACKGROUND) }, { "DARK_RED", MAGIC_COLOR | (COL_DARK_RED0) }, { "DARK_GREEN", MAGIC_COLOR | (COL_DARK_GREEN0) }, @@ -223,6 +225,8 @@ static void set_lua_variables(lua_State *L) { "FRAME_PLUS_0", (lua_Unsigned) (COL_FRAME_PLUS_0) }, { "SCROLLBAR_ACTIVE_PLUS_0", (lua_Unsigned) (COL_SCROLLBAR_ACTIVE_PLUS_0) }, { "SCROLLBAR_PASSIVE_PLUS_0", (lua_Unsigned) (COL_SCROLLBAR_PASSIVE_PLUS_0) }, + { "PROGRESSBAR_ACTIVE_PLUS_0", (lua_Unsigned) (COL_PROGRESSBAR_ACTIVE_PLUS_0) }, + { "PROGRESSBAR_PASSIVE_PLUS_0", (lua_Unsigned) (COL_PROGRESSBAR_PASSIVE_PLUS_0) }, { NULL, 0 } }; diff --git a/src/gui/widget/progresswindow.cpp b/src/gui/widget/progresswindow.cpp index 8e992cf1c..c7decf8fa 100644 --- a/src/gui/widget/progresswindow.cpp +++ b/src/gui/widget/progresswindow.cpp @@ -67,9 +67,9 @@ void CProgressWindow::Init() local_bar->allowPaint(false); local_bar->setDimensionsAll(x_item, y_item, w_item, h_pbar); local_bar->setColorBody(col_body); - local_bar->setActiveColor(COL_MENUCONTENT_PLUS_7); + local_bar->setActiveColor(COL_PROGRESSBAR_ACTIVE_PLUS_0); local_bar->setFrameThickness(w_bar_frame); - local_bar->setColorFrame(COL_MENUCONTENT_PLUS_7); + local_bar->setColorFrame(COL_PROGRESSBAR_ACTIVE_PLUS_0); addWindowItem(local_bar); y_item += 2*h_pbar; @@ -78,9 +78,9 @@ void CProgressWindow::Init() global_bar->allowPaint(false); global_bar->setDimensionsAll(x_item, y_item, w_item, h_pbar); global_bar->setColorBody(col_body); - global_bar->setActiveColor(COL_MENUCONTENT_PLUS_7); + global_bar->setActiveColor(COL_PROGRESSBAR_ACTIVE_PLUS_0); global_bar->setFrameThickness(w_bar_frame); - global_bar->setColorFrame(COL_MENUCONTENT_PLUS_7); + global_bar->setColorFrame(COL_PROGRESSBAR_ACTIVE_PLUS_0); addWindowItem(global_bar); y_item += 2*h_pbar;