From a7595ce3c77140cac249e4c16030c998d61cecd4 Mon Sep 17 00:00:00 2001 From: Jacek Jendrzej Date: Thu, 27 Apr 2017 14:26:27 +0200 Subject: [PATCH 01/24] src/gui/channellist.cpp remove unused logo_off Origin commit data ------------------ Commit: https://github.com/neutrino-images/ni-neutrino/commit/6cb58546d89a327f0c8ad464c43bcac036803329 Author: Jacek Jendrzej Date: 2017-04-27 (Thu, 27 Apr 2017) --- src/gui/channellist.cpp | 4 ---- src/gui/channellist.h | 1 - 2 files changed, 5 deletions(-) diff --git a/src/gui/channellist.cpp b/src/gui/channellist.cpp index d27048362..22abc6782 100644 --- a/src/gui/channellist.cpp +++ b/src/gui/channellist.cpp @@ -123,7 +123,6 @@ CChannelList::CChannelList(const char * const pName, bool phistoryMode, bool _vl eventFont = SNeutrinoSettings::FONT_TYPE_CHANNELLIST_EVENT; dline = NULL; cc_minitv = NULL; - logo_off = 0; minitv_is_active = false; headerNew = true; bouquet = NULL; @@ -2129,7 +2128,6 @@ void CChannelList::paintHead() if (!header->getContextBtnObject()->empty()) header->removeContextButtons(); header->enableClock(true, "%H:%M", "%H %M", true); - logo_off = header->getClockObject()->getWidth() + OFFSET_INNER_MID; header->getClockObject()->setCorner(RADIUS_LARGE, CORNER_TOP_RIGHT); }else{ @@ -2139,8 +2137,6 @@ void CChannelList::paintHead() } } } - else - logo_off = OFFSET_INNER_MID; if(g_settings.channellist_show_channellogo){ //ensure to have clean background diff --git a/src/gui/channellist.h b/src/gui/channellist.h index 75ac35a63..edde1bbda 100644 --- a/src/gui/channellist.h +++ b/src/gui/channellist.h @@ -112,7 +112,6 @@ private: int info_height; // the infobox below mainbox is handled outside height int x; int y; - int logo_off; int pig_width; int pig_height; int infozone_width; From 6aa573ece2d159b231c63be8da261d1d1e02150a Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Sat, 29 Apr 2017 18:00:03 +0200 Subject: [PATCH 02/24] CComponentsFrmChain: add possibility to assign border offsets Origin commit data ------------------ Commit: https://github.com/neutrino-images/ni-neutrino/commit/3dda388c8deafde7f9e5852ebee78852ecf83a75 Author: Thilo Graf Date: 2017-04-29 (Sat, 29 Apr 2017) --- src/gui/components/cc_frm_chain.cpp | 88 +++++++++++++++++++++++++---- src/gui/components/cc_frm_chain.h | 25 +++++++- 2 files changed, 100 insertions(+), 13 deletions(-) diff --git a/src/gui/components/cc_frm_chain.cpp b/src/gui/components/cc_frm_chain.cpp index 4910e469c..b08343e46 100644 --- a/src/gui/components/cc_frm_chain.cpp +++ b/src/gui/components/cc_frm_chain.cpp @@ -27,6 +27,25 @@ using namespace std; + +/* general chain form shema + + x/y + / + +---------------------------------------width----------------------------------------+ + | chn_t_offset | + | +--------+ +--------+ +--------+ | + |chn_l_offset| item |append_x_offset| item |append_x_offset| item |chn_r_offset| + | +--------+ +--------+ +--------+ | + | append_y_offset |height + | +--------+ +--------+ +--------+ | + | | item | | item | | item | | + | +--------+ +--------+ +--------+ | + | chn_t_offset | + +------------------------------------------------------------------------------------+ +*/ + + //------------------------------------------------------------------------------------------------------- //sub class CComponentsFrmChain CComponentsFrmChain::CComponentsFrmChain( const int& x_pos, const int& y_pos, const int& w, const int& h, @@ -59,11 +78,14 @@ void CComponentsFrmChain::initVarChain( const int& x_pos, const int& y_pos, cons width = w; height = h; + chn_l_offset = chn_r_offset = 0; + chn_t_offset = chn_b_offset = 0; + shadow = shadow_mode; col_frame = color_frame; col_body = color_body; col_shadow = color_shadow; - + chn_direction = direction; if (v_items) @@ -86,23 +108,65 @@ void CComponentsFrmChain::initChainItems() return; //set new values - int w_tmp = append_x_offset; - int h_tmp = append_y_offset; + int w_tmp = 0, h_tmp = 0; + int w_item = 0, h_item = 0; + size_t i_count = v_cc_items.size(); - for (size_t i= 0; i< v_cc_items.size(); i++){ - int x_item = v_cc_items[i]->getXPos(); - int y_item = v_cc_items[i]->getYPos(); + + for (size_t i= 0; i< i_count; i++){ +// x_item = v_cc_items[i]->getXPos(); +// y_item = v_cc_items[i]->getYPos(); + w_item = v_cc_items[i]->getWidth(); + h_item = v_cc_items[i]->getHeight(); if (chn_direction & CC_DIR_X){ - w_tmp += v_cc_items[i]->getWidth(); - w_tmp += append_x_offset; - v_cc_items[i]->setPos(max(CC_APPEND, x_item), max(CC_CENTERED, y_item)); + if (i == 0){ + v_cc_items[i]->setXPos(chn_l_offset); + w_tmp += chn_l_offset; + w_tmp += w_item; + if (i_count == 1) + w_tmp += chn_r_offset; + } + + if (i_count > 1){ + if (i == i_count-1){ + w_tmp += w_item; + w_tmp += append_x_offset; + v_cc_items[i]->setXPos(w_tmp - v_cc_items[i]->getWidth()); + w_tmp += chn_r_offset; + } + } + + if (i != 0 && i != i_count-1){ + w_tmp += w_item; + w_tmp += append_x_offset; + v_cc_items[i]->setXPos(w_tmp - v_cc_items[i]->getWidth()); + } } if (chn_direction & CC_DIR_Y){ - h_tmp += v_cc_items[i]->getHeight(); - h_tmp += append_y_offset; - v_cc_items[i]->setPos(max(CC_CENTERED, x_item), max(CC_APPEND, y_item)); + if (i == 0){ + v_cc_items[i]->setYPos(chn_t_offset); + h_tmp += chn_t_offset; + h_tmp += h_item; + if (i_count == 1) + h_tmp += chn_b_offset; + } + + if (i_count > 1){ + if (i == i_count-1){ + h_tmp += h_item; + h_tmp += append_y_offset; + v_cc_items[i]->setYPos(h_tmp - v_cc_items[i]->getHeight()); + h_tmp += chn_b_offset; + } + } + + if (i != 0 && i != i_count-1){ + h_tmp += h_item; + h_tmp += append_y_offset; + v_cc_items[i]->setYPos(h_tmp - v_cc_items[i]->getHeight()); + } } } width = max (w_tmp, width); diff --git a/src/gui/components/cc_frm_chain.h b/src/gui/components/cc_frm_chain.h index a33f63ed8..560984a5e 100644 --- a/src/gui/components/cc_frm_chain.h +++ b/src/gui/components/cc_frm_chain.h @@ -55,6 +55,10 @@ class CComponentsFrmChain : public CComponentsForm fb_pixel_t& color_frame, fb_pixel_t& color_body, fb_pixel_t& color_shadow); + + int chn_l_offset, chn_r_offset; + int chn_t_offset, chn_b_offset; + protected: ///property: mode for arrangement direction of items, see also setDirection(), getDirection() int chn_direction; @@ -75,7 +79,26 @@ class CComponentsFrmChain : public CComponentsForm ///defines mode for arrangement direction of items, see also chn_direction virtual void setDirection(int direction); ///gets the mode of arrangment direction - virtual int getDirection(){return chn_direction;}; + virtual int getDirection(){return chn_direction;} + + /**Members to set border offsets + * @param[in] offset + * @li expects type int as offset value + * @return + * void + */ + void setLeftOffset(const int& offset){chn_l_offset = offset;} + void setRightOffset(const int& offset){chn_r_offset = offset;} + void setTopOffset(const int& offset){chn_t_offset = offset;} + void setBottomOffset(const int& offset){chn_b_offset = offset;} + + void setBorderOffsets(const int& left_offset, const int& right_offset, const int& top_offset, const int& bottom_offset) + { + setLeftOffset(left_offset); + setRightOffset(right_offset); + setTopOffset(top_offset); + setBottomOffset(bottom_offset); + } }; #endif From 5092893334f9b8513d3de571eb928e3b48d46c03 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Sat, 29 Apr 2017 18:00:03 +0200 Subject: [PATCH 03/24] CComponentsHeader: adjust context button offset Origin commit data ------------------ Commit: https://github.com/neutrino-images/ni-neutrino/commit/c8326af0df4ffcbd835f30a239bc7a2fea0cc547 Author: Thilo Graf Date: 2017-04-29 (Sat, 29 Apr 2017) --- src/gui/components/cc_frm_header.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/gui/components/cc_frm_header.cpp b/src/gui/components/cc_frm_header.cpp index 2c1cb9e9d..fff49031a 100644 --- a/src/gui/components/cc_frm_header.cpp +++ b/src/gui/components/cc_frm_header.cpp @@ -414,8 +414,9 @@ void CComponentsHeader::initButtons() //set button form properties if (cch_btn_obj){ cch_btn_obj->setYPos(cch_items_y); - cch_btn_obj->doPaintBg(false); + cch_btn_obj->doPaintBg(false);; cch_btn_obj->setAppendOffset(cch_buttons_space, 0); + cch_btn_obj->setRightOffset(cch_buttons_space); cch_btn_obj->removeAllIcons(); cch_btn_obj->addIcon(v_cch_btn); From 35074f95642554763e511406caf721b0e5b9acd4 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Sat, 29 Apr 2017 18:00:03 +0200 Subject: [PATCH 04/24] CTimerList: adjust date offset via format Origin commit data ------------------ Commit: https://github.com/neutrino-images/ni-neutrino/commit/b7d50b923f7f435e63002b8f1169d372279a2e91 Author: Thilo Graf Date: 2017-04-29 (Sat, 29 Apr 2017) --- src/gui/timerlist.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/timerlist.cpp b/src/gui/timerlist.cpp index fa7e7467e..3eda88907 100644 --- a/src/gui/timerlist.cpp +++ b/src/gui/timerlist.cpp @@ -1378,7 +1378,7 @@ void CTimerList::paintItem(int pos) void CTimerList::paintHead() { CComponentsHeaderLocalized header(x, y, width, theight, LOCALE_TIMERLIST_NAME, NEUTRINO_ICON_TIMER, CComponentsHeader::CC_BTN_MENU | CComponentsHeader::CC_BTN_EXIT, NULL, CC_SHADOW_ON); - header.enableClock(true, "%d.%m.%Y %H:%M"); + header.enableClock(true, " %d.%m.%Y %H:%M "); header.paint(CC_SAVE_SCREEN_NO); } From ecab7f1d37ee4f267b85adda0944d61dc6e7ab9c Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Sat, 29 Apr 2017 18:09:16 +0200 Subject: [PATCH 05/24] cc_frm_chain.cpp: fix c/p error in comment Origin commit data ------------------ Commit: https://github.com/neutrino-images/ni-neutrino/commit/891b2e9ad2f4f8023ff4234b711d7a14ae705c55 Author: Thilo Graf Date: 2017-04-29 (Sat, 29 Apr 2017) --- src/gui/components/cc_frm_chain.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/components/cc_frm_chain.cpp b/src/gui/components/cc_frm_chain.cpp index b08343e46..dcc261265 100644 --- a/src/gui/components/cc_frm_chain.cpp +++ b/src/gui/components/cc_frm_chain.cpp @@ -41,7 +41,7 @@ using namespace std; | +--------+ +--------+ +--------+ | | | item | | item | | item | | | +--------+ +--------+ +--------+ | - | chn_t_offset | + | chn_b_offset | +------------------------------------------------------------------------------------+ */ From c898ce7b870e49cabe45a295adde720330ab7f18 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Sat, 29 Apr 2017 22:46:06 +0200 Subject: [PATCH 06/24] CChannelList: Ensure new initialize of modules on palette changes while runtime. Origin commit data ------------------ Commit: https://github.com/neutrino-images/ni-neutrino/commit/1e4967e114bfa5a6a054d062cc5d245cd48219ae Author: Thilo Graf Date: 2017-04-29 (Sat, 29 Apr 2017) --- src/gui/channellist.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/gui/channellist.cpp b/src/gui/channellist.cpp index 22abc6782..e03acf7e8 100644 --- a/src/gui/channellist.cpp +++ b/src/gui/channellist.cpp @@ -132,6 +132,7 @@ CChannelList::CChannelList(const char * const pName, bool phistoryMode, bool _vl channelsChanged = false; paint_events_index = -2; + CFrameBuffer::getInstance()->OnAfterSetPallette.connect(sigc::mem_fun(this, &CChannelList::ResetModules)); } CChannelList::~CChannelList() From ab3d6bf0ea244050aa5b835395acf786ec257402 Mon Sep 17 00:00:00 2001 From: Jacek Jendrzej Date: Tue, 2 May 2017 13:08:06 +0200 Subject: [PATCH 07/24] src/gui/upnpbrowser.cpp fix segfault on connect error Origin commit data ------------------ Commit: https://github.com/neutrino-images/ni-neutrino/commit/cc0f0cd951b7be88bd0d452b3387f3288297cd16 Author: Jacek Jendrzej Date: 2017-05-02 (Tue, 02 May 2017) --- src/gui/upnpbrowser.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/upnpbrowser.cpp b/src/gui/upnpbrowser.cpp index 9b6bf89b1..7458db5f7 100644 --- a/src/gui/upnpbrowser.cpp +++ b/src/gui/upnpbrowser.cpp @@ -731,7 +731,7 @@ bool CUpnpBrowserGui::selectItem(std::string id) if (!getItems(id, liststart, entries, total)) return endall; - while (loop) { + while (loop && entries!=NULL) { updateTimes(); updateMode(); From c0528433c217e80983dacad9aa016380488c61ec Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Mon, 1 May 2017 14:59:16 +0200 Subject: [PATCH 08/24] CCDraw: add methode do get current background save mode Origin commit data ------------------ Commit: https://github.com/neutrino-images/ni-neutrino/commit/5ac5db718dd84b4594806d46ba9e6fc438452d14 Author: Thilo Graf Date: 2017-05-01 (Mon, 01 May 2017) --- 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 2c43a84e12b0885f35cc621f518b157a052cd666 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Mon, 1 May 2017 15:01:32 +0200 Subject: [PATCH 09/24] 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 ------------------ Commit: https://github.com/neutrino-images/ni-neutrino/commit/e7d60f7c08a59d7fe8c3e1f26b15b5ee3a82f4c3 Author: Thilo Graf Date: 2017-05-01 (Mon, 01 May 2017) --- 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 882b9a2c0955631ecc51edc8924146059532d674 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Tue, 2 May 2017 17:21:01 +0200 Subject: [PATCH 10/24] cc_types: add missing image types Origin commit data ------------------ Commit: https://github.com/neutrino-images/ni-neutrino/commit/30b58f49409c91399df13aa4295081de81ddac6a Author: Thilo Graf Date: 2017-05-02 (Tue, 02 May 2017) --- 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 35f39f107d1bd997c06e5052ef02db4f1575b51f Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Tue, 2 May 2017 19:54:42 +0200 Subject: [PATCH 11/24] CComponentsForm: expand debug output with address. Origin commit data ------------------ Commit: https://github.com/neutrino-images/ni-neutrino/commit/801d1beb1084d756daf0ae88d1a95de28f5551ab Author: Thilo Graf Date: 2017-05-02 (Tue, 02 May 2017) --- 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 9bbc06f3aefde0e7cf4ecfa545bf2ccf09808952 Mon Sep 17 00:00:00 2001 From: TangoCash Date: Mon, 1 May 2017 16:18:53 +0200 Subject: [PATCH 12/24] 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 ------------------ 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 --- 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 b3ecc2b65c531946fba6009c096f97f5193095c1 Mon Sep 17 00:00:00 2001 From: TangoCash Date: Wed, 3 May 2017 21:29:41 +0200 Subject: [PATCH 13/24] 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 ------------------ 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 --- 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 e8a4516c6de53ab7c9d4d6d050b6d37757979688 Mon Sep 17 00:00:00 2001 From: TangoCash Date: Wed, 3 May 2017 21:29:41 +0200 Subject: [PATCH 14/24] eventlist: fix clock Signed-off-by: Thilo Graf review required Origin commit data ------------------ 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 --- 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 9ff141a81aae6564ede2ddd7336df92514547464 Mon Sep 17 00:00:00 2001 From: TangoCash Date: Wed, 3 May 2017 21:29:41 +0200 Subject: [PATCH 15/24] epgview: fix movieinfo Origin commit data ------------------ 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 --- 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 e549dcca7aa705be2f283f9d701516aff36df28e Mon Sep 17 00:00:00 2001 From: TangoCash Date: Wed, 3 May 2017 21:29:41 +0200 Subject: [PATCH 16/24] eventlist,epgview: add infoviewer bottom gradient style Signed-off-by: Thilo Graf review required Origin commit data ------------------ 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 --- 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 5d6a052efcc98db023f7e819e40a1072f5859804 Mon Sep 17 00:00:00 2001 From: TangoCash Date: Wed, 3 May 2017 21:29:41 +0200 Subject: [PATCH 17/24] eventlist: fix gradient background Signed-off-by: Thilo Graf review required Origin commit data ------------------ 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 --- 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 c092c7642d8516bd3b64f23473c5180f7e82561b Mon Sep 17 00:00:00 2001 From: TangoCash Date: Wed, 3 May 2017 21:29:41 +0200 Subject: [PATCH 18/24] eventlist: fix segfault Signed-off-by: Thilo Graf review required Origin commit data ------------------ 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 --- 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 a0b1d9c43f5aa11a982de20d0e22e1dd798f1def Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Wed, 3 May 2017 21:29:41 +0200 Subject: [PATCH 19/24] CEpgData: optimize handling of header and bottom box Working with existant instances and reduce flicker effects. Origin commit data ------------------ Commit: https://github.com/neutrino-images/ni-neutrino/commit/fc805049d31a1402696e3111eec883f17f2eb838 Author: Thilo Graf Date: 2017-05-03 (Wed, 03 May 2017) --- 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 d9aa5d0496ed09a3a47c9b47e084e8fae5e71810 Mon Sep 17 00:00:00 2001 From: TangoCash Date: Wed, 3 May 2017 21:29:41 +0200 Subject: [PATCH 20/24] 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 ------------------ 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 --- 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 08f5820f7278ea91a9e45b64cd56e4fd5195f6dc Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Wed, 3 May 2017 21:29:41 +0200 Subject: [PATCH 21/24] CEventList: optimize handling of header and bottom box Mainly to reduce flicker effects on right/left scroll. Origin commit data ------------------ Commit: https://github.com/neutrino-images/ni-neutrino/commit/43fda8bc11e58dd78ea0e4c10cd25455dfff5fe0 Author: Thilo Graf Date: 2017-05-03 (Wed, 03 May 2017) --- 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 fd43f9e123867c3857203c3b34701906a1c284b9 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Wed, 3 May 2017 21:29:41 +0200 Subject: [PATCH 22/24] Revert "-cc_form_header: add max caption width" This reverts commit 9bbc06f3aefde0e7cf4ecfa545bf2ccf09808952. Origin commit data ------------------ Commit: https://github.com/neutrino-images/ni-neutrino/commit/cb02d6253d699d3105286aa2c4462aa43c24b958 Author: Thilo Graf Date: 2017-05-03 (Wed, 03 May 2017) --- 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 639a56b84550bca541c0dcef31e601c24a60a2c9 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Wed, 3 May 2017 21:29:41 +0200 Subject: [PATCH 23/24] CComponentsHeader: optimize logo size/position handling Prevent oversized paint with stupid screen and/or font size settings Origin commit data ------------------ Commit: https://github.com/neutrino-images/ni-neutrino/commit/18fb99688c62d7c35a527fa14d98ae9f2330ae06 Author: Thilo Graf Date: 2017-05-03 (Wed, 03 May 2017) --- 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 2eefbfab7a0ef300bbbaf7137e614b577b44e48a Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Wed, 3 May 2017 21:29:41 +0200 Subject: [PATCH 24/24] 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 ------------------ Commit: https://github.com/neutrino-images/ni-neutrino/commit/81001410f3264115d24c19be61f05838d6d0aba6 Author: Thilo Graf Date: 2017-05-03 (Wed, 03 May 2017) --- 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(); } }