mirror of https://github.com/stella-emu/stella.git
Time Machine dialog can now be toggled by pressing 'T'.
- Note that the dialog is currently empty - See src/gui/CommandDialog for example of how to fill this dialog box
This commit is contained in:
parent
cbb494d7ad
commit
ad69e8900d
|
@ -71,7 +71,7 @@ class Event
|
|||
MouseButtonLeftValue, MouseButtonRightValue,
|
||||
|
||||
ChangeState, LoadState, SaveState, TakeSnapshot, Quit,
|
||||
PauseMode, MenuMode, CmdMenuMode, DebuggerMode, LauncherMode,
|
||||
PauseMode, OptionsMenuMode, CmdMenuMode, TimeMachineMode, DebuggerMode, LauncherMode,
|
||||
Fry, VolumeDecrease, VolumeIncrease,
|
||||
|
||||
UIUp, UIDown, UILeft, UIRight, UIHome, UIEnd, UIPgUp, UIPgDown,
|
||||
|
|
|
@ -1227,7 +1227,7 @@ bool EventHandler::eventStateChange(Event::Type type)
|
|||
handled = false;
|
||||
break;
|
||||
|
||||
case Event::MenuMode:
|
||||
case Event::OptionsMenuMode:
|
||||
if(myState == EventHandlerState::EMULATION)
|
||||
enterMenuMode(EventHandlerState::OPTIONSMENU);
|
||||
else
|
||||
|
@ -1243,6 +1243,15 @@ bool EventHandler::eventStateChange(Event::Type type)
|
|||
handled = false;
|
||||
break;
|
||||
|
||||
case Event::TimeMachineMode:
|
||||
if(myState == EventHandlerState::EMULATION)
|
||||
enterMenuMode(EventHandlerState::TIMEMACHINE);
|
||||
else if(myState == EventHandlerState::TIMEMACHINE)
|
||||
leaveMenuMode();
|
||||
else
|
||||
handled = false;
|
||||
break;
|
||||
|
||||
case Event::DebuggerMode:
|
||||
if(myState == EventHandlerState::EMULATION || myState == EventHandlerState::PAUSE)
|
||||
enterDebugMode();
|
||||
|
@ -1688,8 +1697,9 @@ void EventHandler::setDefaultKeymap(Event::Type event, EventMode mode)
|
|||
setDefaultKey( KBDK_F12, Event::TakeSnapshot );
|
||||
setDefaultKey( KBDK_BACKSPACE, Event::Fry );
|
||||
setDefaultKey( KBDK_PAUSE, Event::PauseMode );
|
||||
setDefaultKey( KBDK_TAB, Event::MenuMode );
|
||||
setDefaultKey( KBDK_TAB, Event::OptionsMenuMode );
|
||||
setDefaultKey( KBDK_BACKSLASH, Event::CmdMenuMode );
|
||||
setDefaultKey( KBDK_T, Event::TimeMachineMode );
|
||||
setDefaultKey( KBDK_GRAVE, Event::DebuggerMode );
|
||||
setDefaultKey( KBDK_ESCAPE, Event::LauncherMode );
|
||||
break;
|
||||
|
@ -2228,8 +2238,9 @@ EventHandler::ActionList EventHandler::ourEmulActionList[kEmulActionListSize] =
|
|||
{ Event::VolumeDecrease, "Decrease volume", "", false },
|
||||
{ Event::VolumeIncrease, "Increase volume", "", false },
|
||||
{ Event::PauseMode, "Pause", "", false },
|
||||
{ Event::MenuMode, "Enter options menu mode", "", false },
|
||||
{ Event::CmdMenuMode, "Toggle command menu mode", "", false },
|
||||
{ Event::OptionsMenuMode, "Enter options menu UI", "", false },
|
||||
{ Event::CmdMenuMode, "Toggle command menu UI", "", false },
|
||||
{ Event::TimeMachineMode, "Toggle time machine UI", "", false },
|
||||
{ Event::DebuggerMode, "Toggle debugger mode", "", false },
|
||||
{ Event::LauncherMode, "Enter ROM launcher", "", false },
|
||||
{ Event::Quit, "Quit", "", false },
|
||||
|
|
|
@ -457,7 +457,7 @@ class EventHandler
|
|||
enum {
|
||||
kComboSize = 16,
|
||||
kEventsPerCombo = 8,
|
||||
kEmulActionListSize = 79 + kComboSize,
|
||||
kEmulActionListSize = 80 + kComboSize,
|
||||
kMenuActionListSize = 14
|
||||
};
|
||||
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
#include "Font.hxx"
|
||||
#include "EventHandler.hxx"
|
||||
#include "FrameBuffer.hxx"
|
||||
#include "FBSurface.hxx"
|
||||
#include "OSystem.hxx"
|
||||
#include "Widget.hxx"
|
||||
#include "TimeMachineDialog.hxx"
|
||||
|
@ -29,11 +30,39 @@ TimeMachineDialog::TimeMachineDialog(OSystem& osystem, DialogContainer& parent,
|
|||
: Dialog(osystem, parent)
|
||||
{
|
||||
const GUI::Font& font = instance().frameBuffer().font();
|
||||
const int buttonWidth = font.getStringWidth("Right Diff B") + 20,
|
||||
buttonHeight = font.getLineHeight() + 6,
|
||||
const int buttonWidth = font.getStringWidth(" ") + 20,
|
||||
// buttonHeight = font.getLineHeight() + 6,
|
||||
rowHeight = font.getLineHeight() + 10;
|
||||
|
||||
WidgetArray wid;
|
||||
|
||||
// Set real dimensions
|
||||
_w = 3 * (buttonWidth + 5) + 20;
|
||||
_h = 6 * rowHeight + 15;
|
||||
_w = 10 * (buttonWidth + 5) + 20;
|
||||
_h = 2 * rowHeight + 15;
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void TimeMachineDialog::center()
|
||||
{
|
||||
// Place on the bottom of the screen, centered horizontally
|
||||
const GUI::Size& screen = instance().frameBuffer().screenSize();
|
||||
const GUI::Rect& dst = surface().dstRect();
|
||||
surface().setDstPos((screen.w - dst.width()) >> 1, screen.h - dst.height() - 10);
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void TimeMachineDialog::loadConfig()
|
||||
{
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void TimeMachineDialog::handleCommand(CommandSender* sender, int cmd,
|
||||
int data, int id)
|
||||
{
|
||||
cerr << cmd << endl;
|
||||
switch(cmd)
|
||||
{
|
||||
default:
|
||||
Dialog::handleCommand(sender, cmd, data, 0);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -30,6 +30,13 @@ class TimeMachineDialog : public Dialog
|
|||
TimeMachineDialog(OSystem& osystem, DialogContainer& parent, int max_w, int max_h);
|
||||
virtual ~TimeMachineDialog() = default;
|
||||
|
||||
private:
|
||||
void loadConfig() override;
|
||||
void handleCommand(CommandSender* sender, int cmd, int data, int id) override;
|
||||
|
||||
/** This dialog uses its own positioning, so we override Dialog::center() */
|
||||
void center() override;
|
||||
|
||||
private:
|
||||
// Following constructors and assignment operators not supported
|
||||
TimeMachineDialog() = delete;
|
||||
|
|
Loading…
Reference in New Issue