Do not incrementally ripple during cut/delete #9295

When cutting multiple regions with Ripple-ALL, removing
the first region ripples the remaining tracks which includes
selected regions on those tracks which are to be cut later.
This commit is contained in:
Robin Gareus 2023-04-06 01:26:40 +02:00
parent dd542b8f4d
commit f57a9d84df
Signed by: rgareus
GPG Key ID: A090BCE02CF57F04
2 changed files with 11 additions and 15 deletions

View File

@ -609,7 +609,7 @@ public:
bool should_ripple () const; bool should_ripple () const;
bool should_ripple_all () const; /* RippleAll will ripple all similar regions and the timeline markers */ bool should_ripple_all () const; /* RippleAll will ripple all similar regions and the timeline markers */
void do_ripple (std::shared_ptr<ARDOUR::Playlist>, Temporal::timepos_t const &, Temporal::timecnt_t const &, ARDOUR::RegionList* exclude, bool add_to_command); void do_ripple (std::shared_ptr<ARDOUR::Playlist>, Temporal::timepos_t const &, Temporal::timecnt_t const &, ARDOUR::RegionList* exclude, ARDOUR::PlaylistSet const& affected_pls, bool add_to_command);
void do_ripple (std::shared_ptr<ARDOUR::Playlist>, Temporal::timepos_t const &, Temporal::timecnt_t const &, std::shared_ptr<ARDOUR::Region> exclude, bool add_to_command); void do_ripple (std::shared_ptr<ARDOUR::Playlist>, Temporal::timepos_t const &, Temporal::timecnt_t const &, std::shared_ptr<ARDOUR::Region> exclude, bool add_to_command);
void ripple_marks (std::shared_ptr<ARDOUR::Playlist> target_playlist, Temporal::timepos_t at, Temporal::timecnt_t const & distance); void ripple_marks (std::shared_ptr<ARDOUR::Playlist> target_playlist, Temporal::timepos_t at, Temporal::timecnt_t const & distance);
void get_markers_to_ripple (std::shared_ptr<ARDOUR::Playlist> target_playlist, Temporal::timepos_t const & pos, std::vector<ArdourMarker*>& markers); void get_markers_to_ripple (std::shared_ptr<ARDOUR::Playlist> target_playlist, Temporal::timepos_t const & pos, std::vector<ArdourMarker*>& markers);

View File

@ -4885,8 +4885,8 @@ Editor::cut_copy_regions (CutCopyOp op, RegionSelection& rs)
timepos_t first_position = timepos_t::max (Temporal::AudioTime); timepos_t first_position = timepos_t::max (Temporal::AudioTime);
typedef set<std::shared_ptr<Playlist> > FreezeList; PlaylistSet freezelist;
FreezeList freezelist; RegionList exclude;
/* get ordering correct before we cut/copy */ /* get ordering correct before we cut/copy */
@ -4981,7 +4981,7 @@ Editor::cut_copy_regions (CutCopyOp op, RegionSelection& rs)
case Delete: case Delete:
pl->remove_region (r); pl->remove_region (r);
if (should_ripple()) { if (should_ripple()) {
do_ripple (pl, r->position(), -r->length(), std::shared_ptr<Region>(), false); do_ripple (pl, r->position(), -r->length(), &exclude, freezelist, false);
} }
break; break;
@ -4990,7 +4990,7 @@ Editor::cut_copy_regions (CutCopyOp op, RegionSelection& rs)
npl->add_region (_xx, timepos_t (first_position.distance (r->position()))); npl->add_region (_xx, timepos_t (first_position.distance (r->position())));
pl->remove_region (r); pl->remove_region (r);
if (should_ripple()) { if (should_ripple()) {
do_ripple (pl, r->position(), -r->length(), std::shared_ptr<Region>(), false); do_ripple (pl, r->position(), -r->length(), &exclude, freezelist, false);
} }
break; break;
@ -5002,7 +5002,7 @@ Editor::cut_copy_regions (CutCopyOp op, RegionSelection& rs)
case Clear: case Clear:
pl->remove_region (r); pl->remove_region (r);
if (should_ripple()) { if (should_ripple()) {
do_ripple (pl, r->position(), -r->length(), std::shared_ptr<Region>(), false); do_ripple (pl, r->position(), -r->length(), &exclude, freezelist, false);
} }
break; break;
} }
@ -5301,7 +5301,7 @@ Editor::duplicate_some_regions (RegionSelection& regions, float times)
} }
for (PlaylistSet::iterator p = playlists.begin(); p != playlists.end(); ++p) { for (PlaylistSet::iterator p = playlists.begin(); p != playlists.end(); ++p) {
do_ripple ((*p), start_time, span.scale (times), &exclude, false); do_ripple ((*p), start_time, span.scale (times), &exclude, playlists, false);
} }
} }
@ -9640,14 +9640,15 @@ void
Editor::do_ripple (std::shared_ptr<ARDOUR::Playlist> target_playlist, timepos_t const & at, timecnt_t const & distance, std::shared_ptr<ARDOUR::Region> exclude, bool add_to_command) Editor::do_ripple (std::shared_ptr<ARDOUR::Playlist> target_playlist, timepos_t const & at, timecnt_t const & distance, std::shared_ptr<ARDOUR::Region> exclude, bool add_to_command)
{ {
RegionList el; RegionList el;
PlaylistSet pls;
if (exclude) { if (exclude) {
el.push_back (exclude); el.push_back (exclude);
} }
do_ripple (target_playlist, at, distance, &el, add_to_command); do_ripple (target_playlist, at, distance, &el, pls, add_to_command);
} }
void void
Editor::do_ripple (std::shared_ptr<Playlist> target_playlist, timepos_t const & at, timecnt_t const & distance, RegionList* exclude, bool add_to_command) Editor::do_ripple (std::shared_ptr<Playlist> target_playlist, timepos_t const & at, timecnt_t const & distance, RegionList* exclude, PlaylistSet const &affected_pls, bool add_to_command)
{ {
PlaylistSet playlists; PlaylistSet playlists;
@ -9683,9 +9684,6 @@ Editor::do_ripple (std::shared_ptr<Playlist> target_playlist, timepos_t const &
if ((*p) == target_playlist) { if ((*p) == target_playlist) {
(*p)->clear_changes ();
(*p)->clear_owned_changes ();
(*p)->ripple (at, distance, exclude); (*p)->ripple (at, distance, exclude);
/* caller may put the target playlist into the undo /* caller may put the target playlist into the undo
@ -9695,9 +9693,7 @@ Editor::do_ripple (std::shared_ptr<Playlist> target_playlist, timepos_t const &
if (add_to_command) { if (add_to_command) {
(*p)->rdiff_and_add_command (_session); (*p)->rdiff_and_add_command (_session);
} }
} else { } else if (affected_pls.find (*p) == affected_pls.end ()) {
/* all other playlists: do the ripple, and save to undo/redo */
(*p)->clear_changes (); (*p)->clear_changes ();
(*p)->clear_owned_changes (); (*p)->clear_owned_changes ();
(*p)->ripple (at, distance, 0); (*p)->ripple (at, distance, 0);