summaryrefslogtreecommitdiff
path: root/libs
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2008-10-07 11:06:29 +0000
committerPaul Davis <paul@linuxaudiosystems.com>2008-10-07 11:06:29 +0000
commitb96c0cba68835a4bda17d4e63494ddab97713322 (patch)
treee21422d78d7a6ba6ec6ca83435c88026633c70bf /libs
parent9a9a7fb6596052c38b92545c33a80ee636040638 (diff)
fixes needed for track/strip ordering issues
git-svn-id: svn://localhost/ardour2/branches/2.0-ongoing@3874 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs')
-rw-r--r--libs/ardour/ardour/route.h4
-rw-r--r--libs/ardour/ardour/session.h2
-rw-r--r--libs/ardour/route.cc32
-rw-r--r--libs/ardour/session.cc8
-rw-r--r--libs/ardour/session_state.cc2
5 files changed, 30 insertions, 18 deletions
diff --git a/libs/ardour/ardour/route.h b/libs/ardour/ardour/route.h
index 8a3c7469b1..4c07b057ff 100644
--- a/libs/ardour/ardour/route.h
+++ b/libs/ardour/ardour/route.h
@@ -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;
diff --git a/libs/ardour/ardour/session.h b/libs/ardour/ardour/session.h
index 322b1b77b2..d23bebf01a 100644
--- a/libs/ardour/ardour/session.h
+++ b/libs/ardour/ardour/session.h
@@ -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>));
diff --git a/libs/ardour/route.cc b/libs/ardour/route.cc
index 7056480c09..975e3228b3 100644
--- a/libs/ardour/route.cc
+++ b/libs/ardour/route.cc
@@ -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;
}
}
diff --git a/libs/ardour/session.cc b/libs/ardour/session.cc
index 7832558ca3..4d3cd7b606 100644
--- a/libs/ardour/session.cc
+++ b/libs/ardour/session.cc
@@ -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
}
diff --git a/libs/ardour/session_state.cc b/libs/ardour/session_state.cc
index ddb166b7ab..354db0efc1 100644
--- a/libs/ardour/session_state.cc
+++ b/libs/ardour/session_state.cc
@@ -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 ();