mirror of
https://github.com/tuxbox-neutrino/neutrino.git
synced 2025-09-15 01:13:41 +02:00
themes: use hintbox and header gradient option in theme settings
Color gradient feature was originally intended for use inside theme settings and it's not really suitable for generally use as default in all themes at the moment, so it makes more sense to have options in theme settings and let the user decide to customize this, unless enough other gui parts can use this feature.
This commit is contained in:
@@ -2049,7 +2049,7 @@ void CChannelList::paint()
|
||||
|
||||
void CChannelList::paintHead()
|
||||
{
|
||||
static int gradient = g_settings.gradiant;
|
||||
static int gradient = g_settings.theme.menu_Head_gradient;
|
||||
|
||||
CComponentsHeader header(x, y, full_width, theight, name /*no header icon*/);
|
||||
if (bouquet && bouquet->zapitBouquet && bouquet->zapitBouquet->bLocked != g_settings.parentallock_defaultlocked)
|
||||
@@ -2059,8 +2059,8 @@ void CChannelList::paintHead()
|
||||
|
||||
header.paint(CC_SAVE_SCREEN_NO);
|
||||
|
||||
if (gradient != g_settings.gradiant && headerClock != NULL) {
|
||||
gradient = g_settings.gradiant;
|
||||
if (gradient != g_settings.theme.menu_Head_gradient && headerClock != NULL) {
|
||||
gradient = g_settings.theme.menu_Head_gradient;
|
||||
headerClock->clearSavedScreen();
|
||||
delete headerClock;
|
||||
headerClock = NULL;
|
||||
|
@@ -328,5 +328,5 @@ void CComponents::setFrameThickness(const int& thickness, const int& thickness_s
|
||||
|
||||
void CComponents::enableColBodyGradient(bool do_paint_gradient)
|
||||
{
|
||||
col_body_gradient = g_settings.gradiant ? do_paint_gradient : false;
|
||||
col_body_gradient = do_paint_gradient;
|
||||
}
|
||||
|
@@ -82,7 +82,7 @@ void CComponentsFooter::initVarFooter( const int& x_pos, const int& y_pos, const
|
||||
corner_rad = RADIUS_LARGE;
|
||||
corner_type = CORNER_BOTTOM;
|
||||
|
||||
btn_contour = g_settings.gradiant;
|
||||
btn_contour = false /*g_settings.theme.Button_gradient*/; //TODO: not implemented at the moment
|
||||
ccf_btn_font = NULL;
|
||||
chain = NULL;
|
||||
|
||||
|
@@ -98,7 +98,7 @@ void CComponentsHeader::initVarHeader( const int& x_pos, const int& y_pos, const
|
||||
col_body = color_body;
|
||||
col_shadow = color_shadow;
|
||||
col_body = COL_MENUHEAD_PLUS_0;
|
||||
col_body_gradient = g_settings.gradiant;
|
||||
col_body_gradient = g_settings.theme.menu_Head_gradient;
|
||||
cc_body_gradient_direction = CFrameBuffer::gradientVertical;
|
||||
cch_text = caption;
|
||||
cch_icon_name = icon_name;
|
||||
|
@@ -854,7 +854,7 @@ void CNeutrinoEventList::paintHead(t_channel_id _channel_id, std::string _channe
|
||||
int font_lr = SNeutrinoSettings::FONT_TYPE_EVENTLIST_ITEMLARGE;
|
||||
|
||||
CComponentsFrmChain header(x, y, full_width, theight);
|
||||
header.enableColBodyGradient(g_settings.gradiant);
|
||||
header.enableColBodyGradient(g_settings.theme.menu_Head_gradient);
|
||||
header.setCorner(RADIUS_LARGE, CORNER_TOP);
|
||||
|
||||
int x_off = 10;
|
||||
|
@@ -185,7 +185,7 @@ void CImageInfo::ShowWindow()
|
||||
cc_win->setWindowHeaderButtons(CComponentsHeader::CC_BTN_MENU | CComponentsHeader::CC_BTN_EXIT);
|
||||
footer = cc_win->getFooterObject();
|
||||
int h_footer = footer->getHeight();
|
||||
fb_pixel_t btn_col = g_settings.gradiant ? COL_BUTTON_BODY : footer->getColorBody();
|
||||
fb_pixel_t btn_col = /*g_settings.theme.Button_gradient ? COL_BUTTON_BODY :*/ footer->getColorBody(); //TODO: Button_gradient option
|
||||
btn_red = new CComponentsButtonRed(10, CC_CENTERED, 250, h_footer-h_footer/4, LOCALE_BUILDINFO_MENU, footer, false , true, false, footer->getColorBody(), btn_col);
|
||||
}
|
||||
|
||||
|
@@ -603,11 +603,6 @@ int COsdSetup::showOsdSetup()
|
||||
mfWindowSize->setHint("", LOCALE_MENU_HINT_WINDOW_SIZE);
|
||||
osd_menu->addItem(mfWindowSize);
|
||||
|
||||
// color gradient
|
||||
mc = new CMenuOptionChooser(LOCALE_COLOR_GRADIENT, &g_settings.gradiant, MESSAGEBOX_NO_YES_OPTIONS, MESSAGEBOX_NO_YES_OPTION_COUNT, true, this );
|
||||
mc->setHint("", LOCALE_MENU_HINT_COLOR_GRADIENT);
|
||||
osd_menu->addItem(mc);
|
||||
|
||||
osd_menu->addItem(GenericMenuSeparatorLine);
|
||||
|
||||
// scrambled
|
||||
@@ -653,6 +648,7 @@ void COsdSetup::showOsdMenueColorSetup(CMenuWidget *menu_colors)
|
||||
menu_colors->addItem(mf);
|
||||
|
||||
SNeutrinoTheme &t = g_settings.theme;
|
||||
sigc::slot0<void> slot_repaint = sigc::mem_fun(menu_colors, &CMenuWidget::paint); //we want to repaint after changed Option
|
||||
|
||||
CColorChooser* chHeadcolor = new CColorChooser(LOCALE_COLORMENU_BACKGROUND, &t.menu_Head_red, &t.menu_Head_green, &t.menu_Head_blue,
|
||||
&t.menu_Head_alpha, colorSetupNotifier);
|
||||
@@ -683,6 +679,13 @@ void COsdSetup::showOsdMenueColorSetup(CMenuWidget *menu_colors)
|
||||
mf->setHint("", LOCALE_MENU_HINT_HEAD_TEXTCOLOR);
|
||||
menu_colors->addItem(mf);
|
||||
|
||||
// head color gradient
|
||||
CMenuOptionChooser *oj;
|
||||
oj = new CMenuOptionChooser(LOCALE_COLOR_GRADIENT, &g_settings.theme.menu_Head_gradient, OPTIONS_OFF0_ON1_OPTIONS, OPTIONS_OFF0_ON1_OPTION_COUNT, true );
|
||||
oj->OnAfterChangeOption.connect(slot_repaint);
|
||||
oj->setHint("", LOCALE_MENU_HINT_COLOR_GRADIENT);
|
||||
menu_colors->addItem(oj);
|
||||
|
||||
menu_colors->addItem( new CMenuSeparator(CMenuSeparator::LINE | CMenuSeparator::STRING, LOCALE_COLORMENUSETUP_MENUCONTENT));
|
||||
mf = new CMenuDForwarder(LOCALE_COLORMENU_BACKGROUND, true, NULL, chContentcolor );
|
||||
mf->setHint("", LOCALE_MENU_HINT_CONTENT_BACK);
|
||||
@@ -710,6 +713,13 @@ void COsdSetup::showOsdMenueColorSetup(CMenuWidget *menu_colors)
|
||||
mf->setHint("", LOCALE_MENU_HINT_SELECTED_TEXT);
|
||||
menu_colors->addItem(mf);
|
||||
|
||||
// hintbox color gradient
|
||||
menu_colors->addItem( new CMenuSeparator(CMenuSeparator::LINE | CMenuSeparator::STRING, LOCALE_COLORTHEMEMENU_MENU_HINTS));
|
||||
oj = new CMenuOptionChooser(LOCALE_COLOR_GRADIENT, &t.menu_Hint_gradient, OPTIONS_OFF0_ON1_OPTIONS, OPTIONS_OFF0_ON1_OPTION_COUNT, true);
|
||||
oj->OnAfterChangeOption.connect(slot_repaint);
|
||||
oj->setHint("", LOCALE_MENU_HINT_COLOR_GRADIENT);
|
||||
menu_colors->addItem(oj);
|
||||
|
||||
CColorChooser* chInfobarcolor = new CColorChooser(LOCALE_COLORMENU_BACKGROUND, &t.infobar_red,
|
||||
&t.infobar_green, &t.infobar_blue, &t.infobar_alpha, colorSetupNotifier);
|
||||
CColorChooser* chInfobarTextcolor = new CColorChooser(LOCALE_COLORMENU_TEXTCOLOR, &t.infobar_Text_red,
|
||||
@@ -1137,7 +1147,7 @@ bool COsdSetup::changeNotify(const neutrino_locale_t OptionName, void * data)
|
||||
}
|
||||
else if(ARE_LOCALES_EQUAL(OptionName, LOCALE_COLOR_GRADIENT)) {
|
||||
osd_menu->paint();
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
else if(ARE_LOCALES_EQUAL(OptionName, LOCALE_COLORMENU_OSD_PRESET)) {
|
||||
int preset = * (int *) data;
|
||||
|
@@ -245,6 +245,7 @@ void CThemes::setTheme(CConfigFile &configfile)
|
||||
configfile.setInt32( "menu_Head_Text_red", t.menu_Head_Text_red );
|
||||
configfile.setInt32( "menu_Head_Text_green", t.menu_Head_Text_green );
|
||||
configfile.setInt32( "menu_Head_Text_blue", t.menu_Head_Text_blue );
|
||||
configfile.setInt32( "menu_Head_gradient" , t.menu_Head_gradient);
|
||||
configfile.setInt32( "menu_Content_alpha", t.menu_Content_alpha );
|
||||
configfile.setInt32( "menu_Content_red", t.menu_Content_red );
|
||||
configfile.setInt32( "menu_Content_green", t.menu_Content_green );
|
||||
@@ -269,6 +270,7 @@ void CThemes::setTheme(CConfigFile &configfile)
|
||||
configfile.setInt32( "menu_Content_inactive_Text_red", t.menu_Content_inactive_Text_red );
|
||||
configfile.setInt32( "menu_Content_inactive_Text_green", t.menu_Content_inactive_Text_green );
|
||||
configfile.setInt32( "menu_Content_inactive_Text_blue", t.menu_Content_inactive_Text_blue );
|
||||
configfile.setInt32( "menu_Hint_gradient" , t.menu_Hint_gradient);
|
||||
configfile.setInt32( "infobar_alpha", t.infobar_alpha );
|
||||
configfile.setInt32( "infobar_red", t.infobar_red );
|
||||
configfile.setInt32( "infobar_green", t.infobar_green );
|
||||
@@ -298,6 +300,7 @@ void CThemes::getTheme(CConfigFile &configfile)
|
||||
t.menu_Head_Text_red = configfile.getInt32( "menu_Head_Text_red", 0x5f );
|
||||
t.menu_Head_Text_green = configfile.getInt32( "menu_Head_Text_green", 0x46 );
|
||||
t.menu_Head_Text_blue = configfile.getInt32( "menu_Head_Text_blue", 0x00 );
|
||||
t.menu_Head_gradient = configfile.getInt32( "menu_Head_gradient", 1);
|
||||
t.menu_Content_alpha = configfile.getInt32( "menu_Content_alpha", 0x14 );
|
||||
t.menu_Content_red = configfile.getInt32( "menu_Content_red", 0x00 );
|
||||
t.menu_Content_green = configfile.getInt32( "menu_Content_green", 0x0f );
|
||||
@@ -322,6 +325,7 @@ void CThemes::getTheme(CConfigFile &configfile)
|
||||
t.menu_Content_inactive_Text_red = configfile.getInt32( "menu_Content_inactive_Text_red", 55 );
|
||||
t.menu_Content_inactive_Text_green = configfile.getInt32( "menu_Content_inactive_Text_green", 70 );
|
||||
t.menu_Content_inactive_Text_blue = configfile.getInt32( "menu_Content_inactive_Text_blue", 85 );
|
||||
t.menu_Hint_gradient = configfile.getInt32( "menu_Hint_gradient", 0);
|
||||
t.infobar_alpha = configfile.getInt32( "infobar_alpha", 0x14 );
|
||||
t.infobar_red = configfile.getInt32( "infobar_red", 0x00 );
|
||||
t.infobar_green = configfile.getInt32( "infobar_green", 0x0e );
|
||||
|
@@ -107,7 +107,7 @@ void CColorChooser::setColor()
|
||||
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))) {
|
||||
if ((g_settings.theme.menu_Head_gradient) && ((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);
|
||||
@@ -270,7 +270,7 @@ void CColorChooser::paint()
|
||||
for (int i = 0; i < 4; i++)
|
||||
paintSlider(x + 10, y + hheight + mheight * i, value[i], colorchooser_names[i], iconnames[i], (i == 0));
|
||||
|
||||
if ((!g_settings.gradiant) || ((chooser_gradient != gradient_head_body) && (chooser_gradient != gradient_head_text))) {
|
||||
if ((!g_settings.theme.menu_Head_gradient) || ((chooser_gradient != gradient_head_body) && (chooser_gradient != gradient_head_text))) {
|
||||
//color preview
|
||||
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);
|
||||
|
@@ -1303,7 +1303,7 @@ void CMenuWidget::paintHint(int pos)
|
||||
if (pos < 0 && !hint_painted)
|
||||
return;
|
||||
|
||||
info_box->enableGradient(g_settings.gradiant != 0); //TODO: manage via themes
|
||||
info_box->enableGradient(g_settings.theme.menu_Hint_gradient != 0);
|
||||
info_box->setColorBody(COL_MENUCONTENT_PLUS_0);
|
||||
|
||||
if (hint_painted) {
|
||||
@@ -1826,6 +1826,7 @@ int CMenuOptionChooser::exec(CMenuTarget*)
|
||||
}
|
||||
}
|
||||
paint(true);
|
||||
OnAfterChangeOption();
|
||||
if(observ && !luaAction.empty()) {
|
||||
if (optionValname)
|
||||
wantsRepaint = observ->changeNotify(luaState, luaAction, luaId, optionValname);
|
||||
|
@@ -355,7 +355,7 @@ struct CMenuOptionChooserCompareItem: public std::binary_function <const CMenuOp
|
||||
};
|
||||
};
|
||||
|
||||
class CMenuOptionChooser : public CAbstractMenuOptionChooser
|
||||
class CMenuOptionChooser : public CAbstractMenuOptionChooser, public sigc::trackable
|
||||
{
|
||||
public:
|
||||
struct keyval
|
||||
@@ -430,7 +430,7 @@ class CMenuOptionChooser : public CAbstractMenuOptionChooser
|
||||
int getWidth(void);
|
||||
void setOptions(const struct keyval * const Options, const unsigned Number_Of_Options);
|
||||
void setOptions(const struct keyval_ext * const Options, const unsigned Number_Of_Options);
|
||||
|
||||
sigc::signal<void> OnAfterChangeOption;
|
||||
int paint(bool selected);
|
||||
|
||||
int exec(CMenuTarget* parent);
|
||||
|
Reference in New Issue
Block a user