mirror of
https://github.com/tuxbox-neutrino/neutrino.git
synced 2025-08-29 16:31:11 +02:00
CComponentsHeader: cleanup
-remove variable userHeight, is not used -change name of parameter in member initCaptionFont(), "font_name" is not a suitable name for a type object.
This commit is contained in:
@@ -83,17 +83,11 @@ void CComponentsHeader::initVarHeader( const int& x_pos, const int& y_pos, const
|
||||
//init header width
|
||||
width = w == 0 ? frameBuffer->getScreenWidth(true) : w;
|
||||
|
||||
//init header height
|
||||
cch_size_mode = CC_HEADER_SIZE_LARGE;
|
||||
cch_font = g_Font[SNeutrinoSettings::FONT_TYPE_MENU_TITLE];
|
||||
if (h > 0) {
|
||||
userHeight = true;
|
||||
height = h;
|
||||
}
|
||||
else{
|
||||
userHeight = false;
|
||||
height = cch_font->getHeight();
|
||||
}
|
||||
//init header default height
|
||||
height = max(h, g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->getHeight());
|
||||
|
||||
cch_size_mode = CC_HEADER_SIZE_LARGE;
|
||||
initCaptionFont(); //sets cch_font and calculate height if required;
|
||||
|
||||
shadow = has_shadow;
|
||||
col_frame = color_frame;
|
||||
@@ -145,10 +139,29 @@ void CComponentsHeader::setCaption(neutrino_locale_t caption_locale, const int&
|
||||
cch_caption_align = align_mode;
|
||||
}
|
||||
|
||||
void CComponentsHeader::setCaptionFont(Font* font_name)
|
||||
void CComponentsHeader::setCaptionFont(Font* font)
|
||||
{
|
||||
cch_font = font_name;
|
||||
height = std::max(height, cch_font->getHeight());
|
||||
initCaptionFont(font); //cch_font = font
|
||||
}
|
||||
|
||||
void CComponentsHeader::initCaptionFont(Font* font)
|
||||
{
|
||||
Font *l_font = g_Font[SNeutrinoSettings::FONT_TYPE_MENU_TITLE];
|
||||
Font *s_font = g_Font[SNeutrinoSettings::FONT_TYPE_MENU];
|
||||
|
||||
if (font == NULL){
|
||||
cch_font = (cch_size_mode == CC_HEADER_SIZE_LARGE? l_font : s_font);
|
||||
|
||||
//select matching height
|
||||
if (cch_size_mode == CC_HEADER_SIZE_LARGE)
|
||||
height = std::max(height, l_font->getHeight());
|
||||
else
|
||||
height = std::min(height, s_font->getHeight());
|
||||
}
|
||||
else{
|
||||
cch_font = font;
|
||||
height = std::max(height, cch_font->getHeight());
|
||||
}
|
||||
}
|
||||
|
||||
void CComponentsHeader::setIcon(const char* icon_name)
|
||||
@@ -378,11 +391,8 @@ void CComponentsHeader::initCaption()
|
||||
void CComponentsHeader::initCCItems()
|
||||
{
|
||||
//set size
|
||||
if (!userHeight) {
|
||||
cch_font = (cch_size_mode == CC_HEADER_SIZE_LARGE? g_Font[SNeutrinoSettings::FONT_TYPE_MENU_TITLE] : g_Font[SNeutrinoSettings::FONT_TYPE_MENU]);
|
||||
height = cch_font->getHeight();
|
||||
}
|
||||
|
||||
initCaptionFont();
|
||||
|
||||
//init icon
|
||||
initIcon();
|
||||
|
||||
|
@@ -89,8 +89,8 @@ class CComponentsHeader : public CComponentsForm
|
||||
///property: alignment of caption within header, see also setCaptionAlignment(), possible values are CTextBox::CENTER, default = CTextBox::NO_AUTO_LINEBREAK (left)
|
||||
int cch_caption_align;
|
||||
|
||||
bool userHeight;
|
||||
|
||||
///init font object and recalculates height if required
|
||||
void initCaptionFont(Font* font = NULL);
|
||||
///sub: init icon object
|
||||
void initIcon();
|
||||
///sub: init caption object
|
||||
@@ -130,7 +130,7 @@ class CComponentsHeader : public CComponentsForm
|
||||
///set alignment of caption within header, possible paramters are CTextBox::CENTER, CTextBox::NO_AUTO_LINEBREAK
|
||||
virtual void setCaptionAlignment(const int& align_mode){cch_caption_align = align_mode;};
|
||||
///set text font object for caption
|
||||
virtual void setCaptionFont(Font* font_name);
|
||||
virtual void setCaptionFont(Font* font);
|
||||
///set text color for caption
|
||||
virtual void setCaptionColor(fb_pixel_t text_color){cch_col_text = text_color;};
|
||||
|
||||
@@ -165,7 +165,7 @@ class CComponentsHeader : public CComponentsForm
|
||||
CC_HEADER_SIZE_SMALL = 1
|
||||
};
|
||||
///set size of header, possible values are CC_HEADER_SIZE_LARGE, CC_HEADER_SIZE_SMALL
|
||||
virtual void setSizeMode(const int& size_mode){cch_size_mode = size_mode;};
|
||||
virtual void setSizeMode(const int& size_mode){cch_size_mode = size_mode; initCCItems();};
|
||||
|
||||
///init all items within header object
|
||||
virtual void initCCItems();
|
||||
|
Reference in New Issue
Block a user