From 34881407e7dd687623fbabfe0ae3aee7099eb352 Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Tue, 31 Jan 2012 23:06:12 +0000 Subject: Make crossfade active state and length changes undo-able. git-svn-id: svn://localhost/ardour2/branches/3.0@11406 d708f5d6-7413-0410-9779-e7cbd77b26cf --- gtk2_ardour/editor.cc | 13 +++++++++++++ libs/ardour/ardour/crossfade.h | 1 + libs/ardour/crossfade.cc | 15 +++++++++++++++ 3 files changed, 29 insertions(+) diff --git a/gtk2_ardour/editor.cc b/gtk2_ardour/editor.cc index 644c74c482..fd7be603cd 100644 --- a/gtk2_ardour/editor.cc +++ b/gtk2_ardour/editor.cc @@ -3636,7 +3636,11 @@ Editor::toggle_xfade_active (boost::weak_ptr wxfade) { boost::shared_ptr xfade (wxfade.lock()); if (xfade) { + xfade->clear_changes (); xfade->set_active (!xfade->active()); + _session->begin_reversible_command (_("Change crossfade active state")); + _session->add_command (new StatefulDiffCommand (xfade)); + _session->commit_reversible_command (); } } @@ -3645,7 +3649,16 @@ Editor::toggle_xfade_length (boost::weak_ptr wxfade) { boost::shared_ptr xfade (wxfade.lock()); if (xfade) { + XMLNode& before = xfade->get_state (); xfade->set_follow_overlap (!xfade->following_overlap()); + XMLNode& after = xfade->get_state (); + + /* This can't be a StatefulDiffCommand as the fade shapes are not + managed by the Stateful properties system. + */ + _session->begin_reversible_command (_("Change crossfade length")); + _session->add_command (new MementoCommand (*xfade.get(), &before, &after)); + _session->commit_reversible_command (); } } diff --git a/libs/ardour/ardour/crossfade.h b/libs/ardour/ardour/crossfade.h index 20bbcccdf5..1c7075eb7d 100644 --- a/libs/ardour/ardour/crossfade.h +++ b/libs/ardour/ardour/crossfade.h @@ -164,6 +164,7 @@ class Crossfade : public ARDOUR::AudioRegion static Sample* crossfade_buffer_in; void initialize (); + void register_properties (); int compute (boost::shared_ptr, boost::shared_ptr, CrossfadeModel); bool update (); diff --git a/libs/ardour/crossfade.cc b/libs/ardour/crossfade.cc index b2301b7167..902627933b 100644 --- a/libs/ardour/crossfade.cc +++ b/libs/ardour/crossfade.cc @@ -92,6 +92,8 @@ Crossfade::Crossfade (boost::shared_ptr in, boost::shared_ptr