summaryrefslogtreecommitdiff
path: root/libs/ardour/playlist.cc
diff options
context:
space:
mode:
authorColin Fletcher <colin.m.fletcher@googlemail.com>2014-07-01 19:10:47 +0100
committerColin Fletcher <colin.m.fletcher@googlemail.com>2014-07-01 19:10:47 +0100
commite5e12acc5698090f2c0c614385e457cc0b46fbb0 (patch)
tree3f4f28baba25f4e276d669d98ff485f7c51aa0b1 /libs/ardour/playlist.cc
parent23e7cf10191270d70357ccf0ed9294f020c7b7ab (diff)
parentda65f3778c66dd2935709445c9a5dbd225296439 (diff)
Merge branch 'ripple-mode-cc' into cairocanvas
Fix up merge conflicts in gtk2_ardour/editor_mouse.cc gtk2_ardour/editor_ops.cc Also fix up compile errors.
Diffstat (limited to 'libs/ardour/playlist.cc')
-rw-r--r--libs/ardour/playlist.cc73
1 files changed, 66 insertions, 7 deletions
diff --git a/libs/ardour/playlist.cc b/libs/ardour/playlist.cc
index ef768cad96..266535da20 100644
--- a/libs/ardour/playlist.cc
+++ b/libs/ardour/playlist.cc
@@ -172,6 +172,7 @@ Playlist::Playlist (boost::shared_ptr<const Playlist> other, string namestr, boo
in_set_state--;
_splicing = other->_splicing;
+ _rippling = other->_rippling;
_nudging = other->_nudging;
_edit_mode = other->_edit_mode;
@@ -302,6 +303,7 @@ Playlist::init (bool hide)
_refcnt = 0;
_hidden = hide;
_splicing = false;
+ _rippling = false;
_shuffling = false;
_nudging = false;
in_set_state = 0;
@@ -706,7 +708,7 @@ Playlist::flush_notifications (bool from_undo)
}
}
- possibly_splice_unlocked (position, (pos + length) - position, boost::shared_ptr<Region>());
+ possibly_splice_unlocked (position, (pos + length) - position, region);
}
void
@@ -1399,7 +1401,7 @@ Playlist::flush_notifications (bool from_undo)
if (_edit_mode == Splice) {
splice_locked (at, distance, exclude);
- }
+ }
}
void
@@ -1456,12 +1458,63 @@ Playlist::flush_notifications (bool from_undo)
_splicing = false;
notify_contents_changed ();
- }
+}
- void
- Playlist::region_bounds_changed (const PropertyChange& what_changed, boost::shared_ptr<Region> region)
- {
- if (in_set_state || _splicing || _nudging || _shuffling) {
+void
+Playlist::ripple_locked (framepos_t at, framecnt_t distance, RegionList *exclude)
+{
+ {
+ RegionWriteLock rl (this);
+ core_ripple (at, distance, exclude);
+ }
+}
+
+void
+Playlist::ripple_unlocked (framepos_t at, framecnt_t distance, RegionList *exclude)
+{
+ core_ripple (at, distance, exclude);
+}
+
+void
+Playlist::core_ripple (framepos_t at, framecnt_t distance, RegionList *exclude)
+{
+ if (distance == 0) {
+ return;
+ }
+
+ _rippling = true;
+ RegionListProperty copy = regions;
+ for (RegionList::iterator i = copy.begin(); i != copy.end(); ++i) {
+ assert (i != copy.end());
+
+ if (exclude) {
+ if (std::find(exclude->begin(), exclude->end(), (*i)) != exclude->end()) {
+ continue;
+ }
+ }
+
+ if ((*i)->position() >= at) {
+ framepos_t new_pos = (*i)->position() + distance;
+ framepos_t limit = max_framepos - (*i)->length();
+ if (new_pos < 0) {
+ new_pos = 0;
+ } else if (new_pos >= limit ) {
+ new_pos = limit;
+ }
+
+ (*i)->set_position (new_pos);
+ }
+ }
+
+ _rippling = false;
+ notify_contents_changed ();
+}
+
+
+void
+Playlist::region_bounds_changed (const PropertyChange& what_changed, boost::shared_ptr<Region> region)
+{
+ if (in_set_state || _splicing || _rippling || _nudging || _shuffling) {
return;
}
@@ -2695,6 +2748,12 @@ Playlist::region_is_shuffle_constrained (boost::shared_ptr<Region>)
}
void
+Playlist::ripple (framepos_t at, framecnt_t distance, RegionList *exclude)
+{
+ ripple_locked (at, distance, exclude);
+}
+
+void
Playlist::update_after_tempo_map_change ()
{
RegionWriteLock rlock (const_cast<Playlist*> (this));