- items.push_back (SeparatorElem());
- /* gah, this is wrong ... it will operate on the wrong selection */
- items.push_front (MenuElem (_("Remove"), sigc::mem_fun(PublicEditor::instance(), &PublicEditor::remove_tracks)));
+ if (_route) {
+ /* note that this relies on selection being shared across editor and
+ mixer (or global to the backend, in the future), which is the only
+ sane thing for users anyway.
+ */
+
+ RouteTimeAxisView* rtav = PublicEditor::instance().get_route_view_by_route_id (_route->id());
+ if (rtav) {
+ Selection& selection (PublicEditor::instance().get_selection());
+ if (!selection.selected (rtav)) {
+ selection.set (rtav);
+ }
+
+ if (!_route->is_master()) {
+ items.push_back (SeparatorElem());
+ items.push_back (MenuElem (_("Duplicate..."), sigc::mem_fun (*this, &RouteUI::duplicate_selected_routes)));
+ }
+
+ items.push_back (SeparatorElem());
+ items.push_back (MenuElem (_("Remove"), sigc::mem_fun(PublicEditor::instance(), &PublicEditor::remove_tracks)));
+ }
+ }