diff --git a/data/locale/deutsch.locale b/data/locale/deutsch.locale index db0117e0e..24eeb6ed4 100644 --- a/data/locale/deutsch.locale +++ b/data/locale/deutsch.locale @@ -578,6 +578,7 @@ imageinfo.forum Forum: imageinfo.head Image Info: imageinfo.homepage Homepage: imageinfo.image Image: +imageinfo.kernel Kernel: imageinfo.license Lizenz: imageinfo.version Version: inetradio.name Internetradio @@ -1140,8 +1141,8 @@ miscsettings.infobar_logo_hdd_dir Logo-Verz. miscsettings.infobar_progressbar Fortschrittsbalken Opt. miscsettings.infobar_progressbar_0 Standard miscsettings.infobar_progressbar_1 unterhalb Kanalname -miscsettings.infobar_progressbar_2 unterhalb Kanalname schmal -miscsettings.infobar_progressbar_3 zwischen EPG-Events schmal +miscsettings.infobar_progressbar_2 unterhalb Kanalname (schmal) +miscsettings.infobar_progressbar_3 zwischen EPG-Events (schmal) 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 033d6ecd6..8c6b900c6 100644 --- a/data/locale/english.locale +++ b/data/locale/english.locale @@ -578,6 +578,7 @@ imageinfo.forum Forum: imageinfo.head Image info: imageinfo.homepage Home page: imageinfo.image Image: +imageinfo.kernel Kernel: imageinfo.license License: imageinfo.version Version: inetradio.name Internetradio diff --git a/src/driver/volume.cpp b/src/driver/volume.cpp index 73c814adc..f9c58554e 100644 --- a/src/driver/volume.cpp +++ b/src/driver/volume.cpp @@ -43,7 +43,7 @@ #include #if HAVE_COOL_HARDWARE -#include +#include #endif #define VOLUME_SCRIPT CONFIGDIR "/volume.sh" @@ -108,13 +108,15 @@ void CVolume::Init() digit_w = g_Font[VolumeFont]->getRenderWidth("100"); digit_offset = g_Font[VolumeFont]->getDigitOffset(); digit_h = g_Font[VolumeFont]->getDigitHeight(); - progress_h = std::max(icon_h, digit_h) - 2*pB; + progress_h = std::max(icon_h, digit_h); vbar_w += digit_w; } vbar_h = std::max((icon_h * faktor_h) / 10, digit_h+digit_offset); if (volscale) delete volscale; - volscale = new CProgressBar(true, progress_w, progress_h, 50, 100, 80, true); + volscale = new CProgressBar(progress_x, progress_y, progress_w, progress_h, colFrame, colBar, colShadow, COL_MENUCONTENT_PLUS_3, COL_MENUCONTENT_PLUS_1, true); + volscale->setInvert(); + volscale->setFrameThickness(2); // mute icon mute_icon_dx = 0; @@ -258,8 +260,6 @@ void CVolume::setVolume(const neutrino_msg_t key, const bool bDoPaint, bool nowa frameBuffer->paintBoxRel(x+ShadowOffset , y+ShadowOffset , (paintDigits) ? vbar_w - vbar_h : vbar_w + 1, vbar_h, colShadow, ROUNDED, (paintDigits) ? CORNER_TOP_LEFT | CORNER_BOTTOM_LEFT : CORNER_ALL); // volumebar frameBuffer->paintBoxRel(x , y , (paintDigits) ? vbar_w - vbar_h : vbar_w + 1, vbar_h, colBar, ROUNDED, (paintDigits) ? CORNER_TOP_LEFT | CORNER_BOTTOM_LEFT : CORNER_ALL); - // frame for progress - frameBuffer->paintBoxRel(progress_x-pB, progress_y-pB, progress_w+pB*2, progress_h+pB*2, colFrame); // volume icon frameBuffer->paintIcon(NEUTRINO_ICON_VOLUME, icon_x, icon_y, 0, colBar); @@ -367,8 +367,6 @@ void CVolume::setVolume(const neutrino_msg_t key, const bool bDoPaint, bool nowa void CVolume::refreshVolumebar(int current_volume) { - // progressbar - volscale->paintProgressBar2(progress_x, progress_y, current_volume); if (paintDigits) { // shadow for erase digits if (paintShadow) @@ -380,6 +378,9 @@ void CVolume::refreshVolumebar(int current_volume) snprintf(buff, 4, "%3d", current_volume); g_Font[VolumeFont]->RenderString(digit_x, digit_y, digit_w, buff, colContent); } + // progressbar + volscale->setValues(current_volume, 100); + volscale->paint(); } bool CVolume::changeNotify(const neutrino_locale_t OptionName, void * data) diff --git a/src/gui/bedit/bouqueteditor_chanselect.cpp b/src/gui/bedit/bouqueteditor_chanselect.cpp index 5e2432668..764de2232 100644 --- a/src/gui/bedit/bouqueteditor_chanselect.cpp +++ b/src/gui/bedit/bouqueteditor_chanselect.cpp @@ -163,10 +163,10 @@ void CBEChannelSelectWidget::onOkKeyPressed() int CBEChannelSelectWidget::exec(CMenuTarget* parent, const std::string & actionKey) { width = frameBuffer->getScreenWidthRel(); - height = frameBuffer->getScreenHeightRel(); + info_height = 2*iheight + 4; + height = frameBuffer->getScreenHeightRel() - info_height; listmaxshow = (height-theight-footerHeight-0)/iheight; height = theight+footerHeight+listmaxshow*iheight; // recalc height - info_height = 2*iheight + 4; x = getScreenStartX(width); if (x < ConnectLineBox_Width) diff --git a/src/gui/channellist.cpp b/src/gui/channellist.cpp index 154a8baec..e64fdf3a6 100644 --- a/src/gui/channellist.cpp +++ b/src/gui/channellist.cpp @@ -54,7 +54,7 @@ #include #include #include -#include +#include #include #include @@ -1913,8 +1913,9 @@ void CChannelList::paintItem(int pos) else l = snprintf(nameAndDescription, sizeof(nameAndDescription), "%s", chan->getName().c_str()); - CProgressBar pb(false); /* never colored */ int pb_space = prg_offset - title_offset; + CProgressBar pb(x+5+numwidth + title_offset, ypos + fheight/4, pb_space + 2, fheight/2); /* never colored */ + pb.setFrameThickness(2); int pb_max = pb_space - 4; if (!(p_event->description.empty())) { snprintf(nameAndDescription+l, sizeof(nameAndDescription)-l,g_settings.channellist_epgtext_align_right ? " ":" - "); @@ -1955,15 +1956,12 @@ void CChannelList::paintItem(int pos) runningPercent = pb_max; // later on which can be fatal... } - int pb_activeCol , pb_passiveCol; - if (liststart + pos != selected) { - pb_activeCol = COL_MENUCONTENT_PLUS_3; - pb_passiveCol = COL_MENUCONTENT_PLUS_1; - } else { - pb_activeCol = COL_MENUCONTENTSELECTED_PLUS_2; - pb_passiveCol = COL_MENUCONTENTSELECTED_PLUS_0; - } - pb.paintProgressBar(x+5+numwidth + title_offset, ypos + fheight/4, pb_space + 2, fheight/2, runningPercent, pb_max, pb_activeCol, pb_passiveCol, pb_activeCol); + if (liststart + pos != selected) + pb.setStatusColors(COL_MENUCONTENT_PLUS_3, COL_MENUCONTENT_PLUS_1); + else + pb.setStatusColors(COL_MENUCONTENTSELECTED_PLUS_2, COL_MENUCONTENTSELECTED_PLUS_0); + pb.setValues(runningPercent, pb_max); + pb.paint(); } } @@ -1979,15 +1977,13 @@ void CChannelList::paintItem(int pos) } else { if(g_settings.channellist_extended) { - int pbz_activeCol, pbz_passiveCol; - if (liststart + pos != selected) { - pbz_activeCol = COL_MENUCONTENT_PLUS_1; - pbz_passiveCol = COL_MENUCONTENT_PLUS_0; - } else { - pbz_activeCol = COL_MENUCONTENTSELECTED_PLUS_2; - pbz_passiveCol = COL_MENUCONTENTSELECTED_PLUS_0; - } - pb.paintProgressBar(x+5+numwidth + title_offset, ypos + fheight/4, pb_space + 2, fheight/2, 0, pb_max, pbz_activeCol, pbz_passiveCol, pbz_activeCol, 0, NULL, 0, NULL, true); + if (liststart + pos != selected) + pb.setStatusColors(COL_MENUCONTENT_PLUS_2, COL_MENUCONTENT_PLUS_1); + else + pb.setStatusColors(COL_MENUCONTENTSELECTED_PLUS_2, COL_MENUCONTENTSELECTED_PLUS_0); + pb.setValues(0, pb_max); + pb.setZeroLine(); + pb.paint(); } //name g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST]->RenderString(x+ 5+ numwidth+ 10+prg_offset, ypos+ fheight, width- numwidth- 40- 15-prg_offset, nameAndDescription, color, 0, true); // UTF-8 diff --git a/src/gui/components/Makefile.am b/src/gui/components/Makefile.am index d72c0396f..5fa381be9 100644 --- a/src/gui/components/Makefile.am +++ b/src/gui/components/Makefile.am @@ -32,6 +32,7 @@ libneutrino_gui_components_a_SOURCES = \ cc_item_box.cpp \ cc_item_infobox.cpp \ cc_item_picture.cpp \ + cc_item_progressbar.cpp \ cc_item_shapes.cpp \ cc_item_text.cpp \ - cc_item_tvpig.cpp + cc_item_tvpic.cpp diff --git a/src/gui/components/cc.h b/src/gui/components/cc.h index 644457254..55a8418a6 100644 --- a/src/gui/components/cc.h +++ b/src/gui/components/cc.h @@ -45,8 +45,9 @@ class CComponents bool firstPaint, shadow, is_painted, paint_bg; void initVarBasic(); + bool allowPaint(int i); void paintFbItems(bool do_save_bg = true); - fb_pixel_t* getScreen(int ax, int ay, int dx, int dy); + virtual fb_pixel_t* getScreen(int ax, int ay, int dx, int dy); comp_screen_data_t saved_screen; void clearSavedScreen(); @@ -103,23 +104,6 @@ class CComponentsItem : public CComponents void initVarItem(); public: - enum - { - CC_ITEMTYPE_BASE, - CC_ITEMTYPE_PICTURE, - CC_ITEMTYPE_TEXT, - CC_ITEMTYPE_TEXT_INFOBOX, - CC_ITEMTYPE_SHAPE_SQUARE, - CC_ITEMTYPE_SHAPE_CIRCLE, - CC_ITEMTYPE_PIP, - CC_ITEMTYPE_FRM, - CC_ITEMTYPE_FRM_HEADER, - CC_ITEMTYPE_FRM_ICONFORM, - CC_ITEMTYPE_FRM_WINDOW, - CC_ITEMTYPE_LABEL, - - CC_ITEMTYPES - }; CComponentsItem(); virtual void paint(bool do_save_bg = CC_SAVE_SCREEN_YES) = 0; @@ -178,7 +162,7 @@ class CComponentsText : public CComponentsItem fb_pixel_t ct_col_text; int ct_text_mode; //see textbox.h for possible modes const char* ct_text; - bool ct_text_sent; + bool ct_text_sent, ct_paint_textbg; void initVarText(); void clearCCText(); @@ -198,6 +182,7 @@ class CComponentsText : public CComponentsItem virtual inline void setTextFont(Font* font_text){ct_font = font_text;}; virtual inline void setTextColor(fb_pixel_t color_text){ ct_col_text = color_text;}; virtual inline void setTextMode(const int mode){ct_text_mode = mode;};//see textbox.h for possible modes + virtual inline void doPaintTextBoxBg(bool do_paintbox_bg){ ct_paint_textbg = do_paintbox_bg;}; virtual void setText(const char* ctext, const int mode = ~CTextBox::AUTO_WIDTH, Font* font_text = NULL); virtual void setText(const std::string& stext, const int mode = ~CTextBox::AUTO_WIDTH, Font* font_text = NULL); virtual void setText(neutrino_locale_t locale_text, const int mode = ~CTextBox::AUTO_WIDTH, Font* font_text = NULL); diff --git a/src/gui/components/cc_base.cpp b/src/gui/components/cc_base.cpp index 7655019b9..6872023f8 100644 --- a/src/gui/components/cc_base.cpp +++ b/src/gui/components/cc_base.cpp @@ -42,7 +42,7 @@ CComponents::CComponents() CComponents::~CComponents() { - hide(); + hide(); clearSavedScreen(); clear(); } @@ -78,6 +78,24 @@ void CComponents::initVarBasic() saved_screen.pixbuf = NULL; } +bool CComponents::allowPaint(int i) +{ + if(v_fbdata[i].fbdata_type == CC_FBDATA_TYPE_BOX) + return true; + + + if (v_fbdata[CC_FBDATA_TYPE_BOX].x != v_fbdata[i].x) + return true; + else if (v_fbdata[CC_FBDATA_TYPE_BOX].y != v_fbdata[i].y) + return true; + else if (v_fbdata[CC_FBDATA_TYPE_BOX].dx != v_fbdata[i].dx) + return true; + else if (v_fbdata[CC_FBDATA_TYPE_BOX].dy != v_fbdata[i].dy) + return true; + + return false; +} + //paint framebuffer stuff and fill buffer void CComponents::paintFbItems(bool do_save_bg) { @@ -120,7 +138,7 @@ void CComponents::paintFbItems(bool do_save_bg) frameBuffer->paintBoxFrame(v_fbdata[i].x, v_fbdata[i].y, v_fbdata[i].dx, v_fbdata[i].dy, v_fbdata[i].frame_thickness, v_fbdata[i].color, v_fbdata[i].r); else if (fbtype == CC_FBDATA_TYPE_BACKGROUND) frameBuffer->paintBackgroundBoxRel(x, y, v_fbdata[i].dx, v_fbdata[i].dy); - else + else if( allowPaint(i) ) frameBuffer->paintBoxRel(v_fbdata[i].x, v_fbdata[i].y, v_fbdata[i].dx, v_fbdata[i].dy, v_fbdata[i].color, v_fbdata[i].r, corner_type); } } diff --git a/src/gui/components/cc_frm.cpp b/src/gui/components/cc_frm.cpp index 55d05409b..1a55a32f1 100644 --- a/src/gui/components/cc_frm.cpp +++ b/src/gui/components/cc_frm.cpp @@ -285,7 +285,7 @@ void CComponentsForm::hide(bool no_restore) // because the handling of minitv items are different to other item types // and need an explizit call of hide() for(size_t i=0; igetItemType() == CComponentsItem::CC_ITEMTYPE_PIP){ + if (v_cc_items[i]->getItemType() == CC_ITEMTYPE_PIP){ v_cc_items[i]->hide(); break; } diff --git a/src/gui/components/cc_item_infobox.cpp b/src/gui/components/cc_item_infobox.cpp index 04eac2e54..fb8eaa9c0 100644 --- a/src/gui/components/cc_item_infobox.cpp +++ b/src/gui/components/cc_item_infobox.cpp @@ -91,9 +91,16 @@ void CComponentsInfoBox::initVarInfobox() void CComponentsInfoBox::paintPicture() { - //init and set icon paint position + //ensure empty pic object if (pic) delete pic; + pic = NULL; + + //exit if no image definied + if (pic_name == "") + return; + + //init pic object and set icon paint position pic = new CComponentsPicture(x+fr_thickness+x_offset, y+fr_thickness/*+y_offset*/, 0, 0, ""); //define icon @@ -115,7 +122,7 @@ void CComponentsInfoBox::paint(bool do_save_bg) x_text = x+fr_thickness+x_offset; //set text to the left border if picture is not painted - if (pic->isPicPainted()){ + if ((pic) && (pic->isPicPainted())){ int pic_w = pic->getWidth(); x_text += pic_w+x_offset; } @@ -127,6 +134,7 @@ void CComponentsInfoBox::paint(bool do_save_bg) cctext = new CComponentsText(); cctext->setText(ct_text, ct_text_mode, ct_font); + cctext->doPaintTextBoxBg(false); cctext->setDimensionsAll(x_text, y+fr_thickness, width-(x_text-x+x_offset+fr_thickness), height-2*fr_thickness); cctext->paint(CC_SAVE_SCREEN_NO); } diff --git a/src/gui/components/cc_item_picture.cpp b/src/gui/components/cc_item_picture.cpp index 1857ac0fe..cd5f8ebf0 100644 --- a/src/gui/components/cc_item_picture.cpp +++ b/src/gui/components/cc_item_picture.cpp @@ -105,6 +105,9 @@ void CComponentsPicture::initVarPicture() pic_painted = false; do_paint = false; + if (pic_name == "") + return; + if (pic_max_w == 0) pic_max_w = width-2*fr_thickness; diff --git a/src/gui/components/cc_item_progressbar.cpp b/src/gui/components/cc_item_progressbar.cpp new file mode 100644 index 000000000..b4369a929 --- /dev/null +++ b/src/gui/components/cc_item_progressbar.cpp @@ -0,0 +1,272 @@ +/* + Based up Neutrino-GUI - Tuxbox-Project + Copyright (C) 2001 by Steffen Hehn 'McClean' + + (C) 2008, 2013 by Thilo Graf + (C) 2009,2010,2013 Stefan Seyfried + + License: GPL + + 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., 51 Franklin St, Fifth Floor, + Boston, MA 02110-1301, USA. + */ + +#ifdef HAVE_CONFIG_H +#include +#endif + +#include +#include + +#include "cc_item_progressbar.h" + +#define ITEMW 4 +#define POINT 2 + +#define RED 0xFF0000 +#define GREEN 0x00FF00 +#define YELLOW 0xFFFF00 + +CProgressBar::CProgressBar() +{ + initVarProgressbar(); +} + +CProgressBar::CProgressBar( const int x_pos, const int y_pos, const int w, const int h, + fb_pixel_t color_frame, fb_pixel_t color_body, fb_pixel_t color_shadow, + const fb_pixel_t active_col, const fb_pixel_t passive_col, + const bool blinkenlights, + const int r, const int g, const int b, + const bool inv) +{ + initVarProgressbar(); + + //CComponents + x = x_pos; + y = y_pos; + width = w; + height = h; + + col_frame = color_frame; + col_body = color_body; + col_shadow = color_shadow; + + pb_blink = blinkenlights; + pb_invert = inv; + pb_red = r; + pb_green = g; + pb_yellow = b; + pb_active_col = active_col; + pb_passive_col = passive_col; +} + + +void CProgressBar::initVarProgressbar() +{ + //CComponentsItem + initVarItem(); + cc_item_type = CC_ITEMTYPE_PROGRESSBAR; + + //CProgressBar + pb_blink = false; + pb_invert = false; + pb_bl_changed = g_settings.progressbar_color; + pb_last_width = -1; + pb_red = 40; + pb_green = 100; + pb_yellow = 70; + pb_active_col = COL_INFOBAR_PLUS_7; + pb_passive_col = COL_INFOBAR_PLUS_3; + pb_value = 0; + pb_max_value = 0; + pb_paint_zero = false; + + // init start positions x/y active bar + pb_x = x + fr_thickness; + pb_y = y + fr_thickness; + pb_active_width = 0; + pb_max_width = width - 2*fr_thickness; + pb_height = 0; + pb_start_x_passive = 0; + pb_passive_width = width; +} + +//calculate bar dimensions +void CProgressBar::initDimensions() +{ + //prevent stupid callers, can give invalid values like "-1"... + if (pb_value < 0) + pb_value = 0; + if (pb_value > pb_max_value) + pb_max_value = pb_value; + + // start positions x/y active bar + pb_x = x + fr_thickness; + pb_y = y + fr_thickness; + + // width for active bar with current value + pb_active_width = max(0, pb_last_width); + if (pb_max_value) + pb_active_width = (width - 2*fr_thickness) * pb_value / pb_max_value; + + // max width active/passive bar + pb_max_width = width - 2*fr_thickness; + + // max height of active/passive bar + pb_height = height - 2*fr_thickness; + + pb_start_x_passive = pb_x + pb_active_width; + + pb_passive_width = pb_max_width - pb_active_width; + + // background = frame + if ( col_frame == 0 ) + col_frame = pb_active_col; +} + + +void CProgressBar::paintSimple() +{ + // progress value + if (pb_active_width != pb_last_width){ + frameBuffer->paintBoxRel(pb_x, pb_y, pb_active_width, pb_height, pb_active_col); // active bar + frameBuffer->paintBoxRel(pb_start_x_passive, pb_y, pb_passive_width, pb_height, pb_passive_col); // passive bar + } + + if (pb_paint_zero && pb_value == 0) + frameBuffer->paintLine(x+fr_thickness , y+fr_thickness, x+width-3, y+height-3, pb_active_col); // zero line +} + +void CProgressBar::paintAdvanced() +{ + 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 = pb_height; + pointy = pb_height; + break; + case PB_LINES_H: // ===== horiz. lines + itemw = POINT; + break; + case PB_COLOR: // filled color + itemw = POINT; + itemh = pb_height; + pointy = pb_height; + break; + } + } + + const int spc = itemh - pointy; /* space between horizontal lines / points */ + int hcnt = (pb_height + spc) / itemh; /* how many POINTs is the bar high */ + int yoff = (pb_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 = pb_red * pb_max_width / (100 * itemw); /* how many POINTs red */ + int yw = pb_yellow * pb_max_width / (100 * itemw); /* how many POINTs yellow */ + int gn = pb_green * pb_max_width / (100 * itemw); /* how many POINTs green */ + + int maxi = pb_active_width / itemw; /* how many POINTs is the active bar */ + int total = pb_max_width / itemw; /* total number of POINTs */ + + uint32_t rgb; + fb_pixel_t color; + + if (pb_active_width != pb_last_width) { + int i, j; + const int py = pb_y + yoff; + if (pb_active_width > pb_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 (pb_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(pb_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 (pb_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(pb_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 (pb_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(pb_x + i * itemw, py + j * itemh, pointx, pointy, color); + } + } + for(i = maxi; i < total; i++) { + for (j = 0; j < hcnt; j++) + frameBuffer->paintBoxRel(pb_x + i * itemw, py + j * itemh, pointx, pointy, pb_passive_col); //fill passive + } + } +} + + +void CProgressBar::paintProgress(bool do_save_bg) +{ + if(pb_bl_changed != g_settings.progressbar_color) { + pb_bl_changed = g_settings.progressbar_color; + reset(); + } + + initDimensions(); + + //body + if (pb_last_width == -1 && col_body != 0) /* first paint */ + paintInit(do_save_bg); + + //progress + if (!pb_blink || !g_settings.progressbar_color) + paintSimple(); + else + paintAdvanced(); + + if (is_painted) + pb_last_width = pb_active_width; +} + + +void CProgressBar::paint(bool do_save_bg) +{ + paintProgress(do_save_bg); +} diff --git a/src/gui/components/cc_item_progressbar.h b/src/gui/components/cc_item_progressbar.h new file mode 100644 index 000000000..a7c0d5796 --- /dev/null +++ b/src/gui/components/cc_item_progressbar.h @@ -0,0 +1,162 @@ +/* + Based up Neutrino-GUI - Tuxbox-Project + Copyright (C) 2001 by Steffen Hehn 'McClean' + + (C) 2008, 2013 by Thilo Graf + (C) 2009,2010,2013 Stefan Seyfried + + License: GPL + + 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., 51 Franklin St, Fifth Floor, + Boston, MA 02110-1301, USA. + */ + +/// +/*! + description of parameters: + + position of progressbar: + x_pos > start position on screen x + y_pos > 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 + + paintZero > optional, if set to true and value = 0, then paints a diagonal line instead of active bar as symbolic for a zero value +*/ + +#ifndef __CC_PROGRESSBAR_H__ +#define __CC_PROGRESSBAR_H__ + +#include "config.h" +#include +#include + +class CProgressBar : public CComponentsItem +{ + protected: + void initVarProgressbar(); + + private: + ///colors of active and passive bar area, active means the displayed value, passive the neutral area + fb_pixel_t pb_active_col, pb_passive_col; + + int pb_last_width; + + ///width of progress + int pb_active_width, pb_passive_width; + + ///maximal width,heigth of progress + int pb_max_width, pb_height; + + ///start position of bars + int pb_start_x_passive; + + ///color values + int pb_red, pb_green, pb_yellow; + + ///start position of activ/passiv area + int pb_x, pb_y; + + bool pb_blink, pb_invert, pb_bl_changed; + + ///causes a diagonal line as a sign for 0 value instead of an empty bar + bool pb_paint_zero; + + ///to evaluate values, these will be convert to the graph + int pb_value, pb_max_value; + + ///paint simple version of progressbar with simple color modifications + void paintSimple(); + ///paint version of progressbar with color and advanced display modifications + void paintAdvanced(); + + void initDimensions(); + + ///paints graph + void paintProgress(bool do_save_bg = CC_SAVE_SCREEN_NO); + + static inline unsigned int make16color(__u32 rgb){return 0xFF000000 | rgb;}; + + public: + ///parameters: + ///x_pos, y_pos, w, h: position and dimension in pixel + ///blinkenlights: true if you want code to follow progressbar_color. needed, no default. + ///w, h: width / height of bar. Can later be set with paintProgressbar. + ///r, g, b: percentage of the bar where red/green/yellow is used, only used if blinkenlights (colored) == true. + ///inv: false => red on the left side, true: red on right side. + ///active_col, passive_col: sets colors for displayed values, activ_col means the the displayed progress + ///color_frame, color_body, color_shadow: colores of progressbar for frame, body and shadow, Note: color of frame is ineffective on fr_thickness = 0 + CProgressBar(); + CProgressBar( const int x_pos, const int y_pos, + const int w = -1, const int h = -1, + fb_pixel_t color_frame = 0, fb_pixel_t color_body = COL_INFOBAR_PLUS_3, fb_pixel_t color_shadow = COL_INFOBAR_PLUS_7, + const fb_pixel_t active_col = COL_INFOBAR_PLUS_7, const fb_pixel_t passive_col = COL_INFOBAR_PLUS_3, + const bool blinkenlights = false, + const int r = 40, const int g = 100, const int b =70, + const bool inv = false ); + + + ///set up to display available values + void setValue(const int val){ pb_value = val;}; + void setMaxValue(const int max_val){pb_max_value = max_val;}; + ///set up booth values to display at once + void setValues(const int val, const int max_val){pb_value = val; pb_max_value = max_val;}; + + ///causes painting a diagonal line if value = 0, Note: ineffective in colored mode + void setZeroLine(bool paint_zero_line = true){pb_paint_zero = paint_zero_line;}; + + ///setters for status colors + void setActiveColor(fb_pixel_t active_color) {pb_active_col = active_color;}; + void setPassiveColor(fb_pixel_t passive_color) {pb_passive_col = passive_color;}; + ///set up booth status colors at once + void setStatusColors(fb_pixel_t active_color, fb_pixel_t passive_color) {pb_passive_col = passive_color; pb_active_col = active_color;}; + + ///invert: false => red on the left side, true: red on right side. + void setInvert(bool inverted = true){pb_invert = inverted;}; + + ///blinkenlights: true (default) if you want code to follow progressbar_color. + void setBlink(bool blinkenlights = true){pb_blink = blinkenlights;}; + ///r, g, b: percentage of the bar where red/green/yellow is used, only used if blinkenlights (colored) == true. + void setRgb(const int r, const int g, const int b){pb_red = r; pb_green = g; pb_yellow = b;}; + + ///x, y, width, height, value, max_value: set most wanted parameters at once + void setProgress(const int x_pos, const int y_pos, + const int w, const int h, + const int val, const int max_val){x=x_pos; y=y_pos; width=w; height=h; pb_value=val; pb_max_value=max_val;}; + + ///force update on next paint + void reset() { pb_last_width = -1; } + void paint(bool do_save_bg = CC_SAVE_SCREEN_NO); + + enum pb_color_t { + PB_MATRIX = 0, /* 0 */ + PB_LINES_V, /* 1 */ + PB_LINES_H, /* 2 */ + PB_COLOR /* 3 */ + }; + +}; + +#endif /* __CC_PROGRESSBAR_H__ */ diff --git a/src/gui/components/cc_item_text.cpp b/src/gui/components/cc_item_text.cpp index 432abfda0..f06380b07 100644 --- a/src/gui/components/cc_item_text.cpp +++ b/src/gui/components/cc_item_text.cpp @@ -91,6 +91,7 @@ void CComponentsText::initVarText() ct_text_mode = CTextBox::AUTO_WIDTH; ct_col_text = COL_MENUCONTENT; ct_text_sent = false; + ct_paint_textbg = true; } @@ -124,7 +125,7 @@ void CComponentsText::initCCText() ct_textbox->setTextMode(ct_text_mode); ct_textbox->setWindowPos(ct_box); ct_textbox->setTextBorderWidth(0); - ct_textbox->enableBackgroundPaint(false); + ct_textbox->enableBackgroundPaint(ct_paint_textbg); ct_textbox->setBackGroundColor(col_body); ct_textbox->setBackGroundRadius(corner_rad-fr_thickness, corner_type); ct_textbox->setTextColor(ct_col_text); diff --git a/src/gui/components/cc_item_tvpig.cpp b/src/gui/components/cc_item_tvpic.cpp similarity index 100% rename from src/gui/components/cc_item_tvpig.cpp rename to src/gui/components/cc_item_tvpic.cpp diff --git a/src/gui/components/cc_types.h b/src/gui/components/cc_types.h index 4dc39ef2d..3ba4d1c14 100644 --- a/src/gui/components/cc_types.h +++ b/src/gui/components/cc_types.h @@ -29,6 +29,26 @@ #include #include +///cc item types +typedef enum +{ + CC_ITEMTYPE_BASE, + CC_ITEMTYPE_PICTURE, + CC_ITEMTYPE_TEXT, + CC_ITEMTYPE_TEXT_INFOBOX, + CC_ITEMTYPE_SHAPE_SQUARE, + CC_ITEMTYPE_SHAPE_CIRCLE, + CC_ITEMTYPE_PIP, + CC_ITEMTYPE_FRM, + CC_ITEMTYPE_FRM_HEADER, + CC_ITEMTYPE_FRM_ICONFORM, + CC_ITEMTYPE_FRM_WINDOW, + CC_ITEMTYPE_LABEL, + CC_ITEMTYPE_PROGRESSBAR, + + CC_ITEMTYPES +}CC_ITEMTYPES_T; + //required typedefs typedef struct comp_fbdata_t { diff --git a/src/gui/dboxinfo.cpp b/src/gui/dboxinfo.cpp index b5ac6df49..f845b8c01 100644 --- a/src/gui/dboxinfo.cpp +++ b/src/gui/dboxinfo.cpp @@ -40,7 +40,7 @@ #include #include -#include +#include #include #include @@ -454,8 +454,11 @@ void CDBoxInfoWidget::paint() //fprintf(stderr, "width: %d offsetw: %d pbw: %d\n", width, offsetw, pbw); if (pbw > 8) /* smaller progressbar is not useful ;) */ { - CProgressBar pb(true, -1, -1, 30, 100, 70, true); - pb.paintProgressBarDefault(x+offsetw, ypos+3, pbw, mheight-10, percent_used, 100); + CProgressBar pb(x+offsetw, ypos+3, pbw, mheight-10); + pb.setBlink(); + pb.setInvert(); + pb.setValues(percent_used, 100); + pb.paint(false); } ypos+= mheight; } diff --git a/src/gui/epgview.cpp b/src/gui/epgview.cpp index 1fd4139e1..9407b8b31 100644 --- a/src/gui/epgview.cpp +++ b/src/gui/epgview.cpp @@ -33,7 +33,7 @@ #include #include #include -#include +#include #include #include @@ -649,8 +649,10 @@ int CEpgData::show(const t_channel_id channel_id, uint64_t a_id, time_t* a_start if ( epg_done!= -1 ) { int pbx = sx + 10 + widthl + 10 + ((ox-104-widthr-widthl-10-10-20)>>1); - CProgressBar pb(true, -1, -1, 30, 100, 70, true); - pb.paintProgressBarDefault(pbx, sy+oy-height, 104, height-6, epg_done, 100); + CProgressBar pb(pbx, sy+oy-height, 104, height-6); + pb.setBlink(); + pb.setValues(epg_done, 100); + pb.paint(false); } GetPrevNextEPGData( epgData.eventID, &epgData.epg_times.startzeit ); @@ -692,9 +694,11 @@ int CEpgData::show(const t_channel_id channel_id, uint64_t a_id, time_t* a_start if (data == g_InfoViewer->getUpdateTimer()) { GetEPGData(channel_id, id, &startzeit, false); if ( epg_done!= -1 ) { - CProgressBar pb(true, -1, -1, 30, 100, 70, true); - int pbx = sx + 10 + widthl + 10 + ((ox-104-widthr-widthl-10-10-20)>>1); - pb.paintProgressBarDefault(pbx, sy+oy-height, 104, height-6, epg_done, 100); + int pbx = sx + 10 + widthl + 10 + ((ox-104-widthr-widthl-10-10-20)>>1); + CProgressBar pb(pbx, sy+oy-height, 104, height-6); + pb.setBlink(); + pb.setValues(epg_done, 100); + pb.paint(false); } } if(data == fader.GetTimer()) { diff --git a/src/gui/eventlist.cpp b/src/gui/eventlist.cpp index ae0fb78b5..357c70933 100644 --- a/src/gui/eventlist.cpp +++ b/src/gui/eventlist.cpp @@ -4,13 +4,6 @@ Copyright (C) 2001 Steffen Hehn 'McClean' Homepage: http://dbox.cyberphoria.org/ - Kommentar: - - Diese GUI wurde von Grund auf neu programmiert und sollte nun vom - Aufbau und auch den Ausbaumoeglichkeiten gut aussehen. Neutrino basiert - auf der Client-Server Idee, diese GUI ist also von der direkten DBox- - Steuerung getrennt. Diese wird dann von Daemons uebernommen. - License: GPL @@ -104,16 +97,18 @@ CNeutrinoEventList::CNeutrinoEventList() m_search_channel_id = 1; m_search_bouquet_id= 1; - fw = g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_SMALL]->getWidth(); //font width - fh = g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_SMALL]->getHeight(); //font height - width = w_max (62 * fw, 40); - height = h_max (23 * fh, 20); + full_width = width = fw = 0; + height = fh = 0; - x = frameBuffer->getScreenX() + (frameBuffer->getScreenWidth() - width) / 2; - y = frameBuffer->getScreenY() + (frameBuffer->getScreenHeight() - height) / 2; + x = y = 0; + cc_infozone = NULL; + infozone_text = ""; item_event_ID = 0; FunctionBarHeight = 0; + oldIndex = -1; + oldEventID = -1; + bgRightBoxPaint = false; } CNeutrinoEventList::~CNeutrinoEventList() @@ -247,6 +242,16 @@ int CNeutrinoEventList::exec(const t_channel_id channel_id, const std::string& c showfollow = false; // Calculate iheight struct button_label tmp_button[1] = { { NEUTRINO_ICON_BUTTON_RED, NONEXISTANT_LOCALE } }; + + fw = g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_SMALL]->getWidth(); //font width + fh = g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_SMALL]->getHeight(); //font height + + full_width = frameBuffer->getScreenWidthRel(); + x = getScreenStartX(full_width); + + width = full_width / 3 * 2; + height = frameBuffer->getScreenHeightRel(); + iheight = ::paintButtons(0, 0, 0, 1, tmp_button, 0, 0, "", false, COL_INFOBAR_SHADOW, NULL, 0, false); if(iheight < fh) iheight = fh; @@ -269,9 +274,15 @@ int CNeutrinoEventList::exec(const t_channel_id channel_id, const std::string& c fwidth1 = g_Font[SNeutrinoSettings::FONT_TYPE_EVENTLIST_DATETIME]->getRenderWidth("DDD, 00:00, "); fwidth2 = g_Font[SNeutrinoSettings::FONT_TYPE_EVENTLIST_ITEMSMALL]->getRenderWidth("[999 min] "); - listmaxshow = (height-theight-iheight-0)/fheight; height = theight+iheight+0+listmaxshow*fheight; // recalc height + y = getScreenStartY(height); + + // calculate width of right info_zone + infozone_width = full_width - width; + + // init right info_zone + cc_infozone = new CComponentsText(x+width+5, y+theight+10, infozone_width-10, listmaxshow*fheight-20); int res = menu_return::RETURN_REPAINT; //printf("CNeutrinoEventList::exec: channel_id %llx\n", channel_id); @@ -356,6 +367,7 @@ int CNeutrinoEventList::exec(const t_channel_id channel_id, const std::string& c selected -= step; if((prev_selected-step) < 0) // because of uint selected = evtlist.size() - 1; + paintDescription(selected); } else if (msg == CRCInput::RC_down || (int) msg == g_settings.key_channelList_pagedown) { @@ -369,6 +381,7 @@ int CNeutrinoEventList::exec(const t_channel_id channel_id, const std::string& c else selected = ((step == (int)listmaxshow) && (selected < (((evtlist.size() / listmaxshow) + 1) * listmaxshow))) ? (evtlist.size() - 1) : 0; } + paintDescription(selected); } paintItem(prev_selected - liststart, channel_id); unsigned int oldliststart = liststart; @@ -589,6 +602,9 @@ int CNeutrinoEventList::exec(const t_channel_id channel_id, const std::string& c g_Timerd->getTimerList (timerlist); paintHead(channel_id, channelname); + oldIndex = -1; + oldEventID = -1; + bgRightBoxPaint = false; paint(channel_id); showFunctionBar(true, channel_id); timeoutEnd = CRCInput::calcTimeoutEnd(g_settings.timing[SNeutrinoSettings::TIMING_EPG]); @@ -626,6 +642,9 @@ int CNeutrinoEventList::exec(const t_channel_id channel_id, const std::string& c timerlist.clear(); g_Timerd->getTimerList (timerlist); paintHead(channel_id,in_search ? search_head_name: channelname); + oldIndex = -1; + oldEventID = -1; + bgRightBoxPaint = false; paint(channel_id); showFunctionBar(true, channel_id); timeoutEnd = CRCInput::calcTimeoutEnd(g_settings.timing[SNeutrinoSettings::TIMING_EPG]); @@ -634,6 +653,9 @@ int CNeutrinoEventList::exec(const t_channel_id channel_id, const std::string& c } else if (!showfollow && ( msg==CRCInput::RC_green )) { + oldIndex = -1; + oldEventID = -1; + bgRightBoxPaint = false; in_search = findEvents(); timeoutEnd = CRCInput::calcTimeoutEnd(g_settings.timing[SNeutrinoSettings::TIMING_EPG]); } @@ -653,6 +675,12 @@ int CNeutrinoEventList::exec(const t_channel_id channel_id, const std::string& c frameBuffer->blit(); } + delete cc_infozone; + cc_infozone = NULL; + oldIndex = -1; + oldEventID = -1; + bgRightBoxPaint = false; + hide(); fader.Stop(); return res; @@ -660,7 +688,7 @@ int CNeutrinoEventList::exec(const t_channel_id channel_id, const std::string& c void CNeutrinoEventList::hide() { - frameBuffer->paintBackgroundBoxRel(x,y, width,height); + frameBuffer->paintBackgroundBoxRel(x,y, full_width,height); showFunctionBar (false, 0); frameBuffer->blit(); @@ -698,7 +726,6 @@ void CNeutrinoEventList::paintItem(unsigned int pos, t_channel_id channel_idI) bgcolor = COL_MENUCONTENTSELECTED_PLUS_0; if(RADIUS_LARGE) frameBuffer->paintBoxRel(x, ypos, width- 15, fheight, COL_MENUCONTENT_PLUS_0, 0); - } else if (curpos == current_event ) { @@ -786,23 +813,51 @@ void CNeutrinoEventList::paintItem(unsigned int pos, t_channel_id channel_idI) // paint 2nd line text g_Font[SNeutrinoSettings::FONT_TYPE_EVENTLIST_ITEMLARGE]->RenderString(x+10+iw, ypos+ fheight, width- 25- 20 -iw, evtlist[curpos].description, color, 0, true); - - } frameBuffer->blit(); } + +void CNeutrinoEventList::paintDescription(int index) +{ + if (evtlist[index].eventID == oldEventID) { + if (oldEventID == 0) { + if (index == oldIndex) + return; + } + else + return; + } + oldEventID = evtlist[index].eventID; + oldIndex = index; + + CEPGData epgData; + if ( evtlist[index].eventID != 0 ) + CEitManager::getInstance()->getEPGid(evtlist[index].eventID, evtlist[index].startTime, &epgData); + else + CEitManager::getInstance()->getActualEPGServiceKey(evtlist[index].channelID, &epgData ); + + if(!epgData.info2.empty()) + infozone_text = epgData.info2.c_str(); + else + infozone_text = g_Locale->getText(LOCALE_EPGLIST_NOEVENTS); + + cc_infozone->setText(infozone_text, CTextBox::TOP, g_Font[SNeutrinoSettings::FONT_TYPE_EVENTLIST_ITEMLARGE]); + cc_infozone->doPaintBg(false); + cc_infozone->paint(CC_SAVE_SCREEN_NO); +} + void CNeutrinoEventList::paintHead(std::string _channelname, std::string _channelname_prev, std::string _channelname_next) { const short font_h = 8; int iw = 0, ih = 0; frameBuffer->getIconSize(NEUTRINO_ICON_BUTTON_INFO, &iw, &ih); - frameBuffer->paintBoxRel(x,y, width,theight+0, COL_MENUHEAD_PLUS_0, RADIUS_LARGE, CORNER_TOP); - int name_width =((width-8-iw)/3); + frameBuffer->paintBoxRel(x,y, full_width,theight+0, COL_MENUHEAD_PLUS_0, RADIUS_LARGE, CORNER_TOP); + int name_width =((full_width-8-iw)/3); short prev_len = g_Font[font_h]->getRenderWidth(_channelname_prev.c_str(),true); short next_len = g_Font[font_h]->getRenderWidth(_channelname_next.c_str(),true); short middle_len = g_Font[SNeutrinoSettings::FONT_TYPE_EVENTLIST_TITLE]->getRenderWidth(_channelname.c_str(),true); - short middle_offset = (width- next_len- prev_len- middle_len-iw-8)/2; + short middle_offset = (full_width- next_len- prev_len- middle_len-iw-8)/2; if(middle_offset < 0){ int fw_h = g_Font[font_h]->getWidth(); int newsize = abs(middle_offset / fw_h) + 1; @@ -814,28 +869,28 @@ void CNeutrinoEventList::paintHead(std::string _channelname, std::string _channe middle_offset = 0; } - g_Font[font_h]->RenderString(x+4,y+theight+1, width, _channelname_prev.c_str(), COL_INFOBAR, 0, true); // UTF-8 - g_Font[SNeutrinoSettings::FONT_TYPE_EVENTLIST_TITLE]->RenderString(x+prev_len+middle_offset,y+theight+1, width, _channelname.c_str(), COL_MENUHEAD, 0, true); // UTF-8 - g_Font[font_h]->RenderString(x+(name_width*3)- next_len,y+theight+1, width, _channelname_next.c_str(), COL_INFOBAR, 0, true); // UTF-8 + g_Font[font_h]->RenderString(x+4,y+theight+1, full_width, _channelname_prev.c_str(), COL_INFOBAR, 0, true); // UTF-8 + g_Font[SNeutrinoSettings::FONT_TYPE_EVENTLIST_TITLE]->RenderString(x+prev_len+middle_offset,y+theight+1, full_width, _channelname.c_str(), COL_MENUHEAD, 0, true); // UTF-8 + g_Font[font_h]->RenderString(x+(name_width*3)- next_len,y+theight+1, full_width, _channelname_next.c_str(), COL_INFOBAR, 0, true); // UTF-8 } void CNeutrinoEventList::paintHead(t_channel_id _channel_id, std::string _channelname) { bool logo_ok = false; - frameBuffer->paintBoxRel(x,y, width,theight+0, COL_MENUHEAD_PLUS_0, RADIUS_LARGE, CORNER_TOP); + frameBuffer->paintBoxRel(x,y, full_width,theight+0, COL_MENUHEAD_PLUS_0, RADIUS_LARGE, CORNER_TOP); std::string lname; int logo_w = 0; int logo_h = 0; - int logo_w_max = width / 4; + int logo_w_max = full_width / 4; if(g_settings.infobar_show_channellogo && g_PicViewer->GetLogoName(_channel_id, _channelname, lname, &logo_w, &logo_h)){ if((logo_h > theight) || (logo_w > logo_w_max)) g_PicViewer->rescaleImageDimensions(&logo_w, &logo_h, logo_w_max, theight); logo_ok = g_PicViewer->DisplayImage(lname, x+10, y+(theight-logo_h)/2, logo_w, logo_h); } else - g_Font[SNeutrinoSettings::FONT_TYPE_EVENTLIST_TITLE]->RenderString(x+15+(logo_ok? 5+logo_w:0),y+theight+1, width, _channelname.c_str(), COL_MENUHEAD, 0, true); // UTF-8 + g_Font[SNeutrinoSettings::FONT_TYPE_EVENTLIST_TITLE]->RenderString(x+15+(logo_ok? 5+logo_w:0),y+theight+1, full_width, _channelname.c_str(), COL_MENUHEAD, 0, true); // UTF-8 } void CNeutrinoEventList::paint(t_channel_id channel_id) @@ -845,15 +900,23 @@ void CNeutrinoEventList::paint(t_channel_id channel_id) int iw = 0, ih = 0; if (evtlist[0].eventID != 0) { frameBuffer->getIconSize(NEUTRINO_ICON_BUTTON_INFO, &iw, &ih); - frameBuffer->paintIcon(NEUTRINO_ICON_BUTTON_INFO, x+ width - 4 - iw, y, theight); + frameBuffer->paintIcon(NEUTRINO_ICON_BUTTON_INFO, x+ full_width - 4 - iw, y, theight); } + // paint background for right box + if (!bgRightBoxPaint) { + frameBuffer->paintBoxRel(x+width,y+theight,infozone_width,listmaxshow*fheight,COL_MENUCONTENT_PLUS_0); + bgRightBoxPaint = true; + } for(unsigned int count=0;countpaintBoxRel(x+ width- 15,ypos, 15, sb, COL_MENUCONTENT_PLUS_1); @@ -894,7 +957,7 @@ void CNeutrinoEventList::showFunctionBar (bool show, t_channel_id channel_id) { int border_space = 4; int bx = x + 2*border_space; - int bw = width - 16; + int bw = full_width - 16; int bh = iheight; int by = y + height-iheight; @@ -905,7 +968,7 @@ void CNeutrinoEventList::showFunctionBar (bool show, t_channel_id channel_id) int btn_cnt = 0; bh = std::max(FunctionBarHeight, bh); - frameBuffer->paintBackgroundBoxRel(x,by,width,bh); + frameBuffer->paintBackgroundBoxRel(x,by,full_width,bh); // -- hide only? if (! show) return; @@ -913,7 +976,7 @@ void CNeutrinoEventList::showFunctionBar (bool show, t_channel_id channel_id) frameBuffer->getIconSize(NEUTRINO_ICON_BUTTON_RED, &icol_w, &icol_h); // int fh = g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_SMALL]->getHeight(); - frameBuffer->paintBoxRel(x, by, width, iheight, COL_INFOBAR_SHADOW_PLUS_1, RADIUS_MID, CORNER_BOTTOM); + frameBuffer->paintBoxRel(x, by, full_width, iheight, COL_INFOBAR_SHADOW_PLUS_1, RADIUS_MID, CORNER_BOTTOM); int tID = -1; //any value, not NULL CTimerd::CTimerEventTypes is_timer = isScheduled(channel_id, &evtlist[selected], &tID); @@ -1302,4 +1365,3 @@ bool CEventFinderMenu::changeNotify(const neutrino_locale_t OptionName, void *) return false; } - diff --git a/src/gui/eventlist.h b/src/gui/eventlist.h index 41a128cfa..530b69e8d 100644 --- a/src/gui/eventlist.h +++ b/src/gui/eventlist.h @@ -4,13 +4,6 @@ Copyright (C) 2001 Steffen Hehn 'McClean' Homepage: http://dbox.cyberphoria.org/ - Kommentar: - - Diese GUI wurde von Grund auf neu programmiert und sollte nun vom - Aufbau und auch den Ausbaumoeglichkeiten gut aussehen. Neutrino basiert - auf der Client-Server Idee, diese GUI ist also von der direkten DBox- - Steuerung getrennt. Diese wird dann von Daemons uebernommen. - License: GPL @@ -41,6 +34,7 @@ #include #include #include +#include #include "color.h" #include "infoviewer.h" @@ -78,6 +72,9 @@ class CNeutrinoEventList t_bouquet_id m_search_bouquet_id; bool m_showChannel; int FunctionBarHeight; + int oldIndex; + event_id_t oldEventID; + bool bgRightBoxPaint; bool findEvents(void); // Eventfinder end @@ -100,14 +97,17 @@ class CNeutrinoEventList int key; std::string search_head_name; - int width, fw; - int height, fh; + int full_width, width, infozone_width, fw; + int height, infozone_height, fh; int x; int y; + std::string infozone_text; int sort_mode; event_id_t item_event_ID; + CComponentsText *cc_infozone; void paintItem(unsigned pos, t_channel_id channel_id = 0); + void paintDescription(int index); void paint(t_channel_id channel_id = 0); void paintHead(t_channel_id channel_id, std::string name); void paintHead(std::string _channelname, std::string _channelname_prev, std::string _channelname_next); diff --git a/src/gui/imageinfo.cpp b/src/gui/imageinfo.cpp index e53ba955b..b1cf1f160 100644 --- a/src/gui/imageinfo.cpp +++ b/src/gui/imageinfo.cpp @@ -58,13 +58,13 @@ CImageInfo::CImageInfo(): config ('\t') //init all var members void CImageInfo::Init(void) { - cc_win = NULL; - cc_lic = NULL; - item_offset = 20; - item_top = item_offset; - license_txt = ""; + cc_win = NULL; + cc_tv = NULL; + cc_lic = NULL; + item_offset = 20; + item_top = item_offset; + license_txt = ""; v_info.clear(); - v_info_supp.clear(); config.loadConfig("/.version"); } @@ -140,12 +140,6 @@ void CImageInfo::ShowWindow() //prepare infos InitInfos(); - //add section space - item_top += 5; - - //prepare suppoprt infos - InitSupportInfos(); - //prepare license text InitLicenseText(); @@ -157,7 +151,11 @@ void CImageInfo::ShowWindow() void CImageInfo::InitMinitv() { //init the minitv object - CComponentsPIP *cc_tv = new CComponentsPIP (0, item_top, 33/*%*/); + cc_tv = new CComponentsPIP (0, item_top); + + //init width and height + cc_tv->setWidth(cc_win->getWidth()/3); + cc_tv->setHeight(cc_win->getHeight()/3); //init x pos and use as parameter for setXPos int cc_tv_x = (cc_win->getWidth() - cc_tv->getWidth()) - item_offset; @@ -173,89 +171,85 @@ void CImageInfo::InitInfos() v_info.clear(); #ifdef GITVERSION - const char * builddate = GITVERSION; + const char * builddate = GITVERSION; #else - const char * builddate = config.getString("builddate", BUILT_DATE).c_str(); + const char * builddate = config.getString("builddate", BUILT_DATE).c_str(); #endif - const char * version = config.getString("version", "no version").c_str(); - config.getString("version", "no version"); - static CFlashVersionInfo versionInfo(version); - const char * releaseCycle = versionInfo.getReleaseCycle(); + const char * _version = config.getString("version", "no version").c_str(); + static CFlashVersionInfo versionInfo(_version); + + std::string version_string; + version_string = versionInfo.getReleaseCycle(); + version_string += " "; + version_string += versionInfo.getType(); struct utsname uts_info; - std::string Version_Kernel; - if( uname(&uts_info) < 0 ) { - Version_Kernel = releaseCycle; - Version_Kernel += " "; - Version_Kernel += versionInfo.getType(); - }else{ - Version_Kernel = releaseCycle; - Version_Kernel += " "; - Version_Kernel += versionInfo.getType(); - Version_Kernel += " - Kernel: "; - Version_Kernel += uts_info.release; - } - image_info_t imagename = {LOCALE_IMAGEINFO_IMAGE, config.getString("imagename", "Neutrino-HD")}; + image_info_t imagename = {LOCALE_IMAGEINFO_IMAGE, config.getString("imagename", "Neutrino-HD")}; v_info.push_back(imagename); image_info_t date = {LOCALE_IMAGEINFO_DATE, builddate}; v_info.push_back(date); - image_info_t kversion = {LOCALE_IMAGEINFO_VERSION, Version_Kernel}; - v_info.push_back(kversion); - image_info_t creator = {LOCALE_IMAGEINFO_CREATOR, config.getString("creator", "n/a")}; + image_info_t version = {LOCALE_IMAGEINFO_VERSION, version_string}; + v_info.push_back(version); + if (uname(&uts_info) == 0) { + image_info_t kernel = {LOCALE_IMAGEINFO_KERNEL, uts_info.release}; + v_info.push_back(kernel); + } + image_info_t creator = {LOCALE_IMAGEINFO_CREATOR, config.getString("creator", "n/a")}; v_info.push_back(creator); + image_info_t www = {LOCALE_IMAGEINFO_HOMEPAGE, config.getString("homepage", "n/a")}; + v_info.push_back(www); + image_info_t doc = {LOCALE_IMAGEINFO_DOKUMENTATION, config.getString("docs", "http://wiki.neutrino-hd.de")}; + v_info.push_back(doc); + image_info_t forum = {LOCALE_IMAGEINFO_FORUM, config.getString("forum", "http://forum.tuxbox.org")}; + v_info.push_back(forum); + image_info_t license = {LOCALE_IMAGEINFO_LICENSE, "GPL"}; + v_info.push_back(license); + + Font * item_font = g_Font[SNeutrinoSettings::FONT_TYPE_MENU]; + + //calculate max width of caption and info_text + int w_caption = 0, w_info_text = 0, w = 0; + for (size_t i = 0; i < v_info.size(); i++) { + w = item_font->getRenderWidth(g_Locale->getText(v_info[i].caption), true); + w_caption = std::max(w_caption, w); + + w = item_font->getRenderWidth(v_info[i].info_text.c_str(), true); + w_info_text = std::max(w_info_text, w); + } + + int x_caption = item_offset; + int x_info_text = x_caption + w_caption + item_offset; + int item_height = item_font->getHeight(); + + //recalc w_info_text to avoid an overlap with pip + w_info_text = std::min(w_info_text, cc_win->getWidth() - x_info_text - cc_tv->getWidth() - 2*item_offset); //create label and text items for (size_t i = 0; i < v_info.size(); i++) { - CComponentsLabel *cc_txt = new CComponentsLabel(); - cc_txt->setDimensionsAll(item_offset, item_top, 200, g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->getHeight()); - cc_txt->setText(v_info[i].caption, CTextBox::NO_AUTO_LINEBREAK, g_Font[SNeutrinoSettings::FONT_TYPE_MENU]); + // add an offset before homepage and license + if (v_info[i].caption == LOCALE_IMAGEINFO_HOMEPAGE || v_info[i].caption == LOCALE_IMAGEINFO_LICENSE) + item_top += item_offset; + + CComponentsLabel *cc_label = new CComponentsLabel(); + cc_label->setDimensionsAll(x_caption, item_top, w_caption, item_height); + cc_label->setText(v_info[i].caption, CTextBox::NO_AUTO_LINEBREAK, item_font); //add label to container - cc_win->addCCItem(cc_txt); + cc_win->addCCItem(cc_label); - CComponentsText *cc_info = new CComponentsText(); - cc_info->setDimensionsAll(item_offset+cc_txt->getWidth(), item_top, 450, g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->getHeight()); - cc_info->setText(v_info[i].info_text.c_str(), CTextBox::NO_AUTO_LINEBREAK, g_Font[SNeutrinoSettings::FONT_TYPE_MENU]); + CComponentsText *cc_text = new CComponentsText(); + cc_text->setDimensionsAll(x_info_text, item_top, w_info_text, item_height); + cc_text->setText(v_info[i].info_text.c_str(), CTextBox::NO_AUTO_LINEBREAK, item_font); //add text to container - cc_win->addCCItem(cc_info); + cc_win->addCCItem(cc_text); - item_top += item_offset*2-5; + item_top += item_height; } -} -//prepare support infos -void CImageInfo::InitSupportInfos() -{ - v_info_supp.clear(); - - image_info_t www = {LOCALE_IMAGEINFO_HOMEPAGE, config.getString("homepage", "n/a")}; - v_info_supp.push_back(www); - image_info_t doc = {LOCALE_IMAGEINFO_DOKUMENTATION, config.getString("docs", "http://wiki.neutrino-hd.de")}; - v_info_supp.push_back(doc); - image_info_t forum = {LOCALE_IMAGEINFO_FORUM, config.getString("forum", "http://forum.tuxbox.org")}; - v_info_supp.push_back(forum); - image_info_t license = {LOCALE_IMAGEINFO_LICENSE, "GPL"}; - v_info_supp.push_back(license); - - //create text an label items - for (size_t i = 0; i < v_info_supp.size(); i++) { - CComponentsLabel *cc_txt = new CComponentsLabel(); - cc_txt->setDimensionsAll(item_offset, item_top, 200, g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->getHeight()); - cc_txt->setText(v_info_supp[i].caption, CTextBox::NO_AUTO_LINEBREAK, g_Font[SNeutrinoSettings::FONT_TYPE_MENU]); - - cc_win->addCCItem(cc_txt); - - CComponentsText *cc_info = new CComponentsText(); - cc_info->setDimensionsAll(item_offset+cc_txt->getWidth(), item_top, 450, g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->getHeight()); - cc_info->setText(v_info_supp[i].info_text.c_str(), CTextBox::NO_AUTO_LINEBREAK, g_Font[SNeutrinoSettings::FONT_TYPE_MENU]); - - cc_win->addCCItem(cc_info); - - item_top += item_offset*2-5; - } + item_top += item_offset; } //prepare license infos @@ -279,7 +273,9 @@ void CImageInfo::InitLicenseText() } in.close(); - cc_lic = new CComponentsInfoBox(item_offset, item_top, cc_win->getWidth()-2*item_offset, cc_win->getHeight()-item_top-item_offset); + //calc y pos of license box to avoid an overlap with pip + int y_lic = std::max(item_top, cc_tv->getHeight() + 2*item_offset); + cc_lic = new CComponentsInfoBox(item_offset, y_lic, cc_win->getWidth()-2*item_offset, cc_win->getHeight()-item_top-item_offset); cc_lic->setText(license_txt, CTextBox::AUTO_WIDTH | CTextBox::SCROLL, g_Font[SNeutrinoSettings::FONT_TYPE_MENU_HINT]); //add text to container diff --git a/src/gui/imageinfo.h b/src/gui/imageinfo.h index 95b0c5c4a..7e1151240 100644 --- a/src/gui/imageinfo.h +++ b/src/gui/imageinfo.h @@ -46,17 +46,16 @@ class CImageInfo : public CMenuTarget std::string license_txt; std::vector v_info; - std::vector v_info_supp; void Init(); void InitMinitv(); void InitInfos(); - void InitSupportInfos(); - void ShowWindow(); void InitLicenseText(); + void ShowWindow(); void ScrollLic(bool scrollDown); CComponentsWindow *cc_win; + CComponentsPIP *cc_tv; CComponentsInfoBox *cc_lic; CConfigFile config; diff --git a/src/gui/infoviewer.cpp b/src/gui/infoviewer.cpp index ca50940d7..ba368f9ed 100644 --- a/src/gui/infoviewer.cpp +++ b/src/gui/infoviewer.cpp @@ -223,19 +223,21 @@ void CInfoViewer::start () void CInfoViewer::changePB() { - const short red_bar = 40; - const short yellow_bar = 70; - const short green_bar = 100; - - if (sigscale != NULL) + if (sigscale) delete sigscale; - sigscale = new CProgressBar(true, bar_width, 10, red_bar, green_bar, yellow_bar); - if (snrscale != NULL) + sigscale = new CProgressBar(); + sigscale->setBlink(); + + if (snrscale) delete snrscale; - snrscale = new CProgressBar(true, bar_width, 10, red_bar, green_bar, yellow_bar); - if (timescale != NULL) + snrscale = new CProgressBar(); + snrscale->setBlink(); + + if (timescale) delete timescale; - timescale = new CProgressBar(true, -1, -1, 30, green_bar, yellow_bar, true); + timescale = new CProgressBar(); + timescale->setBlink(); + timescale->setRgb(0, 100, 70); } void CInfoViewer::paintTime (bool show_dot, bool firstPaint) @@ -1410,7 +1412,10 @@ void CInfoViewer::showSNR () lastsig = sig; posx = BoxStartX + (ChanWidth - (bar_width + 2 + (g_SignalFont->getWidth() * 4))) / 2; posy = freqStartY; - sigscale->paintProgressBar(posx, posy+4, bar_width, 10 * g_settings.screen_yres / 100, sig, 100); + sigscale->setDimensionsAll(posx, posy+4, bar_width, 10 * g_settings.screen_yres / 100); + sigscale->setColorBody(COL_INFOBAR_PLUS_0); + sigscale->setValues(sig, 100); + sigscale->paint(); snprintf (percent, sizeof(percent), "%d%%S", sig); posx = posx + bar_width + 2; sw = BoxStartX + ChanWidth - posx; @@ -1421,7 +1426,10 @@ void CInfoViewer::showSNR () lastsnr = snr; posx = BoxStartX + (ChanWidth - (bar_width + 2 + (g_SignalFont->getWidth() * 4))) / 2; posy = freqStartY + height - (2 * g_settings.screen_yres / 100); - snrscale->paintProgressBar(posx, posy+4, bar_width, 10 * g_settings.screen_yres / 100, snr, 100); + snrscale->setDimensionsAll(posx, posy+4, bar_width, 10 * g_settings.screen_yres / 100); + snrscale->setColorBody(COL_INFOBAR_PLUS_0); + snrscale->setValues(snr, 100); + snrscale->paint(); snprintf (percent, sizeof(percent), "%d%%Q", snr); posx = posx + bar_width + 2; sw = BoxStartX + ChanWidth - posx -4; @@ -1463,12 +1471,12 @@ void CInfoViewer::display_Info(const char *current, const char *next, int pb_h = g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_SMALL]->getHeight() - 4; switch(g_settings.infobar_progressbar) { - case 1: - case 2: + case SNeutrinoSettings::INFOBAR_PROGRESSBAR_ARRANGEMENT_BELOW_CH_NAME: + case SNeutrinoSettings::INFOBAR_PROGRESSBAR_ARRANGEMENT_BELOW_CH_NAME_SMALL: CurrInfoY += (pb_h/3); NextInfoY += (pb_h/3); break; - case 3: + case SNeutrinoSettings::INFOBAR_PROGRESSBAR_ARRANGEMENT_BETWEEN_EVENTS: CurrInfoY -= (pb_h/3); NextInfoY += (pb_h/3); break; @@ -1482,26 +1490,27 @@ void CInfoViewer::display_Info(const char *current, const char *next, int pb_startx = BoxEndX - pb_w - SHADOW_OFFSET; int pb_starty = ChanNameY - (pb_h + 10); int pb_shadow = COL_INFOBAR_SHADOW_PLUS_0; + timescale->setShadowOnOff(true); int pb_color = g_settings.progressbar_color ? COL_INFOBAR_SHADOW_PLUS_0 : COL_INFOBAR_PLUS_0; if(g_settings.infobar_progressbar){ pb_startx = xStart; pb_w = BoxEndX - 10 - xStart; pb_shadow = 0; + timescale->setShadowOnOff(false); } - switch(g_settings.infobar_progressbar) + switch(g_settings.infobar_progressbar) //set progressbar position { - case 1: - + case SNeutrinoSettings::INFOBAR_PROGRESSBAR_ARRANGEMENT_BELOW_CH_NAME: pb_starty = CurrInfoY - ((pb_h * 2) + (pb_h / 6)) ; pb_h = (pb_h/3); - pb_color = 0; +// pb_color = 0; break; - case 2: + case SNeutrinoSettings::INFOBAR_PROGRESSBAR_ARRANGEMENT_BELOW_CH_NAME_SMALL: pb_starty = CurrInfoY - ((pb_h * 2) + (pb_h / 5)) ; pb_h = (pb_h/5); - pb_color = 0; +// pb_color = 0; break; - case 3: + case SNeutrinoSettings::INFOBAR_PROGRESSBAR_ARRANGEMENT_BETWEEN_EVENTS: pb_starty = CurrInfoY + ((pb_h / 3)-(pb_h/5)) ; pb_h = (pb_h/5); break; @@ -1513,8 +1522,10 @@ void CInfoViewer::display_Info(const char *current, const char *next, if (pb_p > pb_w) pb_p = pb_w; - timescale->paintProgressBar(pb_startx, pb_starty, pb_w, pb_h, pb_p, pb_w, - 0, 0, pb_color, pb_shadow, "", COL_INFOBAR); + timescale->setDimensionsAll(pb_startx, pb_starty, pb_w, pb_h); + timescale->setColorAll(pb_color, pb_color, pb_shadow); + timescale->setValues(pb_p, pb_w); + timescale->paint(); //printf("paintProgressBar(%d, %d, %d, %d)\n", BoxEndX - pb_w - SHADOW_OFFSET, ChanNameY - (pb_h + 10) , pb_w, pb_h); } diff --git a/src/gui/infoviewer.h b/src/gui/infoviewer.h index 33dc0d3df..3437f2db2 100644 --- a/src/gui/infoviewer.h +++ b/src/gui/infoviewer.h @@ -42,7 +42,6 @@ #include #include "widget/menue.h" #include -#include #include #include diff --git a/src/gui/infoviewer_bb.cpp b/src/gui/infoviewer_bb.cpp index 07deaef41..d35313fc0 100644 --- a/src/gui/infoviewer_bb.cpp +++ b/src/gui/infoviewer_bb.cpp @@ -646,17 +646,22 @@ void* CInfoViewerBB::hddperThread(void *arg) } void CInfoViewerBB::showBarSys(int percent) -{ - if (is_visible) - sysscale->paintProgressBar(bbIconMinX, BBarY + InfoHeightY_Info / 2 - 2 - 6, hddwidth, 6, percent, 100); +{ + if (is_visible){ + sysscale->setDimensionsAll(bbIconMinX, BBarY + InfoHeightY_Info / 2 - 2 - 6, hddwidth, 6); + sysscale->setValues(percent, 100); + sysscale->paint(); + } } void CInfoViewerBB::showBarHdd(int percent) { if (is_visible) { - if (percent >= 0) - hddscale->paintProgressBar(bbIconMinX, BBarY + InfoHeightY_Info / 2 + 2 + 0, hddwidth, 6, percent, 100); - else { + if (percent >= 0){ + hddscale->setDimensionsAll(bbIconMinX, BBarY + InfoHeightY_Info / 2 + 2 + 0, hddwidth, 6); + hddscale->setValues(percent, 100); + hddscale->paint(); + }else { frameBuffer->paintBoxRel(bbIconMinX, BBarY + InfoHeightY_Info / 2 + 2 + 0, hddwidth, 6, COL_INFOBAR_BUTTONS_BACKGROUND); hddscale->reset(); } @@ -815,12 +820,17 @@ void CInfoViewerBB::paintCA_bar(int left, int right) void CInfoViewerBB::changePB() { hddwidth = frameBuffer->getScreenWidth(true) * ((g_settings.screen_preset == 1) ? 10 : 8) / 128; /* 80(CRT)/100(LCD) pix if screen is 1280 wide */ - if (hddscale != NULL) + if (hddscale) delete hddscale; - hddscale = new CProgressBar(true, hddwidth, 6, 50, 100, 75, true); - if (sysscale != NULL) + hddscale = new CProgressBar(); + hddscale->setBlink(); + hddscale->setInvert(); + + if (sysscale) delete sysscale; - sysscale = new CProgressBar(true, hddwidth, 6, 50, 100, 75, true); + sysscale = new CProgressBar(); + sysscale->setBlink(); + sysscale->setInvert(); } void CInfoViewerBB::reset_allScala() diff --git a/src/gui/infoviewer_bb.h b/src/gui/infoviewer_bb.h index d5f4230c5..d47e64409 100644 --- a/src/gui/infoviewer_bb.h +++ b/src/gui/infoviewer_bb.h @@ -41,7 +41,7 @@ #include #include #include "widget/menue.h" -#include +#include #include class CInfoViewerBB diff --git a/src/gui/motorcontrol.cpp b/src/gui/motorcontrol.cpp index 314cfe95c..250f6481d 100644 --- a/src/gui/motorcontrol.cpp +++ b/src/gui/motorcontrol.cpp @@ -99,8 +99,10 @@ void CMotorControl::Init(void) motorPosition = 1; satellitePosition = 0; stepDelay = 10; - sigscale = new CProgressBar(true, BAR_WIDTH, BAR_HEIGHT); - snrscale = new CProgressBar(true, BAR_WIDTH, BAR_HEIGHT); + sigscale = new CProgressBar(/*true, BAR_WIDTH, BAR_HEIGHT*/); + sigscale->setBlink(); + snrscale = new CProgressBar(/*true, BAR_WIDTH, BAR_HEIGHT*/); + snrscale->setBlink(); } int CMotorControl::exec(CMenuTarget* parent, const std::string &) @@ -720,7 +722,7 @@ void CMotorControl::showSNR() int barwidth = 100; uint16_t ssig, ssnr; int sig, snr; - int posx, posy; + int posx_sig, posx_snr, posy; int sw; @@ -735,29 +737,32 @@ void CMotorControl::showSNR() g_snr = snr; posy = y + height - mheight - 5; - + //TODO: move sig/snr display into its own class, similar or same code also to find in scan.cpp if (lastsig != sig) { lastsig = sig; - posx = x + 10; + posx_sig = x + 10; sprintf(percent, "%d%% SIG", sig); sw = g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->getRenderWidth ("100% SIG"); - sigscale->paintProgressBar2(posx-1, posy, sig); + sigscale->setProgress(posx_sig-1, posy, BAR_WIDTH, BAR_HEIGHT, sig, 100); + sigscale->paint(); - posx = posx + barwidth + 3; - frameBuffer->paintBoxRel(posx, posy - 2, sw+4, mheight, COL_MENUCONTENT_PLUS_0); - g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->RenderString (posx+2, posy + mheight, sw, percent, COL_MENUCONTENT); + posx_sig += barwidth + 3; + frameBuffer->paintBoxRel(posx_sig, posy - 2, sw+4, mheight, COL_MENUCONTENT_PLUS_0); + g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->RenderString (posx_sig+2, posy + mheight, sw, percent, COL_MENUCONTENT); } if (lastsnr != snr) { lastsnr = snr; - posx = x + 10 + 210; + posx_snr = x + 10 + 210; sprintf(percent, "%d%% SNR", snr); sw = g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->getRenderWidth ("100% SNR"); - snrscale->paintProgressBar2(posx-1, posy, snr); + + snrscale->setProgress(posx_snr-1, posy, BAR_WIDTH, BAR_HEIGHT, snr, 100); + snrscale->paint(); - posx = posx + barwidth + 3; - frameBuffer->paintBoxRel(posx, posy - 2, sw+4, mheight, COL_MENUCONTENT_PLUS_0); - g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->RenderString (posx+2, posy + mheight, sw, percent, COL_MENUCONTENT); + posx_snr += barwidth + 3; + frameBuffer->paintBoxRel(posx_snr, posy - 2, sw+4, mheight, COL_MENUCONTENT_PLUS_0); + g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->RenderString (posx_snr+2, posy + mheight, sw, percent, COL_MENUCONTENT); } } diff --git a/src/gui/motorcontrol.h b/src/gui/motorcontrol.h index 7ef402417..b69ad427f 100644 --- a/src/gui/motorcontrol.h +++ b/src/gui/motorcontrol.h @@ -34,7 +34,7 @@ #define __motorcontrol__ #include -#include +#include #include #include #include diff --git a/src/gui/moviebrowser.cpp b/src/gui/moviebrowser.cpp index f36b9a65a..b49e2ef43 100644 --- a/src/gui/moviebrowser.cpp +++ b/src/gui/moviebrowser.cpp @@ -48,7 +48,7 @@ #include #include #include -#include +#include #include #include #include @@ -1286,10 +1286,13 @@ void CMovieBrowser::info_hdd_level(bool paint_hdd) if(tmp_blocks_percent_used != blocks_percent_used || paint_hdd){ tmp_blocks_percent_used = blocks_percent_used; - CProgressBar pb(true, -1, -1, 30, 100, 70, true); const short pbw = 100; const short border = m_cBoxFrameTitleRel.iHeight/4; - pb.paintProgressBarDefault(m_cBoxFrame.iX+ m_cBoxFrameFootRel.iWidth - pbw - border, m_cBoxFrame.iY+m_cBoxFrameTitleRel.iY + border, pbw, m_cBoxFrameTitleRel.iHeight/2, blocks_percent_used, 100); + CProgressBar pb(m_cBoxFrame.iX+ m_cBoxFrameFootRel.iWidth - pbw - border, m_cBoxFrame.iY+m_cBoxFrameTitleRel.iY + border, pbw, m_cBoxFrameTitleRel.iHeight/2); + pb.setBlink(); + pb.setInvert(); + pb.setValues( blocks_percent_used, 100); + pb.paint(false); } } @@ -4009,12 +4012,14 @@ static off64_t cut_movie(MI_MOVIE_INFO * minfo, CMovieInfo * cmovie) CFrameBuffer * frameBuffer = CFrameBuffer::getInstance(); if (! timescale) - timescale = new CProgressBar(g_settings.progressbar_color, 200, 15, 0, 100, 0); + timescale = new CProgressBar();//new CProgressBar(g_settings.progressbar_color, 200, 15, 0, 100, 0); + timescale->setBlink(); int dx = 256; int x = (((g_settings.screen_EndX- g_settings.screen_StartX)- dx) / 2) + g_settings.screen_StartX; int y = g_settings.screen_EndY - 50; - frameBuffer->paintBoxRel (x + 40, y+12, 200, 15, COL_INFOBAR_PLUS_0); - timescale->paintProgressBar2(x + 41, y + 12, percent); + frameBuffer->paintBoxRel (x + 40, y+12, 200, 15, COL_INFOBAR_PLUS_0);//TODO: remove unneeded box paints + timescale->setProgress(x + 41, y + 12, 200, 15, percent, 200); + timescale->paint(); int len = minfo->length; off64_t size = minfo->file.Size; //off64_t secsize = len ? size/len/60 : 511040; @@ -4134,7 +4139,7 @@ printf("\ncut: reading from %" PRId64 " to %" PRId64 " (%" PRId64 ") want gop %d } if(msg) { timescale->reset(); - frameBuffer->paintBoxRel (x + 40, y+12, 200, 15, COL_INFOBAR_PLUS_0); + frameBuffer->paintBoxRel (x + 40, y+12, 200, 15, COL_INFOBAR_PLUS_0);//TODO: remove unneeded box paints } size_t toread = (until-sdone) > BUF_SIZE ? BUF_SIZE : until - sdone; #if REAL_CUT @@ -4160,7 +4165,8 @@ if(buf[0] != 0x47) printf("cut: buffer not aligned at %" PRId64 "\n", sdone); sdone += r; spos += r - wptr; percent = spos * 100 / newsize; - timescale->paintProgressBar2(x + 41, y + 12, percent); + timescale->setProgress(x + 41, y + 12, 200, 15, percent, 200); + timescale->paint(); #if REAL_CUT int wr = write(dstfd, &buf[wptr], r-wptr); if(wr < (r-wptr)) { @@ -4266,12 +4272,14 @@ printf("copy: len %d minute %" PRId64 " second %" PRId64 "\n", len, len ? size/l CFrameBuffer * frameBuffer = CFrameBuffer::getInstance(); if (! timescale) - timescale = new CProgressBar(true, 200, 15, 0, 100, 0); + timescale = new CProgressBar();//new CProgressBar(g_settings.progressbar_color, 200, 15, 0, 100, 0); + timescale->setBlink(); int dx = 256; int x = (((g_settings.screen_EndX- g_settings.screen_StartX)- dx) / 2) + g_settings.screen_StartX; int y = g_settings.screen_EndY - 50; - frameBuffer->paintBoxRel (x + 40, y+12, 200, 15, COL_INFOBAR_PLUS_0); - timescale->paintProgressBar2(x + 41, y + 12, percent); + frameBuffer->paintBoxRel (x + 40, y+12, 200, 15, COL_INFOBAR_PLUS_0); //TODO: remove unneeded box paints + timescale->setProgress(x + 41, y + 12, 200, 15, percent, 200); + timescale->paint(); newsize = 0; for(int book_nr = 0; book_nr < MI_MOVIE_BOOK_USER_MAX; book_nr++) { @@ -4361,7 +4369,7 @@ printf("copy: read from %" PRId64 " to %" PRId64 " read size %d want gop %d\n", goto ret_err; } if(msg) { - frameBuffer->paintBoxRel (x + 40, y+12, 200, 15, COL_INFOBAR_PLUS_0); + frameBuffer->paintBoxRel (x + 40, y+12, 200, 15, COL_INFOBAR_PLUS_0);//TODO: remove unneeded box paints timescale->reset(); } #if REAL_CUT @@ -4389,7 +4397,8 @@ if(buf[0] != 0x47) printf("copy: buffer not aligned at %" PRId64 "\n", sdone); spos += r - wptr; btotal += r; percent = btotal * 100 / newsize; - timescale->paintProgressBar2(x + 41, y + 12, percent); + timescale->setProgress(x + 41, y + 12, 200, 15, percent, 200); + timescale->paint(); #if REAL_CUT int wr = write(dstfd, &buf[wptr], r-wptr); if(wr < (r-wptr)) { diff --git a/src/gui/scan.cpp b/src/gui/scan.cpp index 46743f164..5862f5683 100644 --- a/src/gui/scan.cpp +++ b/src/gui/scan.cpp @@ -40,7 +40,7 @@ #include #include -#include +#include #include #include @@ -72,8 +72,11 @@ CScanTs::CScanTs() total = done = 0; freqready = 0; - sigscale = NULL; - snrscale = NULL; + sigscale = new CProgressBar(); + sigscale->setBlink(); + + snrscale = new CProgressBar(); + snrscale->setBlink(); } void CScanTs::prev_next_TP( bool up) @@ -592,13 +595,14 @@ void CScanTs::showSNR () sig = (ssig & 0xFFFF) * 100 / 65535; posy = y + height - mheight - 5; - - if (lastsig != sig) { + //TODO: move sig/snr display into its own class, similar or same code also to find in motorcontrol + if (lastsig != sig) { lastsig = sig; posx = x + 20; sprintf(percent, "%d%%", sig); sw = g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->getRenderWidth ("100%"); - sigscale->paintProgressBar2(posx - 1, posy+2, sig); + sigscale->setProgress(posx - 1, posy+2, BAR_WIDTH, BAR_HEIGHT, sig, 100); + sigscale->paint(); posx = posx + barwidth + 3; frameBuffer->paintBoxRel(posx, posy -1, sw, mheight-8, COL_MENUCONTENT_PLUS_0); @@ -613,7 +617,8 @@ void CScanTs::showSNR () posx = x + 20 + barwidth + 3 + 4 * fw + 4 * fw; sprintf(percent, "%d%%", snr); sw = g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->getRenderWidth ("100%"); - snrscale->paintProgressBar2(posx - 1, posy+2, snr); + snrscale->setProgress(posx - 1, posy+2, BAR_WIDTH, BAR_HEIGHT, snr, 100); + snrscale->paint(); posx = posx + barwidth + 3; frameBuffer->paintBoxRel(posx, posy - 1, sw, mheight-8, COL_MENUCONTENT_PLUS_0, 0, true); diff --git a/src/gui/scan.h b/src/gui/scan.h index e02217133..a9e97f688 100644 --- a/src/gui/scan.h +++ b/src/gui/scan.h @@ -33,11 +33,11 @@ #define __scants__ #include -#include +#include #include #include #include - +#include class CScanTs : public CMenuTarget { diff --git a/src/gui/streaminfo2.cpp b/src/gui/streaminfo2.cpp index 203fa4371..5b89c230d 100644 --- a/src/gui/streaminfo2.cpp +++ b/src/gui/streaminfo2.cpp @@ -121,8 +121,13 @@ int CStreamInfo2::doSignalStrengthLoop () #define BAR_WIDTH 150 #define BAR_HEIGHT 12 int res = menu_return::RETURN_REPAINT; - sigscale = new CProgressBar(true, BAR_WIDTH, BAR_HEIGHT); - snrscale = new CProgressBar(true, BAR_WIDTH, BAR_HEIGHT); + + sigscale = new CProgressBar(); + sigscale->setBlink(); + + snrscale = new CProgressBar(); + snrscale->setBlink(); + lastsnr = lastsig = -1; neutrino_msg_t msg; @@ -919,7 +924,8 @@ void CStreamInfo2::showSNR () posy = yypos + (mheight/2)-5; posx = x + 10; sprintf(percent, "%d%%", sig); - sigscale->paintProgressBar2(posx - 1, posy, sig); + sigscale->setProgress(posx - 1, posy, BAR_WIDTH, BAR_HEIGHT, sig, 100); + sigscale->paint(); posx = posx + barwidth + 3; frameBuffer->paintBoxRel(posx, posy -1, sw, mheight-8, COL_MENUHEAD_PLUS_0); @@ -931,7 +937,9 @@ void CStreamInfo2::showSNR () posy = yypos + mheight + 5; posx = x + 10; sprintf(percent, "%d%% SNR", snr); - snrscale->paintProgressBar2(posx - 1, posy+2, snr); + snrscale->setProgress(posx - 1, posy+2, BAR_WIDTH, BAR_HEIGHT, snr, 100); + snrscale->paint(); +// snrscale->paintProgressBar2(posx - 1, posy+2, snr); posx = posx + barwidth + 3; frameBuffer->paintBoxRel(posx, posy - 1, sw, mheight-8, COL_MENUHEAD_PLUS_0, 0, true); diff --git a/src/gui/streaminfo2.h b/src/gui/streaminfo2.h index 4ad1411ce..9b3b187fc 100644 --- a/src/gui/streaminfo2.h +++ b/src/gui/streaminfo2.h @@ -27,7 +27,7 @@ #include #include -#include +#include #include diff --git a/src/gui/timeosd.cpp b/src/gui/timeosd.cpp index d14459728..3cc560b48 100644 --- a/src/gui/timeosd.cpp +++ b/src/gui/timeosd.cpp @@ -31,7 +31,6 @@ #include #include -//static CProgressBar *timescale = 0; #define TIMEOSD_FONT SNeutrinoSettings::FONT_TYPE_INFOBAR_CHANNAME #define BARLEN 200 @@ -44,7 +43,7 @@ CTimeOSD::CTimeOSD() visible=false; m_mode=MODE_ASC; GetDimensions(); - timescale = new CProgressBar(true, BARLEN, m_height -5, 40, 100, 70, true); + timescale = new CProgressBar(); m_time_show = 0; } @@ -119,7 +118,10 @@ void CTimeOSD::updatePos(short runningPercent) if(runningPercent > 100 || runningPercent < 0) runningPercent = 0; - timescale->paintProgressBar2(m_xstart, m_y, runningPercent); + timescale->setProgress(m_xstart, m_y, BARLEN, m_height -5, runningPercent, 100); + timescale->setBlink(); + timescale->setRgb(0, 100, 70); + timescale->paint(); frameBuffer->blit(); } diff --git a/src/gui/timeosd.h b/src/gui/timeosd.h index 66ed1fdda..078b723b7 100644 --- a/src/gui/timeosd.h +++ b/src/gui/timeosd.h @@ -27,7 +27,7 @@ #include #include -#include +#include class CTimeOSD { diff --git a/src/gui/widget/Makefile.am b/src/gui/widget/Makefile.am index c7d349b4e..1d2d1009a 100644 --- a/src/gui/widget/Makefile.am +++ b/src/gui/widget/Makefile.am @@ -33,7 +33,6 @@ libneutrino_gui_widget_a_SOURCES = \ messagebox.cpp \ mountchooser.cpp \ msgbox.cpp \ - progressbar.cpp \ stringinput.cpp \ stringinput_ext.cpp \ textbox.cpp diff --git a/src/gui/widget/progressbar.cpp b/src/gui/widget/progressbar.cpp deleted file mode 100644 index 8c70c8d23..000000000 --- a/src/gui/widget/progressbar.cpp +++ /dev/null @@ -1,322 +0,0 @@ -/* - * (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 - * 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 -#endif - -#include -#include - -#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; - switch ((pb_color_t)g_settings.progressbar_color) - { - 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); -} diff --git a/src/gui/widget/progressbar.h b/src/gui/widget/progressbar.h deleted file mode 100644 index 221dc91e6..000000000 --- a/src/gui/widget/progressbar.h +++ /dev/null @@ -1,143 +0,0 @@ -/* - * (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 - * 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 -#include -#include -#include - -#include - -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_MONO = 0, - PB_MATRIX, /* 1 */ - PB_LINES_V, /* 2 */ - PB_LINES_H, /* 3 */ - PB_COLOR /* 4 */ - }; -}; - -#endif /* __gui_widget_progressbar_h__ */ diff --git a/src/neutrino.cpp b/src/neutrino.cpp index 140de17e1..a86a63d29 100644 --- a/src/neutrino.cpp +++ b/src/neutrino.cpp @@ -88,10 +88,6 @@ #include "gui/widget/messagebox.h" #include "gui/infoclock.h" -#if HAVE_COOL_HARDWARE -#include "gui/widget/progressbar.h" -#endif - #include #include #include diff --git a/src/system/locals.h b/src/system/locals.h index 8b6813a5c..31f595c54 100644 --- a/src/system/locals.h +++ b/src/system/locals.h @@ -605,6 +605,7 @@ typedef enum LOCALE_IMAGEINFO_HEAD, LOCALE_IMAGEINFO_HOMEPAGE, LOCALE_IMAGEINFO_IMAGE, + LOCALE_IMAGEINFO_KERNEL, LOCALE_IMAGEINFO_LICENSE, LOCALE_IMAGEINFO_VERSION, LOCALE_INETRADIO_NAME, diff --git a/src/system/locals_intern.h b/src/system/locals_intern.h index b07238fd6..7785bb060 100644 --- a/src/system/locals_intern.h +++ b/src/system/locals_intern.h @@ -605,6 +605,7 @@ const char * locale_real_names[] = "imageinfo.head", "imageinfo.homepage", "imageinfo.image", + "imageinfo.kernel", "imageinfo.license", "imageinfo.version", "inetradio.name", diff --git a/src/system/settings.h b/src/system/settings.h index 787e64b9d..c8838092a 100644 --- a/src/system/settings.h +++ b/src/system/settings.h @@ -606,6 +606,15 @@ struct SNeutrinoSettings std::string usermenu_text[BUTTON_MAX]; int usermenu[BUTTON_MAX][ITEM_MAX]; // (USER_ITEM) [button][position in Menue] = feature item + //progressbar arrangement for infobar + typedef enum + { + INFOBAR_PROGRESSBAR_ARRANGEMENT_DEFAULT = 0, + INFOBAR_PROGRESSBAR_ARRANGEMENT_BELOW_CH_NAME = 1, + INFOBAR_PROGRESSBAR_ARRANGEMENT_BELOW_CH_NAME_SMALL = 2, + INFOBAR_PROGRESSBAR_ARRANGEMENT_BETWEEN_EVENTS = 3 + }INFOBAR_PROGRESSBAR_ARRANGEMENT_TYPES; + }; /* some default Values */