infoviewer_bb: limit text width to available space

only use the available space to draw the button texts

Signed-off-by: Jacek Jendrzej <crashdvb@googlemail.com>


Origin commit data
------------------
Commit: ab191b1c76
Author: Stefan Seyfried <seife@tuxbox-git.slipkontur.de>
Date: 2013-02-17 (Sun, 17 Feb 2013)
This commit is contained in:
Stefan Seyfried
2013-02-17 19:10:49 +01:00
committed by Jacek Jendrzej
parent 53365a8ae0
commit 65a3c616ab

View File

@@ -347,12 +347,21 @@ void CInfoViewerBB::showBBButtons(const int modus)
} }
if (paint) { if (paint) {
int last_x = minX;
frameBuffer->paintBoxRel(g_InfoViewer->ChanInfoX, BBarY, minX - g_InfoViewer->ChanInfoX, InfoHeightY_Info, COL_INFOBAR_BUTTONS_BACKGROUND, RADIUS_SMALL, CORNER_BOTTOM); //round frameBuffer->paintBoxRel(g_InfoViewer->ChanInfoX, BBarY, minX - g_InfoViewer->ChanInfoX, InfoHeightY_Info, COL_INFOBAR_BUTTONS_BACKGROUND, RADIUS_SMALL, CORNER_BOTTOM); //round
for (i = 0; i < CInfoViewerBB::BUTTON_MAX; i++) { for (i = BUTTON_MAX; i > 0;) {
--i;
if ((bbButtonInfo[i].x <= g_InfoViewer->ChanInfoX) || (bbButtonInfo[i].x >= g_InfoViewer->BoxEndX) || (!bbButtonInfo[i].paint)) if ((bbButtonInfo[i].x <= g_InfoViewer->ChanInfoX) || (bbButtonInfo[i].x >= g_InfoViewer->BoxEndX) || (!bbButtonInfo[i].paint))
continue; continue;
if ((bbButtonInfo[i].x > 0) && ((bbButtonInfo[i].x + bbButtonInfo[i].w) <= minX)) { if (bbButtonInfo[i].x > 0) {
if (bbButtonInfo[i].x + bbButtonInfo[i].w > last_x) /* text too long */
bbButtonInfo[i].w = last_x - bbButtonInfo[i].x;
last_x = bbButtonInfo[i].x;
if (bbButtonInfo[i].w - bbButtonInfo[i].cx <= 0) {
printf("[infoviewer_bb:%d cannot paint icon %d (not enough space)\n",
__LINE__, i);
continue;
}
frameBuffer->paintIcon(bbButtonInfo[i].icon, bbButtonInfo[i].x, BBarY, InfoHeightY_Info); frameBuffer->paintIcon(bbButtonInfo[i].icon, bbButtonInfo[i].x, BBarY, InfoHeightY_Info);
g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_SMALL]->RenderString(bbButtonInfo[i].x + bbButtonInfo[i].cx, BBarFontY, g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_SMALL]->RenderString(bbButtonInfo[i].x + bbButtonInfo[i].cx, BBarFontY,