From 7a89d560090496d44f9129cf57f3c5bf5af44570 Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Thu, 29 Apr 2021 22:56:09 +0200 Subject: [PATCH] Fix insert + ripple undo/redo Playlist changes do not include region-property changes. When inserting a region, position(s) of other Regions may change and those changes have to be recorded explicitly (for now). see also RegionRippleDrag. --- gtk2_ardour/editor_drag.cc | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/gtk2_ardour/editor_drag.cc b/gtk2_ardour/editor_drag.cc index 7ac8ce5344..f6001971b9 100644 --- a/gtk2_ardour/editor_drag.cc +++ b/gtk2_ardour/editor_drag.cc @@ -2079,9 +2079,20 @@ RegionInsertDrag::finished (GdkEvent * event, bool) // Mixbus doesn't seem to ripple when inserting regions from the list: should we? yes, probably if (Config->get_edit_mode() == Ripple) { - playlist->ripple (_last_position.sample, _primary->region()->length(), _primary->region()); - } + boost::shared_ptr rl = playlist->regions_with_start_within (Evoral::Range(_last_position.sample, max_samplepos)); + for (RegionList::iterator i = rl->begin(); i != rl->end(); ++i) { + (*i)->clear_changes (); + } + playlist->ripple (_last_position.sample, _primary->region()->length(), _primary->region()); + + samplepos_t where = _last_position.sample + _primary->region()->length(); + for (RegionList::iterator i = rl->begin(); i != rl->end(); ++i) { + if ((*i)->position() >= where) { + _editor->session()->add_command (new StatefulDiffCommand (*i)); + } + } + } _editor->session()->add_command (new StatefulDiffCommand (playlist)); _editor->commit_reversible_command ();