mirror of
https://github.com/tuxbox-neutrino/neutrino.git
synced 2025-08-30 17:01:15 +02:00
progresbar -add colored & vertical design , ported from neutrino-mp
This commit is contained in:
committed by
[CST] Focus
parent
369289d179
commit
f428a0b8d0
@@ -1143,7 +1143,9 @@ miscsettings.infobar_position_3 zwischen EPG-Events (schmal)
|
|||||||
miscsettings.infobar_progressbar Fortschrittsbalken
|
miscsettings.infobar_progressbar Fortschrittsbalken
|
||||||
miscsettings.infobar_progressbar_design Progressbar
|
miscsettings.infobar_progressbar_design Progressbar
|
||||||
miscsettings.infobar_progressbar_design_0 Punktdesign
|
miscsettings.infobar_progressbar_design_0 Punktdesign
|
||||||
miscsettings.infobar_progressbar_design_1 Balkendesign
|
miscsettings.infobar_progressbar_design_1 Balkendesign Vertikal
|
||||||
|
miscsettings.infobar_progressbar_design_2 Balkendesign Horizontal
|
||||||
|
miscsettings.infobar_progressbar_design_3 farbig
|
||||||
miscsettings.infobar_sat_display Kabel-/Satellitenanbieter
|
miscsettings.infobar_sat_display Kabel-/Satellitenanbieter
|
||||||
miscsettings.infobar_show Info bei EPG Änderungen
|
miscsettings.infobar_show Info bei EPG Änderungen
|
||||||
miscsettings.infobar_show_dd_available DD-Verfügbarkeit anzeigen
|
miscsettings.infobar_show_dd_available DD-Verfügbarkeit anzeigen
|
||||||
|
@@ -1155,7 +1155,9 @@ miscsettings.infobar_position_3 narrow between EPG-Events
|
|||||||
miscsettings.infobar_progressbar Progressbar
|
miscsettings.infobar_progressbar Progressbar
|
||||||
miscsettings.infobar_progressbar_design Progressbar
|
miscsettings.infobar_progressbar_design Progressbar
|
||||||
miscsettings.infobar_progressbar_design_0 point Design
|
miscsettings.infobar_progressbar_design_0 point Design
|
||||||
miscsettings.infobar_progressbar_design_1 bar 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_sat_display Satellite display on infobar
|
miscsettings.infobar_sat_display Satellite display on infobar
|
||||||
miscsettings.infobar_show show Info on EPG change
|
miscsettings.infobar_show show Info on EPG change
|
||||||
miscsettings.infobar_show_dd_available show DD availability
|
miscsettings.infobar_show_dd_available show DD availability
|
||||||
|
@@ -47,11 +47,13 @@ const CMenuOptionChooser::keyval LOCALE_MISCSETTINGS_INFOBAR_POSITION_OPTIONS[L
|
|||||||
{ 3 , LOCALE_MISCSETTINGS_INFOBAR_POSITION_3 }
|
{ 3 , LOCALE_MISCSETTINGS_INFOBAR_POSITION_3 }
|
||||||
};
|
};
|
||||||
|
|
||||||
#define LOCALE_MISCSETTINGS_INFOBAR_PROGRESSBAR_DESIGN_COUNT 2
|
#define LOCALE_MISCSETTINGS_INFOBAR_PROGRESSBAR_DESIGN_COUNT 4
|
||||||
const CMenuOptionChooser::keyval LOCALE_MISCSETTINGS_INFOBAR_PROGRESSBAR_DESIGN_OPTIONS[LOCALE_MISCSETTINGS_INFOBAR_PROGRESSBAR_DESIGN_COUNT]=
|
const CMenuOptionChooser::keyval LOCALE_MISCSETTINGS_INFOBAR_PROGRESSBAR_DESIGN_OPTIONS[LOCALE_MISCSETTINGS_INFOBAR_PROGRESSBAR_DESIGN_COUNT]=
|
||||||
{
|
{
|
||||||
{ 0 , LOCALE_MISCSETTINGS_INFOBAR_PROGRESSBAR_DESIGN_0 },
|
{ 0 , LOCALE_MISCSETTINGS_INFOBAR_PROGRESSBAR_DESIGN_0 },
|
||||||
{ 1 , LOCALE_MISCSETTINGS_INFOBAR_PROGRESSBAR_DESIGN_1 }
|
{ 1 , LOCALE_MISCSETTINGS_INFOBAR_PROGRESSBAR_DESIGN_1 },
|
||||||
|
{ 2 , LOCALE_MISCSETTINGS_INFOBAR_PROGRESSBAR_DESIGN_2 },
|
||||||
|
{ 3 , LOCALE_MISCSETTINGS_INFOBAR_PROGRESSBAR_DESIGN_3 }
|
||||||
};
|
};
|
||||||
|
|
||||||
CProgressbarSetup::CProgressbarSetup()
|
CProgressbarSetup::CProgressbarSetup()
|
||||||
|
@@ -1,5 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* (C) 2008 by dbt <info@dbox2-tuning.de>
|
* (C) 2008 by dbt <info@dbox2-tuning.de>
|
||||||
|
* (C) 2009-2010, 2012-2013 Stefan Seyfried
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -55,7 +56,7 @@ CProgressBar::~CProgressBar()
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
inline unsigned int make16color(__u32 rgb)
|
static inline unsigned int make16color(__u32 rgb)
|
||||||
{
|
{
|
||||||
return 0xFF000000 | rgb;
|
return 0xFF000000 | rgb;
|
||||||
}
|
}
|
||||||
@@ -106,7 +107,7 @@ void CProgressBar::paintProgressBar2(const int pos_x,
|
|||||||
}
|
}
|
||||||
|
|
||||||
void CProgressBar::realpaint(const int pos_x, const int pos_y,
|
void CProgressBar::realpaint(const int pos_x, const int pos_y,
|
||||||
const int value, const int max_value,
|
const int val, const int max_value,
|
||||||
const fb_pixel_t activebar_col,
|
const fb_pixel_t activebar_col,
|
||||||
const fb_pixel_t passivebar_col,
|
const fb_pixel_t passivebar_col,
|
||||||
const fb_pixel_t backgroundbar_col,
|
const fb_pixel_t backgroundbar_col,
|
||||||
@@ -120,6 +121,14 @@ void CProgressBar::realpaint(const int pos_x, const int pos_y,
|
|||||||
bl_changed = g_settings.progressbar_color;
|
bl_changed = g_settings.progressbar_color;
|
||||||
reset();
|
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
|
// set colors
|
||||||
fb_pixel_t active_col = activebar_col != 0 ? activebar_col : COL_INFOBAR_PLUS_7;
|
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;
|
fb_pixel_t passive_col = passivebar_col != 0 ? passivebar_col : COL_INFOBAR_PLUS_3;
|
||||||
@@ -153,11 +162,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
|
// 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;
|
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)
|
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 start_x_passive_bar = start_x + active_pb_width;
|
||||||
int width_passive_bar = pb_max_width - active_pb_width;
|
int width_passive_bar = pb_max_width - active_pb_width;
|
||||||
|
|
||||||
@@ -182,14 +191,37 @@ void CProgressBar::realpaint(const int pos_x, const int pos_y,
|
|||||||
}
|
}
|
||||||
else
|
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 */
|
/* red, yellow, green are given in percent */
|
||||||
int rd = red * width / (100 * ITEMW); /* how many POINTs red */
|
int rd = red * width / (100 * itemw); /* how many POINTs red */
|
||||||
int yw = yellow * width / (100 * ITEMW); /* how many POINTs yellow */
|
int yw = yellow * width / (100 * itemw); /* how many POINTs yellow */
|
||||||
int gn = green * width / (100 * ITEMW); /* how many POINTs green */
|
int gn = green * width / (100 * itemw); /* how many POINTs green */
|
||||||
|
|
||||||
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 maxi = active_pb_width / ITEMW; /* how many POINTs is the active bar */
|
int total = width / itemw; /* total number of POINTs */
|
||||||
int total = width / ITEMW; /* total number of POINTs */
|
|
||||||
|
|
||||||
uint32_t rgb;
|
uint32_t rgb;
|
||||||
fb_pixel_t color;
|
fb_pixel_t color;
|
||||||
@@ -202,85 +234,73 @@ void CProgressBar::realpaint(const int pos_x, const int pos_y,
|
|||||||
width, pb_max_height, shadowbar_col, c_rad); // shadow
|
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;
|
int i, j;
|
||||||
int b = 0;
|
const int py = pos_y + yoff;
|
||||||
if (active_pb_width > last_width)
|
if (active_pb_width > last_width) {
|
||||||
{
|
int step, off;
|
||||||
for (i = 0; (i < rd) && (i < maxi); i++)
|
int b = 0;
|
||||||
{ //green section
|
uint8_t diff = 0;
|
||||||
step = 255 / rd;
|
for (i = 0; (i < rd) && (i < maxi); i++) {
|
||||||
|
diff = i * 255 / rd;
|
||||||
if (invert)
|
if (invert)
|
||||||
rgb = GREEN + ((unsigned char)(step * i) << 16); // adding red
|
rgb = GREEN + (diff << 16); // adding red
|
||||||
else
|
else
|
||||||
rgb = RED + ((unsigned char)(step * i) << 8); // adding green
|
rgb = RED + (diff << 8); // adding green
|
||||||
color = make16color(rgb);
|
color = make16color(rgb);
|
||||||
if (g_settings.progressbar_design == 0)
|
for (j = 0; j < hcnt; j++)
|
||||||
{
|
frameBuffer->paintBoxRel(pos_x + i * itemw, py + j * itemh,
|
||||||
for(j = 0; j <= hcnt; j++)
|
pointx, pointy, color);
|
||||||
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 < yw) && (i < maxi); i++)
|
step = yw - rd - 1;
|
||||||
{ //yello section
|
if (step < 1)
|
||||||
step = 255 / yw / 2;
|
step = 1;
|
||||||
|
for (; (i < yw) && (i < maxi); i++) {
|
||||||
|
diff = b++ * 255 / step / 2;
|
||||||
if (invert)
|
if (invert)
|
||||||
rgb = YELLOW - ((unsigned char)(step * (b++)) << 8); // removing green
|
rgb = YELLOW - (diff << 8); // removing green
|
||||||
else
|
else
|
||||||
rgb = YELLOW - ((unsigned char)(step * (b++)) << 16); // removing red
|
rgb = YELLOW - (diff << 16); // removing red
|
||||||
color = make16color(rgb);
|
color = make16color(rgb);
|
||||||
if (g_settings.progressbar_design == 0)
|
for (j = 0; j < hcnt; j++)
|
||||||
{
|
frameBuffer->paintBoxRel(pos_x + i * itemw, py + j * itemh,
|
||||||
for(j = 0; j <= hcnt; j++)
|
pointx, pointy, color);
|
||||||
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 < gn) && (i < maxi); i++)
|
off = diff;
|
||||||
{ //red section
|
b = 0;
|
||||||
step = 255 / gn;
|
step = gn - yw - 1;
|
||||||
|
if (step < 1)
|
||||||
|
step = 1;
|
||||||
|
for (; (i < gn) && (i < maxi); i++) {
|
||||||
|
diff = b++ * 255 / step / 2 + off;
|
||||||
if (invert)
|
if (invert)
|
||||||
rgb = YELLOW - ((unsigned char) (step * (b++)) << 8); // removing green
|
rgb = YELLOW - (diff << 8); // removing green
|
||||||
else
|
else
|
||||||
rgb = YELLOW - ((unsigned char) (step * (b++)) << 16); // removing red
|
rgb = YELLOW - (diff << 16); // removing red
|
||||||
color = make16color(rgb);
|
color = make16color(rgb);
|
||||||
if (g_settings.progressbar_design == 0)
|
for (j = 0; j < hcnt; j++)
|
||||||
{
|
frameBuffer->paintBoxRel(pos_x + i * itemw, py + j * itemh,
|
||||||
for(j = 0; j <= hcnt; j++)
|
pointx, pointy, color);
|
||||||
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(i = maxi; i < total; i++) {
|
||||||
{
|
for (j = 0; j < hcnt; j++)
|
||||||
for(j = 0; j <= hcnt; j++)
|
frameBuffer->paintBoxRel(pos_x + i * itemw, py + j * itemh,
|
||||||
if (g_settings.progressbar_design == 0)
|
pointx, pointy, COL_INFOBAR_PLUS_3);//fill passive
|
||||||
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;
|
last_width = active_pb_width;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// paint icon if present
|
// paint icon if present
|
||||||
if (iconfile != NULL)
|
if (iconfile != NULL){
|
||||||
{
|
|
||||||
int icon_y = pos_y + pb_max_height / 2 - icon_h / 2;
|
int icon_y = pos_y + pb_max_height / 2 - icon_h / 2;
|
||||||
frameBuffer->paintIcon(iconfile, pos_x + frame_widht, icon_y);
|
frameBuffer->paintIcon(iconfile, pos_x + frame_widht, icon_y);
|
||||||
}
|
}
|
||||||
|
|
||||||
// upper text
|
// upper text
|
||||||
int upper_labeltext_y = start_y - frame_widht;
|
int upper_labeltext_y = start_y - frame_widht;
|
||||||
if (upper_labeltext != NULL)
|
if (upper_labeltext != NULL) {
|
||||||
{
|
|
||||||
g_Font[font_pbar]->RenderString(start_x +2,
|
g_Font[font_pbar]->RenderString(start_x +2,
|
||||||
upper_labeltext_y,
|
upper_labeltext_y,
|
||||||
width,
|
width,
|
||||||
|
@@ -1,7 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* $Id$
|
|
||||||
*
|
|
||||||
* (C) 2008 by dbt <info@dbox2-tuning.de>
|
* (C) 2008 by dbt <info@dbox2-tuning.de>
|
||||||
|
* (C) 2009,2010,2013 Stefan Seyfried
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -131,6 +130,13 @@ class CProgressBar
|
|||||||
void reset() { last_width = -1; } /* force update on next paint */
|
void reset() { last_width = -1; } /* force update on next paint */
|
||||||
|
|
||||||
void hide();
|
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__ */
|
#endif /* __gui_widget_progressbar_h__ */
|
||||||
|
@@ -1183,6 +1183,8 @@ typedef enum
|
|||||||
LOCALE_MISCSETTINGS_INFOBAR_PROGRESSBAR_DESIGN,
|
LOCALE_MISCSETTINGS_INFOBAR_PROGRESSBAR_DESIGN,
|
||||||
LOCALE_MISCSETTINGS_INFOBAR_PROGRESSBAR_DESIGN_0,
|
LOCALE_MISCSETTINGS_INFOBAR_PROGRESSBAR_DESIGN_0,
|
||||||
LOCALE_MISCSETTINGS_INFOBAR_PROGRESSBAR_DESIGN_1,
|
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_SAT_DISPLAY,
|
||||||
LOCALE_MISCSETTINGS_INFOBAR_SHOW,
|
LOCALE_MISCSETTINGS_INFOBAR_SHOW,
|
||||||
LOCALE_MISCSETTINGS_INFOBAR_SHOW_DD_AVAILABLE,
|
LOCALE_MISCSETTINGS_INFOBAR_SHOW_DD_AVAILABLE,
|
||||||
|
@@ -1183,6 +1183,8 @@ const char * locale_real_names[] =
|
|||||||
"miscsettings.infobar_progressbar_design",
|
"miscsettings.infobar_progressbar_design",
|
||||||
"miscsettings.infobar_progressbar_design_0",
|
"miscsettings.infobar_progressbar_design_0",
|
||||||
"miscsettings.infobar_progressbar_design_1",
|
"miscsettings.infobar_progressbar_design_1",
|
||||||
|
"miscsettings.infobar_progressbar_design_2",
|
||||||
|
"miscsettings.infobar_progressbar_design_3",
|
||||||
"miscsettings.infobar_sat_display",
|
"miscsettings.infobar_sat_display",
|
||||||
"miscsettings.infobar_show",
|
"miscsettings.infobar_show",
|
||||||
"miscsettings.infobar_show_dd_available",
|
"miscsettings.infobar_show_dd_available",
|
||||||
|
Reference in New Issue
Block a user