summaryrefslogtreecommitdiff
path: root/gtk2_ardour/editor_routes.cc
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2012-06-25 12:46:13 +0000
committerPaul Davis <paul@linuxaudiosystems.com>2012-06-25 12:46:13 +0000
commit97d920593ffc796986107e16d7bbf88cc3184043 (patch)
treecc68f13ec1c9be69f98d30bd734e809fea30a0d1 /gtk2_ardour/editor_routes.cc
parentf2f35e50a0e2d6e0b2c7f02b5e6c76e82643c80a (diff)
drastic rethink of the relationship between remote control ID and route order keys. unless the user explicitly switches to UserOrdered, Route::_remote_control_id is an unallocated pointer, and Route::remote_control_id() simply returns a value based on the relevant order_key() value. Also, change the key used in the Route::order_keys std::map<> from a string to an enum, since there is no evidence that we are benefitting from the theoretical benefit of using a string. Generally tidy up allocation of order keys so that the master and monitor busses always get a "special" MixerSort key value, based on the MMC ID for master (already defined within Ardour), and all other tracks/busses start at zero. Syncing keys between editor and mixer will leave the MixerSort key for the master and monitor bus alone, reflecting the fact that we display these in their own distinct parts of the GUI and they are not orderable like other tracks or busses within the mixer window
git-svn-id: svn://localhost/ardour2/branches/3.0@12923 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'gtk2_ardour/editor_routes.cc')
-rw-r--r--gtk2_ardour/editor_routes.cc36
1 files changed, 15 insertions, 21 deletions
diff --git a/gtk2_ardour/editor_routes.cc b/gtk2_ardour/editor_routes.cc
index c4443cbed0..3faeba183f 100644
--- a/gtk2_ardour/editor_routes.cc
+++ b/gtk2_ardour/editor_routes.cc
@@ -520,7 +520,14 @@ EditorRoutes::redisplay ()
/* this reorder is caused by user action, so reassign sort order keys
to tracks.
*/
- route->set_order_key (N_ ("editor"), order_key);
+
+ if (route->is_master()) {
+ route->set_order_key (EditorSort, Route::MasterBusRemoteControlID);
+ } else if (route->is_monitor()) {
+ route->set_order_key (EditorSort, Route::MonitorBusRemoteControlID);
+ } else {
+ route->set_order_key (EditorSort, order_key++);
+ }
}
bool visible = tv->marked_for_display ();
@@ -534,7 +541,6 @@ EditorRoutes::redisplay ()
}
n++;
- order_key++;
}
/* whenever we go idle, update the track view list to reflect the new order.
@@ -557,7 +563,7 @@ EditorRoutes::redisplay ()
}
if (!_redisplay_does_not_reset_order_keys && !_redisplay_does_not_sync_order_keys) {
- _session->sync_order_keys (N_ ("editor"));
+ _session->sync_order_keys (EditorSort);
}
}
@@ -569,7 +575,6 @@ EditorRoutes::route_deleted (Gtk::TreeModel::Path const &)
}
/* this could require an order reset & sync */
- _session->set_remote_control_ids();
_ignore_reorder = true;
redisplay ();
_ignore_reorder = false;
@@ -591,7 +596,6 @@ EditorRoutes::visible_changed (std::string const & path)
if (tv->set_marked_for_display (!visible)) {
_redisplay_does_not_reset_order_keys = true;
- _session->set_remote_control_ids();
update_visibility ();
redisplay ();
_redisplay_does_not_reset_order_keys = false;
@@ -649,15 +653,6 @@ EditorRoutes::routes_added (list<RouteTimeAxisView*> routes)
row[_columns.solo_safe_state] = (*x)->route()->solo_safe();
row[_columns.name_editable] = true;
- _ignore_reorder = true;
-
- /* added a new fresh one at the end */
- if ((*x)->route()->order_key (N_ ("editor")) == -1) {
- (*x)->route()->set_order_key (N_ ("editor"), _model->children().size()-1);
- }
-
- _ignore_reorder = false;
-
boost::weak_ptr<Route> wr ((*x)->route());
(*x)->route()->gui_changed.connect (*this, MISSING_INVALIDATOR, boost::bind (&EditorRoutes::handle_gui_changes, this, _1, _2), gui_context());
@@ -833,13 +828,13 @@ EditorRoutes::reordered (TreeModel::Path const &, TreeModel::iterator const &, i
* route list so that the visual arrangement of routes matches the order keys from the routes.
*/
void
-EditorRoutes::sync_order_keys (string const & src)
+EditorRoutes::sync_order_keys (RouteSortOrderKey src)
{
map<int, int> new_order;
TreeModel::Children rows = _model->children();
TreeModel::Children::iterator ri;
- if (src == N_ ("editor") || !_session || (_session->state_of_the_state() & (Session::Loading|Session::Deletion)) || rows.empty()) {
+ if (src == EditorSort || !_session || (_session->state_of_the_state() & (Session::Loading|Session::Deletion)) || rows.empty()) {
return;
}
@@ -850,7 +845,7 @@ EditorRoutes::sync_order_keys (string const & src)
boost::shared_ptr<Route> route = (*ri)[_columns.route];
int const old_key = order;
- int const new_key = route->order_key (N_ ("editor"));
+ int const new_key = route->order_key (EditorSort);
new_order[new_key] = old_key;
@@ -1193,7 +1188,7 @@ EditorRoutes::selection_filter (Glib::RefPtr<TreeModel> const &, TreeModel::Path
struct EditorOrderRouteSorter {
bool operator() (boost::shared_ptr<Route> a, boost::shared_ptr<Route> b) {
/* use of ">" forces the correct sort order */
- return a->order_key (N_ ("editor")) < b->order_key (N_ ("editor"));
+ return a->order_key (EditorSort) < b->order_key (EditorSort);
}
};
@@ -1247,7 +1242,6 @@ void
EditorRoutes::track_list_reorder (Gtk::TreeModel::Path const &, Gtk::TreeModel::iterator const &, int* /*new_order*/)
{
_redisplay_does_not_sync_order_keys = true;
- _session->set_remote_control_ids();
redisplay ();
_redisplay_does_not_sync_order_keys = false;
}
@@ -1370,7 +1364,7 @@ EditorRoutes::move_selected_tracks (bool up)
}
for (leading = view_routes.begin(); leading != view_routes.end(); ++leading) {
- neworder.push_back (leading->second->order_key (N_ ("editor")));
+ neworder.push_back (leading->second->order_key (EditorSort));
}
#ifndef NDEBUG
@@ -1381,7 +1375,7 @@ EditorRoutes::move_selected_tracks (bool up)
_model->reorder (neworder);
- _session->sync_order_keys (N_ ("editor"));
+ _session->sync_order_keys (EditorSort);
}
void