When a region movement is undone, prevent the resulting movement from triggering the automation-follows-regions code. Fixes #3348.

git-svn-id: svn://localhost/ardour2/branches/3.0@7464 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
Carl Hetherington
2010-07-22 01:22:33 +00:00
parent 8b0e35cba4
commit 092e598389
6 changed files with 33 additions and 19 deletions

View File

@@ -63,7 +63,7 @@ class AudioPlaylist : public ARDOUR::Playlist
/* playlist "callbacks" */
void notify_crossfade_added (boost::shared_ptr<Crossfade>);
void flush_notifications ();
void flush_notifications (bool);
void finalize_split_region (boost::shared_ptr<Region> orig, boost::shared_ptr<Region> left, boost::shared_ptr<Region> right);

View File

@@ -208,7 +208,7 @@ class Diskstream : public SessionObject, public PublicDiskstream
virtual void playlist_changed (const PBD::PropertyChange&);
virtual void playlist_deleted (boost::weak_ptr<Playlist>);
virtual void playlist_ranges_moved (std::list< Evoral::RangeMove<framepos_t> > const &);
virtual void playlist_ranges_moved (std::list< Evoral::RangeMove<framepos_t> > const &, bool);
virtual void transport_stopped_wallclock (struct tm&, time_t, bool abort) = 0;
virtual void transport_looped (nframes_t transport_frame) = 0;

View File

@@ -182,12 +182,12 @@ class Playlist : public SessionObject
PBD::Signal0<void> NameChanged;
PBD::Signal0<void> LengthChanged;
PBD::Signal0<void> LayeringChanged;
PBD::Signal1<void,std::list< Evoral::RangeMove<framepos_t> > const &> RangesMoved;
PBD::Signal2<void,std::list< Evoral::RangeMove<framepos_t> > const &, bool> RangesMoved;
static std::string bump_name (std::string old_name, Session&);
void freeze ();
void thaw ();
void thaw (bool from_undo = false);
void raise_region (boost::shared_ptr<Region>);
void lower_region (boost::shared_ptr<Region>);
@@ -289,8 +289,8 @@ class Playlist : public SessionObject
}
void delay_notifications ();
void release_notifications ();
virtual void flush_notifications ();
void release_notifications (bool from_undo = false);
virtual void flush_notifications (bool from_undo = false);
void clear_pending ();
void _set_sort_id ();

View File

@@ -241,9 +241,9 @@ AudioPlaylist::remove_dependents (boost::shared_ptr<Region> region)
void
AudioPlaylist::flush_notifications ()
AudioPlaylist::flush_notifications (bool from_undo)
{
Playlist::flush_notifications();
Playlist::flush_notifications (from_undo);
if (in_flush) {
return;

View File

@@ -363,7 +363,7 @@ Diskstream::use_playlist (boost::shared_ptr<Playlist> playlist)
_playlist->ContentsChanged.connect_same_thread (playlist_connections, boost::bind (&Diskstream::playlist_modified, this));
_playlist->DropReferences.connect_same_thread (playlist_connections, boost::bind (&Diskstream::playlist_deleted, this, boost::weak_ptr<Playlist>(_playlist)));
_playlist->RangesMoved.connect_same_thread (playlist_connections, boost::bind (&Diskstream::playlist_ranges_moved, this, _1));
_playlist->RangesMoved.connect_same_thread (playlist_connections, boost::bind (&Diskstream::playlist_ranges_moved, this, _1, _2));
}
/* don't do this if we've already asked for it *or* if we are setting up
@@ -436,8 +436,17 @@ Diskstream::set_name (const string& str)
}
void
Diskstream::playlist_ranges_moved (list< Evoral::RangeMove<framepos_t> > const & movements_frames)
Diskstream::playlist_ranges_moved (list< Evoral::RangeMove<framepos_t> > const & movements_frames, bool from_undo)
{
/* If we're coming from an undo, it will have handled
automation undo (it must, since automation-follows-regions
can lose automation data). Hence we can do nothing here.
*/
if (from_undo) {
return;
}
if (!_track || Config->get_automation_follows_regions () == false) {
return;
}
@@ -483,7 +492,10 @@ Diskstream::move_processor_automation (boost::weak_ptr<Processor> p, list< Evora
set<Evoral::Parameter> const a = processor->what_can_be_automated ();
cout << "move processor auto for " << processor->name() << "\n";
for (set<Evoral::Parameter>::iterator i = a.begin (); i != a.end (); ++i) {
cout << "moving " << *i << "\n";
boost::shared_ptr<AutomationList> al = processor->automation_control(*i)->alist();
XMLNode & before = al->get_state ();
al->move_ranges (movements);

View File

@@ -446,7 +446,7 @@ Playlist::begin_undo ()
void
Playlist::end_undo ()
{
thaw ();
thaw (true);
in_update = false;
}
@@ -457,11 +457,12 @@ Playlist::freeze ()
g_atomic_int_inc (&ignore_state_changes);
}
/** @param from_undo true if this thaw is triggered by the end of an undo on this playlist */
void
Playlist::thaw ()
Playlist::thaw (bool from_undo)
{
g_atomic_int_dec_and_test (&ignore_state_changes);
release_notifications ();
release_notifications (from_undo);
}
@@ -472,11 +473,12 @@ Playlist::delay_notifications ()
freeze_length = _get_extent().second;
}
/** @param from_undo true if this release is triggered by the end of an undo on this playlist */
void
Playlist::release_notifications ()
Playlist::release_notifications (bool from_undo)
{
if (g_atomic_int_dec_and_test (&block_notifications)) {
flush_notifications ();
flush_notifications (from_undo);
}
}
@@ -535,7 +537,7 @@ Playlist::notify_region_moved (boost::shared_ptr<Region> r)
list< Evoral::RangeMove<framepos_t> > m;
m.push_back (move);
RangesMoved (m);
RangesMoved (m, false);
}
}
@@ -574,8 +576,9 @@ Playlist::notify_length_changed ()
}
}
/** @param from_undo true if this flush is triggered by the end of an undo on this playlist */
void
Playlist::flush_notifications ()
Playlist::flush_notifications (bool from_undo)
{
set<boost::shared_ptr<Region> > dependent_checks_needed;
set<boost::shared_ptr<Region> >::iterator s;
@@ -661,8 +664,7 @@ Playlist::flush_notifications ()
}
if (!pending_range_moves.empty ()) {
// cerr << _name << " sends RangesMoved\n";
RangesMoved (pending_range_moves);
RangesMoved (pending_range_moves, from_undo);
}
clear_pending ();