From 3ab1cd74dae7f187d847fe94d620ab7ab6db652a Mon Sep 17 00:00:00 2001 From: Stefan Seyfried Date: Tue, 26 Mar 2013 19:17:06 +0100 Subject: [PATCH] Revert "progresbar -add colored & vertical design , ported from neutrino-mp" This reverts commit a501b6efebdc6528ac1af548186018b44a015977. A better and simpler solution for progressbar setup is already in place. --- data/locale/deutsch.locale | 4 +- data/locale/english.locale | 4 +- src/gui/progressbar_setup.cpp | 6 +- src/gui/widget/progressbar.cpp | 148 ++++++++++++++------------------- src/gui/widget/progressbar.h | 10 +-- src/system/locals.h | 2 - src/system/locals_intern.h | 2 - 7 files changed, 70 insertions(+), 106 deletions(-) diff --git a/data/locale/deutsch.locale b/data/locale/deutsch.locale index a44a21c5d..43c124e45 100644 --- a/data/locale/deutsch.locale +++ b/data/locale/deutsch.locale @@ -1146,9 +1146,7 @@ miscsettings.infobar_position_3 zwischen EPG-Events (schmal) miscsettings.infobar_progressbar Fortschrittsbalken miscsettings.infobar_progressbar_design Progressbar miscsettings.infobar_progressbar_design_0 Punktdesign -miscsettings.infobar_progressbar_design_1 Balkendesign Vertikal -miscsettings.infobar_progressbar_design_2 Balkendesign Horizontal -miscsettings.infobar_progressbar_design_3 farbig +miscsettings.infobar_progressbar_design_1 Balkendesign miscsettings.infobar_sat_display Kabel-/Satellitenanbieter miscsettings.infobar_show Info bei EPG Änderungen miscsettings.infobar_show_dd_available DD-Verfügbarkeit anzeigen diff --git a/data/locale/english.locale b/data/locale/english.locale index e89182548..18a0610f4 100644 --- a/data/locale/english.locale +++ b/data/locale/english.locale @@ -1146,9 +1146,7 @@ miscsettings.infobar_position_3 narrow between EPG-Events miscsettings.infobar_progressbar Progressbar miscsettings.infobar_progressbar_design Progressbar miscsettings.infobar_progressbar_design_0 point Design -miscsettings.infobar_progressbar_design_1 bar Design vertical -miscsettings.infobar_progressbar_design_2 bar Design horizontal -miscsettings.infobar_progressbar_design_3 colored +miscsettings.infobar_progressbar_design_1 bar Design miscsettings.infobar_sat_display Satellite display on infobar miscsettings.infobar_show show Info on EPG change miscsettings.infobar_show_dd_available show DD availability diff --git a/src/gui/progressbar_setup.cpp b/src/gui/progressbar_setup.cpp index 3ca86969e..98d17fa50 100644 --- a/src/gui/progressbar_setup.cpp +++ b/src/gui/progressbar_setup.cpp @@ -47,13 +47,11 @@ const CMenuOptionChooser::keyval LOCALE_MISCSETTINGS_INFOBAR_POSITION_OPTIONS[L { 3 , LOCALE_MISCSETTINGS_INFOBAR_POSITION_3 } }; -#define LOCALE_MISCSETTINGS_INFOBAR_PROGRESSBAR_DESIGN_COUNT 4 +#define LOCALE_MISCSETTINGS_INFOBAR_PROGRESSBAR_DESIGN_COUNT 2 const CMenuOptionChooser::keyval LOCALE_MISCSETTINGS_INFOBAR_PROGRESSBAR_DESIGN_OPTIONS[LOCALE_MISCSETTINGS_INFOBAR_PROGRESSBAR_DESIGN_COUNT]= { { 0 , LOCALE_MISCSETTINGS_INFOBAR_PROGRESSBAR_DESIGN_0 }, - { 1 , LOCALE_MISCSETTINGS_INFOBAR_PROGRESSBAR_DESIGN_1 }, - { 2 , LOCALE_MISCSETTINGS_INFOBAR_PROGRESSBAR_DESIGN_2 }, - { 3 , LOCALE_MISCSETTINGS_INFOBAR_PROGRESSBAR_DESIGN_3 } + { 1 , LOCALE_MISCSETTINGS_INFOBAR_PROGRESSBAR_DESIGN_1 } }; CProgressbarSetup::CProgressbarSetup() diff --git a/src/gui/widget/progressbar.cpp b/src/gui/widget/progressbar.cpp index 355eb0fbd..e9bef678e 100644 --- a/src/gui/widget/progressbar.cpp +++ b/src/gui/widget/progressbar.cpp @@ -1,6 +1,5 @@ /* * (C) 2008 by dbt - * (C) 2009-2010, 2012-2013 Stefan Seyfried * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -56,7 +55,7 @@ CProgressBar::~CProgressBar() { } -static inline unsigned int make16color(__u32 rgb) +inline unsigned int make16color(__u32 rgb) { return 0xFF000000 | rgb; } @@ -107,7 +106,7 @@ void CProgressBar::paintProgressBar2(const int pos_x, } void CProgressBar::realpaint(const int pos_x, const int pos_y, - const int val, const int max_value, + const int value, const int max_value, const fb_pixel_t activebar_col, const fb_pixel_t passivebar_col, const fb_pixel_t backgroundbar_col, @@ -121,14 +120,6 @@ void CProgressBar::realpaint(const int pos_x, const int pos_y, bl_changed = g_settings.progressbar_color; reset(); } - - /* stupid callers give invalid values like "-1"... */ - int value = val; - if (value < 0) - value = 0; - if (value > max_value) - value = max_value; - // set colors fb_pixel_t active_col = activebar_col != 0 ? activebar_col : COL_INFOBAR_PLUS_7; fb_pixel_t passive_col = passivebar_col != 0 ? passivebar_col : COL_INFOBAR_PLUS_3; @@ -162,11 +153,11 @@ void CProgressBar::realpaint(const int pos_x, const int pos_y, // max height progressbar bar, if icon height larger than pb_height then get height from icon int pb_max_height = icon_h > height ? icon_h + 2* frame_widht : height; + // max height of active/passive bar + int bar_height = pb_max_height - 2*frame_widht; + if (!blink || !g_settings.progressbar_color) { - // max height of active/passive bar - int bar_height = pb_max_height - 2*frame_widht; - int start_x_passive_bar = start_x + active_pb_width; int width_passive_bar = pb_max_width - active_pb_width; @@ -191,37 +182,14 @@ void CProgressBar::realpaint(const int pos_x, const int pos_y, } else { - int itemw = ITEMW, itemh = ITEMW, pointx = POINT, pointy = POINT; - if(g_settings.progressbar_color){ - switch ((pb_color_t)g_settings.progressbar_design){ - default: - case PB_MATRIX: /* matrix */ - break; - case PB_LINES_V: /* vert. lines */ - itemh = height; - pointy = height; - break; - case PB_LINES_H: /* horiz. lines */ - itemw = POINT; - break; - case PB_COLOR: /* filled color */ - itemw = POINT; - itemh = height; - pointy = height; - break; - } - } - const int spc = itemh - pointy; /* space between horizontal lines / points */ - int hcnt = (height + spc) / itemh; /* how many POINTs is the bar high */ - int yoff = (height + spc - itemh * hcnt) / 2; - //printf("height: %d itemh: %d hcnt: %d yoff: %d spc: %d\n", height, itemh, hcnt, yoff, spc); /* red, yellow, green are given in percent */ - int rd = red * width / (100 * itemw); /* how many POINTs red */ - int yw = yellow * width / (100 * itemw); /* how many POINTs yellow */ - int gn = green * width / (100 * itemw); /* how many POINTs green */ + int rd = red * width / (100 * ITEMW); /* how many POINTs red */ + int yw = yellow * width / (100 * ITEMW); /* how many POINTs yellow */ + int gn = green * width / (100 * ITEMW); /* how many POINTs green */ - int maxi = active_pb_width / itemw; /* how many POINTs is the active bar */ - int total = width / itemw; /* total number of POINTs */ + int hcnt = height / ITEMW; /* how many POINTs is the bar high */ + int maxi = active_pb_width / ITEMW; /* how many POINTs is the active bar */ + int total = width / ITEMW; /* total number of POINTs */ uint32_t rgb; fb_pixel_t color; @@ -234,73 +202,85 @@ void CProgressBar::realpaint(const int pos_x, const int pos_y, width, pb_max_height, shadowbar_col, c_rad); // shadow } - if (active_pb_width != last_width) { + if (active_pb_width != last_width) + { + int step; int i, j; - const int py = pos_y + yoff; - if (active_pb_width > last_width) { - int step, off; - int b = 0; - uint8_t diff = 0; - for (i = 0; (i < rd) && (i < maxi); i++) { - diff = i * 255 / rd; + int b = 0; + if (active_pb_width > last_width) + { + for (i = 0; (i < rd) && (i < maxi); i++) + { //green section + step = 255 / rd; if (invert) - rgb = GREEN + (diff << 16); // adding red + rgb = GREEN + ((unsigned char)(step * i) << 16); // adding red else - rgb = RED + (diff << 8); // adding green + rgb = RED + ((unsigned char)(step * i) << 8); // adding green color = make16color(rgb); - for (j = 0; j < hcnt; j++) - frameBuffer->paintBoxRel(pos_x + i * itemw, py + j * itemh, - pointx, pointy, color); + if (g_settings.progressbar_design == 0) + { + for(j = 0; j <= hcnt; j++) + frameBuffer->paintBoxRel(pos_x + i * ITEMW, pos_y + j * ITEMW, POINT, POINT, color); + } + else + frameBuffer->paintBoxRel(pos_x + i * ITEMW,start_y, POINT, bar_height, color); } - step = yw - rd - 1; - if (step < 1) - step = 1; - for (; (i < yw) && (i < maxi); i++) { - diff = b++ * 255 / step / 2; + for (; (i < yw) && (i < maxi); i++) + { //yello section + step = 255 / yw / 2; if (invert) - rgb = YELLOW - (diff << 8); // removing green + rgb = YELLOW - ((unsigned char)(step * (b++)) << 8); // removing green else - rgb = YELLOW - (diff << 16); // removing red + rgb = YELLOW - ((unsigned char)(step * (b++)) << 16); // removing red color = make16color(rgb); - for (j = 0; j < hcnt; j++) - frameBuffer->paintBoxRel(pos_x + i * itemw, py + j * itemh, - pointx, pointy, color); + if (g_settings.progressbar_design == 0) + { + for(j = 0; j <= hcnt; j++) + frameBuffer->paintBoxRel(pos_x + i * ITEMW, pos_y + j * ITEMW, POINT, POINT, color); + } + else + frameBuffer->paintBoxRel(pos_x + i * ITEMW, start_y, POINT, bar_height, color); } - off = diff; - b = 0; - step = gn - yw - 1; - if (step < 1) - step = 1; - for (; (i < gn) && (i < maxi); i++) { - diff = b++ * 255 / step / 2 + off; + for (; (i < gn) && (i < maxi); i++) + { //red section + step = 255 / gn; if (invert) - rgb = YELLOW - (diff << 8); // removing green + rgb = YELLOW - ((unsigned char) (step * (b++)) << 8); // removing green else - rgb = YELLOW - (diff << 16); // removing red + rgb = YELLOW - ((unsigned char) (step * (b++)) << 16); // removing red color = make16color(rgb); - for (j = 0; j < hcnt; j++) - frameBuffer->paintBoxRel(pos_x + i * itemw, py + j * itemh, - pointx, pointy, color); + if (g_settings.progressbar_design == 0) + { + for(j = 0; j <= hcnt; j++) + frameBuffer->paintBoxRel(pos_x + i * ITEMW, pos_y + j * ITEMW, POINT, POINT, color); + } + else + frameBuffer->paintBoxRel(pos_x + i * ITEMW, start_y, POINT, bar_height, color); } } - for(i = maxi; i < total; i++) { - for (j = 0; j < hcnt; j++) - frameBuffer->paintBoxRel(pos_x + i * itemw, py + j * itemh, - pointx, pointy, COL_INFOBAR_PLUS_3);//fill passive + for(i = maxi; i < total; i++) + { + for(j = 0; j <= hcnt; j++) + if (g_settings.progressbar_design == 0) + frameBuffer->paintBoxRel(pos_x + i * ITEMW, pos_y + j * ITEMW, POINT, POINT, COL_INFOBAR_PLUS_3);//fill passive + else + frameBuffer->paintBoxRel(pos_x + i * ITEMW, start_y, POINT, bar_height, COL_INFOBAR_PLUS_3);//fill passive } last_width = active_pb_width; } } // paint icon if present - if (iconfile != NULL){ + if (iconfile != NULL) + { int icon_y = pos_y + pb_max_height / 2 - icon_h / 2; frameBuffer->paintIcon(iconfile, pos_x + frame_widht, icon_y); } // upper text int upper_labeltext_y = start_y - frame_widht; - if (upper_labeltext != NULL) { + if (upper_labeltext != NULL) + { g_Font[font_pbar]->RenderString(start_x +2, upper_labeltext_y, width, diff --git a/src/gui/widget/progressbar.h b/src/gui/widget/progressbar.h index 1d2b6bf2e..f66cf7e42 100644 --- a/src/gui/widget/progressbar.h +++ b/src/gui/widget/progressbar.h @@ -1,6 +1,7 @@ /* + * $Id$ + * * (C) 2008 by dbt - * (C) 2009,2010,2013 Stefan Seyfried * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -130,13 +131,6 @@ class CProgressBar void reset() { last_width = -1; } /* force update on next paint */ void hide(); - - enum pb_color_t { - PB_MATRIX = 0, /* 0 */ - PB_LINES_V, /* 1 */ - PB_LINES_H, /* 2 */ - PB_COLOR /* 3 */ - }; }; #endif /* __gui_widget_progressbar_h__ */ diff --git a/src/system/locals.h b/src/system/locals.h index 9cc9c7bdb..dc5fe0a70 100644 --- a/src/system/locals.h +++ b/src/system/locals.h @@ -1174,8 +1174,6 @@ typedef enum LOCALE_MISCSETTINGS_INFOBAR_PROGRESSBAR_DESIGN, LOCALE_MISCSETTINGS_INFOBAR_PROGRESSBAR_DESIGN_0, LOCALE_MISCSETTINGS_INFOBAR_PROGRESSBAR_DESIGN_1, - LOCALE_MISCSETTINGS_INFOBAR_PROGRESSBAR_DESIGN_2, - LOCALE_MISCSETTINGS_INFOBAR_PROGRESSBAR_DESIGN_3, LOCALE_MISCSETTINGS_INFOBAR_SAT_DISPLAY, LOCALE_MISCSETTINGS_INFOBAR_SHOW, LOCALE_MISCSETTINGS_INFOBAR_SHOW_DD_AVAILABLE, diff --git a/src/system/locals_intern.h b/src/system/locals_intern.h index 1951c6f08..900aa02fc 100644 --- a/src/system/locals_intern.h +++ b/src/system/locals_intern.h @@ -1174,8 +1174,6 @@ const char * locale_real_names[] = "miscsettings.infobar_progressbar_design", "miscsettings.infobar_progressbar_design_0", "miscsettings.infobar_progressbar_design_1", - "miscsettings.infobar_progressbar_design_2", - "miscsettings.infobar_progressbar_design_3", "miscsettings.infobar_sat_display", "miscsettings.infobar_show", "miscsettings.infobar_show_dd_available",