From 5b62e88fbf1022a48c50c9975c2a81a05ecdbb0c Mon Sep 17 00:00:00 2001 From: nick_m Date: Mon, 21 Oct 2013 00:19:43 +1100 Subject: Unify editor / mixer ordering. --- gtk2_ardour/editor_routes.cc | 50 +++++++++++++------------------------------- 1 file changed, 15 insertions(+), 35 deletions(-) (limited to 'gtk2_ardour/editor_routes.cc') diff --git a/gtk2_ardour/editor_routes.cc b/gtk2_ardour/editor_routes.cc index d0918a026a..a10e22f306 100644 --- a/gtk2_ardour/editor_routes.cc +++ b/gtk2_ardour/editor_routes.cc @@ -284,7 +284,7 @@ EditorRoutes::EditorRoutes (Editor* e) _display.set_enable_search (false); - Route::SyncOrderKeys.connect (*this, MISSING_INVALIDATOR, boost::bind (&EditorRoutes::sync_treeview_from_order_keys, this, _1), gui_context()); + Route::SyncOrderKeys.connect (*this, MISSING_INVALIDATOR, boost::bind (&EditorRoutes::sync_treeview_from_order_keys, this), gui_context()); } bool @@ -812,7 +812,7 @@ EditorRoutes::show_track_in_display (TimeAxisView& tv) void EditorRoutes::reset_remote_control_ids () { - if (Config->get_remote_model() != EditorOrdered || !_session || _session->deletion_in_progress()) { + if (Config->get_remote_model() == UserOrdered || !_session || _session->deletion_in_progress()) { return; } @@ -841,7 +841,7 @@ EditorRoutes::reset_remote_control_ids () uint32_t new_rid = (visible ? rid : invisible_key--); if (new_rid != route->remote_control_id()) { - route->set_remote_control_id_from_order_key (EditorSort, new_rid); + route->set_remote_control_id_explicit (new_rid); rid_change = true; } @@ -887,20 +887,20 @@ EditorRoutes::sync_order_keys_from_treeview () boost::shared_ptr route = (*ri)[_columns.route]; bool visible = (*ri)[_columns.visible]; - uint32_t old_key = route->order_key (EditorSort); + uint32_t old_key = route->order_key (); if (order != old_key) { - route->set_order_key (EditorSort, order); + route->set_order_key (order); changed = true; } - if ((Config->get_remote_model() == EditorOrdered) && !route->is_master() && !route->is_monitor()) { + if ((Config->get_remote_model() == MixerOrdered) && !route->is_master() && !route->is_monitor()) { uint32_t new_rid = (visible ? rid : invisible_key--); if (new_rid != route->remote_control_id()) { - route->set_remote_control_id_from_order_key (EditorSort, new_rid); + route->set_remote_control_id_explicit (new_rid); rid_change = true; } @@ -915,7 +915,7 @@ EditorRoutes::sync_order_keys_from_treeview () if (changed) { /* tell the world that we changed the editor sort keys */ - _session->sync_order_keys (EditorSort); + _session->sync_order_keys (); } if (rid_change) { @@ -925,37 +925,17 @@ EditorRoutes::sync_order_keys_from_treeview () } void -EditorRoutes::sync_treeview_from_order_keys (RouteSortOrderKey src) +EditorRoutes::sync_treeview_from_order_keys () { - /* Some route order key(s) for `src' has been changed, make sure that + /* Some route order key(s) have been changed, make sure that we update out tree/list model and GUI to reflect the change. */ - if (!_session || _session->deletion_in_progress()) { + if (_ignore_reorder || !_session || _session->deletion_in_progress()) { return; } - DEBUG_TRACE (DEBUG::OrderKeys, string_compose ("editor sync model from order keys, src = %1\n", enum_2_string (src))); - - if (src == MixerSort) { - - if (!Config->get_sync_all_route_ordering()) { - /* mixer sort keys changed - we don't care */ - return; - } - - DEBUG_TRACE (DEBUG::OrderKeys, "reset editor order key to match mixer\n"); - - /* mixer sort keys were changed, update the editor sort - * keys since "sync mixer+editor order" is enabled. - */ - - boost::shared_ptr r = _session->get_routes (); - - for (RouteList::iterator i = r->begin(); i != r->end(); ++i) { - (*i)->sync_order_keys (src); - } - } + DEBUG_TRACE (DEBUG::OrderKeys, "editor sync model from order keys.\n"); /* we could get here after either a change in the Mixer or Editor sort * order, but either way, the mixer order keys reflect the intended @@ -975,7 +955,7 @@ EditorRoutes::sync_treeview_from_order_keys (RouteSortOrderKey src) for (TreeModel::Children::iterator ri = rows.begin(); ri != rows.end(); ++ri, ++old_order) { boost::shared_ptr route = (*ri)[_columns.route]; - sorted_routes.push_back (RoutePlusOrderKey (route, old_order, route->order_key (EditorSort))); + sorted_routes.push_back (RoutePlusOrderKey (route, old_order, route->order_key ())); } SortByNewDisplayOrder cmp; @@ -1341,7 +1321,7 @@ struct EditorOrderRouteSorter { /* everything else before master */ return false; } - return a->order_key (EditorSort) < b->order_key (EditorSort); + return a->order_key () < b->order_key (); } }; @@ -1501,7 +1481,7 @@ EditorRoutes::move_selected_tracks (bool up) } for (leading = view_routes.begin(); leading != view_routes.end(); ++leading) { - uint32_t order = leading->second->order_key (EditorSort); + uint32_t order = leading->second->order_key (); neworder.push_back (order); } -- cgit v1.2.3