Ripple mode: ripple all after start of first selected region
authorColin Fletcher <colin.m.fletcher@googlemail.com>
Tue, 1 Jul 2014 19:40:40 +0000 (20:40 +0100)
committerColin Fletcher <colin.m.fletcher@googlemail.com>
Tue, 1 Jul 2014 19:43:34 +0000 (20:43 +0100)
Ripple drags should affect all regions which start at or after the
beginning of the first selected region, not just those which start after
its end.

gtk2_ardour/editor_drag.cc

index 91bfb2ce0c4bda4b5249dcdc1ea5df01167128f2..6fec1f77f7853071b0a99e859f102d97d0aa75e4 100644 (file)
@@ -1572,10 +1572,16 @@ RegionSpliceDrag::aborted (bool)
 void
 RegionRippleDrag::add_all_after_to_views(TimeAxisView *tav, framepos_t where, const RegionSelection &exclude, bool drag_in_progress)
 {
+
+       boost::shared_ptr<RegionList> rl = tav->playlist()->regions_with_start_within (Evoral::Range<framepos_t>(where, max_framepos));
+
+       RouteTimeAxisView* rtv = dynamic_cast<RouteTimeAxisView*>(tav);
        RegionSelection to_ripple;
-       TrackViewList tracks;
-       tracks.push_back (tav);
-       _editor->get_regions_after (to_ripple, where, tracks);
+       for (RegionList::iterator i = rl->begin(); i != rl->end(); ++i) {
+               if ((*i)->position() >= where) {
+                       to_ripple.push_back (rtv->view()->find_view(*i));
+               }
+       }
 
        for (RegionSelection::iterator i = to_ripple.begin(); i != to_ripple.end(); ++i) {
                if (!exclude.contains (*i)) {
@@ -1691,7 +1697,7 @@ RegionRippleDrag::RegionRippleDrag (Editor* e, ArdourCanvas::Item* i, RegionView
                assert (first_selected_on_this_track); // we should always find the region in one of the playlists...
                add_all_after_to_views (
                                &first_selected_on_this_track->get_time_axis_view(),
-                               first_selected_on_this_track->region()->position() + first_selected_on_this_track->region()->length(),
+                               first_selected_on_this_track->region()->position(),
                                selected_regions, false);
        }