+Mixer_UI::reset_remote_control_ids ()
+{
+ if (Config->get_remote_model() == UserOrdered || !_session || _session->deletion_in_progress()) {
+ return;
+ }
+
+ TreeModel::Children rows = track_model->children();
+
+ if (rows.empty()) {
+ return;
+ }
+
+ DEBUG_TRACE (DEBUG::OrderKeys, "mixer resets remote control ids after remote model change\n");
+
+ TreeModel::Children::iterator ri;
+ bool rid_change = false;
+ uint32_t rid = 1;
+ uint32_t invisible_key = UINT32_MAX;
+
+ for (ri = rows.begin(); ri != rows.end(); ++ri) {
+ boost::shared_ptr<Route> route = (*ri)[track_columns.route];
+ bool visible = (*ri)[track_columns.visible];
+
+ if (!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_explicit (new_rid);
+ rid_change = true;
+ }
+
+ if (visible) {
+ rid++;
+ }
+ }
+ }
+
+ if (rid_change) {
+ /* tell the world that we changed the remote control IDs */
+ _session->notify_remote_id_change ();
+ }
+}
+
+void
+Mixer_UI::sync_order_keys_from_treeview ()