diff options
author | Colin Fletcher <colin.m.fletcher@googlemail.com> | 2014-07-01 19:10:47 +0100 |
---|---|---|
committer | Colin Fletcher <colin.m.fletcher@googlemail.com> | 2014-07-01 19:10:47 +0100 |
commit | e5e12acc5698090f2c0c614385e457cc0b46fbb0 (patch) | |
tree | 3f4f28baba25f4e276d669d98ff485f7c51aa0b1 /libs/ardour | |
parent | 23e7cf10191270d70357ccf0ed9294f020c7b7ab (diff) | |
parent | da65f3778c66dd2935709445c9a5dbd225296439 (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')
-rw-r--r-- | libs/ardour/ardour/playlist.h | 14 | ||||
-rw-r--r-- | libs/ardour/ardour/types.h | 1 | ||||
-rw-r--r-- | libs/ardour/enums.cc | 1 | ||||
-rw-r--r-- | libs/ardour/playlist.cc | 73 | ||||
-rw-r--r-- | libs/ardour/utils.cc | 5 |
5 files changed, 87 insertions, 7 deletions
diff --git a/libs/ardour/ardour/playlist.h b/libs/ardour/ardour/playlist.h index 5629a04629..ababa60063 100644 --- a/libs/ardour/ardour/playlist.h +++ b/libs/ardour/ardour/playlist.h @@ -144,6 +144,14 @@ public: void uncombine (boost::shared_ptr<Region>); void shuffle (boost::shared_ptr<Region>, int dir); + void ripple (framepos_t at, framecnt_t distance, RegionList *exclude); + void ripple (framepos_t at, framecnt_t distance, boost::shared_ptr<Region> exclude) { + RegionList el; + if (exclude) + el.push_back (exclude); + ripple (at, distance, &el); + } + void update_after_tempo_map_change (); boost::shared_ptr<Playlist> cut (std::list<AudioRange>&, bool result_is_hidden = true); @@ -283,6 +291,7 @@ public: bool first_set_state; bool _hidden; bool _splicing; + bool _rippling; bool _shuffling; bool _nudging; uint32_t _refcnt; @@ -337,6 +346,11 @@ public: void splice_locked (framepos_t at, framecnt_t distance, boost::shared_ptr<Region> exclude); void splice_unlocked (framepos_t at, framecnt_t distance, boost::shared_ptr<Region> exclude); + void core_ripple (framepos_t at, framecnt_t distance, RegionList *exclude); + void ripple_locked (framepos_t at, framecnt_t distance, RegionList *exclude); + void ripple_unlocked (framepos_t at, framecnt_t distance, RegionList *exclude); + + virtual void remove_dependents (boost::shared_ptr<Region> /*region*/) {} virtual XMLNode& state (bool); diff --git a/libs/ardour/ardour/types.h b/libs/ardour/ardour/types.h index df7c40a669..216de8bb0c 100644 --- a/libs/ardour/ardour/types.h +++ b/libs/ardour/ardour/types.h @@ -341,6 +341,7 @@ namespace ARDOUR { enum EditMode { Slide, Splice, + Ripple, Lock }; diff --git a/libs/ardour/enums.cc b/libs/ardour/enums.cc index 7a200ee0a0..6f4158d5de 100644 --- a/libs/ardour/enums.cc +++ b/libs/ardour/enums.cc @@ -235,6 +235,7 @@ setup_enum_writer () REGISTER_ENUM (Slide); REGISTER_ENUM (Splice); + REGISTER_ENUM (Ripple); // XXX do the old enum values have to stay in order? REGISTER_ENUM (Lock); REGISTER (_EditMode); 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)); diff --git a/libs/ardour/utils.cc b/libs/ardour/utils.cc index 54943562cb..9c0aea885b 100644 --- a/libs/ardour/utils.cc +++ b/libs/ardour/utils.cc @@ -423,6 +423,8 @@ ARDOUR::string_to_edit_mode (string str) return Splice; } else if (str == _("Slide")) { return Slide; + } else if (str == _("Ripple")) { + return Ripple; } else if (str == _("Lock")) { return Lock; } @@ -441,6 +443,9 @@ ARDOUR::edit_mode_to_string (EditMode mode) case Lock: return _("Lock"); + case Ripple: + return _("Ripple"); + default: case Splice: return _("Splice"); |