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
This commit is contained in:
Dimitris Panokostas 2020-02-05 00:11:38 +01:00
parent 4ab0e9eda8
commit e80850e4a3
2 changed files with 20 additions and 6 deletions

View file

@ -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);

View file

@ -103,7 +103,7 @@ extern std::vector<std::string> 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];