X-Git-Url: https://git.carlh.net/gitweb/?a=blobdiff_plain;f=gtk2_ardour%2Feditor_routes.cc;h=d0918a026ae3c76812c33eb4204e239c6f9b396f;hb=741f9de3f7dda286181419c33cfe361a4f75c775;hp=242a01358378c03e90ebe6b9f641676ec5b693ff;hpb=e43d91949be2fedf09eaf61cb5b9e4778a505dc0;p=ardour.git diff --git a/gtk2_ardour/editor_routes.cc b/gtk2_ardour/editor_routes.cc index 242a013583..d0918a026a 100644 --- a/gtk2_ardour/editor_routes.cc +++ b/gtk2_ardour/editor_routes.cc @@ -45,6 +45,7 @@ #include "gui_thread.h" #include "actions.h" #include "utils.h" +#include "route_sorter.h" #include "editor_group_tabs.h" #include "editor_routes.h" @@ -68,6 +69,7 @@ EditorRoutes::EditorRoutes (Editor* e) : EditorComponent (e) , _ignore_reorder (false) , _no_redisplay (false) + , _adding_routes (false) , _menu (0) , old_focus (0) , selection_countdown (0) @@ -221,7 +223,7 @@ EditorRoutes::EditorRoutes (Editor* e) _display.get_selection()->set_mode (SELECTION_SINGLE); _display.get_selection()->set_select_function (sigc::mem_fun (*this, &EditorRoutes::selection_filter)); _display.set_reorderable (true); - _display.set_name (X_("MixerTrackDisplayList")); + _display.set_name (X_("EditGroupList")); _display.set_rules_hint (true); _display.set_size_request (100, -1); _display.add_object_drag (_columns.route.index(), "routes"); @@ -599,9 +601,12 @@ void EditorRoutes::routes_added (list routes) { TreeModel::Row row; + PBD::Unwinder at (_adding_routes, true); suspend_redisplay (); + _display.set_model (Glib::RefPtr()); + for (list::iterator x = routes.begin(); x != routes.end(); ++x) { boost::shared_ptr midi_trk = boost::dynamic_pointer_cast ((*x)->route()); @@ -652,6 +657,7 @@ EditorRoutes::routes_added (list routes) (*x)->route()->solo_isolated_changed.connect (*this, MISSING_INVALIDATOR, boost::bind (&EditorRoutes::update_solo_isolate_display, this), gui_context()); (*x)->route()->solo_safe_changed.connect (*this, MISSING_INVALIDATOR, boost::bind (&EditorRoutes::update_solo_safe_display, this), gui_context()); (*x)->route()->active_changed.connect (*this, MISSING_INVALIDATOR, boost::bind (&EditorRoutes::update_active_display, this), gui_context ()); + } update_rec_display (); @@ -661,7 +667,9 @@ EditorRoutes::routes_added (list routes) update_solo_safe_display (); update_input_active_display (); update_active_display (); + resume_redisplay (); + _display.set_model (_model); /* now update route order keys from the treeview/track display order */ @@ -671,7 +679,9 @@ EditorRoutes::routes_added (list routes) void EditorRoutes::handle_gui_changes (string const & what, void*) { - ENSURE_GUI_THREAD (*this, &EditorRoutes::handle_gui_changes, what, src) + if (_adding_routes) { + return; + } if (what == "track_height") { /* Optional :make tracks change height while it happens, instead @@ -961,21 +971,30 @@ EditorRoutes::sync_treeview_from_order_keys (RouteSortOrderKey src) return; } - neworder.assign (rows.size(), 0); + OrderKeySortedRoutes sorted_routes; for (TreeModel::Children::iterator ri = rows.begin(); ri != rows.end(); ++ri, ++old_order) { boost::shared_ptr route = (*ri)[_columns.route]; - uint32_t new_order = route->order_key (EditorSort); - - DEBUG_TRACE (DEBUG::OrderKeys, string_compose ("EDITOR change order for %1 from %2 to %3\n", - route->name(), old_order, new_order)); - - neworder[new_order] = old_order; + sorted_routes.push_back (RoutePlusOrderKey (route, old_order, route->order_key (EditorSort))); + } + + SortByNewDisplayOrder cmp; - if (old_order != new_order) { + sort (sorted_routes.begin(), sorted_routes.end(), cmp); + neworder.assign (sorted_routes.size(), 0); + + uint32_t n = 0; + + for (OrderKeySortedRoutes::iterator sr = sorted_routes.begin(); sr != sorted_routes.end(); ++sr, ++n) { + + neworder[n] = sr->old_display_order; + + if (sr->old_display_order != n) { changed = true; } + DEBUG_TRACE (DEBUG::OrderKeys, string_compose ("EDITOR change order for %1 from %2 to %3\n", + sr->route->name(), sr->old_display_order, n)); } if (changed) { @@ -1032,6 +1051,7 @@ EditorRoutes::set_all_tracks_visibility (bool yn) continue; } + tv->set_marked_for_display (yn); (*i)[_columns.visible] = yn; } @@ -1187,10 +1207,12 @@ EditorRoutes::key_press (GdkEventKey* ev) break; case 's': - if (Config->get_solo_control_is_listen_control()) { - _session->set_listen (rl, !rl->front()->listening_via_monitor(), Session::rt_cleanup); - } else { - _session->set_solo (rl, !rl->front()->self_soloed(), Session::rt_cleanup); + if (get_relevant_routes (rl)) { + if (Config->get_solo_control_is_listen_control()) { + _session->set_listen (rl, !rl->front()->listening_via_monitor(), Session::rt_cleanup); + } else { + _session->set_solo (rl, !rl->front()->self_soloed(), Session::rt_cleanup); + } } return true; break;