diff options
author | Carl Hetherington <carl@carlh.net> | 2012-01-31 23:06:12 +0000 |
---|---|---|
committer | Carl Hetherington <carl@carlh.net> | 2012-01-31 23:06:12 +0000 |
commit | 34881407e7dd687623fbabfe0ae3aee7099eb352 (patch) | |
tree | 59720eaf55c85ddef90d8b605e21560a1f268de6 | |
parent | 40a8ed88084eb36922dbdc530db75a323843863a (diff) |
Make crossfade active state and length changes undo-able.
git-svn-id: svn://localhost/ardour2/branches/3.0@11406 d708f5d6-7413-0410-9779-e7cbd77b26cf
-rw-r--r-- | gtk2_ardour/editor.cc | 13 | ||||
-rw-r--r-- | libs/ardour/ardour/crossfade.h | 1 | ||||
-rw-r--r-- | libs/ardour/crossfade.cc | 15 |
3 files changed, 29 insertions, 0 deletions
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<Crossfade> wxfade) { boost::shared_ptr<Crossfade> 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<Crossfade> wxfade) { boost::shared_ptr<Crossfade> 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<Crossfade> (*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<ARDOUR::AudioRegion>, boost::shared_ptr<ARDOUR::AudioRegion>, 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<AudioRegion> in, boost::shared_ptr<Audio , _fade_out (Evoral::Parameter(FadeOutAutomation)) // linear (gain coefficient) => -inf..+6dB { + register_properties (); + _in = in; _out = out; _anchor_point = ap; @@ -107,6 +109,8 @@ Crossfade::Crossfade (boost::shared_ptr<AudioRegion> a, boost::shared_ptr<AudioR , _fade_in (Evoral::Parameter(FadeInAutomation)) // linear (gain coefficient) => -inf..+6dB , _fade_out (Evoral::Parameter(FadeOutAutomation)) // linear (gain coefficient) => -inf..+6dB { + register_properties (); + _in_update = false; _fixed = false; _follow_overlap = false; @@ -127,6 +131,8 @@ Crossfade::Crossfade (const Playlist& playlist, XMLNode const & node) , _fade_out (Evoral::Parameter(FadeOutAutomation)) // linear (gain coefficient) => -inf..+6dB { + register_properties (); + boost::shared_ptr<Region> r; XMLProperty const * prop; LocaleGuard lg (X_("POSIX")); @@ -197,6 +203,8 @@ Crossfade::Crossfade (boost::shared_ptr<Crossfade> orig, boost::shared_ptr<Audio , _fade_in (orig->_fade_in) , _fade_out (orig->_fade_out) { + register_properties (); + _active = orig->_active; _in_update = orig->_in_update; _anchor_point = orig->_anchor_point; @@ -225,6 +233,13 @@ Crossfade::~Crossfade () } void +Crossfade::register_properties () +{ + add_property (_active); + add_property (_follow_overlap); +} + +void Crossfade::initialize () { /* merge source lists from regions */ |