From 21da4a6388afe4410b67139e88c4bb3f8f2e5010 Mon Sep 17 00:00:00 2001 From: thrust26 Date: Sat, 2 Mar 2019 19:04:18 +0100 Subject: [PATCH] move ROM path selection into UIDialog deleted ConfigPathDialog class (TODO: update non VS project files) --- src/gui/ConfigPathDialog.cxx | 153 ----------------------------- src/gui/ConfigPathDialog.hxx | 73 -------------- src/gui/OptionsDialog.cxx | 22 +---- src/gui/OptionsDialog.hxx | 6 +- src/gui/UIDialog.cxx | 116 ++++++++++++++++------ src/gui/UIDialog.hxx | 21 ++-- src/gui/module.mk | 3 +- src/windows/Stella.vcxproj | 2 - src/windows/Stella.vcxproj.filters | 6 -- 9 files changed, 97 insertions(+), 305 deletions(-) delete mode 100644 src/gui/ConfigPathDialog.cxx delete mode 100644 src/gui/ConfigPathDialog.hxx diff --git a/src/gui/ConfigPathDialog.cxx b/src/gui/ConfigPathDialog.cxx deleted file mode 100644 index 66f1aa413..000000000 --- a/src/gui/ConfigPathDialog.cxx +++ /dev/null @@ -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(this, myFont, w, h, title); - else - myBrowser->setTitle(title); -} diff --git a/src/gui/ConfigPathDialog.hxx b/src/gui/ConfigPathDialog.hxx deleted file mode 100644 index a7cd24a21..000000000 --- a/src/gui/ConfigPathDialog.hxx +++ /dev/null @@ -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 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 diff --git a/src/gui/OptionsDialog.cxx b/src/gui/OptionsDialog.cxx index f67093b56..7a841c60c 100644 --- a/src/gui/OptionsDialog.cxx +++ b/src/gui/OptionsDialog.cxx @@ -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(osystem, parent, _font, max_w, max_h); myAudioDialog = make_unique(osystem, parent, _font); myInputDialog = make_unique(osystem, parent, _font, max_w, max_h); - myUIDialog = make_unique(osystem, parent, _font); + myUIDialog = make_unique(osystem, parent, _font, boss, max_w, max_h); mySnapshotDialog = make_unique(osystem, parent, _font, max_w, max_h); - myConfigPathDialog = make_unique(osystem, parent, _font, boss, max_w, max_h); myDeveloperDialog = make_unique(osystem, parent, _font, max_w, max_h); myGameInfoDialog = make_unique(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(instance(), parent(), - instance().frameBuffer().font(), _boss, w, h); - } - myConfigPathDialog->open(); - break; - } - case kDevelopCmd: { // This dialog is resizable under certain conditions, so we need diff --git a/src/gui/OptionsDialog.hxx b/src/gui/OptionsDialog.hxx index 17c7db757..fea0dfcc5 100644 --- a/src/gui/OptionsDialog.hxx +++ b/src/gui/OptionsDialog.hxx @@ -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 myInputDialog; unique_ptr myUIDialog; unique_ptr mySnapshotDialog; - unique_ptr myConfigPathDialog; unique_ptr myDeveloperDialog; unique_ptr 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', diff --git a/src/gui/UIDialog.cxx b/src/gui/UIDialog.cxx index 901eae582..bbd2c7535 100644 --- a/src/gui/UIDialog.cxx +++ b/src/gui/UIDialog.cxx @@ -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(); diff --git a/src/gui/UIDialog.hxx b/src/gui/UIDialog.hxx index 049b730e4..3cc52b8e2 100644 --- a/src/gui/UIDialog.hxx +++ b/src/gui/UIDialog.hxx @@ -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 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; diff --git a/src/gui/module.mk b/src/gui/module.mk index 44e5d33f6..0b81d10df 100644 --- a/src/gui/module.mk +++ b/src/gui/module.mk @@ -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 \ diff --git a/src/windows/Stella.vcxproj b/src/windows/Stella.vcxproj index 82a6158c8..03785edec 100644 --- a/src/windows/Stella.vcxproj +++ b/src/windows/Stella.vcxproj @@ -604,7 +604,6 @@ - @@ -1341,7 +1340,6 @@ - diff --git a/src/windows/Stella.vcxproj.filters b/src/windows/Stella.vcxproj.filters index dd656f571..0c22027b1 100644 --- a/src/windows/Stella.vcxproj.filters +++ b/src/windows/Stella.vcxproj.filters @@ -375,9 +375,6 @@ Source Files\gui - - Source Files\gui - Source Files\gui @@ -1316,9 +1313,6 @@ Header Files\gui - - Header Files\gui - Header Files\gui