More conversions to unique_ptr, so deletes can be removed.

git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@3060 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
stephena 2014-11-09 04:01:31 +00:00
parent 92aa5c2e36
commit 1b7635649c
36 changed files with 93 additions and 196 deletions

View File

@ -36,7 +36,7 @@
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CheatCodeDialog::CheatCodeDialog(OSystem& osystem, DialogContainer& parent,
const GUI::Font& font)
: Dialog(osystem, parent, 0, 0, 0, 0)
: Dialog(osystem, parent)
{
const int lineHeight = font.getLineHeight(),
fontWidth = font.getMaxCharWidth(),

View File

@ -1,47 +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-2014 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.
//
// $Id$
//============================================================================
#include "Expression.hxx"
#ifdef EXPR_REF_COUNT
#include "bspf.hxx"
int refCount = 0;
#endif
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Expression::Expression(Expression* lhs, Expression* rhs)
: myLHS(lhs),
myRHS(rhs)
{
#ifdef EXPR_REF_COUNT
refCount++;
cerr << "new Expression::Expression()" << endl;
#endif
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Expression::~Expression()
{
#ifdef EXPR_REF_COUNT
refCount--;
cerr << "~Expression::Expression()" << endl;
#endif
delete myLHS;
delete myRHS;
}

View File

@ -22,10 +22,6 @@
#include "bspf.hxx"
// define this to count Expression instances. Only useful for debugging
// Stella itself.
//#define EXPR_REF_COUNT
/**
This class provides an implementation of an expression node, which
is a construct that is given two other expressions and evaluates and
@ -38,14 +34,13 @@
class Expression
{
public:
Expression(Expression* lhs, Expression* rhs);
virtual ~Expression();
Expression(Expression* lhs, Expression* rhs) : myLHS(lhs), myRHS(rhs) { }
virtual ~Expression() { }
virtual uInt16 evaluate() const = 0;
protected:
Expression* myLHS;
Expression* myRHS;
unique_ptr<Expression> myLHS, myRHS;
};
#endif

View File

@ -50,8 +50,6 @@ DebuggerDialog::DebuggerDialog(OSystem& osystem, DialogContainer& parent,
: Dialog(osystem, parent, x, y, w, h),
myTab(nullptr),
myRomTab(nullptr),
myLFont(nullptr),
myNFont(nullptr),
myFatalError(nullptr)
{
createFont(); // Font is sized according to available space
@ -68,8 +66,6 @@ DebuggerDialog::DebuggerDialog(OSystem& osystem, DialogContainer& parent,
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
DebuggerDialog::~DebuggerDialog()
{
delete myLFont;
delete myNFont;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -212,53 +208,53 @@ void DebuggerDialog::createFont()
if(_w >= kLargeFontMinW && _h >= kLargeFontMinH)
{
// Large font doesn't use fontstyle at all
myLFont = new GUI::Font(GUI::stellaMediumDesc);
myNFont = new GUI::Font(GUI::stellaMediumDesc);
myLFont = make_ptr<GUI::Font>(GUI::stellaMediumDesc);
myNFont = make_ptr<GUI::Font>(GUI::stellaMediumDesc);
}
else if(_w >= kMediumFontMinW && _h >= kMediumFontMinH)
{
if(fontstyle == 1)
{
myLFont = new GUI::Font(GUI::consoleMediumBDesc);
myNFont = new GUI::Font(GUI::consoleMediumDesc);
myLFont = make_ptr<GUI::Font>(GUI::consoleMediumBDesc);
myNFont = make_ptr<GUI::Font>(GUI::consoleMediumDesc);
}
else if(fontstyle == 2)
{
myLFont = new GUI::Font(GUI::consoleMediumDesc);
myNFont = new GUI::Font(GUI::consoleMediumBDesc);
myLFont = make_ptr<GUI::Font>(GUI::consoleMediumDesc);
myNFont = make_ptr<GUI::Font>(GUI::consoleMediumBDesc);
}
else if(fontstyle == 3)
{
myLFont = new GUI::Font(GUI::consoleMediumBDesc);
myNFont = new GUI::Font(GUI::consoleMediumBDesc);
myLFont = make_ptr<GUI::Font>(GUI::consoleMediumBDesc);
myNFont = make_ptr<GUI::Font>(GUI::consoleMediumBDesc);
}
else // default to zero
{
myLFont = new GUI::Font(GUI::consoleMediumDesc);
myNFont = new GUI::Font(GUI::consoleMediumDesc);
myLFont = make_ptr<GUI::Font>(GUI::consoleMediumDesc);
myNFont = make_ptr<GUI::Font>(GUI::consoleMediumDesc);
}
}
else
{
if(fontstyle == 1)
{
myLFont = new GUI::Font(GUI::consoleBDesc);
myNFont = new GUI::Font(GUI::consoleDesc);
myLFont = make_ptr<GUI::Font>(GUI::consoleBDesc);
myNFont = make_ptr<GUI::Font>(GUI::consoleDesc);
}
else if(fontstyle == 2)
{
myLFont = new GUI::Font(GUI::consoleDesc);
myNFont = new GUI::Font(GUI::consoleBDesc);
myLFont = make_ptr<GUI::Font>(GUI::consoleDesc);
myNFont = make_ptr<GUI::Font>(GUI::consoleBDesc);
}
else if(fontstyle == 3)
{
myLFont = new GUI::Font(GUI::consoleBDesc);
myNFont = new GUI::Font(GUI::consoleBDesc);
myLFont = make_ptr<GUI::Font>(GUI::consoleBDesc);
myNFont = make_ptr<GUI::Font>(GUI::consoleBDesc);
}
else // default to zero
{
myLFont = new GUI::Font(GUI::consoleDesc);
myNFont = new GUI::Font(GUI::consoleDesc);
myLFont = make_ptr<GUI::Font>(GUI::consoleDesc);
myNFont = make_ptr<GUI::Font>(GUI::consoleDesc);
}
}
}

View File

@ -104,8 +104,6 @@ class DebuggerDialog : public Dialog
TabWidget *myTab, *myRomTab;
GUI::Font* myLFont; // used for labels
GUI::Font* myNFont; // used for normal text
PromptWidget* myPrompt;
TiaInfoWidget* myTiaInfo;
TiaOutputWidget* myTiaOutput;
@ -118,6 +116,9 @@ class DebuggerDialog : public Dialog
EditTextWidget* myMessageBox;
ButtonWidget* myRewindButton;
GUI::MessageBox* myFatalError;
unique_ptr<GUI::Font> myLFont; // used for labels
unique_ptr<GUI::Font> myNFont; // used for normal text
};
#endif

View File

@ -139,7 +139,7 @@ RamWidget::RamWidget(GuiObject* boss, const GUI::Font& lfont, const GUI::Font& n
// Inputbox which will pop up when searching RAM
StringList labels;
labels.push_back("Search: ");
myInputBox = new InputTextDialog(boss, lfont, nfont, labels);
myInputBox = make_ptr<InputTextDialog>(boss, lfont, nfont, labels);
myInputBox->setTarget(this);
// Start with these buttons disabled
@ -150,7 +150,6 @@ RamWidget::RamWidget(GuiObject* boss, const GUI::Font& lfont, const GUI::Font& n
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
RamWidget::~RamWidget()
{
delete myInputBox;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

View File

@ -66,6 +66,8 @@ class RamWidget : public Widget, public CommandSender
int myUndoValue;
int myCurrentRamBank;
unique_ptr<InputTextDialog> myInputBox;
StaticTextWidget* myRamStart;
StaticTextWidget* myRamLabels[8];
DataGridWidget* myRamGrid;
@ -80,8 +82,6 @@ class RamWidget : public Widget, public CommandSender
ButtonWidget* myCompareButton;
ButtonWidget* myRestartButton;
InputTextDialog* myInputBox;
IntArray myOldValueList;
IntArray mySearchAddr;
IntArray mySearchValue;

View File

@ -31,7 +31,6 @@ RomListWidget::RomListWidget(GuiObject* boss, const GUI::Font& lfont,
const GUI::Font& nfont,
int x, int y, int w, int h)
: EditableWidget(boss, nfont, x, y, 16, 16),
myMenu(nullptr),
_rows(0),
_cols(0),
_currentPos(0),
@ -58,7 +57,7 @@ RomListWidget::RomListWidget(GuiObject* boss, const GUI::Font& lfont,
myScrollBar->setTarget(this);
// Add settings menu
myMenu = new RomListSettings(this, lfont);
myMenu = make_ptr<RomListSettings>(this, lfont);
// Take advantage of a wide debugger window when possible
const int fontWidth = lfont.getMaxCharWidth(),
@ -94,7 +93,6 @@ RomListWidget::RomListWidget(GuiObject* boss, const GUI::Font& lfont,
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
RomListWidget::~RomListWidget()
{
delete myMenu;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

View File

@ -91,7 +91,7 @@ class RomListWidget : public EditableWidget
void scrollToCurrent(int item);
private:
RomListSettings* myMenu;
unique_ptr<RomListSettings> myMenu;
ScrollBarWidget* myScrollBar;
int _labelWidth;

View File

@ -38,7 +38,6 @@ TiaOutputWidget::TiaOutputWidget(GuiObject* boss, const GUI::Font& font,
int x, int y, int w, int h)
: Widget(boss, font, x, y, w, h),
CommandSender(boss),
myMenu(nullptr),
myZoom(nullptr),
myClickX(0),
myClickY(0)
@ -50,13 +49,12 @@ TiaOutputWidget::TiaOutputWidget(GuiObject* boss, const GUI::Font& font,
VList::push_back(l, "Set zoom position", "zoom");
VList::push_back(l, "Save snapshot", "snap");
VList::push_back(l, "Toggle fixed debug colors (from beam pos)", "fixed");
myMenu = new ContextMenu(this, font, l);
myMenu = make_ptr<ContextMenu>(this, font, l);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
TiaOutputWidget::~TiaOutputWidget()
{
delete myMenu;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

View File

@ -59,7 +59,7 @@ class TiaOutputWidget : public Widget, public CommandSender
bool wantsFocus() { return false; }
private:
ContextMenu* myMenu;
unique_ptr<ContextMenu> myMenu;
TiaZoomWidget* myZoom;
int myClickX, myClickY;

View File

@ -31,8 +31,7 @@
TiaZoomWidget::TiaZoomWidget(GuiObject* boss, const GUI::Font& font,
int x, int y, int w, int h)
: Widget(boss, font, x, y, 16, 16),
CommandSender(boss),
myMenu(nullptr)
CommandSender(boss)
{
_flags = WIDGET_ENABLED | WIDGET_CLEARBG |
WIDGET_RETAIN_FOCUS | WIDGET_TRACK_MOUSE;
@ -58,13 +57,12 @@ TiaZoomWidget::TiaZoomWidget(GuiObject* boss, const GUI::Font& font,
VList::push_back(l, "2x zoom", "2");
VList::push_back(l, "4x zoom", "4");
VList::push_back(l, "8x zoom", "8");
myMenu = new ContextMenu(this, font, l);
myMenu = make_ptr<ContextMenu>(this, font, l);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
TiaZoomWidget::~TiaZoomWidget()
{
delete myMenu;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

View File

@ -54,7 +54,7 @@ class TiaZoomWidget : public Widget, public CommandSender
void recalc();
private:
ContextMenu* myMenu;
unique_ptr<ContextMenu> myMenu;
int myZoomLevel;
int myNumCols, myNumRows;

View File

@ -3,7 +3,6 @@ MODULE := src/debugger
MODULE_OBJS := \
src/debugger/Debugger.o \
src/debugger/DebuggerParser.o \
src/debugger/Expression.o \
src/debugger/PackedBitArray.o \
src/debugger/CartDebug.o \
src/debugger/CpuDebug.o \

View File

@ -27,7 +27,7 @@
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
AboutDialog::AboutDialog(OSystem& osystem, DialogContainer& parent,
const GUI::Font& font)
: Dialog(osystem, parent, 0, 0, 0, 0),
: Dialog(osystem, parent),
myPage(1),
myNumPages(4),
myLinesPerPage(12)

View File

@ -36,7 +36,7 @@
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
AudioDialog::AudioDialog(OSystem& osystem, DialogContainer& parent,
const GUI::Font& font)
: Dialog(osystem, parent, 0, 0, 0, 0)
: Dialog(osystem, parent)
{
const int lineHeight = font.getLineHeight(),
fontWidth = font.getMaxCharWidth(),

View File

@ -39,7 +39,7 @@
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
BrowserDialog::BrowserDialog(GuiObject* boss, const GUI::Font& font,
int max_w, int max_h)
: Dialog(boss->instance(), boss->parent(), 0, 0, 0, 0),
: Dialog(boss->instance(), boss->parent()),
CommandSender(boss),
_cmd(0),
_mode(FileSave)

View File

@ -35,7 +35,7 @@
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
ComboDialog::ComboDialog(GuiObject* boss, const GUI::Font& font,
const VariantList& combolist)
: Dialog(boss->instance(), boss->parent(), 0, 0, 0, 0),
: Dialog(boss->instance(), boss->parent()),
myComboEvent(Event::NoType)
{
#define ADD_EVENT_POPUP(IDX, LABEL) \

View File

@ -130,13 +130,12 @@ ConfigPathDialog::ConfigPathDialog(
}
// Create file browser dialog
myBrowser = new BrowserDialog(this, font, max_w, max_h);
myBrowser = make_ptr<BrowserDialog>(this, font, max_w, max_h);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
ConfigPathDialog::~ConfigPathDialog()
{
delete myBrowser;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

View File

@ -63,7 +63,7 @@ class ConfigPathDialog : public Dialog, public CommandSender
kNVRamDirChosenCmd = 'LOnc' // nvram (flash/eeprom) dir changed
};
BrowserDialog* myBrowser;
unique_ptr<BrowserDialog> myBrowser;
// Config paths
EditTextWidget* myRomPath;

View File

@ -36,7 +36,7 @@
GameInfoDialog::GameInfoDialog(
OSystem& osystem, DialogContainer& parent, const GUI::Font& font,
GuiObject* boss)
: Dialog(osystem, parent, 0, 0, 0, 0),
: Dialog(osystem, parent),
CommandSender(boss),
myPropertiesLoaded(false),
myDefaultsSelected(false)

View File

@ -32,7 +32,7 @@
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
GlobalPropsDialog::GlobalPropsDialog(GuiObject* boss, const GUI::Font& font)
: Dialog(boss->instance(), boss->parent(), 0, 0, 0, 0),
: Dialog(boss->instance(), boss->parent()),
CommandSender(boss)
{
const int lineHeight = font.getLineHeight(),

View File

@ -28,7 +28,7 @@
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
HelpDialog::HelpDialog(OSystem& osystem, DialogContainer& parent,
const GUI::Font& font)
: Dialog(osystem, parent, 0, 0, 0, 0),
: Dialog(osystem, parent),
myPage(1),
myNumPages(5)
{

View File

@ -35,7 +35,7 @@
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
InputDialog::InputDialog(OSystem& osystem, DialogContainer& parent,
const GUI::Font& font, int max_w, int max_h)
: Dialog(osystem, parent, 0, 0, 0, 0)
: Dialog(osystem, parent)
{
const int lineHeight = font.getLineHeight(),
fontWidth = font.getMaxCharWidth(),

View File

@ -53,13 +53,8 @@ LauncherDialog::LauncherDialog(OSystem& osystem, DialogContainer& parent,
myOptionsButton(nullptr),
myQuitButton(nullptr),
myList(nullptr),
myGameList(nullptr),
myRomInfoWidget(nullptr),
myMenu(nullptr),
myGlobalProps(nullptr),
myFilters(nullptr),
myFirstRunMsg(nullptr),
myRomDir(nullptr),
mySelectedItem(0)
{
const GUI::Font& font = instance().frameBuffer().launcherFont();
@ -169,11 +164,12 @@ LauncherDialog::LauncherDialog(OSystem& osystem, DialogContainer& parent,
mySelectedItem = 0; // Highlight 'Rom Listing'
// Create an options dialog, similar to the in-game one
myOptions = new OptionsDialog(osystem, parent, this, int(w * 0.8), int(h * 0.8), true);
myOptions = make_ptr<OptionsDialog>(osystem, parent, this,
int(w * 0.8), int(h * 0.8), true);
// Create a game list, which contains all the information about a ROM that
// the launcher needs
myGameList = new GameList();
myGameList = make_ptr<GameList>();
addToFocusList(wid);
@ -182,14 +178,14 @@ LauncherDialog::LauncherDialog(OSystem& osystem, DialogContainer& parent,
VList::push_back(l, "Power-on options", "override");
VList::push_back(l, "Filter listing", "filter");
VList::push_back(l, "Reload listing", "reload");
myMenu = new ContextMenu(this, osystem.frameBuffer().font(), l);
myMenu = make_ptr<ContextMenu>(this, osystem.frameBuffer().font(), l);
// Create global props dialog, which is used to temporarily overrride
// ROM properties
myGlobalProps = new GlobalPropsDialog(this, osystem.frameBuffer().font());
myGlobalProps = make_ptr<GlobalPropsDialog>(this, osystem.frameBuffer().font());
// Create dialog whereby the files shown in the ROM listing can be customized
myFilters = new LauncherFilterDialog(this, osystem.frameBuffer().font());
myFilters = make_ptr<LauncherFilterDialog>(this, osystem.frameBuffer().font());
// Figure out which filters are needed for the ROM listing
setListFilters();
@ -198,12 +194,6 @@ LauncherDialog::LauncherDialog(OSystem& osystem, DialogContainer& parent,
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
LauncherDialog::~LauncherDialog()
{
delete myOptions;
delete myGameList;
delete myMenu;
delete myGlobalProps;
delete myFilters;
delete myRomDir;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -531,7 +521,7 @@ void LauncherDialog::handleCommand(CommandSender* sender, int cmd,
case kFirstRunMsgChosenCmd:
// Show a file browser, starting from the users' home directory
if(!myRomDir)
myRomDir = new BrowserDialog(this, instance().frameBuffer().font(), _w, _h);
myRomDir = make_ptr<BrowserDialog>(this, instance().frameBuffer().font(), _w, _h);
myRomDir->show("Select ROM directory:", "~",
BrowserDialog::Directories, kStartupRomDirChosenCmd);

View File

@ -94,6 +94,13 @@ class LauncherDialog : public Dialog
bool matchPattern(const string& s, const string& pattern) const;
private:
unique_ptr<OptionsDialog> myOptions;
unique_ptr<GameList> myGameList;
unique_ptr<ContextMenu> myMenu;
unique_ptr<GlobalPropsDialog> myGlobalProps;
unique_ptr<LauncherFilterDialog> myFilters;
unique_ptr<BrowserDialog> myRomDir;
ButtonWidget* myStartButton;
ButtonWidget* myPrevDirButton;
ButtonWidget* myOptionsButton;
@ -104,17 +111,9 @@ class LauncherDialog : public Dialog
StaticTextWidget* myDir;
StaticTextWidget* myRomCount;
EditTextWidget* myPattern;
GameList* myGameList;
OptionsDialog* myOptions;
RomInfoWidget* myRomInfoWidget;
ContextMenu* myMenu;
GlobalPropsDialog* myGlobalProps;
LauncherFilterDialog* myFilters;
GUI::MessageBox* myFirstRunMsg;
BrowserDialog* myRomDir;
int mySelectedItem;
FilesystemNode myCurrentNode;

View File

@ -34,7 +34,7 @@
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
LauncherFilterDialog::LauncherFilterDialog(GuiObject* boss, const GUI::Font& font)
: Dialog(boss->instance(), boss->parent(), 0, 0, 0, 0),
: Dialog(boss->instance(), boss->parent()),
CommandSender(boss)
{
const int lineHeight = font.getLineHeight(),

View File

@ -37,7 +37,7 @@
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
LoggerDialog::LoggerDialog(OSystem& osystem, DialogContainer& parent,
const GUI::Font& font, int max_w, int max_h)
: Dialog(osystem, parent, 0, 0, 0, 0),
: Dialog(osystem, parent),
myLogInfo(nullptr)
{
const int lineHeight = font.getLineHeight(),

View File

@ -49,17 +49,6 @@
OptionsDialog::OptionsDialog(OSystem& osystem, DialogContainer& parent,
GuiObject* boss, int max_w, int max_h, bool global)
: Dialog(osystem, parent),
myVideoDialog(nullptr),
myAudioDialog(nullptr),
myInputDialog(nullptr),
myUIDialog(nullptr),
mySnapshotDialog(nullptr),
myConfigPathDialog(nullptr),
myGameInfoDialog(nullptr),
myCheatCodeDialog(nullptr),
myLoggerDialog(nullptr),
myHelpDialog(nullptr),
myAboutDialog(nullptr),
myIsGlobal(global)
{
const GUI::Font& font = instance().frameBuffer().font();
@ -124,20 +113,20 @@ OptionsDialog::OptionsDialog(OSystem& osystem, DialogContainer& parent,
addCancelWidget(b);
// Now create all the dialogs attached to each menu button
myVideoDialog = new VideoDialog(osystem, parent, font, max_w, max_h);
myAudioDialog = new AudioDialog(osystem, parent, font);
myInputDialog = new InputDialog(osystem, parent, font, max_w, max_h);
myUIDialog = new UIDialog(osystem, parent, font);
mySnapshotDialog = new SnapshotDialog(osystem, parent, font, boss, max_w, max_h);
myConfigPathDialog = new ConfigPathDialog(osystem, parent, font, boss, max_w, max_h);
myRomAuditDialog = new RomAuditDialog(osystem, parent, font, max_w, max_h);
myGameInfoDialog = new GameInfoDialog(osystem, parent, font, this);
myVideoDialog = make_ptr<VideoDialog>(osystem, parent, font, max_w, max_h);
myAudioDialog = make_ptr<AudioDialog>(osystem, parent, font);
myInputDialog = make_ptr<InputDialog>(osystem, parent, font, max_w, max_h);
myUIDialog = make_ptr<UIDialog>(osystem, parent, font);
mySnapshotDialog = make_ptr<SnapshotDialog>(osystem, parent, font, boss, max_w, max_h);
myConfigPathDialog = make_ptr<ConfigPathDialog>(osystem, parent, font, boss, max_w, max_h);
myRomAuditDialog = make_ptr<RomAuditDialog>(osystem, parent, font, max_w, max_h);
myGameInfoDialog = make_ptr<GameInfoDialog>(osystem, parent, font, this);
#ifdef CHEATCODE_SUPPORT
myCheatCodeDialog = new CheatCodeDialog(osystem, parent, font);
myCheatCodeDialog = make_ptr<CheatCodeDialog>(osystem, parent, font);
#endif
myLoggerDialog = new LoggerDialog(osystem, parent, font, max_w, max_h);
myHelpDialog = new HelpDialog(osystem, parent, font);
myAboutDialog = new AboutDialog(osystem, parent, font);
myLoggerDialog = make_ptr<LoggerDialog>(osystem, parent, font, max_w, max_h);
myHelpDialog = make_ptr<HelpDialog>(osystem, parent, font);
myAboutDialog = make_ptr<AboutDialog>(osystem, parent, font);
addToFocusList(wid);
@ -155,20 +144,6 @@ OptionsDialog::OptionsDialog(OSystem& osystem, DialogContainer& parent,
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
OptionsDialog::~OptionsDialog()
{
delete myVideoDialog;
delete myAudioDialog;
delete myInputDialog;
delete myUIDialog;
delete mySnapshotDialog;
delete myConfigPathDialog;
delete myRomAuditDialog;
delete myGameInfoDialog;
#ifdef CHEATCODE_SUPPORT
delete myCheatCodeDialog;
#endif
delete myLoggerDialog;
delete myHelpDialog;
delete myAboutDialog;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

View File

@ -52,18 +52,18 @@ class OptionsDialog : public Dialog
void handleCommand(CommandSender* sender, int cmd, int data, int id);
private:
VideoDialog* myVideoDialog;
AudioDialog* myAudioDialog;
InputDialog* myInputDialog;
UIDialog* myUIDialog;
SnapshotDialog* mySnapshotDialog;
ConfigPathDialog* myConfigPathDialog;
RomAuditDialog* myRomAuditDialog;
GameInfoDialog* myGameInfoDialog;
CheatCodeDialog* myCheatCodeDialog;
LoggerDialog* myLoggerDialog;
HelpDialog* myHelpDialog;
AboutDialog* myAboutDialog;
unique_ptr<VideoDialog> myVideoDialog;
unique_ptr<AudioDialog> myAudioDialog;
unique_ptr<InputDialog> myInputDialog;
unique_ptr<UIDialog> myUIDialog;
unique_ptr<SnapshotDialog> mySnapshotDialog;
unique_ptr<ConfigPathDialog> myConfigPathDialog;
unique_ptr<RomAuditDialog> myRomAuditDialog;
unique_ptr<GameInfoDialog> myGameInfoDialog;
unique_ptr<CheatCodeDialog> myCheatCodeDialog;
unique_ptr<LoggerDialog> myLoggerDialog;
unique_ptr<HelpDialog> myHelpDialog;
unique_ptr<AboutDialog> myAboutDialog;
ButtonWidget* myRomAuditButton;
ButtonWidget* myGameInfoButton;

View File

@ -63,13 +63,12 @@ PopUpWidget::PopUpWidget(GuiObject* boss, const GUI::Font& font,
myTextY = (_h - _font.getFontHeight()) / 2;
myArrowsY = (_h - 8) / 2;
myMenu = new ContextMenu(this, font, list, cmd);
myMenu = make_ptr<ContextMenu>(this, font, list, cmd);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
PopUpWidget::~PopUpWidget()
{
delete myMenu;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

View File

@ -70,7 +70,7 @@ class PopUpWidget : public Widget, public CommandSender
void drawWidget(bool hilite);
private:
ContextMenu* myMenu;
unique_ptr<ContextMenu> myMenu;
int myArrowsY;
int myTextY;

View File

@ -37,7 +37,6 @@
RomAuditDialog::RomAuditDialog(OSystem& osystem, DialogContainer& parent,
const GUI::Font& font, int max_w, int max_h)
: Dialog(osystem, parent),
myBrowser(nullptr),
myConfirmMsg(nullptr),
myMaxWidth(max_w),
myMaxHeight(max_h)
@ -93,13 +92,12 @@ RomAuditDialog::RomAuditDialog(OSystem& osystem, DialogContainer& parent,
addBGroupToFocusList(wid);
// Create file browser dialog
myBrowser = new BrowserDialog(this, font, myMaxWidth, myMaxHeight);
myBrowser = make_ptr<BrowserDialog>(this, font, myMaxWidth, myMaxHeight);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
RomAuditDialog::~RomAuditDialog()
{
delete myBrowser;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

View File

@ -54,6 +54,9 @@ class RomAuditDialog : public Dialog
kConfirmAuditCmd = 'RAcf' // confirm rom audit
};
// Select a new ROM audit path
unique_ptr<BrowserDialog> myBrowser;
// ROM audit path
EditTextWidget* myRomPath;
@ -61,9 +64,6 @@ class RomAuditDialog : public Dialog
StaticTextWidget* myResults1;
StaticTextWidget* myResults2;
// Select a new ROM audit path
BrowserDialog* myBrowser;
// Show a message about the dangers of using this function
GUI::MessageBox* myConfirmMsg;

View File

@ -38,7 +38,7 @@
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
UIDialog::UIDialog(OSystem& osystem, DialogContainer& parent,
const GUI::Font& font)
: Dialog(osystem, parent, 0, 0, 0, 0)
: Dialog(osystem, parent)
{
const GUI::Font& ifont = instance().frameBuffer().infoFont();
const int lineHeight = font.getLineHeight(),

View File

@ -39,7 +39,7 @@
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
VideoDialog::VideoDialog(OSystem& osystem, DialogContainer& parent,
const GUI::Font& font, int max_w, int max_h)
: Dialog(osystem, parent, 0, 0, 0, 0)
: Dialog(osystem, parent)
{
const int lineHeight = font.getLineHeight(),
fontWidth = font.getMaxCharWidth(),