Fix #8012 to some extent.
As soon as we ripple drag the selected region out of the original track, ::remove_unselected_from_views() is called and the rippled regions on the original track are not covered when ::remove_selected_from_views() is called again in ::finished(). Therefore we need to shift the regions remaining on the original track back and forth again, in order to have them properly in the undo history.
This commit is contained in:
@@ -2314,6 +2314,9 @@ RegionRippleDrag::RegionRippleDrag (Editor* e, ArdourCanvas::Item* i, RegionView
|
||||
|
||||
if (allow_moves_across_tracks) {
|
||||
orig_tav = &(*selected_regions.begin())->get_time_axis_view();
|
||||
for (std::list<DraggingView>::const_iterator it = _views.begin(); it != _views.end(); ++it) {
|
||||
_orig_tav_ripples.push_back((*it).view->region());
|
||||
}
|
||||
} else {
|
||||
orig_tav = NULL;
|
||||
}
|
||||
@@ -2423,6 +2426,26 @@ RegionRippleDrag::finished (GdkEvent* event, bool movement_occurred)
|
||||
orig_tav->playlist()->clear_changes();
|
||||
orig_tav->playlist()->clear_owned_changes();
|
||||
remove_unselected_from_views (prev_amount, true);
|
||||
|
||||
std::list<boost::shared_ptr<Region> >::const_iterator it = _orig_tav_ripples.begin();
|
||||
for (; it != _orig_tav_ripples.end(); ++it) {
|
||||
const boost::shared_ptr<Region> r = *it;
|
||||
bool found = false;
|
||||
for (std::list<DraggingView>::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);
|
||||
}
|
||||
}
|
||||
|
||||
vector<Command*> cmds;
|
||||
orig_tav->playlist()->rdiff (cmds);
|
||||
_editor->session()->add_commands (cmds);
|
||||
|
||||
@@ -44,6 +44,7 @@
|
||||
|
||||
namespace ARDOUR {
|
||||
class Location;
|
||||
class Region;
|
||||
class TempoSection;
|
||||
}
|
||||
|
||||
@@ -520,6 +521,7 @@ private:
|
||||
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);
|
||||
|
||||
std::list<boost::shared_ptr<ARDOUR::Region> > _orig_tav_ripples;
|
||||
};
|
||||
|
||||
/** "Drag" to cut a region (action only on button release) */
|
||||
@@ -1328,4 +1330,3 @@ private:
|
||||
};
|
||||
|
||||
#endif /* __gtk2_ardour_editor_drag_h_ */
|
||||
|
||||
|
||||
Reference in New Issue
Block a user