From b696007ec8d0ecb624cfbd9a31583cdc549f393e Mon Sep 17 00:00:00 2001 From: Jacek Jendrzej Date: Tue, 25 Apr 2017 16:38:47 +0200 Subject: [PATCH 1/6] fix logo position with clock --- src/gui/components/cc_frm_header.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/gui/components/cc_frm_header.cpp b/src/gui/components/cc_frm_header.cpp index 0d5207d3b..2c1d45f14 100644 --- a/src/gui/components/cc_frm_header.cpp +++ b/src/gui/components/cc_frm_header.cpp @@ -299,6 +299,7 @@ void CComponentsHeader::initLogo() //right end int x_logo_right = getCCItem(next_id) ? getCCItem(next_id)->getXPos() - cch_logo_obj->getWidth() : width - cch_logo_obj->getWidth()-OFFSET_INNER_MID; + x_logo_right -= cch_cl_enable ? cch_cl_obj->getWidth() : 0; //left end int x_logo_left = getCCItem(prev_id) ? getCCItem(prev_id)->getXPos() + getCCItem(prev_id)->getWidth() : 0; From c2bc8b4f8f3ea150e4052a12856f5296c476485c Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Wed, 26 Apr 2017 07:51:38 +0200 Subject: [PATCH 2/6] CComponentsHeader: fix logo position with clock This reverts "fix logo position with clock", commit b696007ec8d0ecb624cfbd9a31583cdc549f393e. Was not the right way. Id's are not in visual order, therefore it's better to calculate direct with the ''width"" properties of possible following items clock and context buttons. --- src/gui/components/cc_frm_header.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/gui/components/cc_frm_header.cpp b/src/gui/components/cc_frm_header.cpp index 2c1d45f14..f4f013203 100644 --- a/src/gui/components/cc_frm_header.cpp +++ b/src/gui/components/cc_frm_header.cpp @@ -294,12 +294,15 @@ void CComponentsHeader::initLogo() // set id of logo item depends of neighbor items int logo_id = getCCItemId(cch_logo_obj); - int next_id = logo_id + 1; int prev_id = logo_id - 1; //right end - int x_logo_right = getCCItem(next_id) ? getCCItem(next_id)->getXPos() - cch_logo_obj->getWidth() : width - cch_logo_obj->getWidth()-OFFSET_INNER_MID; - x_logo_right -= cch_cl_enable ? cch_cl_obj->getWidth() : 0; + int x_logo_right = width - cch_logo_obj->getWidth(); + if (cch_btn_obj) + x_logo_right -= cch_btn_obj->getWidth(); + if (cch_cl_obj) + x_logo_right -= cch_cl_obj->getWidth(); + //left end int x_logo_left = getCCItem(prev_id) ? getCCItem(prev_id)->getXPos() + getCCItem(prev_id)->getWidth() : 0; From 71606d0860b0c79ee29db1c1fcb0735ddf30b046 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Thu, 27 Apr 2017 09:27:45 +0200 Subject: [PATCH 3/6] CComponentsHeader: rectification for 'optimize auto size mode for logos' see commit: 76cd93555db7043a8442727f5f2fcba50ddde36d Additional variable was required. Values were overwritten and had no effect. --- src/gui/components/cc_frm_header.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/gui/components/cc_frm_header.cpp b/src/gui/components/cc_frm_header.cpp index f4f013203..2c1cb9e9d 100644 --- a/src/gui/components/cc_frm_header.cpp +++ b/src/gui/components/cc_frm_header.cpp @@ -274,10 +274,10 @@ void CComponentsHeader::initIcon() void CComponentsHeader::initLogo() { - cch_logo.dy_max = cch_logo.dy_max == -1 ? height - 2*OFFSET_INNER_MIN : cch_logo.dy_max; + 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 - cch_logo.dy_max/2, cch_logo.Name, cch_logo.Id, this); + cch_logo_obj = new CComponentsChannelLogoScalable(width/2, height/2 - h_logo/2, cch_logo.Name, cch_logo.Id, this); else cch_logo_obj->setChannel(cch_logo.Id, cch_logo.Name); @@ -285,12 +285,12 @@ void CComponentsHeader::initLogo() if (cch_logo.dy_max == -1){ int dx_orig = 0, dy_orig = 0 ; cch_logo_obj->getRealSize(&dx_orig, &dy_orig); - if (cch_logo.dy_max > dy_orig) - cch_logo.dy_max = dy_orig; + if (h_logo > dy_orig) + h_logo = dy_orig; } if (cch_logo_obj->hasLogo()){ - cch_logo_obj->setHeight(cch_logo.dy_max, true); + cch_logo_obj->setHeight(h_logo, true); // set id of logo item depends of neighbor items int logo_id = getCCItemId(cch_logo_obj); From 19fc8c6d3bd81cc25be26d6b5042277002be5bb0 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Thu, 27 Apr 2017 09:27:45 +0200 Subject: [PATCH 4/6] CComponentsForm: add member hideCCItems() In case of items with cached background it is useful to have possibility to restore their background. (eg. items are painted outside of form). --- src/gui/components/cc_frm.cpp | 6 ++++++ src/gui/components/cc_frm.h | 10 ++++++++++ src/gui/components/cc_frm_header.h | 2 +- 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/src/gui/components/cc_frm.cpp b/src/gui/components/cc_frm.cpp index c202c6742..bd1f4f555 100644 --- a/src/gui/components/cc_frm.cpp +++ b/src/gui/components/cc_frm.cpp @@ -532,6 +532,12 @@ void CComponentsForm::killCCItems(const fb_pixel_t& bg_color, bool ignore_parent v_cc_items[i]->kill(bg_color, ignore_parent); } +void CComponentsForm::hideCCItems() +{ + for(size_t i=0; ihide(); +} + void CComponentsForm::setPageCount(const u_int8_t& pageCount) { u_int8_t new_val = pageCount; diff --git a/src/gui/components/cc_frm.h b/src/gui/components/cc_frm.h index 3561e495a..59f488fdb 100644 --- a/src/gui/components/cc_frm.h +++ b/src/gui/components/cc_frm.h @@ -81,6 +81,16 @@ class CComponentsForm : public CComponentsItem ///NOTE: Items always have parent bindings to "this" and use the parent background color as default! Set parameter 'ignore_parent=true' to ignore parent background color! virtual void killCCItems(const fb_pixel_t& bg_color, bool ignore_parent); + /** + Removes possible contained items and finally removes + current form from screen and + restores last displayed background before form was painted. + */ + void hide(){hideCCItems(); CCDraw::hide();} + + ///restore background for all items inside form, + void hideCCItems(); + ///add an item to form collection, returns id virtual int addCCItem(CComponentsItem* cc_Item); ///add items from a vector to form collection, returns size/count of items diff --git a/src/gui/components/cc_frm_header.h b/src/gui/components/cc_frm_header.h index 320c59282..9550d1134 100644 --- a/src/gui/components/cc_frm_header.h +++ b/src/gui/components/cc_frm_header.h @@ -299,7 +299,7 @@ class CComponentsHeader : public CComponentsForm, public CCTextScreen virtual void paint(bool do_save_bg = CC_SAVE_SCREEN_YES); ///hides item, arg: no_restore see hideCCItem() - void hide(){disableClock(); CComponents::hide();} + void hide(){disableClock(); CComponentsForm::hide();} ///erase current screen without restore of background, it's similar to paintBackgroundBoxRel() from CFrameBuffer void kill(const fb_pixel_t& bg_color = COL_BACKGROUND_PLUS_0, const int& corner_radius = -1, const int& fblayer_type = CC_FBDATA_TYPES, bool disable_clock = true); From 85f4992ca8444f833dd1aec4cdf672295747f165 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Thu, 27 Apr 2017 11:24:29 +0200 Subject: [PATCH 5/6] CChannelList: don't assign logo if disabled --- src/gui/channellist.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/gui/channellist.cpp b/src/gui/channellist.cpp index edc0e8bab..d27048362 100644 --- a/src/gui/channellist.cpp +++ b/src/gui/channellist.cpp @@ -2148,6 +2148,8 @@ void CChannelList::paintHead() header->setChannelLogo((*chanlist)[selected]->getChannelID(), (*chanlist)[selected]->getName()); header->getChannelLogoObject()->allowPaint(false); } + else + header->setChannelLogo(0, string()); header->paint(CC_SAVE_SCREEN_NO); showChannelLogo(); } From 6cb58546d89a327f0c8ad464c43bcac036803329 Mon Sep 17 00:00:00 2001 From: Jacek Jendrzej Date: Thu, 27 Apr 2017 14:26:27 +0200 Subject: [PATCH 6/6] src/gui/channellist.cpp remove unused logo_off --- 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;