Sort bundle names in mixer strip menus alphabetically to prevent them being re-ordere...
authorCarl Hetherington <carl@carlh.net>
Mon, 2 May 2011 23:53:10 +0000 (23:53 +0000)
committerCarl Hetherington <carl@carlh.net>
Mon, 2 May 2011 23:53:10 +0000 (23:53 +0000)
git-svn-id: svn://localhost/ardour2/branches/3.0@9461 d708f5d6-7413-0410-9779-e7cbd77b26cf

gtk2_ardour/mixer_strip.cc

index 9b69243c5897a1a576d0bcd751d814d80516c355..115b81879029461e409b68e5f50b6255848bcb21 100644 (file)
@@ -622,6 +622,12 @@ MixerStrip::set_packed (bool yn)
 }
 
 
+struct RouteCompareByName {
+       bool operator() (boost::shared_ptr<Route> a, boost::shared_ptr<Route> b) {
+               return a->name().compare (b->name()) < 0;
+       }
+};
+
 gint
 MixerStrip::output_press (GdkEventButton *ev)
 {
@@ -667,7 +673,9 @@ MixerStrip::output_press (GdkEventButton *ev)
                }
                
                boost::shared_ptr<ARDOUR::RouteList> routes = _session->get_routes ();
-               for (ARDOUR::RouteList::const_iterator i = routes->begin(); i != routes->end(); ++i) {
+               RouteList copy = *routes;
+               copy.sort (RouteCompareByName ());
+               for (ARDOUR::RouteList::const_iterator i = copy.begin(); i != copy.end(); ++i) {
                        maybe_add_bundle_to_output_menu ((*i)->input()->bundle(), current);
                }
 
@@ -777,7 +785,9 @@ MixerStrip::input_press (GdkEventButton *ev)
                }
                
                boost::shared_ptr<ARDOUR::RouteList> routes = _session->get_routes ();
-               for (ARDOUR::RouteList::const_iterator i = routes->begin(); i != routes->end(); ++i) {
+               RouteList copy = *routes;
+               copy.sort (RouteCompareByName ());
+               for (ARDOUR::RouteList::const_iterator i = copy.begin(); i != copy.end(); ++i) {
                        maybe_add_bundle_to_input_menu ((*i)->output()->bundle(), current);
                }