Merge branch 'master' into pu/fb-setmode

This commit is contained in:
2017-05-28 13:36:46 +02:00

View File

@@ -112,7 +112,7 @@ void CComponentsButton::initVarButton( const int& x_pos, const int& y_pos, const
cc_item_enabled = enabled;
cc_item_selected = selected;
fr_thickness = 0; //TODO: parts of the GUI still don't use framed buttons
append_x_offset = 6;
append_x_offset = OFFSET_INTER;
append_y_offset = 0;
corner_rad = RADIUS_SMALL;
@@ -187,6 +187,7 @@ void CComponentsButton::initCaption()
}
//set basic properties
int x_offset = (!cc_btn_text_obj || !cc_btn_icon_obj) ? 0 : append_x_offset;
int w_frame = fr_thickness;
int reduce = 2*w_frame;
if (cc_btn_text_obj){
@@ -198,7 +199,7 @@ void CComponentsButton::initCaption()
if (cc_btn_font == NULL)
cc_btn_font = g_Font[SNeutrinoSettings::FONT_TYPE_BUTTON_TEXT];
int w_cap = min(width - append_x_offset - x_cap - reduce, cc_btn_font->getRenderWidth(cc_btn_text));
int w_cap = min(width - 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
@@ -235,10 +236,10 @@ void CComponentsButton::initCaption()
}
//handle common position of icon and text inside container required for alignment
int w_required = w_frame + append_x_offset;
w_required += cc_btn_icon_obj ? cc_btn_icon_obj->getWidth() + append_x_offset : 0;
int w_required = w_frame + x_offset;
w_required += cc_btn_icon_obj ? cc_btn_icon_obj->getWidth() + x_offset : 0;
w_required += cc_btn_font ? cc_btn_font->getRenderWidth(cc_btn_text) : 0;
w_required += append_x_offset + w_frame;
w_required += x_offset + w_frame;
//dynamic width
if (w_required > width){
@@ -247,10 +248,10 @@ void CComponentsButton::initCaption()
}
//do center
int x_icon = width/2 - w_required/2 /*+ fr_thickness + append_x_offset*/;
int x_icon = width/2 - w_required/2 /*+ fr_thickness + x_offset*/;
int w_icon = 0;
if (cc_btn_icon_obj){
x_icon += w_frame + append_x_offset;
x_icon += w_frame + x_offset;
cc_btn_icon_obj->setXPos(x_icon);
w_icon = cc_btn_icon_obj->getWidth();
/*in case of dynamic changed height of caption or button opbject itself,
@@ -260,7 +261,7 @@ void CComponentsButton::initCaption()
cc_btn_icon_obj->setYPos(y_icon);
}
if (cc_btn_text_obj){
cc_btn_text_obj->setXPos(x_icon + w_icon + append_x_offset);
cc_btn_text_obj->setXPos(x_icon + w_icon + x_offset);
cc_btn_text_obj->setWidth(width - cc_btn_text_obj->getXPos());
}
}