CMenuWidget: Remove line breaks from hint text

- Add font to Constructor & setText()
- remove CTextBox::AUTO_HIGH


Origin commit data
------------------
Branch: ni/coolstream
Commit: ff12f2b5b5
Author: Michael Liebmann <tuxcode.bbg@gmail.com>
Date: 2012-08-20 (Mon, 20 Aug 2012)



------------------
This commit was generated by Migit
This commit is contained in:
Michael Liebmann
2012-08-20 06:18:17 +02:00
committed by Thilo Graf
parent 1ddc65e25d
commit 191bc734dc

View File

@@ -814,10 +814,11 @@ void CMenuWidget::calcSize()
} }
#endif #endif
} }
hint_height = 70; //TODO: rework calculation of hint_height hint_height = 0;
if(g_settings.show_menu_hints && has_hints) { 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 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 ! */ /* assuming all hint icons has the same size ! */
int iw, ih; int iw, ih;
frameBuffer->getIconSize(NEUTRINO_ICON_HINT_TVMODE, &iw, &ih); frameBuffer->getIconSize(NEUTRINO_ICON_HINT_TVMODE, &iw, &ih);
@@ -1075,7 +1076,7 @@ void CMenuWidget::paintHint(int pos)
return; return;
int rad = RADIUS_LARGE; int rad = RADIUS_LARGE;
int xpos = x - ConnectLineBox_Width; int xpos = x - ConnectLineBox_Width;
int ypos2 = y + height + rad + SHADOW_OFFSET + INFO_BOX_Y_OFFSET; int ypos2 = y + height + rad + SHADOW_OFFSET + INFO_BOX_Y_OFFSET;
int iwidth = width+sb_width; int iwidth = width+sb_width;
@@ -1155,15 +1156,23 @@ void CMenuWidget::paintHint(int pos)
#if 0 #if 0
details_line->paint(savescreen); details_line->paint(savescreen);
#endif #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 //init infobox
if (info_box == NULL) 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{ else{
info_box->setXPos(x); info_box->setXPos(x);
info_box->setYPos(ypos2); info_box->setYPos(ypos2);
info_box->setWidth(iwidth); 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); info_box->setCornerRadius(RADIUS_LARGE);