From 28904b79c742555f34bc2b4ca0ba92b8d96077f3 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Tue, 25 Sep 2012 15:32:33 +0200 Subject: [PATCH] ComponentsInfoBox: arange text to the left border if no picture is painted changed isPainted() to isPicPainted(), return of isPicPainted() value was not marked-down to false and isPainted() means the container frame and isPicPainted() means the picture itself, so the last state was wrong. Now it should work fine. Btw: scope of x_text reduced, is only required in member paintText() --- src/gui/components/cc.h | 2 +- src/gui/components/components.cpp | 10 ++++++---- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/gui/components/cc.h b/src/gui/components/cc.h index 24f12959b..fff3d4169 100644 --- a/src/gui/components/cc.h +++ b/src/gui/components/cc.h @@ -222,7 +222,7 @@ class CComponentsInfoBox : public CComponentsContainer private: const char* text; int text_mode; //see textbox.h for possible modes - int x_text, x_offset; + int x_offset; Font* font; CBox * box; CTextBox * textbox; diff --git a/src/gui/components/components.cpp b/src/gui/components/components.cpp index a4172cc8b..2e71f29e7 100644 --- a/src/gui/components/components.cpp +++ b/src/gui/components/components.cpp @@ -325,7 +325,6 @@ void CComponentsInfoBox::initVarInfobox() textbox = NULL; pic = NULL; pic_name = ""; - x_text = x; x_offset = 10; } @@ -361,8 +360,10 @@ void CComponentsInfoBox::paintText() box = new CBox(); //define text x position - x_text = x+fr_thickness+x_offset; - if (pic->isPainted()){ + int x_text = x+fr_thickness+x_offset; + + //set text to the left border if picture not painted + if (pic->isPicPainted()){ int pic_w = pic->getWidth(); x_text += pic_w+x_offset; } @@ -383,7 +384,7 @@ void CComponentsInfoBox::paintText() //set properties textbox->setTextFont(font); - textbox->movePosition(box->iX, box->iY); + textbox->setWindowPos(box); textbox->setTextColor(ibox_col_text); //set text @@ -765,6 +766,7 @@ void CComponentsPicture::paint(bool do_save_bg) { initVarPicture(); paintInit(do_save_bg); + pic_painted = false; if (do_paint){ if (picMode == CC_PIC_ICON)