13
0

Fix initial order-keys when creating tracks/busses

.. and leave some notes for the day when UI treemodel won't be canonical
to set order-keys.
This commit is contained in:
Robin Gareus 2017-02-17 00:50:52 +01:00
parent 91cee14ca6
commit d0e3eb42a6

View File

@ -3484,6 +3484,16 @@ Session::add_routes_inner (RouteList& new_routes, bool input_auto_connect, bool
}
}
/* auditioner and monitor routes are not part of the order */
if (auditioner) {
assert (n_routes > 0);
--n_routes;
}
if (_monitor_out) {
assert (n_routes > 0);
--n_routes;
}
DEBUG_TRACE (DEBUG::OrderKeys, string_compose ("ensure order gap starting at %1 for %2\n", order, new_routes.size()));
ensure_route_presentation_info_gap (order, new_routes.size());
@ -3532,6 +3542,17 @@ Session::add_routes_inner (RouteList& new_routes, bool input_auto_connect, bool
/* presentation info order may already have been set from XML */
if (!r->presentation_info().order_set()) {
/* this is only useful for headless sessions,
* Editor::add_routes() and Mixer_UI::add_routes() will
* override it following the RouteAdded signal.
*
* Also routes should be sorted before VCAs (like the GUI does).
* Session::ensure_route_presentation_info_gap() does not special case VCAs either.
*
* ... but not to worry, the GUI's
* gtk2_ardour/route_sorter.h and various ::sync_presentation_info_from_treeview()
* handle this :)
*/
if (order == PresentationInfo::max_order) {
/* just add to the end */