CColorChooser: Preview color gradient for header color

Origin commit data
------------------
Branch: ni/coolstream
Commit: 8c3b26fc76
Author: Michael Liebmann <tuxcode.bbg@gmail.com>
Date: 2014-11-26 (Wed, 26 Nov 2014)


------------------
No further description and justification available within origin commit message!

------------------
This commit was generated by Migit
This commit is contained in:
Michael Liebmann
2014-11-26 09:27:59 +01:00
parent e5a6d55619
commit 0368ac717f
3 changed files with 33 additions and 5 deletions

View File

@@ -642,8 +642,10 @@ void COsdSetup::showOsdMenueColorSetup(CMenuWidget *menu_colors)
CColorChooser* chHeadcolor = new CColorChooser(LOCALE_COLORMENU_BACKGROUND, &t.menu_Head_red, &t.menu_Head_green, &t.menu_Head_blue, CColorChooser* chHeadcolor = new CColorChooser(LOCALE_COLORMENU_BACKGROUND, &t.menu_Head_red, &t.menu_Head_green, &t.menu_Head_blue,
&t.menu_Head_alpha, colorSetupNotifier); &t.menu_Head_alpha, colorSetupNotifier);
chHeadcolor->setGradient(CColorChooser::gradient_head_body);
CColorChooser* chHeadTextcolor = new CColorChooser(LOCALE_COLORMENU_TEXTCOLOR, &t.menu_Head_Text_red, &t.menu_Head_Text_green, &t.menu_Head_Text_blue, CColorChooser* chHeadTextcolor = new CColorChooser(LOCALE_COLORMENU_TEXTCOLOR, &t.menu_Head_Text_red, &t.menu_Head_Text_green, &t.menu_Head_Text_blue,
NULL, colorSetupNotifier); NULL, colorSetupNotifier);
chHeadTextcolor->setGradient(CColorChooser::gradient_head_text);
CColorChooser* chContentcolor = new CColorChooser(LOCALE_COLORMENU_BACKGROUND, &t.menu_Content_red, &t.menu_Content_green, &t.menu_Content_blue, CColorChooser* chContentcolor = new CColorChooser(LOCALE_COLORMENU_BACKGROUND, &t.menu_Content_red, &t.menu_Content_green, &t.menu_Content_blue,
&t.menu_Content_alpha, colorSetupNotifier); &t.menu_Content_alpha, colorSetupNotifier);
CColorChooser* chContentTextcolor = new CColorChooser(LOCALE_COLORMENU_TEXTCOLOR, &t.menu_Content_Text_red, &t.menu_Content_Text_green, &t.menu_Content_Text_blue, CColorChooser* chContentTextcolor = new CColorChooser(LOCALE_COLORMENU_TEXTCOLOR, &t.menu_Content_Text_red, &t.menu_Content_Text_green, &t.menu_Content_Text_blue,

View File

@@ -95,11 +95,28 @@ CColorChooser::CColorChooser(const neutrino_locale_t Name, unsigned char *R, uns
value[VALUE_G] = G; value[VALUE_G] = G;
value[VALUE_B] = B; value[VALUE_B] = B;
value[VALUE_ALPHA] = Alpha; value[VALUE_ALPHA] = Alpha;
chooser_gradient = gradient_none;
} }
void CColorChooser::setColor() void CColorChooser::setColor()
{ {
frameBuffer->paintBoxRel(x+offset+162,y+hheight+2+5, mheight*4-4 ,mheight*4-4-10, getColor()); fb_pixel_t col = getColor();
int x_col = x+offset+160;
int y_col = y+hheight+5;
int w_col = mheight*4;
int h_col = mheight*4-10;
if ((g_settings.gradiant) && ((chooser_gradient == gradient_head_body) || (chooser_gradient == gradient_head_text))) {
CComponentsHeader header(x_col, y_col+((h_col-hheight)/2), w_col, hheight, "Head");
if (chooser_gradient == gradient_head_body)
header.setColorBody(col);
else if (chooser_gradient == gradient_head_text)
header.setCaptionColor(col);
header.paint(CC_SAVE_SCREEN_NO);
}
else
frameBuffer->paintBoxRel(x_col+2, y_col+2, w_col-4 , h_col-4, col);
} }
fb_pixel_t CColorChooser::getColor() fb_pixel_t CColorChooser::getColor()
@@ -253,9 +270,11 @@ void CColorChooser::paint()
for (int i = 0; i < 4; i++) for (int i = 0; i < 4; i++)
paintSlider(x + 10, y + hheight + mheight * i, value[i], colorchooser_names[i], iconnames[i], (i == 0)); paintSlider(x + 10, y + hheight + mheight * i, value[i], colorchooser_names[i], iconnames[i], (i == 0));
//color preview if ((!g_settings.gradiant) || ((chooser_gradient != gradient_head_body) && (chooser_gradient != gradient_head_text))) {
frameBuffer->paintBoxRel(x+offset+160,y+hheight+5, mheight*4, mheight*4-10, COL_MENUHEAD_PLUS_0); //color preview
frameBuffer->paintBoxRel(x+offset+162,y+hheight+2+5, mheight*4-4 ,mheight*4-4-10, 254); frameBuffer->paintBoxRel(x+offset+160,y+hheight+5, mheight*4, mheight*4-10, COL_MENUHEAD_PLUS_0);
frameBuffer->paintBoxRel(x+offset+162,y+hheight+2+5, mheight*4-4 ,mheight*4-4-10, 254);
}
} }
void CColorChooser::paintSlider(int px, int py, unsigned char *spos, const neutrino_locale_t text, const char * const iconname, const bool selected) void CColorChooser::paintSlider(int px, int py, unsigned char *spos, const neutrino_locale_t text, const char * const iconname, const bool selected)

View File

@@ -50,6 +50,7 @@ class CColorChooser : public CMenuTarget
int hheight,mheight; // head/menu font height int hheight,mheight; // head/menu font height
int offset; int offset;
int font_info; int font_info;
int chooser_gradient;
unsigned char * value[4]; // r, g, b, alpha unsigned char * value[4]; // r, g, b, alpha
@@ -68,7 +69,13 @@ class CColorChooser : public CMenuTarget
void hide(); void hide();
int exec(CMenuTarget* parent, const std::string & actionKey); int exec(CMenuTarget* parent, const std::string & actionKey);
fb_pixel_t getColor(void); fb_pixel_t getColor(void);
enum
{
gradient_none,
gradient_head_body,
gradient_head_text
};
void setGradient(int gradient = gradient_none) { chooser_gradient = gradient; };
}; };