mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-07 15:25:01 +01:00
make sure that when extending the selection in the editor and mixer, the clicked-upon track gets set_selected() called last
This makes it be the "first" selected strip for control surfaces and the editor mixer
This commit is contained in:
parent
f64441aa58
commit
7cd70e0c91
2 changed files with 29 additions and 13 deletions
|
|
@ -89,10 +89,6 @@ Editor::extend_selection_to_track (TimeAxisView& view)
|
||||||
|
|
||||||
sorted.sort (cmp);
|
sorted.sort (cmp);
|
||||||
|
|
||||||
if (!selection->selected (&view)) {
|
|
||||||
to_be_added.push_back (&view);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* figure out if we should go forward or backwards */
|
/* figure out if we should go forward or backwards */
|
||||||
|
|
||||||
for (TrackViewList::iterator i = sorted.begin(); i != sorted.end(); ++i) {
|
for (TrackViewList::iterator i = sorted.begin(); i != sorted.end(); ++i) {
|
||||||
|
|
@ -158,6 +154,10 @@ Editor::extend_selection_to_track (TimeAxisView& view)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!selection->selected (&view)) {
|
||||||
|
to_be_added.push_back (&view);
|
||||||
|
}
|
||||||
|
|
||||||
if (!to_be_added.empty()) {
|
if (!to_be_added.empty()) {
|
||||||
selection->add (to_be_added);
|
selection->add (to_be_added);
|
||||||
return true;
|
return true;
|
||||||
|
|
@ -981,19 +981,33 @@ Editor::set_selected_regionview_from_map_event (GdkEventAny* /*ev*/, StreamView*
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
struct SelectionOrderSorter {
|
||||||
|
bool operator() (TimeAxisView const * const a, TimeAxisView const * const b) const {
|
||||||
|
boost::shared_ptr<Stripable> sa = a->stripable ();
|
||||||
|
boost::shared_ptr<Stripable> sb = b->stripable ();
|
||||||
|
if (!sa && !sb) {
|
||||||
|
return a < b;
|
||||||
|
}
|
||||||
|
if (!sa) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (!sb) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return sa->presentation_info().selection_cnt() < sb->presentation_info().selection_cnt();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
void
|
void
|
||||||
Editor::track_selection_changed ()
|
Editor::track_selection_changed ()
|
||||||
{
|
{
|
||||||
|
SelectionOrderSorter cmp;
|
||||||
|
selection->tracks.sort (cmp);
|
||||||
|
|
||||||
switch (selection->tracks.size()) {
|
switch (selection->tracks.size()) {
|
||||||
case 0:
|
case 0:
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
/* last element in selection list is the most recently
|
|
||||||
* selected, because we always append to that list.
|
|
||||||
*/
|
|
||||||
cerr << "setting selected mixer strip to "
|
|
||||||
<< selection->tracks.back()->name()
|
|
||||||
<< endl;
|
|
||||||
set_selected_mixer_strip (*(selection->tracks.back()));
|
set_selected_mixer_strip (*(selection->tracks.back()));
|
||||||
if (!_track_selection_change_without_scroll) {
|
if (!_track_selection_change_without_scroll) {
|
||||||
ensure_time_axis_view_is_visible (*(selection->tracks.back()), false);
|
ensure_time_axis_view_is_visible (*(selection->tracks.back()), false);
|
||||||
|
|
|
||||||
|
|
@ -928,8 +928,6 @@ Mixer_UI::strip_button_release_event (GdkEventButton *ev, MixerStrip *strip)
|
||||||
bool accumulate = false;
|
bool accumulate = false;
|
||||||
bool found_another = false;
|
bool found_another = false;
|
||||||
|
|
||||||
tmp.push_back (strip);
|
|
||||||
|
|
||||||
OrderingKeys sorted;
|
OrderingKeys sorted;
|
||||||
const size_t cmp_max = strips.size ();
|
const size_t cmp_max = strips.size ();
|
||||||
for (list<MixerStrip*>::iterator i = strips.begin(); i != strips.end(); ++i) {
|
for (list<MixerStrip*>::iterator i = strips.begin(); i != strips.end(); ++i) {
|
||||||
|
|
@ -970,12 +968,16 @@ Mixer_UI::strip_button_release_event (GdkEventButton *ev, MixerStrip *strip)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
tmp.push_back (strip);
|
||||||
|
|
||||||
if (found_another) {
|
if (found_another) {
|
||||||
|
PresentationInfo::ChangeSuspender cs;
|
||||||
for (vector<MixerStrip*>::iterator i = tmp.begin(); i != tmp.end(); ++i) {
|
for (vector<MixerStrip*>::iterator i = tmp.begin(); i != tmp.end(); ++i) {
|
||||||
_selection.add (*i);
|
_selection.add (*i);
|
||||||
}
|
}
|
||||||
} else
|
} else {
|
||||||
_selection.set (strip); //user wants to start a range selection, but there aren't any others selected yet
|
_selection.set (strip); //user wants to start a range selection, but there aren't any others selected yet
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
_selection.set (strip);
|
_selection.set (strip);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue