13
0

Make crossfade active state and length changes undo-able.

git-svn-id: svn://localhost/ardour2/branches/3.0@11406 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
Carl Hetherington 2012-01-31 23:06:12 +00:00
parent 40a8ed8808
commit 34881407e7
3 changed files with 29 additions and 0 deletions

View File

@ -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 ();
}
}

View File

@ -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 ();

View File

@ -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;
@ -224,6 +232,13 @@ Crossfade::~Crossfade ()
{
}
void
Crossfade::register_properties ()
{
add_property (_active);
add_property (_follow_overlap);
}
void
Crossfade::initialize ()
{