- scale imageinfo with fontsize

git-svn-id: file:///home/bas/coolstream_public_svn/THIRDPARTY/applications/neutrino-experimental@360 e54a6e83-5905-42d5-8d5c-058d10e6a962
This commit is contained in:
striper
2010-02-17 12:52:49 +00:00
parent b26284ef99
commit 39f76419fd
2 changed files with 51 additions and 26 deletions

View File

@@ -23,9 +23,6 @@
#include <config.h> #include <config.h>
#endif #endif
#define SCREEN_X 720
#define SCREEN_Y 572
#include <gui/imageinfo.h> #include <gui/imageinfo.h>
#include <global.h> #include <global.h>
@@ -49,6 +46,18 @@ CImageInfo::CImageInfo()
Init(); Init();
} }
static const neutrino_locale_t info_items[8] =
{
LOCALE_IMAGEINFO_IMAGE,
LOCALE_IMAGEINFO_DATE,
LOCALE_IMAGEINFO_VERSION,
LOCALE_IMAGEINFO_CREATOR,
LOCALE_IMAGEINFO_HOMEPAGE,
LOCALE_IMAGEINFO_DOKUMENTATION,
LOCALE_IMAGEINFO_FORUM,
LOCALE_IMAGEINFO_LICENSE
};
void CImageInfo::Init(void) void CImageInfo::Init(void)
{ {
frameBuffer = CFrameBuffer::getInstance(); frameBuffer = CFrameBuffer::getInstance();
@@ -68,6 +77,18 @@ void CImageInfo::Init(void)
height = frameBuffer->getScreenHeight() - 10; height = frameBuffer->getScreenHeight() - 10;
x=getScreenStartX( width ); x=getScreenStartX( width );
y=getScreenStartY( height ); y=getScreenStartY( height );
// calculate max width of used LOCALES
offset = 0;
for (int i = 0; i < 8; i++) {
int tmpoffset = g_Font[font_info]->getRenderWidth(g_Locale->getText (info_items[i]));
if (tmpoffset > offset) {
offset = tmpoffset;
}
}
offset = offset + 15;
} }
CImageInfo::~CImageInfo() CImageInfo::~CImageInfo()
@@ -158,7 +179,7 @@ void CImageInfo::paint()
CConfigFile config('\t'); CConfigFile config('\t');
config.loadConfig("/.version"); config.loadConfig("/.version");
const char * imagename = config.getString("imagename", "Neutrino").c_str(); const char * imagename = config.getString("imagename", "Neutrino-HD").c_str();
const char * homepage = config.getString("homepage", "n/a").c_str(); const char * homepage = config.getString("homepage", "n/a").c_str();
const char * creator = config.getString("creator", "n/a").c_str(); const char * creator = config.getString("creator", "n/a").c_str();
const char * version = config.getString("version", "no version").c_str(); const char * version = config.getString("version", "no version").c_str();
@@ -170,64 +191,65 @@ void CImageInfo::paint()
sprintf((char*) imagedate, "%s %s", versionInfo.getDate(), versionInfo.getTime()); sprintf((char*) imagedate, "%s %s", versionInfo.getDate(), versionInfo.getTime());
ypos += iheight; ypos += iheight;
paintLine(xpos , font_info, g_Locale->getText(LOCALE_IMAGEINFO_IMAGE)); paintLine(xpos , font_info, g_Locale->getText(LOCALE_IMAGEINFO_IMAGE));
paintLine(xpos+125, font_info, imagename); paintLine(xpos+offset, font_info, imagename);
ypos += iheight; ypos += iheight;
paintLine(xpos , font_info, g_Locale->getText(LOCALE_IMAGEINFO_DATE)); paintLine(xpos , font_info, g_Locale->getText(LOCALE_IMAGEINFO_DATE));
paintLine(xpos+125, font_info, imagedate); paintLine(xpos+offset, font_info, imagedate);
ypos += iheight; ypos += iheight;
paintLine(xpos , font_info, g_Locale->getText(LOCALE_IMAGEINFO_VERSION)); paintLine(xpos , font_info, g_Locale->getText(LOCALE_IMAGEINFO_VERSION));
paintLine(xpos+125, font_info, releaseCycle); paintLine(xpos+offset, font_info, releaseCycle);
ypos += iheight; ypos += iheight;
paintLine(xpos , font_info, g_Locale->getText(LOCALE_IMAGEINFO_CREATOR)); paintLine(xpos , font_info, g_Locale->getText(LOCALE_IMAGEINFO_CREATOR));
paintLine(xpos+125, font_info, creator); paintLine(xpos+offset, font_info, creator);
ypos += iheight+15; ypos += iheight+15;
paintLine(xpos , font_info, g_Locale->getText(LOCALE_IMAGEINFO_HOMEPAGE)); paintLine(xpos , font_info, g_Locale->getText(LOCALE_IMAGEINFO_HOMEPAGE));
paintLine(xpos+125, font_info, homepage); paintLine(xpos+offset, font_info, homepage);
ypos += iheight; ypos += iheight;
paintLine(xpos , font_info, g_Locale->getText(LOCALE_IMAGEINFO_DOKUMENTATION)); paintLine(xpos , font_info, g_Locale->getText(LOCALE_IMAGEINFO_DOKUMENTATION));
paintLine(xpos+125, font_info, docs); paintLine(xpos+offset, font_info, docs);
ypos += iheight; ypos += iheight;
paintLine(xpos , font_info, g_Locale->getText(LOCALE_IMAGEINFO_FORUM)); paintLine(xpos , font_info, g_Locale->getText(LOCALE_IMAGEINFO_FORUM));
paintLine(xpos+125, font_info, forum); paintLine(xpos+offset, font_info, forum);
ypos += iheight+15; ypos += iheight+15;
paintLine(xpos, font_info,g_Locale->getText(LOCALE_IMAGEINFO_LICENSE)); paintLine(xpos, font_info,g_Locale->getText(LOCALE_IMAGEINFO_LICENSE));
paintLine(xpos+125, font_small, "This program is free software; you can redistribute it and/or modify"); paintLine(xpos+offset, font_small, "This program is free software; you can redistribute it and/or modify");
ypos+= sheight; ypos+= sheight;
paintLine(xpos+125, font_small, "it under the terms of the GNU General Public License as published by"); paintLine(xpos+offset, font_small, "it under the terms of the GNU General Public License as published by");
ypos+= sheight; ypos+= sheight;
paintLine(xpos+125, font_small, "the Free Software Foundation; either version 2 of the License, or"); paintLine(xpos+offset, font_small, "the Free Software Foundation; either version 2 of the License, or");
ypos+= sheight; ypos+= sheight;
paintLine(xpos+125, font_small, "(at your option) any later version."); paintLine(xpos+offset, font_small, "(at your option) any later version.");
ypos+= sheight+10; ypos+= sheight+10;
paintLine(xpos+125, font_small, "This program is distributed in the hope that it will be useful,"); paintLine(xpos+offset, font_small, "This program is distributed in the hope that it will be useful,");
ypos+= sheight; ypos+= sheight;
paintLine(xpos+125, font_small, "but WITHOUT ANY WARRANTY; without even the implied warranty of"); paintLine(xpos+offset, font_small, "but WITHOUT ANY WARRANTY; without even the implied warranty of");
ypos+= sheight; ypos+= sheight;
paintLine(xpos+125, font_small, "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."); paintLine(xpos+offset, font_small, "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.");
ypos+= sheight; ypos+= sheight;
paintLine(xpos+125, font_small, "See the GNU General Public License for more details."); paintLine(xpos+offset, font_small, "See the GNU General Public License for more details.");
ypos+= sheight+10; ypos+= sheight+10;
paintLine(xpos+125, font_small, "You should have received a copy of the GNU General Public License"); paintLine(xpos+offset, font_small, "You should have received a copy of the GNU General Public License");
ypos+= sheight; ypos+= sheight;
paintLine(xpos+125, font_small, "along with this program; if not, write to the Free Software"); paintLine(xpos+offset, font_small, "along with this program; if not, write to the Free Software");
ypos+= sheight; ypos+= sheight;
paintLine(xpos+125, font_small, "Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA."); paintLine(xpos+offset, font_small, "Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.");
} }

View File

@@ -26,7 +26,7 @@
#include <configfile.h> #include <configfile.h>
#include <gui/widget/menue.h> #include <gui/widget/menue.h>
#include <system/localize.h>
#include <driver/framebuffer.h> #include <driver/framebuffer.h>
#include <driver/pig.h> #include <driver/pig.h>
@@ -46,6 +46,9 @@ class CImageInfo : public CMenuTarget
int max_height; // Frambuffer 0.. max int max_height; // Frambuffer 0.. max
int max_width; int max_width;
neutrino_locale_t name;
int offset;
int font_head; int font_head;
int font_info; int font_info;
int font_small; int font_small;