Sort session routes before trying to do the group tabs
authorCarl Hetherington <carl@carlh.net>
Mon, 21 Nov 2011 22:38:44 +0000 (22:38 +0000)
committerCarl Hetherington <carl@carlh.net>
Mon, 21 Nov 2011 22:38:44 +0000 (22:38 +0000)
collection; should fix #4500.

git-svn-id: svn://localhost/ardour2/branches/3.0@10749 d708f5d6-7413-0410-9779-e7cbd77b26cf

gtk2_ardour/group_tabs.cc

index c1b6e5142dd52a665f482edef9445df37716c9a4..08dfe539a2179f36433d0a705742993eaae86a20 100644 (file)
@@ -432,13 +432,24 @@ GroupTabs::subgroup (RouteGroup* g, bool aux, Placement placement)
 }
 
 struct CollectSorter {
-       CollectSorter (std::string const & key) : _key (key) {}
+       CollectSorter (string const & key) : _key (key) {}
 
        bool operator () (boost::shared_ptr<Route> a, boost::shared_ptr<Route> b) {
                return a->order_key (_key) < b->order_key (_key);
        }
 
-       std::string _key;
+       string _key;
+};
+
+struct OrderSorter {
+       OrderSorter (string const & key) : _key (key) {}
+       
+       bool operator() (boost::shared_ptr<Route> a, boost::shared_ptr<Route> b) {
+               /* use of ">" forces the correct sort order */
+               return a->order_key (_key) < b->order_key (_key);
+       }
+
+       string _key;
 };
 
 /** Collect all members of a RouteGroup so that they are together in the Editor or Mixer.
@@ -453,6 +464,7 @@ GroupTabs::collect (RouteGroup* g)
 
        RouteList::iterator i = group_routes->begin ();
        boost::shared_ptr<RouteList> routes = _session->get_routes ();
+       routes->sort (OrderSorter (order_key ()));
        RouteList::const_iterator j = routes->begin ();
 
        int diff = 0;