diff --git a/src/gui/osd_setup.cpp b/src/gui/osd_setup.cpp index 3a07ef112..d66e92d80 100644 --- a/src/gui/osd_setup.cpp +++ b/src/gui/osd_setup.cpp @@ -55,6 +55,7 @@ #include #include +#include extern CRemoteControl * g_RemoteControl; @@ -81,6 +82,8 @@ COsdSetup::~COsdSetup() { delete colorSetupNotifier; delete fontsizenotifier; + delete mfFontFile; + delete mfTtxFontFile; } //font settings @@ -195,6 +198,8 @@ int COsdSetup::exec(CMenuTarget* parent, const std::string &actionKey) strcpy(g_settings.font_file, fileBrowser.getSelectedFile()->Name.c_str()); printf("[neutrino] new font file %s\n", fileBrowser.getSelectedFile()->Name.c_str()); CNeutrinoApp::getInstance()->SetupFonts(); + osdFontFile = "(" + getBaseName(fileBrowser.getSelectedFile()->Name) + ")"; + mfFontFile->setOption(osdFontFile.c_str()); } return menu_return::RETURN_REPAINT; } @@ -210,6 +215,8 @@ int COsdSetup::exec(CMenuTarget* parent, const std::string &actionKey) ttx_font_file = fileBrowser.getSelectedFile()->Name; printf("[neutrino] ttx font file %s\n", fileBrowser.getSelectedFile()->Name.c_str()); CNeutrinoApp::getInstance()->SetupFonts(); + osdTtxFontFile = "(" + getBaseName(fileBrowser.getSelectedFile()->Name) + ")"; + mfTtxFontFile->setOption(osdTtxFontFile.c_str()); } return menu_return::RETURN_REPAINT; } @@ -416,7 +423,7 @@ int COsdSetup::showOsdSetup() osd_menu->addItem(mf); //fonts - CMenuWidget osd_menu_fonts(LOCALE_MAINMENU_SETTINGS, NEUTRINO_ICON_COLORS, width, MN_WIDGET_ID_OSDSETUP_FONT); + CMenuWidget osd_menu_fonts(LOCALE_MAINMENU_SETTINGS, NEUTRINO_ICON_COLORS, w_max(50, 10), MN_WIDGET_ID_OSDSETUP_FONT); showOsdFontSizeSetup(&osd_menu_fonts); mf = new CMenuForwarder(LOCALE_FONTMENU_HEAD, true, NULL, &osd_menu_fonts, NULL, CRCInput::RC_green, NEUTRINO_ICON_BUTTON_GREEN); mf->setHint("", LOCALE_MENU_HINT_FONTS); @@ -653,7 +660,6 @@ void COsdSetup::AddFontSettingItem(CMenuWidget &font_Settings, const SNeutrinoSe font_Settings.addItem(new CMenuNumberInput(neutrino_font[number_of_fontsize_entry].name, neutrino_font[number_of_fontsize_entry].defaultsize, fontsizenotifier, CNeutrinoApp::getInstance()->getConfigFile())); } - //font settings menu void COsdSetup::showOsdFontSizeSetup(CMenuWidget *menu_fonts) { @@ -663,14 +669,18 @@ void COsdSetup::showOsdFontSizeSetup(CMenuWidget *menu_fonts) fontSettings->addIntroItems(LOCALE_FONTMENU_HEAD); // select gui font file - mf = new CMenuForwarder(LOCALE_COLORMENU_FONT, true, NULL, this, "select_font", CRCInput::RC_red, NEUTRINO_ICON_BUTTON_RED); - mf->setHint("", LOCALE_MENU_HINT_FONT_GUI); - fontSettings->addItem(mf); + osdFontFile = g_settings.font_file; + osdFontFile = "(" + getBaseName(osdFontFile) + ")"; + mfFontFile = new CMenuForwarder(LOCALE_COLORMENU_FONT, true, osdFontFile.c_str(), this, "select_font", CRCInput::RC_red, NEUTRINO_ICON_BUTTON_RED); + mfFontFile->setHint("", LOCALE_MENU_HINT_FONT_GUI); + fontSettings->addItem(mfFontFile); // select teletext font file - mf = new CMenuForwarder(LOCALE_COLORMENU_FONT_TTX, true, NULL, this, "ttx_font", CRCInput::RC_green, NEUTRINO_ICON_BUTTON_GREEN); - mf->setHint("", LOCALE_MENU_HINT_FONT_TTX); - fontSettings->addItem(mf); + osdTtxFontFile = g_settings.ttx_font_file; + osdTtxFontFile = "(" + getBaseName(osdTtxFontFile) + ")"; + mfTtxFontFile = new CMenuForwarder(LOCALE_COLORMENU_FONT_TTX, true, osdTtxFontFile.c_str(), this, "ttx_font", CRCInput::RC_green, NEUTRINO_ICON_BUTTON_GREEN); + mfTtxFontFile->setHint("", LOCALE_MENU_HINT_FONT_TTX); + fontSettings->addItem(mfTtxFontFile); // contrast fonts CMenuOptionChooser * mc = new CMenuOptionChooser(LOCALE_COLORMENU_CONTRAST_FONTS, &g_settings.contrast_fonts, OPTIONS_OFF0_ON1_OPTIONS, OPTIONS_OFF0_ON1_OPTION_COUNT, true, this, CRCInput::RC_yellow, NEUTRINO_ICON_BUTTON_YELLOW); diff --git a/src/gui/osd_setup.h b/src/gui/osd_setup.h index d8c866131..b1ebb733e 100644 --- a/src/gui/osd_setup.h +++ b/src/gui/osd_setup.h @@ -47,6 +47,8 @@ class COsdSetup : public CMenuTarget, public CChangeObserver CFontSizeNotifier *fontsizenotifier; CMenuWidget *osd_menu; CMenuWidget *submenu_menus; + CMenuForwarder *mfFontFile, *mfTtxFontFile; + std::string osdFontFile, osdTtxFontFile; int width; bool is_wizard;