Fixed #538: Implemented GUI controls for display centering

This commit is contained in:
Dimitris Panokostas 2019-11-23 12:40:53 +01:00
parent b756445a87
commit 1466ae965b
3 changed files with 60 additions and 8 deletions

View file

@ -720,6 +720,29 @@ int check_prefs_changed_gfx()
update_display(&currprefs);
changed = 1;
}
if (currprefs.gf[0].gfx_filter_autoscale != changed_prefs.gf[0].gfx_filter_autoscale ||
currprefs.gfx_xcenter_pos != changed_prefs.gfx_xcenter_pos ||
currprefs.gfx_ycenter_pos != changed_prefs.gfx_ycenter_pos ||
currprefs.gfx_xcenter_size != changed_prefs.gfx_xcenter_size ||
currprefs.gfx_ycenter_size != changed_prefs.gfx_ycenter_size ||
currprefs.gfx_xcenter != changed_prefs.gfx_xcenter ||
currprefs.gfx_ycenter != changed_prefs.gfx_ycenter)
{
currprefs.gfx_xcenter_pos = changed_prefs.gfx_xcenter_pos;
currprefs.gfx_ycenter_pos = changed_prefs.gfx_ycenter_pos;
currprefs.gfx_xcenter_size = changed_prefs.gfx_xcenter_size;
currprefs.gfx_ycenter_size = changed_prefs.gfx_ycenter_size;
currprefs.gfx_xcenter = changed_prefs.gfx_xcenter;
currprefs.gfx_ycenter = changed_prefs.gfx_ycenter;
currprefs.gf[0].gfx_filter_autoscale = changed_prefs.gf[0].gfx_filter_autoscale;
get_custom_limits(NULL, NULL, NULL, NULL, NULL);
fixup_prefs_dimensions(&changed_prefs);
return 1;
}
if (currprefs.leds_on_screen != changed_prefs.leds_on_screen ||
currprefs.hide_idle_led != changed_prefs.hide_idle_led)
{

View file

@ -203,17 +203,18 @@ static NavigationMap navMap[] =
// active move left move right move up move down
// PanelDisplay
{"sldWidth", "", "", "Frameskip", "sldHeight"},
{"sldHeight", "", "", "sldWidth", "sldVertPos"},
{"sldVertPos", "", "", "sldHeight", "Auto"},
{"Auto", "Display", "Single", "sldVertPos", "Nearest Neighbor (pixelated)"},
{"sldHeight", "", "", "sldWidth", "Auto"},
{"Auto", "Display", "Single", "sldHeight", "Nearest Neighbor (pixelated)"},
{"Nearest Neighbor (pixelated)", "Display", "Double", "Auto", "Linear (smooth)"},
{"Linear (smooth)", "Display", "Scanlines", "Nearest Neighbor (pixelated)", "CorrectAR"},
{"Single", "Auto", "Auto", "sdlVertPos", "Double"},
{"Single", "Auto", "Auto", "Vertical", "Double"},
{"Double", "Nearest Neighbor (pixelated)", "Nearest Neighbor (pixelated)", "Single", "Scanlines"},
{"Scanlines", "Linear (smooth)", "Linear (smooth)", "Double", "Fullscreen"},
{"CorrectAR", "Display", "Fullscreen", "Linear (smooth)", "Frameskip"},
{"Fullscreen", "CorrectAR", "CorrectAR", "Scanlines", "Frameskip"},
{"Frameskip", "Display", "Display", "CorrectAR", "sldWidth"},
{"Vertical", "", "", "Horizontal", "Single"},
{"Horizontal", "", "", "", "Vertical"},
// active move left move right move up move down
//PanelSound

View file

@ -38,6 +38,10 @@ static gcn::UaeCheckBox* chkFrameskip;
static gcn::UaeCheckBox* chkAspect;
static gcn::UaeCheckBox* chkFullscreen;
static gcn::Window* grpCentering;
static gcn::UaeCheckBox* chkHorizontal;
static gcn::UaeCheckBox* chkVertical;
class AmigaScreenActionListener : public gcn::ActionListener
{
public:
@ -78,6 +82,12 @@ public:
changed_prefs.gfx_apmode[1].gfx_fullscreen = GFX_FULLSCREEN;
}
}
else if (actionEvent.getSource() == chkHorizontal)
changed_prefs.gfx_xcenter = chkHorizontal->isSelected() ? 2 : 0;
else if (actionEvent.getSource() == chkVertical)
changed_prefs.gfx_ycenter = chkVertical->isSelected() ? 2 : 0;
}
};
@ -151,6 +161,11 @@ void InitPanelDisplay(const struct _ConfigCategory& category)
sldAmigaHeight->addActionListener(amigaScreenActionListener);
lblAmigaHeightInfo = new gcn::Label("200");
chkHorizontal = new gcn::UaeCheckBox("Horizontal");
chkHorizontal->addActionListener(amigaScreenActionListener);
chkVertical = new gcn::UaeCheckBox("Vertical");
chkVertical->addActionListener(amigaScreenActionListener);
chkAspect = new gcn::UaeCheckBox("Correct Aspect Ratio");
chkAspect->setId("CorrectAR");
chkAspect->addActionListener(amigaScreenActionListener);
@ -180,8 +195,17 @@ void InitPanelDisplay(const struct _ConfigCategory& category)
lblAmigaWidth->getX() + lblAmigaWidth->getWidth() + sldAmigaWidth->getWidth() + lblAmigaWidth->getWidth() + (
DISTANCE_BORDER * 2), posY + DISTANCE_BORDER);
grpAmigaScreen->setBaseColor(gui_baseCol);
category.panel->add(grpAmigaScreen);
grpCentering = new gcn::Window("Centering");
grpCentering->setPosition(DISTANCE_BORDER + grpAmigaScreen->getWidth() + DISTANCE_BORDER, DISTANCE_BORDER);
grpCentering->add(chkHorizontal, DISTANCE_BORDER, DISTANCE_BORDER);
grpCentering->add(chkVertical, DISTANCE_BORDER, chkHorizontal->getY() + chkHorizontal->getHeight() + DISTANCE_NEXT_Y);
grpCentering->setMovable(false);
grpCentering->setSize(chkHorizontal->getX() + chkHorizontal->getWidth() + DISTANCE_BORDER * 2, posY + DISTANCE_BORDER);
grpCentering->setBaseColor(gui_baseCol);
category.panel->add(grpCentering);
posY = DISTANCE_BORDER + grpAmigaScreen->getHeight() + DISTANCE_NEXT_Y;
scalingMethodActionListener = new ScalingMethodActionListener();
@ -250,11 +274,12 @@ void ExitPanelDisplay()
delete lblAmigaHeight;
delete sldAmigaHeight;
delete lblAmigaHeightInfo;
//delete lblVertPos;
//delete sldVertPos;
//delete lblVertPosInfo;
delete grpAmigaScreen;
delete chkHorizontal;
delete chkVertical;
delete grpCentering;
delete chkAspect;
delete chkFullscreen;
@ -301,6 +326,9 @@ void RefreshPanelDisplay()
}
}
chkHorizontal->setSelected(changed_prefs.gfx_xcenter == 2);
chkVertical->setSelected(changed_prefs.gfx_ycenter == 2);
chkAspect->setSelected(changed_prefs.gfx_correct_aspect);
chkFullscreen->setSelected(changed_prefs.gfx_apmode[0].gfx_fullscreen == GFX_FULLSCREEN);