From 7cb9dbb8af5c4bd957067816d304282fa5120844 Mon Sep 17 00:00:00 2001 From: nick_m Date: Sun, 14 Jun 2015 05:17:25 +1000 Subject: [PATCH] Rudimentary automation touch undo/redo. --- libs/ardour/ardour/automation_control.h | 1 + libs/ardour/automation_control.cc | 10 +++++++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/libs/ardour/ardour/automation_control.h b/libs/ardour/ardour/automation_control.h index 24a9e0de3e..5d73e4aef9 100644 --- a/libs/ardour/ardour/automation_control.h +++ b/libs/ardour/ardour/automation_control.h @@ -101,6 +101,7 @@ protected: ARDOUR::Session& _session; const ParameterDescriptor _desc; + XMLNode* _before; //used for undo of touch start/stop pairs. }; diff --git a/libs/ardour/automation_control.cc b/libs/ardour/automation_control.cc index da33ad12a5..4ece790248 100644 --- a/libs/ardour/automation_control.cc +++ b/libs/ardour/automation_control.cc @@ -19,12 +19,15 @@ */ #include - #include "ardour/automation_control.h" #include "ardour/automation_watch.h" #include "ardour/event_type_map.h" #include "ardour/session.h" +#include "pbd/memento_command.h" + +#include "i18n.h" + using namespace std; using namespace ARDOUR; using namespace PBD; @@ -118,6 +121,7 @@ AutomationControl::start_touch(double when) if (alist()->automation_state() == Touch) { /* subtle. aligns the user value with the playback */ set_value (get_value ()); + _before = &alist ()->get_state (); alist()->start_touch (when); if (!_desc.toggled) { AutomationWatch::instance().add_automation_watch (shared_from_this()); @@ -138,6 +142,10 @@ AutomationControl::stop_touch(bool mark, double when) if (!_desc.toggled) { AutomationWatch::instance().remove_automation_watch (shared_from_this()); } + + _session.begin_reversible_command (_("record automation controller")); + _session.add_command (new MementoCommand (*alist ().get (), _before, &alist ()->get_state ())); + _session.commit_reversible_command (); } } }