CComponentsFrmClock: set font only with fontrender object

This commit is contained in:
2013-06-18 19:10:47 +02:00
parent ad48ffd99c
commit 03ef18cdb9
4 changed files with 10 additions and 14 deletions

View File

@@ -2079,10 +2079,11 @@ void CChannelList::paintHead()
if (headerClock == NULL) { if (headerClock == NULL) {
headerClock = new CComponentsFrmClock(0, 0, 0, 0, "%H:%M"); headerClock = new CComponentsFrmClock(0, 0, 0, 0, "%H:%M");
headerClock->setClockIntervall(10); headerClock->setClockIntervall(10);
headerClock->setClockFontType(SNeutrinoSettings::FONT_TYPE_MENU_TITLE);
}
headerClock->setClockFont(g_Font[SNeutrinoSettings::FONT_TYPE_MENU_TITLE]);
headerClock->setCornerRadius(RADIUS_LARGE); headerClock->setCornerRadius(RADIUS_LARGE);
headerClock->setCornerType(CORNER_TOP_RIGHT); headerClock->setCornerType(CORNER_TOP_RIGHT);
}
headerClock->setYPos(y); headerClock->setYPos(y);
headerClock->setHeight(theight); headerClock->setHeight(theight);
headerClock->setTextColor(COL_MENUHEAD); headerClock->setTextColor(COL_MENUHEAD);

View File

@@ -69,12 +69,10 @@ void CComponentsFrmClock::initVarClock()
cc_item_type = CC_ITEMTYPE_FRM_CLOCK; cc_item_type = CC_ITEMTYPE_FRM_CLOCK;
corner_rad = RADIUS_SMALL; corner_rad = RADIUS_SMALL;
cl_font_type = SNeutrinoSettings::FONT_TYPE_INFOBAR_INFO; cl_font = g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_INFO];
cl_font = NULL;
cl_col_text = COL_MENUCONTENT; cl_col_text = COL_MENUCONTENT;
cl_format_str = "%H:%M"; cl_format_str = "%H:%M";
cl_align = CC_ALIGN_VER_CENTER | CC_ALIGN_HOR_CENTER; cl_align = CC_ALIGN_VER_CENTER | CC_ALIGN_HOR_CENTER;
// cl_force_segment_paint = false;
cl_thread = 0; cl_thread = 0;
cl_interval = 1; cl_interval = 1;
@@ -112,8 +110,6 @@ void CComponentsFrmClock::initCCLockItems()
initTimeString(); initTimeString();
string s_time = cl_timestr; string s_time = cl_timestr;
cl_font = g_Font[cl_font_type];
//get minimal required height, width from raw text //get minimal required height, width from raw text
int min_text_w = cl_font->getRenderWidth(s_time, true);; int min_text_w = cl_font->getRenderWidth(s_time, true);;
int min_text_h = cl_font->getHeight(); int min_text_h = cl_font->getHeight();

View File

@@ -57,12 +57,11 @@ class CComponentsFrmClock : public CComponentsForm
///raw time chars ///raw time chars
char cl_timestr[20]; char cl_timestr[20];
//TODO: please add comments!
bool paintClock; bool paintClock;
bool activeClock; bool activeClock;
///font ///object: font render object
int cl_font_type;
///fontrenderer object
Font *cl_font; Font *cl_font;
///text color ///text color
int cl_col_text; int cl_col_text;
@@ -88,7 +87,7 @@ class CComponentsFrmClock : public CComponentsForm
~CComponentsFrmClock(); ~CComponentsFrmClock();
///set font type for segments ///set font type for segments
void setClockFontType(const int& font_type){cl_font_type = font_type;}; void setClockFont(Font *font){cl_font = font;};
///set text color ///set text color
void setTextColor(fb_pixel_t color_text){ cl_col_text = color_text;}; void setTextColor(fb_pixel_t color_text){ cl_col_text = color_text;};

View File

@@ -589,7 +589,7 @@ int CTestMenu::exec(CMenuTarget* parent, const std::string &actionKey)
else if (actionKey == "running_clock"){ else if (actionKey == "running_clock"){
if (clock_r == NULL){ if (clock_r == NULL){
clock_r = new CComponentsFrmClock(100, 50, 0, 50, "%H.%M:%S"); clock_r = new CComponentsFrmClock(100, 50, 0, 50, "%H.%M:%S");
clock_r->setClockFontType(SNeutrinoSettings::FONT_TYPE_INFOBAR_CHANNAME); clock_r->setClockFont(g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_CHANNAME]);
clock_r->setClockIntervall(1); clock_r->setClockIntervall(1);
// clock_r->doPaintBg(false); // clock_r->doPaintBg(false);
} }
@@ -610,7 +610,7 @@ int CTestMenu::exec(CMenuTarget* parent, const std::string &actionKey)
else if (actionKey == "clock"){ else if (actionKey == "clock"){
if (clock == NULL){ if (clock == NULL){
clock = new CComponentsFrmClock(100, 50, 0, 50, "%H:%M", false); clock = new CComponentsFrmClock(100, 50, 0, 50, "%H:%M", false);
clock->setClockFontType(SNeutrinoSettings::FONT_TYPE_INFOBAR_CHANNAME); clock->setClockFont(g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_CHANNAME]);
} }
if (!clock->isPainted()) if (!clock->isPainted())