diff options
author | nick_m <mainsbridge@gmail.com> | 2013-10-24 01:27:13 +1100 |
---|---|---|
committer | nick_m <mainsbridge@gmail.com> | 2013-10-24 01:27:13 +1100 |
commit | be69bf15dd2fbc414b35aa84167b863caf6d7677 (patch) | |
tree | 809ff4484f8d70960494bd664b293aad4a54f266 /gtk2_ardour/ardour_ui.cc | |
parent | 75271a17d8d4ed0003c4627e80a28feb68f5d9c9 (diff) |
New routes are placed after highest selected route.
Diffstat (limited to 'gtk2_ardour/ardour_ui.cc')
-rw-r--r-- | gtk2_ardour/ardour_ui.cc | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/gtk2_ardour/ardour_ui.cc b/gtk2_ardour/ardour_ui.cc index e3c446ecc2..46308fed98 100644 --- a/gtk2_ardour/ardour_ui.cc +++ b/gtk2_ardour/ardour_ui.cc @@ -3223,6 +3223,51 @@ ARDOUR_UI::flush_trash () } void +ARDOUR_UI::setup_order_hint () +{ + uint32_t order_hint = 0; + + /* + we want the new routes to have their order keys set starting from + the highest order key in the selection + 1 (if available). + */ + + 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(); + } + } + + for (TrackSelection::iterator s = editor->get_selection().tracks.begin(); s != editor->get_selection().tracks.end(); ++s) { + RouteTimeAxisView* tav = dynamic_cast<RouteTimeAxisView*> (*s); + if (tav->route()->order_key() > order_hint) { + order_hint = tav->route()->order_key(); + } + } + + if (!mixer->selection().routes.empty() || !editor->get_selection().tracks.empty()) { + order_hint++; + } + + _session->set_order_hint (order_hint); + + /* create a gap in the existing route order keys to accomodate new routes.*/ + + boost::shared_ptr <RouteList> rd = _session->get_routes(); + for (RouteList::iterator ri = rd->begin(); ri != rd->end(); ++ri) { + boost::shared_ptr<Route> rt (*ri); + + if (rt->is_monitor()) { + continue; + } + + if (rt->order_key () >= order_hint) { + rt->set_order_key (rt->order_key () + add_route_dialog->count()); + } + } +} + +void ARDOUR_UI::add_route (Gtk::Window* float_window) { int count; @@ -3256,6 +3301,8 @@ ARDOUR_UI::add_route (Gtk::Window* float_window) return; } + setup_order_hint(); + PBD::ScopedConnection idle_connection; if (count > 8) { |