summaryrefslogtreecommitdiff
path: root/libs/ardour/playlist.cc
diff options
context:
space:
mode:
authorCarl Hetherington <carl@carlh.net>2008-12-16 23:21:01 +0000
committerCarl Hetherington <carl@carlh.net>2008-12-16 23:21:01 +0000
commit2ebb1af2997b8e8f162635b11e8acc5c5d0fe563 (patch)
treea88ebc1e46dbe43cc760626eddd57d0feac81216 /libs/ardour/playlist.cc
parent43b14aa6098e266f07e1d7dfe4a8a65edda36b0a (diff)
Implement #2425: option for automation to follow region moves.
git-svn-id: svn://localhost/ardour2/branches/3.0@4326 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs/ardour/playlist.cc')
-rw-r--r--libs/ardour/playlist.cc67
1 files changed, 53 insertions, 14 deletions
diff --git a/libs/ardour/playlist.cc b/libs/ardour/playlist.cc
index fbe9990933..433e567efa 100644
--- a/libs/ardour/playlist.cc
+++ b/libs/ardour/playlist.cc
@@ -361,6 +361,25 @@ Playlist::notify_region_removed (boost::shared_ptr<Region> r)
}
void
+Playlist::notify_region_moved (boost::shared_ptr<Region> r)
+{
+ Evoral::RangeMove const move (r->last_position (), r->length (), r->position ());
+
+ if (holding_state ()) {
+
+ pending_range_moves.push_back (move);
+
+ } else {
+
+ Evoral::RangeMoveList m;
+ m.push_back (move);
+ RangesMoved (m);
+
+ }
+
+}
+
+void
Playlist::notify_region_added (boost::shared_ptr<Region> r)
{
/* the length change might not be true, but we have to act
@@ -452,9 +471,14 @@ Playlist::flush_notifications ()
check_dependents (*s, false);
}
+ if (!pending_range_moves.empty ()) {
+ RangesMoved (pending_range_moves);
+ }
+
pending_adds.clear ();
pending_removes.clear ();
pending_bounds.clear ();
+ pending_range_moves.clear ();
in_flush = false;
}
@@ -559,8 +583,10 @@ Playlist::add_region_internal (boost::shared_ptr<Region> region, nframes_t posit
}
}
- region->StateChanged.connect (sigc::bind (mem_fun (this, &Playlist::region_changed_proxy),
- boost::weak_ptr<Region> (region)));
+ region_state_changed_connections.push_back (
+ region->StateChanged.connect (sigc::bind (mem_fun (this, &Playlist::region_changed_proxy),
+ boost::weak_ptr<Region> (region)))
+ );
return true;
}
@@ -1288,20 +1314,22 @@ Playlist::region_changed (Change what_changed, boost::shared_ptr<Region> region)
return false;
}
- {
- if (what_changed & BoundsChanged) {
- region_bounds_changed (what_changed, region);
- save = !(_splicing || _nudging);
- }
+ if (what_changed & BoundsChanged) {
+ region_bounds_changed (what_changed, region);
+ save = !(_splicing || _nudging);
+ }
- if ((what_changed & our_interests) &&
- !(what_changed & Change (ARDOUR::PositionChanged|ARDOUR::LengthChanged))) {
- check_dependents (region, false);
- }
+ if ((what_changed & our_interests) &&
+ !(what_changed & Change (ARDOUR::PositionChanged|ARDOUR::LengthChanged))) {
+ check_dependents (region, false);
+ }
+
+ if (what_changed & Change (ARDOUR::PositionChanged)) {
+ notify_region_moved (region);
+ }
- if (what_changed & our_interests) {
- save = true;
- }
+ if (what_changed & our_interests) {
+ save = true;
}
return save;
@@ -1320,6 +1348,17 @@ Playlist::clear (bool with_signals)
{
{
RegionLock rl (this);
+
+ for (
+ std::list<sigc::connection>::iterator i = region_state_changed_connections.begin ();
+ i != region_state_changed_connections.end ();
+ ++i
+ ) {
+
+ i->disconnect ();
+
+ }
+
for (RegionList::iterator i = regions.begin(); i != regions.end(); ++i) {
pending_removes.insert (*i);
}