mirror of https://github.com/stella-emu/stella.git
add hidpi option checkbox to UIDialog
This commit is contained in:
parent
087dd1dbb9
commit
093fd4eb75
|
@ -53,6 +53,7 @@ FrameBuffer::FrameBuffer(OSystem& osystem)
|
||||||
myStatsEnabled(false),
|
myStatsEnabled(false),
|
||||||
myLastScanlines(0),
|
myLastScanlines(0),
|
||||||
myGrabMouse(false),
|
myGrabMouse(false),
|
||||||
|
myHiDPIAllowed(false),
|
||||||
myHiDPIEnabled(false),
|
myHiDPIEnabled(false),
|
||||||
myCurrentModeList(nullptr)
|
myCurrentModeList(nullptr)
|
||||||
{
|
{
|
||||||
|
@ -85,9 +86,9 @@ bool FrameBuffer::initialize()
|
||||||
myDesktopSize = myAbsDesktopSize;
|
myDesktopSize = myAbsDesktopSize;
|
||||||
|
|
||||||
// Check for HiDPI mode (is it activated, and can we use it?)
|
// Check for HiDPI mode (is it activated, and can we use it?)
|
||||||
myHiDPIEnabled = myOSystem.settings().getBool("hidpi") &&
|
myHiDPIAllowed = ((myAbsDesktopSize.w / 2) >= FBMinimum::Width) &&
|
||||||
((myAbsDesktopSize.w / 2) >= FBMinimum::Width) &&
|
|
||||||
((myAbsDesktopSize.h / 2) >= FBMinimum::Height);
|
((myAbsDesktopSize.h / 2) >= FBMinimum::Height);
|
||||||
|
myHiDPIEnabled = myHiDPIAllowed && myOSystem.settings().getBool("hidpi");
|
||||||
|
|
||||||
// In HiDPI mode, the desktop resolution is essentially halved
|
// In HiDPI mode, the desktop resolution is essentially halved
|
||||||
// Later, the output is scaled and rendered in 2x mode
|
// Later, the output is scaled and rendered in 2x mode
|
||||||
|
|
|
@ -259,6 +259,12 @@ class FrameBuffer
|
||||||
*/
|
*/
|
||||||
void stateChanged(EventHandlerState state);
|
void stateChanged(EventHandlerState state);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Answer whether hidpi mode is allowed. In this mode, all FBSurfaces
|
||||||
|
are scaled to 2x normal size.
|
||||||
|
*/
|
||||||
|
bool hidpiAllowed() const { return myHiDPIAllowed; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Answer whether hidpi mode is enabled. In this mode, all FBSurfaces
|
Answer whether hidpi mode is enabled. In this mode, all FBSurfaces
|
||||||
are scaled to 2x normal size.
|
are scaled to 2x normal size.
|
||||||
|
@ -562,6 +568,7 @@ class FrameBuffer
|
||||||
uInt32 myLastScanlines;
|
uInt32 myLastScanlines;
|
||||||
|
|
||||||
bool myGrabMouse;
|
bool myGrabMouse;
|
||||||
|
bool myHiDPIAllowed;
|
||||||
bool myHiDPIEnabled;
|
bool myHiDPIEnabled;
|
||||||
|
|
||||||
// The list of all available video modes for this framebuffer
|
// The list of all available video modes for this framebuffer
|
||||||
|
|
|
@ -41,7 +41,6 @@ Settings::Settings()
|
||||||
setPermanent("center", "false");
|
setPermanent("center", "false");
|
||||||
setPermanent("palette", "standard");
|
setPermanent("palette", "standard");
|
||||||
setPermanent("uimessages", "true");
|
setPermanent("uimessages", "true");
|
||||||
setPermanent("hidpi", "false");
|
|
||||||
|
|
||||||
// TIA specific options
|
// TIA specific options
|
||||||
setPermanent("tia.zoom", "3");
|
setPermanent("tia.zoom", "3");
|
||||||
|
@ -122,6 +121,7 @@ Settings::Settings()
|
||||||
DebuggerDialog::kMediumFontMinH));
|
DebuggerDialog::kMediumFontMinH));
|
||||||
#endif
|
#endif
|
||||||
setPermanent("uipalette", "standard");
|
setPermanent("uipalette", "standard");
|
||||||
|
setPermanent("hidpi", "false");
|
||||||
setPermanent("listdelay", "300");
|
setPermanent("listdelay", "300");
|
||||||
setPermanent("mwheel", "4");
|
setPermanent("mwheel", "4");
|
||||||
setPermanent("basic_settings", false);
|
setPermanent("basic_settings", false);
|
||||||
|
@ -462,13 +462,16 @@ void Settings::usage() const
|
||||||
<< " -launcherroms <1|0> Show only ROMs in the launcher (vs. all files)\n"
|
<< " -launcherroms <1|0> Show only ROMs in the launcher (vs. all files)\n"
|
||||||
<< " -romviewer <0|1|2> Show ROM info viewer at given zoom level in ROM\n"
|
<< " -romviewer <0|1|2> Show ROM info viewer at given zoom level in ROM\n"
|
||||||
<< " launcher (0 for off)\n"
|
<< " launcher (0 for off)\n"
|
||||||
|
<< " -uipalette <standard| Selects GUI theme\n"
|
||||||
|
<< " classic|light>\n"
|
||||||
|
<< " -hidpi <0|1> Enable HiDPI mode\n"
|
||||||
|
<< " -dialogpos <0..4> Display all dialogs at given positions\n"
|
||||||
<< " -listdelay <delay> Time to wait between keypresses in list widgets\n"
|
<< " -listdelay <delay> Time to wait between keypresses in list widgets\n"
|
||||||
<< " (300-1000)\n"
|
<< " (300-1000)\n"
|
||||||
<< " -mwheel <lines> Number of lines the mouse wheel will scroll in\n"
|
<< " -mwheel <lines> Number of lines the mouse wheel will scroll in\n"
|
||||||
<< " UI\n"
|
<< " UI\n"
|
||||||
<< " -basic_settings <0|1> Display only a basic settings dialog\n"
|
<< " -basic_settings <0|1> Display only a basic settings dialog\n"
|
||||||
<< " -dialogpos <0..4> Display all dialogs at given positions\n"
|
<< " -romdir <dir> Directory from which to load ROM files\n"
|
||||||
<< " -romdir <dir> Directory in which to load ROM files\n"
|
|
||||||
<< " -avoxport <name> The name of the serial port where an AtariVox is\n"
|
<< " -avoxport <name> The name of the serial port where an AtariVox is\n"
|
||||||
<< " connected\n"
|
<< " connected\n"
|
||||||
<< " -holdreset Start the emulator with the Game Reset switch\n"
|
<< " -holdreset Start the emulator with the Game Reset switch\n"
|
||||||
|
|
|
@ -96,6 +96,11 @@ UIDialog::UIDialog(OSystem& osystem, DialogContainer& parent,
|
||||||
myPositionPopup = new PopUpWidget(myTab, font, xpos, ypos, pwidth, lineHeight,
|
myPositionPopup = new PopUpWidget(myTab, font, xpos, ypos, pwidth, lineHeight,
|
||||||
items, "Dialogs position ", lwidth);
|
items, "Dialogs position ", lwidth);
|
||||||
wid.push_back(myPositionPopup);
|
wid.push_back(myPositionPopup);
|
||||||
|
ypos += lineHeight + V_GAP;
|
||||||
|
|
||||||
|
// Enable HiDPI mode
|
||||||
|
myHidpiWidget = new CheckboxWidget(myTab, font, xpos, ypos, "HiDPI mode");
|
||||||
|
wid.push_back(myHidpiWidget);
|
||||||
ypos += lineHeight + V_GAP * 4;
|
ypos += lineHeight + V_GAP * 4;
|
||||||
|
|
||||||
// Delay between quick-selecting characters in ListWidget
|
// Delay between quick-selecting characters in ListWidget
|
||||||
|
@ -276,6 +281,17 @@ void UIDialog::loadConfig()
|
||||||
const string& pal = settings.getString("uipalette");
|
const string& pal = settings.getString("uipalette");
|
||||||
myPalettePopup->setSelected(pal, "standard");
|
myPalettePopup->setSelected(pal, "standard");
|
||||||
|
|
||||||
|
// Enable HiDPI mode
|
||||||
|
if (!instance().frameBuffer().hidpiAllowed())
|
||||||
|
{
|
||||||
|
myHidpiWidget->setState(false);
|
||||||
|
myHidpiWidget->setEnabled(false);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
myHidpiWidget->setState(settings.getBool("hidpi"));
|
||||||
|
}
|
||||||
|
|
||||||
// Dialog position
|
// Dialog position
|
||||||
myPositionPopup->setSelected(settings.getString("dialogpos"), "0");
|
myPositionPopup->setSelected(settings.getString("dialogpos"), "0");
|
||||||
|
|
||||||
|
@ -324,6 +340,9 @@ void UIDialog::saveConfig()
|
||||||
myPalettePopup->getSelectedTag().toString());
|
myPalettePopup->getSelectedTag().toString());
|
||||||
instance().frameBuffer().setUIPalette();
|
instance().frameBuffer().setUIPalette();
|
||||||
|
|
||||||
|
// Enable HiDPI mode
|
||||||
|
settings.setValue("hidpi", myHidpiWidget->getState());
|
||||||
|
|
||||||
// Dialog position
|
// Dialog position
|
||||||
settings.setValue("dialogpos", myPositionPopup->getSelectedTag().toString());
|
settings.setValue("dialogpos", myPositionPopup->getSelectedTag().toString());
|
||||||
|
|
||||||
|
@ -347,6 +366,7 @@ void UIDialog::setDefaults()
|
||||||
{
|
{
|
||||||
case 0: // Misc. options
|
case 0: // Misc. options
|
||||||
myPalettePopup->setSelected("standard");
|
myPalettePopup->setSelected("standard");
|
||||||
|
myHidpiWidget->setState(false);
|
||||||
myPositionPopup->setSelected("0");
|
myPositionPopup->setSelected("0");
|
||||||
myListDelayPopup->setValue(300);
|
myListDelayPopup->setValue(300);
|
||||||
myWheelLinesPopup->setValue(4);
|
myWheelLinesPopup->setValue(4);
|
||||||
|
|
|
@ -63,6 +63,7 @@ class UIDialog : public Dialog, public CommandSender
|
||||||
|
|
||||||
// Misc options
|
// Misc options
|
||||||
PopUpWidget* myPalettePopup;
|
PopUpWidget* myPalettePopup;
|
||||||
|
CheckboxWidget* myHidpiWidget;
|
||||||
PopUpWidget* myPositionPopup;
|
PopUpWidget* myPositionPopup;
|
||||||
SliderWidget* myListDelayPopup;
|
SliderWidget* myListDelayPopup;
|
||||||
SliderWidget* myWheelLinesPopup;
|
SliderWidget* myWheelLinesPopup;
|
||||||
|
|
Loading…
Reference in New Issue