diff --git a/gtk2_ardour/editor_drag.cc b/gtk2_ardour/editor_drag.cc index 62cd7d67b0..fe36ae8488 100644 --- a/gtk2_ardour/editor_drag.cc +++ b/gtk2_ardour/editor_drag.cc @@ -2386,7 +2386,7 @@ RegionRippleDrag::y_movement_allowed (int delta_track, double delta_layer, int s { if (RegionMotionDrag::y_movement_allowed (delta_track, delta_layer, skip_invisible)) { if (delta_track) { - return allow_moves_across_tracks; + return false; } else { return true; } @@ -2402,8 +2402,6 @@ RegionRippleDrag::RegionRippleDrag (Editor* e, ArdourCanvas::Item* i, RegionView RegionSelection selected_regions = _editor->selection->regions; selection_length = selected_regions.end_sample() - selected_regions.start(); - // Rippling accross tracks disabled. Rippling on all tracks is the way to go in the future. - allow_moves_across_tracks = false; // (selected_regions.playlists().size() == 1); prev_tav = NULL; prev_amount = 0; exclude = new RegionList; @@ -2435,15 +2433,7 @@ RegionRippleDrag::RegionRippleDrag (Editor* e, ArdourCanvas::Item* i, RegionView selected_regions, false); } - if (allow_moves_across_tracks) { - orig_tav = &(*selected_regions.begin())->get_time_axis_view(); - for (std::list::const_iterator it = _views.begin(); it != _views.end(); ++it) { - _orig_tav_ripples.push_back((*it).view->region()); - } - } else { - orig_tav = NULL; - } - + orig_tav = NULL; } void @@ -2473,46 +2463,9 @@ RegionRippleDrag::motion (GdkEvent* event, bool first_move) samplecnt_t amount = _editor->pixel_to_sample (delta); - if (allow_moves_across_tracks) { - // all the originally selected regions were on the same track - - samplecnt_t adjust = 0; - if (prev_tav && tv != prev_tav) { - // dragged onto a different track - // remove the unselected regions from _views, restore them to their original positions - // and add the regions after the drop point on the new playlist to _views instead. - // undo the effect of rippling the previous playlist, and include the effect of removing - // the dragged region(s) from this track - - remove_unselected_from_views (prev_amount, false); - // ripple previous playlist according to the regions that have been removed onto the new playlist - prev_tav->playlist()->ripple(prev_position, -selection_length, exclude); - prev_amount = 0; - - // move just the selected regions - RegionMoveDrag::motion(event, first_move); - - // ensure that the ripple operation on the new playlist inserts selection_length time - adjust = selection_length; - // ripple the new current playlist - tv->playlist()->ripple (where, amount+adjust, exclude); - - // add regions after point where drag entered this track to subsequent ripples - add_all_after_to_views (tv, where, _editor->selection->regions, true); - - } else { - // motion on same track - RegionMoveDrag::motion(event, first_move); - } - prev_tav = tv; - - // remember what we've done to this playlist so we can undo it if the selection is dragged to another track - prev_position = where; - } else { - // selection encompasses multiple tracks - just drag - // cross-track drags are forbidden - RegionMoveDrag::motion(event, first_move); - } + // selection encompasses multiple tracks - just drag + // cross-track drags are forbidden + RegionMoveDrag::motion(event, first_move); if (!_x_constrained) { prev_amount += amount; @@ -2541,68 +2494,24 @@ RegionRippleDrag::finished (GdkEvent* event, bool movement_occurred) // remove the regions being rippled from the dragging view, updating them to // their new positions - if (allow_moves_across_tracks) { - if (orig_tav) { - // if regions were dragged across tracks, we've rippled any later - // regions on the track the regions were dragged off, so we need - // to add the original track to the undo record - orig_tav->playlist()->clear_changes(); - orig_tav->playlist()->clear_owned_changes(); - orig_tav->playlist()->freeze (); + // selection spanned multiple tracks - all will need adding to undo record - remove_unselected_from_views (prev_amount, true); + std::set > playlists = _editor->selection->regions.playlists(); + std::set >::const_iterator pi; - std::list >::const_iterator it = _orig_tav_ripples.begin(); - for (; it != _orig_tav_ripples.end(); ++it) { - const boost::shared_ptr r = *it; - bool found = false; - for (std::list::const_iterator it = _views.begin(); it != _views.end(); ++it) { - if (it->view->region() == r) { - found = true; - break; - } - } - if (!found) { - const samplecnt_t pos_after = r->position(); - const samplecnt_t pos_before = pos_after + selection_length; - r->set_position(pos_before); - r->clear_changes(); - r->set_position(pos_after); - } - } + for (pi = playlists.begin(); pi != playlists.end(); ++pi) { + (*pi)->clear_changes(); + (*pi)->clear_owned_changes(); + (*pi)->freeze(); + } - orig_tav->playlist()->thaw (); + remove_unselected_from_views (prev_amount, true); - vector cmds; - orig_tav->playlist()->rdiff (cmds); - _editor->session()->add_commands (cmds); - } - if (prev_tav && prev_tav != orig_tav) { - prev_tav->playlist()->clear_changes(); - vector cmds; - prev_tav->playlist()->rdiff (cmds); - _editor->session()->add_commands (cmds); - } - } else { - // selection spanned multiple tracks - all will need adding to undo record - - std::set > playlists = _editor->selection->regions.playlists(); - std::set >::const_iterator pi; - - for (pi = playlists.begin(); pi != playlists.end(); ++pi) { - (*pi)->clear_changes(); - (*pi)->clear_owned_changes(); - (*pi)->freeze(); - } - - remove_unselected_from_views (prev_amount, true); - - for (pi = playlists.begin(); pi != playlists.end(); ++pi) { - (*pi)->thaw(); - vector cmds; - (*pi)->rdiff (cmds); - _editor->session()->add_commands (cmds); - } + for (pi = playlists.begin(); pi != playlists.end(); ++pi) { + (*pi)->thaw(); + vector cmds; + (*pi)->rdiff (cmds); + _editor->session()->add_commands (cmds); } // other modified playlists are added to undo by RegionMoveDrag::finished() diff --git a/gtk2_ardour/editor_drag.h b/gtk2_ardour/editor_drag.h index 802a150ddf..663ad76df6 100644 --- a/gtk2_ardour/editor_drag.h +++ b/gtk2_ardour/editor_drag.h @@ -553,7 +553,6 @@ private: ARDOUR::samplecnt_t prev_amount; ARDOUR::samplepos_t prev_position; ARDOUR::samplecnt_t selection_length; - bool allow_moves_across_tracks; // only if all selected regions are on one track ARDOUR::RegionList *exclude; void add_all_after_to_views (TimeAxisView *tav, ARDOUR::samplepos_t where, const RegionSelection &exclude, bool drag_in_progress); void remove_unselected_from_views (ARDOUR::samplecnt_t amount, bool move_regions);