improved VideoDialog alignment

moved "Center Windows" to UIDialog
This commit is contained in:
thrust26 2020-05-10 12:46:54 +02:00
parent fd02fb6e86
commit b21efb6269
4 changed files with 95 additions and 93 deletions

View File

@ -105,12 +105,13 @@ UIDialog::UIDialog(OSystem& osystem, DialogContainer& parent,
wid.push_back(myDialogFontPopup);
// Enable HiDPI mode
myHidpiWidget = new CheckboxWidget(myTab, font, myDialogFontPopup->getRight() + fontWidth * 5,
xpos = myDialogFontPopup->getRight() + fontWidth * 5;
myHidpiWidget = new CheckboxWidget(myTab, font, xpos,
ypos + 1, "HiDPI mode (*)");
wid.push_back(myHidpiWidget);
ypos += lineHeight + VGAP;
// Dialog position
xpos = HBORDER; ypos += lineHeight + VGAP;
items.clear();
VarList::push_back(items, "Centered", 0);
VarList::push_back(items, "Left top", 1);
@ -120,9 +121,14 @@ UIDialog::UIDialog(OSystem& osystem, DialogContainer& parent,
myPositionPopup = new PopUpWidget(myTab, font, xpos, ypos, pwidth, lineHeight,
items, "Dialogs position", lwidth);
wid.push_back(myPositionPopup);
ypos += lineHeight + VGAP * 2;
// Center window (in windowed mode)
xpos = myHidpiWidget->getLeft();
myCenter = new CheckboxWidget(myTab, _font, xpos, ypos + 1, "Center windows");
wid.push_back(myCenter);
// Confirm dialog when exiting emulation
xpos = HBORDER; ypos += lineHeight + VGAP * 2;
myConfirmExitWidget = new CheckboxWidget(myTab, font, xpos, ypos, "Confirm exiting emulation");
wid.push_back(myConfirmExitWidget);
ypos += lineHeight + VGAP * 3;
@ -303,6 +309,10 @@ UIDialog::UIDialog(OSystem& osystem, DialogContainer& parent,
wid.clear();
addDefaultsOKCancelBGroup(wid, font);
addBGroupToFocusList(wid);
#ifndef WINDOWED_SUPPORT
myCenter->clearFlags(Widget::FLAG_ENABLED);
#endif
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -353,6 +363,10 @@ void UIDialog::loadConfig()
const string& pal = settings.getString("uipalette");
myPalettePopup->setSelected(pal, "standard");
// Dialog font
const string& dialogFont = settings.getString("dialogfont");
myDialogFontPopup->setSelected(dialogFont, "medium");
// Enable HiDPI mode
if (!instance().frameBuffer().hidpiAllowed())
{
@ -364,16 +378,15 @@ void UIDialog::loadConfig()
myHidpiWidget->setState(settings.getBool("hidpi"));
}
// Confirm dialog when exiting emulation
myConfirmExitWidget->setState(settings.getBool("confirmexit"));
// Dialog font
const string& dialogFont = settings.getString("dialogfont");
myDialogFontPopup->setSelected(dialogFont, "medium");
// Dialog position
myPositionPopup->setSelected(settings.getString("dialogpos"), "0");
// Center window
myCenter->setState(settings.getBool("center"));
// Confirm dialog when exiting emulation
myConfirmExitWidget->setState(settings.getBool("confirmexit"));
// Listwidget quick delay
int delay = settings.getInt("listdelay");
myListDelaySlider->setValue(delay);
@ -436,16 +449,19 @@ void UIDialog::saveConfig()
myPalettePopup->getSelectedTag().toString());
instance().frameBuffer().setUIPalette();
// Enable HiDPI mode
settings.setValue("hidpi", myHidpiWidget->getState());
// Dialog font
settings.setValue("dialogfont",
myDialogFontPopup->getSelectedTag().toString());
// Enable HiDPI mode
settings.setValue("hidpi", myHidpiWidget->getState());
// Dialog position
settings.setValue("dialogpos", myPositionPopup->getSelectedTag().toString());
// Center window
settings.setValue("center", myCenter->getState());
// Confirm dialog when exiting emulation
settings.setValue("confirmexit", myConfirmExitWidget->getState());
@ -481,9 +497,10 @@ void UIDialog::setDefaults()
{
case 0: // Misc. options
myPalettePopup->setSelected("standard");
myHidpiWidget->setState(false);
myDialogFontPopup->setSelected("medium", "");
myHidpiWidget->setState(false);
myPositionPopup->setSelected("0");
myCenter->setState(false);
myConfirmExitWidget->setState(false);
myListDelaySlider->setValue(300);
myWheelLinesSlider->setValue(4);

View File

@ -66,9 +66,10 @@ class UIDialog : public Dialog, public CommandSender
// Misc options
PopUpWidget* myPalettePopup{nullptr};
CheckboxWidget* myHidpiWidget{nullptr};
PopUpWidget* myDialogFontPopup{nullptr};
CheckboxWidget* myHidpiWidget{nullptr};
PopUpWidget* myPositionPopup{nullptr};
CheckboxWidget* myCenter{nullptr};
CheckboxWidget* myConfirmExitWidget{nullptr};
SliderWidget* myListDelaySlider{nullptr};
SliderWidget* myWheelLinesSlider{nullptr};

View File

@ -115,7 +115,8 @@ VideoDialog::VideoDialog(OSystem& osystem, DialogContainer& parent,
// Disable certain functions when we know they aren't present
#ifndef WINDOWED_SUPPORT
myFullscreen->clearFlags(Widget::FLAG_ENABLED);
myCenter->clearFlags(Widget::FLAG_ENABLED);
myUseStretch->clearFlags(Widget::FLAG_ENABLED);
myTVOverscan->clearFlags(Widget::FLAG_ENABLED);
#endif
}
@ -129,17 +130,14 @@ void VideoDialog::addGeneralTab()
const int VGAP = fontHeight / 4;
const int VBORDER = fontHeight / 2;
const int HBORDER = fontWidth * 1.25;
const int INDENT = fontWidth * 2;
int xpos, ypos, tabID;
int lwidth = _font.getStringWidth("V-Size adjust "),
pwidth = _font.getStringWidth("XXXXxXXXX"),
swidth = fontWidth * 8 - fontWidth / 2;
const int INDENT = CheckboxWidget::prefixSize(_font);
const int lwidth = _font.getStringWidth("V-Size adjust "),
pwidth = _font.getStringWidth("XXXXxXXXX");
int xpos = HBORDER,
ypos = VBORDER;
WidgetArray wid;
VariantList items;
tabID = myTab->addTab(" General ");
xpos = HBORDER; ypos = VBORDER;
const int tabID = myTab->addTab(" General ");
// Video renderer
myRenderer = new PopUpWidget(myTab, _font, xpos, ypos, pwidth, lineHeight,
@ -150,8 +148,32 @@ void VideoDialog::addGeneralTab()
// TIA interpolation
myTIAInterpolate = new CheckboxWidget(myTab, _font, xpos, ypos + 1, "Interpolation ");
wid.push_back(myTIAInterpolate); ypos += lineHeight + VGAP;
wid.push_back(myTIAInterpolate); ypos += lineHeight + VGAP * 4;
// Fullscreen
myFullscreen = new CheckboxWidget(myTab, _font, xpos, ypos + 1, "Fullscreen", kFullScreenChanged);
wid.push_back(myFullscreen);
ypos += lineHeight + VGAP;
/*pwidth = font.getStringWidth("0: 3840x2860@120Hz");
myFullScreenMode = new PopUpWidget(myTab, font, xpos + INDENT + 2, ypos, pwidth, lineHeight,
instance().frameBuffer().supportedScreenModes(), "Mode ");
wid.push_back(myFullScreenMode);
ypos += lineHeight + VGAP;*/
// FS stretch
myUseStretch = new CheckboxWidget(myTab, _font, xpos + INDENT, ypos + 1, "Stretch");
wid.push_back(myUseStretch);
ypos += lineHeight + VGAP;
// FS overscan
const int swidth = myRenderer->getWidth() - lwidth;
myTVOverscan = new SliderWidget(myTab, _font, xpos + INDENT, ypos - 1, swidth, lineHeight,
"Overscan", lwidth - INDENT, kOverscanChanged, fontWidth * 3, "%");
myTVOverscan->setMinValue(0); myTVOverscan->setMaxValue(10);
myTVOverscan->setTickmarkIntervals(2);
wid.push_back(myTVOverscan);
ypos += lineHeight + VGAP;
// TIA zoom levels (will be dynamically filled later)
myTIAZoom = new SliderWidget(myTab, _font, xpos, ypos - 1, swidth, lineHeight,
@ -160,14 +182,14 @@ void VideoDialog::addGeneralTab()
wid.push_back(myTIAZoom);
ypos += lineHeight + VGAP;
// Aspect ratio (NTSC mode)
// Vertical size
myVSizeAdjust =
new SliderWidget(myTab, _font, xpos, ypos-1, swidth, lineHeight,
"V-Size adjust", lwidth, kVSizeChanged, fontWidth * 7, "%", 0, true);
myVSizeAdjust->setMinValue(-5); myVSizeAdjust->setMaxValue(5);
myVSizeAdjust->setTickmarkIntervals(2);
wid.push_back(myVSizeAdjust);
ypos += lineHeight + VGAP;
ypos += lineHeight + VGAP * 4;
// Speed
mySpeed =
@ -187,30 +209,6 @@ void VideoDialog::addGeneralTab()
xpos = myVSizeAdjust->getRight() + fontWidth * 3;
ypos = VBORDER;
// Fullscreen
myFullscreen = new CheckboxWidget(myTab, _font, xpos, ypos + 1, "Fullscreen", kFullScreenChanged);
wid.push_back(myFullscreen);
ypos += lineHeight + VGAP;
/*pwidth = font.getStringWidth("0: 3840x2860@120Hz");
myFullScreenMode = new PopUpWidget(myTab, font, xpos + INDENT + 2, ypos, pwidth, lineHeight,
instance().frameBuffer().supportedScreenModes(), "Mode ");
wid.push_back(myFullScreenMode);
ypos += lineHeight + VGAP;*/
// FS stretch
myUseStretch = new CheckboxWidget(myTab, _font, xpos + INDENT, ypos + 1, "Stretch");
wid.push_back(myUseStretch);
ypos += lineHeight + VGAP;
// FS overscan
myTVOverscan = new SliderWidget(myTab, _font, xpos + INDENT, ypos - 1, swidth, lineHeight,
"Overscan", _font.getStringWidth("Overscan "), kOverscanChanged, fontWidth * 3, "%");
myTVOverscan->setMinValue(0); myTVOverscan->setMaxValue(10);
myTVOverscan->setTickmarkIntervals(2);
wid.push_back(myTVOverscan);
ypos += (lineHeight + VGAP) * 2;
// Skip progress load bars for SuperCharger ROMs
// Doesn't really belong here, but I couldn't find a better place for it
myFastSCBios = new CheckboxWidget(myTab, _font, xpos, ypos + 1, "Fast SuperCharger load");
@ -222,11 +220,6 @@ void VideoDialog::addGeneralTab()
wid.push_back(myUIMessages);
ypos += lineHeight + VGAP;
// Center window (in windowed mode)
myCenter = new CheckboxWidget(myTab, _font, xpos, ypos + 1, "Center window");
wid.push_back(myCenter);
ypos += (lineHeight + VGAP) * 2;
// Use multi-threading
myUseThreads = new CheckboxWidget(myTab, _font, xpos, ypos + 1, "Multi-threading");
wid.push_back(myUseThreads);
@ -246,15 +239,13 @@ void VideoDialog::addPaletteTab()
const int HBORDER = fontWidth * 1.25;
const int INDENT = fontWidth * 2;
const int VGAP = fontHeight / 4;
const int lwidth = _font.getStringWidth(" NTSC phase ");
const int pwidth = _font.getStringWidth("Standard");
int xpos = HBORDER,
ypos = VBORDER;
int swidth = fontWidth * 8 - fontWidth / 2;
int lwidth = _font.getStringWidth("Saturation ");
int pwidth = _font.getStringWidth("Standard");
WidgetArray wid;
VariantList items;
int tabID = myTab->addTab(" Palettes ");
const int tabID = myTab->addTab(" Palettes ");
// TIA Palette
items.clear();
@ -268,9 +259,9 @@ void VideoDialog::addPaletteTab()
wid.push_back(myTIAPalette);
ypos += lineHeight + VGAP;
swidth = myTIAPalette->getWidth() - lwidth;
int plWidth = _font.getStringWidth("NTSC phase ");
int pswidth = swidth - INDENT + lwidth - plWidth;
const int swidth = myTIAPalette->getWidth() - lwidth;
const int plWidth = _font.getStringWidth("NTSC phase ");
const int pswidth = swidth - INDENT + lwidth - plWidth;
myPhaseShiftNtsc =
new SliderWidget(myTab, _font, xpos + INDENT, ypos-1, pswidth, lineHeight,
@ -316,16 +307,15 @@ void VideoDialog::addTVEffectsTab()
buttonHeight = _font.getLineHeight() * 1.25;
const int VBORDER = fontHeight / 2;
const int HBORDER = fontWidth * 1.25;
const int INDENT = fontWidth * 2;
const int INDENT = CheckboxWidget::prefixSize(_font);// fontWidth * 2;
const int VGAP = fontHeight / 4;
int xpos = HBORDER,
ypos = VBORDER;
int swidth = fontWidth * 8 - fontWidth / 2;
int lwidth = _font.getStringWidth("TV Mode ");
int pwidth = _font.getStringWidth("Bad adjust");
const int lwidth = _font.getStringWidth("Saturation ");
const int pwidth = _font.getStringWidth("Bad adjust ");
WidgetArray wid;
VariantList items;
int tabID = myTab->addTab(" TV Effects ");
const int tabID = myTab->addTab(" TV Effects ");
items.clear();
VarList::push_back(items, "Disabled", static_cast<uInt32>(NTSCFilter::Preset::OFF));
@ -334,15 +324,14 @@ void VideoDialog::addTVEffectsTab()
VarList::push_back(items, "Composite", static_cast<uInt32>(NTSCFilter::Preset::COMPOSITE));
VarList::push_back(items, "Bad adjust", static_cast<uInt32>(NTSCFilter::Preset::BAD));
VarList::push_back(items, "Custom", static_cast<uInt32>(NTSCFilter::Preset::CUSTOM));
myTVMode =
new PopUpWidget(myTab, _font, xpos, ypos, pwidth, lineHeight,
items, "TV mode ", lwidth, kTVModeChanged);
myTVMode = new PopUpWidget(myTab, _font, xpos, ypos, pwidth, lineHeight,
items, "TV mode ", 0, kTVModeChanged);
wid.push_back(myTVMode);
ypos += lineHeight + VGAP;
// Custom adjustables (using macro voodoo)
xpos += INDENT - 2; ypos += 0;
lwidth = _font.getStringWidth("Saturation ");
const int swidth = myTVMode->getWidth() - INDENT - lwidth;
xpos += INDENT;
#define CREATE_CUSTOM_SLIDERS(obj, desc, cmd) \
myTV ## obj = \
@ -359,10 +348,9 @@ void VideoDialog::addTVEffectsTab()
CREATE_CUSTOM_SLIDERS(Fringe, "Fringing ", 0)
CREATE_CUSTOM_SLIDERS(Bleed, "Bleeding ", 0)
xpos += myTVContrast->getWidth() + fontWidth * 6;
ypos = VBORDER;
ypos += VGAP * 3;
lwidth = _font.getStringWidth("Intensity ");
xpos = HBORDER;
// TV Phosphor effect
myTVPhosphor = new CheckboxWidget(myTab, _font, xpos, ypos + 1, "Phosphor for all ROMs", kPhosphorChanged);
@ -371,9 +359,8 @@ void VideoDialog::addTVEffectsTab()
// TV Phosphor blend level
xpos += INDENT;
swidth = _font.getMaxCharWidth() * 10;
CREATE_CUSTOM_SLIDERS(PhosLevel, "Blend ", kPhosBlendChanged)
ypos += VGAP * 2;
CREATE_CUSTOM_SLIDERS(PhosLevel, "Blend", kPhosBlendChanged)
ypos += VGAP;
// Scanline intensity and interpolation
xpos -= INDENT;
@ -381,12 +368,14 @@ void VideoDialog::addTVEffectsTab()
ypos += lineHeight + VGAP / 2;
xpos += INDENT;
CREATE_CUSTOM_SLIDERS(ScanIntense, "Intensity ", kScanlinesChanged)
ypos += VGAP * 3;
CREATE_CUSTOM_SLIDERS(ScanIntense, "Intensity", kScanlinesChanged)
// Create buttons in 2nd column
xpos = myTVSharp->getRight() + fontWidth * 2;
ypos = VBORDER - VGAP / 2;
// Adjustable presets
xpos -= INDENT;
int cloneWidth = _font.getStringWidth("Clone Bad Adjust") + 20;
int cloneWidth = _font.getStringWidth("Clone Bad Adjust") + fontWidth * 2.5;
#define CREATE_CLONE_BUTTON(obj, desc) \
myClone ## obj = \
new ButtonWidget(myTab, _font, xpos, ypos, cloneWidth, buttonHeight,\
@ -458,9 +447,6 @@ void VideoDialog::loadConfig()
// Show UI messages
myUIMessages->setState(instance().settings().getBool("uimessages"));
// Center window
myCenter->setState(instance().settings().getBool("center"));
// Fast loading of Supercharger BIOS
myFastSCBios->setState(instance().settings().getBool("fastscbios"));
@ -544,9 +530,6 @@ void VideoDialog::saveConfig()
// Show UI messages
instance().settings().setValue("uimessages", myUIMessages->getState());
// Center window
instance().settings().setValue("center", myCenter->getState());
// Fast loading of Supercharger BIOS
instance().settings().setValue("fastscbios", myFastSCBios->getState());
@ -623,7 +606,6 @@ void VideoDialog::setDefaults()
myUseStretch->setState(false);
myUseVSync->setState(true);
myUIMessages->setState(true);
myCenter->setState(false);
myFastSCBios->setState(true);
myUseThreads->setState(false);

View File

@ -22,6 +22,7 @@ class CommandSender;
class CheckboxWidget;
class DialogContainer;
class PopUpWidget;
class RadioButtonGroup;
class SliderWidget;
class StaticTextWidget;
class TabWidget;
@ -67,13 +68,13 @@ class VideoDialog : public Dialog
SliderWidget* myVSizeAdjust{nullptr};
SliderWidget* mySpeed{nullptr};
RadioButtonGroup* myZoomGroup{nullptr};
CheckboxWidget* myFullscreen{nullptr};
//PopUpWidget* myFullScreenMode;
CheckboxWidget* myUseStretch{nullptr};
SliderWidget* myTVOverscan{nullptr};
CheckboxWidget* myUseVSync{nullptr};
CheckboxWidget* myUIMessages{nullptr};
CheckboxWidget* myCenter{nullptr};
CheckboxWidget* myFastSCBios{nullptr};
CheckboxWidget* myUseThreads{nullptr};
@ -112,6 +113,7 @@ class VideoDialog : public Dialog
kSpeedupChanged = 'VDSp',
kVSizeChanged = 'VDVs',
kFullScreenChanged = 'VDFs',
kZoomChanged = 'VDZo',
kOverscanChanged = 'VDOv',
kTVModeChanged = 'VDtv',