diff --git a/src/emucore/OSystem.cxx b/src/emucore/OSystem.cxx index 838f7d1c8..2d7bd1fac 100644 --- a/src/emucore/OSystem.cxx +++ b/src/emucore/OSystem.cxx @@ -47,6 +47,7 @@ #include "Menu.hxx" #include "CommandMenu.hxx" #include "Launcher.hxx" +#include "Rewinder.hxx" #include "PNGLibrary.hxx" #include "Widget.hxx" #include "Console.hxx" @@ -140,6 +141,7 @@ bool OSystem::create() myMenu = make_unique(*this); myCommandMenu = make_unique(*this); myLauncher = make_unique(*this); + myRewinder = make_unique(*this); myStateManager = make_unique(*this); // Create the sound object; the sound subsystem isn't actually diff --git a/src/emucore/OSystem.hxx b/src/emucore/OSystem.hxx index 5be8f4b75..7f6385e23 100644 --- a/src/emucore/OSystem.hxx +++ b/src/emucore/OSystem.hxx @@ -26,6 +26,7 @@ class Console; class Debugger; class Launcher; class Menu; +class Rewinder; class FrameBuffer; class PNGLibrary; class Properties; @@ -152,6 +153,13 @@ class OSystem */ Launcher& launcher() const { return *myLauncher; } + /** + Get the state rewinder of the system. + + @return The rewinder object + */ + Rewinder& rewinder() const { return *myRewinder; } + /** Get the state manager of the system. @@ -461,6 +469,9 @@ class OSystem unique_ptr myLauncher; bool myLauncherUsed; + // Pointer to the Rewinder object + unique_ptr myRewinder; + #ifdef DEBUGGER_SUPPORT // Pointer to the Debugger object unique_ptr myDebugger; diff --git a/src/gui/RewindDialog.cxx b/src/gui/RewindDialog.cxx new file mode 100644 index 000000000..682b25cc1 --- /dev/null +++ b/src/gui/RewindDialog.cxx @@ -0,0 +1,39 @@ +//============================================================================ +// +// 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-2017 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 "Dialog.hxx" +#include "Font.hxx" +#include "EventHandler.hxx" +#include "FrameBuffer.hxx" +#include "OSystem.hxx" +#include "Widget.hxx" +#include "RewindDialog.hxx" + +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +RewindDialog::RewindDialog(OSystem& osystem, DialogContainer& parent, + int max_w, int max_h) + : Dialog(osystem, parent) +{ + const GUI::Font& font = instance().frameBuffer().font(); + const int buttonWidth = font.getStringWidth("Right Diff B") + 20, + buttonHeight = font.getLineHeight() + 6, + rowHeight = font.getLineHeight() + 10; + + // Set real dimensions + _w = 3 * (buttonWidth + 5) + 20; + _h = 6 * rowHeight + 15; +} diff --git a/src/gui/RewindDialog.hxx b/src/gui/RewindDialog.hxx new file mode 100644 index 000000000..6bf71f47b --- /dev/null +++ b/src/gui/RewindDialog.hxx @@ -0,0 +1,42 @@ +//============================================================================ +// +// 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-2017 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 REWIND_DIALOG_HXX +#define REWIND_DIALOG_HXX + +class CommandSender; +class DialogContainer; +class OSystem; + +#include "Dialog.hxx" + +class RewindDialog : public Dialog +{ + public: + RewindDialog(OSystem& osystem, DialogContainer& parent, int max_w, int max_h); + virtual ~RewindDialog() = default; + + private: + // Following constructors and assignment operators not supported + RewindDialog() = delete; + RewindDialog(const RewindDialog&) = delete; + RewindDialog(RewindDialog&&) = delete; + RewindDialog& operator=(const RewindDialog&) = delete; + RewindDialog& operator=(RewindDialog&&) = delete; +}; + +#endif diff --git a/src/gui/Rewinder.cxx b/src/gui/Rewinder.cxx new file mode 100644 index 000000000..066e70759 --- /dev/null +++ b/src/gui/Rewinder.cxx @@ -0,0 +1,29 @@ +//============================================================================ +// +// 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-2017 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 "Dialog.hxx" +#include "FrameBuffer.hxx" +#include "RewindDialog.hxx" +#include "Rewinder.hxx" + +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Rewinder::Rewinder(OSystem& osystem) + : DialogContainer(osystem) +{ + myBaseDialog = new RewindDialog(myOSystem, *this, + FrameBuffer::kFBMinW, FrameBuffer::kFBMinH); +} diff --git a/src/gui/Rewinder.hxx b/src/gui/Rewinder.hxx new file mode 100644 index 000000000..67434d987 --- /dev/null +++ b/src/gui/Rewinder.hxx @@ -0,0 +1,45 @@ +//============================================================================ +// +// 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-2017 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 REWINDER_HXX +#define REWINDER_HXX + +class OSystem; + +#include "DialogContainer.hxx" + +/** + The base dialog for all rewind-related UI items in Stella. + + @author Stephen Anthony +*/ +class Rewinder : public DialogContainer +{ + public: + Rewinder(OSystem& osystem); + virtual ~Rewinder() = default; + + private: + // Following constructors and assignment operators not supported + Rewinder() = delete; + Rewinder(const Rewinder&) = delete; + Rewinder(Rewinder&&) = delete; + Rewinder& operator=(const Rewinder&) = delete; + Rewinder& operator=(Rewinder&&) = delete; +}; + +#endif diff --git a/src/gui/module.mk b/src/gui/module.mk index 06a8f46c5..ebe74d760 100644 --- a/src/gui/module.mk +++ b/src/gui/module.mk @@ -37,6 +37,8 @@ MODULE_OBJS := \ src/gui/PopUpWidget.o \ src/gui/ProgressDialog.o \ src/gui/RadioButtonWidget.o \ + src/gui/Rewinder.o \ + src/gui/RewindDialog.o \ src/gui/RomAuditDialog.o \ src/gui/RomInfoWidget.o \ src/gui/ScrollBarWidget.o \