summaryrefslogtreecommitdiff
path: root/gtk2_ardour/selection.cc
diff options
context:
space:
mode:
authorTim Mayberry <mojofunk@gmail.com>2017-04-23 21:32:09 +1000
committerTim Mayberry <mojofunk@gmail.com>2017-04-24 08:41:30 +1000
commit1b2bc203ac42ef19560b4d103cb5e2cc03b4f1cc (patch)
tree644566b1a97c860904fa8fad8f4f09db98856fb9 /gtk2_ardour/selection.cc
parent68883cbb56763a8d414dd1a74749c7cf91c8f41d (diff)
Add regions at once rather than individually when restoring Selection state
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
Diffstat (limited to 'gtk2_ardour/selection.cc')
-rw-r--r--gtk2_ardour/selection.cc7
1 files changed, 6 insertions, 1 deletions
diff --git a/gtk2_ardour/selection.cc b/gtk2_ardour/selection.cc
index b7230ad7e1..1114222248 100644
--- a/gtk2_ardour/selection.cc
+++ b/gtk2_ardour/selection.cc
@@ -1387,6 +1387,8 @@ Selection::set_state (XMLNode const & node, int)
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) {
@@ -1411,7 +1413,7 @@ Selection::set_state (XMLNode const & node, int)
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
@@ -1571,6 +1573,9 @@ Selection::set_state (XMLNode const & node, int)
}
+ // now add regions to selection at once
+ add (selected_regions);
+
return 0;
}