mirror of
https://github.com/tuxbox-fork-migrations/recycled-ni-neutrino.git
synced 2025-09-01 01:41:12 +02:00
Add new class CNeutrinoFonts for setup and modify neutrino fonts
- move SetupFonts() from CNeutrinoApp to CFontSetup
Origin commit data
------------------
Commit: 465d2aba23
Author: Michael Liebmann <tuxcode.bbg@gmail.com>
Date: 2013-06-27 (Thu, 27 Jun 2013)
This commit is contained in:
@@ -51,6 +51,7 @@
|
||||
#include <driver/abstime.h>
|
||||
#include <driver/fontrenderer.h>
|
||||
#include <driver/framebuffer.h>
|
||||
#include <driver/neutrinofonts.h>
|
||||
#include <driver/rcinput.h>
|
||||
#include <driver/shutdown_count.h>
|
||||
#include <driver/record.h>
|
||||
@@ -177,6 +178,7 @@ CPictureViewer * g_PicViewer;
|
||||
CCAMMenuHandler * g_CamHandler;
|
||||
CVolume * g_volume;
|
||||
CAudioMute * g_audioMute;
|
||||
CNeutrinoFonts * neutrinoFonts = NULL;
|
||||
|
||||
// Globale Variablen - to use import global.h
|
||||
|
||||
@@ -200,10 +202,9 @@ CNeutrinoApp::CNeutrinoApp()
|
||||
|
||||
frameBuffer = CFrameBuffer::getInstance();
|
||||
frameBuffer->setIconBasePath(DATADIR "/neutrino/icons/");
|
||||
|
||||
SetupFrameBuffer();
|
||||
|
||||
mode = mode_unknown;
|
||||
mode = mode_unknown;
|
||||
channelList = NULL;
|
||||
TVchannelList = NULL;
|
||||
RADIOchannelList = NULL;
|
||||
@@ -213,7 +214,6 @@ CNeutrinoApp::CNeutrinoApp()
|
||||
current_muted = 0;
|
||||
recordingstatus = 0;
|
||||
g_channel_list_changed = false;
|
||||
memset(&font, 0, sizeof(neutrino_font_descr_struct));
|
||||
}
|
||||
|
||||
/*-------------------------------------------------------------------------------------
|
||||
@@ -223,6 +223,9 @@ CNeutrinoApp::~CNeutrinoApp()
|
||||
{
|
||||
if (channelList)
|
||||
delete channelList;
|
||||
if (neutrinoFonts)
|
||||
delete neutrinoFonts;
|
||||
neutrinoFonts = NULL;
|
||||
}
|
||||
|
||||
CNeutrinoApp* CNeutrinoApp::getInstance()
|
||||
@@ -236,16 +239,6 @@ CNeutrinoApp* CNeutrinoApp::getInstance()
|
||||
return neutrinoApp;
|
||||
}
|
||||
|
||||
|
||||
#define FONT_STYLE_REGULAR 0
|
||||
#define FONT_STYLE_BOLD 1
|
||||
#define FONT_STYLE_ITALIC 2
|
||||
|
||||
extern font_sizes_groups_struct font_sizes_groups[];
|
||||
extern font_sizes_struct neutrino_font[];
|
||||
|
||||
const font_sizes_struct signal_font = {LOCALE_FONTSIZE_INFOBAR_SMALL , 14, FONT_STYLE_REGULAR, 1};
|
||||
|
||||
typedef struct lcd_setting_t
|
||||
{
|
||||
const char * const name;
|
||||
@@ -1469,8 +1462,6 @@ void CNeutrinoApp::CmdParser(int argc, char **argv)
|
||||
softupdate = false;
|
||||
//fromflash = false;
|
||||
|
||||
font.name = NULL;
|
||||
|
||||
for(int x=1; x<argc; x++) {
|
||||
if ((!strcmp(argv[x], "-u")) || (!strcmp(argv[x], "--enable-update"))) {
|
||||
dprintf(DEBUG_NORMAL, "Software update enabled\n");
|
||||
@@ -1531,52 +1522,10 @@ void CNeutrinoApp::SetupFrameBuffer()
|
||||
|
||||
void CNeutrinoApp::SetupFonts()
|
||||
{
|
||||
const char * style[3];
|
||||
if (neutrinoFonts == NULL)
|
||||
neutrinoFonts = CNeutrinoFonts::getInstance();
|
||||
neutrinoFonts->SetupNeutrinoFonts();
|
||||
|
||||
if (g_fontRenderer != NULL)
|
||||
delete g_fontRenderer;
|
||||
|
||||
g_fontRenderer = new FBFontRenderClass(72 * g_settings.screen_xres / 100, 72 * g_settings.screen_yres / 100);
|
||||
|
||||
if(font.filename != NULL)
|
||||
free((void *)font.filename);
|
||||
|
||||
printf("[neutrino] settings font file %s\n", g_settings.font_file);
|
||||
|
||||
if(access(g_settings.font_file, F_OK)) {
|
||||
if(!access(FONTDIR"/neutrino.ttf", F_OK)){
|
||||
font.filename = strdup(FONTDIR"/neutrino.ttf");
|
||||
strcpy(g_settings.font_file, font.filename);
|
||||
}
|
||||
else{
|
||||
fprintf( stderr,"[neutrino] font file [%s] not found\n neutrino exit\n",FONTDIR"/neutrino.ttf");
|
||||
_exit(0);
|
||||
}
|
||||
|
||||
}
|
||||
else{
|
||||
font.filename = strdup(g_settings.font_file);
|
||||
}
|
||||
style[0] = g_fontRenderer->AddFont(font.filename);
|
||||
|
||||
if(font.name != NULL)
|
||||
free((void *)font.name);
|
||||
|
||||
font.name = strdup(g_fontRenderer->getFamily(font.filename).c_str());
|
||||
|
||||
printf("[neutrino] font family %s\n", font.name);
|
||||
|
||||
style[1] = "Bold Regular";
|
||||
|
||||
g_fontRenderer->AddFont(font.filename, true); // make italics
|
||||
style[2] = "Italic";
|
||||
|
||||
for (int i = 0; i < SNeutrinoSettings::FONT_TYPE_COUNT; i++)
|
||||
{
|
||||
if(g_Font[i]) delete g_Font[i];
|
||||
g_Font[i] = g_fontRenderer->getFont(font.name, style[neutrino_font[i].style], configfile.getInt32(locale_real_names[neutrino_font[i].name], neutrino_font[i].defaultsize) + neutrino_font[i].size_offset * font.size_offset);
|
||||
}
|
||||
g_SignalFont = g_fontRenderer->getFont(font.name, style[signal_font.style], signal_font.defaultsize + signal_font.size_offset * font.size_offset);
|
||||
/* recalculate infobar position */
|
||||
if (g_InfoViewer)
|
||||
g_InfoViewer->start();
|
||||
@@ -1781,6 +1730,7 @@ TIMER_START();
|
||||
show_startwizard = true;
|
||||
}
|
||||
/* setup GUI */
|
||||
neutrinoFonts = CNeutrinoFonts::getInstance();
|
||||
SetupFonts();
|
||||
SetupTiming();
|
||||
g_PicViewer = new CPictureViewer();
|
||||
@@ -1789,7 +1739,7 @@ TIMER_START();
|
||||
CHintBox * hintBox = new CHintBox(LOCALE_MESSAGEBOX_INFO, g_Locale->getText(LOCALE_NEUTRINO_STARTING));
|
||||
hintBox->paint();
|
||||
|
||||
CVFD::getInstance()->init(font.filename, font.name);
|
||||
CVFD::getInstance()->init(neutrinoFonts->fontDescr.filename, neutrinoFonts->fontDescr.name);
|
||||
CVFD::getInstance()->Clear();
|
||||
CVFD::getInstance()->ShowText(g_Locale->getText(LOCALE_NEUTRINO_STARTING));
|
||||
CVFD::getInstance()->setBacklight(g_settings.backlight_tv);
|
||||
|
Reference in New Issue
Block a user