mirror of https://github.com/stella-emu/stella.git
move ROM path selection into UIDialog
deleted ConfigPathDialog class (TODO: update non VS project files)
This commit is contained in:
parent
7bd355d759
commit
21da4a6388
|
@ -1,153 +0,0 @@
|
|||
//============================================================================
|
||||
//
|
||||
// SSSS tt lll lll
|
||||
// SS SS tt ll ll
|
||||
// SS tttttt eeee ll ll aaaa
|
||||
// SSSS tt ee ee ll ll aa
|
||||
// SS tt eeeeee ll ll aaaaa -- "An Atari 2600 VCS Emulator"
|
||||
// SS SS tt ee ll ll aa aa
|
||||
// SSSS ttt eeeee llll llll aaaaa
|
||||
//
|
||||
// Copyright (c) 1995-2019 by Bradford W. Mott, Stephen Anthony
|
||||
// and the Stella Team
|
||||
//
|
||||
// See the file "License.txt" for information on usage and redistribution of
|
||||
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||
//============================================================================
|
||||
|
||||
#include "bspf.hxx"
|
||||
#include "BrowserDialog.hxx"
|
||||
#include "EditTextWidget.hxx"
|
||||
#include "FSNode.hxx"
|
||||
#include "Font.hxx"
|
||||
#include "LauncherDialog.hxx"
|
||||
#include "PopUpWidget.hxx"
|
||||
#include "Settings.hxx"
|
||||
#include "ConfigPathDialog.hxx"
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
ConfigPathDialog::ConfigPathDialog(
|
||||
OSystem& osystem, DialogContainer& parent,
|
||||
const GUI::Font& font, GuiObject* boss, int max_w, int max_h)
|
||||
: Dialog(osystem, parent, font, "Configure paths"),
|
||||
CommandSender(boss),
|
||||
myFont(font),
|
||||
myBrowser(nullptr),
|
||||
myIsGlobal(boss != nullptr)
|
||||
{
|
||||
const int VBORDER = 10 + _th;
|
||||
const int HBORDER = 10;
|
||||
const int V_GAP = 4;
|
||||
const int H_GAP = 8;
|
||||
const int lineHeight = font.getLineHeight(),
|
||||
fontWidth = font.getMaxCharWidth(),
|
||||
buttonWidth = font.getStringWidth("ROM Path") + 20,
|
||||
buttonHeight = font.getLineHeight() + 4;
|
||||
int xpos, ypos;
|
||||
WidgetArray wid;
|
||||
|
||||
// Set real dimensions
|
||||
setSize(64 * fontWidth + HBORDER * 2, 9 * (lineHeight + V_GAP) + VBORDER, max_w, max_h);
|
||||
|
||||
xpos = HBORDER; ypos = VBORDER;
|
||||
|
||||
// ROM path
|
||||
ButtonWidget* romButton =
|
||||
new ButtonWidget(this, font, xpos, ypos, buttonWidth, buttonHeight,
|
||||
"ROM path" + ELLIPSIS, kChooseRomDirCmd);
|
||||
wid.push_back(romButton);
|
||||
xpos += buttonWidth + H_GAP;
|
||||
myRomPath = new EditTextWidget(this, font, xpos, ypos + 1,
|
||||
_w - xpos - HBORDER, lineHeight, "");
|
||||
wid.push_back(myRomPath);
|
||||
|
||||
// Add Defaults, OK and Cancel buttons
|
||||
addDefaultsOKCancelBGroup(wid, font);
|
||||
|
||||
addToFocusList(wid);
|
||||
|
||||
// All ROM settings are disabled while in game mode
|
||||
if(!myIsGlobal)
|
||||
{
|
||||
romButton->clearFlags(WIDGET_ENABLED);
|
||||
myRomPath->setEditable(false);
|
||||
}
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
ConfigPathDialog::~ConfigPathDialog()
|
||||
{
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void ConfigPathDialog::loadConfig()
|
||||
{
|
||||
const Settings& settings = instance().settings();
|
||||
myRomPath->setText(settings.getString("romdir"));
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void ConfigPathDialog::saveConfig()
|
||||
{
|
||||
instance().settings().setValue("romdir", myRomPath->getText());
|
||||
|
||||
// Flush changes to disk and inform the OSystem
|
||||
instance().saveConfig();
|
||||
instance().setConfigPaths();
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void ConfigPathDialog::setDefaults()
|
||||
{
|
||||
FilesystemNode node("~");
|
||||
myRomPath->setText(node.getShortPath());
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void ConfigPathDialog::handleCommand(CommandSender* sender, int cmd,
|
||||
int data, int id)
|
||||
{
|
||||
switch (cmd)
|
||||
{
|
||||
case GuiObject::kOKCmd:
|
||||
saveConfig();
|
||||
close();
|
||||
if(myIsGlobal) // Let the boss know romdir has changed
|
||||
sendCommand(LauncherDialog::kRomDirChosenCmd, 0, 0);
|
||||
break;
|
||||
|
||||
case GuiObject::kDefaultsCmd:
|
||||
setDefaults();
|
||||
break;
|
||||
|
||||
case kChooseRomDirCmd:
|
||||
// This dialog is resizable under certain conditions, so we need
|
||||
// to re-create it as necessary
|
||||
createBrowser("Select ROM directory");
|
||||
myBrowser->show(myRomPath->getText(),
|
||||
BrowserDialog::Directories, LauncherDialog::kRomDirChosenCmd);
|
||||
break;
|
||||
|
||||
case LauncherDialog::kRomDirChosenCmd:
|
||||
myRomPath->setText(myBrowser->getResult().getShortPath());
|
||||
break;
|
||||
|
||||
default:
|
||||
Dialog::handleCommand(sender, cmd, data, 0);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void ConfigPathDialog::createBrowser(const string& title)
|
||||
{
|
||||
uInt32 w = 0, h = 0;
|
||||
getDynamicBounds(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);
|
||||
}
|
|
@ -1,73 +0,0 @@
|
|||
//============================================================================
|
||||
//
|
||||
// SSSS tt lll lll
|
||||
// SS SS tt ll ll
|
||||
// SS tttttt eeee ll ll aaaa
|
||||
// SSSS tt ee ee ll ll aa
|
||||
// SS tt eeeeee ll ll aaaaa -- "An Atari 2600 VCS Emulator"
|
||||
// SS SS tt ee ll ll aa aa
|
||||
// SSSS ttt eeeee llll llll aaaaa
|
||||
//
|
||||
// Copyright (c) 1995-2019 by Bradford W. Mott, Stephen Anthony
|
||||
// and the Stella Team
|
||||
//
|
||||
// See the file "License.txt" for information on usage and redistribution of
|
||||
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||
//============================================================================
|
||||
|
||||
#ifndef CONFIG_PATH_DIALOG_HXX
|
||||
#define CONFIG_PATH_DIALOG_HXX
|
||||
|
||||
class OSystem;
|
||||
class GuiObject;
|
||||
class DialogContainer;
|
||||
class BrowserDialog;
|
||||
class CheckboxWidget;
|
||||
class PopUpWidget;
|
||||
class EditTextWidget;
|
||||
class SliderWidget;
|
||||
class StaticTextWidget;
|
||||
|
||||
#include "Dialog.hxx"
|
||||
#include "Command.hxx"
|
||||
|
||||
class ConfigPathDialog : public Dialog, public CommandSender
|
||||
{
|
||||
public:
|
||||
ConfigPathDialog(OSystem& osystem, DialogContainer& parent,
|
||||
const GUI::Font& font, GuiObject* boss, int max_w, int max_h);
|
||||
virtual ~ConfigPathDialog();
|
||||
|
||||
private:
|
||||
void handleCommand(CommandSender* sender, int cmd, int data, int id) override;
|
||||
void createBrowser(const string& title);
|
||||
|
||||
void loadConfig() override;
|
||||
void saveConfig() override;
|
||||
void setDefaults() override;
|
||||
|
||||
private:
|
||||
enum {
|
||||
kChooseRomDirCmd = 'LOrm', // rom select
|
||||
};
|
||||
|
||||
const GUI::Font& myFont;
|
||||
|
||||
// Config paths
|
||||
EditTextWidget* myRomPath;
|
||||
|
||||
unique_ptr<BrowserDialog> myBrowser;
|
||||
|
||||
// Indicates if this dialog is used for global (vs. in-game) settings
|
||||
bool myIsGlobal;
|
||||
|
||||
private:
|
||||
// Following constructors and assignment operators not supported
|
||||
ConfigPathDialog() = delete;
|
||||
ConfigPathDialog(const ConfigPathDialog&) = delete;
|
||||
ConfigPathDialog(ConfigPathDialog&&) = delete;
|
||||
ConfigPathDialog& operator=(const ConfigPathDialog&) = delete;
|
||||
ConfigPathDialog& operator=(ConfigPathDialog&&) = delete;
|
||||
};
|
||||
|
||||
#endif
|
|
@ -28,7 +28,6 @@
|
|||
#include "InputDialog.hxx"
|
||||
#include "UIDialog.hxx"
|
||||
#include "SnapshotDialog.hxx"
|
||||
#include "ConfigPathDialog.hxx"
|
||||
#include "RomAuditDialog.hxx"
|
||||
#include "GameInfoDialog.hxx"
|
||||
#include "LoggerDialog.hxx"
|
||||
|
@ -90,8 +89,7 @@ OptionsDialog::OptionsDialog(OSystem& osystem, DialogContainer& parent,
|
|||
b = ADD_OD_BUTTON("Snapshots" + ELLIPSIS, kSnapCmd);
|
||||
wid.push_back(b);
|
||||
|
||||
b = ADD_OD_BUTTON("Paths" + ELLIPSIS, kCfgPathsCmd);
|
||||
wid.push_back(b);
|
||||
yoffset += rowHeight;
|
||||
|
||||
b = ADD_OD_BUTTON("Developer" + ELLIPSIS, kDevelopCmd);
|
||||
wid.push_back(b);
|
||||
|
@ -128,9 +126,8 @@ OptionsDialog::OptionsDialog(OSystem& osystem, DialogContainer& parent,
|
|||
myVideoDialog = make_unique<VideoDialog>(osystem, parent, _font, max_w, max_h);
|
||||
myAudioDialog = make_unique<AudioDialog>(osystem, parent, _font);
|
||||
myInputDialog = make_unique<InputDialog>(osystem, parent, _font, max_w, max_h);
|
||||
myUIDialog = make_unique<UIDialog>(osystem, parent, _font);
|
||||
myUIDialog = make_unique<UIDialog>(osystem, parent, _font, boss, max_w, max_h);
|
||||
mySnapshotDialog = make_unique<SnapshotDialog>(osystem, parent, _font, max_w, max_h);
|
||||
myConfigPathDialog = make_unique<ConfigPathDialog>(osystem, parent, _font, boss, max_w, max_h);
|
||||
myDeveloperDialog = make_unique<DeveloperDialog>(osystem, parent, _font, max_w, max_h);
|
||||
myGameInfoDialog = make_unique<GameInfoDialog>(osystem, parent, _font, this, max_w, max_h);
|
||||
#ifdef CHEATCODE_SUPPORT
|
||||
|
@ -240,21 +237,6 @@ void OptionsDialog::handleCommand(CommandSender* sender, int cmd,
|
|||
break;
|
||||
}
|
||||
|
||||
case kCfgPathsCmd:
|
||||
{
|
||||
// This dialog is resizable under certain conditions, so we need
|
||||
// to re-create it as necessary
|
||||
uInt32 w = 0, h = 0;
|
||||
|
||||
if(myConfigPathDialog == nullptr || myConfigPathDialog->shouldResize(w, h))
|
||||
{
|
||||
myConfigPathDialog = make_unique<ConfigPathDialog>(instance(), parent(),
|
||||
instance().frameBuffer().font(), _boss, w, h);
|
||||
}
|
||||
myConfigPathDialog->open();
|
||||
break;
|
||||
}
|
||||
|
||||
case kDevelopCmd:
|
||||
{
|
||||
// This dialog is resizable under certain conditions, so we need
|
||||
|
|
|
@ -27,9 +27,8 @@ class AudioDialog;
|
|||
class InputDialog;
|
||||
class UIDialog;
|
||||
class SnapshotDialog;
|
||||
class ConfigPathDialog;
|
||||
class RomAuditDialog;
|
||||
class GameInfoDialog;
|
||||
class RomAuditDialog;
|
||||
#ifdef CHEATCODE_SUPPORT
|
||||
class CheatCodeDialog;
|
||||
#endif
|
||||
|
@ -38,7 +37,6 @@ class AboutDialog;
|
|||
class LoggerDialog;
|
||||
|
||||
#include "Dialog.hxx"
|
||||
#include "bspf.hxx"
|
||||
|
||||
class DeveloperDialog;
|
||||
|
||||
|
@ -67,7 +65,6 @@ class OptionsDialog : public Dialog
|
|||
unique_ptr<InputDialog> myInputDialog;
|
||||
unique_ptr<UIDialog> myUIDialog;
|
||||
unique_ptr<SnapshotDialog> mySnapshotDialog;
|
||||
unique_ptr<ConfigPathDialog> myConfigPathDialog;
|
||||
unique_ptr<DeveloperDialog> myDeveloperDialog;
|
||||
unique_ptr<GameInfoDialog> myGameInfoDialog;
|
||||
#ifdef CHEATCODE_SUPPORT
|
||||
|
@ -93,7 +90,6 @@ class OptionsDialog : public Dialog
|
|||
kInptCmd = 'INPT',
|
||||
kUsrIfaceCmd = 'URIF',
|
||||
kSnapCmd = 'SNAP',
|
||||
kCfgPathsCmd = 'CFGP',
|
||||
kAuditCmd = 'RAUD',
|
||||
kInfoCmd = 'INFO',
|
||||
kCheatCmd = 'CHET',
|
||||
|
|
|
@ -29,6 +29,7 @@
|
|||
#include "TabWidget.hxx"
|
||||
#include "Widget.hxx"
|
||||
#include "Font.hxx"
|
||||
#include "LauncherDialog.hxx"
|
||||
#ifdef DEBUGGER_SUPPORT
|
||||
#include "DebuggerDialog.hxx"
|
||||
#endif
|
||||
|
@ -36,29 +37,31 @@
|
|||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
UIDialog::UIDialog(OSystem& osystem, DialogContainer& parent,
|
||||
const GUI::Font& font)
|
||||
const GUI::Font& font, GuiObject* boss, int max_w, int max_h)
|
||||
: Dialog(osystem, parent, font, "User interface settings"),
|
||||
myFont(font)
|
||||
CommandSender(boss),
|
||||
myFont(font),
|
||||
myIsGlobal(boss != nullptr)
|
||||
{
|
||||
const GUI::Font& ifont = instance().frameBuffer().infoFont();
|
||||
const int lineHeight = font.getLineHeight(),
|
||||
fontWidth = font.getMaxCharWidth(),
|
||||
fontHeight = font.getFontHeight(),
|
||||
buttonWidth = font.getStringWidth("Image path" + ELLIPSIS) + 20 + 1,
|
||||
buttonHeight = font.getLineHeight() + 4;
|
||||
|
||||
const int VBORDER = 8;
|
||||
const int HBORDER = 10;
|
||||
const int INDENT = 16;
|
||||
const int V_GAP = 4;
|
||||
int xpos, ypos, tabID;
|
||||
int lwidth, pwidth;
|
||||
int lwidth, pwidth, bwidth;
|
||||
WidgetArray wid;
|
||||
VariantList items;
|
||||
const GUI::Size& ds = instance().frameBuffer().desktopSize();
|
||||
|
||||
// Set real dimensions
|
||||
_w = (39+15) * fontWidth + 10 * 2;
|
||||
_h = (10+1) * (lineHeight + 4) + VBORDER + _th;
|
||||
setSize(64 * fontWidth + HBORDER * 2, 11 * (lineHeight + V_GAP) + V_GAP * 9 + VBORDER + _th,
|
||||
max_w, max_h);
|
||||
|
||||
// The tab widget
|
||||
myTab = new TabWidget(this, font, 2, 4 + _th, _w - 2*2, _h - _th - buttonHeight - 20);
|
||||
|
@ -81,7 +84,7 @@ 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 * 4;
|
||||
ypos += lineHeight + V_GAP * 4;
|
||||
|
||||
// Delay between quick-selecting characters in ListWidget
|
||||
int swidth = myPalettePopup->getWidth() - lwidth;
|
||||
|
@ -93,7 +96,7 @@ UIDialog::UIDialog(OSystem& osystem, DialogContainer& parent,
|
|||
myListDelayPopup->setStepValue(50);
|
||||
myListDelayPopup->setTickmarkInterval(5);
|
||||
wid.push_back(myListDelayPopup);
|
||||
ypos += lineHeight + 4;
|
||||
ypos += lineHeight + V_GAP;
|
||||
|
||||
// Number of lines a mouse wheel will scroll
|
||||
myWheelLinesPopup = new SliderWidget(myTab, font, xpos, ypos, swidth, lineHeight,
|
||||
|
@ -114,6 +117,19 @@ UIDialog::UIDialog(OSystem& osystem, DialogContainer& parent,
|
|||
lwidth = font.getStringWidth("Launcher height ");
|
||||
xpos = HBORDER; ypos = VBORDER;
|
||||
|
||||
// ROM path
|
||||
bwidth = font.getStringWidth("ROM path" + ELLIPSIS) + 20 + 1;
|
||||
ButtonWidget* romButton =
|
||||
new ButtonWidget(myTab, font, xpos, ypos, bwidth, buttonHeight,
|
||||
"ROM path" + ELLIPSIS, kChooseRomDirCmd);
|
||||
wid.push_back(romButton);
|
||||
xpos = romButton->getRight() + 8;
|
||||
myRomPath = new EditTextWidget(myTab, font, xpos, ypos + 1,
|
||||
_w - xpos - HBORDER - 2, lineHeight, "");
|
||||
wid.push_back(myRomPath);
|
||||
xpos = HBORDER;
|
||||
ypos += lineHeight + V_GAP * 4;
|
||||
|
||||
// Launcher width and height
|
||||
myLauncherWidthSlider = new SliderWidget(myTab, font, xpos, ypos, "Launcher width ",
|
||||
lwidth, kLauncherSize, 6 * fontWidth, "px");
|
||||
|
@ -123,7 +139,7 @@ UIDialog::UIDialog(OSystem& osystem, DialogContainer& parent,
|
|||
// one tickmark every ~100 pixel
|
||||
myLauncherWidthSlider->setTickmarkInterval((ds.w - FrameBuffer::kFBMinW + 50) / 100);
|
||||
wid.push_back(myLauncherWidthSlider);
|
||||
ypos += lineHeight + 4;
|
||||
ypos += lineHeight + V_GAP;
|
||||
|
||||
myLauncherHeightSlider = new SliderWidget(myTab, font, xpos, ypos, "Launcher height ",
|
||||
lwidth, kLauncherSize, 6 * fontWidth, "px");
|
||||
|
@ -133,7 +149,7 @@ UIDialog::UIDialog(OSystem& osystem, DialogContainer& parent,
|
|||
// one tickmark every ~100 pixel
|
||||
myLauncherHeightSlider->setTickmarkInterval((ds.h - FrameBuffer::kFBMinH + 50) / 100);
|
||||
wid.push_back(myLauncherHeightSlider);
|
||||
ypos += lineHeight + 4;
|
||||
ypos += lineHeight + V_GAP;
|
||||
|
||||
// Launcher font
|
||||
pwidth = font.getStringWidth("2x (1000x760)");
|
||||
|
@ -145,7 +161,7 @@ UIDialog::UIDialog(OSystem& osystem, DialogContainer& parent,
|
|||
new PopUpWidget(myTab, font, xpos, ypos + 1, pwidth, lineHeight, items,
|
||||
"Launcher font ", lwidth);
|
||||
wid.push_back(myLauncherFontPopup);
|
||||
ypos += lineHeight + 4 * 4;
|
||||
ypos += lineHeight + V_GAP * 4;
|
||||
|
||||
// ROM launcher info/snapshot viewer
|
||||
items.clear();
|
||||
|
@ -156,20 +172,21 @@ UIDialog::UIDialog(OSystem& osystem, DialogContainer& parent,
|
|||
new PopUpWidget(myTab, font, xpos, ypos + 1, pwidth, lineHeight, items,
|
||||
"ROM info viewer ", lwidth, kRomViewer);
|
||||
wid.push_back(myRomViewerPopup);
|
||||
ypos += lineHeight + 4;
|
||||
ypos += lineHeight + V_GAP;
|
||||
|
||||
// Snapshot path (load files)
|
||||
xpos = HBORDER + INDENT;
|
||||
myOpenBrowserButton = new ButtonWidget(myTab, font, xpos, ypos, buttonWidth, buttonHeight,
|
||||
bwidth = font.getStringWidth("Image path" + ELLIPSIS) + 20 + 1,
|
||||
myOpenBrowserButton = new ButtonWidget(myTab, font, xpos, ypos, bwidth, 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, "");
|
||||
_w - xpos - HBORDER - 2, lineHeight, "");
|
||||
wid.push_back(mySnapLoadPath);
|
||||
ypos += lineHeight + 4 * 5;
|
||||
ypos += lineHeight + V_GAP * 4;
|
||||
|
||||
// Exit to Launcher
|
||||
xpos = HBORDER;
|
||||
|
@ -187,6 +204,13 @@ UIDialog::UIDialog(OSystem& osystem, DialogContainer& parent,
|
|||
// Add items for tab 1
|
||||
addToFocusList(wid, myTab, tabID);
|
||||
|
||||
// All ROM settings are disabled while in game mode
|
||||
if(!myIsGlobal)
|
||||
{
|
||||
romButton->clearFlags(WIDGET_ENABLED);
|
||||
myRomPath->setEditable(false);
|
||||
}
|
||||
|
||||
// Activate the first tab
|
||||
myTab->setActiveTab(0);
|
||||
|
||||
|
@ -204,8 +228,13 @@ UIDialog::~UIDialog()
|
|||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void UIDialog::loadConfig()
|
||||
{
|
||||
const Settings& settings = instance().settings();
|
||||
|
||||
// ROM path
|
||||
myRomPath->setText(settings.getString("romdir"));
|
||||
|
||||
// Launcher size
|
||||
const GUI::Size& ls = instance().settings().getSize("launcherres");
|
||||
const GUI::Size& ls = settings.getSize("launcherres");
|
||||
uInt32 w = ls.w, h = ls.h;
|
||||
|
||||
w = std::max(w, uInt32(FrameBuffer::kFBMinW));
|
||||
|
@ -217,30 +246,30 @@ void UIDialog::loadConfig()
|
|||
myLauncherHeightSlider->setValue(h);
|
||||
|
||||
// Launcher font
|
||||
const string& font = instance().settings().getString("launcherfont");
|
||||
const string& font = settings.getString("launcherfont");
|
||||
myLauncherFontPopup->setSelected(font, "medium");
|
||||
|
||||
// ROM launcher info viewer
|
||||
const string& viewer = instance().settings().getString("romviewer");
|
||||
const string& viewer = settings.getString("romviewer");
|
||||
myRomViewerPopup->setSelected(viewer, "0");
|
||||
|
||||
// ROM launcher info viewer image path
|
||||
mySnapLoadPath->setText(instance().settings().getString("snaploaddir"));
|
||||
mySnapLoadPath->setText(settings.getString("snaploaddir"));
|
||||
|
||||
// Exit to launcher
|
||||
bool exitlauncher = instance().settings().getBool("exitlauncher");
|
||||
bool exitlauncher = settings.getBool("exitlauncher");
|
||||
myLauncherExitWidget->setState(exitlauncher);
|
||||
|
||||
// UI palette
|
||||
const string& pal = instance().settings().getString("uipalette");
|
||||
const string& pal = settings.getString("uipalette");
|
||||
myPalettePopup->setSelected(pal, "standard");
|
||||
|
||||
// Listwidget quick delay
|
||||
int delay = instance().settings().getInt("listdelay");
|
||||
int delay = settings.getInt("listdelay");
|
||||
myListDelayPopup->setValue(delay);
|
||||
|
||||
// Mouse wheel lines
|
||||
int mw = instance().settings().getInt("mwheel");
|
||||
int mw = settings.getInt("mwheel");
|
||||
myWheelLinesPopup->setValue(mw);
|
||||
|
||||
handleRomViewer();
|
||||
|
@ -251,37 +280,46 @@ void UIDialog::loadConfig()
|
|||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void UIDialog::saveConfig()
|
||||
{
|
||||
Settings& settings = instance().settings();
|
||||
|
||||
// ROM path
|
||||
settings.setValue("romdir", myRomPath->getText());
|
||||
|
||||
// Launcher size
|
||||
instance().settings().setValue("launcherres",
|
||||
settings.setValue("launcherres",
|
||||
GUI::Size(myLauncherWidthSlider->getValue(),
|
||||
myLauncherHeightSlider->getValue()));
|
||||
|
||||
// Launcher font
|
||||
instance().settings().setValue("launcherfont",
|
||||
settings.setValue("launcherfont",
|
||||
myLauncherFontPopup->getSelectedTag().toString());
|
||||
|
||||
// ROM launcher info viewer
|
||||
instance().settings().setValue("romviewer",
|
||||
settings.setValue("romviewer",
|
||||
myRomViewerPopup->getSelectedTag().toString());
|
||||
|
||||
// ROM launcher info viewer image path
|
||||
instance().settings().setValue("snaploaddir", mySnapLoadPath->getText());
|
||||
settings.setValue("snaploaddir", mySnapLoadPath->getText());
|
||||
|
||||
// Exit to Launcher
|
||||
instance().settings().setValue("exitlauncher", myLauncherExitWidget->getState());
|
||||
settings.setValue("exitlauncher", myLauncherExitWidget->getState());
|
||||
|
||||
// UI palette
|
||||
instance().settings().setValue("uipalette",
|
||||
settings.setValue("uipalette",
|
||||
myPalettePopup->getSelectedTag().toString());
|
||||
instance().frameBuffer().setUIPalette();
|
||||
|
||||
// Listwidget quick delay
|
||||
instance().settings().setValue("listdelay", myListDelayPopup->getValue());
|
||||
settings.setValue("listdelay", myListDelayPopup->getValue());
|
||||
ListWidget::setQuickSelectDelay(myListDelayPopup->getValue());
|
||||
|
||||
// Mouse wheel lines
|
||||
instance().settings().setValue("mwheel", myWheelLinesPopup->getValue());
|
||||
settings.setValue("mwheel", myWheelLinesPopup->getValue());
|
||||
ScrollBarWidget::setWheelLines(myWheelLinesPopup->getValue());
|
||||
|
||||
// Flush changes to disk and inform the OSystem
|
||||
instance().saveConfig();
|
||||
instance().setConfigPaths();
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
@ -296,6 +334,8 @@ void UIDialog::setDefaults()
|
|||
break;
|
||||
case 1: // Launcher options
|
||||
{
|
||||
FilesystemNode node("~");
|
||||
myRomPath->setText(node.getShortPath());
|
||||
uInt32 w = std::min(instance().frameBuffer().desktopSize().w, 900u);
|
||||
uInt32 h = std::min(instance().frameBuffer().desktopSize().h, 600u);
|
||||
myLauncherWidthSlider->setValue(w);
|
||||
|
@ -319,6 +359,8 @@ void UIDialog::handleCommand(CommandSender* sender, int cmd, int data, int id)
|
|||
case GuiObject::kOKCmd:
|
||||
saveConfig();
|
||||
close();
|
||||
if(myIsGlobal) // Let the boss know romdir has changed
|
||||
sendCommand(LauncherDialog::kRomDirChosenCmd, 0, 0);
|
||||
break;
|
||||
|
||||
case GuiObject::kDefaultsCmd:
|
||||
|
@ -348,6 +390,18 @@ void UIDialog::handleCommand(CommandSender* sender, int cmd, int data, int id)
|
|||
myWheelLinesPopup->setValueUnit(" lines");
|
||||
break;
|
||||
|
||||
case kChooseRomDirCmd:
|
||||
// This dialog is resizable under certain conditions, so we need
|
||||
// to re-create it as necessary
|
||||
createBrowser("Select ROM directory");
|
||||
myBrowser->show(myRomPath->getText(),
|
||||
BrowserDialog::Directories, LauncherDialog::kRomDirChosenCmd);
|
||||
break;
|
||||
|
||||
case LauncherDialog::kRomDirChosenCmd:
|
||||
myRomPath->setText(myBrowser->getResult().getShortPath());
|
||||
break;
|
||||
|
||||
case kLauncherSize:
|
||||
case kRomViewer:
|
||||
handleRomViewer();
|
||||
|
|
|
@ -18,23 +18,13 @@
|
|||
#ifndef UI_DIALOG_HXX
|
||||
#define UI_DIALOG_HXX
|
||||
|
||||
class CommandSender;
|
||||
class Dialog;
|
||||
class DialogContainer;
|
||||
class CheckboxWidget;
|
||||
class PopUpWidget;
|
||||
class SliderWidget;
|
||||
class StaticTextWidget;
|
||||
class TabWidget;
|
||||
class BrowserDialog;
|
||||
class OSystem;
|
||||
|
||||
#include "bspf.hxx"
|
||||
|
||||
class UIDialog : public Dialog
|
||||
class UIDialog : public Dialog, public CommandSender
|
||||
{
|
||||
public:
|
||||
UIDialog(OSystem& osystem, DialogContainer& parent, const GUI::Font& font);
|
||||
UIDialog(OSystem& osystem, DialogContainer& parent, const GUI::Font& font,
|
||||
GuiObject* boss, int max_w, int max_h);
|
||||
virtual ~UIDialog();
|
||||
|
||||
private:
|
||||
|
@ -51,6 +41,7 @@ class UIDialog : public Dialog
|
|||
{
|
||||
kListDelay = 'UILd',
|
||||
kMouseWheel = 'UIMw',
|
||||
kChooseRomDirCmd = 'LOrm', // rom select
|
||||
kLauncherSize = 'UIls',
|
||||
kRomViewer = 'UIRv',
|
||||
kChooseSnapLoadDirCmd = 'UIsl', // snapshot dir (load files)
|
||||
|
@ -61,6 +52,7 @@ class UIDialog : public Dialog
|
|||
TabWidget* myTab;
|
||||
|
||||
// Launcher options
|
||||
EditTextWidget* myRomPath;
|
||||
SliderWidget* myLauncherWidthSlider;
|
||||
SliderWidget* myLauncherHeightSlider;
|
||||
PopUpWidget* myLauncherFontPopup;
|
||||
|
@ -76,6 +68,9 @@ class UIDialog : public Dialog
|
|||
|
||||
unique_ptr<BrowserDialog> myBrowser;
|
||||
|
||||
// Indicates if this dialog is used for global (vs. in-game) settings
|
||||
bool myIsGlobal;
|
||||
|
||||
private:
|
||||
// Following constructors and assignment operators not supported
|
||||
UIDialog() = delete;
|
||||
|
|
|
@ -8,8 +8,7 @@ MODULE_OBJS := \
|
|||
src/gui/ColorWidget.o \
|
||||
src/gui/ComboDialog.o \
|
||||
src/gui/CommandDialog.o \
|
||||
src/gui/CommandMenu.o \
|
||||
src/gui/ConfigPathDialog.o \
|
||||
src/gui/CommandMenu.o \
|
||||
src/gui/ContextMenu.o \
|
||||
src/gui/DeveloperDialog.o \
|
||||
src/gui/DialogContainer.o \
|
||||
|
|
|
@ -604,7 +604,6 @@
|
|||
<ClCompile Include="..\gui\EditableWidget.cxx" />
|
||||
<ClCompile Include="..\gui\EditTextWidget.cxx" />
|
||||
<ClCompile Include="..\gui\EventMappingWidget.cxx" />
|
||||
<ClCompile Include="..\gui\ConfigPathDialog.cxx" />
|
||||
<ClCompile Include="..\gui\Font.cxx" />
|
||||
<ClCompile Include="..\gui\GameInfoDialog.cxx" />
|
||||
<ClCompile Include="..\gui\GameList.cxx" />
|
||||
|
@ -1341,7 +1340,6 @@
|
|||
<ClInclude Include="..\gui\EditableWidget.hxx" />
|
||||
<ClInclude Include="..\gui\EditTextWidget.hxx" />
|
||||
<ClInclude Include="..\gui\EventMappingWidget.hxx" />
|
||||
<ClInclude Include="..\gui\ConfigPathDialog.hxx" />
|
||||
<ClInclude Include="..\gui\Font.hxx" />
|
||||
<ClInclude Include="..\gui\GameInfoDialog.hxx" />
|
||||
<ClInclude Include="..\gui\GameList.hxx" />
|
||||
|
|
|
@ -375,9 +375,6 @@
|
|||
<ClCompile Include="..\gui\EventMappingWidget.cxx">
|
||||
<Filter>Source Files\gui</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\gui\ConfigPathDialog.cxx">
|
||||
<Filter>Source Files\gui</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\gui\Font.cxx">
|
||||
<Filter>Source Files\gui</Filter>
|
||||
</ClCompile>
|
||||
|
@ -1316,9 +1313,6 @@
|
|||
<ClInclude Include="..\gui\EventMappingWidget.hxx">
|
||||
<Filter>Header Files\gui</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\gui\ConfigPathDialog.hxx">
|
||||
<Filter>Header Files\gui</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\gui\Font.hxx">
|
||||
<Filter>Header Files\gui</Filter>
|
||||
</ClInclude>
|
||||
|
|
Loading…
Reference in New Issue