mirror of https://github.com/stella-emu/stella.git
replaced some PopUpWidgets with SliderWidgets
This commit is contained in:
parent
7f23ac00a2
commit
c9bc3601e3
|
@ -21,7 +21,6 @@
|
|||
#include "FSNode.hxx"
|
||||
#include "Font.hxx"
|
||||
#include "LauncherDialog.hxx"
|
||||
#include "PopUpWidget.hxx"
|
||||
#include "Settings.hxx"
|
||||
#include "SnapshotDialog.hxx"
|
||||
|
||||
|
@ -39,7 +38,7 @@ SnapshotDialog::SnapshotDialog(OSystem& osystem, DialogContainer& parent,
|
|||
fontWidth = font.getMaxCharWidth(),
|
||||
buttonWidth = font.getStringWidth("Save path" + ELLIPSIS) + 20,
|
||||
buttonHeight = font.getLineHeight() + 4;
|
||||
int xpos, ypos, lwidth, fwidth;
|
||||
int xpos, ypos, fwidth;
|
||||
WidgetArray wid;
|
||||
ButtonWidget* b;
|
||||
|
||||
|
@ -70,25 +69,14 @@ SnapshotDialog::SnapshotDialog(OSystem& osystem, DialogContainer& parent,
|
|||
|
||||
// Snapshot naming
|
||||
xpos = HBORDER; ypos += buttonHeight + V_GAP * 4;
|
||||
VariantList items;
|
||||
lwidth = font.getStringWidth("Continuous snapshot interval ");
|
||||
fwidth = font.getStringWidth("10 seconds");
|
||||
|
||||
// Snapshot interval (continuous mode)
|
||||
items.clear();
|
||||
VarList::push_back(items, "1 second", "1");
|
||||
VarList::push_back(items, "2 seconds", "2");
|
||||
VarList::push_back(items, "3 seconds", "3");
|
||||
VarList::push_back(items, "4 seconds", "4");
|
||||
VarList::push_back(items, "5 seconds", "5");
|
||||
VarList::push_back(items, "6 seconds", "6");
|
||||
VarList::push_back(items, "7 seconds", "7");
|
||||
VarList::push_back(items, "8 seconds", "8");
|
||||
VarList::push_back(items, "9 seconds", "9");
|
||||
VarList::push_back(items, "10 seconds", "10");
|
||||
mySnapInterval =
|
||||
new PopUpWidget(this, font, xpos, ypos, fwidth, lineHeight, items,
|
||||
"Continuous snapshot interval ", lwidth);
|
||||
mySnapInterval = new SliderWidget(this, font, xpos, ypos,
|
||||
"Continuous snapshot interval ", 0, kSnapshotInterval,
|
||||
font.getStringWidth("10 seconds"));
|
||||
mySnapInterval->setMinValue(1);
|
||||
mySnapInterval->setMaxValue(10);
|
||||
wid.push_back(mySnapInterval);
|
||||
|
||||
// Booleans for saving snapshots
|
||||
|
@ -99,12 +87,11 @@ SnapshotDialog::SnapshotDialog(OSystem& osystem, DialogContainer& parent,
|
|||
|
||||
// Snapshot single or multiple saves
|
||||
xpos += INDENT; ypos += lineHeight + V_GAP;
|
||||
mySnapName = new CheckboxWidget(this, font, xpos, ypos, "Use actualy ROM name");
|
||||
mySnapName = new CheckboxWidget(this, font, xpos, ypos, "Use actual ROM name");
|
||||
wid.push_back(mySnapName);
|
||||
ypos += lineHeight + V_GAP;
|
||||
|
||||
mySnapSingle = new CheckboxWidget(this, font, xpos, ypos,
|
||||
"Overwrite existing files");
|
||||
mySnapSingle = new CheckboxWidget(this, font, xpos, ypos, "Overwrite existing files");
|
||||
wid.push_back(mySnapSingle);
|
||||
|
||||
// Snapshot in 1x mode (ignore scaling)
|
||||
|
@ -130,8 +117,8 @@ void SnapshotDialog::loadConfig()
|
|||
const Settings& settings = instance().settings();
|
||||
mySnapSavePath->setText(settings.getString("snapsavedir"));
|
||||
mySnapLoadPath->setText(settings.getString("snaploaddir"));
|
||||
mySnapInterval->setValue(instance().settings().getInt("ssinterval"));
|
||||
mySnapName->setState(instance().settings().getString("snapname") == "rom");
|
||||
mySnapInterval->setSelected(instance().settings().getString("ssinterval"), "2");
|
||||
mySnapSingle->setState(settings.getBool("sssingle"));
|
||||
mySnap1x->setState(settings.getBool("ss1x"));
|
||||
}
|
||||
|
@ -141,11 +128,10 @@ void SnapshotDialog::saveConfig()
|
|||
{
|
||||
instance().settings().setValue("snapsavedir", mySnapSavePath->getText());
|
||||
instance().settings().setValue("snaploaddir", mySnapLoadPath->getText());
|
||||
instance().settings().setValue("ssinterval", mySnapInterval->getValue());
|
||||
instance().settings().setValue("snapname", mySnapName->getState() ? "rom" : "int");
|
||||
instance().settings().setValue("sssingle", mySnapSingle->getState());
|
||||
instance().settings().setValue("ss1x", mySnap1x->getState());
|
||||
instance().settings().setValue("ssinterval",
|
||||
mySnapInterval->getSelectedTag().toString());
|
||||
|
||||
// Flush changes to disk and inform the OSystem
|
||||
instance().saveConfig();
|
||||
|
@ -157,10 +143,10 @@ void SnapshotDialog::setDefaults()
|
|||
{
|
||||
mySnapSavePath->setText(instance().defaultSaveDir());
|
||||
mySnapLoadPath->setText(instance().defaultLoadDir());
|
||||
|
||||
mySnapInterval->setValue(2);
|
||||
mySnapName->setState(false);
|
||||
mySnapSingle->setState(false);
|
||||
mySnap1x->setState(false);
|
||||
mySnapInterval->setSelected("2", "2");
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
@ -202,6 +188,13 @@ void SnapshotDialog::handleCommand(CommandSender* sender, int cmd,
|
|||
mySnapLoadPath->setText(myBrowser->getResult().getShortPath());
|
||||
break;
|
||||
|
||||
case kSnapshotInterval:
|
||||
if(mySnapInterval->getValue() == 1)
|
||||
mySnapInterval->setValueUnit(" second");
|
||||
else
|
||||
mySnapInterval->setValueUnit(" seconds");
|
||||
break;
|
||||
|
||||
default:
|
||||
Dialog::handleCommand(sender, cmd, data, 0);
|
||||
break;
|
||||
|
|
|
@ -22,7 +22,6 @@ class OSystem;
|
|||
class GuiObject;
|
||||
class DialogContainer;
|
||||
class CheckboxWidget;
|
||||
class PopUpWidget;
|
||||
class EditTextWidget;
|
||||
class SliderWidget;
|
||||
class StaticTextWidget;
|
||||
|
@ -51,7 +50,8 @@ class SnapshotDialog : public Dialog
|
|||
kChooseSnapSaveDirCmd = 'LOss', // snapshot dir (save files)
|
||||
kChooseSnapLoadDirCmd = 'LOsl', // snapshot dir (load files)
|
||||
kSnapSaveDirChosenCmd = 'snsc', // snap chosen (save files)
|
||||
kSnapLoadDirChosenCmd = 'snlc' // snap chosen (load files)
|
||||
kSnapLoadDirChosenCmd = 'snlc', // snap chosen (load files)
|
||||
kSnapshotInterval = 'SnIn' // snap chosen (load files)
|
||||
};
|
||||
|
||||
const GUI::Font& myFont;
|
||||
|
@ -61,7 +61,7 @@ class SnapshotDialog : public Dialog
|
|||
EditTextWidget* mySnapLoadPath;
|
||||
|
||||
CheckboxWidget* mySnapName;
|
||||
PopUpWidget* mySnapInterval;
|
||||
SliderWidget* mySnapInterval;
|
||||
|
||||
CheckboxWidget* mySnapSingle;
|
||||
CheckboxWidget* mySnap1x;
|
||||
|
|
|
@ -53,7 +53,7 @@ UIDialog::UIDialog(OSystem& osystem, DialogContainer& parent,
|
|||
const GUI::Size& ds = instance().frameBuffer().desktopSize();
|
||||
|
||||
// Set real dimensions
|
||||
_w = 37 * fontWidth + 10;
|
||||
_w = 39 * fontWidth + 10 * 2;
|
||||
_h = 10 * (lineHeight + 4) + VBORDER + _th;
|
||||
|
||||
// The tab widget
|
||||
|
@ -78,38 +78,25 @@ UIDialog::UIDialog(OSystem& osystem, DialogContainer& parent,
|
|||
myPalettePopup = new PopUpWidget(myTab, font, xpos, ypos, pwidth, lineHeight,
|
||||
items, "Theme (*) ", lwidth);
|
||||
wid.push_back(myPalettePopup);
|
||||
ypos += lineHeight + 4;
|
||||
ypos += lineHeight + 4 * 4;
|
||||
|
||||
// Delay between quick-selecting characters in ListWidget
|
||||
items.clear();
|
||||
VarList::push_back(items, "Disabled", "0");
|
||||
VarList::push_back(items, "300 ms", "300");
|
||||
VarList::push_back(items, "400 ms", "400");
|
||||
VarList::push_back(items, "500 ms", "500");
|
||||
VarList::push_back(items, "600 ms", "600");
|
||||
VarList::push_back(items, "700 ms", "700");
|
||||
VarList::push_back(items, "800 ms", "800");
|
||||
VarList::push_back(items, "900 ms", "900");
|
||||
VarList::push_back(items, "1 second", "1000");
|
||||
myListDelayPopup = new PopUpWidget(myTab, font, xpos, ypos, pwidth, lineHeight,
|
||||
items, "List input delay ", lwidth);
|
||||
int swidth = myPalettePopup->getWidth() - lwidth;
|
||||
myListDelayPopup = new SliderWidget(myTab, font, xpos, ypos, swidth, lineHeight,
|
||||
"List input delay ", 0, kListDelay,
|
||||
font.getStringWidth("1 second"));
|
||||
myListDelayPopup->setMinValue(0);
|
||||
myListDelayPopup->setMaxValue(1000);
|
||||
myListDelayPopup->setStepValue(50);
|
||||
wid.push_back(myListDelayPopup);
|
||||
ypos += lineHeight + 4;
|
||||
|
||||
// Number of lines a mouse wheel will scroll
|
||||
items.clear();
|
||||
VarList::push_back(items, "1 line", "1");
|
||||
VarList::push_back(items, "2 lines", "2");
|
||||
VarList::push_back(items, "3 lines", "3");
|
||||
VarList::push_back(items, "4 lines", "4");
|
||||
VarList::push_back(items, "5 lines", "5");
|
||||
VarList::push_back(items, "6 lines", "6");
|
||||
VarList::push_back(items, "7 lines", "7");
|
||||
VarList::push_back(items, "8 lines", "8");
|
||||
VarList::push_back(items, "9 lines", "9");
|
||||
VarList::push_back(items, "10 lines", "10");
|
||||
myWheelLinesPopup = new PopUpWidget(myTab, font, xpos, ypos, pwidth, lineHeight,
|
||||
items, "Mouse wheel scroll ", lwidth);
|
||||
myWheelLinesPopup = new SliderWidget(myTab, font, xpos, ypos, swidth, lineHeight,
|
||||
"Mouse wheel scroll ", 0, kMouseWheel,
|
||||
font.getStringWidth("10 lines"));
|
||||
myWheelLinesPopup->setMinValue(1);
|
||||
myWheelLinesPopup->setMaxValue(10);
|
||||
wid.push_back(myWheelLinesPopup);
|
||||
|
||||
// Add message concerning usage
|
||||
|
@ -226,12 +213,12 @@ void UIDialog::loadConfig()
|
|||
myPalettePopup->setSelected(pal, "standard");
|
||||
|
||||
// Listwidget quick delay
|
||||
const string& delay = instance().settings().getString("listdelay");
|
||||
myListDelayPopup->setSelected(delay, "300");
|
||||
int delay = instance().settings().getInt("listdelay");
|
||||
myListDelayPopup->setValue(delay);
|
||||
|
||||
// Mouse wheel lines
|
||||
const string& mw = instance().settings().getString("mwheel");
|
||||
myWheelLinesPopup->setSelected(mw, "1");
|
||||
int mw = instance().settings().getInt("mwheel");
|
||||
myWheelLinesPopup->setValue(mw);
|
||||
|
||||
myTab->loadConfig();
|
||||
}
|
||||
|
@ -260,14 +247,12 @@ void UIDialog::saveConfig()
|
|||
myPalettePopup->getSelectedTag().toString());
|
||||
|
||||
// Listwidget quick delay
|
||||
instance().settings().setValue("listdelay",
|
||||
myListDelayPopup->getSelectedTag().toString());
|
||||
ListWidget::setQuickSelectDelay(myListDelayPopup->getSelectedTag().toInt());
|
||||
instance().settings().setValue("listdelay", myListDelayPopup->getValue());
|
||||
ListWidget::setQuickSelectDelay(myListDelayPopup->getValue());
|
||||
|
||||
// Mouse wheel lines
|
||||
instance().settings().setValue("mwheel",
|
||||
myWheelLinesPopup->getSelectedTag().toString());
|
||||
ScrollBarWidget::setWheelLines(myWheelLinesPopup->getSelectedTag().toInt());
|
||||
instance().settings().setValue("mwheel", myWheelLinesPopup->getValue());
|
||||
ScrollBarWidget::setWheelLines(myWheelLinesPopup->getValue());
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
@ -289,8 +274,8 @@ void UIDialog::setDefaults()
|
|||
|
||||
case 1: // Misc. options
|
||||
myPalettePopup->setSelected("standard");
|
||||
myListDelayPopup->setSelected("300");
|
||||
myWheelLinesPopup->setSelected("4");
|
||||
myListDelayPopup->setValue(300);
|
||||
myWheelLinesPopup->setValue(4);
|
||||
break;
|
||||
|
||||
default:
|
||||
|
@ -314,6 +299,29 @@ void UIDialog::handleCommand(CommandSender* sender, int cmd, int data, int id)
|
|||
setDefaults();
|
||||
break;
|
||||
|
||||
case kListDelay:
|
||||
if(myListDelayPopup->getValue() == 0)
|
||||
{
|
||||
myListDelayPopup->setValueLabel("Off");
|
||||
myListDelayPopup->setValueUnit("");
|
||||
}
|
||||
else if(myListDelayPopup->getValue() == 1000)
|
||||
{
|
||||
myListDelayPopup->setValueLabel("1");
|
||||
myListDelayPopup->setValueUnit(" second");
|
||||
}
|
||||
else
|
||||
{
|
||||
myListDelayPopup->setValueUnit(" ms");
|
||||
}
|
||||
break;
|
||||
case kMouseWheel:
|
||||
if(myWheelLinesPopup->getValue() == 1)
|
||||
myWheelLinesPopup->setValueUnit(" line");
|
||||
else
|
||||
myWheelLinesPopup->setValueUnit(" lines");
|
||||
break;
|
||||
|
||||
default:
|
||||
Dialog::handleCommand(sender, cmd, data, 0);
|
||||
break;
|
||||
|
|
|
@ -44,6 +44,12 @@ class UIDialog : public Dialog
|
|||
void handleCommand(CommandSender* sender, int cmd, int data, int id) override;
|
||||
|
||||
private:
|
||||
enum
|
||||
{
|
||||
kListDelay = 'UILd',
|
||||
kMouseWheel = 'UIMw',
|
||||
};
|
||||
|
||||
TabWidget* myTab;
|
||||
|
||||
// Launcher options
|
||||
|
@ -55,8 +61,8 @@ class UIDialog : public Dialog
|
|||
|
||||
// Misc options
|
||||
PopUpWidget* myPalettePopup;
|
||||
PopUpWidget* myListDelayPopup;
|
||||
PopUpWidget* myWheelLinesPopup;
|
||||
SliderWidget* myListDelayPopup;
|
||||
SliderWidget* myWheelLinesPopup;
|
||||
|
||||
private:
|
||||
// Following constructors and assignment operators not supported
|
||||
|
|
Loading…
Reference in New Issue