From 191bc734dc72ffa95ef2e04c0e2bb55a5340d1c4 Mon Sep 17 00:00:00 2001 From: Michael Liebmann Date: Mon, 20 Aug 2012 06:18:17 +0200 Subject: [PATCH] CMenuWidget: Remove line breaks from hint text - Add font to Constructor & setText() - remove CTextBox::AUTO_HIGH Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/ff12f2b5b53c185fcc84e8be84e3bf95e7e886af Author: Michael Liebmann Date: 2012-08-20 (Mon, 20 Aug 2012) ------------------ This commit was generated by Migit --- src/gui/widget/menue.cpp | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/src/gui/widget/menue.cpp b/src/gui/widget/menue.cpp index 93b8f348f..aa1f328da 100644 --- a/src/gui/widget/menue.cpp +++ b/src/gui/widget/menue.cpp @@ -814,10 +814,11 @@ void CMenuWidget::calcSize() } #endif } - hint_height = 70; //TODO: rework calculation of hint_height + hint_height = 0; if(g_settings.show_menu_hints && has_hints) { + hint_height = 60; //TODO: rework calculation of hint_height int fheight = g_Font[SNeutrinoSettings::FONT_TYPE_MENU_HINT]->getHeight(); - int h_tmp = 10 + 2*fheight; + int h_tmp = 16 + 2*fheight; /* assuming all hint icons has the same size ! */ int iw, ih; frameBuffer->getIconSize(NEUTRINO_ICON_HINT_TVMODE, &iw, &ih); @@ -1075,7 +1076,7 @@ void CMenuWidget::paintHint(int pos) return; int rad = RADIUS_LARGE; - + int xpos = x - ConnectLineBox_Width; int ypos2 = y + height + rad + SHADOW_OFFSET + INFO_BOX_Y_OFFSET; int iwidth = width+sb_width; @@ -1155,15 +1156,23 @@ void CMenuWidget::paintHint(int pos) #if 0 details_line->paint(savescreen); #endif - + + // remove line breaks + std::string str = g_Locale->getText(item->hint); + std::string::size_type spos = str.find_first_of("\n"); + while (spos != std::string::npos) { + str.replace(spos, 1, " "); + spos = str.find_first_of("\n"); + } + //init infobox if (info_box == NULL) - info_box = new CComponentsInfoBox(x, ypos2, iwidth, hint_height, g_Locale->getText(item->hint), CTextBox::AUTO_WIDTH | CTextBox::AUTO_HIGH/*, g_Font[SNeutrinoSettings::FONT_TYPE_MENU_HINT]*/); + info_box = new CComponentsInfoBox(x, ypos2, iwidth, hint_height, str.c_str(), CTextBox::AUTO_WIDTH, g_Font[SNeutrinoSettings::FONT_TYPE_MENU_HINT]); else{ info_box->setXPos(x); info_box->setYPos(ypos2); info_box->setWidth(iwidth); - info_box->setText(g_Locale->getText(item->hint)); + info_box->setText(str, CTextBox::AUTO_WIDTH, g_Font[SNeutrinoSettings::FONT_TYPE_MENU_HINT]); } info_box->setCornerRadius(RADIUS_LARGE);