From f4ae5e17ce00575de61daba517f37a4bb9252836 Mon Sep 17 00:00:00 2001 From: Jacek Jendrzej Date: Wed, 27 Mar 2013 16:18:32 +0100 Subject: [PATCH 01/27] src/gui/channellist.cpp: fix to 36e95d7fbcd22dfbb94d03867f10634f7a72df63 if more bouquets empty --- src/gui/channellist.cpp | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/src/gui/channellist.cpp b/src/gui/channellist.cpp index 316ae5798..ed422e7f1 100644 --- a/src/gui/channellist.cpp +++ b/src/gui/channellist.cpp @@ -749,11 +749,21 @@ int CChannelList::show() if(bouquetList->Bouquets[nNext]->channelList->isEmpty() ) { found = false; nNext = (nNext + b_size + dir) % b_size; - for (int i = nNext; i < b_size; i++) { - if( !bouquetList->Bouquets[i]->channelList->isEmpty() ) { - found = true; - nNext = i; - break; + if(msg == (neutrino_msg_t)g_settings.key_bouquet_down){ + for (int i = nNext; i > 0; i--) { + if( !bouquetList->Bouquets[i]->channelList->isEmpty() ) { + found = true; + nNext = i; + break; + } + } + }else{ + for (int i = nNext; i < b_size; i++) { + if( !bouquetList->Bouquets[i]->channelList->isEmpty() ) { + found = true; + nNext = i; + break; + } } } } From 393aa14cff58aa4ac0af229d7e98d2d3708cb2ca Mon Sep 17 00:00:00 2001 From: svenhoefer Date: Fri, 29 Mar 2013 20:40:52 +0100 Subject: [PATCH 02/27] - bouqueteditor_chanselect.cpp: fix height --- src/gui/bedit/bouqueteditor_chanselect.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/gui/bedit/bouqueteditor_chanselect.cpp b/src/gui/bedit/bouqueteditor_chanselect.cpp index 586a80749..d09699a7f 100644 --- a/src/gui/bedit/bouqueteditor_chanselect.cpp +++ b/src/gui/bedit/bouqueteditor_chanselect.cpp @@ -162,10 +162,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) From c07b8781a5db83caa8f690cc34b495d93564fb7f Mon Sep 17 00:00:00 2001 From: svenhoefer Date: Sat, 30 Mar 2013 16:03:27 +0100 Subject: [PATCH 03/27] - imageinfo: remove some fixed width values ... ... to avoid possible ugly overlaps * split kernel-version from image-version * whitespace cleanup --- data/locale/deutsch.locale | 1 + data/locale/english.locale | 1 + src/gui/imageinfo.cpp | 148 ++++++++++++++++++------------------- src/gui/imageinfo.h | 5 +- src/system/locals.h | 1 + src/system/locals_intern.h | 1 + 6 files changed, 78 insertions(+), 79 deletions(-) diff --git a/data/locale/deutsch.locale b/data/locale/deutsch.locale index c2cf6564a..a91ad6766 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 diff --git a/data/locale/english.locale b/data/locale/english.locale index ef133967c..cfd72e7a9 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/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/system/locals.h b/src/system/locals.h index b3d852207..dc9fadf40 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 08277139a..5445feccb 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", From d4e54571a4d43fe8d83de418e354dc3ca9170f5b Mon Sep 17 00:00:00 2001 From: Michael Liebmann Date: Mon, 1 Apr 2013 18:19:46 +0200 Subject: [PATCH 04/27] * Sort locales --- data/locale/deutsch.locale | 14 +++++++------- data/locale/english.locale | 14 +++++++------- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/data/locale/deutsch.locale b/data/locale/deutsch.locale index a91ad6766..993e4cfbd 100644 --- a/data/locale/deutsch.locale +++ b/data/locale/deutsch.locale @@ -1139,6 +1139,13 @@ miscsettings.infobar_disp_5 Logo/Signalbalken miscsettings.infobar_disp_6 Logo+Kanalnummer/Signalbalken miscsettings.infobar_disp_log Logo miscsettings.infobar_logo_hdd_dir Logo-Verz. +miscsettings.infobar_sat_display Kabel-/Satellitenanbieter +miscsettings.infobar_show Info bei EPG Änderungen +miscsettings.infobar_show_dd_available DD-Verfügbarkeit anzeigen +miscsettings.infobar_show_res Auflösung anzeigen +miscsettings.infobar_show_res_simple einfach +miscsettings.infobar_show_sysfs_hdd Füllstandanzeige (sysFS & hdd) +miscsettings.infobar_show_tuner Aktiven Tuner anzeigen miscsettings.progressbar Fortschrittsbalken miscsettings.progressbar_color Farbe miscsettings.progressbar_design Design @@ -1151,13 +1158,6 @@ miscsettings.progressbar_infobar_position_0 Standard miscsettings.progressbar_infobar_position_1 unterhalb Kanalname miscsettings.progressbar_infobar_position_2 unterhalb Kanalname (schmal) miscsettings.progressbar_infobar_position_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 -miscsettings.infobar_show_res Auflösung anzeigen -miscsettings.infobar_show_res_simple einfach -miscsettings.infobar_show_sysfs_hdd Füllstandanzeige (sysFS & hdd) -miscsettings.infobar_show_tuner Aktiven Tuner anzeigen miscsettings.radiotext Radiotext miscsettings.shutdown_count Komplett ausschalten nach miscsettings.shutdown_count_hint1 Zeit (in Minuten), nach der vom Standby in diff --git a/data/locale/english.locale b/data/locale/english.locale index cfd72e7a9..e7a99dced 100644 --- a/data/locale/english.locale +++ b/data/locale/english.locale @@ -1139,6 +1139,13 @@ miscsettings.infobar_disp_5 Logo+signal miscsettings.infobar_disp_6 Logo+channel number+signal miscsettings.infobar_disp_log Logo miscsettings.infobar_logo_hdd_dir Logo dir +miscsettings.infobar_sat_display Satellite display on infobar +miscsettings.infobar_show show Info on EPG change +miscsettings.infobar_show_dd_available show DD availability +miscsettings.infobar_show_res show resolution on infobar +miscsettings.infobar_show_res_simple simple +miscsettings.infobar_show_sysfs_hdd Fill level (sysFS & hdd) +miscsettings.infobar_show_tuner Display active tuner miscsettings.progressbar Progressbar miscsettings.progressbar_color Color miscsettings.progressbar_design Design @@ -1151,13 +1158,6 @@ miscsettings.progressbar_infobar_position_0 standard miscsettings.progressbar_infobar_position_1 below channel name miscsettings.progressbar_infobar_position_2 small below channel name miscsettings.progressbar_infobar_position_3 narrow between EPG-Events -miscsettings.infobar_sat_display Satellite display on infobar -miscsettings.infobar_show show Info on EPG change -miscsettings.infobar_show_dd_available show DD availability -miscsettings.infobar_show_res show resolution on infobar -miscsettings.infobar_show_res_simple simple -miscsettings.infobar_show_sysfs_hdd Fill level (sysFS & hdd) -miscsettings.infobar_show_tuner Display active tuner miscsettings.radiotext Radiotext miscsettings.shutdown_count In standby, switch off after miscsettings.shutdown_count_hint1 time (in minutes) to switch from standby From 68cf021581ecf08b9ca3d7db664238ecd0885498 Mon Sep 17 00:00:00 2001 From: "svenhoefer, SatBaby, snafed" Date: Mon, 1 Apr 2013 22:06:19 +0200 Subject: [PATCH 05/27] - eventlist: add right infobox with current eventinfo * use getScreen{Width/Height}Rel() --- src/gui/eventlist.cpp | 98 +++++++++++++++++++++++++++++-------------- src/gui/eventlist.h | 15 +++---- 2 files changed, 72 insertions(+), 41 deletions(-) diff --git a/src/gui/eventlist.cpp b/src/gui/eventlist.cpp index 936606b12..ca9279da9 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 @@ -44,6 +37,7 @@ #include #include #include +#include // FIXME should be included by cc.h in eventlist.h #include #include "widget/hintbox.h" @@ -104,14 +98,13 @@ 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; } @@ -247,6 +240,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 +272,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 CComponentsInfoBox(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); @@ -355,6 +364,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) { @@ -368,6 +378,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; @@ -653,12 +664,16 @@ int CNeutrinoEventList::exec(const t_channel_id channel_id, const std::string& c hide(); fader.Stop(); + + delete cc_infozone; + cc_infozone = NULL; + return res; } void CNeutrinoEventList::hide() { - frameBuffer->paintBackgroundBoxRel(x,y, width,height); + frameBuffer->paintBackgroundBoxRel(x,y, full_width,height); showFunctionBar (false, 0); } @@ -695,7 +710,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 ) { @@ -783,22 +797,38 @@ 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); - - } } + +void CNeutrinoEventList::paintDescription(int 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->paint(); +} + 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; @@ -810,28 +840,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) @@ -841,15 +871,20 @@ 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 + frameBuffer->paintBoxRel(x+width,y+theight,infozone_width,listmaxshow*fheight,COL_MENUCONTENT_PLUS_0); for(unsigned int count=0;countpaintBoxRel(x+ width- 15,ypos, 15, sb, COL_MENUCONTENT_PLUS_1); @@ -891,7 +926,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; int w_button = bw / 4 - border_space;// 4 cells @@ -902,7 +937,7 @@ void CNeutrinoEventList::showFunctionBar (bool show, t_channel_id channel_id) // std::string btncaption; bh = std::max(FunctionBarHeight, bh); - frameBuffer->paintBackgroundBoxRel(x,by,width,bh); + frameBuffer->paintBackgroundBoxRel(x,by,full_width,bh); // -- hide only? if (! show) return; @@ -910,7 +945,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); @@ -1307,4 +1342,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..e492b72de 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" @@ -100,14 +94,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; + CComponentsInfoBox *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); From 825ec2f5cc339113a4c602c21646fc1487b1de76 Mon Sep 17 00:00:00 2001 From: svenhoefer Date: Tue, 2 Apr 2013 01:28:38 +0200 Subject: [PATCH 06/27] - eventlist: fix delete of cc_infozone --- src/gui/eventlist.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/gui/eventlist.cpp b/src/gui/eventlist.cpp index ca9279da9..e8968dc1d 100644 --- a/src/gui/eventlist.cpp +++ b/src/gui/eventlist.cpp @@ -662,12 +662,11 @@ int CNeutrinoEventList::exec(const t_channel_id channel_id, const std::string& c } } - hide(); - fader.Stop(); - delete cc_infozone; cc_infozone = NULL; + hide(); + fader.Stop(); return res; } From d87290c2bcfbb477b0c8642295918a7ca21e854b Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Mon, 25 Mar 2013 21:19:20 +0100 Subject: [PATCH 07/27] CComponentsPIP: remove unsuitable filename --- src/gui/components/Makefile.am | 2 +- src/gui/components/{cc_item_tvpig.cpp => cc_item_tvpic.cpp} | 0 2 files changed, 1 insertion(+), 1 deletion(-) rename src/gui/components/{cc_item_tvpig.cpp => cc_item_tvpic.cpp} (100%) diff --git a/src/gui/components/Makefile.am b/src/gui/components/Makefile.am index a940f62bc..8e839e16b 100644 --- a/src/gui/components/Makefile.am +++ b/src/gui/components/Makefile.am @@ -29,4 +29,4 @@ libneutrino_gui_components_a_SOURCES = \ cc_item_picture.cpp \ cc_item_shapes.cpp \ cc_item_text.cpp \ - cc_item_tvpig.cpp + cc_item_tvpic.cpp 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 From d391bedd5f68d2a8f3c64985639bba0fc50cc374 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Tue, 26 Mar 2013 19:15:21 +0100 Subject: [PATCH 08/27] CComponents: move item type enum to cc_types.h --- src/gui/components/cc.h | 17 ----------------- src/gui/components/cc_frm.cpp | 2 +- src/gui/components/cc_types.h | 19 +++++++++++++++++++ 3 files changed, 20 insertions(+), 18 deletions(-) diff --git a/src/gui/components/cc.h b/src/gui/components/cc.h index 644457254..f8eaa5e9f 100644 --- a/src/gui/components/cc.h +++ b/src/gui/components/cc.h @@ -103,23 +103,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; diff --git a/src/gui/components/cc_frm.cpp b/src/gui/components/cc_frm.cpp index 34d38c361..443e04d63 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_types.h b/src/gui/components/cc_types.h index 4dc39ef2d..85f09144e 100644 --- a/src/gui/components/cc_types.h +++ b/src/gui/components/cc_types.h @@ -29,6 +29,25 @@ #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_ITEMTYPES +}CC_ITEMTYPES_T; + //required typedefs typedef struct comp_fbdata_t { From 860be9a412125cf84a0b78e4a62633cda5d10941 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Mon, 1 Apr 2013 22:01:55 +0200 Subject: [PATCH 09/27] CComponents: add progressbar class to cc-items CProgressbar moved into components sub directory and adapt includes. Progressbar objects are now usable as cc-item TODO: -some color and size corrections -found some dub codes for sig and snr-bars, needs rework --- src/driver/volume.cpp | 11 +- src/gui/channellist.cpp | 35 +-- src/gui/components/Makefile.am | 1 + src/gui/components/cc.h | 4 +- src/gui/components/cc_base.cpp | 2 +- src/gui/components/cc_item_progressbar.cpp | 273 +++++++++++++++++ src/gui/components/cc_item_progressbar.h | 162 +++++++++++ src/gui/components/cc_types.h | 1 + src/gui/dboxinfo.cpp | 9 +- src/gui/epgview.cpp | 18 +- src/gui/infoviewer.cpp | 60 ++-- src/gui/infoviewer.h | 1 - src/gui/infoviewer_bb.cpp | 30 +- src/gui/infoviewer_bb.h | 2 +- src/gui/motorcontrol.cpp | 33 ++- src/gui/motorcontrol.h | 2 +- src/gui/moviebrowser.cpp | 35 ++- src/gui/scan.cpp | 19 +- src/gui/scan.h | 4 +- src/gui/streaminfo2.cpp | 13 +- src/gui/streaminfo2.h | 2 +- src/gui/timeosd.cpp | 8 +- src/gui/timeosd.h | 2 +- src/gui/widget/Makefile.am | 1 - src/gui/widget/progressbar.cpp | 323 --------------------- src/gui/widget/progressbar.h | 142 --------- src/neutrino.cpp | 4 - src/system/settings.h | 9 + 28 files changed, 616 insertions(+), 590 deletions(-) create mode 100644 src/gui/components/cc_item_progressbar.cpp create mode 100644 src/gui/components/cc_item_progressbar.h delete mode 100644 src/gui/widget/progressbar.cpp delete mode 100644 src/gui/widget/progressbar.h diff --git a/src/driver/volume.cpp b/src/driver/volume.cpp index d2b3e65fa..d0c556f60 100644 --- a/src/driver/volume.cpp +++ b/src/driver/volume.cpp @@ -40,7 +40,7 @@ #include #if HAVE_COOL_HARDWARE -#include +#include #endif extern CRemoteControl * g_RemoteControl; @@ -111,7 +111,7 @@ void CVolume::Init() } 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); // mute icon mute_icon_dx = 0; @@ -250,8 +250,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); @@ -343,8 +341,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) @@ -356,6 +352,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/channellist.cpp b/src/gui/channellist.cpp index ed422e7f1..6d2b251c6 100644 --- a/src/gui/channellist.cpp +++ b/src/gui/channellist.cpp @@ -54,7 +54,7 @@ #include #include #include -#include +#include #include #include @@ -1903,8 +1903,8 @@ 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 */ int pb_max = pb_space - 4; if (!(p_event->description.empty())) { snprintf(nameAndDescription+l, sizeof(nameAndDescription)-l,g_settings.channellist_epgtext_align_right ? " ":" - "); @@ -1945,15 +1945,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(); } } @@ -1969,15 +1966,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 8e839e16b..1a6caf7d0 100644 --- a/src/gui/components/Makefile.am +++ b/src/gui/components/Makefile.am @@ -27,6 +27,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_tvpic.cpp diff --git a/src/gui/components/cc.h b/src/gui/components/cc.h index f8eaa5e9f..17dd0ca49 100644 --- a/src/gui/components/cc.h +++ b/src/gui/components/cc.h @@ -32,7 +32,7 @@ #include #include -// #define DEBUG_CC + #define DEBUG_CC class CComponents { @@ -46,7 +46,7 @@ class CComponents void initVarBasic(); 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(); diff --git a/src/gui/components/cc_base.cpp b/src/gui/components/cc_base.cpp index 7655019b9..313c29635 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(); } diff --git a/src/gui/components/cc_item_progressbar.cpp b/src/gui/components/cc_item_progressbar.cpp new file mode 100644 index 000000000..d12f68a1e --- /dev/null +++ b/src/gui/components/cc_item_progressbar.cpp @@ -0,0 +1,273 @@ +/* + 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; + fr_thickness = 2; + + //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_types.h b/src/gui/components/cc_types.h index 85f09144e..3ba4d1c14 100644 --- a/src/gui/components/cc_types.h +++ b/src/gui/components/cc_types.h @@ -44,6 +44,7 @@ typedef enum CC_ITEMTYPE_FRM_ICONFORM, CC_ITEMTYPE_FRM_WINDOW, CC_ITEMTYPE_LABEL, + CC_ITEMTYPE_PROGRESSBAR, CC_ITEMTYPES }CC_ITEMTYPES_T; diff --git a/src/gui/dboxinfo.cpp b/src/gui/dboxinfo.cpp index e00db49e7..1e48bc29e 100644 --- a/src/gui/dboxinfo.cpp +++ b/src/gui/dboxinfo.cpp @@ -40,7 +40,7 @@ #include #include -#include +#include #include #include @@ -442,8 +442,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.setFrameThickness(0); + pb.setBlink(); + pb.setValues(percent_used, 100); + pb.paint(false); } ypos+= mheight; } diff --git a/src/gui/epgview.cpp b/src/gui/epgview.cpp index 16f7dd77e..f4a4a17b3 100644 --- a/src/gui/epgview.cpp +++ b/src/gui/epgview.cpp @@ -33,7 +33,7 @@ #include #include #include -#include +#include #include #include @@ -641,8 +641,11 @@ 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.setFrameThickness(0); + pb.setBlink(); + pb.setValues(epg_done, 100); + pb.paint(false); } GetPrevNextEPGData( epgData.eventID, &epgData.epg_times.startzeit ); @@ -683,9 +686,12 @@ 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.setFrameThickness(0); + pb.setBlink(); + pb.setValues(epg_done, 100); + pb.paint(false); } } if(data == fader.GetTimer()) { diff --git a/src/gui/infoviewer.cpp b/src/gui/infoviewer.cpp index de51eddb8..91b798378 100644 --- a/src/gui/infoviewer.cpp +++ b/src/gui/infoviewer.cpp @@ -216,19 +216,22 @@ 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(); + sigscale->setFrameThickness(0); + + 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(); + snrscale->setFrameThickness(0); + + if (timescale) delete timescale; - timescale = new CProgressBar(true, -1, -1, 30, green_bar, yellow_bar, true); + timescale = new CProgressBar(); + timescale->setBlink(); } void CInfoViewer::paintTime (bool show_dot, bool firstPaint) @@ -1390,7 +1393,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; @@ -1401,7 +1407,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; @@ -1443,12 +1452,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; @@ -1462,26 +1471,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; @@ -1493,8 +1503,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 9a0831132..206d76a96 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 131c0a506..7bf733ecd 100644 --- a/src/gui/infoviewer_bb.cpp +++ b/src/gui/infoviewer_bb.cpp @@ -642,17 +642,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(); } @@ -811,12 +816,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->setFrameThickness(0); + hddscale->setBlink(); + + if (sysscale) delete sysscale; - sysscale = new CProgressBar(true, hddwidth, 6, 50, 100, 75, true); + sysscale = new CProgressBar(); + sysscale->setFrameThickness(0); + sysscale->setBlink(); } 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 627535772..508282fe7 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 &) @@ -717,7 +719,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; @@ -732,29 +734,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 ccbef2f65..e91dd8429 100644 --- a/src/gui/moviebrowser.cpp +++ b/src/gui/moviebrowser.cpp @@ -48,7 +48,7 @@ #include #include #include -#include +#include #include #include #include @@ -1283,10 +1283,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); } } @@ -4006,12 +4009,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; @@ -4131,7 +4136,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 @@ -4157,7 +4162,8 @@ if(buf[0] != 0x47) printf("cut: buffer not aligned at %" PRId64 "\n", sdone); sdone += r; spos += r - wptr; percent = (int) ((float)(spos)/(float)(newsize)*100.); - 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)) { @@ -4263,12 +4269,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++) { @@ -4358,7 +4366,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 @@ -4386,7 +4394,8 @@ if(buf[0] != 0x47) printf("copy: buffer not aligned at %" PRId64 "\n", sdone); spos += r - wptr; btotal += r; percent = (int) ((float)(btotal)/(float)(newsize)*100.); - 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 58510e924..28838244c 100644 --- a/src/gui/scan.cpp +++ b/src/gui/scan.cpp @@ -49,7 +49,7 @@ #include #include -#include +#include #include #include @@ -81,8 +81,11 @@ CScanTs::CScanTs() total = done = 0; freqready = 0; - 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(); } void CScanTs::prev_next_TP( bool up) @@ -555,13 +558,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); @@ -576,7 +580,8 @@ void CScanTs::showSNR () posx = x + 20 + (20 * 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 db871bcc0..4464f6441 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 242c479d5..d025c81fe 100644 --- a/src/gui/streaminfo2.cpp +++ b/src/gui/streaminfo2.cpp @@ -120,8 +120,10 @@ 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(/*true, BAR_WIDTH, BAR_HEIGHT*/); + sigscale->setBlink(); + snrscale = new CProgressBar(/*true, BAR_WIDTH, BAR_HEIGHT*/); + snrscale->setBlink(); lastsnr = lastsig = -1; neutrino_msg_t msg; @@ -910,7 +912,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); @@ -922,7 +925,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 e6a8f2359..2a3757ce9 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 0d80900c2..42daf0d77 100644 --- a/src/gui/timeosd.cpp +++ b/src/gui/timeosd.cpp @@ -31,7 +31,7 @@ #include #include -//static CProgressBar *timescale = 0; +static CProgressBar *timescale = 0; #define TIMEOSD_FONT SNeutrinoSettings::FONT_TYPE_INFOBAR_CHANNAME #define BARLEN 200 @@ -44,7 +44,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; } @@ -118,7 +118,9 @@ 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->paint(); } void CTimeOSD::update(int position, int duration) 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 6cdfee1fe..0818dff09 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 355eb0fbd..000000000 --- a/src/gui/widget/progressbar.cpp +++ /dev/null @@ -1,323 +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; - 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); -} diff --git a/src/gui/widget/progressbar.h b/src/gui/widget/progressbar.h deleted file mode 100644 index 1d2b6bf2e..000000000 --- a/src/gui/widget/progressbar.h +++ /dev/null @@ -1,142 +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_MATRIX = 0, /* 0 */ - PB_LINES_V, /* 1 */ - PB_LINES_H, /* 2 */ - PB_COLOR /* 3 */ - }; -}; - -#endif /* __gui_widget_progressbar_h__ */ diff --git a/src/neutrino.cpp b/src/neutrino.cpp index f41464214..d22776f76 100644 --- a/src/neutrino.cpp +++ b/src/neutrino.cpp @@ -86,10 +86,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/settings.h b/src/system/settings.h index e5aced076..6e1856b26 100644 --- a/src/system/settings.h +++ b/src/system/settings.h @@ -601,6 +601,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 */ From c4d9f76b6bff0ce80a6289df5d373d3b39d7a89c Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Mon, 1 Apr 2013 23:01:13 +0200 Subject: [PATCH 10/27] CTimeOsd: remove unused var timescale --- src/gui/timeosd.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/src/gui/timeosd.cpp b/src/gui/timeosd.cpp index 42daf0d77..be165b3b7 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 From 5cd01b8cc8060a23962d2489fbd5f15fef913c2f Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Mon, 1 Apr 2013 23:11:52 +0200 Subject: [PATCH 11/27] CNeutrinoEventList: remove include of textbox.h Is already included by cc.h --- src/gui/eventlist.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/src/gui/eventlist.cpp b/src/gui/eventlist.cpp index e8968dc1d..c0ff43908 100644 --- a/src/gui/eventlist.cpp +++ b/src/gui/eventlist.cpp @@ -37,7 +37,6 @@ #include #include #include -#include // FIXME should be included by cc.h in eventlist.h #include #include "widget/hintbox.h" From bdbea07e71c9cfa9fcc89f4656a8cdcec1252f7a Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Mon, 1 Apr 2013 23:13:02 +0200 Subject: [PATCH 12/27] CComponents: disable debug spam --- src/gui/components/cc.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/components/cc.h b/src/gui/components/cc.h index 17dd0ca49..16b8aa1c3 100644 --- a/src/gui/components/cc.h +++ b/src/gui/components/cc.h @@ -32,7 +32,7 @@ #include #include - #define DEBUG_CC +// #define DEBUG_CC class CComponents { From e23b03fde9fa70a2a49b5ab5e9cc2b72c254c6c5 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Wed, 3 Apr 2013 10:30:24 +0200 Subject: [PATCH 13/27] CComponentsText: paint always background before painting text Ensures erase of old text, usefully to avoid often repaints of embedded textbox objects or text items --- src/gui/components/cc_item_text.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/components/cc_item_text.cpp b/src/gui/components/cc_item_text.cpp index 432abfda0..c666af19d 100644 --- a/src/gui/components/cc_item_text.cpp +++ b/src/gui/components/cc_item_text.cpp @@ -124,7 +124,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(true); ct_textbox->setBackGroundColor(col_body); ct_textbox->setBackGroundRadius(corner_rad-fr_thickness, corner_type); ct_textbox->setTextColor(ct_col_text); From 399dbad3507694e7f56d1d6924810d70d0f02c3e Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Wed, 3 Apr 2013 10:43:13 +0200 Subject: [PATCH 14/27] CNeutrinoEventList: use CComponentsText instead CComponentsInfoBox add doPaintBg(false), causes no paint or repaint and save of item background. CC-Items comes with its own hide(), but it's not very sensefull to store or paint background here. NOTE: CComponentsText is more of appropriate for embedded text items than CComponentsInfoBox. CComponentsInfoBox is more made for hint or messageboxes. --- src/gui/eventlist.cpp | 5 +++-- src/gui/eventlist.h | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/gui/eventlist.cpp b/src/gui/eventlist.cpp index c0ff43908..231345bf1 100644 --- a/src/gui/eventlist.cpp +++ b/src/gui/eventlist.cpp @@ -279,7 +279,7 @@ int CNeutrinoEventList::exec(const t_channel_id channel_id, const std::string& c infozone_width = full_width - width; // init right info_zone - cc_infozone = new CComponentsInfoBox(x+width+5, y+theight+10, infozone_width-10, listmaxshow*fheight-20); + 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); @@ -812,7 +812,8 @@ void CNeutrinoEventList::paintDescription(int index) infozone_text = g_Locale->getText(LOCALE_EPGLIST_NOEVENTS); cc_infozone->setText(infozone_text, CTextBox::TOP, g_Font[SNeutrinoSettings::FONT_TYPE_EVENTLIST_ITEMLARGE]); - cc_infozone->paint(); + 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) diff --git a/src/gui/eventlist.h b/src/gui/eventlist.h index e492b72de..15cc6c065 100644 --- a/src/gui/eventlist.h +++ b/src/gui/eventlist.h @@ -101,7 +101,7 @@ class CNeutrinoEventList std::string infozone_text; int sort_mode; event_id_t item_event_ID; - CComponentsInfoBox *cc_infozone; + CComponentsText *cc_infozone; void paintItem(unsigned pos, t_channel_id channel_id = 0); void paintDescription(int index); From 3a4543b8d26062e47fc63fbdafe9ca338298938e Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Thu, 4 Apr 2013 09:44:54 +0200 Subject: [PATCH 15/27] CComponentsText: add member to control background paint on textbox objects --- src/gui/components/cc.h | 3 ++- src/gui/components/cc_item_text.cpp | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/gui/components/cc.h b/src/gui/components/cc.h index 16b8aa1c3..cd064ab97 100644 --- a/src/gui/components/cc.h +++ b/src/gui/components/cc.h @@ -161,7 +161,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(); @@ -181,6 +181,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_item_text.cpp b/src/gui/components/cc_item_text.cpp index c666af19d..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(true); + 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); From 4e7f81a1261f734cb576bebb7e0d5920bda01a27 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Thu, 4 Apr 2013 09:47:48 +0200 Subject: [PATCH 16/27] CComponentsInfoBox: prevent background paint in infobox Background for text is not needed here --- src/gui/components/cc_item_infobox.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/gui/components/cc_item_infobox.cpp b/src/gui/components/cc_item_infobox.cpp index 04eac2e54..37c0d94ad 100644 --- a/src/gui/components/cc_item_infobox.cpp +++ b/src/gui/components/cc_item_infobox.cpp @@ -127,6 +127,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); } From a841aa37905946bb4d7c74bebdee78615d20fb34 Mon Sep 17 00:00:00 2001 From: Michael Liebmann Date: Wed, 3 Apr 2013 21:34:00 +0200 Subject: [PATCH 17/27] * CNeutrinoEventList: Fix flicker when page is changed --- src/gui/eventlist.cpp | 31 ++++++++++++++++++++++++++++++- src/gui/eventlist.h | 3 +++ 2 files changed, 33 insertions(+), 1 deletion(-) diff --git a/src/gui/eventlist.cpp b/src/gui/eventlist.cpp index 231345bf1..97282ce39 100644 --- a/src/gui/eventlist.cpp +++ b/src/gui/eventlist.cpp @@ -106,6 +106,9 @@ CNeutrinoEventList::CNeutrinoEventList() infozone_text = ""; item_event_ID = 0; FunctionBarHeight = 0; + oldIndex = -1; + oldEventID = -1; + bgRightBoxPaint = false; } CNeutrinoEventList::~CNeutrinoEventList() @@ -598,6 +601,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]); @@ -635,6 +641,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]); @@ -643,6 +652,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]); } @@ -663,6 +675,9 @@ int CNeutrinoEventList::exec(const t_channel_id channel_id, const std::string& c delete cc_infozone; cc_infozone = NULL; + oldIndex = -1; + oldEventID = -1; + bgRightBoxPaint = false; hide(); fader.Stop(); @@ -800,6 +815,17 @@ void CNeutrinoEventList::paintItem(unsigned int pos, t_channel_id channel_idI) 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); @@ -874,7 +900,10 @@ void CNeutrinoEventList::paint(t_channel_id channel_id) } // paint background for right box - frameBuffer->paintBoxRel(x+width,y+theight,infozone_width,listmaxshow*fheight,COL_MENUCONTENT_PLUS_0); + if (!bgRightBoxPaint) { + frameBuffer->paintBoxRel(x+width,y+theight,infozone_width,listmaxshow*fheight,COL_MENUCONTENT_PLUS_0); + bgRightBoxPaint = true; + } for(unsigned int count=0;count Date: Thu, 4 Apr 2013 12:19:31 +0200 Subject: [PATCH 18/27] CComponents: don't paint the same box with different colors as background --- src/gui/components/cc.h | 1 + src/gui/components/cc_base.cpp | 20 +++++++++++++++++++- 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/src/gui/components/cc.h b/src/gui/components/cc.h index cd064ab97..55a8418a6 100644 --- a/src/gui/components/cc.h +++ b/src/gui/components/cc.h @@ -45,6 +45,7 @@ class CComponents bool firstPaint, shadow, is_painted, paint_bg; void initVarBasic(); + bool allowPaint(int i); void paintFbItems(bool do_save_bg = true); virtual fb_pixel_t* getScreen(int ax, int ay, int dx, int dy); comp_screen_data_t saved_screen; diff --git a/src/gui/components/cc_base.cpp b/src/gui/components/cc_base.cpp index 313c29635..6872023f8 100644 --- a/src/gui/components/cc_base.cpp +++ b/src/gui/components/cc_base.cpp @@ -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); } } From 85ab392a09e2afa92b00c8e3e56f0d6db32f1424 Mon Sep 17 00:00:00 2001 From: svenhoefer Date: Thu, 4 Apr 2013 14:41:13 +0200 Subject: [PATCH 19/27] - infoviewer: remove frame from timescale inside infoviewer --- src/gui/infoviewer.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/gui/infoviewer.cpp b/src/gui/infoviewer.cpp index 91b798378..1ce423fee 100644 --- a/src/gui/infoviewer.cpp +++ b/src/gui/infoviewer.cpp @@ -1478,6 +1478,7 @@ void CInfoViewer::display_Info(const char *current, const char *next, pb_w = BoxEndX - 10 - xStart; pb_shadow = 0; timescale->setShadowOnOff(false); + timescale->setFrameThickness(0); } switch(g_settings.infobar_progressbar) //set progressbar position { From 095c0e1b045898cbb7abdf363227e0f0690cf1a6 Mon Sep 17 00:00:00 2001 From: Michael Liebmann Date: Thu, 4 Apr 2013 17:05:32 +0200 Subject: [PATCH 20/27] * CComponentsInfoBox: CComponentsPicture not create when no image to draw --- src/gui/components/cc_item_infobox.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/gui/components/cc_item_infobox.cpp b/src/gui/components/cc_item_infobox.cpp index 37c0d94ad..b4954a6c8 100644 --- a/src/gui/components/cc_item_infobox.cpp +++ b/src/gui/components/cc_item_infobox.cpp @@ -91,6 +91,9 @@ void CComponentsInfoBox::initVarInfobox() void CComponentsInfoBox::paintPicture() { + if (pic_name == "") + return; + //init and set icon paint position if (pic) delete pic; @@ -115,7 +118,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; } From bd47ef206072b18e6441f38f504131dd3125ca38 Mon Sep 17 00:00:00 2001 From: Michael Liebmann Date: Thu, 4 Apr 2013 17:06:07 +0200 Subject: [PATCH 21/27] * CComponentsPicture: initVarPicture() not execute if pic_name is blank --- src/gui/components/cc_item_picture.cpp | 3 +++ 1 file changed, 3 insertions(+) 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; From adfbfe079c04178aa58f443987c7ddc8e17be352 Mon Sep 17 00:00:00 2001 From: Michael Liebmann Date: Fri, 5 Apr 2013 20:37:48 +0200 Subject: [PATCH 22/27] * Fix order of colors for some progress bars --- src/driver/volume.cpp | 3 ++- src/gui/dboxinfo.cpp | 1 + src/gui/infoviewer.cpp | 1 + src/gui/infoviewer_bb.cpp | 2 ++ src/gui/moviebrowser.cpp | 1 + src/gui/streaminfo2.cpp | 2 ++ src/gui/timeosd.cpp | 1 + 7 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/driver/volume.cpp b/src/driver/volume.cpp index d0c556f60..82c0ec51f 100644 --- a/src/driver/volume.cpp +++ b/src/driver/volume.cpp @@ -106,12 +106,13 @@ void CVolume::Init() vbar_w = spacer + icon_w + spacer + progress_w + spacer; if (paintDigits) { digit_w = g_Font[VolumeFont]->getRenderWidth("100"); - progress_h = std::max(icon_h, digit_h) - 2*pB; + progress_h = std::max(icon_h, digit_h); vbar_w += digit_w; } if (volscale) delete volscale; 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(); // mute icon mute_icon_dx = 0; diff --git a/src/gui/dboxinfo.cpp b/src/gui/dboxinfo.cpp index 1e48bc29e..8c6087633 100644 --- a/src/gui/dboxinfo.cpp +++ b/src/gui/dboxinfo.cpp @@ -445,6 +445,7 @@ void CDBoxInfoWidget::paint() CProgressBar pb(x+offsetw, ypos+3, pbw, mheight-10); pb.setFrameThickness(0); pb.setBlink(); + pb.setInvert(); pb.setValues(percent_used, 100); pb.paint(false); } diff --git a/src/gui/infoviewer.cpp b/src/gui/infoviewer.cpp index 1ce423fee..c7bd1eaf0 100644 --- a/src/gui/infoviewer.cpp +++ b/src/gui/infoviewer.cpp @@ -232,6 +232,7 @@ void CInfoViewer::changePB() delete timescale; timescale = new CProgressBar(); timescale->setBlink(); + timescale->setRgb(0, 100, 70); } void CInfoViewer::paintTime (bool show_dot, bool firstPaint) diff --git a/src/gui/infoviewer_bb.cpp b/src/gui/infoviewer_bb.cpp index 7bf733ecd..98a611806 100644 --- a/src/gui/infoviewer_bb.cpp +++ b/src/gui/infoviewer_bb.cpp @@ -821,12 +821,14 @@ void CInfoViewerBB::changePB() hddscale = new CProgressBar(); hddscale->setFrameThickness(0); hddscale->setBlink(); + hddscale->setInvert(); if (sysscale) delete sysscale; sysscale = new CProgressBar(); sysscale->setFrameThickness(0); sysscale->setBlink(); + sysscale->setInvert(); } void CInfoViewerBB::reset_allScala() diff --git a/src/gui/moviebrowser.cpp b/src/gui/moviebrowser.cpp index e91dd8429..7aa357c72 100644 --- a/src/gui/moviebrowser.cpp +++ b/src/gui/moviebrowser.cpp @@ -1288,6 +1288,7 @@ void CMovieBrowser::info_hdd_level(bool paint_hdd) 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.setFrameThickness(0); pb.setValues( blocks_percent_used, 100); pb.paint(false); } diff --git a/src/gui/streaminfo2.cpp b/src/gui/streaminfo2.cpp index d025c81fe..8fcf0f300 100644 --- a/src/gui/streaminfo2.cpp +++ b/src/gui/streaminfo2.cpp @@ -122,8 +122,10 @@ int CStreamInfo2::doSignalStrengthLoop () int res = menu_return::RETURN_REPAINT; sigscale = new CProgressBar(/*true, BAR_WIDTH, BAR_HEIGHT*/); sigscale->setBlink(); + sigscale->setFrameThickness(0); snrscale = new CProgressBar(/*true, BAR_WIDTH, BAR_HEIGHT*/); snrscale->setBlink(); + snrscale->setFrameThickness(0); lastsnr = lastsig = -1; neutrino_msg_t msg; diff --git a/src/gui/timeosd.cpp b/src/gui/timeosd.cpp index be165b3b7..f3d482277 100644 --- a/src/gui/timeosd.cpp +++ b/src/gui/timeosd.cpp @@ -119,6 +119,7 @@ void CTimeOSD::updatePos(short runningPercent) timescale->setProgress(m_xstart, m_y, BARLEN, m_height -5, runningPercent, 100); timescale->setBlink(); + timescale->setRgb(0, 100, 70); timescale->paint(); } From 210ae1491d0ba3ba7df0764d8dd2ab0ea4a41f67 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Fri, 5 Apr 2013 21:19:20 +0200 Subject: [PATCH 23/27] CProgressBar: remove wrong intital value for frame thickness Default value is 0, and should remain as specified in the base class. --- src/gui/components/cc_item_progressbar.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/src/gui/components/cc_item_progressbar.cpp b/src/gui/components/cc_item_progressbar.cpp index d12f68a1e..b4369a929 100644 --- a/src/gui/components/cc_item_progressbar.cpp +++ b/src/gui/components/cc_item_progressbar.cpp @@ -78,7 +78,6 @@ void CProgressBar::initVarProgressbar() //CComponentsItem initVarItem(); cc_item_type = CC_ITEMTYPE_PROGRESSBAR; - fr_thickness = 2; //CProgressBar pb_blink = false; From f70a30defa0a25b90056c8ec8e86a66de0734f76 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Fri, 5 Apr 2013 21:28:46 +0200 Subject: [PATCH 24/27] Progressbars: use default frame thickness It's unnecessary overhead to set the value everywhere, except it's needed. --- src/driver/volume.cpp | 1 + src/gui/dboxinfo.cpp | 1 - src/gui/epgview.cpp | 2 -- src/gui/infoviewer.cpp | 3 --- src/gui/infoviewer_bb.cpp | 2 -- src/gui/moviebrowser.cpp | 1 - src/gui/streaminfo2.cpp | 9 +++++---- 7 files changed, 6 insertions(+), 13 deletions(-) diff --git a/src/driver/volume.cpp b/src/driver/volume.cpp index 82c0ec51f..052c58fa1 100644 --- a/src/driver/volume.cpp +++ b/src/driver/volume.cpp @@ -113,6 +113,7 @@ void CVolume::Init() delete volscale; 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; diff --git a/src/gui/dboxinfo.cpp b/src/gui/dboxinfo.cpp index 8c6087633..7da5b5cba 100644 --- a/src/gui/dboxinfo.cpp +++ b/src/gui/dboxinfo.cpp @@ -443,7 +443,6 @@ void CDBoxInfoWidget::paint() if (pbw > 8) /* smaller progressbar is not useful ;) */ { CProgressBar pb(x+offsetw, ypos+3, pbw, mheight-10); - pb.setFrameThickness(0); pb.setBlink(); pb.setInvert(); pb.setValues(percent_used, 100); diff --git a/src/gui/epgview.cpp b/src/gui/epgview.cpp index f4a4a17b3..719533328 100644 --- a/src/gui/epgview.cpp +++ b/src/gui/epgview.cpp @@ -642,7 +642,6 @@ int CEpgData::show(const t_channel_id channel_id, uint64_t a_id, time_t* a_start { int pbx = sx + 10 + widthl + 10 + ((ox-104-widthr-widthl-10-10-20)>>1); CProgressBar pb(pbx, sy+oy-height, 104, height-6); - pb.setFrameThickness(0); pb.setBlink(); pb.setValues(epg_done, 100); pb.paint(false); @@ -688,7 +687,6 @@ 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(pbx, sy+oy-height, 104, height-6); - pb.setFrameThickness(0); pb.setBlink(); pb.setValues(epg_done, 100); pb.paint(false); diff --git a/src/gui/infoviewer.cpp b/src/gui/infoviewer.cpp index c7bd1eaf0..aa7c22763 100644 --- a/src/gui/infoviewer.cpp +++ b/src/gui/infoviewer.cpp @@ -220,13 +220,11 @@ void CInfoViewer::changePB() delete sigscale; sigscale = new CProgressBar(); sigscale->setBlink(); - sigscale->setFrameThickness(0); if (snrscale) delete snrscale; snrscale = new CProgressBar(); snrscale->setBlink(); - snrscale->setFrameThickness(0); if (timescale) delete timescale; @@ -1479,7 +1477,6 @@ void CInfoViewer::display_Info(const char *current, const char *next, pb_w = BoxEndX - 10 - xStart; pb_shadow = 0; timescale->setShadowOnOff(false); - timescale->setFrameThickness(0); } switch(g_settings.infobar_progressbar) //set progressbar position { diff --git a/src/gui/infoviewer_bb.cpp b/src/gui/infoviewer_bb.cpp index 98a611806..f25ca307b 100644 --- a/src/gui/infoviewer_bb.cpp +++ b/src/gui/infoviewer_bb.cpp @@ -819,14 +819,12 @@ void CInfoViewerBB::changePB() if (hddscale) delete hddscale; hddscale = new CProgressBar(); - hddscale->setFrameThickness(0); hddscale->setBlink(); hddscale->setInvert(); if (sysscale) delete sysscale; sysscale = new CProgressBar(); - sysscale->setFrameThickness(0); sysscale->setBlink(); sysscale->setInvert(); } diff --git a/src/gui/moviebrowser.cpp b/src/gui/moviebrowser.cpp index 7aa357c72..e91dd8429 100644 --- a/src/gui/moviebrowser.cpp +++ b/src/gui/moviebrowser.cpp @@ -1288,7 +1288,6 @@ void CMovieBrowser::info_hdd_level(bool paint_hdd) 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.setFrameThickness(0); pb.setValues( blocks_percent_used, 100); pb.paint(false); } diff --git a/src/gui/streaminfo2.cpp b/src/gui/streaminfo2.cpp index 8fcf0f300..72f059692 100644 --- a/src/gui/streaminfo2.cpp +++ b/src/gui/streaminfo2.cpp @@ -120,12 +120,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*/); + + sigscale = new CProgressBar(); sigscale->setBlink(); - sigscale->setFrameThickness(0); - snrscale = new CProgressBar(/*true, BAR_WIDTH, BAR_HEIGHT*/); + + snrscale = new CProgressBar(); snrscale->setBlink(); - snrscale->setFrameThickness(0); + lastsnr = lastsig = -1; neutrino_msg_t msg; From d7ce8474712d42e0305c8a8f6202dcc09ea83fda Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Sat, 6 Apr 2013 08:49:16 +0200 Subject: [PATCH 25/27] CComponentsInfoBox: move statement for check of image name Ensure empty pic object otherwise it can be retained on exit of paintPicture(), if an instance of Infobox already exists. supplement to 095c0e1b045898cbb7abdf363227e0f0690cf1a6 --- src/gui/components/cc_item_infobox.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/gui/components/cc_item_infobox.cpp b/src/gui/components/cc_item_infobox.cpp index b4954a6c8..fb8eaa9c0 100644 --- a/src/gui/components/cc_item_infobox.cpp +++ b/src/gui/components/cc_item_infobox.cpp @@ -91,12 +91,16 @@ void CComponentsInfoBox::initVarInfobox() void CComponentsInfoBox::paintPicture() { - if (pic_name == "") - return; - - //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 From 6fa592323baa05503e4d626c753cd6a01c404a49 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Sat, 6 Apr 2013 10:21:22 +0200 Subject: [PATCH 26/27] CChannellist: add missig frame for timscale --- src/gui/channellist.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/gui/channellist.cpp b/src/gui/channellist.cpp index 6d2b251c6..4b5c46624 100644 --- a/src/gui/channellist.cpp +++ b/src/gui/channellist.cpp @@ -1905,6 +1905,7 @@ void CChannelList::paintItem(int pos) 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 ? " ":" - "); From 8ba673497edc8932708dec9140daba022895576d Mon Sep 17 00:00:00 2001 From: Stefan Seyfried Date: Sat, 6 Apr 2013 13:33:29 +0200 Subject: [PATCH 27/27] Revert "src/gui/channellist.cpp: fix to 36e95d7fbcd22dfbb94d03867f10634f7a72df63 if more bouquets empty" This reverts commit f4ae5e17ce00575de61daba517f37a4bb9252836. a better solution without duplicating code is available --- src/gui/channellist.cpp | 20 +++++--------------- 1 file changed, 5 insertions(+), 15 deletions(-) diff --git a/src/gui/channellist.cpp b/src/gui/channellist.cpp index 4b5c46624..1137fa7b3 100644 --- a/src/gui/channellist.cpp +++ b/src/gui/channellist.cpp @@ -749,21 +749,11 @@ int CChannelList::show() if(bouquetList->Bouquets[nNext]->channelList->isEmpty() ) { found = false; nNext = (nNext + b_size + dir) % b_size; - if(msg == (neutrino_msg_t)g_settings.key_bouquet_down){ - for (int i = nNext; i > 0; i--) { - if( !bouquetList->Bouquets[i]->channelList->isEmpty() ) { - found = true; - nNext = i; - break; - } - } - }else{ - for (int i = nNext; i < b_size; i++) { - if( !bouquetList->Bouquets[i]->channelList->isEmpty() ) { - found = true; - nNext = i; - break; - } + for (int i = nNext; i < b_size; i++) { + if( !bouquetList->Bouquets[i]->channelList->isEmpty() ) { + found = true; + nNext = i; + break; } } }