Several large infrastructure changes for upcoming Time Machine stuff:

- renamed Rewinder and associated dialog to TimeMachine and friends
 - changed EventHandler state enum to stronger 'enum class' type (and associated changes to the codebase)
 - moved EventHandlerState into separate class, allowing a few files to not need to include EventHandler.hxx (reduce compile dependency)
 - plumbed EventHandlerState::TIMEMACHINE into the codebase; still TODO is activate it and add a usable dialog)
This commit is contained in:
Stephen Anthony 2017-12-20 21:56:22 -03:30
parent 6313c98fdc
commit 7890a94144
31 changed files with 200 additions and 167 deletions

View File

@ -227,7 +227,7 @@ uInt32 RewindManager::unwindState(uInt32 numStates)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void RewindManager::compressStates() void RewindManager::compressStates()
{ {
uInt64 currentCycles = myOSystem.console().tia().cycles(); // uInt64 currentCycles = myOSystem.console().tia().cycles();
double expectedCycles = myInterval * myFactor * (1 + myFactor); double expectedCycles = myInterval * myFactor * (1 + myFactor);
double maxError = 1; double maxError = 1;
uInt32 idx = myStateList.size() - 2; uInt32 idx = myStateList.size() - 2;
@ -302,7 +302,7 @@ string RewindManager::getUnitString(Int64 cycles)
stringstream result; stringstream result;
Int32 i; Int32 i;
cycles = abs(cycles); cycles = std::abs(cycles);
for(i = 0; i < NUM_UNITS - 1; ++i) for(i = 0; i < NUM_UNITS - 1; ++i)
{ {

View File

@ -22,6 +22,7 @@
#include "Version.hxx" #include "Version.hxx"
#include "OSystem.hxx" #include "OSystem.hxx"
#include "FrameBuffer.hxx" #include "FrameBuffer.hxx"
#include "EventHandler.hxx"
#include "FSNode.hxx" #include "FSNode.hxx"
#include "Settings.hxx" #include "Settings.hxx"
#include "DebuggerDialog.hxx" #include "DebuggerDialog.hxx"

View File

@ -20,6 +20,7 @@
class OSystem; class OSystem;
class Console; class Console;
class EventHandler;
class TiaInfoWidget; class TiaInfoWidget;
class TiaOutputWidget; class TiaOutputWidget;
class TiaZoomWidget; class TiaZoomWidget;

View File

@ -19,6 +19,7 @@
#include "Dialog.hxx" #include "Dialog.hxx"
#include "Font.hxx" #include "Font.hxx"
#include "Debugger.hxx" #include "Debugger.hxx"
#include "EventHandler.hxx"
#include "FrameBuffer.hxx" #include "FrameBuffer.hxx"
#include "FBSurface.hxx" #include "FBSurface.hxx"
#include "DataGridWidget.hxx" #include "DataGridWidget.hxx"

View File

@ -19,6 +19,7 @@
#include "Widget.hxx" #include "Widget.hxx"
#include "Dialog.hxx" #include "Dialog.hxx"
#include "Settings.hxx" #include "Settings.hxx"
#include "EventHandler.hxx"
#include "TabWidget.hxx" #include "TabWidget.hxx"
#include "TiaInfoWidget.hxx" #include "TiaInfoWidget.hxx"
#include "TiaOutputWidget.hxx" #include "TiaOutputWidget.hxx"

View File

@ -20,6 +20,7 @@
#include "DiStella.hxx" #include "DiStella.hxx"
#include "PackedBitArray.hxx" #include "PackedBitArray.hxx"
#include "Widget.hxx" #include "Widget.hxx"
#include "EventHandler.hxx"
#include "FBSurface.hxx" #include "FBSurface.hxx"
#include "Font.hxx" #include "Font.hxx"
#include "ScrollBarWidget.hxx" #include "ScrollBarWidget.hxx"

View File

@ -16,6 +16,7 @@
//============================================================================ //============================================================================
#include "OSystem.hxx" #include "OSystem.hxx"
#include "EventHandler.hxx"
#include "Widget.hxx" #include "Widget.hxx"
#include "ToggleWidget.hxx" #include "ToggleWidget.hxx"

View File

@ -1008,11 +1008,11 @@ void Console::attachDebugger(Debugger& dbg)
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void Console::stateChanged(EventHandler::State state) void Console::stateChanged(EventHandlerState state)
{ {
// For now, only the CompuMate cares about state changes // For now, only the CompuMate cares about state changes
if(myCMHandler) if(myCMHandler)
myCMHandler->enableKeyHandling(state == EventHandler::S_EMULATE); myCMHandler->enableKeyHandling(state == EventHandlerState::EMULATION);
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

View File

@ -34,6 +34,7 @@ class Debugger;
#include "TIATypes.hxx" #include "TIATypes.hxx"
#include "FrameBuffer.hxx" #include "FrameBuffer.hxx"
#include "Serializable.hxx" #include "Serializable.hxx"
#include "EventHandlerConstants.hxx"
#include "NTSCFilter.hxx" #include "NTSCFilter.hxx"
#include "frame-manager/AbstractFrameManager.hxx" #include "frame-manager/AbstractFrameManager.hxx"
@ -184,7 +185,7 @@ class Console : public Serializable
/** /**
Informs the Console of a change in EventHandler state. Informs the Console of a change in EventHandler state.
*/ */
void stateChanged(EventHandler::State state); void stateChanged(EventHandlerState state);
public: public:
/** /**

View File

@ -29,6 +29,7 @@
#include "TIASurface.hxx" #include "TIASurface.hxx"
#include "FSNode.hxx" #include "FSNode.hxx"
#include "Launcher.hxx" #include "Launcher.hxx"
#include "TimeMachine.hxx"
#include "Menu.hxx" #include "Menu.hxx"
#include "OSystem.hxx" #include "OSystem.hxx"
#include "Joystick.hxx" #include "Joystick.hxx"
@ -60,7 +61,7 @@
EventHandler::EventHandler(OSystem& osystem) EventHandler::EventHandler(OSystem& osystem)
: myOSystem(osystem), : myOSystem(osystem),
myOverlay(nullptr), myOverlay(nullptr),
myState(S_NONE), myState(EventHandlerState::NONE),
myAllowAllDirectionsFlag(false), myAllowAllDirectionsFlag(false),
myFryingFlag(false), myFryingFlag(false),
myUseCtrlKeyFlag(true), myUseCtrlKeyFlag(true),
@ -124,7 +125,7 @@ void EventHandler::initialize()
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void EventHandler::reset(State state) void EventHandler::reset(EventHandlerState state)
{ {
setEventState(state); setEventState(state);
myOSystem.state().reset(); myOSystem.state().reset();
@ -213,7 +214,7 @@ void EventHandler::poll(uInt64 time)
// Update controllers and console switches, and in general all other things // Update controllers and console switches, and in general all other things
// related to emulation // related to emulation
if(myState == S_EMULATE) if(myState == EventHandlerState::EMULATION)
{ {
myOSystem.console().riot().update(); myOSystem.console().riot().update();
@ -294,31 +295,31 @@ void EventHandler::handleKeyEvent(StellaKey key, StellaMod mod, bool state)
myOSystem.frameBuffer().toggleFullscreen(); myOSystem.frameBuffer().toggleFullscreen();
} }
// state rewinding must work in pause mode too // state rewinding must work in pause mode too
else if(myState == S_EMULATE || myState == S_PAUSE) else if(myState == EventHandlerState::EMULATION || myState == EventHandlerState::PAUSE)
{ {
switch(key) switch(key)
{ {
case KBDK_LEFT: // Alt-left(-shift) rewinds 1(10) states case KBDK_LEFT: // Alt-left(-shift) rewinds 1(10) states
myOSystem.frameBuffer().setPauseDelay(); myOSystem.frameBuffer().setPauseDelay();
setEventState(S_PAUSE); setEventState(EventHandlerState::PAUSE);
myOSystem.state().rewindState((kbdShift(mod) && state) ? 10 : 1); myOSystem.state().rewindState((kbdShift(mod) && state) ? 10 : 1);
break; break;
case KBDK_RIGHT: // Alt-right(-shift) unwinds 1(10) states case KBDK_RIGHT: // Alt-right(-shift) unwinds 1(10) states
myOSystem.frameBuffer().setPauseDelay(); myOSystem.frameBuffer().setPauseDelay();
setEventState(S_PAUSE); setEventState(EventHandlerState::PAUSE);
myOSystem.state().unwindState((kbdShift(mod) && state) ? 10 : 1); myOSystem.state().unwindState((kbdShift(mod) && state) ? 10 : 1);
break; break;
case KBDK_DOWN: // Alt-down rewinds to start of list case KBDK_DOWN: // Alt-down rewinds to start of list
myOSystem.frameBuffer().setPauseDelay(); myOSystem.frameBuffer().setPauseDelay();
setEventState(S_PAUSE); setEventState(EventHandlerState::PAUSE);
myOSystem.state().rewindState(1000); myOSystem.state().rewindState(1000);
break; break;
case KBDK_UP: // Alt-up rewinds to end of list case KBDK_UP: // Alt-up rewinds to end of list
myOSystem.frameBuffer().setPauseDelay(); myOSystem.frameBuffer().setPauseDelay();
setEventState(S_PAUSE); setEventState(EventHandlerState::PAUSE);
myOSystem.state().unwindState(1000); myOSystem.state().unwindState(1000);
break; break;
@ -328,7 +329,7 @@ void EventHandler::handleKeyEvent(StellaKey key, StellaMod mod, bool state)
} }
} }
// These only work when in emulation mode // These only work when in emulation mode
if(!handled && myState == S_EMULATE) if(!handled && myState == EventHandlerState::EMULATION)
{ {
handled = true; handled = true;
switch(key) switch(key)
@ -538,7 +539,7 @@ void EventHandler::handleKeyEvent(StellaKey key, StellaMod mod, bool state)
handleEvent(Event::Quit, 1); handleEvent(Event::Quit, 1);
} }
// These only work when in emulation mode // These only work when in emulation mode
else if(myState == S_EMULATE) else if(myState == EventHandlerState::EMULATION)
{ {
switch(key) switch(key)
{ {
@ -622,11 +623,11 @@ void EventHandler::handleKeyEvent(StellaKey key, StellaMod mod, bool state)
// Otherwise, let the event handler deal with it // Otherwise, let the event handler deal with it
switch(myState) switch(myState)
{ {
case S_EMULATE: case EventHandlerState::EMULATION:
handleEvent(myKeyTable[key][kEmulationMode], state); handleEvent(myKeyTable[key][kEmulationMode], state);
break; break;
case S_PAUSE: case EventHandlerState::PAUSE:
switch(myKeyTable[key][kEmulationMode]) switch(myKeyTable[key][kEmulationMode])
{ {
case Event::TakeSnapshot: case Event::TakeSnapshot:
@ -650,7 +651,7 @@ void EventHandler::handleKeyEvent(StellaKey key, StellaMod mod, bool state)
void EventHandler::handleMouseMotionEvent(int x, int y, int xrel, int yrel, int button) void EventHandler::handleMouseMotionEvent(int x, int y, int xrel, int yrel, int button)
{ {
// Determine which mode we're in, then send the event to the appropriate place // Determine which mode we're in, then send the event to the appropriate place
if(myState == S_EMULATE) if(myState == EventHandlerState::EMULATION)
{ {
if(!mySkipMouseMotion) if(!mySkipMouseMotion)
{ {
@ -667,7 +668,7 @@ void EventHandler::handleMouseMotionEvent(int x, int y, int xrel, int yrel, int
void EventHandler::handleMouseButtonEvent(MouseButton b, int x, int y) void EventHandler::handleMouseButtonEvent(MouseButton b, int x, int y)
{ {
// Determine which mode we're in, then send the event to the appropriate place // Determine which mode we're in, then send the event to the appropriate place
if(myState == S_EMULATE) if(myState == EventHandlerState::EMULATION)
{ {
switch(b) switch(b)
{ {
@ -706,7 +707,7 @@ void EventHandler::handleJoyEvent(int stick, int button, uInt8 state)
return; return;
// Determine which mode we're in, then send the event to the appropriate place // Determine which mode we're in, then send the event to the appropriate place
if(myState == S_EMULATE) if(myState == EventHandlerState::EMULATION)
handleEvent(joy->btnTable[button][kEmulationMode], state); handleEvent(joy->btnTable[button][kEmulationMode], state);
else if(myOverlay) else if(myOverlay)
myOverlay->handleJoyEvent(stick, button, state); myOverlay->handleJoyEvent(stick, button, state);
@ -726,7 +727,7 @@ void EventHandler::handleJoyEvent(int stick, int button, uInt8 state)
// The 'type-4' here refers to the fact that 'StellaJoystick::JT_2600DAPTOR_LEFT' // The 'type-4' here refers to the fact that 'StellaJoystick::JT_2600DAPTOR_LEFT'
// and 'StellaJoystick::JT_2600DAPTOR_RIGHT' are at index 4 and 5 in the JoyType // and 'StellaJoystick::JT_2600DAPTOR_RIGHT' are at index 4 and 5 in the JoyType
// enum; subtracting four gives us Controller 0 and 1 // enum; subtracting four gives us Controller 0 and 1
if(myState == S_EMULATE) if(myState == EventHandlerState::EMULATION)
{ {
switch(myOSystem.console().leftController().type()) switch(myOSystem.console().leftController().type())
{ {
@ -761,7 +762,7 @@ void EventHandler::handleJoyAxisEvent(int stick, int axis, int value)
switch(joy->type) switch(joy->type)
{ {
case StellaJoystick::JT_REGULAR: case StellaJoystick::JT_REGULAR:
if(myState == S_EMULATE) if(myState == EventHandlerState::EMULATION)
{ {
// Every axis event has two associated values, negative and positive // Every axis event has two associated values, negative and positive
Event::Type eventAxisNeg = joy->axisTable[axis][0][kEmulationMode]; Event::Type eventAxisNeg = joy->axisTable[axis][0][kEmulationMode];
@ -867,7 +868,7 @@ void EventHandler::handleJoyHatEvent(int stick, int hat, int value)
// Preprocess all hat events, converting to Stella JoyHat type // Preprocess all hat events, converting to Stella JoyHat type
// Generate multiple equivalent hat events representing combined direction // Generate multiple equivalent hat events representing combined direction
// when we get a diagonal hat event // when we get a diagonal hat event
if(myState == S_EMULATE) if(myState == EventHandlerState::EMULATION)
{ {
handleEvent(joy->hatTable[hat][int(JoyHat::UP)][kEmulationMode], handleEvent(joy->hatTable[hat][int(JoyHat::UP)][kEmulationMode],
value & EVENT_HATUP_M); value & EVENT_HATUP_M);
@ -913,7 +914,7 @@ void EventHandler::handleSystemEvent(SystemEvent e, int, int)
break; break;
#if 0 #if 0
case EVENT_WINDOW_MINIMIZED: case EVENT_WINDOW_MINIMIZED:
if(myState == S_EMULATE) enterMenuMode(S_MENU); if(myState == EventHandlerState::EMULATION) enterMenuMode(EventHandlerState::OPTIONSMENU);
break; break;
#endif #endif
default: // handle other events as testing requires default: // handle other events as testing requires
@ -1001,8 +1002,8 @@ void EventHandler::handleEvent(Event::Type event, int state)
return; return;
case Event::LauncherMode: case Event::LauncherMode:
if((myState == S_EMULATE || myState == S_CMDMENU || if((myState == EventHandlerState::EMULATION || myState == EventHandlerState::CMDMENU ||
myState == S_DEBUGGER) && state) myState == EventHandlerState::DEBUGGER) && state)
{ {
// Go back to the launcher, or immediately quit // Go back to the launcher, or immediately quit
if(myOSystem.settings().getBool("exitlauncher") || if(myOSystem.settings().getBool("exitlauncher") ||
@ -1218,34 +1219,34 @@ bool EventHandler::eventStateChange(Event::Type type)
switch(type) switch(type)
{ {
case Event::PauseMode: case Event::PauseMode:
if(myState == S_EMULATE) if(myState == EventHandlerState::EMULATION)
setEventState(S_PAUSE); setEventState(EventHandlerState::PAUSE);
else if(myState == S_PAUSE) else if(myState == EventHandlerState::PAUSE)
setEventState(S_EMULATE); setEventState(EventHandlerState::EMULATION);
else else
handled = false; handled = false;
break; break;
case Event::MenuMode: case Event::MenuMode:
if(myState == S_EMULATE) if(myState == EventHandlerState::EMULATION)
enterMenuMode(S_MENU); enterMenuMode(EventHandlerState::OPTIONSMENU);
else else
handled = false; handled = false;
break; break;
case Event::CmdMenuMode: case Event::CmdMenuMode:
if(myState == S_EMULATE) if(myState == EventHandlerState::EMULATION)
enterMenuMode(S_CMDMENU); enterMenuMode(EventHandlerState::CMDMENU);
else if(myState == S_CMDMENU) else if(myState == EventHandlerState::CMDMENU)
leaveMenuMode(); leaveMenuMode();
else else
handled = false; handled = false;
break; break;
case Event::DebuggerMode: case Event::DebuggerMode:
if(myState == S_EMULATE || myState == S_PAUSE) if(myState == EventHandlerState::EMULATION || myState == EventHandlerState::PAUSE)
enterDebugMode(); enterDebugMode();
else if(myState == S_DEBUGGER) else if(myState == EventHandlerState::DEBUGGER)
leaveDebugMode(); leaveDebugMode();
else else
handled = false; handled = false;
@ -2068,7 +2069,7 @@ void EventHandler::setContinuousSnapshots(uInt32 interval)
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void EventHandler::enterMenuMode(State state) void EventHandler::enterMenuMode(EventHandlerState state)
{ {
setEventState(state); setEventState(state);
myOverlay->reStack(); myOverlay->reStack();
@ -2078,7 +2079,7 @@ void EventHandler::enterMenuMode(State state)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void EventHandler::leaveMenuMode() void EventHandler::leaveMenuMode()
{ {
setEventState(S_EMULATE); setEventState(EventHandlerState::EMULATION);
myOSystem.sound().mute(false); myOSystem.sound().mute(false);
} }
@ -2086,7 +2087,7 @@ void EventHandler::leaveMenuMode()
bool EventHandler::enterDebugMode() bool EventHandler::enterDebugMode()
{ {
#ifdef DEBUGGER_SUPPORT #ifdef DEBUGGER_SUPPORT
if(myState == S_DEBUGGER || !myOSystem.hasConsole()) if(myState == EventHandlerState::DEBUGGER || !myOSystem.hasConsole())
return false; return false;
// Make sure debugger starts in a consistent state // Make sure debugger starts in a consistent state
@ -2094,13 +2095,13 @@ bool EventHandler::enterDebugMode()
// mode, since it takes care of locking the debugger state, which will // mode, since it takes care of locking the debugger state, which will
// probably be modified below // probably be modified below
myOSystem.debugger().setStartState(); myOSystem.debugger().setStartState();
setEventState(S_DEBUGGER); setEventState(EventHandlerState::DEBUGGER);
FBInitStatus fbstatus = myOSystem.createFrameBuffer(); FBInitStatus fbstatus = myOSystem.createFrameBuffer();
if(fbstatus != FBInitStatus::Success) if(fbstatus != FBInitStatus::Success)
{ {
myOSystem.debugger().setQuitState(); myOSystem.debugger().setQuitState();
setEventState(S_EMULATE); setEventState(EventHandlerState::EMULATION);
if(fbstatus == FBInitStatus::FailTooLarge) if(fbstatus == FBInitStatus::FailTooLarge)
myOSystem.frameBuffer().showMessage("Debugger window too large for screen", myOSystem.frameBuffer().showMessage("Debugger window too large for screen",
MessagePosition::BottomCenter, true); MessagePosition::BottomCenter, true);
@ -2121,20 +2122,20 @@ void EventHandler::leaveDebugMode()
{ {
#ifdef DEBUGGER_SUPPORT #ifdef DEBUGGER_SUPPORT
// paranoia: this should never happen: // paranoia: this should never happen:
if(myState != S_DEBUGGER) if(myState != EventHandlerState::DEBUGGER)
return; return;
// Make sure debugger quits in a consistent state // Make sure debugger quits in a consistent state
myOSystem.debugger().setQuitState(); myOSystem.debugger().setQuitState();
setEventState(S_EMULATE); setEventState(EventHandlerState::EMULATION);
myOSystem.createFrameBuffer(); myOSystem.createFrameBuffer();
myOSystem.sound().mute(false); myOSystem.sound().mute(false);
#endif #endif
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void EventHandler::setEventState(State state) void EventHandler::setEventState(EventHandlerState state)
{ {
myState = state; myState = state;
@ -2146,7 +2147,7 @@ void EventHandler::setEventState(State state)
// keyboard acts as one large joystick with many (single) buttons // keyboard acts as one large joystick with many (single) buttons
switch(myState) switch(myState)
{ {
case S_EMULATE: case EventHandlerState::EMULATION:
myOverlay = nullptr; myOverlay = nullptr;
myOSystem.sound().mute(false); myOSystem.sound().mute(false);
enableTextEvents(false); enableTextEvents(false);
@ -2154,36 +2155,41 @@ void EventHandler::setEventState(State state)
myUseCtrlKeyFlag = false; myUseCtrlKeyFlag = false;
break; break;
case S_PAUSE: case EventHandlerState::PAUSE:
myOverlay = nullptr; myOverlay = nullptr;
myOSystem.sound().mute(true); myOSystem.sound().mute(true);
enableTextEvents(false); enableTextEvents(false);
break; break;
case S_MENU: case EventHandlerState::OPTIONSMENU:
myOverlay = &myOSystem.menu(); myOverlay = &myOSystem.menu();
enableTextEvents(true); enableTextEvents(true);
break; break;
case S_CMDMENU: case EventHandlerState::CMDMENU:
myOverlay = &myOSystem.commandMenu(); myOverlay = &myOSystem.commandMenu();
enableTextEvents(true); enableTextEvents(true);
break; break;
case S_LAUNCHER: case EventHandlerState::TIMEMACHINE:
myOverlay = &myOSystem.timeMachine();
enableTextEvents(true);
break;
case EventHandlerState::LAUNCHER:
myOverlay = &myOSystem.launcher(); myOverlay = &myOSystem.launcher();
enableTextEvents(true); enableTextEvents(true);
myEvent.clear(); myEvent.clear();
break; break;
#ifdef DEBUGGER_SUPPORT #ifdef DEBUGGER_SUPPORT
case S_DEBUGGER: case EventHandlerState::DEBUGGER:
myOverlay = &myOSystem.debugger(); myOverlay = &myOSystem.debugger();
enableTextEvents(true); enableTextEvents(true);
break; break;
#endif #endif
default: case EventHandlerState::NONE:
myOverlay = nullptr; myOverlay = nullptr;
break; break;
} }

View File

@ -56,17 +56,6 @@ class EventHandler
EventHandler(OSystem& osystem); EventHandler(OSystem& osystem);
virtual ~EventHandler(); virtual ~EventHandler();
// Enumeration representing the different states of operation
enum State {
S_NONE,
S_EMULATE,
S_PAUSE,
S_LAUNCHER,
S_MENU,
S_CMDMENU,
S_DEBUGGER
};
/** /**
Returns the event object associated with this handler class. Returns the event object associated with this handler class.
@ -109,16 +98,16 @@ class EventHandler
/** /**
Returns the current state of the EventHandler Returns the current state of the EventHandler
@return The State type @return The EventHandlerState type
*/ */
State state() const { return myState; } EventHandlerState state() const { return myState; }
/** /**
Resets the state machine of the EventHandler to the defaults Resets the state machine of the EventHandler to the defaults
@param state The current state to set @param state The current state to set
*/ */
void reset(State state); void reset(EventHandlerState state);
/** /**
This method indicates that the system should terminate. This method indicates that the system should terminate.
@ -163,7 +152,7 @@ class EventHandler
return (mod & KBDM_SHIFT); return (mod & KBDM_SHIFT);
} }
void enterMenuMode(State state); void enterMenuMode(EventHandlerState state);
void leaveMenuMode(); void leaveMenuMode();
bool enterDebugMode(); bool enterDebugMode();
void leaveDebugMode(); void leaveDebugMode();
@ -519,7 +508,7 @@ class EventHandler
*/ */
bool eventIsAnalog(Event::Type event) const; bool eventIsAnalog(Event::Type event) const;
void setEventState(State state); void setEventState(EventHandlerState state);
private: private:
// Structure used for action menu items // Structure used for action menu items
@ -547,7 +536,7 @@ class EventHandler
Event::Type myComboTable[kComboSize][kEventsPerCombo]; Event::Type myComboTable[kComboSize][kEventsPerCombo];
// Indicates the current state of the system (ie, which mode is current) // Indicates the current state of the system (ie, which mode is current)
State myState; EventHandlerState myState;
// Indicates whether the joystick emulates 'impossible' directions // Indicates whether the joystick emulates 'impossible' directions
bool myAllowAllDirectionsFlag; bool myAllowAllDirectionsFlag;

View File

@ -18,6 +18,18 @@
#ifndef EVENTHANDLER_CONSTANTS_HXX #ifndef EVENTHANDLER_CONSTANTS_HXX
#define EVENTHANDLER_CONSTANTS_HXX #define EVENTHANDLER_CONSTANTS_HXX
// Enumeration representing the different states of operation
enum class EventHandlerState {
NONE,
EMULATION,
TIMEMACHINE,
PAUSE,
LAUNCHER,
OPTIONSMENU,
CMDMENU,
DEBUGGER
};
enum class MouseButton { enum class MouseButton {
LBUTTONDOWN, LBUTTONDOWN,
LBUTTONUP, LBUTTONUP,

View File

@ -17,7 +17,6 @@
#include "bspf.hxx" #include "bspf.hxx"
#include "CommandMenu.hxx"
#include "Console.hxx" #include "Console.hxx"
#include "EventHandler.hxx" #include "EventHandler.hxx"
#include "Event.hxx" #include "Event.hxx"
@ -28,6 +27,8 @@
#include "ConsoleFont.hxx" #include "ConsoleFont.hxx"
#include "Launcher.hxx" #include "Launcher.hxx"
#include "Menu.hxx" #include "Menu.hxx"
#include "CommandMenu.hxx"
#include "TimeMachine.hxx"
#include "OSystem.hxx" #include "OSystem.hxx"
#include "Settings.hxx" #include "Settings.hxx"
#include "TIA.hxx" #include "TIA.hxx"
@ -205,8 +206,8 @@ FBInitStatus FrameBuffer::createDisplay(const string& title,
myScreenSize = mode.screen; myScreenSize = mode.screen;
// Inform TIA surface about new mode // Inform TIA surface about new mode
if(myOSystem.eventHandler().state() != EventHandler::S_LAUNCHER && if(myOSystem.eventHandler().state() != EventHandlerState::LAUNCHER &&
myOSystem.eventHandler().state() != EventHandler::S_DEBUGGER) myOSystem.eventHandler().state() != EventHandlerState::DEBUGGER)
myTIASurface->initialize(myOSystem.console(), mode); myTIASurface->initialize(myOSystem.console(), mode);
// Did we get the requested fullscreen state? // Did we get the requested fullscreen state?
@ -262,14 +263,14 @@ void FrameBuffer::update()
invalidate(); invalidate();
switch(myOSystem.eventHandler().state()) switch(myOSystem.eventHandler().state())
{ {
case EventHandler::S_EMULATE: case EventHandlerState::EMULATION:
{ {
// Run the console for one frame // Run the console for one frame
// Note that the debugger can cause a breakpoint to occur, which changes // Note that the debugger can cause a breakpoint to occur, which changes
// the EventHandler state 'behind our back' - we need to check for that // the EventHandler state 'behind our back' - we need to check for that
myOSystem.console().tia().update(); myOSystem.console().tia().update();
#ifdef DEBUGGER_SUPPORT #ifdef DEBUGGER_SUPPORT
if(myOSystem.eventHandler().state() != EventHandler::S_EMULATE) break; if(myOSystem.eventHandler().state() != EventHandlerState::EMULATION) break;
#endif #endif
if(myOSystem.eventHandler().frying()) if(myOSystem.eventHandler().frying())
myOSystem.console().fry(); myOSystem.console().fry();
@ -295,10 +296,10 @@ void FrameBuffer::update()
myStatsMsg.surface->render(); myStatsMsg.surface->render();
} }
myPausedCount = 0; myPausedCount = 0;
break; // S_EMULATE break; // EventHandlerState::EMULATION
} }
case EventHandler::S_PAUSE: case EventHandlerState::PAUSE:
{ {
myTIASurface->render(); myTIASurface->render();
@ -308,38 +309,45 @@ void FrameBuffer::update()
myPausedCount = uInt32(7 * myOSystem.frameRate()); myPausedCount = uInt32(7 * myOSystem.frameRate());
showMessage("Paused", MessagePosition::MiddleCenter); showMessage("Paused", MessagePosition::MiddleCenter);
} }
break; // S_PAUSE break; // EventHandlerState::PAUSE
} }
case EventHandler::S_MENU: case EventHandlerState::OPTIONSMENU:
{ {
myTIASurface->render(); myTIASurface->render();
myOSystem.menu().draw(true); myOSystem.menu().draw(true);
break; // S_MENU break; // EventHandlerState::OPTIONSMENU
} }
case EventHandler::S_CMDMENU: case EventHandlerState::CMDMENU:
{ {
myTIASurface->render(); myTIASurface->render();
myOSystem.commandMenu().draw(true); myOSystem.commandMenu().draw(true);
break; // S_CMDMENU break; // EventHandlerState::CMDMENU
} }
case EventHandler::S_LAUNCHER: case EventHandlerState::TIMEMACHINE:
{
myTIASurface->render();
myOSystem.timeMachine().draw(true);
break; // EventHandlerState::TIMEMACHINE
}
case EventHandlerState::LAUNCHER:
{ {
myOSystem.launcher().draw(true); myOSystem.launcher().draw(true);
break; // S_LAUNCHER break; // EventHandlerState::LAUNCHER
} }
#ifdef DEBUGGER_SUPPORT #ifdef DEBUGGER_SUPPORT
case EventHandler::S_DEBUGGER: case EventHandlerState::DEBUGGER:
{ {
myOSystem.debugger().draw(true); myOSystem.debugger().draw(true);
break; // S_DEBUGGER break; // EventHandlerState::DEBUGGER
} }
#endif #endif
default: case EventHandlerState::NONE:
return; return;
} }
@ -528,7 +536,7 @@ void FrameBuffer::setPalette(const uInt32* raw_palette)
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void FrameBuffer::stateChanged(EventHandler::State state) void FrameBuffer::stateChanged(EventHandlerState state)
{ {
// Make sure any onscreen messages are removed // Make sure any onscreen messages are removed
myMsg.enabled = false; myMsg.enabled = false;
@ -545,8 +553,8 @@ void FrameBuffer::setFullscreen(bool enable)
myScreenSize = mode.screen; myScreenSize = mode.screen;
// Inform TIA surface about new mode // Inform TIA surface about new mode
if(myOSystem.eventHandler().state() != EventHandler::S_LAUNCHER && if(myOSystem.eventHandler().state() != EventHandlerState::LAUNCHER &&
myOSystem.eventHandler().state() != EventHandler::S_DEBUGGER) myOSystem.eventHandler().state() != EventHandlerState::DEBUGGER)
myTIASurface->initialize(myOSystem.console(), mode); myTIASurface->initialize(myOSystem.console(), mode);
// Did we get the requested fullscreen state? // Did we get the requested fullscreen state?
@ -566,9 +574,9 @@ void FrameBuffer::toggleFullscreen()
bool FrameBuffer::changeWindowedVidMode(int direction) bool FrameBuffer::changeWindowedVidMode(int direction)
{ {
#ifdef WINDOWED_SUPPORT #ifdef WINDOWED_SUPPORT
EventHandler::State state = myOSystem.eventHandler().state(); EventHandlerState state = myOSystem.eventHandler().state();
bool tiaMode = (state != EventHandler::S_DEBUGGER && bool tiaMode = (state != EventHandlerState::DEBUGGER &&
state != EventHandler::S_LAUNCHER); state != EventHandlerState::LAUNCHER);
// Ignore any attempts to change video size while in invalid modes // Ignore any attempts to change video size while in invalid modes
if(!tiaMode || fullScreen()) if(!tiaMode || fullScreen())
@ -605,7 +613,7 @@ void FrameBuffer::setCursorState()
// Always grab mouse in emulation (if enabled) and emulating a controller // Always grab mouse in emulation (if enabled) and emulating a controller
// that always uses the mouse // that always uses the mouse
bool emulation = bool emulation =
myOSystem.eventHandler().state() == EventHandler::S_EMULATE; myOSystem.eventHandler().state() == EventHandlerState::EMULATION;
bool analog = myOSystem.hasConsole() ? bool analog = myOSystem.hasConsole() ?
(myOSystem.eventHandler().controllerIsAnalog(Controller::Left) || (myOSystem.eventHandler().controllerIsAnalog(Controller::Left) ||
myOSystem.eventHandler().controllerIsAnalog(Controller::Right)) : false; myOSystem.eventHandler().controllerIsAnalog(Controller::Right)) : false;
@ -669,9 +677,9 @@ void FrameBuffer::setAvailableVidModes(uInt32 baseWidth, uInt32 baseHeight)
// Check if zooming is allowed for this state (currently only allowed // Check if zooming is allowed for this state (currently only allowed
// for TIA screens) // for TIA screens)
EventHandler::State state = myOSystem.eventHandler().state(); EventHandlerState state = myOSystem.eventHandler().state();
bool tiaMode = (state != EventHandler::S_DEBUGGER && bool tiaMode = (state != EventHandlerState::DEBUGGER &&
state != EventHandler::S_LAUNCHER); state != EventHandlerState::LAUNCHER);
// TIA mode allows zooming at integral factors in windowed modes, // TIA mode allows zooming at integral factors in windowed modes,
// and also non-integral factors in fullscreen mode // and also non-integral factors in fullscreen mode
@ -730,7 +738,7 @@ void FrameBuffer::setAvailableVidModes(uInt32 baseWidth, uInt32 baseHeight)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
const VideoMode& FrameBuffer::getSavedVidMode(bool fullscreen) const VideoMode& FrameBuffer::getSavedVidMode(bool fullscreen)
{ {
EventHandler::State state = myOSystem.eventHandler().state(); EventHandlerState state = myOSystem.eventHandler().state();
if(fullscreen) if(fullscreen)
{ {
@ -748,7 +756,7 @@ const VideoMode& FrameBuffer::getSavedVidMode(bool fullscreen)
// Now select the best resolution depending on the state // Now select the best resolution depending on the state
// UI modes (launcher and debugger) have only one supported resolution // UI modes (launcher and debugger) have only one supported resolution
// so the 'current' one is the only valid one // so the 'current' one is the only valid one
if(state == EventHandler::S_DEBUGGER || state == EventHandler::S_LAUNCHER) if(state == EventHandlerState::DEBUGGER || state == EventHandlerState::LAUNCHER)
myCurrentModeList->setZoom(1); myCurrentModeList->setZoom(1);
else else
myCurrentModeList->setZoom(myZoomMode); myCurrentModeList->setZoom(myZoomMode);

View File

@ -30,11 +30,11 @@ namespace GUI {
class Font; class Font;
} }
#include "EventHandler.hxx"
#include "Rect.hxx" #include "Rect.hxx"
#include "Variant.hxx" #include "Variant.hxx"
#include "TIAConstants.hxx" #include "TIAConstants.hxx"
#include "FrameBufferConstants.hxx" #include "FrameBufferConstants.hxx"
#include "EventHandlerConstants.hxx"
#include "bspf.hxx" #include "bspf.hxx"
// Contains all relevant info for the dimensions of a video screen // Contains all relevant info for the dimensions of a video screen
@ -261,7 +261,7 @@ class FrameBuffer
/** /**
Informs the Framebuffer of a change in EventHandler state. Informs the Framebuffer of a change in EventHandler state.
*/ */
void stateChanged(EventHandler::State state); void stateChanged(EventHandlerState state);
////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////
// The following methods are system-specific and can/must be // The following methods are system-specific and can/must be

View File

@ -47,7 +47,7 @@
#include "Menu.hxx" #include "Menu.hxx"
#include "CommandMenu.hxx" #include "CommandMenu.hxx"
#include "Launcher.hxx" #include "Launcher.hxx"
#include "Rewinder.hxx" #include "TimeMachine.hxx"
#include "PNGLibrary.hxx" #include "PNGLibrary.hxx"
#include "Widget.hxx" #include "Widget.hxx"
#include "Console.hxx" #include "Console.hxx"
@ -140,8 +140,8 @@ bool OSystem::create()
// Create menu and launcher GUI objects // Create menu and launcher GUI objects
myMenu = make_unique<Menu>(*this); myMenu = make_unique<Menu>(*this);
myCommandMenu = make_unique<CommandMenu>(*this); myCommandMenu = make_unique<CommandMenu>(*this);
myTimeMachine = make_unique<TimeMachine>(*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
@ -250,27 +250,28 @@ FBInitStatus OSystem::createFrameBuffer()
FBInitStatus fbstatus = FBInitStatus::FailComplete; FBInitStatus fbstatus = FBInitStatus::FailComplete;
switch(myEventHandler->state()) switch(myEventHandler->state())
{ {
case EventHandler::S_EMULATE: case EventHandlerState::EMULATION:
case EventHandler::S_PAUSE: case EventHandlerState::PAUSE:
case EventHandler::S_MENU: case EventHandlerState::OPTIONSMENU:
case EventHandler::S_CMDMENU: case EventHandlerState::CMDMENU:
case EventHandlerState::TIMEMACHINE:
if((fbstatus = myConsole->initializeVideo()) != FBInitStatus::Success) if((fbstatus = myConsole->initializeVideo()) != FBInitStatus::Success)
return fbstatus; return fbstatus;
break; // S_EMULATE, S_PAUSE, S_MENU, S_CMDMENU break;
case EventHandler::S_LAUNCHER: case EventHandlerState::LAUNCHER:
if((fbstatus = myLauncher->initializeVideo()) != FBInitStatus::Success) if((fbstatus = myLauncher->initializeVideo()) != FBInitStatus::Success)
return fbstatus; return fbstatus;
break; // S_LAUNCHER break;
#ifdef DEBUGGER_SUPPORT #ifdef DEBUGGER_SUPPORT
case EventHandler::S_DEBUGGER: case EventHandlerState::DEBUGGER:
if((fbstatus = myDebugger->initializeVideo()) != FBInitStatus::Success) if((fbstatus = myDebugger->initializeVideo()) != FBInitStatus::Success)
return fbstatus; return fbstatus;
break; // S_DEBUGGER break;
#endif #endif
default: // Should never happen case EventHandlerState::NONE: // Should never happen
logMessage("ERROR: Unknown emulation state in createFrameBuffer()", 0); logMessage("ERROR: Unknown emulation state in createFrameBuffer()", 0);
break; break;
} }
@ -333,12 +334,12 @@ string OSystem::createConsole(const FilesystemNode& rom, const string& md5sum,
#ifdef CHEATCODE_SUPPORT #ifdef CHEATCODE_SUPPORT
myCheatManager->loadCheats(myRomMD5); myCheatManager->loadCheats(myRomMD5);
#endif #endif
myEventHandler->reset(EventHandler::S_EMULATE); myEventHandler->reset(EventHandlerState::EMULATION);
myEventHandler->setMouseControllerMode(mySettings->getString("usemouse")); myEventHandler->setMouseControllerMode(mySettings->getString("usemouse"));
if(createFrameBuffer() != FBInitStatus::Success) // Takes care of initializeVideo() if(createFrameBuffer() != FBInitStatus::Success) // Takes care of initializeVideo()
{ {
logMessage("ERROR: Couldn't create framebuffer for console", 0); logMessage("ERROR: Couldn't create framebuffer for console", 0);
myEventHandler->reset(EventHandler::S_LAUNCHER); myEventHandler->reset(EventHandlerState::LAUNCHER);
return "ERROR: Couldn't create framebuffer for console"; return "ERROR: Couldn't create framebuffer for console";
} }
myConsole->initializeAudio(); myConsole->initializeAudio();
@ -379,7 +380,7 @@ bool OSystem::reloadConsole()
bool OSystem::hasConsole() const bool OSystem::hasConsole() const
{ {
return myConsole != nullptr && return myConsole != nullptr &&
myEventHandler->state() != EventHandler::S_LAUNCHER; myEventHandler->state() != EventHandlerState::LAUNCHER;
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -393,7 +394,7 @@ bool OSystem::createLauncher(const string& startdir)
mySettings->setValue("tmpromdir", startdir); mySettings->setValue("tmpromdir", startdir);
bool status = false; bool status = false;
myEventHandler->reset(EventHandler::S_LAUNCHER); myEventHandler->reset(EventHandlerState::LAUNCHER);
if(createFrameBuffer() == FBInitStatus::Success) if(createFrameBuffer() == FBInitStatus::Success)
{ {
myLauncher->reStack(); myLauncher->reStack();

View File

@ -26,8 +26,9 @@ class Console;
class Debugger; class Debugger;
class Launcher; class Launcher;
class Menu; class Menu;
class Rewinder; class TimeMachine;
class FrameBuffer; class FrameBuffer;
class EventHandler;
class PNGLibrary; class PNGLibrary;
class Properties; class Properties;
class PropertiesSet; class PropertiesSet;
@ -38,9 +39,9 @@ class Sound;
class StateManager; class StateManager;
class VideoDialog; class VideoDialog;
#include "EventHandler.hxx"
#include "FSNode.hxx" #include "FSNode.hxx"
#include "FrameBufferConstants.hxx" #include "FrameBufferConstants.hxx"
#include "EventHandlerConstants.hxx"
#include "bspf.hxx" #include "bspf.hxx"
struct TimingInfo { struct TimingInfo {
@ -154,11 +155,11 @@ class OSystem
Launcher& launcher() const { return *myLauncher; } Launcher& launcher() const { return *myLauncher; }
/** /**
Get the state rewinder of the system. Get the time machine of the system (manages state files).
@return The rewinder object @return The time machine object
*/ */
Rewinder& rewinder() const { return *myRewinder; } TimeMachine& timeMachine() const { return *myTimeMachine; }
/** /**
Get the state manager of the system. Get the state manager of the system.
@ -410,7 +411,7 @@ class OSystem
/** /**
Informs the OSystem of a change in EventHandler state. Informs the OSystem of a change in EventHandler state.
*/ */
virtual void stateChanged(EventHandler::State state) { } virtual void stateChanged(EventHandlerState state) { }
/** /**
Returns the default save and load paths for various files Returns the default save and load paths for various files
@ -469,8 +470,8 @@ class OSystem
unique_ptr<Launcher> myLauncher; unique_ptr<Launcher> myLauncher;
bool myLauncherUsed; bool myLauncherUsed;
// Pointer to the Rewinder object // Pointer to the TimeMachine object
unique_ptr<Rewinder> myRewinder; unique_ptr<TimeMachine> myTimeMachine;
#ifdef DEBUGGER_SUPPORT #ifdef DEBUGGER_SUPPORT
// Pointer to the Debugger object // Pointer to the Debugger object

View File

@ -16,6 +16,7 @@
//============================================================================ //============================================================================
#include "OSystem.hxx" #include "OSystem.hxx"
#include "EventHandler.hxx"
#include "FrameBuffer.hxx" #include "FrameBuffer.hxx"
#include "FBSurface.hxx" #include "FBSurface.hxx"
#include "Font.hxx" #include "Font.hxx"

View File

@ -19,6 +19,7 @@
//============================================================================ //============================================================================
#include "OSystem.hxx" #include "OSystem.hxx"
#include "EventHandler.hxx"
#include "FrameBuffer.hxx" #include "FrameBuffer.hxx"
#include "FBSurface.hxx" #include "FBSurface.hxx"
#include "Font.hxx" #include "Font.hxx"

View File

@ -16,6 +16,7 @@
//============================================================================ //============================================================================
#include "Dialog.hxx" #include "Dialog.hxx"
#include "EventHandler.hxx"
#include "FBSurface.hxx" #include "FBSurface.hxx"
#include "Font.hxx" #include "Font.hxx"
#include "EditableWidget.hxx" #include "EditableWidget.hxx"

View File

@ -18,6 +18,7 @@
#include "bspf.hxx" #include "bspf.hxx"
#include "OSystem.hxx" #include "OSystem.hxx"
#include "Console.hxx" #include "Console.hxx"
#include "EventHandler.hxx"
#include "Joystick.hxx" #include "Joystick.hxx"
#include "Paddles.hxx" #include "Paddles.hxx"
#include "PointingDevice.hxx" #include "PointingDevice.hxx"

View File

@ -16,6 +16,7 @@
//============================================================================ //============================================================================
#include "OSystem.hxx" #include "OSystem.hxx"
#include "EventHandler.hxx"
#include "Widget.hxx" #include "Widget.hxx"
#include "Font.hxx" #include "Font.hxx"
#include "EditTextWidget.hxx" #include "EditTextWidget.hxx"

View File

@ -30,6 +30,7 @@
#include "MessageBox.hxx" #include "MessageBox.hxx"
#include "OSystem.hxx" #include "OSystem.hxx"
#include "FrameBuffer.hxx" #include "FrameBuffer.hxx"
#include "EventHandler.hxx"
#include "Props.hxx" #include "Props.hxx"
#include "PropsSet.hxx" #include "PropsSet.hxx"
#include "RomInfoWidget.hxx" #include "RomInfoWidget.hxx"

View File

@ -23,6 +23,7 @@
#include "ScrollBarWidget.hxx" #include "ScrollBarWidget.hxx"
#include "Dialog.hxx" #include "Dialog.hxx"
#include "FrameBuffer.hxx" #include "FrameBuffer.hxx"
#include "EventHandler.hxx"
#include "ListWidget.hxx" #include "ListWidget.hxx"
#include "bspf.hxx" #include "bspf.hxx"

View File

@ -17,6 +17,7 @@
#include "OSystem.hxx" #include "OSystem.hxx"
#include "FrameBuffer.hxx" #include "FrameBuffer.hxx"
#include "EventHandler.hxx"
#include "Dialog.hxx" #include "Dialog.hxx"
#include "DialogContainer.hxx" #include "DialogContainer.hxx"
#include "Widget.hxx" #include "Widget.hxx"
@ -164,10 +165,10 @@ void OptionsDialog::loadConfig()
// in launcher mode // in launcher mode
switch(instance().eventHandler().state()) switch(instance().eventHandler().state())
{ {
case EventHandler::S_EMULATE: case EventHandlerState::EMULATION:
myGameInfoButton->setFlags(WIDGET_ENABLED); myGameInfoButton->setFlags(WIDGET_ENABLED);
break; break;
case EventHandler::S_LAUNCHER: case EventHandlerState::LAUNCHER:
if(instance().launcher().selectedRomMD5() != "") if(instance().launcher().selectedRomMD5() != "")
myGameInfoButton->setFlags(WIDGET_ENABLED); myGameInfoButton->setFlags(WIDGET_ENABLED);
else else

View File

@ -22,6 +22,7 @@ class GUIObject;
class ContextMenu; class ContextMenu;
#include "bspf.hxx" #include "bspf.hxx"
#include "Variant.hxx"
#include "Command.hxx" #include "Command.hxx"
#include "Widget.hxx" #include "Widget.hxx"

View File

@ -15,6 +15,7 @@
// this file, and for a DISCLAIMER OF ALL WARRANTIES. // this file, and for a DISCLAIMER OF ALL WARRANTIES.
//============================================================================ //============================================================================
#include "EventHandler.hxx"
#include "FrameBuffer.hxx" #include "FrameBuffer.hxx"
#include "Dialog.hxx" #include "Dialog.hxx"
#include "FBSurface.hxx" #include "FBSurface.hxx"
@ -26,7 +27,6 @@
#include "Rect.hxx" #include "Rect.hxx"
#include "Widget.hxx" #include "Widget.hxx"
#include "TIAConstants.hxx" #include "TIAConstants.hxx"
#include "RomInfoWidget.hxx" #include "RomInfoWidget.hxx"
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -59,7 +59,7 @@ void RomInfoWidget::setProperties(const Properties& props)
myProperties = props; myProperties = props;
// Decide whether the information should be shown immediately // Decide whether the information should be shown immediately
if(instance().eventHandler().state() == EventHandler::S_LAUNCHER) if(instance().eventHandler().state() == EventHandlerState::LAUNCHER)
parseProperties(); parseProperties();
} }
@ -71,7 +71,7 @@ void RomInfoWidget::clearProperties()
mySurface->setVisible(mySurfaceIsValid); mySurface->setVisible(mySurfaceIsValid);
// Decide whether the information should be shown immediately // Decide whether the information should be shown immediately
if(instance().eventHandler().state() == EventHandler::S_LAUNCHER) if(instance().eventHandler().state() == EventHandlerState::LAUNCHER)
setDirty(); setDirty();
} }

View File

@ -17,13 +17,13 @@
#include "Dialog.hxx" #include "Dialog.hxx"
#include "FrameBuffer.hxx" #include "FrameBuffer.hxx"
#include "RewindDialog.hxx" #include "TimeMachineDialog.hxx"
#include "Rewinder.hxx" #include "TimeMachine.hxx"
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Rewinder::Rewinder(OSystem& osystem) TimeMachine::TimeMachine(OSystem& osystem)
: DialogContainer(osystem) : DialogContainer(osystem)
{ {
myBaseDialog = new RewindDialog(myOSystem, *this, myBaseDialog = new TimeMachineDialog(myOSystem, *this,
FrameBuffer::kFBMinW, FrameBuffer::kFBMinH); FrameBuffer::kFBMinW, FrameBuffer::kFBMinH);
} }

View File

@ -15,31 +15,31 @@
// this file, and for a DISCLAIMER OF ALL WARRANTIES. // this file, and for a DISCLAIMER OF ALL WARRANTIES.
//============================================================================ //============================================================================
#ifndef REWINDER_HXX #ifndef TIME_MACHINE_HXX
#define REWINDER_HXX #define TIME_MACHINE_HXX
class OSystem; class OSystem;
#include "DialogContainer.hxx" #include "DialogContainer.hxx"
/** /**
The base dialog for all rewind-related UI items in Stella. The base dialog for all time machine related UI items in Stella.
@author Stephen Anthony @author Stephen Anthony
*/ */
class Rewinder : public DialogContainer class TimeMachine : public DialogContainer
{ {
public: public:
Rewinder(OSystem& osystem); TimeMachine(OSystem& osystem);
virtual ~Rewinder() = default; virtual ~TimeMachine() = default;
private: private:
// Following constructors and assignment operators not supported // Following constructors and assignment operators not supported
Rewinder() = delete; TimeMachine() = delete;
Rewinder(const Rewinder&) = delete; TimeMachine(const TimeMachine&) = delete;
Rewinder(Rewinder&&) = delete; TimeMachine(TimeMachine&&) = delete;
Rewinder& operator=(const Rewinder&) = delete; TimeMachine& operator=(const TimeMachine&) = delete;
Rewinder& operator=(Rewinder&&) = delete; TimeMachine& operator=(TimeMachine&&) = delete;
}; };
#endif #endif

View File

@ -21,10 +21,10 @@
#include "FrameBuffer.hxx" #include "FrameBuffer.hxx"
#include "OSystem.hxx" #include "OSystem.hxx"
#include "Widget.hxx" #include "Widget.hxx"
#include "RewindDialog.hxx" #include "TimeMachineDialog.hxx"
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
RewindDialog::RewindDialog(OSystem& osystem, DialogContainer& parent, TimeMachineDialog::TimeMachineDialog(OSystem& osystem, DialogContainer& parent,
int max_w, int max_h) int max_w, int max_h)
: Dialog(osystem, parent) : Dialog(osystem, parent)
{ {

View File

@ -15,8 +15,8 @@
// this file, and for a DISCLAIMER OF ALL WARRANTIES. // this file, and for a DISCLAIMER OF ALL WARRANTIES.
//============================================================================ //============================================================================
#ifndef REWIND_DIALOG_HXX #ifndef TIME_MACHINE_DIALOG_HXX
#define REWIND_DIALOG_HXX #define TIME_MACHINE_DIALOG_HXX
class CommandSender; class CommandSender;
class DialogContainer; class DialogContainer;
@ -24,19 +24,19 @@ class OSystem;
#include "Dialog.hxx" #include "Dialog.hxx"
class RewindDialog : public Dialog class TimeMachineDialog : public Dialog
{ {
public: public:
RewindDialog(OSystem& osystem, DialogContainer& parent, int max_w, int max_h); TimeMachineDialog(OSystem& osystem, DialogContainer& parent, int max_w, int max_h);
virtual ~RewindDialog() = default; virtual ~TimeMachineDialog() = default;
private: private:
// Following constructors and assignment operators not supported // Following constructors and assignment operators not supported
RewindDialog() = delete; TimeMachineDialog() = delete;
RewindDialog(const RewindDialog&) = delete; TimeMachineDialog(const TimeMachineDialog&) = delete;
RewindDialog(RewindDialog&&) = delete; TimeMachineDialog(TimeMachineDialog&&) = delete;
RewindDialog& operator=(const RewindDialog&) = delete; TimeMachineDialog& operator=(const TimeMachineDialog&) = delete;
RewindDialog& operator=(RewindDialog&&) = delete; TimeMachineDialog& operator=(TimeMachineDialog&&) = delete;
}; };
#endif #endif

View File

@ -4,20 +4,20 @@ MODULE_OBJS := \
src/gui/AboutDialog.o \ src/gui/AboutDialog.o \
src/gui/AudioDialog.o \ src/gui/AudioDialog.o \
src/gui/BrowserDialog.o \ src/gui/BrowserDialog.o \
src/gui/CheckListWidget.o \
src/gui/ColorWidget.o \ src/gui/ColorWidget.o \
src/gui/ComboDialog.o \ src/gui/ComboDialog.o \
src/gui/CommandDialog.o \ src/gui/CommandDialog.o \
src/gui/CommandMenu.o \ src/gui/CommandMenu.o \
src/gui/ConfigPathDialog.o \
src/gui/ContextMenu.o \ src/gui/ContextMenu.o \
src/gui/DialogContainer.o \
src/gui/DeveloperDialog.o \ src/gui/DeveloperDialog.o \
src/gui/DialogContainer.o \
src/gui/Dialog.o \ src/gui/Dialog.o \
src/gui/EditableWidget.o \ src/gui/EditableWidget.o \
src/gui/EditTextWidget.o \ src/gui/EditTextWidget.o \
src/gui/EventMappingWidget.o \ src/gui/EventMappingWidget.o \
src/gui/FileListWidget.o \ src/gui/FileListWidget.o \
src/gui/ConfigPathDialog.o \
src/gui/SnapshotDialog.o \
src/gui/Font.o \ src/gui/Font.o \
src/gui/GameInfoDialog.o \ src/gui/GameInfoDialog.o \
src/gui/GameList.o \ src/gui/GameList.o \
@ -26,25 +26,25 @@ MODULE_OBJS := \
src/gui/InputDialog.o \ src/gui/InputDialog.o \
src/gui/InputTextDialog.o \ src/gui/InputTextDialog.o \
src/gui/JoystickDialog.o \ src/gui/JoystickDialog.o \
src/gui/Launcher.o \
src/gui/LauncherDialog.o \ src/gui/LauncherDialog.o \
src/gui/LauncherFilterDialog.o \ src/gui/LauncherFilterDialog.o \
src/gui/LoggerDialog.o \ src/gui/Launcher.o \
src/gui/ListWidget.o \ src/gui/ListWidget.o \
src/gui/LoggerDialog.o \
src/gui/Menu.o \ src/gui/Menu.o \
src/gui/MessageBox.o \ src/gui/MessageBox.o \
src/gui/OptionsDialog.o \ src/gui/OptionsDialog.o \
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 \
src/gui/CheckListWidget.o \ src/gui/SnapshotDialog.o \
src/gui/StringListWidget.o \ src/gui/StringListWidget.o \
src/gui/TabWidget.o \ src/gui/TabWidget.o \
src/gui/TimeMachineDialog.o \
src/gui/TimeMachine.o \
src/gui/UIDialog.o \ src/gui/UIDialog.o \
src/gui/VideoDialog.o \ src/gui/VideoDialog.o \
src/gui/Widget.o src/gui/Widget.o