summaryrefslogtreecommitdiff
path: root/libs/ardour/route.cc
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2012-06-27 22:57:06 +0000
committerPaul Davis <paul@linuxaudiosystems.com>2012-06-27 22:57:06 +0000
commit11415b49be02f16495c95d6286c485ac8afc5189 (patch)
tree8541101b792c6659994aedbd1ac19714e7ef4c2e /libs/ardour/route.cc
parent5ba1996fd70f05362c70b54e68261b955659f291 (diff)
first pass at the big rethink of managing sort order keys for editor and mixer. this appears to work, but remote control IDs are not yet correct (frequently off by one because of the presence of the master bus in the editor)
git-svn-id: svn://localhost/ardour2/branches/3.0@12953 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs/ardour/route.cc')
-rw-r--r--libs/ardour/route.cc124
1 files changed, 46 insertions, 78 deletions
diff --git a/libs/ardour/route.cc b/libs/ardour/route.cc
index 62bb2d0933..2112336d8b 100644
--- a/libs/ardour/route.cc
+++ b/libs/ardour/route.cc
@@ -247,116 +247,84 @@ uint32_t
Route::remote_control_id() const
{
switch (Config->get_remote_model()) {
- case MixerOrdered:
- return order_key (MixerSort) + 1;
- case EditorOrdered:
- return order_key (EditorSort) + 1;
case UserOrdered:
if (_remote_control_id) {
return *_remote_control_id;
}
+ break;
+ default:
+ break;
+ }
+
+ if (is_master()) {
+ return MasterBusRemoteControlID;
+ }
+
+ if (is_monitor()) {
+ return MonitorBusRemoteControlID;
}
- /* fall back to MixerSort as the default */
+ /* order keys are zero-based, remote control ID's are one-based
+ */
+
+ switch (Config->get_remote_model()) {
+ case EditorOrdered:
+ return order_key (EditorSort) + 1;
+ case MixerOrdered:
+ default:
+ return order_key (MixerSort) + 1;
+ }
+}
- return order_key (MixerSort) + 1;
+bool
+Route::has_order_key (RouteSortOrderKey key) const
+{
+ return (order_keys.find (key) != order_keys.end());
}
-int32_t
+uint32_t
Route::order_key (RouteSortOrderKey key) const
{
OrderKeys::const_iterator i = order_keys.find (key);
if (i == order_keys.end()) {
- return -1;
+ return 0;
}
return i->second;
}
void
-Route::set_order_key (RouteSortOrderKey key, int32_t n)
+Route::sync_order_keys (RouteSortOrderKey base)
{
- bool changed = false;
+ OrderKeys::iterator i = order_keys.find (base);
- /* This method looks more complicated than it should, but
- it's important that we don't emit order_key_changed unless
- it actually has, as expensive things happen on receipt of that
- signal.
- */
-
- if (order_keys.find (key) == order_keys.end() || order_keys[key] != n) {
- order_keys[key] = n;
- changed = true;
+ if (i == order_keys.end()) {
+ return;
}
- if (Config->get_sync_all_route_ordering()) {
- for (OrderKeys::iterator x = order_keys.begin(); x != order_keys.end(); ++x) {
+ for (OrderKeys::iterator k = order_keys.begin(); k != order_keys.end(); ++k) {
- /* we do not sync the signal order keys for mixer +
- * monitor because they are considered "external" to
- * the ordering of other routes.
+ if (k->first == MixerSort && (is_master() || is_monitor())) {
+ /* don't sync the mixer sort keys for master/monitor,
+ * since they are not part of the normal ordering.
*/
-
- if ((!is_master() && !is_monitor()) || x->first != MixerSort) {
- if (x->second != n) {
- x->second = n;
- changed = true;
- }
- }
+
+ continue;
+ }
+
+ if (k->first != base) {
+ k->second = i->second;
}
- }
-
- if (changed) {
- order_key_changed (); /* EMIT SIGNAL */
- _session.set_dirty ();
}
}
-/** Set all order keys to be the same as that for `base', if such a key
- * exists in this route.
- * @param base Base key.
- */
void
-Route::sync_order_keys (RouteSortOrderKey base)
+Route::set_order_key (RouteSortOrderKey key, uint32_t n)
{
- if (order_keys.empty()) {
- return;
- }
-
- OrderKeys::iterator i;
- int32_t key;
-
- if ((i = order_keys.find (base)) == order_keys.end()) {
- /* key doesn't exist, use the first existing key (during session initialization) */
- i = order_keys.begin();
- key = i->second;
- ++i;
- } else {
- /* key exists - use it and reset all others (actually, itself included) */
- key = i->second;
- i = order_keys.begin();
- }
-
- bool changed = false;
-
- for (; i != order_keys.end(); ++i) {
-
- /* we do not sync the signal order keys for mixer +
- * monitor because they are considered "external" to
- * the ordering of other routes.
- */
-
- if ((!is_master() && !is_monitor()) || i->first != MixerSort) {
- if (i->second != key) {
- i->second = key;
- changed = true;
- }
- }
- }
-
- if (changed) {
- order_key_changed (); /* EMIT SIGNAL */
+ if (order_keys.find (key) == order_keys.end() || order_keys[key] != n) {
+ order_keys[key] = n;
+ _session.set_dirty ();
}
}