From e80850e4a350d2e4e65c966cd87cdfe9f20702fc Mon Sep 17 00:00:00 2001 From: Dimitris Panokostas Date: Wed, 5 Feb 2020 00:11:38 +0100 Subject: [PATCH] Added 270 as Height option in GUI, improved behavior when loading from config (fixes #571) If loading Width/Height values from a config file that don't exist in the list of presets, still honor that in the GUI --- src/osdep/gui/PanelDisplay.cpp | 24 +++++++++++++++++++----- src/osdep/target.h | 2 +- 2 files changed, 20 insertions(+), 6 deletions(-) diff --git a/src/osdep/gui/PanelDisplay.cpp b/src/osdep/gui/PanelDisplay.cpp index 4470b67d..55b6c148 100644 --- a/src/osdep/gui/PanelDisplay.cpp +++ b/src/osdep/gui/PanelDisplay.cpp @@ -14,7 +14,7 @@ #include "gui_handling.h" const int amigawidth_values[] = {320, 362, 384, 640, 704, 720}; -const int amigaheight_values[] = {200, 216, 240, 256, 262, 284}; +const int amigaheight_values[] = {200, 216, 240, 256, 262, 270, 284}; static gcn::Window* grpScalingMethod; static gcn::UaeRadioButton* optAuto; @@ -141,7 +141,7 @@ void InitPanelDisplay(const struct _ConfigCategory& category) lblAmigaWidth = new gcn::Label("Width:"); lblAmigaWidth->setAlignment(gcn::Graphics::RIGHT); - sldAmigaWidth = new gcn::Slider(0, 5); + sldAmigaWidth = new gcn::Slider(0, AMIGAWIDTH_COUNT - 1); sldAmigaWidth->setSize(160, SLIDER_HEIGHT); sldAmigaWidth->setBaseColor(gui_baseCol); sldAmigaWidth->setMarkerLength(20); @@ -152,7 +152,7 @@ void InitPanelDisplay(const struct _ConfigCategory& category) lblAmigaHeight = new gcn::Label("Height:"); lblAmigaHeight->setAlignment(gcn::Graphics::RIGHT); - sldAmigaHeight = new gcn::Slider(0, 5); + sldAmigaHeight = new gcn::Slider(0, AMIGAHEIGHT_COUNT - 1); sldAmigaHeight->setSize(160, SLIDER_HEIGHT); sldAmigaHeight->setBaseColor(gui_baseCol); sldAmigaHeight->setMarkerLength(20); @@ -304,7 +304,7 @@ void RefreshPanelDisplay() int i; char tmp[32]; - for (i = 0; i < 6; ++i) + for (i = 0; i < AMIGAWIDTH_COUNT; ++i) { if (changed_prefs.gfx_monitor.gfx_size.width == amigawidth_values[i]) { @@ -313,9 +313,16 @@ void RefreshPanelDisplay() lblAmigaWidthInfo->setCaption(tmp); break; } + // if we reached the end and didn't find anything, set the maximum value + if (i == AMIGAWIDTH_COUNT - 1) + { + snprintf(tmp, 32, "%d", changed_prefs.gfx_monitor.gfx_size.width); + lblAmigaWidthInfo->setCaption(tmp); + break; + } } - for (i = 0; i < 6; ++i) + for (i = 0; i < AMIGAHEIGHT_COUNT; ++i) { if (changed_prefs.gfx_monitor.gfx_size.height == amigaheight_values[i]) { @@ -324,6 +331,13 @@ void RefreshPanelDisplay() lblAmigaHeightInfo->setCaption(tmp); break; } + // if we reached the end and didn't find anything, set the maximum value + if (i == AMIGAHEIGHT_COUNT - 1) + { + snprintf(tmp, 32, "%d", changed_prefs.gfx_monitor.gfx_size.height); + lblAmigaHeightInfo->setCaption(tmp); + break; + } } chkHorizontal->setSelected(changed_prefs.gfx_xcenter == 2); diff --git a/src/osdep/target.h b/src/osdep/target.h index d5862525..12520fc5 100644 --- a/src/osdep/target.h +++ b/src/osdep/target.h @@ -103,7 +103,7 @@ extern std::vector lstMRUCDList; extern void AddFileToCDList(const char *file, int moveToTop); #define AMIGAWIDTH_COUNT 6 -#define AMIGAHEIGHT_COUNT 6 +#define AMIGAHEIGHT_COUNT 7 extern const int amigawidth_values[AMIGAWIDTH_COUNT]; extern const int amigaheight_values[AMIGAHEIGHT_COUNT];