diff options
author | Tim Mayberry <mojofunk@gmail.com> | 2017-04-21 20:33:05 +1000 |
---|---|---|
committer | Tim Mayberry <mojofunk@gmail.com> | 2017-04-26 17:36:58 +1000 |
commit | 3589740d69e7b33097def7db2f173b2458e30639 (patch) | |
tree | 6f647e611423e95fbde253bf35baae3b297f4b5e /libs/ardour/session_state.cc | |
parent | 21f5f434c6e2a70f79c25416cfb85cfa5a375f76 (diff) |
Sort Route xml node order by PBD::ID instead of by PresentationInfo
This prevents the node order from changing when the display order of the Routes
changes, which helps to reduce the amount of Session file change.
This is useful for testing and if keeping sessions under version control.
Resolves: #7327
Diffstat (limited to 'libs/ardour/session_state.cc')
-rw-r--r-- | libs/ardour/session_state.cc | 25 |
1 files changed, 15 insertions, 10 deletions
diff --git a/libs/ardour/session_state.cc b/libs/ardour/session_state.cc index c59ae00a57..35cb9c538c 100644 --- a/libs/ardour/session_state.cc +++ b/libs/ardour/session_state.cc @@ -1126,6 +1126,17 @@ Session::export_track_state (boost::shared_ptr<RouteList> rl, const string& path return tree.write (sn.c_str()); } +namespace +{ +struct route_id_compare { + bool + operator() (const boost::shared_ptr<Route>& r1, const boost::shared_ptr<Route>& r2) + { + return r1->id () < r2->id (); + } +}; +} // anon namespace + XMLNode& Session::state (bool full_state) { @@ -1326,17 +1337,11 @@ Session::state (bool full_state) { boost::shared_ptr<RouteList> r = routes.reader (); - RoutePublicOrderSorter cmp; - RouteList public_order (*r); - public_order.sort (cmp); - - /* the sort should have put the monitor out first */ - - if (_monitor_out) { - assert (_monitor_out == public_order.front()); - } + route_id_compare cmp; + RouteList xml_node_order (*r); + xml_node_order.sort (cmp); - for (RouteList::iterator i = public_order.begin(); i != public_order.end(); ++i) { + for (RouteList::iterator i = xml_node_order.begin(); i != xml_node_order.end(); ++i) { if (!(*i)->is_auditioner()) { if (full_state) { child->add_child_nocopy ((*i)->get_state()); |