From 32c6874aa2f3d9ef57b6eab030a3d9741fcd2a3c Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Mon, 1 May 2017 14:59:16 +0200 Subject: [PATCH 01/17] CCDraw: add methode do get current background save mode Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/5ac5db718dd84b4594806d46ba9e6fc438452d14 Author: Thilo Graf Date: 2017-05-01 (Mon, 01 May 2017) ------------------ No further description and justification available within origin commit message! ------------------ This commit was generated by Migit --- src/gui/components/cc_draw.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/gui/components/cc_draw.h b/src/gui/components/cc_draw.h index 26b8875d5..0f23e7eb4 100644 --- a/src/gui/components/cc_draw.h +++ b/src/gui/components/cc_draw.h @@ -284,6 +284,8 @@ class CCDraw : public COSDFader, public CComponentsSignals virtual void enableSaveBg(bool save_bg = true); ///disable background buffering, does the same like enableSaveBg(false), NOTE: cleans existant pixbuffer content! virtual void disableSaveBg(){enableSaveBg(false);} + ///returns background buffering mode. Mode is assigned with paint() or enableSaveBg()/disableSaveBg()) + bool SaveBg(){return cc_save_bg;} ///allow/disalows paint of item and its contents, but initialize of other properties are not touched ///this can be understood as a counterpart to isPainted(), but before paint and value of is_painted is modified temporarily till next paint of item //TODO: is this sufficiently? From 964651701f56e18de5846451c80e4ca962b8cac5 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Mon, 1 May 2017 15:01:32 +0200 Subject: [PATCH 02/17] CComponentsForm: use current bg save mode while paint items Mode was always false but current mode could be required in many constellations. Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/e7d60f7c08a59d7fe8c3e1f26b15b5ee3a82f4c3 Author: Thilo Graf Date: 2017-05-01 (Mon, 01 May 2017) ------------------ This commit was generated by Migit --- src/gui/components/cc_frm.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/components/cc_frm.cpp b/src/gui/components/cc_frm.cpp index bd1f4f555..15bf84e42 100644 --- a/src/gui/components/cc_frm.cpp +++ b/src/gui/components/cc_frm.cpp @@ -518,7 +518,7 @@ void CComponentsForm::paintCCItems() //finally paint current item, but only required contents of page if (cc_item->getPageNumber() == cur_page) - cc_item->paint(CC_SAVE_SCREEN_NO); + cc_item->paint(cc_item->SaveBg()); //restore defined old visibility mode of item after paint cc_item->allowPaint(item_visible); From e01c99e5e8140dd1689017e37605e5e99bd4e5bc Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Tue, 2 May 2017 17:21:01 +0200 Subject: [PATCH 03/17] cc_types: add missing image types Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/30b58f49409c91399df13aa4295081de81ddac6a Author: Thilo Graf Date: 2017-05-02 (Tue, 02 May 2017) ------------------ No further description and justification available within origin commit message! ------------------ This commit was generated by Migit --- src/gui/components/cc_item_picture.h | 6 ++++-- src/gui/components/cc_types.h | 2 ++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/gui/components/cc_item_picture.h b/src/gui/components/cc_item_picture.h index ef8204d55..fe42604e7 100644 --- a/src/gui/components/cc_item_picture.h +++ b/src/gui/components/cc_item_picture.h @@ -208,7 +208,8 @@ class CComponentsPictureScalable : public CComponentsPicture fb_pixel_t color_background = 0, fb_pixel_t color_shadow = COL_SHADOW_PLUS_0, int transparent = CFrameBuffer::TM_NONE) - : CComponentsPicture(x_pos, y_pos, 0, 0, image_name, parent, shadow_mode, color_frame, color_background, color_shadow, transparent){}; + : CComponentsPicture(x_pos, y_pos, 0, 0, image_name, parent, shadow_mode, color_frame, color_background, color_shadow, transparent) + {cc_item_type = CC_ITEMTYPE_PICTURE_SCALABLE;}; }; class CComponentsChannelLogo : public CComponentsPicture @@ -292,7 +293,8 @@ class CComponentsChannelLogoScalable : public CComponentsChannelLogo fb_pixel_t color_background = 0, fb_pixel_t color_shadow = COL_SHADOW_PLUS_0, int transparent = CFrameBuffer::TM_BLACK) - : CComponentsChannelLogo(x_pos, y_pos, 0, 0, channelName, channelId, parent, shadow_mode, color_frame, color_background, color_shadow, transparent){}; + : CComponentsChannelLogo(x_pos, y_pos, 0, 0, channelName, channelId, parent, shadow_mode, color_frame, color_background, color_shadow, transparent) + {cc_item_type = CC_ITEMTYPE_CHANNEL_LOGO_SCALABLE;}; }; #endif diff --git a/src/gui/components/cc_types.h b/src/gui/components/cc_types.h index 297cc5b66..532aba066 100644 --- a/src/gui/components/cc_types.h +++ b/src/gui/components/cc_types.h @@ -41,7 +41,9 @@ typedef enum CC_ITEMTYPE_GENERIC, CC_ITEMTYPE_ITEM, CC_ITEMTYPE_PICTURE, + CC_ITEMTYPE_PICTURE_SCALABLE, CC_ITEMTYPE_CHANNEL_LOGO, + CC_ITEMTYPE_CHANNEL_LOGO_SCALABLE, CC_ITEMTYPE_TEXT, CC_ITEMTYPE_TEXT_INFOBOX, CC_ITEMTYPE_SHAPE_SQUARE, From d0fd666bdbd32e75ab1b819bde78b243fd9fbe25 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Tue, 2 May 2017 19:54:42 +0200 Subject: [PATCH 04/17] CComponentsForm: expand debug output with address. Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/801d1beb1084d756daf0ae88d1a95de28f5551ab Author: Thilo Graf Date: 2017-05-02 (Tue, 02 May 2017) ------------------ No further description and justification available within origin commit message! ------------------ This commit was generated by Migit --- src/gui/components/cc_frm.cpp | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/gui/components/cc_frm.cpp b/src/gui/components/cc_frm.cpp index 15bf84e42..430423045 100644 --- a/src/gui/components/cc_frm.cpp +++ b/src/gui/components/cc_frm.cpp @@ -185,12 +185,11 @@ void CComponentsForm::clear() return; for(size_t i=0; igetItemType()); - - delete v_cc_items[i]; - v_cc_items[i] = NULL; + CComponentsItem *item = v_cc_items[i]; + if (item){ + dprintf(DEBUG_DEBUG, "[CComponentsForm] %s... delete form cc-item %d of %d (type=%d)\taddress = %p\n", __func__, (int)i+1, (int)v_cc_items.size(), item->getItemType(), item); + delete item; + item = NULL; } } v_cc_items.clear(); From 90226e9a46acb318041062c10a3813e27e099713 Mon Sep 17 00:00:00 2001 From: TangoCash Date: Mon, 1 May 2017 16:18:53 +0200 Subject: [PATCH 05/17] cc_form_header: add max caption width picked from: https://github.com/TangoCash/neutrino-mp-cst-next commit: 4ff6c9f89b194c5fffdc4ee4e4eb744829be975f Signed-off-by: Thilo Graf review reqiured Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/c482dd139f26e5db804e022921fd21a9b75c653b Author: TangoCash Date: 2017-05-01 (Mon, 01 May 2017) Origin message was: ------------------ -cc_form_header: add max caption width picked from: https://github.com/TangoCash/neutrino-mp-cst-next commit: 4ff6c9f89b194c5fffdc4ee4e4eb744829be975f Signed-off-by: Thilo Graf review reqiured ------------------ This commit was generated by Migit --- src/gui/components/cc_frm_header.cpp | 3 +++ src/gui/components/cc_frm_header.h | 4 ++++ 2 files changed, 7 insertions(+) diff --git a/src/gui/components/cc_frm_header.cpp b/src/gui/components/cc_frm_header.cpp index fff49031a..c633c74b9 100644 --- a/src/gui/components/cc_frm_header.cpp +++ b/src/gui/components/cc_frm_header.cpp @@ -144,6 +144,8 @@ void CComponentsHeader::initVarHeader( const int& x_pos, const int& y_pos, const cch_cl_sec_format = cch_cl_format; cch_cl_enable_run = false; + cch_text_max_w = width; + addContextButton(buttons); initCCItems(); initParent(parent); @@ -562,6 +564,7 @@ void CComponentsHeader::initCaption() cch_cl_obj->allowPaint(cch_cl_enable); } + cc_text_w = min(cc_text_w,cch_text_max_w); //create cch_text_obj and add to collection if (cch_text_obj == NULL){ diff --git a/src/gui/components/cc_frm_header.h b/src/gui/components/cc_frm_header.h index 9550d1134..16fa2ddd1 100644 --- a/src/gui/components/cc_frm_header.h +++ b/src/gui/components/cc_frm_header.h @@ -106,6 +106,8 @@ class CComponentsHeader : public CComponentsForm, public CCTextScreen int cch_icon_w; ///property: internal width for clock object int cch_clock_w; + ///property: internal max width for text object + int cch_text_max_w; ///property: internal x-position for caption object int cch_text_x; ///property: internal offset of context button icons within context button object @@ -191,6 +193,8 @@ class CComponentsHeader : public CComponentsForm, public CCTextScreen virtual Font* getCaptionFont(){return cch_font;} ///set text color for caption virtual void setCaptionColor(fb_pixel_t text_color){cch_col_text = text_color;} + ///set max width for caption + virtual void setCaptionMaxWidth(int max_width){cch_text_max_w = max_width;} enum { From e36f7ccecd0d78d6350e2f99b82d7e7a90a626ee Mon Sep 17 00:00:00 2001 From: TangoCash Date: Wed, 3 May 2017 21:29:41 +0200 Subject: [PATCH 06/17] eventlist,epgview: adjust style, implement new header class picked from: https://github.com/TangoCash/neutrino-mp-cst-next commit: 477db186ee4f306e191035ed2201ff4fc9d70b9d Signed-off-by: Thilo Graf review reqiured Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/3ac2f99a671b444426f515b0d25ead1708880bf8 Author: TangoCash Date: 2017-05-03 (Wed, 03 May 2017) Origin message was: ------------------ -eventlist,epgview: adjust style, implement new header class picked from: https://github.com/TangoCash/neutrino-mp-cst-next commit: 477db186ee4f306e191035ed2201ff4fc9d70b9d Signed-off-by: Thilo Graf review reqiured ------------------ This commit was generated by Migit --- src/gui/epgview.cpp | 118 +++++++++++++++--------------------- src/gui/epgview.h | 2 +- src/gui/eventlist.cpp | 107 +++++++++++++++++++++----------- src/gui/eventlist.h | 5 +- src/gui/moviebrowser/mb.cpp | 1 + 5 files changed, 126 insertions(+), 107 deletions(-) diff --git a/src/gui/epgview.cpp b/src/gui/epgview.cpp index bf6658969..b619f3dd6 100644 --- a/src/gui/epgview.cpp +++ b/src/gui/epgview.cpp @@ -712,46 +712,16 @@ int CEpgData::show(const t_channel_id channel_id, uint64_t a_id, time_t* a_start const int pic_h = 39; toph = std::max(toph, pic_h); - // Calculate offset for the title when logo appears. - int pic_offx = 0; std::string lname; - int logo_w = 0; - int logo_h = 0; - int logo_w_max = ox / 4; - int logo_h_max = toph - 2*OFFSET_INNER_MIN; std::string channel_name; if (mp_info) channel_name = mp_movie_info->channelName; else channel_name = g_Zapit->getChannelName(channel_id); - if (g_settings.infobar_show_channellogo && g_PicViewer->GetLogoName(channel_id, channel_name, lname, &logo_w, &logo_h)) - { - if ((logo_h > logo_h_max) || (logo_w > logo_w_max)) - g_PicViewer->rescaleImageDimensions(&logo_w, &logo_h, logo_w_max, logo_h_max); - pic_offx = logo_w + OFFSET_INNER_MID; - } - - int pos; - std::string text1 = epgData.title; - std::string text2 = ""; - if (g_Font[SNeutrinoSettings::FONT_TYPE_EPG_TITLE]->getRenderWidth(text1) > ox - pic_offx - 2*OFFSET_INNER_MID) - { - do - { - pos = text1.find_last_of("[ .]+"); - if (pos != -1) - text1 = text1.substr(0, pos); - } while ((pos != -1) && (g_Font[SNeutrinoSettings::FONT_TYPE_EPG_TITLE]->getRenderWidth(text1) > ox - pic_offx - 2*OFFSET_INNER_MID)); - if (epgData.title.length() > text1.length()) // shold never be false in this place - text2 = epgData.title.substr(text1.length()+ 1, uint(-1) ); - } if (!topboxheight) start(); - if (!text2.empty()) - toph = 2 * topboxheight; - sb = oy - toph - botboxheight; // 21.07.2005 - rainerk @@ -869,61 +839,65 @@ int CEpgData::show(const t_channel_id channel_id, uint64_t a_id, time_t* a_start COSDFader fader(g_settings.theme.menu_Content_alpha); fader.StartFadeIn(); - //show the epg + // show the epg // header + logo - int header_h = std::max(toph, logo_h); - if (!header){ - header = new CComponentsShapeSquare(sx, sy, ox, header_h); - header->setCorner(RADIUS_LARGE, CORNER_TOP); + if (header) { + header->kill(); + delete header; + header = NULL; } - header->setDimensionsAll(sx, sy, ox, header_h); + + header = new CComponentsHeader(sx, sy, ox, toph); + header->setCorner(RADIUS_LARGE, CORNER_TOP); + header->setDimensionsAll(sx, sy, ox, toph); header->setColorBody(COL_MENUHEAD_PLUS_0); header->enableColBodyGradient(g_settings.theme.menu_Head_gradient, COL_MENUCONTENT_PLUS_0, g_settings.theme.menu_Head_gradient_direction); - CComponentsPicture* headerPic = NULL; //NOTE: class CComponentsChannelLogo is preferred for channel logos - if (pic_offx > 0) { - headerPic = new CComponentsPicture(sx + OFFSET_INNER_MID, sy + (header_h-logo_h)/2, logo_w, logo_h, lname); - headerPic->doPaintBg(false); - } - std::string textAll = (!text2.empty()) ? text1 + "\n" + text2 : text1; - CComponentsText headerText(sx + OFFSET_INNER_MID + pic_offx, sy, ox - 2*OFFSET_INNER_MID - pic_offx, header_h, textAll, CTextBox::NO_AUTO_LINEBREAK, g_Font[SNeutrinoSettings::FONT_TYPE_EPG_TITLE]); - headerText.doPaintBg(false); - headerText.setTextColor(COL_MENUHEAD_TEXT); + header->enableClock(true, "%H:%M", "%H.%M", true); + header->getClockObject()->setCorner(RADIUS_LARGE, CORNER_TOP_RIGHT); + + header->getChannelLogoObject()->hide(); + header->setChannelLogo(channel_id, channel_name); + + header->setCaption(epgData.title); + header->paint(CC_SAVE_SCREEN_NO); - headerText.paint(CC_SAVE_SCREEN_NO); - if (headerPic) - headerPic->paint(CC_SAVE_SCREEN_NO); int showPos = 0; textCount = epgText.size(); showText(showPos, sy + toph); // small bottom box - frameBuffer->paintBoxRel(sx, sy+oy-botboxheight, ox, botboxheight, COL_MENUHEAD_PLUS_0); + CComponentsFrmChain *Bottombox = new CComponentsFrmChain(sx, sy+oy-botboxheight, ox, botboxheight); + Bottombox->setColorBody(COL_MENUHEAD_PLUS_0); + if (!mp_info) { - static int iw = 0, ih = 0, io = 0; - if (!iw && !ih) - frameBuffer->getIconSize(NEUTRINO_ICON_BUTTON_LEFT, &iw, &ih); - if (!io && iw) - io = iw + OFFSET_INNER_MID; - std::string fromto = epg_start + " - " + epg_end; - - int widthl = g_Font[SNeutrinoSettings::FONT_TYPE_EPG_DATE]->getRenderWidth(fromto); - g_Font[SNeutrinoSettings::FONT_TYPE_EPG_DATE]->RenderString(sx+OFFSET_INNER_MID+io, sy+oy-3, widthl, fromto, COL_MENUHEAD_TEXT); - int widthr = g_Font[SNeutrinoSettings::FONT_TYPE_EPG_DATE]->getRenderWidth(epg_date); - g_Font[SNeutrinoSettings::FONT_TYPE_EPG_DATE]->RenderString(sx+ox-OFFSET_INNER_MID-io-widthr, sy+oy-3, widthr, epg_date, COL_MENUHEAD_TEXT); + int x_off = OFFSET_INNER_MID; + int mid_width = ox * 40 / 100; // 40% + int side_width = ((ox - mid_width) / 2) - (2 * x_off); GetPrevNextEPGData(epgData.eventID, &epgData.epg_times.startzeit); - if (!call_fromfollowlist) - { - int iy = sy + oy - botboxheight + (botboxheight - iw)/2; - if (prev_id) - frameBuffer->paintIcon(NEUTRINO_ICON_BUTTON_LEFT, sx + OFFSET_INNER_MID, iy); - if (next_id) - frameBuffer->paintIcon(NEUTRINO_ICON_BUTTON_RIGHT, sx + ox - iw - OFFSET_INNER_MID, iy); - } + + CComponentsPictureScalable *lpic = new CComponentsPictureScalable(x_off,CC_CENTERED,NEUTRINO_ICON_BUTTON_LEFT); + CComponentsText *lText = new CComponentsText(x_off + lpic->getWidth() + OFFSET_INNER_MID, CC_CENTERED, side_width, toph, fromto, CTextBox::NO_AUTO_LINEBREAK, g_Font[SNeutrinoSettings::FONT_TYPE_EPG_DATE], CComponentsText::FONT_STYLE_REGULAR, Bottombox, CC_SHADOW_OFF, COL_MENUHEAD_TEXT); + if ((prev_id) && (!call_fromfollowlist)) + Bottombox->addCCItem(lpic); + lpic->doPaintBg(false); + lText->doPaintBg(false); + + CComponentsPictureScalable *rpic = new CComponentsPictureScalable(0,CC_CENTERED,NEUTRINO_ICON_BUTTON_RIGHT,Bottombox); + int x_pos = ox - rpic->getWidth() - OFFSET_INNER_MID; + if ((next_id) && (!call_fromfollowlist)) + Bottombox->addCCItem(rpic); + rpic->setXPos(x_pos); + CComponentsText *rText = new CComponentsText(0, CC_CENTERED, side_width, toph, epg_date, CTextBox::NO_AUTO_LINEBREAK | CTextBox::RIGHT, g_Font[SNeutrinoSettings::FONT_TYPE_EPG_DATE], CComponentsText::FONT_STYLE_REGULAR, Bottombox, CC_SHADOW_OFF, COL_MENUHEAD_TEXT); + rText->setXPos(x_pos - OFFSET_INNER_MID - rText->getWidth()); + rpic->doPaintBg(false); + rText->doPaintBg(false); + + Bottombox->paint(false); } showProgressBar(); @@ -1300,8 +1274,6 @@ int CEpgData::show(const t_channel_id channel_id, uint64_t a_id, time_t* a_start if(epgTextSwitchClear) epgTextSwitch.clear(); } - if (headerPic) - delete headerPic; return res; } @@ -1314,6 +1286,12 @@ void CEpgData::hide() g_Font[SNeutrinoSettings::FONT_TYPE_EPG_INFO2]->setSize((int)(g_Font[SNeutrinoSettings::FONT_TYPE_EPG_INFO2]->getSize() / BIGFONT_FACTOR)); } + if (header) { + header->kill(); + delete header; + header = NULL; + } + frameBuffer->paintBackgroundBoxRel(sx, sy, ox, oy); showTimerEventBar (false); } diff --git a/src/gui/epgview.h b/src/gui/epgview.h index c7ec15b80..e2dd8a573 100644 --- a/src/gui/epgview.h +++ b/src/gui/epgview.h @@ -50,7 +50,7 @@ class CEpgData CChannelEventList evtlist; CChannelEventList followlist; CEPGData epgData; - CComponentsShapeSquare* header; + CComponentsHeader* header; std::string epg_date; std::string epg_start; std::string epg_end; diff --git a/src/gui/eventlist.cpp b/src/gui/eventlist.cpp index 2c1a859d7..d1150a017 100644 --- a/src/gui/eventlist.cpp +++ b/src/gui/eventlist.cpp @@ -291,8 +291,10 @@ int CEventList::exec(const t_channel_id channel_id, const std::string& channelna fwidth1 = g_Font[SNeutrinoSettings::FONT_TYPE_EVENTLIST_DATETIME]->getRenderWidth("DDD, :, ") + 4 * g_Font[SNeutrinoSettings::FONT_TYPE_EVENTLIST_DATETIME]->getMaxDigitWidth(); //fwidth2 = g_Font[SNeutrinoSettings::FONT_TYPE_EVENTLIST_ITEMSMALL]->getRenderWidth("[ ] ") + 3 * g_Font[SNeutrinoSettings::FONT_TYPE_EVENTLIST_ITEMSMALL]->getMaxDigitWidth() + g_Font[SNeutrinoSettings::FONT_TYPE_EVENTLIST_ITEMSMALL]->getRenderWidth(unit_short_minute); - listmaxshow = (height-theight-iheight-0)/fheight; - height = theight+iheight+0+listmaxshow*fheight; // recalc height + botboxheight = fheight1+2*OFFSET_INNER_MIN; + + listmaxshow = (height-theight-iheight-botboxheight-0)/fheight; + height = theight+iheight+botboxheight+0+listmaxshow*fheight; // recalc height y = getScreenStartY(height); // calculate width of right info_zone @@ -804,6 +806,9 @@ void CEventList::paintItem(unsigned int pos, t_channel_id channel_idI) // paint 2nd line text g_Font[SNeutrinoSettings::FONT_TYPE_EVENTLIST_ITEMLARGE]->RenderString(x + iw + OFFSET_INNER_MID, ypos + fheight, width - iw - 2*OFFSET_INNER_MID, evtlist[currpos].description, color); + + if (i_radius) + showProgressBar(currpos); } } @@ -847,57 +852,90 @@ void CEventList::paintDescription(int index) void CEventList::paintHead(t_channel_id _channel_id, std::string _channelname, std::string _channelname_prev, std::string _channelname_next) { - int font_mid = SNeutrinoSettings::FONT_TYPE_EVENTLIST_TITLE; - int font_lr = SNeutrinoSettings::FONT_TYPE_EVENTLIST_ITEMLARGE; + if (header) { + header->kill(); + delete header; + header = NULL; + } - if (!header) - header = new CComponentsFrmChain(); + header = new CComponentsHeader(); header->setDimensionsAll(x, y, full_width, theight); header->enableColBodyGradient(g_settings.theme.menu_Head_gradient, COL_MENUCONTENT_PLUS_0, g_settings.theme.menu_Head_gradient_direction); header->setCorner(RADIUS_LARGE, CORNER_TOP); - header->clear(); + header->enableClock(true, "%H:%M", "%H.%M", true); + header->getClockObject()->setCorner(RADIUS_LARGE, CORNER_TOP_RIGHT); + + header->getChannelLogoObject()->hide(); + header->setChannelLogo(_channel_id,_channelname); + header->setCaption(_channelname,CTextBox::CENTER); + + header->paint(CC_SAVE_SCREEN_NO); + paintBottomBox(_channelname_prev, _channelname_next); +} + +void CEventList::paintBottomBox(std::string _channelname_prev, std::string _channelname_next) +{ + int by = y + height - iheight - botboxheight; + int font_lr = SNeutrinoSettings::FONT_TYPE_EVENTLIST_ITEMLARGE; int x_off = OFFSET_INNER_MID; int mid_width = full_width * 40 / 100; // 40% - int max_height = theight - 2*OFFSET_INNER_MIN; int side_width = ((full_width - mid_width) / 2) - (2 * x_off); - //create an logo object - CComponentsChannelLogoScalable* midLogo = new CComponentsChannelLogoScalable(0, 0, _channelname, _channel_id, header); - if (midLogo->hasLogo()) - { - midLogo->setWidth(min(midLogo->getWidth(), mid_width), true); - if (midLogo->getHeight() > max_height) - midLogo->setHeight(max_height, true); - - midLogo->setPos(CC_CENTERED, CC_CENTERED); - - // recalc widths - side_width = ((full_width - midLogo->getWidth()) / 2) - (4 * x_off); - } - else { - header->removeCCItem(midLogo); //remove/destroy logo object, if it is not available - int w_midText = g_Font[font_mid]->getRenderWidth(_channelname); - CComponentsText *midText = new CComponentsText(0, CC_CENTERED, w_midText, theight, _channelname, CTextBox::CENTER, g_Font[font_mid], CComponentsText::FONT_STYLE_REGULAR, header, CC_SHADOW_OFF, COL_MENUHEAD_TEXT); - midText->setXPos(full_width/2 - midText->getWidth()/2); - midText->doPaintBg(false); - } + CComponentsFrmChain *Bottombox = new CComponentsFrmChain(x, by, full_width, botboxheight); + Bottombox->setColorBody(COL_MENUHEAD_PLUS_0); if (!_channelname_prev.empty()) { - CComponentsText *lText = new CComponentsText(x_off, CC_CENTERED, side_width, theight, _channelname_prev, CTextBox::NO_AUTO_LINEBREAK, g_Font[font_lr], CComponentsText::FONT_STYLE_REGULAR, header, CC_SHADOW_OFF, COL_MENUHEAD_TEXT); + CComponentsPictureScalable *lpic = new CComponentsPictureScalable(x_off,CC_CENTERED,NEUTRINO_ICON_BUTTON_LEFT,Bottombox); + CComponentsText *lText = new CComponentsText(x_off + lpic->getWidth() + OFFSET_INNER_MID, CC_CENTERED, side_width, theight, _channelname_prev, CTextBox::NO_AUTO_LINEBREAK, g_Font[font_lr], CComponentsText::FONT_STYLE_REGULAR, Bottombox, CC_SHADOW_OFF, COL_MENUHEAD_TEXT); + lpic->doPaintBg(false); lText->doPaintBg(false); } if (!_channelname_next.empty()) { - int x_pos = full_width - side_width - x_off; - CComponentsText *rText = new CComponentsText(x_pos, CC_CENTERED, side_width, theight, _channelname_next, CTextBox::NO_AUTO_LINEBREAK | CTextBox::RIGHT, g_Font[font_lr], CComponentsText::FONT_STYLE_REGULAR, header, CC_SHADOW_OFF, COL_MENUHEAD_TEXT); + CComponentsPictureScalable *rpic = new CComponentsPictureScalable(0,CC_CENTERED,NEUTRINO_ICON_BUTTON_RIGHT,Bottombox); + int x_pos = full_width - rpic->getWidth() - OFFSET_INNER_MID; + rpic->setXPos(x_pos); + CComponentsText *rText = new CComponentsText(0, CC_CENTERED, side_width, theight, _channelname_next, CTextBox::NO_AUTO_LINEBREAK | CTextBox::RIGHT, g_Font[font_lr], CComponentsText::FONT_STYLE_REGULAR, Bottombox, CC_SHADOW_OFF, COL_MENUHEAD_TEXT); + rText->setXPos(x_pos - OFFSET_INNER_MID - rText->getWidth()); + rpic->doPaintBg(false); rText->doPaintBg(false); } - if (header->isPainted()) //clean up background of header for new captions - header->kill(header->getColorBody()); - header->paint(CC_SAVE_SCREEN_NO); + Bottombox->paint(false); +} + +void CEventList::showProgressBar(int pos) +{ + int epg_done= -1; + if ((( time(NULL)- evtlist[pos].startTime )>= 0 ) && (evtlist[pos].duration > 0)) + { + unsigned nProcentagePassed = ((time(NULL) - evtlist[pos].startTime) * 100 / evtlist[pos].duration); + if (nProcentagePassed<= 100) + epg_done= nProcentagePassed; + } + + int pbw = 104; + int pbx = x + (full_width - pbw)/2; + int pbh = botboxheight - 12; + int pby = y + height -iheight - botboxheight + (botboxheight - pbh)/2; + + //show progressbar + if (epg_done != -1) + { + CProgressBar pb(pbx, pby, pbw, pbh); + pb.setType(CProgressBar::PB_TIMESCALE); + pb.setValues(epg_done, 100); + pb.paint(false); + } + else + { + CComponentsShapeSquare pb(pbx, pby, pbw, pbh); + pb.setColorBody(COL_MENUHEAD_PLUS_0); + pb.paint(false); + } + } void CEventList::paint(t_channel_id channel_id) @@ -998,7 +1036,6 @@ void CEventList::showFunctionBar(t_channel_id channel_id) buttons[btn_cnt].locale = LOCALE_EPGMENU_EVENTINFO; btn_cnt++; } - ::paintButtons(bx, by, bw, btn_cnt, buttons, bw, bh); } diff --git a/src/gui/eventlist.h b/src/gui/eventlist.h index 90542ba26..512a38cf2 100644 --- a/src/gui/eventlist.h +++ b/src/gui/eventlist.h @@ -95,6 +95,7 @@ class CEventList : public CListHelpers std::string search_head_name; int full_width, width, infozone_width; + int botboxheight; int height; int x; int y; @@ -102,13 +103,15 @@ class CEventList : public CListHelpers int sort_mode; event_id_t item_event_ID; CComponentsText *cc_infozone; - CComponentsFrmChain *header; + CComponentsHeader *header; const char * unit_short_minute; 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 _channelname, std::string _channelname_prev = "", std::string _channelname_next = ""); + void paintBottomBox(std::string _channelname_prev, std::string _channelname_next); + void showProgressBar(int pos); void hide(); void showFunctionBar(t_channel_id channel_id); diff --git a/src/gui/moviebrowser/mb.cpp b/src/gui/moviebrowser/mb.cpp index 2d670805a..df586ca19 100644 --- a/src/gui/moviebrowser/mb.cpp +++ b/src/gui/moviebrowser/mb.cpp @@ -2095,6 +2095,7 @@ bool CMovieBrowser::onButtonPressMainFrame(neutrino_msg_t msg) { if (m_movieSelectionHandler != NULL) { + m_header->getClockObject()->kill(); framebuffer->paintBackground(); //clear whole screen g_EpgData->show_mp(m_movieSelectionHandler); refresh(); From b9a2458f1b98ad122707501c05eb997986136aa5 Mon Sep 17 00:00:00 2001 From: TangoCash Date: Wed, 3 May 2017 21:29:41 +0200 Subject: [PATCH 07/17] eventlist: fix clock Signed-off-by: Thilo Graf review required Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/099f83e819dca892026d10afd826928091332cd4 Author: TangoCash Date: 2017-05-03 (Wed, 03 May 2017) Origin message was: ------------------ -eventlist: fix clock Signed-off-by: Thilo Graf review required ------------------ This commit was generated by Migit --- src/gui/eventlist.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/gui/eventlist.cpp b/src/gui/eventlist.cpp index d1150a017..01e703843 100644 --- a/src/gui/eventlist.cpp +++ b/src/gui/eventlist.cpp @@ -684,6 +684,8 @@ int CEventList::exec(const t_channel_id channel_id, const std::string& channelna void CEventList::hide() { + if (header) + header->getClockObject()->kill(); frameBuffer->paintBackgroundBoxRel(x,y, full_width,height); } From b86d0a7a09218cc5bf6a311c32e58dca13e6b39f Mon Sep 17 00:00:00 2001 From: TangoCash Date: Wed, 3 May 2017 21:29:41 +0200 Subject: [PATCH 08/17] epgview: fix movieinfo Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/5b0668cc23e5ea1fc7a70468604126481062e5b9 Author: TangoCash Date: 2017-05-03 (Wed, 03 May 2017) Origin message was: ------------------ -epgview: fix movieinfo ------------------ No further description and justification available within origin commit message! ------------------ This commit was generated by Migit --- src/gui/epgview.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/gui/epgview.cpp b/src/gui/epgview.cpp index b619f3dd6..bd2120766 100644 --- a/src/gui/epgview.cpp +++ b/src/gui/epgview.cpp @@ -896,9 +896,10 @@ int CEpgData::show(const t_channel_id channel_id, uint64_t a_id, time_t* a_start rText->setXPos(x_pos - OFFSET_INNER_MID - rText->getWidth()); rpic->doPaintBg(false); rText->doPaintBg(false); - - Bottombox->paint(false); } + + Bottombox->paint(false); + showProgressBar(); // show Timer Event Buttons From bb4fd66cae0939af710c45cf48b3619450d8a599 Mon Sep 17 00:00:00 2001 From: TangoCash Date: Wed, 3 May 2017 21:29:41 +0200 Subject: [PATCH 09/17] eventlist,epgview: add infoviewer bottom gradient style Signed-off-by: Thilo Graf review required Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/54ce85c59876bd524fae066cc300a2115f859631 Author: TangoCash Date: 2017-05-03 (Wed, 03 May 2017) Origin message was: ------------------ -eventlist,epgview: add infoviewer bottom gradient style Signed-off-by: Thilo Graf review required ------------------ This commit was generated by Migit --- src/gui/epgview.cpp | 4 +++- src/gui/eventlist.cpp | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/gui/epgview.cpp b/src/gui/epgview.cpp index bd2120766..424fda032 100644 --- a/src/gui/epgview.cpp +++ b/src/gui/epgview.cpp @@ -869,7 +869,9 @@ int CEpgData::show(const t_channel_id channel_id, uint64_t a_id, time_t* a_start // small bottom box CComponentsFrmChain *Bottombox = new CComponentsFrmChain(sx, sy+oy-botboxheight, ox, botboxheight); - Bottombox->setColorBody(COL_MENUHEAD_PLUS_0); + Bottombox->setColorBody(COL_MENUFOOT_PLUS_0); + Bottombox->enableColBodyGradient(g_settings.theme.infobar_gradient_bottom,COL_MENUFOOT_PLUS_0,g_settings.theme.infobar_gradient_bottom_direction); + Bottombox->set2ndColor(COL_MENUCONTENT_PLUS_0); if (!mp_info) { diff --git a/src/gui/eventlist.cpp b/src/gui/eventlist.cpp index 01e703843..975615f7c 100644 --- a/src/gui/eventlist.cpp +++ b/src/gui/eventlist.cpp @@ -886,7 +886,9 @@ void CEventList::paintBottomBox(std::string _channelname_prev, std::string _chan int side_width = ((full_width - mid_width) / 2) - (2 * x_off); CComponentsFrmChain *Bottombox = new CComponentsFrmChain(x, by, full_width, botboxheight); - Bottombox->setColorBody(COL_MENUHEAD_PLUS_0); + Bottombox->setColorBody(COL_MENUFOOT_PLUS_0); + Bottombox->enableColBodyGradient(g_settings.theme.infobar_gradient_bottom,COL_MENUFOOT_PLUS_0,g_settings.theme.infobar_gradient_bottom_direction); + Bottombox->set2ndColor(COL_MENUCONTENT_PLUS_0); if (!_channelname_prev.empty()) { CComponentsPictureScalable *lpic = new CComponentsPictureScalable(x_off,CC_CENTERED,NEUTRINO_ICON_BUTTON_LEFT,Bottombox); From 1dbd9769df6ff506a1f8119fc4223ad2d2d82798 Mon Sep 17 00:00:00 2001 From: TangoCash Date: Wed, 3 May 2017 21:29:41 +0200 Subject: [PATCH 10/17] eventlist: fix gradient background Signed-off-by: Thilo Graf review required Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/ae0810e339fbdd8c0eb3c66300fc4b76c25caf0f Author: TangoCash Date: 2017-05-03 (Wed, 03 May 2017) Origin message was: ------------------ -eventlist: fix gradient background Signed-off-by: Thilo Graf review required ------------------ This commit was generated by Migit --- src/gui/eventlist.cpp | 19 +++++++++++-------- src/gui/eventlist.h | 1 + 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/src/gui/eventlist.cpp b/src/gui/eventlist.cpp index 975615f7c..f5e573d2e 100644 --- a/src/gui/eventlist.cpp +++ b/src/gui/eventlist.cpp @@ -920,24 +920,27 @@ void CEventList::showProgressBar(int pos) epg_done= nProcentagePassed; } + if (!pb) + { int pbw = 104; int pbx = x + (full_width - pbw)/2; int pbh = botboxheight - 12; int pby = y + height -iheight - botboxheight + (botboxheight - pbh)/2; + pb = new CProgressBar(pbx, pby, pbw, pbh); + pb->setType(CProgressBar::PB_TIMESCALE); + pb->doPaintBg(false); + } + //show progressbar - if (epg_done != -1) + if (epg_done > 0) { - CProgressBar pb(pbx, pby, pbw, pbh); - pb.setType(CProgressBar::PB_TIMESCALE); - pb.setValues(epg_done, 100); - pb.paint(false); + pb->setValues(epg_done, 100); + pb->paint(true); } else { - CComponentsShapeSquare pb(pbx, pby, pbw, pbh); - pb.setColorBody(COL_MENUHEAD_PLUS_0); - pb.paint(false); + pb->hide(); } } diff --git a/src/gui/eventlist.h b/src/gui/eventlist.h index 512a38cf2..10d255f73 100644 --- a/src/gui/eventlist.h +++ b/src/gui/eventlist.h @@ -104,6 +104,7 @@ class CEventList : public CListHelpers event_id_t item_event_ID; CComponentsText *cc_infozone; CComponentsHeader *header; + CProgressBar *pb; const char * unit_short_minute; void paintItem(unsigned pos, t_channel_id channel_id = 0); From 93ef2ac356d9d65b15642315a03f7a7fbeec8d73 Mon Sep 17 00:00:00 2001 From: TangoCash Date: Wed, 3 May 2017 21:29:41 +0200 Subject: [PATCH 11/17] eventlist: fix segfault Signed-off-by: Thilo Graf review required Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/08c48016980b637bf5e277b2da2d8f85d4f513f2 Author: TangoCash Date: 2017-05-03 (Wed, 03 May 2017) Origin message was: ------------------ -eventlist: fix segfault Signed-off-by: Thilo Graf review required ------------------ This commit was generated by Migit --- src/gui/eventlist.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/gui/eventlist.cpp b/src/gui/eventlist.cpp index f5e573d2e..c08d78183 100644 --- a/src/gui/eventlist.cpp +++ b/src/gui/eventlist.cpp @@ -120,12 +120,15 @@ CEventList::CEventList() oldEventID = -1; bgRightBoxPaint = false; header = NULL; + pb = NULL; } CEventList::~CEventList() { delete header; header = NULL; + delete pb; + pb = NULL; } void CEventList::UpdateTimerList(void) From 5dc6e6375f78093114ea08fae908d749325bdddf Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Wed, 3 May 2017 21:29:41 +0200 Subject: [PATCH 12/17] CEpgData: optimize handling of header and bottom box Working with existant instances and reduce flicker effects. Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/fc805049d31a1402696e3111eec883f17f2eb838 Author: Thilo Graf Date: 2017-05-03 (Wed, 03 May 2017) ------------------ This commit was generated by Migit --- src/gui/epgview.cpp | 164 ++++++++++++++++++++++++++++---------------- src/gui/epgview.h | 7 +- 2 files changed, 111 insertions(+), 60 deletions(-) diff --git a/src/gui/epgview.cpp b/src/gui/epgview.cpp index 424fda032..cde35d13c 100644 --- a/src/gui/epgview.cpp +++ b/src/gui/epgview.cpp @@ -121,17 +121,22 @@ void reformatExtendedEvents(std::string strItem, std::string strLabel, bool bUse CEpgData::CEpgData() { - bigFonts = false; - frameBuffer = CFrameBuffer::getInstance(); - tmdb_active = false; - mp_movie_info = NULL; - header = NULL; + bigFonts = false; + frameBuffer = CFrameBuffer::getInstance(); + tmdb_active = false; + mp_movie_info = NULL; + header = NULL; + Bottombox = NULL; + lpic = NULL; + rpic = NULL; + lText = NULL; + rText = NULL; + pb = NULL; } CEpgData::~CEpgData() { - delete header; - header = NULL; + ResetModules(); } void CEpgData::start() @@ -841,40 +846,39 @@ int CEpgData::show(const t_channel_id channel_id, uint64_t a_id, time_t* a_start // show the epg // header + logo - if (header) { - header->kill(); - delete header; - header = NULL; - } - - header = new CComponentsHeader(sx, sy, ox, toph); - header->setCorner(RADIUS_LARGE, CORNER_TOP); - header->setDimensionsAll(sx, sy, ox, toph); - header->setColorBody(COL_MENUHEAD_PLUS_0); - header->enableColBodyGradient(g_settings.theme.menu_Head_gradient, COL_MENUCONTENT_PLUS_0, g_settings.theme.menu_Head_gradient_direction); - - header->enableClock(true, "%H:%M", "%H.%M", true); - header->getClockObject()->setCorner(RADIUS_LARGE, CORNER_TOP_RIGHT); - - header->getChannelLogoObject()->hide(); - header->setChannelLogo(channel_id, channel_name); + if (!header){ + header = new CComponentsHeader(sx, sy, ox, toph); + header->setColorBody(COL_MENUHEAD_PLUS_0); + header->enableColBodyGradient(g_settings.theme.menu_Head_gradient, COL_MENUCONTENT_PLUS_0, g_settings.theme.menu_Head_gradient_direction); + header->enableClock(true, "%H:%M", "%H %M", true); + }else + header->setDimensionsAll(sx, sy, ox, toph); header->setCaption(epgData.title); + if (header->isPainted()) + header->hideCCItems(); + + // set channel logo + header->setChannelLogo(channel_id, channel_name); + + //paint head header->paint(CC_SAVE_SCREEN_NO); int showPos = 0; textCount = epgText.size(); showText(showPos, sy + toph); - // small bottom box - CComponentsFrmChain *Bottombox = new CComponentsFrmChain(sx, sy+oy-botboxheight, ox, botboxheight); - Bottombox->setColorBody(COL_MENUFOOT_PLUS_0); - Bottombox->enableColBodyGradient(g_settings.theme.infobar_gradient_bottom,COL_MENUFOOT_PLUS_0,g_settings.theme.infobar_gradient_bottom_direction); - Bottombox->set2ndColor(COL_MENUCONTENT_PLUS_0); + // small bottom box with left/right navigation + if (!Bottombox){ + Bottombox = new CComponentsFrmChain(sx, sy+oy-botboxheight, ox, botboxheight); + Bottombox->setColorBody(COL_MENUFOOT_PLUS_0); + Bottombox->setCornerType(CORNER_NONE); + Bottombox->enableColBodyGradient(g_settings.theme.infobar_gradient_bottom,COL_MENUFOOT_PLUS_0,g_settings.theme.infobar_gradient_bottom_direction); + Bottombox->set2ndColor(COL_MENUCONTENT_PLUS_0); + } - if (!mp_info) - { + if (!mp_info){ std::string fromto = epg_start + " - " + epg_end; int x_off = OFFSET_INNER_MID; int mid_width = ox * 40 / 100; // 40% @@ -882,26 +886,52 @@ int CEpgData::show(const t_channel_id channel_id, uint64_t a_id, time_t* a_start GetPrevNextEPGData(epgData.eventID, &epgData.epg_times.startzeit); - CComponentsPictureScalable *lpic = new CComponentsPictureScalable(x_off,CC_CENTERED,NEUTRINO_ICON_BUTTON_LEFT); - CComponentsText *lText = new CComponentsText(x_off + lpic->getWidth() + OFFSET_INNER_MID, CC_CENTERED, side_width, toph, fromto, CTextBox::NO_AUTO_LINEBREAK, g_Font[SNeutrinoSettings::FONT_TYPE_EPG_DATE], CComponentsText::FONT_STYLE_REGULAR, Bottombox, CC_SHADOW_OFF, COL_MENUHEAD_TEXT); - if ((prev_id) && (!call_fromfollowlist)) + // init left arrow + if (!lpic){ + lpic = new CComponentsPictureScalable(x_off,CC_CENTERED,NEUTRINO_ICON_BUTTON_LEFT); + lpic->doPaintBg(false); Bottombox->addCCItem(lpic); - lpic->doPaintBg(false); - lText->doPaintBg(false); + lpic->enableSaveBg(); + } + lpic->allowPaint(prev_id && !call_fromfollowlist); - CComponentsPictureScalable *rpic = new CComponentsPictureScalable(0,CC_CENTERED,NEUTRINO_ICON_BUTTON_RIGHT,Bottombox); - int x_pos = ox - rpic->getWidth() - OFFSET_INNER_MID; - if ((next_id) && (!call_fromfollowlist)) + // init right arrow + if (!rpic){ + rpic = new CComponentsPictureScalable(0,CC_CENTERED,NEUTRINO_ICON_BUTTON_RIGHT); + + rpic->doPaintBg(false); Bottombox->addCCItem(rpic); - rpic->setXPos(x_pos); - CComponentsText *rText = new CComponentsText(0, CC_CENTERED, side_width, toph, epg_date, CTextBox::NO_AUTO_LINEBREAK | CTextBox::RIGHT, g_Font[SNeutrinoSettings::FONT_TYPE_EPG_DATE], CComponentsText::FONT_STYLE_REGULAR, Bottombox, CC_SHADOW_OFF, COL_MENUHEAD_TEXT); - rText->setXPos(x_pos - OFFSET_INNER_MID - rText->getWidth()); - rpic->doPaintBg(false); - rText->doPaintBg(false); + rpic->enableSaveBg(); + int x_pos = ox - rpic->getWidth() - x_off; + rpic->setXPos(x_pos); + } + rpic->allowPaint(next_id && !call_fromfollowlist); + + // init text left "from to" + if (!lText){ + lText = new CComponentsText(x_off + lpic->getWidth() + x_off, CC_CENTERED, side_width, toph, "", CTextBox::NO_AUTO_LINEBREAK, g_Font[SNeutrinoSettings::FONT_TYPE_EPG_DATE], CComponentsText::FONT_STYLE_REGULAR, NULL, CC_SHADOW_OFF, COL_MENUHEAD_TEXT); + lText->doPaintBg(false); + Bottombox->addCCItem(lText); + lText->enableSaveBg(); + } + lText->setText(fromto, CTextBox::NO_AUTO_LINEBREAK, g_Font[SNeutrinoSettings::FONT_TYPE_EPG_DATE], COL_MENUHEAD_TEXT, CComponentsText::FONT_STYLE_REGULAR); + + // init text right "follow" + if (!rText){ + rText = new CComponentsText(0, CC_CENTERED, side_width, toph, "", CTextBox::NO_AUTO_LINEBREAK | CTextBox::RIGHT, g_Font[SNeutrinoSettings::FONT_TYPE_EPG_DATE], CComponentsText::FONT_STYLE_REGULAR, Bottombox, CC_SHADOW_OFF, COL_MENUHEAD_TEXT); + rText->doPaintBg(false); + rText->enableSaveBg(); + } + rText->setText(epg_date, CTextBox::NO_AUTO_LINEBREAK | CTextBox::RIGHT, g_Font[SNeutrinoSettings::FONT_TYPE_EPG_DATE]); + rText->setXPos(rpic->getXPos() - x_off - rText->getWidth()); } - Bottombox->paint(false); + //ensure clean background + if(Bottombox->isPainted()) + Bottombox->hideCCItems(); + //paint bottombox contents + Bottombox->paint(false); showProgressBar(); // show Timer Event Buttons @@ -1214,6 +1244,7 @@ int CEpgData::show(const t_channel_id channel_id, uint64_t a_id, time_t* a_start } case CRCInput::RC_help: bigFonts = bigFonts ? false : true; + ResetModules(); frameBuffer->paintBackgroundBoxRel(sx, sy, ox, oy); showTimerEventBar (false); start(); @@ -1289,11 +1320,7 @@ void CEpgData::hide() g_Font[SNeutrinoSettings::FONT_TYPE_EPG_INFO2]->setSize((int)(g_Font[SNeutrinoSettings::FONT_TYPE_EPG_INFO2]->getSize() / BIGFONT_FACTOR)); } - if (header) { - header->kill(); - delete header; - header = NULL; - } + ResetModules(); frameBuffer->paintBackgroundBoxRel(sx, sy, ox, oy); showTimerEventBar (false); @@ -1437,18 +1464,21 @@ int CEpgData::FollowScreenings (const t_channel_id /*channel_id*/, const std::st void CEpgData::showProgressBar() { + int w = 104; + int x = sx + (ox - w)/2; + int h = botboxheight - 12; + int y = sy + oy - botboxheight + (botboxheight - h)/2; + if (!pb){ + pb = new CProgressBar(x, y, w, h); + pb->setType(CProgressBar::PB_TIMESCALE); + } //show progressbar if (epg_done != -1) { - int w = 104; - int x = sx + (ox - w)/2; - int h = botboxheight - 12; - int y = sy + oy - botboxheight + (botboxheight - h)/2; - - CProgressBar pb(x, y, w, h); - pb.setType(CProgressBar::PB_TIMESCALE); - pb.setValues(epg_done, 100); - pb.paint(false); + pb->setValues(epg_done, 100); + pb->paint(true); + }else{ + pb->hide(); } } @@ -1523,6 +1553,22 @@ void CEpgData::showTimerEventBar (bool pshow, bool adzap, bool mp_info) } } +void CEpgData::ResetModules() +{ + if (header){ + delete header; header = NULL; + } + if (Bottombox){ + delete Bottombox; Bottombox = NULL; + // bottom box items are destroyed but explicit reset of bottom box items here required + lpic = rpic = NULL; + lText = rText = NULL; + } + if (pb){ + delete pb; pb = NULL; + } +} + // -- EPG Data Viewer Menu Handler Class // -- to be used for calls from Menue // -- (2004-03-06 rasc) diff --git a/src/gui/epgview.h b/src/gui/epgview.h index e2dd8a573..5db5cfa12 100644 --- a/src/gui/epgview.h +++ b/src/gui/epgview.h @@ -50,7 +50,11 @@ class CEpgData CChannelEventList evtlist; CChannelEventList followlist; CEPGData epgData; - CComponentsHeader* header; + CComponentsHeader *header; + CComponentsFrmChain *Bottombox; + CComponentsPictureScalable *lpic, *rpic; + CComponentsText *lText, *rText; + CProgressBar *pb; std::string epg_date; std::string epg_start; std::string epg_end; @@ -100,6 +104,7 @@ class CEpgData int show(const t_channel_id channel_id, uint64_t id = 0, time_t* startzeit = NULL, bool doLoop = true, bool callFromfollowlist = false, bool mp_info = false ); int show_mp(MI_MOVIE_INFO *mi, int mp_position = 0, int mp_duration = 0, bool doLoop = true); void hide(); + void ResetModules(); }; From 981af1f699f72b29a47e58650cdffd5c4e175abb Mon Sep 17 00:00:00 2001 From: TangoCash Date: Wed, 3 May 2017 21:29:41 +0200 Subject: [PATCH 13/17] eventlist,epgview: reduce header flickering picked from: https://github.com/TangoCash/neutrino-mp-cst-next commit: df6862963a9b29a4d0955b01a22e1061c312b17f Signed-off-by: Thilo Graf review reqiured Conflicts: src/gui/epgview.cpp Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/e98564c8e977b9e7ceb3d8f1bc0e45933d17fc25 Author: TangoCash Date: 2017-05-03 (Wed, 03 May 2017) Origin message was: ------------------ -eventlist,epgview: reduce header flickering picked from: https://github.com/TangoCash/neutrino-mp-cst-next commit: df6862963a9b29a4d0955b01a22e1061c312b17f Signed-off-by: Thilo Graf review reqiured Conflicts: src/gui/epgview.cpp ------------------ This commit was generated by Migit --- src/gui/eventlist.cpp | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/gui/eventlist.cpp b/src/gui/eventlist.cpp index c08d78183..4a429799b 100644 --- a/src/gui/eventlist.cpp +++ b/src/gui/eventlist.cpp @@ -857,14 +857,11 @@ void CEventList::paintDescription(int index) void CEventList::paintHead(t_channel_id _channel_id, std::string _channelname, std::string _channelname_prev, std::string _channelname_next) { - if (header) { - header->kill(); - delete header; - header = NULL; + if (header == NULL){ + header = new CComponentsHeader(); + header->getTextObject()->enableTboxSaveScreen(g_settings.theme.menu_Head_gradient);//enable screen save for title text if color gradient is in use } - header = new CComponentsHeader(); - header->setDimensionsAll(x, y, full_width, theight); header->enableColBodyGradient(g_settings.theme.menu_Head_gradient, COL_MENUCONTENT_PLUS_0, g_settings.theme.menu_Head_gradient_direction); header->setCorner(RADIUS_LARGE, CORNER_TOP); From ef15f83fb199c4a0afaa80ab68777506bcfccf36 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Wed, 3 May 2017 21:29:41 +0200 Subject: [PATCH 14/17] CEventList: optimize handling of header and bottom box Mainly to reduce flicker effects on right/left scroll. Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/43fda8bc11e58dd78ea0e4c10cd25455dfff5fe0 Author: Thilo Graf Date: 2017-05-03 (Wed, 03 May 2017) ------------------ This commit was generated by Migit --- src/gui/eventlist.cpp | 61 +++++++++++++++++++++++++++++-------------- src/gui/eventlist.h | 2 ++ 2 files changed, 43 insertions(+), 20 deletions(-) diff --git a/src/gui/eventlist.cpp b/src/gui/eventlist.cpp index 4a429799b..ebb8d5e8f 100644 --- a/src/gui/eventlist.cpp +++ b/src/gui/eventlist.cpp @@ -121,14 +121,25 @@ CEventList::CEventList() bgRightBoxPaint = false; header = NULL; pb = NULL; + Bottombox = NULL; } CEventList::~CEventList() { - delete header; - header = NULL; - delete pb; - pb = NULL; + ResetModules(); +} + +void CEventList::ResetModules() +{ + if (header){ + delete header; header = NULL; + } + if (Bottombox){ + delete Bottombox; Bottombox = NULL; + } + if (pb){ + delete pb; pb = NULL; + } } void CEventList::UpdateTimerList(void) @@ -687,8 +698,7 @@ int CEventList::exec(const t_channel_id channel_id, const std::string& channelna void CEventList::hide() { - if (header) - header->getClockObject()->kill(); + ResetModules(); frameBuffer->paintBackgroundBoxRel(x,y, full_width,height); } @@ -860,20 +870,19 @@ void CEventList::paintHead(t_channel_id _channel_id, std::string _channelname, s if (header == NULL){ header = new CComponentsHeader(); header->getTextObject()->enableTboxSaveScreen(g_settings.theme.menu_Head_gradient);//enable screen save for title text if color gradient is in use + header->enableClock(true, "%H:%M", "%H %M", true); + header->enableColBodyGradient(g_settings.theme.menu_Head_gradient, COL_MENUCONTENT_PLUS_0, g_settings.theme.menu_Head_gradient_direction); + header->setDimensionsAll(x, y, full_width, theight); } + //header->getClockObject()->setCorner(RADIUS_LARGE, CORNER_TOP_RIGHT); - header->setDimensionsAll(x, y, full_width, theight); - header->enableColBodyGradient(g_settings.theme.menu_Head_gradient, COL_MENUCONTENT_PLUS_0, g_settings.theme.menu_Head_gradient_direction); - header->setCorner(RADIUS_LARGE, CORNER_TOP); - - header->enableClock(true, "%H:%M", "%H.%M", true); - header->getClockObject()->setCorner(RADIUS_LARGE, CORNER_TOP_RIGHT); - - header->getChannelLogoObject()->hide(); + if (header->isPainted()) + header->getChannelLogoObject()->hide(); header->setChannelLogo(_channel_id,_channelname); header->setCaption(_channelname,CTextBox::CENTER); header->paint(CC_SAVE_SCREEN_NO); + paintBottomBox(_channelname_prev, _channelname_next); } @@ -885,26 +894,38 @@ void CEventList::paintBottomBox(std::string _channelname_prev, std::string _chan int mid_width = full_width * 40 / 100; // 40% int side_width = ((full_width - mid_width) / 2) - (2 * x_off); - CComponentsFrmChain *Bottombox = new CComponentsFrmChain(x, by, full_width, botboxheight); - Bottombox->setColorBody(COL_MENUFOOT_PLUS_0); - Bottombox->enableColBodyGradient(g_settings.theme.infobar_gradient_bottom,COL_MENUFOOT_PLUS_0,g_settings.theme.infobar_gradient_bottom_direction); - Bottombox->set2ndColor(COL_MENUCONTENT_PLUS_0); + if (!Bottombox){ + Bottombox = new CComponentsFrmChain(x, by, full_width, botboxheight); + Bottombox->setColorBody(COL_MENUFOOT_PLUS_0); + Bottombox->enableColBodyGradient(g_settings.theme.infobar_gradient_bottom,COL_MENUFOOT_PLUS_0,g_settings.theme.infobar_gradient_bottom_direction); + Bottombox->set2ndColor(COL_MENUCONTENT_PLUS_0); + }else{ + if (Bottombox->isPainted()) + Bottombox->hideCCItems(); + Bottombox->clear(); + } if (!_channelname_prev.empty()) { CComponentsPictureScalable *lpic = new CComponentsPictureScalable(x_off,CC_CENTERED,NEUTRINO_ICON_BUTTON_LEFT,Bottombox); - CComponentsText *lText = new CComponentsText(x_off + lpic->getWidth() + OFFSET_INNER_MID, CC_CENTERED, side_width, theight, _channelname_prev, CTextBox::NO_AUTO_LINEBREAK, g_Font[font_lr], CComponentsText::FONT_STYLE_REGULAR, Bottombox, CC_SHADOW_OFF, COL_MENUHEAD_TEXT); lpic->doPaintBg(false); + lpic->enableSaveBg(); + + CComponentsText *lText = new CComponentsText(x_off + lpic->getWidth() + OFFSET_INNER_MID, CC_CENTERED, side_width, theight, _channelname_prev, CTextBox::NO_AUTO_LINEBREAK, g_Font[font_lr], CComponentsText::FONT_STYLE_REGULAR, Bottombox, CC_SHADOW_OFF, COL_MENUHEAD_TEXT); lText->doPaintBg(false); + lText->enableSaveBg(); } if (!_channelname_next.empty()) { CComponentsPictureScalable *rpic = new CComponentsPictureScalable(0,CC_CENTERED,NEUTRINO_ICON_BUTTON_RIGHT,Bottombox); int x_pos = full_width - rpic->getWidth() - OFFSET_INNER_MID; + rpic->doPaintBg(false); rpic->setXPos(x_pos); + rpic->enableSaveBg(); + CComponentsText *rText = new CComponentsText(0, CC_CENTERED, side_width, theight, _channelname_next, CTextBox::NO_AUTO_LINEBREAK | CTextBox::RIGHT, g_Font[font_lr], CComponentsText::FONT_STYLE_REGULAR, Bottombox, CC_SHADOW_OFF, COL_MENUHEAD_TEXT); rText->setXPos(x_pos - OFFSET_INNER_MID - rText->getWidth()); - rpic->doPaintBg(false); rText->doPaintBg(false); + rText->enableSaveBg(); } Bottombox->paint(false); diff --git a/src/gui/eventlist.h b/src/gui/eventlist.h index 10d255f73..8b81aefb5 100644 --- a/src/gui/eventlist.h +++ b/src/gui/eventlist.h @@ -105,6 +105,7 @@ class CEventList : public CListHelpers CComponentsText *cc_infozone; CComponentsHeader *header; CProgressBar *pb; + CComponentsFrmChain *Bottombox; const char * unit_short_minute; void paintItem(unsigned pos, t_channel_id channel_id = 0); @@ -127,6 +128,7 @@ class CEventList : public CListHelpers CEventList(); ~CEventList(); int exec(const t_channel_id channel_id, const std::string& channelname, const std::string& prev = "", const std::string& next = "", const CChannelEventList &followlist = CChannelEventList ()); // UTF-8 + void ResetModules(); }; class CEventListHandler : public CMenuTarget From ff1c39231f93ff2d87991d769a35aa8f0707f658 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Wed, 3 May 2017 21:29:41 +0200 Subject: [PATCH 15/17] Revert "-cc_form_header: add max caption width" This reverts commit 90226e9a46acb318041062c10a3813e27e099713. Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/cb02d6253d699d3105286aa2c4462aa43c24b958 Author: Thilo Graf Date: 2017-05-03 (Wed, 03 May 2017) ------------------ This commit was generated by Migit --- src/gui/components/cc_frm_header.cpp | 3 --- src/gui/components/cc_frm_header.h | 4 ---- 2 files changed, 7 deletions(-) diff --git a/src/gui/components/cc_frm_header.cpp b/src/gui/components/cc_frm_header.cpp index c633c74b9..fff49031a 100644 --- a/src/gui/components/cc_frm_header.cpp +++ b/src/gui/components/cc_frm_header.cpp @@ -144,8 +144,6 @@ void CComponentsHeader::initVarHeader( const int& x_pos, const int& y_pos, const cch_cl_sec_format = cch_cl_format; cch_cl_enable_run = false; - cch_text_max_w = width; - addContextButton(buttons); initCCItems(); initParent(parent); @@ -564,7 +562,6 @@ void CComponentsHeader::initCaption() cch_cl_obj->allowPaint(cch_cl_enable); } - cc_text_w = min(cc_text_w,cch_text_max_w); //create cch_text_obj and add to collection if (cch_text_obj == NULL){ diff --git a/src/gui/components/cc_frm_header.h b/src/gui/components/cc_frm_header.h index 16fa2ddd1..9550d1134 100644 --- a/src/gui/components/cc_frm_header.h +++ b/src/gui/components/cc_frm_header.h @@ -106,8 +106,6 @@ class CComponentsHeader : public CComponentsForm, public CCTextScreen int cch_icon_w; ///property: internal width for clock object int cch_clock_w; - ///property: internal max width for text object - int cch_text_max_w; ///property: internal x-position for caption object int cch_text_x; ///property: internal offset of context button icons within context button object @@ -193,8 +191,6 @@ class CComponentsHeader : public CComponentsForm, public CCTextScreen virtual Font* getCaptionFont(){return cch_font;} ///set text color for caption virtual void setCaptionColor(fb_pixel_t text_color){cch_col_text = text_color;} - ///set max width for caption - virtual void setCaptionMaxWidth(int max_width){cch_text_max_w = max_width;} enum { From ddf003fab00820d51da7fb7d31c60403ae31c644 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Wed, 3 May 2017 21:29:41 +0200 Subject: [PATCH 16/17] CComponentsHeader: optimize logo size/position handling Prevent oversized paint with stupid screen and/or font size settings Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/18fb99688c62d7c35a527fa14d98ae9f2330ae06 Author: Thilo Graf Date: 2017-05-03 (Wed, 03 May 2017) ------------------ This commit was generated by Migit --- src/gui/components/cc_frm_header.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/gui/components/cc_frm_header.cpp b/src/gui/components/cc_frm_header.cpp index fff49031a..f6e20c5a0 100644 --- a/src/gui/components/cc_frm_header.cpp +++ b/src/gui/components/cc_frm_header.cpp @@ -277,10 +277,13 @@ void CComponentsHeader::initLogo() int h_logo = cch_logo.dy_max == -1 ? height - 2*OFFSET_INNER_MIN : cch_logo.dy_max; if(!cch_logo_obj) - cch_logo_obj = new CComponentsChannelLogoScalable(width/2, height/2 - h_logo/2, cch_logo.Name, cch_logo.Id, this); + cch_logo_obj = new CComponentsChannelLogoScalable(1, height/2 - h_logo/2, cch_logo.Name, cch_logo.Id, this); else cch_logo_obj->setChannel(cch_logo.Id, cch_logo.Name); + // use value 1 as initial value for logo width, ensures downscale with stupid available logo space + cch_logo_obj->setHeight(1, true); + //ensure logo is not larger than original size if in auto mode if (cch_logo.dy_max == -1){ int dx_orig = 0, dy_orig = 0 ; @@ -289,6 +292,7 @@ void CComponentsHeader::initLogo() h_logo = dy_orig; } + //cch_logo_obj->setWidth(1, true); if (cch_logo_obj->hasLogo()){ cch_logo_obj->setHeight(h_logo, true); @@ -533,7 +537,7 @@ void CComponentsHeader::initCaption() cch_btn_obj->setXPos(width - buttons_w); //set required width of caption object - cc_text_w -= (buttons_w + cch_offset); + cc_text_w -= buttons_w; } //clock @@ -548,7 +552,7 @@ void CComponentsHeader::initCaption() cch_cl_obj->setXPos(width - buttons_w - clock_w); //set required width of caption object - cc_text_w -= (clock_w + cch_offset); + cc_text_w -= clock_w; //stop clock if disabled or option run is disabled and clock is running if (cch_cl_enable){ From 694dd0d5e1e1b2da04cce0e045521c435cbd9b68 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Wed, 3 May 2017 21:29:41 +0200 Subject: [PATCH 17/17] CChannelList: rework details line handling, fix hide() after setup Detailsline is handling hide() by itself. After channellist setup, eg. switching additional infos and channellist window has different size, artefacts were possible. Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/81001410f3264115d24c19be61f05838d6d0aba6 Author: Thilo Graf Date: 2017-05-03 (Wed, 03 May 2017) ------------------ This commit was generated by Migit --- src/gui/channellist.cpp | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/src/gui/channellist.cpp b/src/gui/channellist.cpp index e03acf7e8..32d70dbd8 100644 --- a/src/gui/channellist.cpp +++ b/src/gui/channellist.cpp @@ -439,8 +439,9 @@ int CChannelList::doChannelMenu(void) previous_channellist_additional = g_settings.channellist_additional; COsdSetup osd_setup; osd_setup.showContextChanlistMenu(this); - //FIXME check font/options changed ? hide(); + ResetModules(); + //FIXME check font/options changed ? calcSize(); ret = -1; } @@ -955,7 +956,11 @@ void CChannelList::hide() header->kill(); frameBuffer->paintBackgroundBoxRel(x, y, full_width, height + OFFSET_INTER + info_height); - clearItem2DetailsLine(); + + //remove details line + if (dline) + dline->kill(); + CInfoClock::getInstance()->enableInfoClock(!CInfoClock::getInstance()->isBlocked()); } @@ -1637,12 +1642,6 @@ void CChannelList::clearItem2DetailsLine() void CChannelList::paintItem2DetailsLine (int pos) { - if (dline){ - dline->kill(); //kill details line - delete dline; - dline = NULL; - } - if (!g_settings.channellist_show_infobox) return; @@ -1652,9 +1651,15 @@ void CChannelList::paintItem2DetailsLine (int pos) // paint Line if detail info (and not valid list pos) if (pos >= 0) { - if (dline == NULL) + if (!dline){ dline = new CComponentsDetailsLine(xpos, ypos1, ypos2, fheight/2, info_height-RADIUS_LARGE*2); - dline->paint(false); + }else{ + dline->setPos(xpos, ypos1); + dline->setYPosDown(ypos2); + dline->setHMarkTop(fheight/2); + dline->setHMarkDown(info_height-RADIUS_LARGE*2); + } + dline->paint(); } }