mirror of https://github.com/stella-emu/stella.git
moved ROM viewer image path settings into UIDialog
This commit is contained in:
parent
7ae6d84739
commit
13c616c4c8
|
@ -85,7 +85,7 @@ void EditTextWidget::drawWidget(bool hilite)
|
||||||
// Highlight changes
|
// Highlight changes
|
||||||
if(_changed && onTop)
|
if(_changed && onTop)
|
||||||
s.fillRect(_x, _y, _w, _h, kDbgChangedColor);
|
s.fillRect(_x, _y, _w, _h, kDbgChangedColor);
|
||||||
else if(!isEditable())
|
else if(!isEditable() || !isEnabled())
|
||||||
s.fillRect(_x, _y, _w, _h, onTop ? kDlgColor : kBGColorLo);
|
s.fillRect(_x, _y, _w, _h, onTop ? kDlgColor : kBGColorLo);
|
||||||
|
|
||||||
// Draw a thin frame around us.
|
// Draw a thin frame around us.
|
||||||
|
@ -94,9 +94,9 @@ void EditTextWidget::drawWidget(bool hilite)
|
||||||
// Draw the text
|
// Draw the text
|
||||||
adjustOffset();
|
adjustOffset();
|
||||||
s.drawString(_font, editString(), _x + 2, _y + 2, getEditRect().width(),
|
s.drawString(_font, editString(), _x + 2, _y + 2, getEditRect().width(),
|
||||||
_changed && onTop
|
_changed && onTop && isEnabled()
|
||||||
? kDbgChangedTextColor
|
? kDbgChangedTextColor
|
||||||
: onTop ? _textcolor : kColor,
|
: onTop && isEnabled() ? _textcolor : kColor,
|
||||||
TextAlign::Left, -_editScrollOffset, false);
|
TextAlign::Left, -_editScrollOffset, false);
|
||||||
|
|
||||||
// Draw the caret
|
// Draw the caret
|
||||||
|
|
|
@ -57,16 +57,6 @@ SnapshotDialog::SnapshotDialog(OSystem& osystem, DialogContainer& parent,
|
||||||
_w - xpos - HBORDER, lineHeight, "");
|
_w - xpos - HBORDER, lineHeight, "");
|
||||||
wid.push_back(mySnapSavePath);
|
wid.push_back(mySnapSavePath);
|
||||||
|
|
||||||
// Snapshot path (load files)
|
|
||||||
xpos = HBORDER; ypos += buttonHeight + V_GAP;
|
|
||||||
b = new ButtonWidget(this, font, xpos, ypos, buttonWidth, buttonHeight,
|
|
||||||
"Load path" + ELLIPSIS, kChooseSnapLoadDirCmd);
|
|
||||||
wid.push_back(b);
|
|
||||||
xpos += buttonWidth + 8;
|
|
||||||
mySnapLoadPath = new EditTextWidget(this, font, xpos, ypos + 1,
|
|
||||||
_w - xpos - HBORDER, lineHeight, "");
|
|
||||||
wid.push_back(mySnapLoadPath);
|
|
||||||
|
|
||||||
// Snapshot naming
|
// Snapshot naming
|
||||||
xpos = HBORDER; ypos += buttonHeight + V_GAP * 4;
|
xpos = HBORDER; ypos += buttonHeight + V_GAP * 4;
|
||||||
fwidth = font.getStringWidth("10 seconds");
|
fwidth = font.getStringWidth("10 seconds");
|
||||||
|
@ -117,7 +107,6 @@ void SnapshotDialog::loadConfig()
|
||||||
{
|
{
|
||||||
const Settings& settings = instance().settings();
|
const Settings& settings = instance().settings();
|
||||||
mySnapSavePath->setText(settings.getString("snapsavedir"));
|
mySnapSavePath->setText(settings.getString("snapsavedir"));
|
||||||
mySnapLoadPath->setText(settings.getString("snaploaddir"));
|
|
||||||
mySnapInterval->setValue(instance().settings().getInt("ssinterval"));
|
mySnapInterval->setValue(instance().settings().getInt("ssinterval"));
|
||||||
mySnapName->setState(instance().settings().getString("snapname") == "rom");
|
mySnapName->setState(instance().settings().getString("snapname") == "rom");
|
||||||
mySnapSingle->setState(settings.getBool("sssingle"));
|
mySnapSingle->setState(settings.getBool("sssingle"));
|
||||||
|
@ -128,7 +117,6 @@ void SnapshotDialog::loadConfig()
|
||||||
void SnapshotDialog::saveConfig()
|
void SnapshotDialog::saveConfig()
|
||||||
{
|
{
|
||||||
instance().settings().setValue("snapsavedir", mySnapSavePath->getText());
|
instance().settings().setValue("snapsavedir", mySnapSavePath->getText());
|
||||||
instance().settings().setValue("snaploaddir", mySnapLoadPath->getText());
|
|
||||||
instance().settings().setValue("ssinterval", mySnapInterval->getValue());
|
instance().settings().setValue("ssinterval", mySnapInterval->getValue());
|
||||||
instance().settings().setValue("snapname", mySnapName->getState() ? "rom" : "int");
|
instance().settings().setValue("snapname", mySnapName->getState() ? "rom" : "int");
|
||||||
instance().settings().setValue("sssingle", mySnapSingle->getState());
|
instance().settings().setValue("sssingle", mySnapSingle->getState());
|
||||||
|
@ -143,7 +131,6 @@ void SnapshotDialog::saveConfig()
|
||||||
void SnapshotDialog::setDefaults()
|
void SnapshotDialog::setDefaults()
|
||||||
{
|
{
|
||||||
mySnapSavePath->setText(instance().defaultSaveDir());
|
mySnapSavePath->setText(instance().defaultSaveDir());
|
||||||
mySnapLoadPath->setText(instance().defaultLoadDir());
|
|
||||||
mySnapInterval->setValue(2);
|
mySnapInterval->setValue(2);
|
||||||
mySnapName->setState(false);
|
mySnapName->setState(false);
|
||||||
mySnapSingle->setState(false);
|
mySnapSingle->setState(false);
|
||||||
|
@ -173,22 +160,10 @@ void SnapshotDialog::handleCommand(CommandSender* sender, int cmd,
|
||||||
BrowserDialog::Directories, kSnapSaveDirChosenCmd);
|
BrowserDialog::Directories, kSnapSaveDirChosenCmd);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case kChooseSnapLoadDirCmd:
|
|
||||||
// This dialog is resizable under certain conditions, so we need
|
|
||||||
// to re-create it as necessary
|
|
||||||
createBrowser("Select snapshot load directory");
|
|
||||||
myBrowser->show(mySnapLoadPath->getText(),
|
|
||||||
BrowserDialog::Directories, kSnapLoadDirChosenCmd);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case kSnapSaveDirChosenCmd:
|
case kSnapSaveDirChosenCmd:
|
||||||
mySnapSavePath->setText(myBrowser->getResult().getShortPath());
|
mySnapSavePath->setText(myBrowser->getResult().getShortPath());
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case kSnapLoadDirChosenCmd:
|
|
||||||
mySnapLoadPath->setText(myBrowser->getResult().getShortPath());
|
|
||||||
break;
|
|
||||||
|
|
||||||
case kSnapshotInterval:
|
case kSnapshotInterval:
|
||||||
if(mySnapInterval->getValue() == 1)
|
if(mySnapInterval->getValue() == 1)
|
||||||
mySnapInterval->setValueUnit(" second");
|
mySnapInterval->setValueUnit(" second");
|
||||||
|
|
|
@ -48,9 +48,7 @@ class SnapshotDialog : public Dialog
|
||||||
private:
|
private:
|
||||||
enum {
|
enum {
|
||||||
kChooseSnapSaveDirCmd = 'LOss', // snapshot dir (save files)
|
kChooseSnapSaveDirCmd = 'LOss', // snapshot dir (save files)
|
||||||
kChooseSnapLoadDirCmd = 'LOsl', // snapshot dir (load files)
|
|
||||||
kSnapSaveDirChosenCmd = 'snsc', // snap chosen (save files)
|
kSnapSaveDirChosenCmd = 'snsc', // snap chosen (save files)
|
||||||
kSnapLoadDirChosenCmd = 'snlc', // snap chosen (load files)
|
|
||||||
kSnapshotInterval = 'SnIn' // snap chosen (load files)
|
kSnapshotInterval = 'SnIn' // snap chosen (load files)
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -58,7 +56,6 @@ class SnapshotDialog : public Dialog
|
||||||
|
|
||||||
// Config paths
|
// Config paths
|
||||||
EditTextWidget* mySnapSavePath;
|
EditTextWidget* mySnapSavePath;
|
||||||
EditTextWidget* mySnapLoadPath;
|
|
||||||
|
|
||||||
CheckboxWidget* mySnapName;
|
CheckboxWidget* mySnapName;
|
||||||
SliderWidget* mySnapInterval;
|
SliderWidget* mySnapInterval;
|
||||||
|
|
|
@ -16,6 +16,7 @@
|
||||||
//============================================================================
|
//============================================================================
|
||||||
|
|
||||||
#include "bspf.hxx"
|
#include "bspf.hxx"
|
||||||
|
#include "BrowserDialog.hxx"
|
||||||
#include "Dialog.hxx"
|
#include "Dialog.hxx"
|
||||||
#include "OSystem.hxx"
|
#include "OSystem.hxx"
|
||||||
#include "FrameBuffer.hxx"
|
#include "FrameBuffer.hxx"
|
||||||
|
@ -23,6 +24,7 @@
|
||||||
#include "ListWidget.hxx"
|
#include "ListWidget.hxx"
|
||||||
#include "PopUpWidget.hxx"
|
#include "PopUpWidget.hxx"
|
||||||
#include "ScrollBarWidget.hxx"
|
#include "ScrollBarWidget.hxx"
|
||||||
|
#include "EditTextWidget.hxx"
|
||||||
#include "Settings.hxx"
|
#include "Settings.hxx"
|
||||||
#include "TabWidget.hxx"
|
#include "TabWidget.hxx"
|
||||||
#include "Widget.hxx"
|
#include "Widget.hxx"
|
||||||
|
@ -35,15 +37,19 @@
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
UIDialog::UIDialog(OSystem& osystem, DialogContainer& parent,
|
UIDialog::UIDialog(OSystem& osystem, DialogContainer& parent,
|
||||||
const GUI::Font& font)
|
const GUI::Font& font)
|
||||||
: Dialog(osystem, parent, font, "User interface settings")
|
: Dialog(osystem, parent, font, "User interface settings"),
|
||||||
|
myFont(font)
|
||||||
{
|
{
|
||||||
const GUI::Font& ifont = instance().frameBuffer().infoFont();
|
const GUI::Font& ifont = instance().frameBuffer().infoFont();
|
||||||
const int lineHeight = font.getLineHeight(),
|
const int lineHeight = font.getLineHeight(),
|
||||||
fontWidth = font.getMaxCharWidth(),
|
fontWidth = font.getMaxCharWidth(),
|
||||||
fontHeight = font.getFontHeight(),
|
fontHeight = font.getFontHeight(),
|
||||||
|
buttonWidth = font.getStringWidth("Image path" + ELLIPSIS) + 20 + 1,
|
||||||
buttonHeight = font.getLineHeight() + 4;
|
buttonHeight = font.getLineHeight() + 4;
|
||||||
|
|
||||||
const int VBORDER = 8;
|
const int VBORDER = 8;
|
||||||
const int HBORDER = 10;
|
const int HBORDER = 10;
|
||||||
|
const int INDENT = 16;
|
||||||
int xpos, ypos, tabID;
|
int xpos, ypos, tabID;
|
||||||
int lwidth, pwidth = font.getStringWidth("Standard");
|
int lwidth, pwidth = font.getStringWidth("Standard");
|
||||||
WidgetArray wid;
|
WidgetArray wid;
|
||||||
|
@ -51,8 +57,8 @@ UIDialog::UIDialog(OSystem& osystem, DialogContainer& parent,
|
||||||
const GUI::Size& ds = instance().frameBuffer().desktopSize();
|
const GUI::Size& ds = instance().frameBuffer().desktopSize();
|
||||||
|
|
||||||
// Set real dimensions
|
// Set real dimensions
|
||||||
_w = 39 * fontWidth + 10 * 2;
|
_w = (39+15) * fontWidth + 10 * 2;
|
||||||
_h = 10 * (lineHeight + 4) + VBORDER + _th;
|
_h = (10+1) * (lineHeight + 4) + VBORDER + _th;
|
||||||
|
|
||||||
// The tab widget
|
// The tab widget
|
||||||
xpos = HBORDER; ypos = VBORDER;
|
xpos = HBORDER; ypos = VBORDER;
|
||||||
|
@ -138,7 +144,7 @@ UIDialog::UIDialog(OSystem& osystem, DialogContainer& parent,
|
||||||
new PopUpWidget(myTab, font, xpos, ypos + 1, pwidth, lineHeight, items,
|
new PopUpWidget(myTab, font, xpos, ypos + 1, pwidth, lineHeight, items,
|
||||||
"Launcher Font ", lwidth);
|
"Launcher Font ", lwidth);
|
||||||
wid.push_back(myLauncherFontPopup);
|
wid.push_back(myLauncherFontPopup);
|
||||||
ypos += lineHeight + 4;
|
ypos += lineHeight + 4 * 4;
|
||||||
|
|
||||||
// ROM launcher info/snapshot viewer
|
// ROM launcher info/snapshot viewer
|
||||||
items.clear();
|
items.clear();
|
||||||
|
@ -147,11 +153,25 @@ UIDialog::UIDialog(OSystem& osystem, DialogContainer& parent,
|
||||||
VarList::push_back(items, "2x (1000x760)", "2");
|
VarList::push_back(items, "2x (1000x760)", "2");
|
||||||
myRomViewerPopup =
|
myRomViewerPopup =
|
||||||
new PopUpWidget(myTab, font, xpos, ypos + 1, pwidth, lineHeight, items,
|
new PopUpWidget(myTab, font, xpos, ypos + 1, pwidth, lineHeight, items,
|
||||||
"ROM Info viewer ", lwidth);
|
"ROM Info viewer ", lwidth, kRomViewer);
|
||||||
wid.push_back(myRomViewerPopup);
|
wid.push_back(myRomViewerPopup);
|
||||||
ypos += lineHeight + 4*4;
|
ypos += lineHeight + 4;
|
||||||
|
|
||||||
|
// Snapshot path (load files)
|
||||||
|
xpos = HBORDER + INDENT;
|
||||||
|
myOpenBrowserButton = new ButtonWidget(myTab, font, xpos, ypos, buttonWidth, buttonHeight,
|
||||||
|
"Image path" + ELLIPSIS, kChooseSnapLoadDirCmd);
|
||||||
|
wid.push_back(myOpenBrowserButton);
|
||||||
|
//ypos += lineHeight + 4;
|
||||||
|
xpos = myOpenBrowserButton->getRight() + 8;
|
||||||
|
|
||||||
|
mySnapLoadPath = new EditTextWidget(myTab, font, xpos, ypos + 1,
|
||||||
|
_w - xpos - HBORDER, lineHeight, "");
|
||||||
|
wid.push_back(mySnapLoadPath);
|
||||||
|
ypos += lineHeight + 4 * 5;
|
||||||
|
|
||||||
// Exit to Launcher
|
// Exit to Launcher
|
||||||
|
xpos = HBORDER;
|
||||||
myLauncherExitWidget = new CheckboxWidget(myTab, font, xpos + 1, ypos, "Always exit to Launcher");
|
myLauncherExitWidget = new CheckboxWidget(myTab, font, xpos + 1, ypos, "Always exit to Launcher");
|
||||||
wid.push_back(myLauncherExitWidget);
|
wid.push_back(myLauncherExitWidget);
|
||||||
|
|
||||||
|
@ -198,6 +218,9 @@ void UIDialog::loadConfig()
|
||||||
const string& viewer = instance().settings().getString("romviewer");
|
const string& viewer = instance().settings().getString("romviewer");
|
||||||
myRomViewerPopup->setSelected(viewer, "0");
|
myRomViewerPopup->setSelected(viewer, "0");
|
||||||
|
|
||||||
|
// ROM launcher info viewer image path
|
||||||
|
mySnapLoadPath->setText(instance().settings().getString("snaploaddir"));
|
||||||
|
|
||||||
// Exit to launcher
|
// Exit to launcher
|
||||||
bool exitlauncher = instance().settings().getBool("exitlauncher");
|
bool exitlauncher = instance().settings().getBool("exitlauncher");
|
||||||
myLauncherExitWidget->setState(exitlauncher);
|
myLauncherExitWidget->setState(exitlauncher);
|
||||||
|
@ -214,6 +237,8 @@ void UIDialog::loadConfig()
|
||||||
int mw = instance().settings().getInt("mwheel");
|
int mw = instance().settings().getInt("mwheel");
|
||||||
myWheelLinesPopup->setValue(mw);
|
myWheelLinesPopup->setValue(mw);
|
||||||
|
|
||||||
|
handleRomViewer();
|
||||||
|
|
||||||
myTab->loadConfig();
|
myTab->loadConfig();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -233,6 +258,9 @@ void UIDialog::saveConfig()
|
||||||
instance().settings().setValue("romviewer",
|
instance().settings().setValue("romviewer",
|
||||||
myRomViewerPopup->getSelectedTag().toString());
|
myRomViewerPopup->getSelectedTag().toString());
|
||||||
|
|
||||||
|
// ROM launcher info viewer image path
|
||||||
|
instance().settings().setValue("snaploaddir", mySnapLoadPath->getText());
|
||||||
|
|
||||||
// Exit to Launcher
|
// Exit to Launcher
|
||||||
instance().settings().setValue("exitlauncher", myLauncherExitWidget->getState());
|
instance().settings().setValue("exitlauncher", myLauncherExitWidget->getState());
|
||||||
|
|
||||||
|
@ -268,6 +296,7 @@ void UIDialog::setDefaults()
|
||||||
myLauncherHeightSlider->setValue(h);
|
myLauncherHeightSlider->setValue(h);
|
||||||
myLauncherFontPopup->setSelected("medium", "");
|
myLauncherFontPopup->setSelected("medium", "");
|
||||||
myRomViewerPopup->setSelected("1", "");
|
myRomViewerPopup->setSelected("1", "");
|
||||||
|
mySnapLoadPath->setText(instance().defaultLoadDir());
|
||||||
myLauncherExitWidget->setState(false);
|
myLauncherExitWidget->setState(false);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -313,8 +342,48 @@ void UIDialog::handleCommand(CommandSender* sender, int cmd, int data, int id)
|
||||||
myWheelLinesPopup->setValueUnit(" lines");
|
myWheelLinesPopup->setValueUnit(" lines");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case kRomViewer:
|
||||||
|
handleRomViewer();
|
||||||
|
break;
|
||||||
|
|
||||||
|
case kChooseSnapLoadDirCmd:
|
||||||
|
// This dialog is resizable under certain conditions, so we need
|
||||||
|
// to re-create it as necessary
|
||||||
|
createBrowser("Select snapshot load directory");
|
||||||
|
myBrowser->show(mySnapLoadPath->getText(),
|
||||||
|
BrowserDialog::Directories, kSnapLoadDirChosenCmd);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case kSnapLoadDirChosenCmd:
|
||||||
|
mySnapLoadPath->setText(myBrowser->getResult().getShortPath());
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
Dialog::handleCommand(sender, cmd, data, 0);
|
Dialog::handleCommand(sender, cmd, data, 0);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
void UIDialog::handleRomViewer()
|
||||||
|
{
|
||||||
|
bool enable = myRomViewerPopup->getSelectedName() != "Off";
|
||||||
|
|
||||||
|
myOpenBrowserButton->setEnabled(enable);
|
||||||
|
mySnapLoadPath->setEnabled(enable);
|
||||||
|
}
|
||||||
|
|
||||||
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
void UIDialog::createBrowser(const string& title)
|
||||||
|
{
|
||||||
|
uInt32 w = 0, h = 0;
|
||||||
|
getResizableBounds(w, h);
|
||||||
|
|
||||||
|
// Create file browser dialog
|
||||||
|
if(!myBrowser || uInt32(myBrowser->getWidth()) != w ||
|
||||||
|
uInt32(myBrowser->getHeight()) != h)
|
||||||
|
myBrowser = make_unique<BrowserDialog>(this, myFont, w, h, title);
|
||||||
|
else
|
||||||
|
myBrowser->setTitle(title);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
@ -26,6 +26,7 @@ class PopUpWidget;
|
||||||
class SliderWidget;
|
class SliderWidget;
|
||||||
class StaticTextWidget;
|
class StaticTextWidget;
|
||||||
class TabWidget;
|
class TabWidget;
|
||||||
|
class BrowserDialog;
|
||||||
class OSystem;
|
class OSystem;
|
||||||
|
|
||||||
#include "bspf.hxx"
|
#include "bspf.hxx"
|
||||||
|
@ -42,28 +43,38 @@ class UIDialog : public Dialog
|
||||||
void setDefaults() override;
|
void setDefaults() override;
|
||||||
|
|
||||||
void handleCommand(CommandSender* sender, int cmd, int data, int id) override;
|
void handleCommand(CommandSender* sender, int cmd, int data, int id) override;
|
||||||
|
void handleRomViewer();
|
||||||
|
void createBrowser(const string& title);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
kListDelay = 'UILd',
|
kListDelay = 'UILd',
|
||||||
kMouseWheel = 'UIMw',
|
kMouseWheel = 'UIMw',
|
||||||
|
kRomViewer = 'UIRv',
|
||||||
|
kChooseSnapLoadDirCmd = 'UIsl', // snapshot dir (load files)
|
||||||
|
kSnapLoadDirChosenCmd = 'UIsc' // snap chosen (load files)
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const GUI::Font& myFont;
|
||||||
TabWidget* myTab;
|
TabWidget* myTab;
|
||||||
|
|
||||||
// Launcher options
|
// Launcher options
|
||||||
SliderWidget* myLauncherWidthSlider;
|
SliderWidget* myLauncherWidthSlider;
|
||||||
SliderWidget* myLauncherHeightSlider;
|
SliderWidget* myLauncherHeightSlider;
|
||||||
CheckboxWidget* myLauncherExitWidget;
|
|
||||||
PopUpWidget* myLauncherFontPopup;
|
PopUpWidget* myLauncherFontPopup;
|
||||||
PopUpWidget* myRomViewerPopup;
|
PopUpWidget* myRomViewerPopup;
|
||||||
|
ButtonWidget* myOpenBrowserButton;
|
||||||
|
EditTextWidget* mySnapLoadPath;
|
||||||
|
CheckboxWidget* myLauncherExitWidget;
|
||||||
|
|
||||||
// Misc options
|
// Misc options
|
||||||
PopUpWidget* myPalettePopup;
|
PopUpWidget* myPalettePopup;
|
||||||
SliderWidget* myListDelayPopup;
|
SliderWidget* myListDelayPopup;
|
||||||
SliderWidget* myWheelLinesPopup;
|
SliderWidget* myWheelLinesPopup;
|
||||||
|
|
||||||
|
unique_ptr<BrowserDialog> myBrowser;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// Following constructors and assignment operators not supported
|
// Following constructors and assignment operators not supported
|
||||||
UIDialog() = delete;
|
UIDialog() = delete;
|
||||||
|
|
Loading…
Reference in New Issue