begin_reversible_command (_("remove region"));
playlist->clear_changes ();
+ playlist->clear_owned_changes ();
playlist->remove_region (clicked_regionview->region());
+
+ /* We might have removed regions, which alters other regions' layering_index,
+ so we need to do a recursive diff here.
+ */
+ vector<Command*> cmds;
+ playlist->rdiff (cmds);
+ _session->add_commands (cmds);
+
_session->add_command(new StatefulDiffCommand (playlist));
commit_reversible_command ();
}
playlists.push_back (playlist);
playlist->clear_changes ();
+ playlist->clear_owned_changes ();
playlist->freeze ();
playlist->remove_region (*rl);
}
for (pl = playlists.begin(); pl != playlists.end(); ++pl) {
(*pl)->thaw ();
+
+ /* We might have removed regions, which alters other regions' layering_index,
+ so we need to do a recursive diff here.
+ */
+ vector<Command*> cmds;
+ (*pl)->rdiff (cmds);
+ _session->add_commands (cmds);
+
_session->add_command(new StatefulDiffCommand (*pl));
}
if (fl == freezelist.end()) {
pl->clear_changes();
+ pl->clear_owned_changes ();
pl->freeze ();
freezelist.insert (pl);
}
for (FreezeList::iterator pl = freezelist.begin(); pl != freezelist.end(); ++pl) {
(*pl)->thaw ();
+
+ /* We might have removed regions, which alters other regions' layering_index,
+ so we need to do a recursive diff here.
+ */
+ vector<Command*> cmds;
+ (*pl)->rdiff (cmds);
+ _session->add_commands (cmds);
+
_session->add_command (new StatefulDiffCommand (*pl));
}
}
if (arv->audio_region()->apply (filter, progress) == 0) {
playlist->clear_changes ();
+ playlist->clear_owned_changes ();
if (filter.results.empty ()) {
}
+ /* We might have removed regions, which alters other regions' layering_index,
+ so we need to do a recursive diff here.
+ */
+ vector<Command*> cmds;
+ playlist->rdiff (cmds);
+ _session->add_commands (cmds);
+
_session->add_command(new StatefulDiffCommand (playlist));
} else {
goto out;
AnalysisFeatureList::const_iterator x;
pl->clear_changes ();
+ pl->clear_owned_changes ();
x = positions.begin();
pl->thaw ();
+ /* We might have removed regions, which alters other regions' layering_index,
+ so we need to do a recursive diff here.
+ */
+ vector<Command*> cmds;
+ pl->rdiff (cmds);
+ _session->add_commands (cmds);
+
_session->add_command (new StatefulDiffCommand (pl));
if (select_new) {
PLAYLIST OPERATIONS
*************************************************************/
+/** Note: this calls set_layer (..., DBL_MAX) so it will reset the layering index of region */
void
Playlist::add_region (boost::shared_ptr<Region> region, framepos_t position, float times, bool auto_partition)
{
freeze ();
/* add the added regions */
for (RegionListProperty::ChangeContainer::iterator i = change.added.begin(); i != change.added.end(); ++i) {
- add_region ((*i), (*i)->position());
+ add_region_internal ((*i), (*i)->position());
}
/* remove the removed regions */
for (RegionListProperty::ChangeContainer::iterator i = change.removed.begin(); i != change.removed.end(); ++i) {
copy.insert (i, region);
- /* Then re-write layering indices */
+ setup_layering_indices (copy);
+}
+
+void
+Playlist::setup_layering_indices (RegionList const & regions) const
+{
uint64_t j = 0;
- for (RegionList::iterator k = copy.begin(); k != copy.end(); ++k) {
+ for (RegionList::const_iterator k = regions.begin(); k != regions.end(); ++k) {
(*k)->set_layering_index (j++);
}
}
+
/** Take the layering indices of each of our regions, compute the layers
* that they should be on, and write the layers back to the regions.
*/
if (changed) {
notify_layering_changed ();
}
+
+ /* This relayer() may have been called as a result of a region removal, in which
+ case we need to setup layering indices so account for the one that has just
+ gone away.
+ */
+ setup_layering_indices (copy);
}
void