diff options
author | David Robillard <d@drobilla.net> | 2016-09-18 11:43:08 -0400 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2016-09-18 11:43:30 -0400 |
commit | 39109efb8dc196164911922d199a68747a4788db (patch) | |
tree | 65d48aa361c7b3910f88268ed8a510ac6426daee | |
parent | a43528ab069f325e68dab6e18cf2cab19cc22e56 (diff) | |
download | ingen-39109efb8dc196164911922d199a68747a4788db.tar.gz ingen-39109efb8dc196164911922d199a68747a4788db.tar.bz2 ingen-39109efb8dc196164911922d199a68747a4788db.zip |
Fix undo after redo
-rw-r--r-- | src/server/EventWriter.hpp | 3 | ||||
-rw-r--r-- | src/server/events/Undo.cpp | 7 |
2 files changed, 6 insertions, 4 deletions
diff --git a/src/server/EventWriter.hpp b/src/server/EventWriter.hpp index 7b9b920b..5e05af0c 100644 --- a/src/server/EventWriter.hpp +++ b/src/server/EventWriter.hpp @@ -96,7 +96,8 @@ public: virtual void error(const std::string& msg) {} ///< N/A - void set_event_mode(Event::Mode mode) { _event_mode = mode; } + void set_event_mode(Event::Mode mode) { _event_mode = mode; } + Event::Mode get_event_mode() { return _event_mode; } protected: Engine& _engine; diff --git a/src/server/events/Undo.cpp b/src/server/events/Undo.cpp index 15c18ca2..0510d50f 100644 --- a/src/server/events/Undo.cpp +++ b/src/server/events/Undo.cpp @@ -36,13 +36,14 @@ Undo::Undo(Engine& engine, bool Undo::pre_process() { - UndoStack* stack = _is_redo ? _engine.redo_stack() : _engine.undo_stack(); - Event::Mode mode = _is_redo ? Event::Mode::REDO : Event::Mode::UNDO; + UndoStack* const stack = _is_redo ? _engine.redo_stack() : _engine.undo_stack(); + const Event::Mode mode = _is_redo ? Event::Mode::REDO : Event::Mode::UNDO; if (stack->empty()) { return Event::pre_process_done(Status::NOT_FOUND); } + const Event::Mode orig_mode = _engine.event_writer()->get_event_mode(); _entry = stack->pop(); _engine.event_writer()->set_event_mode(mode); if (_entry.events.size() > 1) { @@ -56,7 +57,7 @@ Undo::pre_process() if (_entry.events.size() > 1) { _engine.interface()->bundle_end(); } - _engine.event_writer()->set_event_mode(mode); + _engine.event_writer()->set_event_mode(orig_mode); return Event::pre_process_done(Status::SUCCESS); } |