CComponentsFrmClock: add members to control segment refreshing on interval

Refreshing of segments is now enabled on default.
In certain conditions this should be better.
This commit is contained in:
2017-04-07 21:44:32 +02:00
parent 83cfd68f88
commit 511486c404
2 changed files with 13 additions and 2 deletions

View File

@@ -87,6 +87,9 @@ CComponentsFrmClock::CComponentsFrmClock( const int& x_pos,
//set default text background behavior //set default text background behavior
cc_txt_save_screen = false; cc_txt_save_screen = false;
//enable refresh of all segments on each interval as default
cl_force_repaint = true;
//set default running clock properties //set default running clock properties
cl_interval = interval_seconds; cl_interval = interval_seconds;
cl_timer = NULL; cl_timer = NULL;
@@ -255,7 +258,7 @@ void CComponentsFrmClock::initCCLockItems()
//set size, text, color of current item //set size, text, color of current item
lbl->setDimensionsAll(x_tmp, y_tmp, w_tmp, h_tmp); lbl->setDimensionsAll(x_tmp, y_tmp, w_tmp, h_tmp);
lbl->setColorAll(col_frame, col_body, col_shadow); lbl->setColorAll(col_frame, col_body, col_shadow);
lbl->forceTextPaint(false); lbl->forceTextPaint(cl_force_repaint);
lbl->setText(stmp, CTextBox::CENTER, cl_font, cl_col_text, cl_font_style); lbl->setText(stmp, CTextBox::CENTER, cl_font, cl_col_text, cl_font_style);
//init background behavior of segment //init background behavior of segment

View File

@@ -70,6 +70,9 @@ class CComponentsFrmClock : public CComponentsForm, public CCTextScreen
///text color ///text color
int cl_col_text; int cl_col_text;
///refresh mode
bool cl_force_repaint;
///current time format ///current time format
std::string cl_format; std::string cl_format;
///primary time format ///primary time format
@@ -151,7 +154,7 @@ class CComponentsFrmClock : public CComponentsForm, public CCTextScreen
///returns true, if clock is running ///returns true, if clock is running
virtual bool isRun() const {return cl_timer ? true : false;}; virtual bool isRun() const {return cl_timer ? true : false;};
///set refresh interval in seconds, default value=1 (=1 sec) ///set refresh interval in seconds, default value=1 (=1 sec)
virtual void setClockInterval(const int& seconds){cl_interval = seconds;}; virtual void setClockInterval(const int& seconds){cl_interval = seconds;}
///show clock on screen ///show clock on screen
virtual void paint(bool do_save_bg = CC_SAVE_SCREEN_YES); virtual void paint(bool do_save_bg = CC_SAVE_SCREEN_YES);
@@ -163,6 +166,11 @@ class CComponentsFrmClock : public CComponentsForm, public CCTextScreen
///reinitialize clock contents ///reinitialize clock contents
virtual void refresh() { initCCLockItems(); } virtual void refresh() { initCCLockItems(); }
///enables force to repaint of all segments on each interval, Note: repaint of all segemts is default enabled.
void enableForceSegmentPaint(bool enable = true){cl_force_repaint = enable;}
///disables repaint of all segments on each interval, repaint happens only on changed segment value
void disableForceSegmentPaint(){enableForceSegmentPaint(false);}
/**Member to modify background behavior of embeded segment objects /**Member to modify background behavior of embeded segment objects
* @param[in] mode * @param[in] mode
* @li bool, default = true * @li bool, default = true