summaryrefslogtreecommitdiff
path: root/gtk2_ardour/editor_routes.cc
diff options
context:
space:
mode:
authorCarl Hetherington <carl@carlh.net>2011-11-17 23:44:16 +0000
committerCarl Hetherington <carl@carlh.net>2011-11-17 23:44:16 +0000
commitaef4f9fb078225f06bba457d88082d7108965bff (patch)
treee6d2a4e61bad873a05ceb5436d1de9bb35a3ba76 /gtk2_ardour/editor_routes.cc
parent330e98d6cb653b49790b8d0fe141f787817c4fb1 (diff)
Fix erroneous setup of order keys when tracks have children: order keys relate to the actual tracks only, and ignore child automation views. Should fix the root cause of #4481.
git-svn-id: svn://localhost/ardour2/branches/3.0@10664 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'gtk2_ardour/editor_routes.cc')
-rw-r--r--gtk2_ardour/editor_routes.cc22
1 files changed, 19 insertions, 3 deletions
diff --git a/gtk2_ardour/editor_routes.cc b/gtk2_ardour/editor_routes.cc
index 41f1d4bcf5..015d42b385 100644
--- a/gtk2_ardour/editor_routes.cc
+++ b/gtk2_ardour/editor_routes.cc
@@ -463,9 +463,18 @@ EditorRoutes::redisplay ()
TreeModel::Children rows = _model->children();
TreeModel::Children::iterator i;
uint32_t position;
+
+ /* n will be the count of tracks plus children (updated by TimeAxisView::show_at),
+ so we will use that to know where to put things.
+ */
int n;
- for (n = 0, position = 0, i = rows.begin(); i != rows.end(); ++i) {
+ /* Order keys must not take children into account, so use a separate counter
+ for that.
+ */
+ int order_key;
+
+ for (n = 0, order_key = 0, position = 0, i = rows.begin(); i != rows.end(); ++i) {
TimeAxisView *tv = (*i)[_columns.tv];
boost::shared_ptr<Route> route = (*i)[_columns.route];
@@ -478,7 +487,7 @@ EditorRoutes::redisplay ()
/* this reorder is caused by user action, so reassign sort order keys
to tracks.
*/
- route->set_order_key (N_ ("editor"), n);
+ route->set_order_key (N_ ("editor"), order_key);
}
bool visible = tv->marked_for_display ();
@@ -492,6 +501,7 @@ EditorRoutes::redisplay ()
}
n++;
+ order_key++;
}
/* whenever we go idle, update the track view list to reflect the new order.
@@ -1323,9 +1333,15 @@ EditorRoutes::move_selected_tracks (bool up)
neworder.push_back (leading->second->order_key (N_ ("editor")));
}
+#ifndef NDEBUG
+ for (vector<int>::iterator i = neworder.begin(); i != neworder.end(); ++i) {
+ assert (*i < (int) neworder.size ());
+ }
+#endif
+
_model->reorder (neworder);
- _session->sync_order_keys (N_ ("editor"));
+ _session->sync_order_keys (N_ ("editor"));
}
void