ensure that track selection operations call ::set_selected() for tracks, allowing faster lookups of selected status during drags
This commit is contained in:
parent
aff595c739
commit
9ba2c04820
@ -125,6 +125,9 @@ void
|
|||||||
Selection::clear_tracks ()
|
Selection::clear_tracks ()
|
||||||
{
|
{
|
||||||
if (!tracks.empty()) {
|
if (!tracks.empty()) {
|
||||||
|
for (TrackViewList::iterator x = tracks.begin(); x != tracks.end(); ++x) {
|
||||||
|
(*x)->set_selected (false);
|
||||||
|
}
|
||||||
tracks.clear ();
|
tracks.clear ();
|
||||||
if (!_no_tracks_changed) {
|
if (!_no_tracks_changed) {
|
||||||
TracksChanged();
|
TracksChanged();
|
||||||
@ -249,8 +252,10 @@ Selection::toggle (TimeAxisView* track)
|
|||||||
TrackSelection::iterator i;
|
TrackSelection::iterator i;
|
||||||
|
|
||||||
if ((i = find (tracks.begin(), tracks.end(), track)) == tracks.end()) {
|
if ((i = find (tracks.begin(), tracks.end(), track)) == tracks.end()) {
|
||||||
|
track->set_selected (true);
|
||||||
tracks.push_back (track);
|
tracks.push_back (track);
|
||||||
} else {
|
} else {
|
||||||
|
track->set_selected (false);
|
||||||
tracks.erase (i);
|
tracks.erase (i);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -392,6 +397,9 @@ Selection::add (const TrackViewList& track_list)
|
|||||||
TrackViewList added = tracks.add (track_list);
|
TrackViewList added = tracks.add (track_list);
|
||||||
|
|
||||||
if (!added.empty()) {
|
if (!added.empty()) {
|
||||||
|
for (TrackViewList::iterator x = added.begin(); x != added.end(); ++x) {
|
||||||
|
(*x)->set_selected (true);
|
||||||
|
}
|
||||||
if (!_no_tracks_changed) {
|
if (!_no_tracks_changed) {
|
||||||
TracksChanged ();
|
TracksChanged ();
|
||||||
}
|
}
|
||||||
@ -402,6 +410,7 @@ void
|
|||||||
Selection::add (TimeAxisView* track)
|
Selection::add (TimeAxisView* track)
|
||||||
{
|
{
|
||||||
TrackViewList tr;
|
TrackViewList tr;
|
||||||
|
track->set_selected (true);
|
||||||
tr.push_back (track);
|
tr.push_back (track);
|
||||||
add (tr);
|
add (tr);
|
||||||
}
|
}
|
||||||
@ -589,6 +598,7 @@ Selection::remove (TimeAxisView* track)
|
|||||||
{
|
{
|
||||||
list<TimeAxisView*>::iterator i;
|
list<TimeAxisView*>::iterator i;
|
||||||
if ((i = find (tracks.begin(), tracks.end(), track)) != tracks.end()) {
|
if ((i = find (tracks.begin(), tracks.end(), track)) != tracks.end()) {
|
||||||
|
track->set_selected (false);
|
||||||
tracks.erase (i);
|
tracks.erase (i);
|
||||||
if (!_no_tracks_changed) {
|
if (!_no_tracks_changed) {
|
||||||
TracksChanged();
|
TracksChanged();
|
||||||
@ -596,15 +606,6 @@ Selection::remove (TimeAxisView* track)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
|
||||||
Selection::remove (ControlPoint* p)
|
|
||||||
{
|
|
||||||
PointSelection::iterator i = find (points.begin(), points.end(), p);
|
|
||||||
if (i != points.end ()) {
|
|
||||||
points.erase (i);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
Selection::remove (const TrackViewList& track_list)
|
Selection::remove (const TrackViewList& track_list)
|
||||||
{
|
{
|
||||||
@ -614,6 +615,7 @@ Selection::remove (const TrackViewList& track_list)
|
|||||||
|
|
||||||
TrackViewList::iterator x = find (tracks.begin(), tracks.end(), *i);
|
TrackViewList::iterator x = find (tracks.begin(), tracks.end(), *i);
|
||||||
if (x != tracks.end()) {
|
if (x != tracks.end()) {
|
||||||
|
(*i)->set_selected (false);
|
||||||
tracks.erase (x);
|
tracks.erase (x);
|
||||||
changed = true;
|
changed = true;
|
||||||
}
|
}
|
||||||
@ -626,6 +628,15 @@ Selection::remove (const TrackViewList& track_list)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
Selection::remove (ControlPoint* p)
|
||||||
|
{
|
||||||
|
PointSelection::iterator i = find (points.begin(), points.end(), p);
|
||||||
|
if (i != points.end ()) {
|
||||||
|
points.erase (i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
Selection::remove (const MidiNoteSelection& midi_list)
|
Selection::remove (const MidiNoteSelection& midi_list)
|
||||||
{
|
{
|
||||||
@ -924,7 +935,7 @@ Selection::selected (Marker* m)
|
|||||||
bool
|
bool
|
||||||
Selection::selected (TimeAxisView* tv)
|
Selection::selected (TimeAxisView* tv)
|
||||||
{
|
{
|
||||||
return find (tracks.begin(), tracks.end(), tv) != tracks.end();
|
return tv->get_selected ();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
|
Loading…
Reference in New Issue
Block a user