Conflicts:
	src/neutrino.cpp


Origin commit data
------------------
Commit: eee55893c6
Author: vanhofen <vanhofen@gmx.de>
Date: 2017-01-05 (Thu, 05 Jan 2017)
This commit is contained in:
vanhofen
2017-01-05 23:07:16 +01:00
15 changed files with 93 additions and 56 deletions

View File

@@ -120,7 +120,7 @@ void CComponentsButton::initVarButton( const int& x_pos, const int& y_pos, const
cc_btn_icon_obj = NULL;
cc_btn_text_obj = NULL;
cc_btn_dy_font = CNeutrinoFonts::getInstance();
cc_btn_font = g_Font[SNeutrinoSettings::FONT_TYPE_BUTTON_TEXT];
cc_btn_font = NULL;
cc_btn_icon = icon_name;
cc_btn_text = caption;
cc_directKey = CRCInput::RC_nokey;
@@ -188,6 +188,7 @@ void CComponentsButton::initCaption()
//set basic properties
int w_frame = fr_thickness;
int reduce = 2*w_frame;
if (cc_btn_text_obj){
//position and size
int x_cap = w_frame;
@@ -197,8 +198,8 @@ void CComponentsButton::initCaption()
if (cc_btn_font == NULL)
cc_btn_font = g_Font[SNeutrinoSettings::FONT_TYPE_BUTTON_TEXT];
int w_cap = width - w_frame - append_x_offset - x_cap - w_frame;
int h_cap = min(height - 2*w_frame, cc_btn_font->getHeight());
int w_cap = min(width - append_x_offset - x_cap - reduce, cc_btn_font->getRenderWidth(cc_btn_text));
int h_cap = min(height - reduce, cc_btn_font->getHeight());
/*NOTE:
paint of centered text in y direction without y_offset
looks unlovely displaced in y direction especially besides small icons and inside small areas,
@@ -210,13 +211,17 @@ void CComponentsButton::initCaption()
cc_btn_text_obj->setDimensionsAll(x_cap, y_cap, w_cap, h_cap);
//text and font
Font* def_font = *cc_btn_dy_font->getDynFont(w_cap, h_cap, cc_btn_text);
/* If button dimension too small, use dynamic font, this ignores possible defined font
* Otherwise definied font will be used. Button dimensions are calculated from parent container (e.g. footer...).
* These dimensions must be enough to display complete content like possible icon and without truncated text.
*/
if ((cc_btn_font->getHeight()- 2*w_frame) > h_cap && (cc_btn_font->getRenderWidth(cc_btn_text)- 2*w_frame) > w_cap)
cc_btn_font = def_font;
Font *tmp_font = cc_btn_font;
if ((tmp_font->getHeight()-reduce) > (height-reduce) && (tmp_font->getRenderWidth(cc_btn_text)-reduce) > width-reduce)
tmp_font = *cc_btn_dy_font->getDynFont(w_cap, h_cap, cc_btn_text);
if ((cc_btn_font->getHeight()-reduce) > (height-reduce))
tmp_font = *cc_btn_dy_font->getDynFont(w_cap, h_cap, cc_btn_text);
cc_btn_font = tmp_font;
cc_btn_text_obj->setText(cc_btn_text, CTextBox::NO_AUTO_LINEBREAK, cc_btn_font);
cc_btn_text_obj->forceTextPaint(); //here required;

View File

@@ -137,11 +137,14 @@ void CComponentsFooter::setButtonLabels(const struct button_label_s * const cont
* With this container we can work inside footer as primary container (in this context '=this') and the parent for the button label container (chain object).
* Button label container (chain object) itself is concurrent to the parent object for button objects.
*/
int dist = height/2-cch_offset;
int h_chain = ccf_btn_font->getHeight() > height+dist ? height-dist : ccf_btn_font->getHeight()+dist;
int x_chain = width/2 - w_chain/2;
int y_chain = height/2 - h_chain/2;
if (cch_icon_obj)
x_chain = cch_offset+cch_icon_obj->getWidth()+cch_offset;
if (chain == NULL){
chain = new CComponentsFrmChain(x_chain, 0, w_chain, height, 0, CC_DIR_X, this, CC_SHADOW_OFF, COL_MENUCONTENT_PLUS_6, col_body);
chain = new CComponentsFrmChain(x_chain, y_chain, w_chain, h_chain, 0, CC_DIR_X, this, CC_SHADOW_OFF, COL_MENUCONTENT_PLUS_6, col_body);
chain->setAppendOffset(0, 0);
chain->setCorner(this->corner_rad, this->corner_type);
chain->doPaintBg(false);
@@ -172,7 +175,7 @@ void CComponentsFooter::setButtonLabels(const struct button_label_s * const cont
* with default width to chain object.
*/
vector<CComponentsItem*> v_btns;
int h_btn = /*(ccf_enable_button_bg ? */(height*85/100)-2*fr_thickness-OFFSET_INNER_SMALL/* : height)*/-ccf_button_shadow_width;
int h_btn = /*(ccf_enable_button_bg ? */chain->getHeight()-2*fr_thickness/*-OFFSET_INNER_SMALL*//* : height)*/-ccf_button_shadow_width;
for (size_t i= 0; i< label_count; i++){
string txt = content[i].text;
string icon_name = string(content[i].button);
@@ -426,7 +429,8 @@ void CComponentsFooter::enableButtonShadow(int mode, const int& shadow_width, bo
if (chain){
for(size_t i=0; i<chain->size(); i++){
chain->getCCItem(i)->enableShadow(ccf_enable_button_shadow, ccf_button_shadow_width, ccf_button_shadow_force_paint);
int y_btn = ccf_enable_button_shadow == CC_SHADOW_OFF ? CC_CENTERED : chain->getHeight()/2 - chain->getCCItem(i)->getHeight()/2 - ccf_button_shadow_width;
//int y_btn = ccf_enable_button_shadow == CC_SHADOW_OFF ? CC_CENTERED : chain->getHeight()/2 - chain->getCCItem(i)->getHeight()/2 - ccf_button_shadow_width;
int y_btn = chain->getHeight()/2 - chain->getCCItem(i)->getHeight()/2;
chain->getCCItem(i)->setYPos(y_btn);
}
}

View File

@@ -204,7 +204,7 @@ class CComponentsFooter : public CComponentsHeader
const struct button_label * const content,
const int& label_width = 0,
const int& context_buttons = 0,
Font* font = g_Font[SNeutrinoSettings::FONT_TYPE_MENU_FOOT],
Font* font = g_Font[SNeutrinoSettings::FONT_TYPE_BUTTON_TEXT],
bool do_save_bg = CC_SAVE_SCREEN_NO
);