gui/components/cc_frm_clock.cpp: set CTextBox save screen and paint background flag;

add option to call first paint with save bg - default dont save;
detach clock thread


Origin commit data
------------------
Commit: f50840ac96
Author: [CST] Focus <focus.cst@gmail.com>
Date: 2015-03-06 (Fri, 06 Mar 2015)
This commit is contained in:
[CST] Focus
2015-03-06 13:35:34 +03:00
parent 1372f35c6c
commit 3d365aedeb
2 changed files with 9 additions and 4 deletions

View File

@@ -191,6 +191,9 @@ void CComponentsFrmClock::initCCLockItems()
lbl->setColorAll(col_frame, col_body, col_shadow); lbl->setColorAll(col_frame, col_body, col_shadow);
lbl->setText(stmp, CTextBox::CENTER, *getClockFont()); lbl->setText(stmp, CTextBox::CENTER, *getClockFont());
lbl->doPaintTextBoxBg(paint_bg);
lbl->enableTboxSaveScreen(save_tbox_screen);
//use matching height for digits for better vertical centerring into form //use matching height for digits for better vertical centerring into form
CTextBox* ctb = lbl->getCTextBoxObject(); CTextBox* ctb = lbl->getCTextBoxObject();
if (ctb) if (ctb)
@@ -285,6 +288,7 @@ bool CComponentsFrmClock::startThread()
printf("[CComponentsFrmClock] [%s] pthread_create %s\n", __func__, strerror(errno)); printf("[CComponentsFrmClock] [%s] pthread_create %s\n", __func__, strerror(errno));
return false; return false;
} }
pthread_detach(cl_thread);
} }
return true; return true;
} }
@@ -298,19 +302,20 @@ bool CComponentsFrmClock::stopThread()
printf("[CComponentsFrmClock] [%s] pthread_cancel %s\n", __func__, strerror(errno)); printf("[CComponentsFrmClock] [%s] pthread_cancel %s\n", __func__, strerror(errno));
return false; return false;
} }
#if 0
res = pthread_join(cl_thread, NULL); res = pthread_join(cl_thread, NULL);
if (res != 0){ if (res != 0){
printf("[CComponentsFrmClock] [%s] pthread_join %s\n", __func__, strerror(errno)); printf("[CComponentsFrmClock] [%s] pthread_join %s\n", __func__, strerror(errno));
return false; return false;
} }
#endif
} }
hide(); hide();
cl_thread = 0; cl_thread = 0;
return true; return true;
} }
bool CComponentsFrmClock::Start() bool CComponentsFrmClock::Start(bool do_save_bg)
{ {
if (!activeClock) if (!activeClock)
return false; return false;
@@ -318,7 +323,7 @@ bool CComponentsFrmClock::Start()
startThread(); startThread();
if (cl_thread) { if (cl_thread) {
//ensure paint of segements on first paint //ensure paint of segements on first paint
paint(); paint(do_save_bg);
paintClock = true; paintClock = true;
} }
return cl_thread == 0 ? false : true; return cl_thread == 0 ? false : true;

View File

@@ -126,7 +126,7 @@ class CComponentsFrmClock : public CComponentsForm
///stop ticking clock thread, returns true on success, if false causes log output ///stop ticking clock thread, returns true on success, if false causes log output
virtual bool stopThread(); virtual bool stopThread();
virtual bool Start(); virtual bool Start(bool do_save_bg = CC_SAVE_SCREEN_NO);
virtual bool Stop(); virtual bool Stop();
///returns true, if clock is running in thread ///returns true, if clock is running in thread