mirror of
https://github.com/tuxbox-fork-migrations/recycled-ni-neutrino.git
synced 2025-09-18 10:51:07 +02:00
Merge branch 'pu/cc' into next-cc
Conflicts:
acinclude.m4
data/locale/deutsch.locale
data/locale/english.locale
src/driver/volume.cpp
src/eitd/SIlanguage.cpp
src/gui/bedit/bouqueteditor_channels.cpp
src/gui/bedit/bouqueteditor_chanselect.cpp
src/gui/bouquetlist.cpp
src/gui/channellist.cpp
src/gui/eventlist.cpp
src/gui/osd_setup.cpp
src/gui/scan.cpp
src/gui/scan.h
src/gui/test_menu.cpp
src/gui/timeosd.cpp
src/gui/widget/progressbar.cpp
src/gui/widget/progressbar.h
src/neutrino.cpp
src/nhttpd/yconfig.h
Origin commit data
------------------
Commit: 8bb70d1ab3
Author: [CST] Focus <focus.cst@gmail.com>
Date: 2013-04-17 (Wed, 17 Apr 2013)
This commit is contained in:
@@ -38,7 +38,6 @@ libneutrino_gui_widget_a_SOURCES = \
|
||||
messagebox.cpp \
|
||||
mountchooser.cpp \
|
||||
msgbox.cpp \
|
||||
progressbar.cpp \
|
||||
stringinput.cpp \
|
||||
stringinput_ext.cpp \
|
||||
textbox.cpp
|
||||
|
@@ -322,9 +322,9 @@ void CMenuWidget::Init(const std::string & Icon, const int mwidth, const mn_widg
|
||||
mglobal = CMenuGlobal::getInstance(); //create CMenuGlobal instance only here
|
||||
frameBuffer = CFrameBuffer::getInstance();
|
||||
iconfile = Icon;
|
||||
details_line = NULL;
|
||||
info_box = NULL;
|
||||
|
||||
details_line = new CComponentsDetailLine();
|
||||
info_box = new CComponentsInfoBox();
|
||||
|
||||
//handle select values
|
||||
if(w_index > MN_WIDGET_ID_MAX){
|
||||
//error
|
||||
@@ -816,13 +816,14 @@ void CMenuWidget::calcSize()
|
||||
}
|
||||
hint_height = 0;
|
||||
if(g_settings.show_menu_hints && has_hints) {
|
||||
hint_height = 60; //TODO: rework calculation of hint_height
|
||||
int fheight = g_Font[SNeutrinoSettings::FONT_TYPE_MENU_HINT]->getHeight();
|
||||
hint_height = 10 + 2*fheight;
|
||||
int h_tmp = 16 + 2*fheight;
|
||||
/* assuming all hint icons has the same size ! */
|
||||
int iw, ih;
|
||||
frameBuffer->getIconSize(NEUTRINO_ICON_HINT_TVMODE, &iw, &ih);
|
||||
if(hint_height < (ih+10))
|
||||
hint_height = ih+10;
|
||||
h_tmp = std::max(h_tmp, ih+10);
|
||||
hint_height = std::max(h_tmp, hint_height);
|
||||
}
|
||||
/* set the max height to 9/10 of usable screen height
|
||||
debatable, if the callers need a possibility to set this */
|
||||
@@ -1070,16 +1071,16 @@ void CMenuWidget::paintHint(int pos)
|
||||
{
|
||||
if (!g_settings.show_menu_hints)
|
||||
return;
|
||||
|
||||
|
||||
if (pos < 0 && !hint_painted)
|
||||
return;
|
||||
|
||||
|
||||
int rad = RADIUS_LARGE;
|
||||
|
||||
int xpos = x - ConnectLineBox_Width;
|
||||
int ypos2 = y + height + rad + SHADOW_OFFSET + INFO_BOX_Y_OFFSET;
|
||||
int iwidth = width+sb_width;
|
||||
|
||||
#if 0
|
||||
if (hint_painted) {
|
||||
/* clear detailsline line */
|
||||
// TODO CComponents::hide with param restore ? or auto (if it have saved screens) ?
|
||||
@@ -1099,134 +1100,86 @@ void CMenuWidget::paintHint(int pos)
|
||||
}
|
||||
}
|
||||
hint_painted = false;
|
||||
#endif
|
||||
if (hint_painted) {
|
||||
/* clear detailsline line */
|
||||
if (details_line)
|
||||
details_line->hide();
|
||||
/* clear info box */
|
||||
if ((info_box) && (pos == -1))
|
||||
info_box->hide(true);
|
||||
hint_painted = false;
|
||||
}
|
||||
if (pos < 0)
|
||||
return;
|
||||
|
||||
|
||||
CMenuItem* item = items[pos];
|
||||
//printf("paintHint: icon %s text %s\n", item->hintIcon.c_str(), g_Locale->getText(item->hint));
|
||||
|
||||
|
||||
if (item->hintIcon.empty() && item->hint == NONEXISTANT_LOCALE) {
|
||||
#if 0
|
||||
if (info_box != NULL) {
|
||||
if (savescreen)
|
||||
#endif
|
||||
if (info_box)
|
||||
info_box->hide(false);
|
||||
#if 0
|
||||
info_box->restore();
|
||||
else
|
||||
info_box->hide();
|
||||
}
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
|
||||
hint_painted = true;
|
||||
|
||||
|
||||
if (item->hint == NONEXISTANT_LOCALE)
|
||||
return;
|
||||
|
||||
int iheight = item->getHeight();
|
||||
|
||||
//details line
|
||||
|
||||
//init details line and infobox dimensions
|
||||
int ypos1 = item->getYPosition();
|
||||
int ypos1a = ypos1 + (iheight/2)-2;
|
||||
int ypos2a = ypos2 + (hint_height/2) - INFO_BOX_Y_OFFSET;
|
||||
int markh = hint_height > rad*2 ? hint_height - rad*2 : hint_height;
|
||||
int imarkh = iheight/2+1;
|
||||
|
||||
if (details_line == NULL){
|
||||
details_line = new CComponentsDetailLine(xpos, ypos1a, ypos2a, imarkh, markh);
|
||||
}else{
|
||||
//init details line
|
||||
if (details_line){
|
||||
details_line->setXPos(xpos);
|
||||
details_line->setYPos(ypos1a);
|
||||
details_line->setYPosDown(ypos2a);
|
||||
details_line->setHMarkDown(markh);
|
||||
details_line->setColor(COL_MENUCONTENT_PLUS_6, COL_MENUCONTENTDARK_PLUS_0);
|
||||
details_line->setHMarkTop(imarkh);
|
||||
details_line->setHMarkDown(markh);
|
||||
details_line->syncSysColors();
|
||||
}
|
||||
#if 0
|
||||
details_line->paint(savescreen);
|
||||
#endif
|
||||
|
||||
if (info_box == NULL)
|
||||
info_box = new CComponentsInfoBox(x, ypos2, iwidth, hint_height);
|
||||
else {
|
||||
info_box->setXPos(x);
|
||||
info_box->setYPos(ypos2);
|
||||
info_box->setWidth(iwidth);
|
||||
info_box->setColor(COL_MENUCONTENT_PLUS_6, COL_MENUCONTENTDARK_PLUS_0, COL_MENUCONTENTDARK_PLUS_0);
|
||||
//init infobox
|
||||
std::string str = g_Locale->getText(item->hint);
|
||||
if (info_box){
|
||||
info_box->setDimensionsAll(x, ypos2, iwidth, hint_height);
|
||||
info_box->setFrameThickness(2);
|
||||
info_box->removeLineBreaks(str);
|
||||
info_box->setText(str, CTextBox::AUTO_WIDTH, g_Font[SNeutrinoSettings::FONT_TYPE_MENU_HINT]);
|
||||
info_box->setCornerRadius(RADIUS_LARGE);
|
||||
info_box->syncSysColors();
|
||||
info_box->setShadowOnOff(CC_SHADOW_ON);
|
||||
info_box->setPicture(item->hintIcon);
|
||||
}
|
||||
#if 0
|
||||
/* force full paint - menu-over i.e. option chooser with pulldown can overwrite */
|
||||
info_box->paint(savescreen, true);
|
||||
#endif
|
||||
|
||||
int offset = 10;
|
||||
if (!item->hintIcon.empty()) {
|
||||
int iw, ih;
|
||||
frameBuffer->getIconSize(item->hintIcon.c_str(), &iw, &ih);
|
||||
if (iw && ih) {
|
||||
int ix = x + offset;
|
||||
int iy = ypos2 + (hint_height - ih)/2;
|
||||
frameBuffer->paintIcon(item->hintIcon.c_str(), ix, iy);
|
||||
offset += iw + 10;
|
||||
}
|
||||
}
|
||||
if (item->hint == NONEXISTANT_LOCALE)
|
||||
return;
|
||||
|
||||
int HintFont = SNeutrinoSettings::FONT_TYPE_MENU_HINT;
|
||||
int fheight = g_Font[HintFont]->getHeight();
|
||||
|
||||
std::string str1, str2;
|
||||
std::string str = g_Locale->getText(item->hint);
|
||||
std::string::size_type spos = str.find_first_of("\n");
|
||||
if (spos != std::string::npos) {
|
||||
str1 = str.substr(0, spos);
|
||||
str2 = str.substr(spos+1);
|
||||
}
|
||||
else
|
||||
str1 = str;
|
||||
|
||||
if ((!str1.empty()) || (!str1.empty())) {
|
||||
int wBox = iwidth - 6 - offset;
|
||||
int wStr1 = 0, wStr2 = 0;
|
||||
if (!str1.empty())
|
||||
wStr1 = g_Font[HintFont]->getRenderWidth(str1);
|
||||
if (!str2.empty())
|
||||
wStr2 = g_Font[HintFont]->getRenderWidth(str2);
|
||||
if ((wStr1 > wBox) || (wStr2 > wBox)) {
|
||||
str = g_Locale->getText(item->hint);
|
||||
// replace "\n" with " "
|
||||
spos = str.find_first_of("\n");
|
||||
if (spos != std::string::npos)
|
||||
str.replace(spos, 1, " ");
|
||||
spos = str.length();
|
||||
if (spos >= 1) {
|
||||
std::string BreakChars = "+-/";
|
||||
str1 = str;
|
||||
wStr1 = g_Font[HintFont]->getRenderWidth(str1);
|
||||
int count = 0;
|
||||
std::string bChar;
|
||||
while (wStr1 > wBox) {
|
||||
spos = str1.find_last_of(BreakChars + " ");
|
||||
if (spos != std::string::npos) {
|
||||
str1 = str1.substr(0, spos+1);
|
||||
// Last delimiter remember if it's not a whitespace
|
||||
size_t len = str1.length();
|
||||
size_t spos2 = str1.find_last_of(BreakChars);
|
||||
if (len == spos2+1)
|
||||
bChar = str1.substr(spos2, spos2+1);
|
||||
else
|
||||
bChar = "";
|
||||
// Remove last delimiter
|
||||
str1 = str1.substr(0, spos);
|
||||
}
|
||||
// Width of string with delimiter
|
||||
wStr1 = g_Font[HintFont]->getRenderWidth(str1 + bChar);
|
||||
count++;
|
||||
if (count > 20)
|
||||
break;
|
||||
}
|
||||
// Last delimiter append again
|
||||
str1 += bChar;
|
||||
str2 = str.substr(spos+1);
|
||||
}
|
||||
}
|
||||
ypos2 += (hint_height-fheight*2)/2;
|
||||
if (!str1.empty())
|
||||
g_Font[HintFont]->RenderString(x+offset, ypos2+fheight, wBox, str1, COL_MENUCONTENT, 0, true); // UTF-8
|
||||
if (!str2.empty())
|
||||
g_Font[HintFont]->RenderString(x+offset, ypos2+fheight*2, wBox, str2, COL_MENUCONTENT, 0, true); // UTF-8
|
||||
}
|
||||
|
||||
//paint result
|
||||
details_line->paint();
|
||||
info_box->paint();
|
||||
|
||||
hint_painted = true;
|
||||
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------
|
||||
|
@@ -425,6 +425,7 @@ class CMenuWidget : public CMenuTarget
|
||||
CMenuGlobal *mglobal;
|
||||
CComponentsDetailLine *details_line;
|
||||
CComponentsInfoBox *info_box;
|
||||
int hint_height;
|
||||
|
||||
protected:
|
||||
std::string nameString;
|
||||
@@ -448,7 +449,6 @@ class CMenuWidget : public CMenuTarget
|
||||
fb_pixel_t *background;
|
||||
int full_width, full_height;
|
||||
bool savescreen;
|
||||
int hint_height;
|
||||
bool has_hints; // is any items has hints
|
||||
bool hint_painted; // is hint painted
|
||||
|
||||
|
@@ -1,323 +0,0 @@
|
||||
/*
|
||||
* (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
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#include <global.h>
|
||||
#include <neutrino.h>
|
||||
|
||||
#include "icons.h"
|
||||
#include "progressbar.h"
|
||||
|
||||
#define ITEMW 4
|
||||
#define POINT 2
|
||||
|
||||
#define RED 0xFF0000
|
||||
#define GREEN 0x00FF00
|
||||
#define YELLOW 0xFFFF00
|
||||
|
||||
CProgressBar::CProgressBar(const bool bl, const int w, const int h,
|
||||
const int r, const int g, const int b, const bool inv)
|
||||
{
|
||||
frameBuffer = CFrameBuffer::getInstance();
|
||||
font_pbar = SNeutrinoSettings::FONT_TYPE_INFOBAR_SMALL;
|
||||
// frame width around active bar
|
||||
frame_widht = 2;
|
||||
blink = bl;
|
||||
invert = inv;
|
||||
red = r;
|
||||
green = g;
|
||||
yellow = b;
|
||||
width = w;
|
||||
height = h;
|
||||
last_width = -1;
|
||||
bl_changed = g_settings.progressbar_color;
|
||||
}
|
||||
|
||||
CProgressBar::~CProgressBar()
|
||||
{
|
||||
}
|
||||
|
||||
static inline unsigned int make16color(__u32 rgb)
|
||||
{
|
||||
return 0xFF000000 | rgb;
|
||||
}
|
||||
|
||||
void CProgressBar::paintProgressBar ( const int pos_x,
|
||||
const int pos_y,
|
||||
const int pb_width,
|
||||
const int pb_height,
|
||||
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,
|
||||
const fb_pixel_t shadowbar_col,
|
||||
const char *upper_labeltext,
|
||||
const uint8_t uppertext_col,
|
||||
const char *iconfile,
|
||||
bool paintZero)
|
||||
{
|
||||
width = pb_width;
|
||||
height = pb_height;
|
||||
realpaint(pos_x, pos_y, value, max_value,
|
||||
activebar_col, passivebar_col, backgroundbar_col, shadowbar_col,
|
||||
upper_labeltext, uppertext_col, iconfile, paintZero);
|
||||
}
|
||||
|
||||
void CProgressBar::paintProgressBar2(const int pos_x,
|
||||
const int pos_y,
|
||||
const int value,
|
||||
const int max_value,
|
||||
const fb_pixel_t activebar_col,
|
||||
const fb_pixel_t passivebar_col,
|
||||
const fb_pixel_t frame_col,
|
||||
const fb_pixel_t shadowbar_col,
|
||||
const char * upper_labeltext,
|
||||
const uint8_t uppertext_col,
|
||||
const char * iconfile,
|
||||
bool paintZero)
|
||||
{
|
||||
if (height < 0 || width < 0)
|
||||
{
|
||||
fprintf(stderr, "CProgressBar::paintProgressBar2 height or width not set!\n");
|
||||
return;
|
||||
}
|
||||
realpaint(pos_x, pos_y, value, max_value,
|
||||
activebar_col, passivebar_col, frame_col, shadowbar_col,
|
||||
upper_labeltext, uppertext_col, iconfile, paintZero);
|
||||
}
|
||||
|
||||
void CProgressBar::realpaint(const int pos_x, const int pos_y,
|
||||
const int val, const int max_value,
|
||||
const fb_pixel_t activebar_col,
|
||||
const fb_pixel_t passivebar_col,
|
||||
const fb_pixel_t backgroundbar_col,
|
||||
const fb_pixel_t shadowbar_col,
|
||||
const char *upper_labeltext,
|
||||
const uint8_t uppertext_col,
|
||||
const char *iconfile,
|
||||
bool paintZero)
|
||||
{
|
||||
if(bl_changed != g_settings.progressbar_color) {
|
||||
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;
|
||||
|
||||
/* radius is 0 for now, since the rounded corner code is sufficiently
|
||||
different from tuxbox.org's so that everything else looks 'strange' */
|
||||
const int c_rad = 0;
|
||||
|
||||
/* if the bar is too small, do not draw the borders around it */
|
||||
if (height / 2 <= frame_widht || (blink && g_settings.progressbar_color) || backgroundbar_col == 0)
|
||||
frame_widht = 0;
|
||||
// get icon size
|
||||
int icon_w = 0, icon_h = 0;
|
||||
if(iconfile != NULL)
|
||||
frameBuffer->getIconSize(iconfile, &icon_w, &icon_h);
|
||||
|
||||
// start positions x/y active bar
|
||||
int start_x = icon_w != 0 ? pos_x + icon_w + 2*frame_widht : pos_x + frame_widht;
|
||||
int start_y = pos_y + frame_widht;
|
||||
|
||||
// width active bar for current value
|
||||
int active_pb_width;
|
||||
if (max_value)
|
||||
active_pb_width = (width - icon_w - 2 * frame_widht) * value / max_value;
|
||||
else
|
||||
active_pb_width = 0;
|
||||
|
||||
// max width active/passive bar
|
||||
int pb_max_width = icon_w != 0 ? (width - 2*frame_widht) - icon_w - frame_widht : width - 2*frame_widht;
|
||||
|
||||
// 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;
|
||||
|
||||
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;
|
||||
|
||||
// shadow
|
||||
if (shadowbar_col != 0)
|
||||
frameBuffer->paintBoxRel(pos_x + SHADOW_OFFSET, pos_y + SHADOW_OFFSET,
|
||||
width, pb_max_height, shadowbar_col, c_rad); // shadow
|
||||
|
||||
// background = frame
|
||||
if (backgroundbar_col != 0) {
|
||||
// we must paint background as frame, because of flicker effects at screen on fast changing values
|
||||
frameBuffer->paintBoxRel(pos_x, pos_y, 10, pb_max_height, backgroundbar_col, c_rad, CORNER_LEFT);
|
||||
frameBuffer->paintBoxRel(pos_x + width - 10, pos_y, 10, pb_max_height, backgroundbar_col, c_rad, CORNER_RIGHT);
|
||||
frameBuffer->paintBoxRel(pos_x + 10, pos_y, width - 20, frame_widht, backgroundbar_col);
|
||||
frameBuffer->paintBoxRel(pos_x + 10, pos_y + pb_max_height - frame_widht, width - 20, frame_widht, backgroundbar_col);
|
||||
}
|
||||
|
||||
frameBuffer->paintBoxRel(start_x, start_y, active_pb_width, bar_height, active_col); // active bar
|
||||
frameBuffer->paintBoxRel(start_x_passive_bar, start_y, width_passive_bar, bar_height, passive_col); // passive bar
|
||||
if (paintZero && value == 0)
|
||||
frameBuffer->paintLine(pos_x+2 , pos_y+2, pos_x+width-3, pos_y+height-3, active_col); // zero line
|
||||
}
|
||||
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 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;
|
||||
|
||||
if (last_width == -1 && backgroundbar_col != 0) /* first paint */
|
||||
{
|
||||
frameBuffer->paintBoxRel(pos_x, pos_y, width, pb_max_height, backgroundbar_col);
|
||||
if (shadowbar_col != 0)
|
||||
frameBuffer->paintBoxRel(pos_x + SHADOW_OFFSET, pos_y + SHADOW_OFFSET,
|
||||
width, pb_max_height, shadowbar_col, c_rad); // shadow
|
||||
}
|
||||
|
||||
if (active_pb_width != last_width) {
|
||||
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;
|
||||
if (invert)
|
||||
rgb = GREEN + (diff << 16); // adding red
|
||||
else
|
||||
rgb = RED + (diff << 8); // adding green
|
||||
color = make16color(rgb);
|
||||
for (j = 0; j < hcnt; j++)
|
||||
frameBuffer->paintBoxRel(pos_x + i * itemw, py + j * itemh,
|
||||
pointx, pointy, color);
|
||||
}
|
||||
step = yw - rd - 1;
|
||||
if (step < 1)
|
||||
step = 1;
|
||||
for (; (i < yw) && (i < maxi); i++) {
|
||||
diff = b++ * 255 / step / 2;
|
||||
if (invert)
|
||||
rgb = YELLOW - (diff << 8); // removing green
|
||||
else
|
||||
rgb = YELLOW - (diff << 16); // removing red
|
||||
color = make16color(rgb);
|
||||
for (j = 0; j < hcnt; j++)
|
||||
frameBuffer->paintBoxRel(pos_x + i * itemw, py + j * itemh,
|
||||
pointx, pointy, 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;
|
||||
if (invert)
|
||||
rgb = YELLOW - (diff << 8); // removing green
|
||||
else
|
||||
rgb = YELLOW - (diff << 16); // removing red
|
||||
color = make16color(rgb);
|
||||
for (j = 0; j < hcnt; j++)
|
||||
frameBuffer->paintBoxRel(pos_x + i * itemw, py + j * itemh,
|
||||
pointx, pointy, 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
|
||||
}
|
||||
last_width = active_pb_width;
|
||||
}
|
||||
}
|
||||
|
||||
// paint icon if present
|
||||
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) {
|
||||
g_Font[font_pbar]->RenderString(start_x +2,
|
||||
upper_labeltext_y,
|
||||
width,
|
||||
upper_labeltext,
|
||||
uppertext_col != 0 ? uppertext_col : COL_INFOBAR,
|
||||
height,
|
||||
true); // UTF8
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void CProgressBar::paintProgressBarDefault( const int pos_x,
|
||||
const int pos_y,
|
||||
const int pb_width,
|
||||
const int pb_height,
|
||||
const int value,
|
||||
const int max_value)
|
||||
{
|
||||
paintProgressBar (pos_x, pos_y, pb_width, pb_height, value, max_value, 0, 0, COL_INFOBAR_SHADOW_PLUS_1, 0, "", 0);
|
||||
}
|
@@ -1,142 +0,0 @@
|
||||
/*
|
||||
* (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
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef __gui_widget_progressbar_h__
|
||||
#define __gui_widget_progressbar_h__
|
||||
#include "config.h"
|
||||
#include <gui/color.h>
|
||||
#include <driver/framebuffer.h>
|
||||
#include <driver/fontrenderer.h>
|
||||
#include <system/settings.h>
|
||||
|
||||
#include <string>
|
||||
|
||||
class CProgressBar
|
||||
{
|
||||
private:
|
||||
CFrameBuffer * frameBuffer;
|
||||
int font_pbar;
|
||||
int frame_widht;
|
||||
int last_width;
|
||||
int red, green, yellow;
|
||||
bool blink, invert, bl_changed;
|
||||
int width, height;
|
||||
void realpaint(const int pos_x, const int pos_y,
|
||||
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,
|
||||
const fb_pixel_t shadowbar_col,
|
||||
const char *upper_labeltext,
|
||||
const uint8_t uppertext_col,
|
||||
const char *iconfile,
|
||||
bool paintZero);
|
||||
|
||||
|
||||
public:
|
||||
/* parameters:
|
||||
blinkenligts: true if you want code to follow progressbar_color. needed, no default.
|
||||
w, h: width / height of bar. Can later be set with paintProgressbar.
|
||||
paintProgressBar2 can oly be used if w and h are set.
|
||||
r, g, b: percentage of the bar where red/green/yellow is used.
|
||||
only used if blinkenlights == true.
|
||||
inv: false => red on the left side, true: red on right side. */
|
||||
CProgressBar(const bool blinkenlights,
|
||||
const int w = -1,
|
||||
const int h = -1,
|
||||
const int r = 40,
|
||||
const int g = 100,
|
||||
const int b =70,
|
||||
const bool inv = false);
|
||||
~CProgressBar();
|
||||
|
||||
/// void paintProgressBar(...)
|
||||
/*!
|
||||
description of parameters:
|
||||
|
||||
position of progressbar:
|
||||
pos_x > start position on screen x
|
||||
pos_y > start position on screen y
|
||||
pb_width > with of progressbar
|
||||
pb_height > height of progressbar
|
||||
|
||||
definitions of values:
|
||||
value > value, you will display
|
||||
max_value > maximal value that you will display
|
||||
|
||||
appearance:
|
||||
activebar_col > color of inner bar that shows the current value
|
||||
passivebar_col > color of passive bar
|
||||
frame_col > general frame color of progressbar, set 0 for no frame
|
||||
shadowbar_col color > shadow behind progressbar, set 0 for no shadow
|
||||
|
||||
upper_labeltext > optional, label text, will be painted upper/left the progressbar
|
||||
uppertext_col > optional, but necessary with label text, color of label text
|
||||
iconfile > optional, name of iconfile
|
||||
paintZero > optional, if set to true and value = 0, then paints a diagonal line instead of active bar as symbolic for a zero value
|
||||
*/
|
||||
void paintProgressBar ( const int pos_x,
|
||||
const int pos_y,
|
||||
const int pb_width,
|
||||
const int pb_height,
|
||||
const int value,
|
||||
const int max_value,
|
||||
const fb_pixel_t activebar_col = 0,
|
||||
const fb_pixel_t passivebar_col = 0,
|
||||
const fb_pixel_t frame_col = 0,
|
||||
const fb_pixel_t shadowbar_col = 0,
|
||||
const char * upper_labeltext = NULL,
|
||||
const uint8_t uppertext_col = 0,
|
||||
const char * iconfile = NULL,
|
||||
bool paintZero = false);
|
||||
|
||||
void paintProgressBar2 (const int pos_x,
|
||||
const int pos_y,
|
||||
const int value,
|
||||
const int max_value = 100,
|
||||
const fb_pixel_t activebar_col = 0,
|
||||
const fb_pixel_t passivebar_col = 0,
|
||||
const fb_pixel_t frame_col = 0,
|
||||
const fb_pixel_t shadowbar_col = 0,
|
||||
const char * upper_labeltext = NULL,
|
||||
const uint8_t uppertext_col = 0,
|
||||
const char * iconfile = NULL,
|
||||
bool paintZero = false);
|
||||
|
||||
void paintProgressBarDefault ( const int pos_x,
|
||||
const int pos_y,
|
||||
const int pb_width,
|
||||
const int pb_height,
|
||||
const int value,
|
||||
const int max_value);
|
||||
|
||||
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__ */
|
@@ -644,6 +644,8 @@ void CTextBox::hide (void)
|
||||
if(frameBuffer == NULL)
|
||||
return;
|
||||
|
||||
frameBuffer->paintBackgroundBoxRel(m_cFrame.iX, m_cFrame.iY, m_cFrame.iWidth, m_cFrame.iHeight);
|
||||
if (m_nPaintBackground)
|
||||
frameBuffer->paintBackgroundBoxRel(m_cFrame.iX, m_cFrame.iY, m_cFrame.iWidth, m_cFrame.iHeight);
|
||||
|
||||
frameBuffer = NULL;
|
||||
}
|
||||
|
@@ -72,7 +72,7 @@ class CBox
|
||||
|
||||
public:
|
||||
/* Constructor */
|
||||
inline CBox(){iY = 0; iX = 0; iWidth = 0;iHeight = 0;};
|
||||
inline CBox(){iX=0; iY=0; iWidth=0; iHeight=0;};
|
||||
inline CBox( const int _iX, const int _iY, const int _iWidth, const int _iHeight){iX=_iX; iY=_iY; iWidth=_iWidth; iHeight=_iHeight;};
|
||||
inline ~CBox(){;};
|
||||
/* Functions */
|
||||
|
Reference in New Issue
Block a user