fixes needed for track/strip ordering issues

git-svn-id: svn://localhost/ardour2/branches/2.0-ongoing@3874 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
Paul Davis 2008-10-07 11:06:29 +00:00
parent 9a9a7fb659
commit b96c0cba68
5 changed files with 30 additions and 18 deletions

View file

@ -241,8 +241,8 @@ class Route : public IO
uint32_t remote_control_id () const;
sigc::signal<void> RemoteControlIDChanged;
void sync_order_keys ();
static sigc::signal<void,void*> SyncOrderKeys;
void sync_order_keys (const char* base);
static sigc::signal<void,const char*> SyncOrderKeys;
protected:
friend class Session;

View file

@ -306,7 +306,7 @@ class Session : public PBD::StatefulDestructible
bool operator() (boost::shared_ptr<Route>, boost::shared_ptr<Route> b);
};
void sync_order_keys (void *src);
void sync_order_keys (const char* base);
template<class T> void foreach_route (T *obj, void (T::*func)(Route&));
template<class T> void foreach_route (T *obj, void (T::*func)(boost::shared_ptr<Route>));

View file

@ -51,7 +51,7 @@ using namespace ARDOUR;
using namespace PBD;
uint32_t Route::order_key_cnt = 0;
sigc::signal<void,void*> Route::SyncOrderKeys;
sigc::signal<void,const char*> Route::SyncOrderKeys;
Route::Route (Session& sess, string name, int input_min, int input_max, int output_min, int output_max, Flag flg, DataType default_type)
: IO (sess, name, input_min, input_max, output_min, output_max, default_type),
@ -169,20 +169,32 @@ Route::set_order_key (const char* name, long n)
}
void
Route::sync_order_keys ()
Route::sync_order_keys (const char* base)
{
uint32_t key;
if (order_keys.empty()) {
return;
}
OrderKeys::iterator x = order_keys.begin();
key = x->second;
++x;
for (; x != order_keys.end(); ++x) {
x->second = key;
OrderKeys::iterator i;
uint32_t key;
if ((i = order_keys.find (base)) == order_keys.end()) {
/* key doesn't exist, use the first existing
key (this is done during session initialization)
*/
i = order_keys.begin();
key = i->second;
++i;
} else {
/* key exists - use it and reset all others
(actually, itself included)
*/
i = order_keys.begin();
key = i->second;
}
for (; i != order_keys.end(); ++i) {
i->second = key;
}
}

View file

@ -2153,7 +2153,7 @@ Session::remove_route (shared_ptr<Route> route)
route->drop_references ();
sync_order_keys (this);
sync_order_keys (N_("session"));
/* save the new state of the world */
@ -4199,7 +4199,7 @@ Session::compute_initial_length ()
}
void
Session::sync_order_keys (void* src)
Session::sync_order_keys (const char* base)
{
if (!Config->get_sync_all_route_ordering()) {
/* leave order keys as they are */
@ -4209,8 +4209,8 @@ Session::sync_order_keys (void* src)
boost::shared_ptr<RouteList> r = routes.reader ();
for (RouteList::iterator i = r->begin(); i != r->end(); ++i) {
(*i)->sync_order_keys ();
(*i)->sync_order_keys (base);
}
Route::SyncOrderKeys (src); // EMIT SIGNAL
Route::SyncOrderKeys (base); // EMIT SIGNAL
}

View file

@ -3345,7 +3345,7 @@ Session::config_changed (const char* parameter_name)
} else if (PARAM_IS ("history-depth")) {
set_history_depth (Config->get_history_depth());
} else if (PARAM_IS ("sync-all-route-ordering")) {
sync_order_keys (0);
sync_order_keys ("session");
}
set_dirty ();