From 220829ffaa7fcbff0f6810284fb48c7f9154ad25 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Mon, 24 Apr 2017 08:00:36 +0200 Subject: [PATCH 1/7] CComponentsHeader: unifiy init value for logo align --- src/gui/components/cc_frm_header.cpp | 2 +- src/gui/components/cc_frm_header.h | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/gui/components/cc_frm_header.cpp b/src/gui/components/cc_frm_header.cpp index 9161a0fe3..770c643de 100644 --- a/src/gui/components/cc_frm_header.cpp +++ b/src/gui/components/cc_frm_header.cpp @@ -128,7 +128,7 @@ void CComponentsHeader::initVarHeader( const int& x_pos, const int& y_pos, const cch_logo.Id = 0; cch_logo.Name = ""; cch_logo.dy_max = -1; - cch_logo.Align = CC_LOGO_RIGHT; + cch_logo.Align = DEFAULT_LOGO_ALIGN; cch_col_text = COL_MENUHEAD_TEXT; cch_caption_align = CTextBox::NO_AUTO_LINEBREAK; cch_items_y = CC_CENTERED; diff --git a/src/gui/components/cc_frm_header.h b/src/gui/components/cc_frm_header.h index 1a0f1c8d4..a525a3ecc 100644 --- a/src/gui/components/cc_frm_header.h +++ b/src/gui/components/cc_frm_header.h @@ -32,6 +32,8 @@ #include "cc_frm_clock.h" #include +#define DEFAULT_LOGO_ALIGN CComponentsHeader::CC_LOGO_CENTER + //! Sub class of CComponentsForm. Shows a header with prepared items. /*! CComponentsHeader provides prepared items like icon, caption and context button icons, mostly for usage in menues or simple windows @@ -320,7 +322,7 @@ class CComponentsHeader : public CComponentsForm, public CCTextScreen */ void setChannelLogo( const uint64_t& channelId, const std::string& channelName, - cc_logo_alignment_t alignment = CC_LOGO_CENTER, + cc_logo_alignment_t alignment = DEFAULT_LOGO_ALIGN, const int& dy = -1) {cch_logo.Id = channelId; cch_logo.Name = channelName, cch_logo.Align = alignment, cch_logo.dy_max = dy; initCCItems();} /**Methode to get channel logo object for direct access to its properties and methodes From 7b19ea1fd1a9ff689c8c42cf4731f9d8319b7b8e Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Mon, 24 Apr 2017 08:30:52 +0200 Subject: [PATCH 2/7] EpgPlus: simplify calls of logo attributes and logo instance --- src/gui/epgplus.cpp | 19 +++++++++++-------- src/gui/epgplus.h | 2 ++ 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/src/gui/epgplus.cpp b/src/gui/epgplus.cpp index 7ebf586db..c8db47377 100644 --- a/src/gui/epgplus.cpp +++ b/src/gui/epgplus.cpp @@ -111,20 +111,23 @@ void EpgPlus::Header::paint(const char * Name) std::string caption = Name ? Name : g_Locale->getText(LOCALE_EPGPLUS_HEAD); if (this->head == NULL) + { this->head = new CComponentsHeader(); + this->head->setContextButton(CComponentsHeader::CC_BTN_HELP); + this->head->enableClock(true, "%H:%M", "%H %M", true); + } if (this->head) { if (g_settings.channellist_show_channellogo) { // ensure to have clean background - this->head->getChannelLogoObject()->hide(); - this->head->getChannelLogoObject()->allowPaint(false); + this->logo = this->head->getChannelLogoObject(); + this->logo->hide(); + this->logo->allowPaint(false); } this->head->setDimensionsAll(this->x, this->y, this->width, this->font->getHeight()); this->head->setCaption(caption, CTextBox::NO_AUTO_LINEBREAK); - this->head->setContextButton(CComponentsHeader::CC_BTN_HELP); - this->head->enableClock(true, "%H:%M", "%H %M", true); this->head->paint(CC_SAVE_SCREEN_NO); } } @@ -136,14 +139,14 @@ void EpgPlus::Header::paintChannelLogo(const CZapitChannel * Channel) if (this->head) { - this->head->getChannelLogoObject()->hide(); - this->head->getChannelLogoObject()->clearSavedScreen(); + this->logo->hide(); + this->logo->clearSavedScreen(); if (Channel) { this->head->setChannelLogo(Channel->getChannelID(), Channel->getName()); } - this->head->getChannelLogoObject()->allowPaint(true); - this->head->getChannelLogoObject()->paint(); + this->logo->allowPaint(true); + this->logo->paint(); } } diff --git a/src/gui/epgplus.h b/src/gui/epgplus.h index f5a0ee65f..b317e6f82 100644 --- a/src/gui/epgplus.h +++ b/src/gui/epgplus.h @@ -69,6 +69,8 @@ class EpgPlus class Header { + private: + CComponentsChannelLogoScalable *logo; //// construction / destruction public: Header(CFrameBuffer* frameBuffer, From 4de8c61c043a7c0ddf5ce195aa14e096a208fbf1 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Mon, 24 Apr 2017 11:21:46 +0200 Subject: [PATCH 3/7] COsdSetup: reset channellist objects after changed window size Ensures complete reinit of relevent modules inside channellist instance. --- src/gui/osd_setup.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/gui/osd_setup.cpp b/src/gui/osd_setup.cpp index 60cd9ebfc..f2ec1473e 100644 --- a/src/gui/osd_setup.cpp +++ b/src/gui/osd_setup.cpp @@ -314,6 +314,7 @@ int COsdSetup::exec(CMenuTarget* parent, const std::string &actionKey) memset(window_size_value, 0, sizeof(window_size_value)); snprintf(window_size_value, sizeof(window_size_value), "%d / %d", g_settings.window_width, g_settings.window_height); mfWindowSize->setOption(window_size_value); + CNeutrinoApp::getInstance()->channelList->ResetModules(); break; } else if ((msg == CRCInput::RC_home) || (msg == CRCInput::RC_timeout)) { g_settings.window_width = old_window_width; From 8e3390687c5633aeafea05dab21a3ac7cba2ae54 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Tue, 11 Apr 2017 07:35:31 +0200 Subject: [PATCH 4/7] EpgPlus: update license text --- src/gui/epgplus.cpp | 3 +-- src/gui/epgplus.h | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/src/gui/epgplus.cpp b/src/gui/epgplus.cpp index c8db47377..e945d32ee 100644 --- a/src/gui/epgplus.cpp +++ b/src/gui/epgplus.cpp @@ -19,8 +19,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + along with this program. If not, see . */ #ifdef HAVE_CONFIG_H diff --git a/src/gui/epgplus.h b/src/gui/epgplus.h index b317e6f82..d0dc7286d 100644 --- a/src/gui/epgplus.h +++ b/src/gui/epgplus.h @@ -18,8 +18,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + along with this program. If not, see . */ #ifndef __epgplus__ From cffab5f8f963fda235e98e389e9cbf363dabefd1 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Tue, 25 Apr 2017 09:55:51 +0200 Subject: [PATCH 5/7] CProgressBar: add own position methodes NOTE: not required in branch pu/fb-setmode, remove this after merge! --- src/gui/components/cc_item_progressbar.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/gui/components/cc_item_progressbar.h b/src/gui/components/cc_item_progressbar.h index 610402687..b158bd49e 100644 --- a/src/gui/components/cc_item_progressbar.h +++ b/src/gui/components/cc_item_progressbar.h @@ -157,6 +157,9 @@ class CProgressBar : public CComponentsItem //set gradient (overides g_settings.theme.progressbar_gradient) void setGradient(int &gradient) { pb_gradient = &gradient; } + + void setXPos(const int& xpos){CCDraw::setXPos(xpos);} + void setYPos(const int& ypos){CCDraw::setYPos(ypos);} }; #endif /* __CC_PROGRESSBAR_H__ */ From 0aae491cccad8d5efb424c4b051f427ea4e3f455 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Tue, 25 Apr 2017 11:21:44 +0200 Subject: [PATCH 6/7] CComponentsPicture: add methode to get real image size --- src/gui/components/cc_item_picture.cpp | 22 +++++++++++++++------- src/gui/components/cc_item_picture.h | 9 +++++---- 2 files changed, 20 insertions(+), 11 deletions(-) diff --git a/src/gui/components/cc_item_picture.cpp b/src/gui/components/cc_item_picture.cpp index 91841c071..c776dfcb6 100644 --- a/src/gui/components/cc_item_picture.cpp +++ b/src/gui/components/cc_item_picture.cpp @@ -76,6 +76,7 @@ void CComponentsPicture::init( const int &x_pos, const int &y_pos, const int &w, y = y_old = y_pos; width = width_old = dx = dxc = w; height = height_old = dy = dyc = h; + dx_orig = dy_orig = 0; pic_name = pic_name_old = image_name; shadow = shadow_mode; shadow_w = OFFSET_SHADOW; @@ -201,6 +202,9 @@ void CComponentsPicture::initCCItem() if (height == 0) height = dy_tmp; } + dx_orig = width; + dy_orig = height; + /* leave init methode here if we in no scale mode * otherwise goto next step! */ @@ -211,8 +215,12 @@ void CComponentsPicture::initCCItem() * check internal dimension values (dx/dy) and ensure that values are >0 * real image size */ - if ((dx != width || dy != height) || (dx == 0 || dy == 0)) - g_PicViewer->getSize(pic_name.c_str(), &dx, &dy); + g_PicViewer->getSize(pic_name.c_str(), &dx_orig, &dy_orig); + if ((dx != width || dy != height) || (dx == 0 || dy == 0)){ + dx = dx_orig; + dy = dy_orig; + //g_PicViewer->getSize(pic_name.c_str(), &dx, &dy); + } } /* on next step check item dimensions (width/height) for 0 values @@ -269,11 +277,11 @@ void CComponentsPicture::initPosition(int *x_position, int *y_position) } -// void CComponentsPicture::getSize(int* width_image, int *height_image) -// { -// *width_image = width; -// *height_image = height; -// } +void CComponentsPicture::getRealSize(int* dx_original, int *dy_original) +{ + *dx_original = dx_orig; + *dy_original = dy_orig; +} int CComponentsPicture::getWidth() { diff --git a/src/gui/components/cc_item_picture.h b/src/gui/components/cc_item_picture.h index 7bf8953d0..ef8204d55 100644 --- a/src/gui/components/cc_item_picture.h +++ b/src/gui/components/cc_item_picture.h @@ -54,9 +54,10 @@ class CComponentsPicture : public CComponentsItem ///screen cache content for painted image fb_pixel_t *image_cache; - ///current original image dimensions + ///current image dimensions int dx, dy; - + ///original image dimensions + int dx_orig, dy_orig; ///cached image dimensions int dxc, dyc; @@ -146,8 +147,8 @@ class CComponentsPicture : public CComponentsItem ///returns current assigned image name std::string getPictureName(){return pic_name;} -// ///handle image size -// void getSize(int* width_image, int *height_image); + ///get original image size + void getRealSize(int* dx_orig, int *dy_orig); ///return width of item int getWidth(); ///return height of item From 76cd93555db7043a8442727f5f2fcba50ddde36d Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Tue, 25 Apr 2017 11:31:53 +0200 Subject: [PATCH 7/7] CComponentsHeader: optimize auto size mode for logos With very large font size settings it is possible that header is too large for reasonable display of logos, because of possible bad upscale effects (eg. step effects). So it seems it's better to use original size as largest possible size. --- src/gui/components/cc_frm_header.cpp | 8 ++++++++ src/gui/components/cc_frm_header.h | 1 + 2 files changed, 9 insertions(+) diff --git a/src/gui/components/cc_frm_header.cpp b/src/gui/components/cc_frm_header.cpp index 770c643de..0d5207d3b 100644 --- a/src/gui/components/cc_frm_header.cpp +++ b/src/gui/components/cc_frm_header.cpp @@ -281,6 +281,14 @@ void CComponentsHeader::initLogo() else cch_logo_obj->setChannel(cch_logo.Id, cch_logo.Name); + //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 ; + cch_logo_obj->getRealSize(&dx_orig, &dy_orig); + if (cch_logo.dy_max > dy_orig) + cch_logo.dy_max = dy_orig; + } + if (cch_logo_obj->hasLogo()){ cch_logo_obj->setHeight(cch_logo.dy_max, true); diff --git a/src/gui/components/cc_frm_header.h b/src/gui/components/cc_frm_header.h index a525a3ecc..320c59282 100644 --- a/src/gui/components/cc_frm_header.h +++ b/src/gui/components/cc_frm_header.h @@ -319,6 +319,7 @@ class CComponentsHeader : public CComponentsForm, public CCTextScreen * CC_LOGO_RIGHT \n * @param[in] dy * @li optional logo height, default = -1 (auto) + * @note In auto mode, logo use full height minus inner offset but not larger than original logo height. */ void setChannelLogo( const uint64_t& channelId, const std::string& channelName,