From 288520b5b0de7b54af97786be6a4263509db8ddc Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Sat, 13 Nov 2021 18:56:46 +0100 Subject: [PATCH] wdget/navibar: remove nb_lpic->doPaintBg(false), code format changes doPaintBg is no more required --- src/gui/widget/navibar.cpp | 54 ++++++++++++++++++++------------------ src/gui/widget/navibar.h | 38 +++++++++++++-------------- 2 files changed, 47 insertions(+), 45 deletions(-) diff --git a/src/gui/widget/navibar.cpp b/src/gui/widget/navibar.cpp index a8b8b3833..6c3047472 100644 --- a/src/gui/widget/navibar.cpp +++ b/src/gui/widget/navibar.cpp @@ -3,7 +3,7 @@ Copyright (C) 2001 by Steffen Hehn 'McClean' Class for epg window navigation bar. - Copyright (C) 2017-2018, Thilo Graf 'dbt' + Copyright (C) 2017-2021, Thilo Graf 'dbt' License: GPL @@ -31,16 +31,19 @@ using namespace std; -CNaviBar::CNaviBar( const int& x_pos, - const int& y_pos, - const int& dx, - const int& dy, - CComponentsForm* parent, +CNaviBar::CNaviBar( const int &x_pos, + const int &y_pos, + const int &dx, + const int &dy, + CComponentsForm *parent, int shadow_mode, - fb_pixel_t& color_frame, - fb_pixel_t& color_body, - fb_pixel_t& color_shadow) - : CComponentsFrmChain( x_pos, y_pos, dx, dy, + fb_pixel_t &color_frame, + fb_pixel_t &color_body, + fb_pixel_t &color_shadow) + : CComponentsFrmChain( x_pos, + y_pos, + dx, + dy, NULL, CC_DIR_X, parent, @@ -50,7 +53,7 @@ CNaviBar::CNaviBar( const int& x_pos, color_shadow) { setCornerType(CORNER_NONE); - enableColBodyGradient(g_settings.theme.infobar_gradient_bottom,COL_MENUFOOT_PLUS_0,g_settings.theme.infobar_gradient_bottom_direction); + enableColBodyGradient(g_settings.theme.infobar_gradient_bottom, COL_MENUFOOT_PLUS_0, g_settings.theme.infobar_gradient_bottom_direction); set2ndColor(COL_MENUCONTENT_PLUS_0); nb_lpic = nb_rpic = NULL; @@ -68,27 +71,24 @@ void CNaviBar::initCCItems() int mid_width = width * 40 / 100; // 40% int side_width = ((width - mid_width) / 2) - (2 * x_off); int h_text = height; - int icon_h, icon_w; // init left arrow - if (!nb_lpic){ - nb_lpic = new CComponentsPicture(x_off,CC_CENTERED, CFrameBuffer::getInstance()->getIconPath(NEUTRINO_ICON_BUTTON_LEFT)); - nb_lpic->getRealSize(&icon_h, &icon_w); - if ((icon_h + 2*OFFSET_INNER_MIN) > (height + 2*OFFSET_INNER_MIN)) - nb_lpic->setHeight(height - 2*OFFSET_INNER_MIN, true); - nb_lpic->doPaintBg(false); + if (!nb_lpic) + { + nb_lpic = new CComponentsPicture(x_off, CC_CENTERED, CFrameBuffer::getInstance()->getIconPath(NEUTRINO_ICON_BUTTON_LEFT)); + if ((nb_lpic->getHeight() + 2 * OFFSET_INNER_MIN) > (height + 2 * OFFSET_INNER_MIN)) + nb_lpic->setHeight(height - 2 * OFFSET_INNER_MIN); this->addCCItem(nb_lpic); nb_lpic->enableSaveBg(); } nb_lpic->allowPaint(nb_lpic_enable); // init right arrow - if (!nb_rpic){ - nb_rpic = new CComponentsPicture(0,CC_CENTERED, CFrameBuffer::getInstance()->getIconPath(NEUTRINO_ICON_BUTTON_RIGHT)); - nb_rpic->getRealSize(&icon_h, &icon_w); - if ((icon_h + 2*OFFSET_INNER_MIN) > (height + 2*OFFSET_INNER_MIN)) - nb_rpic->setHeight(height - 2*OFFSET_INNER_MIN, true); - nb_rpic->doPaintBg(false); + if (!nb_rpic) + { + nb_rpic = new CComponentsPicture(0, CC_CENTERED, CFrameBuffer::getInstance()->getIconPath(NEUTRINO_ICON_BUTTON_RIGHT)); + if ((nb_rpic->getHeight() + 2 * OFFSET_INNER_MIN) > (height + 2 * OFFSET_INNER_MIN)) + nb_rpic->setHeight(height - 2 * OFFSET_INNER_MIN); this->addCCItem(nb_rpic); nb_rpic->enableSaveBg(); int x_pos = width - nb_rpic->getWidth() - x_off; @@ -97,7 +97,8 @@ void CNaviBar::initCCItems() nb_rpic->allowPaint(nb_rpic_enable); // init text left - if (!nb_lText){ + if (!nb_lText) + { nb_lText = new CComponentsText(x_off + nb_lpic->getWidth() + x_off, CC_CENTERED, side_width, h_text, "", CTextBox::NO_AUTO_LINEBREAK, g_Font[SNeutrinoSettings::FONT_TYPE_EPG_DATE], CComponentsText::FONT_STYLE_REGULAR, this, CC_SHADOW_OFF, COL_MENUHEAD_TEXT); nb_lText->doPaintBg(false); nb_lText->enableSaveBg(); @@ -105,7 +106,8 @@ void CNaviBar::initCCItems() nb_lText->setText(nb_l_text, CTextBox::NO_AUTO_LINEBREAK, nb_font, COL_MENUHEAD_TEXT, CComponentsText::FONT_STYLE_REGULAR); // init text right - if (!nb_rText){ + if (!nb_rText) + { nb_rText = new CComponentsText(0, CC_CENTERED, side_width, h_text, "", CTextBox::NO_AUTO_LINEBREAK | CTextBox::RIGHT, g_Font[SNeutrinoSettings::FONT_TYPE_EPG_DATE], CComponentsText::FONT_STYLE_REGULAR, this, CC_SHADOW_OFF, COL_MENUHEAD_TEXT); nb_rText->doPaintBg(false); nb_rText->enableSaveBg(); diff --git a/src/gui/widget/navibar.h b/src/gui/widget/navibar.h index 21d6759d5..ce3d0226f 100644 --- a/src/gui/widget/navibar.h +++ b/src/gui/widget/navibar.h @@ -3,7 +3,7 @@ Copyright (C) 2001 by Steffen Hehn 'McClean' Class for epg window navigation bar. - Copyright (C) 2017, Thilo Graf 'dbt' + Copyright (C) 2017, 2021, Thilo Graf 'dbt' License: GPL @@ -30,7 +30,7 @@ /** - CNaviBar is sub class of CComponentsFrmChain. + CNaviBar is sub class of CComponentsFrmChain. Shows a navigation bar with text and navigation icons. You can enable/disable predefined icons and texts on the left and/or right side of bar. @@ -74,15 +74,15 @@ class CNaviBar : public CComponentsFrmChain * * @see class CComponentsFrmChain() */ - CNaviBar( const int& x_pos, - const int& y_pos, - const int& dx, - const int& dy, - CComponentsForm* parent = NULL, + CNaviBar( const int &x_pos, + const int &y_pos, + const int &dx, + const int &dy, + CComponentsForm *parent = NULL, int shadow_mode = CC_SHADOW_OFF, - fb_pixel_t& color_frame = COL_FRAME_PLUS_0, - fb_pixel_t& color_body = COL_MENUFOOT_PLUS_0, - fb_pixel_t& color_shadow = COL_SHADOW_PLUS_0); + fb_pixel_t &color_frame = COL_FRAME_PLUS_0, + fb_pixel_t &color_body = COL_MENUFOOT_PLUS_0, + fb_pixel_t &color_shadow = COL_SHADOW_PLUS_0); //~CNaviBar(); //is inherited @@ -91,26 +91,26 @@ class CNaviBar : public CComponentsFrmChain * @param[in] enable * @li expects type bool, default = true */ - void enableLeftArrow(bool enable = true){nb_lpic_enable = enable; initCCItems();} + void enableLeftArrow(bool enable = true) {nb_lpic_enable = enable; initCCItems();} /** * Enable or disable right icon * @param[in] enable * @li expects type bool, default = true */ - void enableRightArrow(bool enable = true){nb_rpic_enable = enable; initCCItems();} + void enableRightArrow(bool enable = true) {nb_rpic_enable = enable; initCCItems();} /** * disable left icon * no parameter */ - void disableLeftArrow(){enableLeftArrow(false);} + void disableLeftArrow() {enableLeftArrow(false);} /** * disable right icon * no parameter */ - void disableRightArrow(){enableRightArrow(false);} + void disableRightArrow() {enableRightArrow(false);} /** * Enable or disable both icons at once. @@ -119,13 +119,13 @@ class CNaviBar : public CComponentsFrmChain * @param[in] enable_right * @li expects type bool, default = true */ - void enableArrows(bool enable_left = true, bool enable_right = true){enableLeftArrow(enable_left); enableRightArrow(enable_right);} + void enableArrows(bool enable_left = true, bool enable_right = true) {enableLeftArrow(enable_left); enableRightArrow(enable_right);} /** * Disable all icons. * no parameter */ - void disableArrows(){disableLeftArrow(); disableRightArrow();} + void disableArrows() {disableLeftArrow(); disableRightArrow();} /** * Sets font type for texts. @@ -139,14 +139,14 @@ class CNaviBar : public CComponentsFrmChain * @param[in] text * @li expects type std::string */ - void setLeftText(const std::string& text) {nb_l_text = text; initCCItems();} + void setLeftText(const std::string &text) {nb_l_text = text; initCCItems();} /** * Sets right text * @param[in] text * @li expects type std::string */ - void setRightText(const std::string& text) {nb_r_text = text; initCCItems();} + void setRightText(const std::string &text) {nb_r_text = text; initCCItems();} /** * Sets left and right text at once. @@ -155,7 +155,7 @@ class CNaviBar : public CComponentsFrmChain * @param[in] right * @li expects type std::string */ - void setText(const std::string& left, const std::string& right) {setLeftText(left); setRightText(right);} + void setText(const std::string &left, const std::string &right) {setLeftText(left); setRightText(right);} /** * Paint bar on screen.