mirror of
https://github.com/tuxbox-neutrino/neutrino.git
synced 2025-08-28 07:51:19 +02:00
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:
@@ -82,15 +82,10 @@ void CComponentsText::initVarText( const int x_pos, const int y_pos, const int w
|
|||||||
ct_old_text = ct_text;
|
ct_old_text = ct_text;
|
||||||
ct_text_mode = mode;
|
ct_text_mode = mode;
|
||||||
|
|
||||||
x = x_pos;
|
iX = x = x_pos;
|
||||||
y = y_pos;
|
iY = y = y_pos;
|
||||||
width = w;
|
iWidth=width = w;
|
||||||
height = h;
|
iHeight=height = h;
|
||||||
|
|
||||||
pX = &x;
|
|
||||||
pY = &y;
|
|
||||||
pHeight = &height;
|
|
||||||
pWidth = &width;
|
|
||||||
|
|
||||||
/* we need a minimal borderwith of 1px because the edge-smoothing
|
/* we need a minimal borderwith of 1px because the edge-smoothing
|
||||||
(or fontrenderer?) otherwise will paint single pixels outside the
|
(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];
|
ct_font = g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_SMALL];
|
||||||
|
|
||||||
//define height from font size
|
//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
|
//init CBox dimensions
|
||||||
int tx = x, ty = y;
|
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){
|
if (cc_parent){
|
||||||
tx = cc_xr;
|
int th_parent_fr = cc_parent->getFrameThickness();
|
||||||
ty = cc_yr;
|
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
|
//init textbox
|
||||||
if (ct_textbox == NULL)
|
if (ct_textbox == NULL)
|
||||||
@@ -148,8 +144,8 @@ void CComponentsText::initCCText()
|
|||||||
ct_textbox->setBackGroundColor(col_body);
|
ct_textbox->setBackGroundColor(col_body);
|
||||||
ct_textbox->setBackGroundRadius(corner_rad-fr_thickness, corner_type);
|
ct_textbox->setBackGroundRadius(corner_rad-fr_thickness, corner_type);
|
||||||
ct_textbox->setTextColor(ct_col_text);
|
ct_textbox->setTextColor(ct_col_text);
|
||||||
ct_textbox->setWindowMaxDimensions(width, height);
|
ct_textbox->setWindowMaxDimensions(iWidth, iHeight);
|
||||||
ct_textbox->setWindowMinDimensions(width, height);
|
ct_textbox->setWindowMinDimensions(iWidth, iHeight);
|
||||||
|
|
||||||
//observe behavior of parent form if available
|
//observe behavior of parent form if available
|
||||||
bool force_text_paint = ct_force_text_paint;
|
bool force_text_paint = ct_force_text_paint;
|
||||||
|
Reference in New Issue
Block a user