diff --git a/src/gui/components/cc_frm.cpp b/src/gui/components/cc_frm.cpp index 19843a5b9..d124f3395 100644 --- a/src/gui/components/cc_frm.cpp +++ b/src/gui/components/cc_frm.cpp @@ -680,20 +680,3 @@ bool CComponentsForm::enableColBodyGradient(const int& enable_mode, const fb_pix } return false; } - -void CComponentsForm::forceItemsPaint(bool force) -{ - for (size_t i = 0; i < v_cc_items.size(); i++){ - dprintf(DEBUG_DEBUG, "\033[33m[CComponentsForm] [%s - %d] found item type = [%d] \033[0m\n", __func__, __LINE__, v_cc_items[i]->getItemType()); - if (v_cc_items[i]->getItemType() == CC_ITEMTYPE_TEXT){ - CComponentsText* text = static_cast (v_cc_items[i]); - text->forceTextPaint(force); - dprintf(DEBUG_DEBUG, "\033[33m[CComponentsForm] [%s - %d] force repaint of item type CC_ITEMTYPE_TEXT [%u] content [%s]\033[0m\n", __func__, __LINE__, i, text->getText().c_str()); - } - if (v_cc_items[i]->getItemType() == CC_ITEMTYPE_LABEL){ - CComponentsLabel* label = static_cast (v_cc_items[i]); - label ->forceTextPaint(force); - dprintf(DEBUG_DEBUG, "\033[33m[CComponentsForm] [%s - %d] force repaint of item type CC_ITEMTYPE_LABEL [%u] content [%s]\033[0m\n", __func__, __LINE__, i, label->getText().c_str()); - } - } -} diff --git a/src/gui/components/cc_frm.h b/src/gui/components/cc_frm.h index b9cab7934..3561e495a 100644 --- a/src/gui/components/cc_frm.h +++ b/src/gui/components/cc_frm.h @@ -65,13 +65,6 @@ class CComponentsForm : public CComponentsItem const fb_pixel_t& color_body, const fb_pixel_t& color_shadow); - ///force repaint of all possible text items - void forceItemsPaint(bool force); - ///slot for background paint event, reserved for forceItemsPaint() - sigc::slot0 sl_items_repaint; - ///slot for repaint event, reserved for actions before repaint if paint() already was done. - sigc::slot0 sl_form_repaint; - public: CComponentsForm( const int x_pos = 0, const int y_pos = 0, const int w = 800, const int h = 600, CComponentsForm *parent = NULL, @@ -223,6 +216,9 @@ class CComponentsForm : public CComponentsItem virtual bool clearPaintCache(); ///cleanup old gradient buffers include from sub items, returns true if any gradient buffer data was removed virtual bool clearFbGradientData(); + + ///slot for repaint event, reserved for actions before repaint if paint() already was done. + sigc::slot0 sl_form_repaint; }; #endif diff --git a/src/gui/components/cc_frm_clock.cpp b/src/gui/components/cc_frm_clock.cpp index c52001eb7..08a498eb1 100644 --- a/src/gui/components/cc_frm_clock.cpp +++ b/src/gui/components/cc_frm_clock.cpp @@ -100,9 +100,6 @@ CComponentsFrmClock::CComponentsFrmClock( const int& x_pos, //init slot for running clock cl_sl_show = sigc::mem_fun0(*this, &CComponentsFrmClock::ShowTime); - //init slot to ensure paint segments after painted background - sl_items_repaint = sigc::bind(sigc::mem_fun(*this, &CComponentsFrmClock::forceItemsPaint), true); - //run clock already if required if (activ) startClock(); @@ -300,11 +297,6 @@ void CComponentsFrmClock::initCCLockItems() x_lbl += v_cc_items[i-1]->getWidth(); v_cc_items[i]->setPos(x_lbl, y_lbl); } - - if(!OnAfterPaintBg.empty()) - OnAfterPaintBg.clear(); - //init slot to handle repaint of segments if background was repainted - OnAfterPaintBg.connect(sl_items_repaint); } diff --git a/src/gui/components/cc_frm_ext_text.cpp b/src/gui/components/cc_frm_ext_text.cpp index 707d43627..9cd27aa23 100644 --- a/src/gui/components/cc_frm_ext_text.cpp +++ b/src/gui/components/cc_frm_ext_text.cpp @@ -113,9 +113,6 @@ void CComponentsExtTextForm::initVarExtTextForm(const int& x_pos, const int& y_p } ccx_label_align = ccx_text_align = CTextBox::NO_AUTO_LINEBREAK; - //init slot to ensure paint text items after painted background - sl_items_repaint = sigc::bind(sigc::mem_fun(*this, &CComponentsExtTextForm::forceItemsPaint), true); - initParent(parent); } @@ -221,11 +218,6 @@ void CComponentsExtTextForm::initCCTextItems() { initLabel(); initText(); - - if(!OnAfterPaintBg.empty()) - OnAfterPaintBg.clear(); - //init slot to handle repaint of text if background was repainted - OnAfterPaintBg.connect(sl_items_repaint); } void CComponentsExtTextForm::setLabelWidthPercent(const uint8_t& percent_val) diff --git a/src/gui/components/cc_frm_header.cpp b/src/gui/components/cc_frm_header.cpp index cda9c5628..838f4f35c 100644 --- a/src/gui/components/cc_frm_header.cpp +++ b/src/gui/components/cc_frm_header.cpp @@ -135,10 +135,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; - //init slot to ensure paint items after painted background - sl_items_repaint = sigc::bind(sigc::mem_fun(*this, &CComponentsHeader::forceItemsPaint), true); - OnAfterPaintBg.connect(sl_items_repaint); - //init slot before re paint of header, paint() is already done sl_form_repaint = sigc::bind(sigc::mem_fun(*this, &CComponentsHeader::kill), col_body, -1, CC_FBDATA_TYPES, false); OnBeforeRePaint.connect(sl_form_repaint); diff --git a/src/gui/components/cc_item_text.cpp b/src/gui/components/cc_item_text.cpp index c31e34f13..8a3897d2d 100644 --- a/src/gui/components/cc_item_text.cpp +++ b/src/gui/components/cc_item_text.cpp @@ -274,6 +274,12 @@ bool CComponentsText::setTextFromFile(const string& path_to_textfile, const int void CComponentsText::paintText(bool do_save_bg) { + if (cc_parent){ + if(!cc_parent->OnAfterPaintBg.empty()) + cc_parent->OnAfterPaintBg.clear(); + //init slot to handle repaint of text if background was repainted + cc_parent->OnAfterPaintBg.connect(sigc::bind(sigc::mem_fun(*this, &CComponentsText::forceTextPaint), true)); + } initCCText(); if (!is_painted) paintInit(do_save_bg); diff --git a/src/gui/components/cc_item_text.h b/src/gui/components/cc_item_text.h index 1de07d08c..5e5d53d48 100644 --- a/src/gui/components/cc_item_text.h +++ b/src/gui/components/cc_item_text.h @@ -196,7 +196,6 @@ class CComponentsText : public CCTextScreen, public CComponentsItem ///force paint of text even if text was changed or not virtual void forceTextPaint(bool force_text_paint = true){ct_force_text_paint = force_text_paint;}; - ///gets the embedded CTextBox object, so it's possible to get access directly to its methods and properties virtual CTextBox* getCTextBoxObject() { return ct_textbox; };