From 93494fc7d3e3c378fc3b41eb83b1a054cdac20b6 Mon Sep 17 00:00:00 2001 From: thrust26 Date: Wed, 22 Jul 2020 10:29:23 +0200 Subject: [PATCH] support F12 (snapshot) in TM UI too (implements #679) --- src/gui/TimeMachineDialog.cxx | 9 +++++++++ src/gui/TimeMachineDialog.hxx | 5 +++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/src/gui/TimeMachineDialog.cxx b/src/gui/TimeMachineDialog.cxx index e84c50223..b8fc3a088 100644 --- a/src/gui/TimeMachineDialog.cxx +++ b/src/gui/TimeMachineDialog.cxx @@ -25,6 +25,7 @@ #include "StateManager.hxx" #include "RewindManager.hxx" #include "TimeLineWidget.hxx" +#include "TIASurface.hxx" #include "Console.hxx" #include "TIA.hxx" @@ -297,6 +298,8 @@ void TimeMachineDialog::handleKeyDown(StellaKey key, StellaMod mod, bool repeate // The following 'Alt' shortcuts duplicate the shortcuts in EventHandler // It is best to keep them the same, so changes in EventHandler mean we // need to update the logic here too + // Note: The hotkeys can be remapped in emulation mode, but this will not + // affect the fixed hotkeys here. if(StellaModTest::isAlt(mod)) { switch(key) @@ -323,6 +326,8 @@ void TimeMachineDialog::handleKeyDown(StellaKey key, StellaMod mod, bool repeate } else if(key == KBDK_SPACE || key == KBDK_ESCAPE) handleCommand(nullptr, kPlay, 0, 0); + else if (key == KBDK_F12) + handleCommand(nullptr, kSnapShot, 0, 0); else Dialog::handleKeyDown(key, mod); } @@ -383,6 +388,10 @@ void TimeMachineDialog::handleCommand(CommandSender* sender, int cmd, initBar(); break; + case kSnapShot: + instance().frameBuffer().tiaSurface().saveSnapShot(); + break; + default: Dialog::handleCommand(sender, cmd, data, 0); } diff --git a/src/gui/TimeMachineDialog.hxx b/src/gui/TimeMachineDialog.hxx index 4d94f006f..45c9dfa06 100644 --- a/src/gui/TimeMachineDialog.hxx +++ b/src/gui/TimeMachineDialog.hxx @@ -65,8 +65,9 @@ class TimeMachineDialog : public Dialog kUnwindAll = 'TMua', kUnwind10 = 'TMu1', kUnwind1 = 'TMun', - kSaveAll = 'TMsv', - kLoadAll = 'TMld', + kSaveAll = 'TMsv', + kLoadAll = 'TMld', + kSnapShot = 'TMsn', }; TimeLineWidget* myTimeline{nullptr};