improve rippling of marks to include any in the gap between the primary-dragged region and the one before it

This commit is contained in:
Paul Davis
2021-06-16 19:27:30 -06:00
parent fc5143772b
commit ac1d5bac0a
4 changed files with 69 additions and 46 deletions

View File

@@ -1616,47 +1616,50 @@ Locations::range_starts_at(samplepos_t pos, samplecnt_t slop, bool incl) const
void
Locations::ripple (samplepos_t at, samplecnt_t distance, bool include_locked, bool notify)
{
LocationList copy;
{
Glib::Threads::RWLock::WriterLock lm (_lock);
copy = locations;
}
for (LocationList::iterator i = locations.begin(); i != locations.end(); ++i) {
for (LocationList::iterator i = copy.begin(); i != copy.end(); ++i) {
/* keep session range markers covering entire region if
a ripple "extends" the session.
*/
if (distance > 0 && (*i)->is_session_range()) {
/* keep session range markers covering entire region if
a ripple "extends" the session.
*/
if (distance > 0 && (*i)->is_session_range()) {
/* Don't move start unless it occurs after the ripple point.
*/
if ((*i)->start() >= at) {
(*i)->set ((*i)->start() + distance, (*i)->end() + distance);
} else {
(*i)->set_end ((*i)->end() + distance);
}
/* Don't move start unless it occurs after the ripple point.
*/
if ((*i)->start() >= at) {
(*i)->set ((*i)->start() + distance, (*i)->end() + distance);
} else {
(*i)->set_end ((*i)->end() + distance);
}
continue;
}
bool locked = (*i)->locked();
if (locked) {
if (!include_locked) {
continue;
}
} else {
(*i)->unlock ();
}
bool locked = (*i)->locked();
if ((*i)->start() >= at) {
(*i)->set_start ((*i)->start() + distance);
if (locked) {
if (!include_locked) {
continue;
}
} else {
(*i)->unlock ();
if (!(*i)->is_mark()) {
(*i)->set_end ((*i)->end() + distance);
}
}
if ((*i)->start() >= at) {
(*i)->set_start ((*i)->start() + distance);
if (!(*i)->is_mark()) {
(*i)->set_end ((*i)->end() + distance);
}
}
if (locked) {
(*i)->lock();
}
if (locked) {
(*i)->lock();
}
}