Speed up track deletion when Editor-Mixer is visible
authorRobin Gareus <robin@gareus.org>
Mon, 28 Nov 2016 14:36:04 +0000 (15:36 +0100)
committerRobin Gareus <robin@gareus.org>
Mon, 28 Nov 2016 14:36:04 +0000 (15:36 +0100)
gtk2_ardour/editor_ops.cc

index 643780a490ea4abd3559d7e111b656f099810a67..25d1c7376667e32c7051281f5dd16ab042c8c52b 100644 (file)
@@ -7388,6 +7388,23 @@ edit your ardour.rc file to set the\n\
                return;
        }
 
+       if (current_mixer_strip && routes.size () > 1 && std::find (routes.begin(), routes.end(), current_mixer_strip->route()) != routes.end ()) {
+               /* Route deletion calls Editor::timeaxisview_deleted() iteratively (for each deleted
+                * route). If the deleted route is currently displayed in the Editor-Mixer (highly
+                * likely because deletion requires selection) this will call
+                * Editor::set_selected_mixer_strip () which is expensive ( MixerStrip::set_route() ).
+                * It's likewise likely that the route that has just been displayed in the
+                * Editor-Mixer will be next in line for deletion.
+                *
+                * So simply switch to the master-bus (if present)
+                */
+               for (TrackViewList::iterator i = track_views.begin(); i != track_views.end(); ++i) {
+                       if ((*i)->stripable ()->is_master ()) {
+                               set_selected_mixer_strip (*(*i));
+                               break;
+                       }
+               }
+       }
 
        Mixer_UI::instance()->selection().block_routes_changed (true);
        selection->block_tracks_changed (true);