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.
This commit is contained in:
Robin Gareus 2021-04-29 22:56:09 +02:00
parent 2c64736604
commit 7a89d56009
Signed by: rgareus
GPG Key ID: A090BCE02CF57F04
1 changed files with 13 additions and 2 deletions

View File

@ -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<RegionList> rl = playlist->regions_with_start_within (Evoral::Range<samplepos_t>(_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 ();