From 6949d3ea622fc1b45e25a51f5eee18406e6a930d Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Mon, 2 May 2011 23:53:10 +0000 Subject: [PATCH] Sort bundle names in mixer strip menus alphabetically to prevent them being re-ordered when the session's route list is sorted for signal flow (#4021). git-svn-id: svn://localhost/ardour2/branches/3.0@9461 d708f5d6-7413-0410-9779-e7cbd77b26cf --- gtk2_ardour/mixer_strip.cc | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/gtk2_ardour/mixer_strip.cc b/gtk2_ardour/mixer_strip.cc index 9b69243c58..115b818790 100644 --- a/gtk2_ardour/mixer_strip.cc +++ b/gtk2_ardour/mixer_strip.cc @@ -622,6 +622,12 @@ MixerStrip::set_packed (bool yn) } +struct RouteCompareByName { + bool operator() (boost::shared_ptr a, boost::shared_ptr 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 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 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); }