Merge branch 'master' into pu/fb-modules

This commit is contained in:
M. Liebmann
2017-02-08 20:16:41 +01:00
12 changed files with 21 additions and 52 deletions

View File

@@ -680,20 +680,3 @@ bool CComponentsForm::enableColBodyGradient(const int& enable_mode, const fb_pix
} }
return false; 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 <CComponentsText*>(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 <CComponentsLabel*>(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());
}
}
}

View File

@@ -65,13 +65,6 @@ class CComponentsForm : public CComponentsItem
const fb_pixel_t& color_body, const fb_pixel_t& color_body,
const fb_pixel_t& color_shadow); 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<void> sl_items_repaint;
///slot for repaint event, reserved for actions before repaint if paint() already was done.
sigc::slot0<void> sl_form_repaint;
public: public:
CComponentsForm( const int x_pos = 0, const int y_pos = 0, const int w = 800, const int h = 600, CComponentsForm( const int x_pos = 0, const int y_pos = 0, const int w = 800, const int h = 600,
CComponentsForm *parent = NULL, CComponentsForm *parent = NULL,
@@ -223,6 +216,9 @@ class CComponentsForm : public CComponentsItem
virtual bool clearPaintCache(); virtual bool clearPaintCache();
///cleanup old gradient buffers include from sub items, returns true if any gradient buffer data was removed ///cleanup old gradient buffers include from sub items, returns true if any gradient buffer data was removed
virtual bool clearFbGradientData(); virtual bool clearFbGradientData();
///slot for repaint event, reserved for actions before repaint if paint() already was done.
sigc::slot0<void> sl_form_repaint;
}; };
#endif #endif

View File

@@ -30,7 +30,7 @@
#include "cc_frm_clock.h" #include "cc_frm_clock.h"
#include <time.h> #include <time.h>
#include <sigc++/bind.h>
#include <unistd.h> #include <unistd.h>
#include <errno.h> #include <errno.h>
#include <ctype.h> #include <ctype.h>
@@ -101,9 +101,6 @@ CComponentsFrmClock::CComponentsFrmClock( const int& x_pos,
//init slot for running clock //init slot for running clock
cl_sl_show = sigc::mem_fun0(*this, &CComponentsFrmClock::ShowTime); 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 //run clock already if required
if (activ) if (activ)
startClock(); startClock();
@@ -301,11 +298,6 @@ void CComponentsFrmClock::initCCLockItems()
x_lbl += v_cc_items[i-1]->getWidth(); x_lbl += v_cc_items[i-1]->getWidth();
v_cc_items[i]->setPos(x_lbl, y_lbl); 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);
} }

View File

@@ -30,7 +30,6 @@
#include "cc_frm_ext_text.h" #include "cc_frm_ext_text.h"
#include <driver/fontrenderer.h> #include <driver/fontrenderer.h>
#include <sigc++/bind.h>
#define DEF_HEIGHT 27 #define DEF_HEIGHT 27
#define DEF_LABEL_WIDTH_PERCENT 30 #define DEF_LABEL_WIDTH_PERCENT 30
@@ -115,9 +114,6 @@ void CComponentsExtTextForm::initVarExtTextForm(const int& x_pos, const int& y_p
} }
ccx_label_align = ccx_text_align = CTextBox::NO_AUTO_LINEBREAK; 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); initParent(parent);
} }
@@ -223,11 +219,6 @@ void CComponentsExtTextForm::initCCTextItems()
{ {
initLabel(); initLabel();
initText(); 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) void CComponentsExtTextForm::setLabelWidthPercent(const uint8_t& percent_val)

View File

@@ -32,7 +32,6 @@
#include <system/debug.h> #include <system/debug.h>
#include <driver/fontrenderer.h> #include <driver/fontrenderer.h>
#include <sigc++/bind.h>
using namespace std; using namespace std;
@@ -137,10 +136,6 @@ void CComponentsHeader::initVarHeader( const int& x_pos, const int& y_pos, const
cch_cl_sec_format = cch_cl_format; cch_cl_sec_format = cch_cl_format;
cch_cl_enable_run = false; 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 //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); sl_form_repaint = sigc::bind(sigc::mem_fun(*this, &CComponentsHeader::kill), col_body, -1, CC_FBDATA_TYPES, false);
OnBeforeRePaint.connect(sl_form_repaint); OnBeforeRePaint.connect(sl_form_repaint);

View File

@@ -27,10 +27,12 @@
#include "cc_types.h" #include "cc_types.h"
#include "cc_base.h" #include "cc_base.h"
#include "cc_draw.h" #include "cc_draw.h"
#include "cc_signals.h"
#include <vector> #include <vector>
#include <string> #include <string>
#include <driver/colorgradient.h> #include <driver/colorgradient.h>
class CComponentsItem : public CComponents class CComponentsItem : public CComponents
{ {
protected: protected:

View File

@@ -36,6 +36,7 @@
#include <fstream> #include <fstream>
#include <errno.h> #include <errno.h>
#include <system/debug.h> #include <system/debug.h>
using namespace std; using namespace std;
//sub class CComponentsText from CComponentsItem //sub class CComponentsText from CComponentsItem
@@ -274,6 +275,12 @@ bool CComponentsText::setTextFromFile(const string& path_to_textfile, const int
void CComponentsText::paintText(bool do_save_bg) 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(); initCCText();
if (!is_painted) if (!is_painted)
paintInit(do_save_bg); paintInit(do_save_bg);

View File

@@ -196,7 +196,6 @@ class CComponentsText : public CCTextScreen, public CComponentsItem
///force paint of text even if text was changed or not ///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;}; 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 ///gets the embedded CTextBox object, so it's possible to get access directly to its methods and properties
virtual CTextBox* getCTextBoxObject() { return ct_textbox; }; virtual CTextBox* getCTextBoxObject() { return ct_textbox; };

View File

@@ -88,6 +88,7 @@ class CYourClass : sigc::trackable //<- not forget, requierd by destructor!
#define __CC_SIGNALS_H__ #define __CC_SIGNALS_H__
#include <sigc++/signal.h> #include <sigc++/signal.h>
#include <sigc++/bind.h>
#include <driver/rcinput.h> #include <driver/rcinput.h>
class CComponentsSignals : public sigc::trackable class CComponentsSignals : public sigc::trackable

View File

@@ -144,11 +144,13 @@ void CScreenSaver::Stop()
m_frameBuffer->paintBackground(); //clear entire screen m_frameBuffer->paintBackground(); //clear entire screen
CAudioMute::getInstance()->enableMuteIcon(status_mute); CAudioMute::getInstance()->enableMuteIcon(status_mute);
if (!OnAfterStop.empty()) if (!OnAfterStop.empty()){
OnAfterStop(); OnAfterStop();
else }else{
CInfoClock::getInstance()->ClearDisplay(); //provokes reinit
CInfoClock::getInstance()->enableInfoClock(); CInfoClock::getInstance()->enableInfoClock();
} }
}
void* CScreenSaver::ScreenSaverPrg(void* arg) void* CScreenSaver::ScreenSaverPrg(void* arg)
{ {

View File

@@ -99,9 +99,9 @@ void Helpbox::addLine(const std::string& icon, const std::string& text, const in
if (!text.empty()){ if (!text.empty()){
int x_text = w_picon + (picon ? OFFSET_INNER_MID : 0); 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); 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. #if 0 //"contrast agent", if you want to see where the text items are drawn.
txt->setColorBody(COL_RED); txt->setColorBody(COL_RED);
txt->doPaintBg(true);
#endif #endif
int lines = txt->getCTextBoxObject()->getLines(); int lines = txt->getCTextBoxObject()->getLines();
txt_height = std::max(lines*font->getHeight(), h_line); txt_height = std::max(lines*font->getHeight(), h_line);

View File

@@ -659,6 +659,7 @@ void CTextBox::refreshText(void)
if (allow_paint_bg){ if (allow_paint_bg){
//TRACE("[CTextBox] %s restore bg %d\r\n", __FUNCTION__, __LINE__); //TRACE("[CTextBox] %s restore bg %d\r\n", __FUNCTION__, __LINE__);
frameBuffer->RestoreScreen(ax, ay, dx, dy, m_bgpixbuf); frameBuffer->RestoreScreen(ax, ay, dx, dy, m_bgpixbuf);
m_bg_painted = true;
} }
} }
} }
@@ -720,7 +721,7 @@ void CTextBox::refreshText(void)
frameBuffer->paintBoxRel(tx, ty-th, tw, th, COL_RED, m_nBgRadius, m_nBgRadiusType); frameBuffer->paintBoxRel(tx, ty-th, tw, th, COL_RED, m_nBgRadius, m_nBgRadiusType);
#endif #endif
//TRACE("[CTextBox] %s Line %d m_cFrame.iX %d m_cFrameTextRel.iX %d\r\n", __FUNCTION__, __LINE__, m_cFrame.iX, m_cFrameTextRel.iX); //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)); 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; y += m_nFontTextHeight;
} }