minimal rewind button state refactoring

This commit is contained in:
thrust26 2017-10-13 16:01:30 +02:00
parent cdb2e18324
commit 474c9941d5
3 changed files with 19 additions and 12 deletions

View File

@ -29,7 +29,6 @@
#include "Settings.hxx" #include "Settings.hxx"
#include "DebuggerDialog.hxx" #include "DebuggerDialog.hxx"
#include "DebuggerParser.hxx" #include "DebuggerParser.hxx"
#include "StateManager.hxx"
#include "Console.hxx" #include "Console.hxx"
#include "System.hxx" #include "System.hxx"
@ -451,6 +450,14 @@ void Debugger::nextFrame(int frames)
lockBankswitchState(); lockBankswitchState();
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void Debugger::updateRewindbuttons(const RewindManager& r)
{
myDialog->rewindButton().setEnabled(!r.atLast());
myDialog->unwindButton().setEnabled(!r.atFirst());
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool Debugger::windState(bool unwind) bool Debugger::windState(bool unwind)
{ {
RewindManager& r = myOSystem.state().rewindManager(); RewindManager& r = myOSystem.state().rewindManager();
@ -461,9 +468,7 @@ bool Debugger::windState(bool unwind)
bool result = unwind ? r.unwindState() : r.rewindState(); bool result = unwind ? r.unwindState() : r.rewindState();
lockBankswitchState(); lockBankswitchState();
myDialog->rewindButton().setEnabled(!r.atLast()); updateRewindbuttons(r);
myDialog->unwindButton().setEnabled(!r.atFirst());
return result; return result;
} }
@ -517,8 +522,7 @@ void Debugger::saveOldState(string rewindMsg)
{ {
RewindManager& r = myOSystem.state().rewindManager(); RewindManager& r = myOSystem.state().rewindManager();
r.addState(rewindMsg); r.addState(rewindMsg);
myDialog->rewindButton().setEnabled(!r.atLast()); updateRewindbuttons(r);
myDialog->unwindButton().setEnabled(!r.atFirst());
} }
} }
@ -529,8 +533,7 @@ void Debugger::setStartState()
lockBankswitchState(); lockBankswitchState();
RewindManager& r = myOSystem.state().rewindManager(); RewindManager& r = myOSystem.state().rewindManager();
myDialog->rewindButton().setEnabled(!r.atLast()); updateRewindbuttons(r);
myDialog->unwindButton().setEnabled(!r.atFirst());
// Save initial state, but don't add it to the rewind list // Save initial state, but don't add it to the rewind list
saveOldState(); saveOldState();

View File

@ -36,6 +36,7 @@ class ButtonWidget;
#include "DialogContainer.hxx" #include "DialogContainer.hxx"
#include "DebuggerDialog.hxx" #include "DebuggerDialog.hxx"
#include "DebuggerParser.hxx" #include "DebuggerParser.hxx"
#include "StateManager.hxx"
#include "M6502.hxx" #include "M6502.hxx"
#include "System.hxx" #include "System.hxx"
#include "Stack.hxx" #include "Stack.hxx"
@ -327,7 +328,10 @@ class Debugger : public DialogContainer
static PseudoRegister ourPseudoRegisters[NUM_PSEUDO_REGS]; static PseudoRegister ourPseudoRegisters[NUM_PSEUDO_REGS];
private: private:
// rewind/unwind one state
bool windState(bool unwind); bool windState(bool unwind);
// update the rewind/unwind button state
void updateRewindbuttons(const RewindManager& r);
// Following constructors and assignment operators not supported // Following constructors and assignment operators not supported
Debugger() = delete; Debugger() = delete;

View File

@ -1174,30 +1174,30 @@ static const uInt16 console_font_bits[] = {
+--------+ +--------+
| | | |
| | | |
| * |
| * | | * |
| * | | * |
| * | | * |
| * | | * |
| * |
| * |
| * | | * |
| * | | * |
| * | | * |
| * |
| | | |
| | | |
+--------+ +--------+
*/ */
0x0000, 0x0000,
0x0000, 0x0000,
0x4000,
0x2000, 0x2000,
0x1000, 0x1000,
0x0800, 0x0800,
0x0400, 0x0400,
0x0200,
0x0400,
0x0800, 0x0800,
0x1000, 0x1000,
0x2000, 0x2000,
0x4000,
0x0000, 0x0000,
0x0000, 0x0000,