make Selection::set (TrackViewList*) more efficient and emit less PI::Change signals
This commit is contained in:
parent
e653da32c0
commit
5456fd5717
@ -830,46 +830,29 @@ Selection::set (const TrackViewList& track_list)
|
|||||||
{
|
{
|
||||||
clear_objects(); //enforce object/range exclusivity
|
clear_objects(); //enforce object/range exclusivity
|
||||||
|
|
||||||
PresentationInfo::ChangeSuspender cs;
|
|
||||||
|
|
||||||
if (!tracks.empty()) {
|
TrackViewList to_be_added;
|
||||||
|
TrackViewList to_be_removed;
|
||||||
|
|
||||||
/* cannot use set<T>::operator== (set<T> const &) here, because
|
for (TrackViewList::const_iterator x = tracks.begin(); x != tracks.end(); ++x) {
|
||||||
* apparently the ordering used within 2 sets is not
|
if (find (track_list.begin(), track_list.end(), *x) == track_list.end()) {
|
||||||
* necessarily the same.
|
to_be_removed.push_back (*x);
|
||||||
*/
|
}
|
||||||
|
}
|
||||||
if (tracks.size() == track_list.size()) {
|
|
||||||
bool missing = false;
|
|
||||||
|
|
||||||
for (TrackViewList::const_iterator x = track_list.begin(); x != track_list.end(); ++x) {
|
for (TrackViewList::const_iterator x = track_list.begin(); x != track_list.end(); ++x) {
|
||||||
if (dynamic_cast<VCATimeAxisView*> (*x)) {
|
if (dynamic_cast<VCATimeAxisView*> (*x)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (find (tracks.begin(), tracks.end(), *x) == tracks.end()) {
|
if (find (tracks.begin(), tracks.end(), *x) == tracks.end()) {
|
||||||
missing = true;
|
to_be_added.push_back (*x);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!missing) {
|
PresentationInfo::ChangeSuspender cs;
|
||||||
/* already same selection: nothing to do */
|
remove (to_be_removed);
|
||||||
return;
|
add (to_be_added);
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* argument is different from existing selection */
|
|
||||||
|
|
||||||
for (TrackViewList::iterator x = tracks.begin(); x != tracks.end(); ++x) {
|
|
||||||
if (dynamic_cast<VCATimeAxisView*> (*x)) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
(*x)->set_selected (false);
|
|
||||||
}
|
|
||||||
|
|
||||||
tracks.clear ();
|
|
||||||
}
|
|
||||||
|
|
||||||
add (track_list);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
Loading…
Reference in New Issue
Block a user