diff --git a/src/gui/bedit/bouqueteditor_bouquets.cpp b/src/gui/bedit/bouqueteditor_bouquets.cpp index f09ad4a66..9c7017a46 100644 --- a/src/gui/bedit/bouqueteditor_bouquets.cpp +++ b/src/gui/bedit/bouqueteditor_bouquets.cpp @@ -97,22 +97,22 @@ void CBEBouquetWidget::paintItem(int pos) if (current < Bouquets->size()) { if ((i_selected) && (state == beMoving)) - frameBuffer->paintIcon(NEUTRINO_ICON_BUTTON_YELLOW, x + 5, ypos, iheight); + frameBuffer->paintIcon(NEUTRINO_ICON_BUTTON_YELLOW, x + OFFSET_INNER_MID, ypos, iheight); if ((*Bouquets)[current]->bHidden) - frameBuffer->paintIcon(NEUTRINO_ICON_HIDDEN, x + 26, ypos, iheight); + frameBuffer->paintIcon(NEUTRINO_ICON_HIDDEN, x + OFFSET_INNER_MID + iconoffset, ypos, iheight); if ((*Bouquets)[current]->bLocked != g_settings.parentallock_defaultlocked) - frameBuffer->paintIcon(NEUTRINO_ICON_LOCK, x + 18 + iconoffset, ypos, iheight); + frameBuffer->paintIcon(NEUTRINO_ICON_LOCK, x + OFFSET_INNER_MID + 2*iconoffset, ypos, iheight); if (!(*Bouquets)[current]->tvChannels.empty() ) { - frameBuffer->paintIcon(NEUTRINO_ICON_VIDEO, x + 20 + 2*iconoffset - 2, ypos, iheight); + frameBuffer->paintIcon(NEUTRINO_ICON_VIDEO, x + OFFSET_INNER_MID + 3*iconoffset, ypos, iheight); } if (!(*Bouquets)[current]->radioChannels.empty()) { - frameBuffer->paintIcon(NEUTRINO_ICON_AUDIO, x + 20+ 3*iconoffset - 4, ypos, iheight); + frameBuffer->paintIcon(NEUTRINO_ICON_AUDIO, x + OFFSET_INNER_MID + 4*iconoffset, ypos, iheight); } - g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST]->RenderString(x +20 + 4*iconoffset, ypos + iheight - (iheight-fheight)/2, width-iconoffset-20, (*Bouquets)[current]->bFav ? g_Locale->getText(LOCALE_FAVORITES_BOUQUETNAME) : (*Bouquets)[current]->Name, color); + g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST]->RenderString(x + 2*OFFSET_INNER_MID + 5*iconoffset, ypos + iheight - (iheight-fheight)/2, width - 3*OFFSET_INNER_MID - 5*iconoffset, (*Bouquets)[current]->bFav ? g_Locale->getText(LOCALE_FAVORITES_BOUQUETNAME) : (*Bouquets)[current]->Name, color); } } @@ -203,21 +203,31 @@ int CBEBouquetWidget::exec(CMenuTarget* parent, const std::string & /*actionKey* int icol_w, icol_h; frameBuffer->getIconSize(NEUTRINO_ICON_BUTTON_YELLOW, &icol_w, &icol_h); - iheight = std::max(fheight, icol_h+2); + iheight = std::max(fheight, icol_h + OFFSET_INNER_MIN); iconoffset = std::max(iconoffset, icol_w); frameBuffer->getIconSize(NEUTRINO_ICON_LOCK, &icol_w, &icol_h); - iheight = std::max(iheight, icol_h+2); + iheight = std::max(fheight, icol_h + OFFSET_INNER_MIN); iconoffset = std::max(iconoffset, icol_w); frameBuffer->getIconSize(NEUTRINO_ICON_HIDDEN, &icol_w, &icol_h); - iheight = std::max(iheight, icol_h+2); + iheight = std::max(fheight, icol_h + OFFSET_INNER_MIN); + iconoffset = std::max(iconoffset, icol_w); + + frameBuffer->getIconSize(NEUTRINO_ICON_VIDEO, &icol_w, &icol_h); + iheight = std::max(fheight, icol_h + OFFSET_INNER_MIN); + iconoffset = std::max(iconoffset, icol_w); + + frameBuffer->getIconSize(NEUTRINO_ICON_AUDIO, &icol_w, &icol_h); + iheight = std::max(fheight, icol_h + OFFSET_INNER_MIN); iconoffset = std::max(iconoffset, icol_w); width = frameBuffer->getScreenWidthRel(); height = frameBuffer->getScreenHeightRel() - ButtonHeight; - listmaxshow = (height-theight-0)/iheight; - height = theight+0+listmaxshow*iheight; // recalc height + + listmaxshow = (height-theight)/iheight; + height = theight+listmaxshow*iheight; // recalc height + x = getScreenStartX(width); y = getScreenStartY(height + ButtonHeight); diff --git a/src/gui/bedit/bouqueteditor_channels.cpp b/src/gui/bedit/bouqueteditor_channels.cpp index 38310c319..03f3776d8 100644 --- a/src/gui/bedit/bouqueteditor_channels.cpp +++ b/src/gui/bedit/bouqueteditor_channels.cpp @@ -125,19 +125,19 @@ void CBEChannelWidget::paintItem(int pos) frameBuffer->paintBoxRel(x, ypos, width- 15, iheight, bgcolor, i_radius); if ((current == selected) && (state == beMoving)) { - frameBuffer->paintIcon(NEUTRINO_ICON_BUTTON_YELLOW, x + 5, ypos, iheight); + frameBuffer->paintIcon(NEUTRINO_ICON_BUTTON_YELLOW, x + OFFSET_INNER_MID, ypos, iheight); } if (current < Channels->size()) { if ((*Channels)[current]->bLocked) { - frameBuffer->paintIcon(NEUTRINO_ICON_LOCK, x + 22, ypos, iheight); + frameBuffer->paintIcon(NEUTRINO_ICON_LOCK, x + OFFSET_INNER_MID + iconoffset, ypos, iheight); } //g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST]->RenderString(x+ 5+ numwidth+ 10, ypos+ fheight, width- numwidth- 20- 15, (*Channels)[current]->getName(), color); //FIXME numwidth ? we not show chan numbers - g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST]->RenderString(x+ 22 + iconoffset, ypos + iheight - (iheight-fheight)/2, width- iconoffset- 20, (*Channels)[current]->getName(), color); + g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST]->RenderString(x + 2*OFFSET_INNER_MID + 2*iconoffset, ypos + iheight - (iheight-fheight)/2, width - 3*OFFSET_INNER_MID - 2*iconoffset, (*Channels)[current]->getName(), color); if((*Channels)[current]->scrambled) - frameBuffer->paintIcon(NEUTRINO_ICON_SCRAMBLED, x+width- 15 - 28, ypos, fheight); + frameBuffer->paintIcon(NEUTRINO_ICON_SCRAMBLED, x + width - 15 - OFFSET_INNER_MID - iconoffset, ypos, fheight); else if (!(*Channels)[current]->getUrl().empty()) - frameBuffer->paintIcon(NEUTRINO_ICON_STREAMING, x+width- 15 - 28, ypos, fheight); + frameBuffer->paintIcon(NEUTRINO_ICON_STREAMING, x + width - 15 - OFFSET_INNER_MID - iconoffset, ypos, fheight); } } diff --git a/src/gui/bedit/bouqueteditor_chanselect.cpp b/src/gui/bedit/bouqueteditor_chanselect.cpp index 79896b0b1..c60372450 100644 --- a/src/gui/bedit/bouqueteditor_chanselect.cpp +++ b/src/gui/bedit/bouqueteditor_chanselect.cpp @@ -135,15 +135,15 @@ void CBEChannelSelectWidget::paintItem(uint32_t itemNr, int paintNr, bool pselec if(itemNr < getItemCount()) { if( isChannelInBouquet(itemNr)) - frameBuffer->paintIcon(NEUTRINO_ICON_BUTTON_GREEN, x+10, ypos, iheight); + frameBuffer->paintIcon(NEUTRINO_ICON_BUTTON_GREEN, x + OFFSET_INNER_MID, ypos, iheight); else - frameBuffer->paintBoxRel(x+10, ypos, iconoffset, iheight, bgcolor); + frameBuffer->paintBoxRel(x + OFFSET_INNER_MID, ypos, iconoffset, iheight, bgcolor); - g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST]->RenderString(x + 20 + iconoffset, ypos + iheight - (iheight-fheight)/2, width - 20 - iconoffset, Channels[itemNr]->getName(), color); + g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST]->RenderString(x + 2*OFFSET_INNER_MID + 2*iconoffset, ypos + iheight - (iheight-fheight)/2, width - 3*OFFSET_INNER_MID - 2*iconoffset, Channels[itemNr]->getName(), color); if(Channels[itemNr]->scrambled) - frameBuffer->paintIcon(NEUTRINO_ICON_SCRAMBLED, x+width- 15 - 28, ypos, fheight); + frameBuffer->paintIcon(NEUTRINO_ICON_SCRAMBLED, x + width - 15 - OFFSET_INNER_MID - iconoffset, ypos, fheight); else if (!Channels[itemNr]->getUrl().empty()) - frameBuffer->paintIcon(NEUTRINO_ICON_STREAMING, x+width- 15 - 28, ypos, fheight); + frameBuffer->paintIcon(NEUTRINO_ICON_STREAMING, x + width - 15 - OFFSET_INNER_MID - iconoffset, ypos, fheight); } } diff --git a/src/gui/buildinfo.cpp b/src/gui/buildinfo.cpp index 3cc94094a..782edc07e 100644 --- a/src/gui/buildinfo.cpp +++ b/src/gui/buildinfo.cpp @@ -45,7 +45,7 @@ void CBuildInfo::initVarBuildInfo() { setCenterPos(); - font = NULL; + font = g_Font[SNeutrinoSettings::FONT_TYPE_MENU_HINT]; setWindowHeaderButtons(CComponentsHeader::CC_BTN_MENU | CComponentsHeader::CC_BTN_EXIT); InitInfoItems(); diff --git a/src/gui/components/cc_frm_ext_text.cpp b/src/gui/components/cc_frm_ext_text.cpp index 81354cc6c..645410ead 100644 --- a/src/gui/components/cc_frm_ext_text.cpp +++ b/src/gui/components/cc_frm_ext_text.cpp @@ -34,6 +34,13 @@ using namespace std; +CComponentsExtTextForm::CComponentsExtTextForm(CComponentsForm* parent) +{ + Font* t_font = g_Font[SNeutrinoSettings::FONT_TYPE_MENU_INFO]; + initVarExtTextForm(0, 0, 300, t_font->getHeight(), "", "", t_font, parent, CC_SHADOW_OFF, COL_MENUCONTENTINACTIVE_TEXT, COL_MENUCONTENT_TEXT, COL_FRAME_PLUS_0, COL_MENUCONTENT_PLUS_0, COL_SHADOW_PLUS_0); + initCCTextItems(); +} + CComponentsExtTextForm::CComponentsExtTextForm( const int& x_pos, const int& y_pos, const int& w, const int& h, const std::string& label_text, const std::string& text, Font* font_text, @@ -47,20 +54,19 @@ CComponentsExtTextForm::CComponentsExtTextForm( const int& x_pos, const int& y_p initCCTextItems(); } -CComponentsExtTextFormLocalized::CComponentsExtTextFormLocalized(const int& x_pos, const int& y_pos, const int& w, const int& h, - const neutrino_locale_t& locale_label_text, const neutrino_locale_t& locale_text, - Font* font_text, - CComponentsForm* parent, - int shadow_mode, - fb_pixel_t label_color, - fb_pixel_t text_color, - fb_pixel_t color_frame, fb_pixel_t color_body, fb_pixel_t color_shadow) - : CComponentsExtTextForm( x_pos, y_pos, w, h, - g_Locale->getText(locale_label_text), g_Locale->getText(locale_text), - font_text, - parent, - shadow_mode, - label_color, text_color, color_frame, color_body, color_shadow){}; +CComponentsExtTextForm::CComponentsExtTextForm( const int& x_pos, const int& y_pos, const int& w, const int& h, + neutrino_locale_t l_text, const std::string& text, + Font* font_text, + CComponentsForm* parent, + int shadow_mode, + fb_pixel_t label_color, + fb_pixel_t text_color, + fb_pixel_t color_frame, fb_pixel_t color_body, fb_pixel_t color_shadow) +{ + initVarExtTextForm(x_pos, y_pos, w, h, (string)g_Locale->getText(l_text), text, font_text, parent, shadow_mode, label_color, text_color, color_frame, color_body, color_shadow); + initCCTextItems(); +} + void CComponentsExtTextForm::initVarExtTextForm(const int& x_pos, const int& y_pos, const int& w, const int& h, const std::string& label_text, const std::string& text, @@ -81,9 +87,13 @@ void CComponentsExtTextForm::initVarExtTextForm(const int& x_pos, const int& y_p ccx_percent_label_w = DEF_LABEL_WIDTH_PERCENT; ccx_label_width = ccx_percent_label_w * width/100; ccx_text_width = width-ccx_label_width; - + height = h; - + if (height == 0) + height = DEF_HEIGHT; + + y_text = 0; + ccx_label_text = label_text; ccx_text = text; shadow = shadow_mode; @@ -95,8 +105,11 @@ void CComponentsExtTextForm::initVarExtTextForm(const int& x_pos, const int& y_p ccx_label_obj = NULL; ccx_text_obj = NULL; corner_type = 0; - int dx = 0, dy = DEF_HEIGHT; - ccx_font = font_text == NULL ? *(CNeutrinoFonts::getInstance()->getDynFont(dx, dy)) : g_Font[SNeutrinoSettings::FONT_TYPE_MENU_INFO]; + ccx_font = font_text; + if (ccx_font == NULL){ + int dx = 0, dy = height; + ccx_font = *(CNeutrinoFonts::getInstance()->getDynFont(dx, dy)); + } ccx_label_align = ccx_text_align = CTextBox::NO_AUTO_LINEBREAK; initParent(parent); @@ -120,9 +133,10 @@ void CComponentsExtTextForm::initLabel() //set properties if (ccx_label_obj){ ccx_label_width = (ccx_percent_label_w * width/100); + y_text = height/2 - height-2*fr_thickness; ccx_label_obj->setText(ccx_label_text, ccx_label_align, ccx_font); ccx_label_obj->setTextColor(ccx_label_color); - ccx_label_obj->setDimensionsAll(0, 0, ccx_label_width-2*fr_thickness, height-2*fr_thickness); + ccx_label_obj->setDimensionsAll(0, y_text, ccx_label_width-2*fr_thickness, height-2*fr_thickness); ccx_label_obj->setCorner(this->corner_rad, CORNER_LEFT); } } @@ -146,7 +160,7 @@ void CComponentsExtTextForm::initText() ccx_text_width = width-ccx_label_obj->getWidth(); ccx_text_obj->setText(ccx_text, ccx_text_align, ccx_font); ccx_text_obj->setTextColor(ccx_text_color); - ccx_text_obj->setDimensionsAll(CC_APPEND, 0, ccx_text_width-2*fr_thickness, height-2*fr_thickness); + ccx_text_obj->setDimensionsAll(ccx_label_obj->getWidth(), y_text, ccx_text_width-2*fr_thickness, height-2*fr_thickness); ccx_text_obj->setCorner(this->corner_rad, CORNER_RIGHT); } } diff --git a/src/gui/components/cc_frm_ext_text.h b/src/gui/components/cc_frm_ext_text.h index aa148599f..837eb8c18 100644 --- a/src/gui/components/cc_frm_ext_text.h +++ b/src/gui/components/cc_frm_ext_text.h @@ -51,6 +51,8 @@ class CComponentsExtTextForm : public CComponentsForm, public CCTextScreen Font* ccx_font; ///property: percentage val of label width related to full width, causes fit of text automatically into the available remaining size of item, see also setLabelWidthPercent() uint8_t ccx_percent_label_w; + ///centered y position of label and text + int y_text; ///object: label object CComponentsLabel *ccx_label_obj; @@ -79,7 +81,9 @@ class CComponentsExtTextForm : public CComponentsForm, public CCTextScreen public: ///advanced constructor for CComponentsExtTextForm, provides parameters for the most required properties, and caption as string - CComponentsExtTextForm( const int& x_pos = 1, const int& y_pos = 1, const int& w = 300, const int& h = 48, + CComponentsExtTextForm(CComponentsForm* parent = NULL); + + CComponentsExtTextForm( const int& x_pos, const int& y_pos, const int& w, const int& h, const std::string& label_text = "", const std::string& text = "", Font* font_text = NULL, CComponentsForm *parent = NULL, @@ -89,6 +93,17 @@ class CComponentsExtTextForm : public CComponentsForm, public CCTextScreen fb_pixel_t color_frame = COL_FRAME_PLUS_0, fb_pixel_t color_body = COL_MENUCONTENT_PLUS_0, fb_pixel_t color_shadow = COL_SHADOW_PLUS_0); + + CComponentsExtTextForm( const int& x_pos, const int& y_pos, const int& w, const int& h, + neutrino_locale_t l_text = NONEXISTANT_LOCALE, const std::string& text = "", + Font* font_text = NULL, + CComponentsForm *parent = NULL, + int shadow_mode = CC_SHADOW_OFF, + fb_pixel_t label_color = COL_MENUCONTENTINACTIVE_TEXT, + fb_pixel_t text_color = COL_MENUCONTENT_TEXT, + fb_pixel_t color_frame = COL_FRAME_PLUS_0, + fb_pixel_t color_body = COL_MENUCONTENT_PLUS_0, + fb_pixel_t color_shadow = COL_SHADOW_PLUS_0); // ~CComponentsExtTextForm(); //inherited from CComponentsForm ///assigns texts for label and text, parameter as string, parameter Font is optional for required font type, default font is dependently from defined item height @@ -142,20 +157,4 @@ class CComponentsExtTextForm : public CComponentsForm, public CCTextScreen void paint(bool do_save_bg = CC_SAVE_SCREEN_YES); }; -class CComponentsExtTextFormLocalized : public CComponentsExtTextForm -{ - public: - ///advanced constructor for CComponentsExtTextForm, provides parameters for the most required properties, and caption as locales - CComponentsExtTextFormLocalized(const int& x_pos = 1, const int& y_pos = 1, const int& w = 300, const int& h = 48, - const neutrino_locale_t& locale_label_text = NONEXISTANT_LOCALE, const neutrino_locale_t& locale_text = NONEXISTANT_LOCALE, - Font* font_text = NULL, - CComponentsForm *parent = NULL, - int shadow_mode = CC_SHADOW_OFF, - fb_pixel_t label_color = COL_MENUCONTENTINACTIVE_TEXT, - fb_pixel_t text_color = COL_MENUCONTENT_TEXT, - fb_pixel_t color_frame = COL_FRAME_PLUS_0, - fb_pixel_t color_body = COL_MENUCONTENT_PLUS_0, - fb_pixel_t color_shadow = COL_SHADOW_PLUS_0); -}; - #endif diff --git a/src/gui/components/cc_frm_footer.cpp b/src/gui/components/cc_frm_footer.cpp index 4a1cbfc4e..9874a122b 100644 --- a/src/gui/components/cc_frm_footer.cpp +++ b/src/gui/components/cc_frm_footer.cpp @@ -79,7 +79,7 @@ void CComponentsFooter::initVarFooter( const int& x_pos, const int& y_pos, const col_frame = color_frame; col_body = color_body; col_shadow = color_shadow; - cc_body_gradient_enable = cc_body_gradient_enable_old = g_settings.theme.menu_ButtonBar_gradient; //TODO: not complete implemented at the moment + cc_body_gradient_enable = cc_body_gradient_enable_old = CC_COLGRAD_OFF/*g_settings.theme.menu_ButtonBar_gradient*/; //TODO: not complete implemented at the moment cc_body_gradient_direction = CFrameBuffer::gradientVertical; cc_body_gradient_mode = CColorGradient::gradientDark2Light; btn_auto_frame_col = false; @@ -362,8 +362,7 @@ void CComponentsFooter::setSelectedButton(size_t item_id, sel_col = sel_fr_col; //TODO: make it configurable chain->setSelectedItem(item_id, sel_col, fr_col, sel_bg_col, bg_col, frame_width, sel_frame_width); - if (chain->size() > 1) - getSelectedButtonObject()->setButtonTextColor(sel_text_col); + getSelectedButtonObject()->setButtonTextColor(sel_text_col); } } diff --git a/src/gui/components/cc_item_text.cpp b/src/gui/components/cc_item_text.cpp index c851a49fa..bf52a4f33 100644 --- a/src/gui/components/cc_item_text.cpp +++ b/src/gui/components/cc_item_text.cpp @@ -86,10 +86,11 @@ void CComponentsText::initVarText( const int x_pos, const int y_pos, const int w ct_text_mode = mode; ct_text_style = font_style; - iX = x = x_old = x_pos; //TODO: equalize inhertited member names - iY = y = y_old = y_pos; - iWidth = width_old = width = w; - iHeight = height_old = height = h; + fr_thickness = 0; + x = x_old = x_pos; + y = y_old = y_pos; + width = width_old = w; + height = height_old = h; /* we need a minimal borderwith of 1px because the edge-smoothing (or fontrenderer?) otherwise will paint single pixels outside the @@ -103,7 +104,7 @@ void CComponentsText::initVarText( const int x_pos, const int y_pos, const int w col_frame = color_frame; col_body = color_body; col_shadow = color_shadow; - fr_thickness = 0; + ct_text_sent = false; ct_paint_textbg = false; ct_force_text_paint = false; @@ -114,6 +115,27 @@ void CComponentsText::initVarText( const int x_pos, const int y_pos, const int w } +void CComponentsText::initCBox() +{ + x = max(0, x); + y = max(0, y); + + int x_box = x + fr_thickness; + int y_box = y + fr_thickness; + + if (cc_parent){ + ct_box.iX = cc_xr; + ct_box.iY = cc_yr; + }else{ + ct_box.iX = x_box; + ct_box.iY = y_box; + } + + ct_box.iWidth = width - 2*fr_thickness; + ct_box.iHeight = height - 2*fr_thickness; +} + + void CComponentsText::initCCText() { //set default font, if is no font definied @@ -121,41 +143,32 @@ void CComponentsText::initCCText() ct_font = g_Font[SNeutrinoSettings::FONT_TYPE_MENU_INFO]; //define height from font size - height = max(height, ct_font->getHeight()); - - //init CBox dimensions - iWidth = width-2*fr_thickness; - iHeight = height-2*fr_thickness; - - //using of real x/y values to paint textbox if this text object is bound in a parent form - if (cc_parent){ - 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); - }else{ - iX = x; - iY = y; - } - iX += fr_thickness; - iY += fr_thickness; + int h_tmp = ct_font->getHeight(); + height = max(height, h_tmp-2*fr_thickness); + if (width == 0) + width = max(width, CTextBox::getMaxLineWidth(ct_text, ct_font)-2*fr_thickness); //init textbox + initCBox(); + if (ct_textbox == NULL) ct_textbox = new CTextBox(); - //set text box properties + //set text properties ct_textbox->setTextFont(ct_font); ct_textbox->setTextMode(ct_text_mode); - ct_textbox->setWindowPos(this); + ct_textbox->setTextColor(ct_col_text); + ct_textbox->enableUTF8(ct_utf8_encoded); + + //set text box properties + ct_textbox->setWindowPos(&ct_box); + ct_textbox->setWindowMaxDimensions(ct_box.iWidth, ct_box.iHeight); + ct_textbox->setWindowMinDimensions(ct_box.iWidth, ct_box.iHeight); ct_textbox->setTextBorderWidth(ct_text_Hborder, ct_text_Vborder); ct_textbox->enableBackgroundPaint(ct_paint_textbg && !cc_txt_save_screen); ct_textbox->setBackGroundColor(col_body); - ct_textbox->setBackGroundRadius(corner_rad-fr_thickness, corner_type); - ct_textbox->setTextColor(ct_col_text); - ct_textbox->setWindowMaxDimensions(iWidth, iHeight); - ct_textbox->setWindowMinDimensions(iWidth, iHeight); + ct_textbox->setBackGroundRadius(0/*(corner_type ? corner_rad-fr_thickness : 0), corner_type*/); ct_textbox->enableSaveScreen(cc_txt_save_screen && !ct_paint_textbg); - ct_textbox->enableUTF8(ct_utf8_encoded); //observe behavior of parent form if available bool force_text_paint = ct_force_text_paint; @@ -169,7 +182,7 @@ void CComponentsText::initCCText() #endif //send text to CTextBox object, but force text paint text if force_text_paint option is enabled //this is managed by CTextBox object itself - ct_text_sent = ct_textbox->setText(&ct_text, this->iWidth, force_text_paint); + ct_text_sent = ct_textbox->setText(&ct_text, ct_box.iWidth, force_text_paint); //set current text status, needed by textChanged() if (ct_text_sent){ @@ -180,7 +193,7 @@ void CComponentsText::initCCText() //ensure clean font rendering on transparency background ct_textbox->setTextRenderModeFullBG(!paint_bg); -// dprintf(DEBUG_NORMAL, "[CComponentsText] [%s - %d] init text: %s [x %d x_old %d, y %d y_old %d, w %d, h %d]\n", __func__, __LINE__, ct_text.c_str(), this->x, x_old, this->y, y_old, this->iWidth, this->iHeight); +// dprintf(DEBUG_NORMAL, "[CComponentsText] [%s - %d] ct_text = %s, x = %d , x_old = %d , y = %d , y_old = %d , \nct_box.iWidth = %d , ct_box.iHeight = %d , width = %d , height = %d, corner_rad = %d\n", __func__, __LINE__, ct_text.c_str(), x, x_old, y, y_old, ct_box.iWidth, ct_box.iHeight, width, height, corner_rad); } void CComponentsText::clearCCText() @@ -287,25 +300,25 @@ void CComponentsText::hide() void CComponentsText::setXPos(const int& xpos) { CCDraw::setXPos(xpos); - iX = x; + initCBox(); } void CComponentsText::setYPos(const int& ypos) { CCDraw::setYPos(ypos); - iY = y; + initCBox(); } void CComponentsText::setHeight(const int& h) { CCDraw::setHeight(h); - iHeight = height; + initCBox(); } void CComponentsText::setWidth(const int& w) { CCDraw::setWidth(w); - iWidth = width; + initCBox(); } //small helper to remove excessiv linbreaks diff --git a/src/gui/components/cc_item_text.h b/src/gui/components/cc_item_text.h index dd26f02ad..7bd5f6372 100644 --- a/src/gui/components/cc_item_text.h +++ b/src/gui/components/cc_item_text.h @@ -40,11 +40,12 @@ Handling of text parts based up CTextBox attributes and methodes. CComponentsText provides a interface to the embedded CTextBox object. */ -class CComponentsText : public CCTextScreen, public CComponentsItem, public CBox +class CComponentsText : public CCTextScreen, public CComponentsItem { protected: ///object: CTextBox object CTextBox * ct_textbox; + CBox ct_box; ///object: Fontrenderer object Font * ct_font; ///property: font style @@ -96,6 +97,9 @@ class CComponentsText : public CCTextScreen, public CComponentsItem, public CBox ///initialize all required attributes for text and send to the CTextBox object void initCCText(); + ///init internal CBox object required by CTextBox object + void initCBox(); + ///paint CCItem backckrond (if paint_bg=true), apply initCCText() and send paint() to the CTextBox object void paintText(bool do_save_bg = CC_SAVE_SCREEN_YES); public: @@ -105,7 +109,7 @@ class CComponentsText : public CCTextScreen, public CComponentsItem, public CBox FONT_STYLE_ITALIC = 2 }; - CComponentsText( const int x_pos = 10, const int y_pos = 10, const int w = 150, const int h = 50, + CComponentsText( const int x_pos = 10, const int y_pos = 10, const int w = 0, const int h = 0, std::string text = "", const int mode = CTextBox::AUTO_WIDTH, Font* font_text = NULL, diff --git a/src/gui/imageinfo.cpp b/src/gui/imageinfo.cpp index feda1034f..6f946a3ab 100644 --- a/src/gui/imageinfo.cpp +++ b/src/gui/imageinfo.cpp @@ -72,7 +72,7 @@ void CImageInfo::Init(void) item_offset = 10; item_font = NULL; item_height = 0; - + y_tmp = 0; license_txt = ""; v_info.clear(); config.loadConfig(VERSION_FILE); @@ -351,8 +351,9 @@ void CImageInfo::InitInfos() cc_info->setWidth(cc_win->getWidth() - cc_tv->getWidth() - 2*item_offset); //create label and text items + y_tmp = 0; for (size_t i=0; igetWidth(), 0, g_Locale->getText(v_info[i].caption), v_info[i].info_text); + CComponentsExtTextForm *item = new CComponentsExtTextForm(1, y_tmp, cc_info->getWidth(), 0, g_Locale->getText(v_info[i].caption), v_info[i].info_text); item->setLabelWidthPercent(20); if (!item_font){ @@ -363,16 +364,13 @@ void CImageInfo::InitInfos() item->setHeight(item_height); cc_info->setHeight(v_info.size()*item_height); - if ((i == 0) && (item->getYPos() == CC_APPEND)) - item->setYPos(1); - //add ext-text object to window body if (!item->isAdded()) cc_info->addCCItem(item); //add an offset before homepage and license and at the end if (v_info[i].caption == LOCALE_IMAGEINFO_CREATOR || v_info[i].caption == LOCALE_IMAGEINFO_FORUM){ - CComponentsShapeSquare *spacer = new CComponentsShapeSquare(1, CC_APPEND, 1, item_offset); + CComponentsShapeSquare *spacer = new CComponentsShapeSquare(1, y_tmp+=item_offset, 1, item_offset); //spacer ist not visible! spacer->allowPaint(false); cc_info->addCCItem(spacer); @@ -380,6 +378,7 @@ void CImageInfo::InitInfos() int tmp_h = cc_info->getHeight(); cc_info->setHeight(tmp_h + item_offset); } + y_tmp += item->getHeight(); } } @@ -414,7 +413,7 @@ void CImageInfo::InitInfoText(const std::string& text) Font * caption_font = g_Font[SNeutrinoSettings::FONT_TYPE_MENU]; int caption_height = caption_font->getHeight(); if (cc_sub_caption == NULL) - cc_sub_caption = new CComponentsLabel(cc_info->getXPos(), CC_APPEND, cc_info->getWidth(), caption_height, + cc_sub_caption = new CComponentsLabel(cc_info->getXPos(), y_tmp, cc_info->getWidth(), caption_height, g_Locale->getText(LOCALE_IMAGEINFO_LICENSE), CTextBox::AUTO_WIDTH, item_font); if (!cc_sub_caption->isAdded()) cc_win->addWindowItem(cc_sub_caption); @@ -423,9 +422,9 @@ void CImageInfo::InitInfoText(const std::string& text) int h_txt = h_body - item_offset - cc_info->getHeight() - cc_sub_caption->getHeight() - item_offset; if (cc_lic == NULL) - cc_lic = new CComponentsInfoBox(CC_CENTERED, CC_APPEND, w_body-2*item_offset, h_txt); + cc_lic = new CComponentsInfoBox(CC_CENTERED, y_tmp+=cc_sub_caption->getHeight(), w_body-2*item_offset, h_txt); cc_lic->setSpaceOffset(1); - cc_lic->setText(text, CTextBox::TOP | CTextBox::AUTO_WIDTH | CTextBox::SCROLL, g_Font[SNeutrinoSettings::FONT_TYPE_MENU_HINT]); + cc_lic->setText(text, CTextBox::TOP | CTextBox::AUTO_WIDTH | CTextBox::SCROLL, item_font); cc_lic->doPaintTextBoxBg(true); //add text to container diff --git a/src/gui/imageinfo.h b/src/gui/imageinfo.h index a243866b4..9d6e399f8 100644 --- a/src/gui/imageinfo.h +++ b/src/gui/imageinfo.h @@ -50,7 +50,7 @@ class CImageInfo : public CMenuTarget std::string license_txt; Font* item_font; int item_height; - + int y_tmp; std::vector v_info; void Clean(); diff --git a/src/gui/test_menu.cpp b/src/gui/test_menu.cpp index c461a9afe..cd4b5116c 100644 --- a/src/gui/test_menu.cpp +++ b/src/gui/test_menu.cpp @@ -559,7 +559,7 @@ int CTestMenu::exec(CMenuTarget* parent, const std::string &actionKey) else if (actionKey == "text_ext"){ if (text_ext == NULL) text_ext = new CComponentsExtTextForm(); - text_ext->setDimensionsAll(10, 20, 300, 48); + text_ext->setDimensionsAll(10, 20, 300, g_Font[SNeutrinoSettings::FONT_TYPE_MENU_TITLE]->getHeight()); text_ext->setLabelAndText("Label", "Text for demo", g_Font[SNeutrinoSettings::FONT_TYPE_MENU_TITLE]); text_ext->setFrameThickness(2); // text_ext->setLabelWidthPercent(15/*%*/); diff --git a/src/gui/widget/msgbox.cpp b/src/gui/widget/msgbox.cpp index e2edcdeed..51480afa1 100644 --- a/src/gui/widget/msgbox.cpp +++ b/src/gui/widget/msgbox.cpp @@ -288,15 +288,19 @@ int CMsgBox::exec() mb_show_button = ccw_footer->getSelectedButtonObject()->getButtonAlias(); } selected = ccw_footer->getSelectedButton(); - refreshFoot(); - //refresh timeout on any pressed navi key! This resets current timeout end to the initial value + //***refresh buttons only if we have more than one button, this avoids unnecessary repaints with possible flicker effects*** + if (ccw_footer->getButtonChainObject()->size()>1) + refreshFoot(); + + //***refresh timeout on any pressed navi key! This resets current timeout end to initial value*** if (timeout > 0){ timeout_pb->setValues(0, timeout); timeoutEnd = CRCInput::calcTimeoutEnd(timeout); } dprintf(DEBUG_INFO, "\033[32m[CMsgBox] [%s - %d] result = %d, mb_show_button = %d\033[0m\n", __func__, __LINE__, result, mb_show_button); } + //***action buttons without preselection*** for (size_t i = 0; i< ccw_footer->getButtonChainObject()->size(); i++){ CComponentsButton* btn_action = static_cast(ccw_footer->getButtonChainObject()->getCCItem(i)); diff --git a/src/gui/widget/textbox.cpp b/src/gui/widget/textbox.cpp index 41ca9e7dc..c1c17ce60 100644 --- a/src/gui/widget/textbox.cpp +++ b/src/gui/widget/textbox.cpp @@ -186,7 +186,7 @@ void CTextBox::initVar(void) m_nPaintBackground = true; m_SaveScreen = false; m_nBgRadius = m_old_nBgRadius = 0; - m_nBgRadiusType = m_old_nBgRadiusType = CORNER_ALL; + m_nBgRadiusType = m_old_nBgRadiusType = CORNER_NONE; m_cLineArray.clear(); @@ -292,7 +292,7 @@ void CTextBox::initFramesRel(void) m_cFrameTextRel.iX = 0; m_cFrameTextRel.iY = 0; - m_cFrameTextRel.iHeight = m_cFrame.iHeight ; + m_cFrameTextRel.iHeight = m_cFrame.iHeight ; if(m_nMode & SCROLL) { @@ -583,7 +583,7 @@ void CTextBox::refreshText(void) if( frameBuffer == NULL) return; - //TRACE("[CTextBox] m_nCurrentLine: %d, m_nNrOfLines %d, m_cLineArray[m_nCurrentLine]: %s\r\n",m_nCurrentLine, m_nNrOfLines, m_cLineArray[m_nCurrentLine].c_str()); + //TRACE("[CTextBox] m_nCurrentLine: %d, m_nNrOfLines %d, m_cLineArray[m_nCurrentLine]: %s m_nBgRadius: %d\r\n",m_nCurrentLine, m_nNrOfLines, m_cLineArray[m_nCurrentLine].c_str(), m_nBgRadius, m_nBgRadiusType); //bg variables int ax = m_cFrameTextRel.iX+m_cFrame.iX; @@ -688,7 +688,7 @@ void CTextBox::refreshText(void) y += m_nFontTextHeight + ((m_cFrameTextRel.iHeight - m_nFontTextHeight * lines) >> 1); #ifdef VISUAL_DEBUG - frameBuffer->paintBoxRel(m_cFrame.iX, m_cFrame.iY, m_cFrame.iWidth, m_cFrame.iHeight, COL_GREEN); + frameBuffer->paintBoxRel(m_cFrame.iX, m_cFrame.iY, m_cFrame.iWidth, m_cFrame.iHeight, COL_GREEN, m_nBgRadius, m_nBgRadiusType); #endif for(i = m_nCurrentLine; i < m_nNrOfLines && i < m_nCurrentLine + m_nLinesPerPage; i++) @@ -710,7 +710,7 @@ void CTextBox::refreshText(void) #ifdef VISUAL_DEBUG int th = m_nFontTextHeight; - frameBuffer->paintBoxRel(tx, ty-th, tw, th, COL_RED); + frameBuffer->paintBoxRel(tx, ty-th, tw, th, COL_RED, m_nBgRadius, m_nBgRadiusType); #endif //TRACE("[CTextBox] %s Line %d m_cFrame.iX %d m_cFrameTextRel.iX %d\r\n", __FUNCTION__, __LINE__, m_cFrame.iX, m_cFrameTextRel.iX); m_pcFontText->RenderString(tx, ty, tw, m_cLineArray[i].c_str(), m_textColor, 0, m_renderMode | (m_utf8_encoded) ? Font::IS_UTF8 : 0);