summaryrefslogtreecommitdiffstats
path: root/src/server/events/Mark.cpp
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2016-07-30 13:10:13 -0400
committerDavid Robillard <d@drobilla.net>2016-07-30 15:32:49 -0400
commitc8ae7295e911c62cf9dedf90187656937cc18cbb (patch)
tree0ba1207bf2c63278e9932eed2d04f961144a02db /src/server/events/Mark.cpp
parente74c6a3b388ded66fcc4cfb1fa5bece881b63113 (diff)
downloadingen-c8ae7295e911c62cf9dedf90187656937cc18cbb.tar.gz
ingen-c8ae7295e911c62cf9dedf90187656937cc18cbb.tar.bz2
ingen-c8ae7295e911c62cf9dedf90187656937cc18cbb.zip
Add undo support
Diffstat (limited to 'src/server/events/Mark.cpp')
-rw-r--r--src/server/events/Mark.cpp65
1 files changed, 65 insertions, 0 deletions
diff --git a/src/server/events/Mark.cpp b/src/server/events/Mark.cpp
new file mode 100644
index 00000000..0e14f008
--- /dev/null
+++ b/src/server/events/Mark.cpp
@@ -0,0 +1,65 @@
+/*
+ This file is part of Ingen.
+ Copyright 2016 David Robillard <http://drobilla.net/>
+
+ Ingen is free software: you can redistribute it and/or modify it under the
+ terms of the GNU Affero General Public License as published by the Free
+ Software Foundation, either version 3 of the License, or any later version.
+
+ Ingen is distributed in the hope that it will be useful, but WITHOUT ANY
+ WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
+ A PARTICULAR PURPOSE. See the GNU Affero General Public License for details.
+
+ You should have received a copy of the GNU Affero General Public License
+ along with Ingen. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#include "Engine.hpp"
+#include "UndoStack.hpp"
+#include "events/Mark.hpp"
+
+namespace Ingen {
+namespace Server {
+namespace Events {
+
+Mark::Mark(Engine& engine,
+ SPtr<Interface> client,
+ int32_t id,
+ SampleCount timestamp,
+ Type type)
+ : Event(engine, client, id, timestamp)
+ , _type(type)
+{}
+
+bool
+Mark::pre_process()
+{
+ UndoStack* const stack = ((_mode == Mode::UNDO)
+ ? _engine.redo_stack()
+ : _engine.undo_stack());
+
+ switch (_type) {
+ case Type::BUNDLE_START:
+ stack->start_entry();
+ break;
+ case Type::BUNDLE_END:
+ stack->finish_entry();
+ break;
+ }
+
+ return Event::pre_process_done(Status::SUCCESS);
+}
+
+void
+Mark::execute(ProcessContext& context)
+{}
+
+void
+Mark::post_process()
+{
+ respond();
+}
+
+} // namespace Events
+} // namespace Server
+} // namespace Ingen