13
0

now that there is only 1 effective selection, adjust add-new-track-or-bus option for after/before selection

This commit is contained in:
Paul Davis 2015-04-13 22:24:10 -04:00
parent 05cd32a9f0
commit d45620d636
3 changed files with 27 additions and 34 deletions

View File

@ -81,8 +81,8 @@ AddRouteDialog::AddRouteDialog ()
track_bus_combo.set_active (0);
insert_at_combo.append_text (_("First"));
insert_at_combo.append_text (_("After Editor Selection"));
insert_at_combo.append_text (_("After Mixer Selection"));
insert_at_combo.append_text (_("Before Selection"));
insert_at_combo.append_text (_("After Selection"));
insert_at_combo.append_text (_("Last"));
insert_at_combo.set_active (1);
@ -558,10 +558,10 @@ AddRouteDialog::insert_at ()
if (str == _("First")) {
return First;
} else if (str == _("After Editor Selection")) {
return EditorSelection;
} else if (str == _("After Mixer Selection")){
return MixerSelection;
} else if (str == _("After Selection")) {
return AfterSelection;
} else if (str == _("Before Selection")){
return BeforeSelection;
}
return Last;
}

View File

@ -68,8 +68,8 @@ class AddRouteDialog : public ArdourDialog
ARDOUR::TrackMode mode();
ARDOUR::RouteGroup* route_group ();
enum InsertAt {
EditorSelection,
MixerSelection,
BeforeSelection,
AfterSelection,
First,
Last
};

View File

@ -3499,43 +3499,36 @@ ARDOUR_UI::flush_trash ()
void
ARDOUR_UI::setup_order_hint (AddRouteDialog::InsertAt place)
{
uint32_t order_hint = 0;
uint32_t order_hint = UINT32_MAX;
if (editor->get_selection().tracks.empty()) {
return;
}
/*
we want the new routes to have their order keys set starting from
the highest order key in the selection + 1 (if available).
*/
if (place == AddRouteDialog::MixerSelection) {
for (RouteUISelection::iterator s = mixer->selection().routes.begin(); s != mixer->selection().routes.end(); ++s) {
if ((*s)->route()->order_key() > order_hint) {
order_hint = (*s)->route()->order_key();
}
}
if (!mixer->selection().routes.empty()) {
if (place == AddRouteDialog::AfterSelection) {
RouteTimeAxisView *rtav = dynamic_cast<RouteTimeAxisView*> (editor->get_selection().tracks.back());
if (rtav) {
order_hint = rtav->route()->order_key();
order_hint++;
} else {
return;
}
} else if (place == AddRouteDialog::EditorSelection){
for (TrackSelection::iterator s = editor->get_selection().tracks.begin(); s != editor->get_selection().tracks.end(); ++s) {
RouteTimeAxisView* tav = dynamic_cast<RouteTimeAxisView*> (*s);
if (tav && tav->route() && tav->route()->order_key() > order_hint) {
order_hint = tav->route()->order_key();
}
} else if (place == AddRouteDialog::BeforeSelection) {
RouteTimeAxisView *rtav = dynamic_cast<RouteTimeAxisView*> (editor->get_selection().tracks.front());
if (rtav) {
order_hint = rtav->route()->order_key();
}
if (!editor->get_selection().tracks.empty()) {
order_hint++;
} else {
return;
}
} else if (place == AddRouteDialog::First) {
order_hint = 0;
} else {
/** AddRouteDialog::Last
/* leave order_hint at UINT32_MAX */
}
if (order_hint == UINT32_MAX) {
/** AddRouteDialog::Last or selection with first/last not a RouteTimeAxisView
* not setting an order hint will place new routes last.
*/
return;