Revert "cleaned up code for use of fonts for BrowserDialog"

This reverts commit b56f81e8b5.
This commit is contained in:
Stephen Anthony 2020-12-27 11:32:23 -03:30
parent b56f81e8b5
commit 027ff96d94
9 changed files with 16 additions and 5 deletions

View File

@ -35,6 +35,7 @@
#include "PromptWidget.hxx" #include "PromptWidget.hxx"
#include "RomWidget.hxx" #include "RomWidget.hxx"
#include "ProgressDialog.hxx" #include "ProgressDialog.hxx"
#include "BrowserDialog.hxx"
#include "TimerManager.hxx" #include "TimerManager.hxx"
#include "Vec.hxx" #include "Vec.hxx"

View File

@ -17,6 +17,7 @@
#include "bspf.hxx" #include "bspf.hxx"
#include "Bankswitch.hxx" #include "Bankswitch.hxx"
#include "BrowserDialog.hxx"
#include "ContextMenu.hxx" #include "ContextMenu.hxx"
#include "DialogContainer.hxx" #include "DialogContainer.hxx"
#include "Dialog.hxx" #include "Dialog.hxx"

View File

@ -22,6 +22,7 @@ class ButtonWidget;
class CommandSender; class CommandSender;
class ContextMenu; class ContextMenu;
class DialogContainer; class DialogContainer;
class BrowserDialog;
class OptionsDialog; class OptionsDialog;
class HighScoresDialog; class HighScoresDialog;
class GlobalPropsDialog; class GlobalPropsDialog;
@ -167,6 +168,7 @@ class LauncherDialog : public Dialog
unique_ptr<StellaSettingsDialog> myStellaSettingsDialog; unique_ptr<StellaSettingsDialog> myStellaSettingsDialog;
unique_ptr<ContextMenu> myMenu; unique_ptr<ContextMenu> myMenu;
unique_ptr<GlobalPropsDialog> myGlobalProps; unique_ptr<GlobalPropsDialog> myGlobalProps;
unique_ptr<BrowserDialog> myRomDir;
unique_ptr<WhatsNewDialog> myWhatsNewDialog; unique_ptr<WhatsNewDialog> myWhatsNewDialog;
// automatically sized font for ROM info viewer // automatically sized font for ROM info viewer

View File

@ -37,6 +37,7 @@
RomAuditDialog::RomAuditDialog(OSystem& osystem, DialogContainer& parent, RomAuditDialog::RomAuditDialog(OSystem& osystem, DialogContainer& parent,
const GUI::Font& font, int max_w, int max_h) const GUI::Font& font, int max_w, int max_h)
: Dialog(osystem, parent, font, "Audit ROMs"), : Dialog(osystem, parent, font, "Audit ROMs"),
myFont{font},
myMaxWidth{max_w}, myMaxWidth{max_w},
myMaxHeight{max_h} myMaxHeight{max_h}
{ {
@ -185,7 +186,7 @@ void RomAuditDialog::handleCommand(CommandSender* sender, int cmd,
msg.push_back("If you're sure you want to proceed with the"); msg.push_back("If you're sure you want to proceed with the");
msg.push_back("audit, click 'OK', otherwise click 'Cancel'."); msg.push_back("audit, click 'OK', otherwise click 'Cancel'.");
myConfirmMsg = make_unique<GUI::MessageBox> myConfirmMsg = make_unique<GUI::MessageBox>
(this, _font, msg, myMaxWidth, myMaxHeight, kConfirmAuditCmd, (this, myFont, msg, myMaxWidth, myMaxHeight, kConfirmAuditCmd,
"OK", "Cancel", "ROM Audit", false); "OK", "Cancel", "ROM Audit", false);
} }
myConfirmMsg->show(); myConfirmMsg->show();
@ -228,7 +229,7 @@ void RomAuditDialog::createBrowser(const string& title)
// Create file browser dialog // Create file browser dialog
if(!myBrowser || uInt32(myBrowser->getWidth()) != w || if(!myBrowser || uInt32(myBrowser->getWidth()) != w ||
uInt32(myBrowser->getHeight()) != h) uInt32(myBrowser->getHeight()) != h)
myBrowser = make_unique<BrowserDialog>(this, _font, w, h, title); myBrowser = make_unique<BrowserDialog>(this, myFont, w, h, title);
else else
myBrowser->setTitle(title); myBrowser->setTitle(title);
} }

View File

@ -54,6 +54,7 @@ class RomAuditDialog : public Dialog
// Select a new ROM audit path // Select a new ROM audit path
unique_ptr<BrowserDialog> myBrowser; unique_ptr<BrowserDialog> myBrowser;
const GUI::Font& myFont;
// ROM audit path // ROM audit path
EditTextWidget* myRomPath{nullptr}; EditTextWidget* myRomPath{nullptr};

View File

@ -28,7 +28,8 @@
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
SnapshotDialog::SnapshotDialog(OSystem& osystem, DialogContainer& parent, SnapshotDialog::SnapshotDialog(OSystem& osystem, DialogContainer& parent,
const GUI::Font& font, int max_w, int max_h) const GUI::Font& font, int max_w, int max_h)
: Dialog(osystem, parent, font, "Snapshot settings") : Dialog(osystem, parent, font, "Snapshot settings"),
myFont{font}
{ {
const int lineHeight = font.getLineHeight(), const int lineHeight = font.getLineHeight(),
fontHeight = _font.getFontHeight(), fontHeight = _font.getFontHeight(),
@ -188,7 +189,7 @@ void SnapshotDialog::createBrowser(const string& title)
// Create file browser dialog // Create file browser dialog
if(!myBrowser || uInt32(myBrowser->getWidth()) != w || if(!myBrowser || uInt32(myBrowser->getWidth()) != w ||
uInt32(myBrowser->getHeight()) != h) uInt32(myBrowser->getHeight()) != h)
myBrowser = make_unique<BrowserDialog>(this, _font, w, h, title); myBrowser = make_unique<BrowserDialog>(this, myFont, w, h, title);
else else
myBrowser->setTitle(title); myBrowser->setTitle(title);
} }

View File

@ -52,6 +52,8 @@ class SnapshotDialog : public Dialog
kSnapshotInterval = 'SnIn' // snap chosen (load files) kSnapshotInterval = 'SnIn' // snap chosen (load files)
}; };
const GUI::Font& myFont;
// Config paths // Config paths
EditTextWidget* mySnapSavePath{nullptr}; EditTextWidget* mySnapSavePath{nullptr};

View File

@ -42,6 +42,7 @@ UIDialog::UIDialog(OSystem& osystem, DialogContainer& parent,
const GUI::Font& font, GuiObject* boss, int max_w, int max_h) const GUI::Font& font, GuiObject* boss, int max_w, int max_h)
: Dialog(osystem, parent, font, "User interface settings"), : Dialog(osystem, parent, font, "User interface settings"),
CommandSender(boss), CommandSender(boss),
myFont{font},
myIsGlobal{boss != nullptr} myIsGlobal{boss != nullptr}
{ {
const GUI::Font& ifont = instance().frameBuffer().infoFont(); const GUI::Font& ifont = instance().frameBuffer().infoFont();
@ -711,7 +712,7 @@ void UIDialog::createBrowser(const string& title)
// Create file browser dialog // Create file browser dialog
if(!myBrowser || uInt32(myBrowser->getWidth()) != w || if(!myBrowser || uInt32(myBrowser->getWidth()) != w ||
uInt32(myBrowser->getHeight()) != h) uInt32(myBrowser->getHeight()) != h)
myBrowser = make_unique<BrowserDialog>(this, _font, w, h, title); myBrowser = make_unique<BrowserDialog>(this, myFont, w, h, title);
else else
myBrowser->setTitle(title); myBrowser->setTitle(title);
} }

View File

@ -50,6 +50,7 @@ class UIDialog : public Dialog, public CommandSender
kSnapLoadDirChosenCmd = 'UIsc' // snap chosen (load files) kSnapLoadDirChosenCmd = 'UIsc' // snap chosen (load files)
}; };
const GUI::Font& myFont;
TabWidget* myTab{nullptr}; TabWidget* myTab{nullptr};
// Launcher options // Launcher options