diff --git a/src/gui/screensetup.cpp b/src/gui/screensetup.cpp index 51049b6f5..772231309 100644 --- a/src/gui/screensetup.cpp +++ b/src/gui/screensetup.cpp @@ -110,6 +110,17 @@ int CScreenSetup::exec(CMenuTarget* parent, const std::string &) g_settings.screen_EndX = x_coord[1]; g_settings.screen_StartY = y_coord[0]; g_settings.screen_EndY = y_coord[1]; + if(g_settings.screen_preset) { + g_settings.screen_StartX_lcd = g_settings.screen_StartX; + g_settings.screen_StartY_lcd = g_settings.screen_StartY; + g_settings.screen_EndX_lcd = g_settings.screen_EndX; + g_settings.screen_EndY_lcd = g_settings.screen_EndY; + } else { + g_settings.screen_StartX_crt = g_settings.screen_StartX; + g_settings.screen_StartY_crt = g_settings.screen_StartY; + g_settings.screen_EndX_crt = g_settings.screen_EndX; + g_settings.screen_EndY_crt = g_settings.screen_EndY; + } if (g_InfoViewer) /* recalc infobar position */ g_InfoViewer->start(); loop = false; diff --git a/src/neutrino.cpp b/src/neutrino.cpp index 7c8692788..e0fad8cc8 100644 --- a/src/neutrino.cpp +++ b/src/neutrino.cpp @@ -721,10 +721,15 @@ const lcd_setting_struct_t lcd_setting[LCD_SETTING_COUNT] = /************************************************************************************** * CNeutrinoApp - loadSetup, load the application-settings * **************************************************************************************/ -#define DEFAULT_X_START 60 -#define DEFAULT_Y_START 20 -#define DEFAULT_X_END 1220 -#define DEFAULT_Y_END 560 +#define DEFAULT_X_START_SD 60 +#define DEFAULT_Y_START_SD 20 +#define DEFAULT_X_END_SD 1220 +#define DEFAULT_Y_END_SD 560 + +#define DEFAULT_X_START_HD 5 +#define DEFAULT_Y_START_HD 5 +#define DEFAULT_X_END_HD 1275 +#define DEFAULT_Y_END_HD 715 std::string ttx_font_file = ""; @@ -1044,10 +1049,21 @@ printf("***************************** rec dir %s timeshift dir %s\n", g_settings g_settings.channellist_epgtext_align_right = configfile.getBool("channellist_epgtext_align_right" , false); g_settings.channellist_extended = configfile.getBool("channellist_extended" , true); //screen configuration - g_settings.screen_StartX = configfile.getInt32( "screen_StartX", DEFAULT_X_START); - g_settings.screen_StartY = configfile.getInt32( "screen_StartY", DEFAULT_Y_START ); - g_settings.screen_EndX = configfile.getInt32( "screen_EndX", DEFAULT_X_END); - g_settings.screen_EndY = configfile.getInt32( "screen_EndY", DEFAULT_Y_END); + g_settings.screen_StartX_crt = configfile.getInt32( "screen_StartX_crt", DEFAULT_X_START_SD); + g_settings.screen_StartY_crt = configfile.getInt32( "screen_StartY_crt", DEFAULT_Y_START_SD ); + g_settings.screen_EndX_crt = configfile.getInt32( "screen_EndX_crt", DEFAULT_X_END_SD); + g_settings.screen_EndY_crt = configfile.getInt32( "screen_EndY_crt", DEFAULT_Y_END_SD); + g_settings.screen_StartX_lcd = configfile.getInt32( "screen_StartX_lcd", DEFAULT_X_START_HD); + g_settings.screen_StartY_lcd = configfile.getInt32( "screen_StartY_lcd", DEFAULT_Y_START_HD ); + g_settings.screen_EndX_lcd = configfile.getInt32( "screen_EndX_lcd", DEFAULT_X_END_HD); + g_settings.screen_EndY_lcd = configfile.getInt32( "screen_EndY_lcd", DEFAULT_Y_END_HD); + g_settings.screen_preset = configfile.getInt32( "screen_preset", 0); + + g_settings.screen_StartX = g_settings.screen_preset ? g_settings.screen_StartX_lcd : g_settings.screen_StartX_crt; + g_settings.screen_StartY = g_settings.screen_preset ? g_settings.screen_StartY_lcd : g_settings.screen_StartY_crt; + g_settings.screen_EndX = g_settings.screen_preset ? g_settings.screen_EndX_lcd : g_settings.screen_EndX_crt; + g_settings.screen_EndY = g_settings.screen_preset ? g_settings.screen_EndY_lcd : g_settings.screen_EndY_crt; + g_settings.screen_width = configfile.getInt32("screen_width", 0); g_settings.screen_height = configfile.getInt32("screen_height", 0); @@ -1198,12 +1214,14 @@ printf("***************************** rec dir %s timeshift dir %s\n", g_settings g_settings.uboot_console_bak = g_settings.uboot_console; } #endif + /* in case FB resolution changed */ if((g_settings.screen_width && g_settings.screen_width != (int) frameBuffer->getScreenWidth(true)) - || (g_settings.screen_height && g_settings.screen_height != (int) frameBuffer->getScreenHeight(true))) { - g_settings.screen_StartX = DEFAULT_X_START; - g_settings.screen_StartY = DEFAULT_Y_START; - g_settings.screen_EndX = DEFAULT_X_END; - g_settings.screen_EndY = DEFAULT_Y_END; + || (g_settings.screen_height && g_settings.screen_height != (int) frameBuffer->getScreenHeight(true))) { + g_settings.screen_StartX = g_settings.screen_preset ? DEFAULT_X_START_HD : DEFAULT_X_START_SD; + g_settings.screen_StartY = g_settings.screen_preset ? DEFAULT_Y_START_HD : DEFAULT_Y_START_SD; + g_settings.screen_EndX = g_settings.screen_preset ? DEFAULT_X_END_HD : DEFAULT_X_END_SD; + g_settings.screen_EndY = g_settings.screen_preset ? DEFAULT_Y_END_HD : DEFAULT_Y_END_SD; + g_settings.screen_width = frameBuffer->getScreenWidth(true); g_settings.screen_height = frameBuffer->getScreenHeight(true); } @@ -1544,10 +1562,14 @@ void CNeutrinoApp::saveSetup(const char * fname) configfile.setBool ( "audiochannel_up_down_enable", g_settings.audiochannel_up_down_enable ); //screen configuration - configfile.setInt32( "screen_StartX", g_settings.screen_StartX ); - configfile.setInt32( "screen_StartY", g_settings.screen_StartY ); - configfile.setInt32( "screen_EndX", g_settings.screen_EndX ); - configfile.setInt32( "screen_EndY", g_settings.screen_EndY ); + configfile.setInt32( "screen_StartX_lcd", g_settings.screen_StartX_lcd ); + configfile.setInt32( "screen_StartY_lcd", g_settings.screen_StartY_lcd ); + configfile.setInt32( "screen_EndX_lcd", g_settings.screen_EndX_lcd ); + configfile.setInt32( "screen_EndY_lcd", g_settings.screen_EndY_lcd ); + configfile.setInt32( "screen_StartX_crt", g_settings.screen_StartX_crt ); + configfile.setInt32( "screen_StartY_crt", g_settings.screen_StartY_crt ); + configfile.setInt32( "screen_EndX_crt", g_settings.screen_EndX_crt ); + configfile.setInt32( "screen_EndY_crt", g_settings.screen_EndY_crt ); configfile.setInt32( "screen_width", g_settings.screen_width); configfile.setInt32( "screen_height", g_settings.screen_height); diff --git a/src/neutrino_menue.cpp b/src/neutrino_menue.cpp index 58b8f7919..0efabaaf5 100644 --- a/src/neutrino_menue.cpp +++ b/src/neutrino_menue.cpp @@ -2326,8 +2326,8 @@ void CNeutrinoApp::InitFontSettings(CMenuWidget &fontSettings) #define OSD_PRESET_OPTIONS_COUNT 2 const CMenuOptionChooser::keyval OSD_PRESET_OPTIONS[OSD_PRESET_OPTIONS_COUNT] = { - { 560, LOCALE_COLORMENU_SD_PRESET }, - { 696, LOCALE_COLORMENU_HD_PRESET } + { 0, LOCALE_COLORMENU_SD_PRESET }, + { 1, LOCALE_COLORMENU_HD_PRESET } }; void CNeutrinoApp::InitColorSettings(CMenuWidget &colorSettings, CMenuWidget &fontSettings ) @@ -2349,7 +2349,8 @@ void CNeutrinoApp::InitColorSettings(CMenuWidget &colorSettings, CMenuWidget &fo colorSettings.addItem(new CMenuForwarder(LOCALE_COLORMENU_TIMING, true, NULL, colorSettings_timing, NULL, CRCInput::RC_yellow, NEUTRINO_ICON_BUTTON_YELLOW)); colorSettings.addItem(new CMenuForwarder(LOCALE_VIDEOMENU_SCREENSETUP, true, NULL, ScreenSetup, NULL, CRCInput::RC_blue, NEUTRINO_ICON_BUTTON_BLUE)); - colorSettings.addItem(new CMenuOptionChooser(LOCALE_COLORMENU_OSD_PRESET, &g_settings.screen_EndY, OSD_PRESET_OPTIONS, OSD_PRESET_OPTIONS_COUNT, true, NULL, CRCInput::RC_1)); + CScreePresetNotifier * presetNotify = new CScreePresetNotifier(); + colorSettings.addItem(new CMenuOptionChooser(LOCALE_COLORMENU_OSD_PRESET, &g_settings.screen_preset, OSD_PRESET_OPTIONS, OSD_PRESET_OPTIONS_COUNT, true, presetNotify, CRCInput::RC_1)); //infobar CMenuWidget *miscSettingsInfobar = new CMenuWidget(LOCALE_MISCSETTINGS_INFOBAR, NEUTRINO_ICON_SETTINGS); diff --git a/src/system/setting_helpers.cpp b/src/system/setting_helpers.cpp index 03387696e..1c83b3a12 100644 --- a/src/system/setting_helpers.cpp +++ b/src/system/setting_helpers.cpp @@ -990,3 +990,16 @@ bool CCpuFreqNotifier::changeNotify(const neutrino_locale_t, void * data) cpuFreq->SetCpuFreq(freq); return true; } + +bool CScreePresetNotifier::changeNotify(const neutrino_locale_t OptionName, void * data) +{ + int preset = * (int *) data; +printf("CScreePresetNotifier::changeNotify preset %d (setting %d)\n", preset, g_settings.screen_preset); + + g_settings.screen_StartX = g_settings.screen_preset ? g_settings.screen_StartX_lcd : g_settings.screen_StartX_crt; + g_settings.screen_StartY = g_settings.screen_preset ? g_settings.screen_StartY_lcd : g_settings.screen_StartY_crt; + g_settings.screen_EndX = g_settings.screen_preset ? g_settings.screen_EndX_lcd : g_settings.screen_EndX_crt; + g_settings.screen_EndY = g_settings.screen_preset ? g_settings.screen_EndY_lcd : g_settings.screen_EndY_crt; + CFrameBuffer::getInstance()->Clear(); + return true; +} diff --git a/src/system/setting_helpers.h b/src/system/setting_helpers.h index 7b83e8587..49d3f30e5 100644 --- a/src/system/setting_helpers.h +++ b/src/system/setting_helpers.h @@ -305,4 +305,10 @@ class CCpuFreqNotifier : public CChangeObserver public: bool changeNotify(const neutrino_locale_t, void * data); }; + +class CScreePresetNotifier : public CChangeObserver +{ +public: + bool changeNotify(const neutrino_locale_t, void * data); +}; #endif diff --git a/src/system/settings.h b/src/system/settings.h index 7a350bb6b..11dbc26d7 100644 --- a/src/system/settings.h +++ b/src/system/settings.h @@ -317,6 +317,15 @@ struct SNeutrinoSettings int screen_StartY; int screen_EndX; int screen_EndY; + int screen_StartX_crt; + int screen_StartY_crt; + int screen_EndX_crt; + int screen_EndY_crt; + int screen_StartX_lcd; + int screen_StartY_lcd; + int screen_EndX_lcd; + int screen_EndY_lcd; + int screen_preset; int screen_width; int screen_height;