This is a workaround for performance issues with the current implementation
when adding many regions to the selection one at a time.
If the Selection implementation was to change at some point and adding regions
to the selection only takes a small constant amount of time, then this
optimization may no longer be necessary.
Related to: #7274
clear_tracks ();
clear_markers ();
+ RegionSelection selected_regions;
+
PBD::ID id;
XMLNodeList children = node.children ();
for (XMLNodeList::const_iterator i = children.begin(); i != children.end(); ++i) {
editor->get_regionviews_by_id (id, rs);
if (!rs.empty ()) {
- add (rs);
+ selected_regions.insert (selected_regions.end(), rs.begin(), rs.end());
} else {
/*
regionviews haven't been constructed - stash the region IDs
}
+ // now add regions to selection at once
+ add (selected_regions);
+
return 0;
}