diff options
author | Paul Davis <paul@linuxaudiosystems.com> | 2015-04-13 22:24:10 -0400 |
---|---|---|
committer | Paul Davis <paul@linuxaudiosystems.com> | 2015-04-13 22:24:10 -0400 |
commit | d45620d6365302d3ced17eff9a271ad2c5672632 (patch) | |
tree | 22f94bf2a3a6fdc1c0b18cf8caeab2685db80296 | |
parent | 05cd32a9f01cfac9cc272b0e518ac7268f6e7f2e (diff) |
now that there is only 1 effective selection, adjust add-new-track-or-bus option for after/before selection
-rw-r--r-- | gtk2_ardour/add_route_dialog.cc | 12 | ||||
-rw-r--r-- | gtk2_ardour/add_route_dialog.h | 4 | ||||
-rw-r--r-- | gtk2_ardour/ardour_ui.cc | 45 |
3 files changed, 27 insertions, 34 deletions
diff --git a/gtk2_ardour/add_route_dialog.cc b/gtk2_ardour/add_route_dialog.cc index 990a84ba88..53fbe613c6 100644 --- a/gtk2_ardour/add_route_dialog.cc +++ b/gtk2_ardour/add_route_dialog.cc @@ -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; } diff --git a/gtk2_ardour/add_route_dialog.h b/gtk2_ardour/add_route_dialog.h index c4a3f1754e..1f7fa65d7e 100644 --- a/gtk2_ardour/add_route_dialog.h +++ b/gtk2_ardour/add_route_dialog.h @@ -68,8 +68,8 @@ class AddRouteDialog : public ArdourDialog ARDOUR::TrackMode mode(); ARDOUR::RouteGroup* route_group (); enum InsertAt { - EditorSelection, - MixerSelection, + BeforeSelection, + AfterSelection, First, Last }; diff --git a/gtk2_ardour/ardour_ui.cc b/gtk2_ardour/ardour_ui.cc index 735d5e4e01..0b978a9a42 100644 --- a/gtk2_ardour/ardour_ui.cc +++ b/gtk2_ardour/ardour_ui.cc @@ -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; |