From b2aa68e0635b73cbe1a17e26d0ffdb347c9d59ea Mon Sep 17 00:00:00 2001 From: satbaby Date: Tue, 20 Dec 2011 13:57:32 +0000 Subject: [PATCH] infoviewer: infobar centered (thx svenhoefer) git-svn-id: file:///home/bas/coolstream_public_svn/THIRDPARTY/applications/neutrino-beta@1982 e54a6e83-5905-42d5-8d5c-058d10e6a962 --- src/gui/infoviewer.cpp | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/src/gui/infoviewer.cpp b/src/gui/infoviewer.cpp index 3f0fdb469..2d204f676 100644 --- a/src/gui/infoviewer.cpp +++ b/src/gui/infoviewer.cpp @@ -1903,10 +1903,10 @@ void CInfoViewer::showInfoFile() /*if (recordModeActive) return;*/ char infotext[80]; - int fd, xStart, yStart, width, height, radius; + int fd, xStart, xOffset, yStart, width, height, tWidth, tIndent; ssize_t cnt; - fd = open("/tmp/infobar.txt", O_RDONLY); //Datei aus welcher der Text ausgelesen wird + fd = open("/tmp/infobar.txt", O_RDONLY); //read textcontent from this file if (fd < 0) return; @@ -1919,18 +1919,23 @@ void CInfoViewer::showInfoFile() } infotext[cnt-1] = '\0'; - xStart = BoxStartX + ChanWidth + 140; //Abstand rechts vom Aufnahmeicon + xStart = BoxStartX + ChanWidth + 140; //140px space for the little rec/ts-bar + xOffset = 5; //same value as the used RADIUS_SMALL yStart = BoxStartY; - width = BoxEndX - xStart - 225; + width = BoxEndX - xStart - 225; //225px space for the progress-bar height = g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_INFO]->getHeight() + 2; - radius = height / 3; + tWidth = g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_INFO]->getRenderWidth(infotext); + if (tWidth < (width - (xOffset * 2)) ) + tIndent = (width - (xOffset * 2) - tWidth) / 2; + else + tIndent = 0; //shadow frameBuffer->paintBoxRel(xStart + SHADOW_OFFSET, yStart + SHADOW_OFFSET, width, height, COL_INFOBAR_SHADOW_PLUS_0, RADIUS_SMALL, CORNER_ALL); //background frameBuffer->paintBoxRel(xStart, yStart, width, height, COL_INFOBAR_PLUS_0, RADIUS_SMALL, CORNER_ALL); //content g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_INFO]->RenderString( - xStart + radius, yStart + height, width - radius, (std::string)infotext, COL_INFOBAR, height, false); + xStart + xOffset + tIndent, yStart + height, width - xOffset, (std::string)infotext, COL_INFOBAR, height, false); }