Added preset buttons to debugger UI config to set window size

to use each font.


git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@2805 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
stephena 2013-08-20 17:58:56 +00:00
parent 28b80d93cf
commit 216490744c
3 changed files with 63 additions and 16 deletions

View File

@ -24,6 +24,7 @@
#include "bspf.hxx" #include "bspf.hxx"
#include "DebuggerDialog.hxx"
#include "OSystem.hxx" #include "OSystem.hxx"
#include "Version.hxx" #include "Version.hxx"
@ -112,14 +113,15 @@ Settings::Settings(OSystem* osystem)
// ROM browser options // ROM browser options
setInternal("exitlauncher", "false"); setInternal("exitlauncher", "false");
setInternal("launcherres", "640x480"); setInternal("launcherres", GUI::Size(640, 480));
setInternal("launcherfont", "medium"); setInternal("launcherfont", "medium");
setInternal("launcherexts", "allroms"); setInternal("launcherexts", "allroms");
setInternal("romviewer", "0"); setInternal("romviewer", "0");
setInternal("lastrom", ""); setInternal("lastrom", "");
// UI-related options // UI-related options
setInternal("debuggerres", "1030x690"); setInternal("debuggerres",
GUI::Size(DebuggerDialog::kMediumFontMinW, DebuggerDialog::kMediumFontMinH));
setInternal("uipalette", "0"); setInternal("uipalette", "0");
setInternal("listdelay", "300"); setInternal("listdelay", "300");
setInternal("mwheel", "4"); setInternal("mwheel", "4");

View File

@ -22,6 +22,7 @@
#include "bspf.hxx" #include "bspf.hxx"
#include "Dialog.hxx" #include "Dialog.hxx"
#include "DebuggerDialog.hxx"
#include "OSystem.hxx" #include "OSystem.hxx"
#include "ListWidget.hxx" #include "ListWidget.hxx"
#include "PopUpWidget.hxx" #include "PopUpWidget.hxx"
@ -49,6 +50,7 @@ UIDialog::UIDialog(OSystem* osystem, DialogContainer* parent,
int lwidth, pwidth = font.getStringWidth("Standard"); int lwidth, pwidth = font.getStringWidth("Standard");
WidgetArray wid; WidgetArray wid;
VariantList items; VariantList items;
ButtonWidget* b;
// Set real dimensions // Set real dimensions
_w = 37 * fontWidth + 10; _w = 37 * fontWidth + 10;
@ -166,8 +168,8 @@ UIDialog::UIDialog(OSystem* osystem, DialogContainer* parent,
myDebuggerWidthSlider = new SliderWidget(myTab, font, xpos, ypos, pwidth, myDebuggerWidthSlider = new SliderWidget(myTab, font, xpos, ypos, pwidth,
lineHeight, "Debugger Width: ", lineHeight, "Debugger Width: ",
lwidth, kDWidthChanged); lwidth, kDWidthChanged);
myDebuggerWidthSlider->setMinValue(1080); myDebuggerWidthSlider->setMinValue(DebuggerDialog::kSmallFontMinW);
myDebuggerWidthSlider->setMaxValue(1920); myDebuggerWidthSlider->setMaxValue(osystem->desktopWidth());
myDebuggerWidthSlider->setStepValue(10); myDebuggerWidthSlider->setStepValue(10);
wid.push_back(myDebuggerWidthSlider); wid.push_back(myDebuggerWidthSlider);
myDebuggerWidthLabel = myDebuggerWidthLabel =
@ -180,8 +182,8 @@ UIDialog::UIDialog(OSystem* osystem, DialogContainer* parent,
myDebuggerHeightSlider = new SliderWidget(myTab, font, xpos, ypos, pwidth, myDebuggerHeightSlider = new SliderWidget(myTab, font, xpos, ypos, pwidth,
lineHeight, "Debugger Height: ", lineHeight, "Debugger Height: ",
lwidth, kDHeightChanged); lwidth, kDHeightChanged);
myDebuggerHeightSlider->setMinValue(720); myDebuggerHeightSlider->setMinValue(DebuggerDialog::kSmallFontMinH);
myDebuggerHeightSlider->setMaxValue(1200); myDebuggerHeightSlider->setMaxValue(osystem->desktopHeight());
myDebuggerHeightSlider->setStepValue(10); myDebuggerHeightSlider->setStepValue(10);
wid.push_back(myDebuggerHeightSlider); wid.push_back(myDebuggerHeightSlider);
myDebuggerHeightLabel = myDebuggerHeightLabel =
@ -190,6 +192,21 @@ UIDialog::UIDialog(OSystem* osystem, DialogContainer* parent,
ypos + 1, 4*fontWidth, fontHeight, "", kTextAlignLeft); ypos + 1, 4*fontWidth, fontHeight, "", kTextAlignLeft);
myDebuggerHeightLabel->setFlags(WIDGET_CLEARBG); myDebuggerHeightLabel->setFlags(WIDGET_CLEARBG);
// Add minimum window size buttons for different fonts
int fbwidth = font.getStringWidth("Set window size for medium font") + 20;
xpos = (_w - fbwidth - 2*vBorder)/2; ypos += 2*lineHeight + 4;
b = new ButtonWidget(myTab, font, xpos, ypos, fbwidth, buttonHeight,
"Set window size for small font", kDSmallSize);
wid.push_back(b);
ypos += b->getHeight() + 4;
b = new ButtonWidget(myTab, font, xpos, ypos, fbwidth, buttonHeight,
"Set window size for medium font", kDMediumSize);
wid.push_back(b);
ypos += b->getHeight() + 4;
b = new ButtonWidget(myTab, font, xpos, ypos, fbwidth, buttonHeight,
"Set window size for large font", kDLargeSize);
wid.push_back(b);
// Debugger is only realistically available in windowed modes 800x600 or greater // Debugger is only realistically available in windowed modes 800x600 or greater
// (and when it's actually been compiled into the app) // (and when it's actually been compiled into the app)
bool debuggerAvailable = bool debuggerAvailable =
@ -266,7 +283,6 @@ UIDialog::UIDialog(OSystem* osystem, DialogContainer* parent,
// Add Defaults, OK and Cancel buttons // Add Defaults, OK and Cancel buttons
wid.clear(); wid.clear();
ButtonWidget* b;
b = new ButtonWidget(this, font, 10, _h - buttonHeight - 10, b = new ButtonWidget(this, font, 10, _h - buttonHeight - 10,
buttonWidth, buttonHeight, "Defaults", kDefaultsCmd); buttonWidth, buttonHeight, "Defaults", kDefaultsCmd);
wid.push_back(b); wid.push_back(b);
@ -312,10 +328,10 @@ void UIDialog::loadConfig()
// Debugger size // Debugger size
const GUI::Size& ds = instance().settings().getSize("debuggerres"); const GUI::Size& ds = instance().settings().getSize("debuggerres");
w = ds.w, h = ds.h; w = ds.w, h = ds.h;
w = BSPF_max(w, 1080); w = BSPF_max(w, (int)DebuggerDialog::kSmallFontMinW);
h = BSPF_max(h, 720); h = BSPF_max(h, (int)DebuggerDialog::kSmallFontMinH);
w = BSPF_min(w, 1920); w = BSPF_min(w, (int)instance().desktopWidth());
h = BSPF_min(h, 1200); h = BSPF_min(h, (int)instance().desktopHeight());
myDebuggerWidthSlider->setValue(w); myDebuggerWidthSlider->setValue(w);
myDebuggerWidthLabel->setValue(w); myDebuggerWidthLabel->setValue(w);
@ -398,11 +414,15 @@ void UIDialog::setDefaults()
} }
case 1: // Debugger options case 1: // Debugger options
myDebuggerWidthSlider->setValue(1080); {
myDebuggerWidthLabel->setValue(1080); int w = BSPF_min(instance().desktopWidth(), (uInt32)DebuggerDialog::kMediumFontMinW);
myDebuggerHeightSlider->setValue(720); int h = BSPF_min(instance().desktopHeight(), (uInt32)DebuggerDialog::kMediumFontMinH);
myDebuggerHeightLabel->setValue(720); myDebuggerWidthSlider->setValue(w);
myDebuggerWidthLabel->setValue(w);
myDebuggerHeightSlider->setValue(h);
myDebuggerHeightLabel->setValue(h);
break; break;
}
case 2: // Misc. options case 2: // Misc. options
myPalettePopup->setSelected("1", "1"); myPalettePopup->setSelected("1", "1");
@ -438,6 +458,27 @@ void UIDialog::handleCommand(CommandSender* sender, int cmd, int data, int id)
myDebuggerHeightLabel->setValue(myDebuggerHeightSlider->getValue()); myDebuggerHeightLabel->setValue(myDebuggerHeightSlider->getValue());
break; break;
case kDSmallSize:
myDebuggerWidthSlider->setValue(DebuggerDialog::kSmallFontMinW);
myDebuggerWidthLabel->setValue(DebuggerDialog::kSmallFontMinW);
myDebuggerHeightSlider->setValue(DebuggerDialog::kSmallFontMinH);
myDebuggerHeightLabel->setValue(DebuggerDialog::kSmallFontMinH);
break;
case kDMediumSize:
myDebuggerWidthSlider->setValue(DebuggerDialog::kMediumFontMinW);
myDebuggerWidthLabel->setValue(DebuggerDialog::kMediumFontMinW);
myDebuggerHeightSlider->setValue(DebuggerDialog::kMediumFontMinH);
myDebuggerHeightLabel->setValue(DebuggerDialog::kMediumFontMinH);
break;
case kDLargeSize:
myDebuggerWidthSlider->setValue(DebuggerDialog::kLargeFontMinW);
myDebuggerWidthLabel->setValue(DebuggerDialog::kLargeFontMinW);
myDebuggerHeightSlider->setValue(DebuggerDialog::kLargeFontMinH);
myDebuggerHeightLabel->setValue(DebuggerDialog::kLargeFontMinH);
break;
case kOKCmd: case kOKCmd:
saveConfig(); saveConfig();
close(); close();

View File

@ -72,7 +72,11 @@ class UIDialog : public Dialog
kLWidthChanged = 'UIlw', kLWidthChanged = 'UIlw',
kLHeightChanged = 'UIlh', kLHeightChanged = 'UIlh',
kDWidthChanged = 'UIdw', kDWidthChanged = 'UIdw',
kDHeightChanged = 'UIdh' kDHeightChanged = 'UIdh',
kDSmallSize = 'UIds',
kDMediumSize = 'UIdm',
kDLargeSize = 'UIdl'
}; };
}; };