From 11d4052f035c94f8e15ff6588a32ae7e64fbd6b5 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Mon, 6 Feb 2017 21:25:33 +0100 Subject: [PATCH 1/5] signals: reduce multiple includes for sigc++/bind.h Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/e4d0abc7dc37e88e5295740d2d25cdeeded36fc3 Author: Thilo Graf Date: 2017-02-06 (Mon, 06 Feb 2017) ------------------ No further description and justification available within origin commit message! ------------------ This commit was generated by Migit --- src/gui/components/cc_frm_clock.cpp | 2 +- src/gui/components/cc_frm_ext_text.cpp | 1 - src/gui/components/cc_frm_header.cpp | 1 - src/gui/components/cc_item.h | 2 ++ src/gui/components/cc_item_text.cpp | 1 + src/gui/components/cc_signals.h | 1 + 6 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/gui/components/cc_frm_clock.cpp b/src/gui/components/cc_frm_clock.cpp index fcce3647e..c52001eb7 100644 --- a/src/gui/components/cc_frm_clock.cpp +++ b/src/gui/components/cc_frm_clock.cpp @@ -30,7 +30,7 @@ #include "cc_frm_clock.h" #include -#include + #include #include #include diff --git a/src/gui/components/cc_frm_ext_text.cpp b/src/gui/components/cc_frm_ext_text.cpp index 420ea2775..707d43627 100644 --- a/src/gui/components/cc_frm_ext_text.cpp +++ b/src/gui/components/cc_frm_ext_text.cpp @@ -29,7 +29,6 @@ #include #include "cc_frm_ext_text.h" -#include #define DEF_HEIGHT 27 #define DEF_LABEL_WIDTH_PERCENT 30 diff --git a/src/gui/components/cc_frm_header.cpp b/src/gui/components/cc_frm_header.cpp index 8a56e24ad..cda9c5628 100644 --- a/src/gui/components/cc_frm_header.cpp +++ b/src/gui/components/cc_frm_header.cpp @@ -31,7 +31,6 @@ #include "cc_frm_header.h" #include -#include using namespace std; diff --git a/src/gui/components/cc_item.h b/src/gui/components/cc_item.h index dad19d96e..4f5f42da5 100644 --- a/src/gui/components/cc_item.h +++ b/src/gui/components/cc_item.h @@ -27,10 +27,12 @@ #include "cc_types.h" #include "cc_base.h" #include "cc_draw.h" +#include "cc_signals.h" #include #include #include + class CComponentsItem : public CComponents { protected: diff --git a/src/gui/components/cc_item_text.cpp b/src/gui/components/cc_item_text.cpp index 67ee50401..c31e34f13 100644 --- a/src/gui/components/cc_item_text.cpp +++ b/src/gui/components/cc_item_text.cpp @@ -35,6 +35,7 @@ #include #include #include + using namespace std; //sub class CComponentsText from CComponentsItem diff --git a/src/gui/components/cc_signals.h b/src/gui/components/cc_signals.h index c3c60727e..5c3fdaca1 100644 --- a/src/gui/components/cc_signals.h +++ b/src/gui/components/cc_signals.h @@ -88,6 +88,7 @@ class CYourClass : sigc::trackable //<- not forget, requierd by destructor! #define __CC_SIGNALS_H__ #include +#include #include class CComponentsSignals : public sigc::trackable From 112973c3ae7977e40db74dee1ec3ae96ef695112 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Mon, 6 Feb 2017 19:32:25 +0100 Subject: [PATCH 2/5] CComponentsForm: move slots into base classes Usable for all form classes Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/06fa3f248885ac76994864c135bfb8d5605dc609 Author: Thilo Graf Date: 2017-02-06 (Mon, 06 Feb 2017) ------------------ This commit was generated by Migit --- src/gui/components/cc_frm.cpp | 17 ----------------- src/gui/components/cc_frm.h | 10 +++------- src/gui/components/cc_frm_clock.cpp | 8 -------- src/gui/components/cc_frm_ext_text.cpp | 8 -------- src/gui/components/cc_frm_header.cpp | 4 ---- src/gui/components/cc_item_text.cpp | 6 ++++++ src/gui/components/cc_item_text.h | 1 - 7 files changed, 9 insertions(+), 45 deletions(-) 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; }; From b66ccd6251b4fcedbc318fbbfe71768e9e7d68de Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Mon, 6 Feb 2017 21:20:34 +0100 Subject: [PATCH 3/5] Helpbox: fix missing text after page repaint Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/9f7605127a83bcab4e41b7c23d101f544790a6ef Author: Thilo Graf Date: 2017-02-06 (Mon, 06 Feb 2017) ------------------ No further description and justification available within origin commit message! ------------------ This commit was generated by Migit --- src/gui/widget/helpbox.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/widget/helpbox.cpp b/src/gui/widget/helpbox.cpp index 4169b5d13..bb5c04829 100644 --- a/src/gui/widget/helpbox.cpp +++ b/src/gui/widget/helpbox.cpp @@ -98,9 +98,9 @@ void Helpbox::addLine(const std::string& icon, const std::string& text, const in if (!text.empty()){ int x_text = w_picon + (picon ? OFFSET_INNER_MID : 0); CComponentsText * txt = new CComponentsText(x_text, 0, line->getWidth()-x_text, 0, text, text_mode, font); + txt->doPaintBg(false); #if 0 //"contrast agent", if you want to see where the text items are drawn. txt->setColorBody(COL_RED); - txt->doPaintBg(true); #endif int lines = txt->getCTextBoxObject()->getLines(); txt_height = std::max(lines*font->getHeight(), h_line); From f453a2380481ada0fad4d5ebce8c395a12934d5c Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Tue, 7 Feb 2017 15:04:51 +0100 Subject: [PATCH 4/5] CTextBox: compare condition for text render more precisely Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/95de68c5a5725ac919c40b2092413d2b0fc62d6b Author: Thilo Graf Date: 2017-02-07 (Tue, 07 Feb 2017) ------------------ No further description and justification available within origin commit message! ------------------ This commit was generated by Migit --- src/gui/widget/textbox.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/gui/widget/textbox.cpp b/src/gui/widget/textbox.cpp index 54968c03c..bc2fcac5a 100644 --- a/src/gui/widget/textbox.cpp +++ b/src/gui/widget/textbox.cpp @@ -657,6 +657,7 @@ void CTextBox::refreshText(void) if (allow_paint_bg){ //TRACE("[CTextBox] %s restore bg %d\r\n", __FUNCTION__, __LINE__); frameBuffer->RestoreScreen(ax, ay, dx, dy, m_bgpixbuf); + m_bg_painted = true; } } } @@ -718,7 +719,7 @@ void CTextBox::refreshText(void) frameBuffer->paintBoxRel(tx, ty-th, tw, th, COL_RED, m_nBgRadius, m_nBgRadiusType); #endif //TRACE("[CTextBox] %s Line %d m_cFrame.iX %d m_cFrameTextRel.iX %d\r\n", __FUNCTION__, __LINE__, m_cFrame.iX, m_cFrameTextRel.iX); - if (m_bg_painted || m_old_cText != m_cText) + if (m_bg_painted || (m_old_cText != m_cText)) m_pcFontText->RenderString(tx, ty, tw, m_cLineArray[i].c_str(), m_textColor, 0, m_renderMode | ((m_utf8_encoded) ? Font::IS_UTF8 : 0)); y += m_nFontTextHeight; } From b2eb4b1889c3a15284336e1fa1ce2c9e2caed667 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Tue, 7 Feb 2017 17:06:11 +0100 Subject: [PATCH 5/5] CScreenSaver: ensure full cleanup of infoclock after stopped screensaver This provokes re init of info clock. Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/622e7a4dd259ccf1c2b963f354091b59415abae7 Author: Thilo Graf Date: 2017-02-07 (Tue, 07 Feb 2017) ------------------ This commit was generated by Migit --- src/gui/screensaver.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/gui/screensaver.cpp b/src/gui/screensaver.cpp index 7c3b50b5a..7532803a0 100644 --- a/src/gui/screensaver.cpp +++ b/src/gui/screensaver.cpp @@ -143,10 +143,12 @@ void CScreenSaver::Stop() m_frameBuffer->paintBackground(); //clear entire screen CAudioMute::getInstance()->enableMuteIcon(status_mute); - if (!OnAfterStop.empty()) + if (!OnAfterStop.empty()){ OnAfterStop(); - else + }else{ + CInfoClock::getInstance()->ClearDisplay(); //provokes reinit CInfoClock::getInstance()->enableInfoClock(); + } } void* CScreenSaver::ScreenSaverPrg(void* arg)