Added basic infrastructure for what will become the rewind dialog.

This commit is contained in:
Stephen Anthony 2017-12-15 13:19:29 -03:30
parent d28fb580b8
commit bf6d28e181
7 changed files with 170 additions and 0 deletions

View File

@ -47,6 +47,7 @@
#include "Menu.hxx" #include "Menu.hxx"
#include "CommandMenu.hxx" #include "CommandMenu.hxx"
#include "Launcher.hxx" #include "Launcher.hxx"
#include "Rewinder.hxx"
#include "PNGLibrary.hxx" #include "PNGLibrary.hxx"
#include "Widget.hxx" #include "Widget.hxx"
#include "Console.hxx" #include "Console.hxx"
@ -140,6 +141,7 @@ bool OSystem::create()
myMenu = make_unique<Menu>(*this); myMenu = make_unique<Menu>(*this);
myCommandMenu = make_unique<CommandMenu>(*this); myCommandMenu = make_unique<CommandMenu>(*this);
myLauncher = make_unique<Launcher>(*this); myLauncher = make_unique<Launcher>(*this);
myRewinder = make_unique<Rewinder>(*this);
myStateManager = make_unique<StateManager>(*this); myStateManager = make_unique<StateManager>(*this);
// Create the sound object; the sound subsystem isn't actually // Create the sound object; the sound subsystem isn't actually

View File

@ -26,6 +26,7 @@ class Console;
class Debugger; class Debugger;
class Launcher; class Launcher;
class Menu; class Menu;
class Rewinder;
class FrameBuffer; class FrameBuffer;
class PNGLibrary; class PNGLibrary;
class Properties; class Properties;
@ -152,6 +153,13 @@ class OSystem
*/ */
Launcher& launcher() const { return *myLauncher; } 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. Get the state manager of the system.
@ -461,6 +469,9 @@ class OSystem
unique_ptr<Launcher> myLauncher; unique_ptr<Launcher> myLauncher;
bool myLauncherUsed; bool myLauncherUsed;
// Pointer to the Rewinder object
unique_ptr<Rewinder> myRewinder;
#ifdef DEBUGGER_SUPPORT #ifdef DEBUGGER_SUPPORT
// Pointer to the Debugger object // Pointer to the Debugger object
unique_ptr<Debugger> myDebugger; unique_ptr<Debugger> myDebugger;

39
src/gui/RewindDialog.cxx Normal file
View File

@ -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;
}

42
src/gui/RewindDialog.hxx Normal file
View File

@ -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

29
src/gui/Rewinder.cxx Normal file
View File

@ -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);
}

45
src/gui/Rewinder.hxx Normal file
View File

@ -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

View File

@ -37,6 +37,8 @@ MODULE_OBJS := \
src/gui/PopUpWidget.o \ src/gui/PopUpWidget.o \
src/gui/ProgressDialog.o \ src/gui/ProgressDialog.o \
src/gui/RadioButtonWidget.o \ src/gui/RadioButtonWidget.o \
src/gui/Rewinder.o \
src/gui/RewindDialog.o \
src/gui/RomAuditDialog.o \ src/gui/RomAuditDialog.o \
src/gui/RomInfoWidget.o \ src/gui/RomInfoWidget.o \
src/gui/ScrollBarWidget.o \ src/gui/ScrollBarWidget.o \