CComponentsText: fix fit of textbox object inside cc text object dimensions

Position related to parent container was wrong. Some variables were
unused and removed.
This commit is contained in:
2014-05-04 19:18:55 +02:00
parent 6ba757bd9d
commit f4447b38e0

View File

@@ -82,15 +82,10 @@ void CComponentsText::initVarText( const int x_pos, const int y_pos, const int w
ct_old_text = ct_text;
ct_text_mode = mode;
x = x_pos;
y = y_pos;
width = w;
height = h;
pX = &x;
pY = &y;
pHeight = &height;
pWidth = &width;
iX = x = x_pos;
iY = y = y_pos;
iWidth=width = w;
iHeight=height = h;
/* we need a minimal borderwith of 1px because the edge-smoothing
(or fontrenderer?) otherwise will paint single pixels outside the
@@ -121,19 +116,20 @@ void CComponentsText::initCCText()
ct_font = g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_SMALL];
//define height from font size
height = max(height, ct_font->getHeight());
height = max(height, ct_font->getHeight());
//using of real x/y values to paint images if this text object is bound in a parent form
int tx = x, ty = y;
//init CBox dimensions
iWidth = width-2*fr_thickness;
iHeight = height-2*fr_thickness;
iX = x + fr_thickness;
iY = y + fr_thickness;
//using of real x/y values to paint textbox if this text object is bound in a parent form
if (cc_parent){
tx = cc_xr;
ty = cc_yr;
int th_parent_fr = cc_parent->getFrameThickness();
iX = cc_xr + (x <= th_parent_fr ? th_parent_fr : 0);
iY = cc_yr + (y <= th_parent_fr ? th_parent_fr : 0);
}
//init text box dimensions
this->iX/*x*/ = tx+fr_thickness;
this->iY/*y*/ = ty+fr_thickness;
this->iWidth/*width*/ = width-2*fr_thickness;
this->iHeight/*height*/ = height-2*fr_thickness;
//init textbox
if (ct_textbox == NULL)
@@ -148,8 +144,8 @@ void CComponentsText::initCCText()
ct_textbox->setBackGroundColor(col_body);
ct_textbox->setBackGroundRadius(corner_rad-fr_thickness, corner_type);
ct_textbox->setTextColor(ct_col_text);
ct_textbox->setWindowMaxDimensions(width, height);
ct_textbox->setWindowMinDimensions(width, height);
ct_textbox->setWindowMaxDimensions(iWidth, iHeight);
ct_textbox->setWindowMinDimensions(iWidth, iHeight);
//observe behavior of parent form if available
bool force_text_paint = ct_force_text_paint;