Split route group list out of Editor.
[ardour.git] / gtk2_ardour / editor_actions.cc
1 /*
2     Copyright (C) 2000-2007 Paul Davis 
3
4     This program is free software; you can redistribute it and/or modify
5     it under the terms of the GNU General Public License as published by
6     the Free Software Foundation; either version 2 of the License, or
7     (at your option) any later version.
8
9     This program is distributed in the hope that it will be useful,
10     but WITHOUT ANY WARRANTY; without even the implied warranty of
11     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12     GNU General Public License for more details.
13
14     You should have received a copy of the GNU General Public License
15     along with this program; if not, write to the Free Software
16     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
17
18 */
19
20 #include "ardour/ardour.h"
21 #include "ardour/profile.h"
22
23 #include "actions.h"
24 #include "ardour_ui.h"
25 #include "editing.h"
26 #include "editor.h"
27 #include "gui_thread.h"
28 #include "time_axis_view.h"
29 #include "utils.h"
30 #include "i18n.h"
31 #include "audio_time_axis.h"
32 #include "editor_group_tabs.h"
33 #include "editor_routes.h"
34
35 using namespace Gtk;
36 using namespace Glib;
37 using namespace std;
38 using namespace sigc;
39 using namespace ARDOUR;
40 using namespace PBD;
41 using namespace Editing;
42
43 void
44 Editor::register_actions ()
45 {
46         RefPtr<Action> act;
47
48         editor_actions = ActionGroup::create (X_("Editor"));
49         
50         /* non-operative menu items for menu bar */
51
52         ActionManager::register_action (editor_actions, X_("AlignMenu"), _("Align"));
53         ActionManager::register_action (editor_actions, X_("Autoconnect"), _("Autoconnect"));
54         ActionManager::register_action (editor_actions, X_("Crossfades"), _("Crossfades"));
55         ActionManager::register_action (editor_actions, X_("Edit"), _("Edit"));
56         ActionManager::register_action (editor_actions, X_("EditCursorMovementOptions"), _("Move Selected Marker"));
57         ActionManager::register_action (editor_actions, X_("EditSelectRangeOptions"), _("Select Range Operations"));
58         ActionManager::register_action (editor_actions, X_("EditSelectRegionOptions"), _("Select Regions"));
59         ActionManager::register_action (editor_actions, X_("EditPointMenu"), _("Edit Point"));
60         ActionManager::register_action (editor_actions, X_("FadeMenu"), _("Fade"));
61         ActionManager::register_action (editor_actions, X_("LatchMenu"), _("Latch"));
62         ActionManager::register_action (editor_actions, X_("Layering"), _("Layering"));
63         ActionManager::register_action (editor_actions, X_("Link"), _("Link"));
64         ActionManager::register_action (editor_actions, X_("ZoomFocusMenu"), _("Zoom Focus"));
65         ActionManager::register_action (editor_actions, X_("KeyMouseActions"), _("Key Mouse"));
66         ActionManager::register_action (editor_actions, X_("LocateToMarker"), _("Locate to Markers"));
67         ActionManager::register_action (editor_actions, X_("MarkerMenu"), _("Markers"));
68         ActionManager::register_action (editor_actions, X_("MeterFalloff"), _("Meter falloff"));
69         ActionManager::register_action (editor_actions, X_("MeterHold"), _("Meter hold"));
70         ActionManager::register_action (editor_actions, X_("MiscOptions"), _("Misc Options"));
71         ActionManager::register_action (editor_actions, X_("Monitoring"), _("Monitoring"));
72         ActionManager::register_action (editor_actions, X_("MoveActiveMarkMenu"), _("Active Mark"));
73         ActionManager::register_action (editor_actions, X_("MovePlayHeadMenu"), _("Playhead"));
74         ActionManager::register_action (editor_actions, X_("NudgeRegionMenu"), _("Nudge"));
75         ActionManager::register_action (editor_actions, X_("PlayMenu"), _("Play"));
76         ActionManager::register_action (editor_actions, X_("PrimaryClockMenu"), _("Primary Clock"));
77         ActionManager::register_action (editor_actions, X_("Pullup"), _("Pullup / Pulldown"));
78         ActionManager::register_action (editor_actions, X_("RegionMenu"), _("Region"));
79         ActionManager::register_action (editor_actions, X_("RegionEditOps"), _("Region operations"));
80         ActionManager::register_action (editor_actions, X_("RegionGainMenu"), _("Gain"));
81         ActionManager::register_action (editor_actions, X_("RulerMenu"), _("Rulers"));
82         ActionManager::register_action (editor_actions, X_("SavedViewMenu"), _("Views"));
83         ActionManager::register_action (editor_actions, X_("ScrollMenu"), _("Scroll"));
84         ActionManager::register_action (editor_actions, X_("SecondaryClockMenu"), _("Secondary Clock"));
85         ActionManager::register_action (editor_actions, X_("Select"), _("Select"));
86         ActionManager::register_action (editor_actions, X_("SelectMenu"), _("Select"));
87         ActionManager::register_action (editor_actions, X_("SeparateMenu"), _("Separate"));
88         ActionManager::register_action (editor_actions, X_("SetLoopMenu"), _("Loop"));
89         ActionManager::register_action (editor_actions, X_("SetPunchMenu"), _("Punch"));
90         ActionManager::register_action (editor_actions, X_("Solo"), _("Solo"));
91         ActionManager::register_action (editor_actions, X_("Subframes"), _("Subframes"));
92         ActionManager::register_action (editor_actions, X_("SyncMenu"), _("Sync"));
93         ActionManager::register_action (editor_actions, X_("TempoMenu"), _("Tempo"));
94         ActionManager::register_action (editor_actions, X_("Timecode"), _("Timecode fps"));
95         ActionManager::register_action (editor_actions, X_("TrackHeightMenu"), _("Height"));
96         ActionManager::register_action (editor_actions, X_("TrackMenu"), _("Track"));
97         ActionManager::register_action (editor_actions, X_("Tools"), _("Tools"));
98         ActionManager::register_action (editor_actions, X_("TrimMenu"), _("Trim"));
99         ActionManager::register_action (editor_actions, X_("View"), _("View"));
100         ActionManager::register_action (editor_actions, X_("ZoomFocus"), _("Zoom Focus"));
101         ActionManager::register_action (editor_actions, X_("ZoomMenu"), _("Zoom"));
102
103         /* add named actions for the editor */
104
105         ActionManager::register_action (editor_actions, "break-drag", _("Break drag"), mem_fun (*this, &Editor::break_drag));
106
107         act = ActionManager::register_toggle_action (editor_actions, "show-editor-mixer", _("Show Editor Mixer"), mem_fun (*this, &Editor::editor_mixer_button_toggled));
108         ActionManager::session_sensitive_actions.push_back (act);
109         act = ActionManager::register_toggle_action (editor_actions, "show-editor-list", _("Show Editor List"), mem_fun (*this, &Editor::editor_list_button_toggled));
110         ActionManager::session_sensitive_actions.push_back (act);
111
112         act = ActionManager::register_action (editor_actions, "toggle-selected-region-fade-in", _("Toggle Region Fade In"), bind (mem_fun(*this, &Editor::toggle_selected_region_fades), 1));;
113         ActionManager::session_sensitive_actions.push_back (act);
114         act = ActionManager::register_action (editor_actions, "toggle-selected-region-fade-out", _("Toggle Region Fade Out"), bind (mem_fun(*this, &Editor::toggle_selected_region_fades), -1));;
115         ActionManager::session_sensitive_actions.push_back (act);
116         act = ActionManager::register_action (editor_actions, "toggle-selected-region-fades", _("Toggle Region Fades"), bind (mem_fun(*this, &Editor::toggle_selected_region_fades), 0));
117         ActionManager::session_sensitive_actions.push_back (act);
118
119         act = ActionManager::register_action (editor_actions, "playhead-to-next-region-boundary", _("Playhead to Next Region Boundary"), bind (mem_fun(*this, &Editor::cursor_to_next_region_boundary), true ));
120         ActionManager::session_sensitive_actions.push_back (act);
121         act = ActionManager::register_action (editor_actions, "playhead-to-next-region-boundary-noselection", _("Playhead to Next Region Boundary (No Track Selection)"), bind (mem_fun(*this, &Editor::cursor_to_next_region_boundary), false ));
122         ActionManager::session_sensitive_actions.push_back (act);
123         act = ActionManager::register_action (editor_actions, "playhead-to-previous-region-boundary", _("Playhead to Previous Region Boundary"), bind (mem_fun(*this, &Editor::cursor_to_previous_region_boundary), true));
124         ActionManager::session_sensitive_actions.push_back (act);
125         act = ActionManager::register_action (editor_actions, "playhead-to-previous-region-boundary-noselection", _("Playhead to Previous Region Boundary (No Track Selection"), bind (mem_fun(*this, &Editor::cursor_to_previous_region_boundary), false));
126         ActionManager::session_sensitive_actions.push_back (act);
127
128         act = ActionManager::register_action (editor_actions, "playhead-to-next-region-start", _("Playhead to Next Region Start"), bind (mem_fun(*this, &Editor::cursor_to_next_region_point), playhead_cursor, RegionPoint (Start)));
129         ActionManager::session_sensitive_actions.push_back (act);
130         act = ActionManager::register_action (editor_actions, "playhead-to-next-region-end", _("Playhead to Next Region End"), bind (mem_fun(*this, &Editor::cursor_to_next_region_point), playhead_cursor, RegionPoint (End)));
131         ActionManager::session_sensitive_actions.push_back (act);
132         act = ActionManager::register_action (editor_actions, "playhead-to-next-region-sync", _("Playhead to Next Region Sync"), bind (mem_fun(*this, &Editor::cursor_to_next_region_point), playhead_cursor, RegionPoint (SyncPoint)));
133         ActionManager::session_sensitive_actions.push_back (act);
134
135         act = ActionManager::register_action (editor_actions, "playhead-to-previous-region-start", _("Playhead to Previous Region Start"), bind (mem_fun(*this, &Editor::cursor_to_previous_region_point), playhead_cursor, RegionPoint (Start)));
136         ActionManager::session_sensitive_actions.push_back (act);
137         act = ActionManager::register_action (editor_actions, "playhead-to-previous-region-end", _("Playhead to Previous Region End"), bind (mem_fun(*this, &Editor::cursor_to_previous_region_point), playhead_cursor, RegionPoint (End)));
138         ActionManager::session_sensitive_actions.push_back (act);
139         act = ActionManager::register_action (editor_actions, "playhead-to-previous-region-sync", _("Playhead to Previous Region Sync"), bind (mem_fun(*this, &Editor::cursor_to_previous_region_point), playhead_cursor, RegionPoint (SyncPoint)));
140         ActionManager::session_sensitive_actions.push_back (act);
141
142         act = ActionManager::register_action (editor_actions, "selected-marker-to-next-region-boundary", _("to Next Region Boundary"), bind (mem_fun(*this, &Editor::selected_marker_to_next_region_boundary), true));
143         ActionManager::session_sensitive_actions.push_back (act);
144         act = ActionManager::register_action (editor_actions, "selected-marker-to-next-region-boundary-noselection", _("to Next Region Boundary (No Track Selection)"), bind (mem_fun(*this, &Editor::selected_marker_to_next_region_boundary), false));
145         ActionManager::session_sensitive_actions.push_back (act);
146         act = ActionManager::register_action (editor_actions, "selected-marker-to-previous-region-boundary", _("to Previous Region Boundary"), bind (mem_fun(*this, &Editor::selected_marker_to_previous_region_boundary), true));
147         ActionManager::session_sensitive_actions.push_back (act);
148         act = ActionManager::register_action (editor_actions, "selected-marker-to-previous-region-boundary-noselection", _("to Previous Region Boundary (No Track Selection)"), bind (mem_fun(*this, &Editor::selected_marker_to_previous_region_boundary), false));
149         ActionManager::session_sensitive_actions.push_back (act);
150
151         act = ActionManager::register_action (editor_actions, "edit-cursor-to-next-region-start", _("To Next Region Start"), bind (mem_fun(*this, &Editor::selected_marker_to_next_region_point), RegionPoint (Start)));
152         ActionManager::session_sensitive_actions.push_back (act);
153         act = ActionManager::register_action (editor_actions, "edit-cursor-to-next-region-end", _("To Next Region End"), bind (mem_fun(*this, &Editor::selected_marker_to_next_region_point), RegionPoint (End)));
154         ActionManager::session_sensitive_actions.push_back (act);
155         act = ActionManager::register_action (editor_actions, "edit-cursor-to-next-region-sync", _("To Next Region Sync"), bind (mem_fun(*this, &Editor::selected_marker_to_next_region_point), RegionPoint (SyncPoint)));
156         ActionManager::session_sensitive_actions.push_back (act);
157
158         act = ActionManager::register_action (editor_actions, "edit-cursor-to-previous-region-start", _("To Previous Region Start"), bind (mem_fun(*this, &Editor::selected_marker_to_previous_region_point), RegionPoint (Start)));
159         ActionManager::session_sensitive_actions.push_back (act);
160         act = ActionManager::register_action (editor_actions, "edit-cursor-to-previous-region-end", _("To Previous Region End"), bind (mem_fun(*this, &Editor::selected_marker_to_previous_region_point), RegionPoint (End)));
161         ActionManager::session_sensitive_actions.push_back (act);
162         act = ActionManager::register_action (editor_actions, "edit-cursor-to-previous-region-sync", _("To Previous Region Sync"), bind (mem_fun(*this, &Editor::selected_marker_to_previous_region_point), RegionPoint (SyncPoint)));
163         ActionManager::session_sensitive_actions.push_back (act);
164
165         act = ActionManager::register_action (editor_actions, "edit-cursor-to-range-start", _("To Range Start"), mem_fun(*this, &Editor::selected_marker_to_selection_start));
166         ActionManager::session_sensitive_actions.push_back (act);
167         act = ActionManager::register_action (editor_actions, "edit-cursor-to-range-end", _("To Range End"), mem_fun(*this, &Editor::selected_marker_to_selection_end));
168         ActionManager::session_sensitive_actions.push_back (act);
169
170         act = ActionManager::register_action (editor_actions, "playhead-to-range-start", _("Playhead to Range Start"), bind (mem_fun(*this, &Editor::cursor_to_selection_start), playhead_cursor));
171         ActionManager::session_sensitive_actions.push_back (act);
172         act = ActionManager::register_action (editor_actions, "playhead-to-range-end", _("Playhead to Range End"), bind (mem_fun(*this, &Editor::cursor_to_selection_end), playhead_cursor));
173         ActionManager::session_sensitive_actions.push_back (act);
174
175         act = ActionManager::register_action (editor_actions, "select-all", _("Select All"), bind (mem_fun(*this, &Editor::select_all), Selection::Set));
176         ActionManager::session_sensitive_actions.push_back (act);
177         act = ActionManager::register_action (editor_actions, "deselect-all", _("Deselect All"), mem_fun(*this, &Editor::deselect_all));
178         ActionManager::session_sensitive_actions.push_back (act);
179         act = ActionManager::register_action (editor_actions, "invert-selection", _("Invert Selection"), mem_fun(*this, &Editor::invert_selection));
180         ActionManager::session_sensitive_actions.push_back (act);
181         act = ActionManager::register_action (editor_actions, "select-all-after-edit-cursor", _("Select All After Edit Point"), bind (mem_fun(*this, &Editor::select_all_selectables_using_edit), true));
182         ActionManager::session_sensitive_actions.push_back (act);
183         act = ActionManager::register_action (editor_actions, "select-all-before-edit-cursor", _("Select All Before Edit Point"), bind (mem_fun(*this, &Editor::select_all_selectables_using_edit), false));
184         ActionManager::session_sensitive_actions.push_back (act);
185
186         act = ActionManager::register_action (editor_actions, "select-all-between-cursors", _("Select All Overlapping Edit Range"), bind (mem_fun(*this, &Editor::select_all_selectables_between), false));
187         ActionManager::session_sensitive_actions.push_back (act);
188         act = ActionManager::register_action (editor_actions, "select-all-within-cursors", _("Select All Inside Edit Range"), bind (mem_fun(*this, &Editor::select_all_selectables_between), true));
189         ActionManager::session_sensitive_actions.push_back (act);
190
191         act = ActionManager::register_action (editor_actions, "select-range-between-cursors", _("Select Edit Range"), mem_fun(*this, &Editor::select_range_between));
192         ActionManager::session_sensitive_actions.push_back (act);
193
194         act = ActionManager::register_action (editor_actions, "select-all-in-punch-range", _("Select All in Punch Range"), mem_fun(*this, &Editor::select_all_selectables_using_punch));
195         ActionManager::session_sensitive_actions.push_back (act);
196         act = ActionManager::register_action (editor_actions, "select-all-in-loop-range", _("Select All in Loop Range"), mem_fun(*this, &Editor::select_all_selectables_using_loop));
197         ActionManager::session_sensitive_actions.push_back (act);
198         
199         act = ActionManager::register_action (editor_actions, "select-next-route", _("Select Next Track/Bus"), mem_fun(*this, &Editor::select_next_route));
200         ActionManager::session_sensitive_actions.push_back (act);
201         act = ActionManager::register_action (editor_actions, "select-prev-route", _("Select Previous Track/Bus"), mem_fun(*this, &Editor::select_prev_route));
202         ActionManager::session_sensitive_actions.push_back (act);
203         
204         act = ActionManager::register_action (editor_actions, "track-record-enable-toggle", _("Toggle Record Enable"), mem_fun(*this, &Editor::toggle_record_enable));
205         ActionManager::session_sensitive_actions.push_back (act);
206
207
208         act = ActionManager::register_action (editor_actions, "save-visual-state-1", _("Save View 1"), bind (mem_fun (*this, &Editor::start_visual_state_op), 0));
209         ActionManager::session_sensitive_actions.push_back (act);
210         act = ActionManager::register_action (editor_actions, "goto-visual-state-1", _("Goto View 1"), bind (mem_fun (*this, &Editor::cancel_visual_state_op), 0));
211         ActionManager::session_sensitive_actions.push_back (act);
212         act = ActionManager::register_action (editor_actions, "save-visual-state-2", _("Save View 2"), bind (mem_fun (*this, &Editor::start_visual_state_op), 1));
213         ActionManager::session_sensitive_actions.push_back (act);
214         act = ActionManager::register_action (editor_actions, "goto-visual-state-2", _("Goto View 2"), bind (mem_fun (*this, &Editor::cancel_visual_state_op), 1));
215         ActionManager::session_sensitive_actions.push_back (act);
216         act = ActionManager::register_action (editor_actions, "save-visual-state-3", _("Save View 3"), bind (mem_fun (*this, &Editor::start_visual_state_op), 2));
217         ActionManager::session_sensitive_actions.push_back (act);
218         act = ActionManager::register_action (editor_actions, "goto-visual-state-3", _("Goto View 3"), bind (mem_fun (*this, &Editor::cancel_visual_state_op), 2));
219         ActionManager::session_sensitive_actions.push_back (act);
220         act = ActionManager::register_action (editor_actions, "save-visual-state-4", _("Save View 4"), bind (mem_fun (*this, &Editor::start_visual_state_op), 3));
221         ActionManager::session_sensitive_actions.push_back (act);
222         act = ActionManager::register_action (editor_actions, "goto-visual-state-4", _("Goto View 4"), bind (mem_fun (*this, &Editor::cancel_visual_state_op), 3));
223         ActionManager::session_sensitive_actions.push_back (act);
224         act = ActionManager::register_action (editor_actions, "save-visual-state-5", _("Save View 5"), bind (mem_fun (*this, &Editor::start_visual_state_op), 4));
225         ActionManager::session_sensitive_actions.push_back (act);
226         act = ActionManager::register_action (editor_actions, "goto-visual-state-5", _("Goto View 5"), bind (mem_fun (*this, &Editor::cancel_visual_state_op), 4));
227         ActionManager::session_sensitive_actions.push_back (act);
228         act = ActionManager::register_action (editor_actions, "save-visual-state-6", _("Save View 6"), bind (mem_fun (*this, &Editor::start_visual_state_op), 5));
229         ActionManager::session_sensitive_actions.push_back (act);
230         act = ActionManager::register_action (editor_actions, "goto-visual-state-6", _("Goto View 6"), bind (mem_fun (*this, &Editor::cancel_visual_state_op), 5));
231         ActionManager::session_sensitive_actions.push_back (act);
232         act = ActionManager::register_action (editor_actions, "save-visual-state-7", _("Save View 7"), bind (mem_fun (*this, &Editor::start_visual_state_op), 6));
233         ActionManager::session_sensitive_actions.push_back (act);
234         act = ActionManager::register_action (editor_actions, "goto-visual-state-7", _("Goto View 7"), bind (mem_fun (*this, &Editor::cancel_visual_state_op), 6));
235         ActionManager::session_sensitive_actions.push_back (act);
236         act = ActionManager::register_action (editor_actions, "save-visual-state-8", _("Save View 8"), bind (mem_fun (*this, &Editor::start_visual_state_op), 7));
237         ActionManager::session_sensitive_actions.push_back (act);
238         act = ActionManager::register_action (editor_actions, "goto-visual-state-8", _("Goto View 8"), bind (mem_fun (*this, &Editor::cancel_visual_state_op), 7));
239         ActionManager::session_sensitive_actions.push_back (act);
240         act = ActionManager::register_action (editor_actions, "save-visual-state-9", _("Save View 9"), bind (mem_fun (*this, &Editor::start_visual_state_op), 8));
241         ActionManager::session_sensitive_actions.push_back (act);
242         act = ActionManager::register_action (editor_actions, "goto-visual-state-9", _("Goto View 9"), bind (mem_fun (*this, &Editor::cancel_visual_state_op), 8));
243         ActionManager::session_sensitive_actions.push_back (act);
244         act = ActionManager::register_action (editor_actions, "save-visual-state-10", _("Save View 10"), bind (mem_fun (*this, &Editor::start_visual_state_op), 9));
245         ActionManager::session_sensitive_actions.push_back (act);
246         act = ActionManager::register_action (editor_actions, "goto-visual-state-10", _("Goto View 10"), bind (mem_fun (*this, &Editor::cancel_visual_state_op), 9));
247         ActionManager::session_sensitive_actions.push_back (act);
248         act = ActionManager::register_action (editor_actions, "save-visual-state-11", _("Save View 11"), bind (mem_fun (*this, &Editor::start_visual_state_op), 10));
249         ActionManager::session_sensitive_actions.push_back (act);
250         act = ActionManager::register_action (editor_actions, "goto-visual-state-11", _("Goto View 11"), bind (mem_fun (*this, &Editor::cancel_visual_state_op), 10));
251         ActionManager::session_sensitive_actions.push_back (act);
252         act = ActionManager::register_action (editor_actions, "save-visual-state-12", _("Save View 12"), bind (mem_fun (*this, &Editor::start_visual_state_op), 11));
253         ActionManager::session_sensitive_actions.push_back (act);
254         act = ActionManager::register_action (editor_actions, "goto-visual-state-12", _("Goto View 12"), bind (mem_fun (*this, &Editor::cancel_visual_state_op), 11));
255         ActionManager::session_sensitive_actions.push_back (act);
256
257
258         act = ActionManager::register_action (editor_actions, "goto-mark-1", _("Locate to Mark 1"), bind (mem_fun (*this, &Editor::goto_nth_marker), 0));
259         ActionManager::session_sensitive_actions.push_back (act);
260         act = ActionManager::register_action (editor_actions, "goto-mark-2", _("Locate to Mark 2"), bind (mem_fun (*this, &Editor::goto_nth_marker), 1));
261         ActionManager::session_sensitive_actions.push_back (act);
262         act = ActionManager::register_action (editor_actions, "goto-mark-3", _("Locate to Mark 3"), bind (mem_fun (*this, &Editor::goto_nth_marker), 2));
263         ActionManager::session_sensitive_actions.push_back (act);
264         act = ActionManager::register_action (editor_actions, "goto-mark-4", _("Locate to Mark 4"), bind (mem_fun (*this, &Editor::goto_nth_marker), 3));
265         ActionManager::session_sensitive_actions.push_back (act);
266         act = ActionManager::register_action (editor_actions, "goto-mark-5", _("Locate to Mark 5"), bind (mem_fun (*this, &Editor::goto_nth_marker), 4));
267         ActionManager::session_sensitive_actions.push_back (act);
268         act = ActionManager::register_action (editor_actions, "goto-mark-6", _("Locate to Mark 6"), bind (mem_fun (*this, &Editor::goto_nth_marker), 5));
269         ActionManager::session_sensitive_actions.push_back (act);
270         act = ActionManager::register_action (editor_actions, "goto-mark-7", _("Locate to Mark 7"), bind (mem_fun (*this, &Editor::goto_nth_marker), 6));
271         ActionManager::session_sensitive_actions.push_back (act);
272         act = ActionManager::register_action (editor_actions, "goto-mark-8", _("Locate to Mark 8"), bind (mem_fun (*this, &Editor::goto_nth_marker), 7));
273         ActionManager::session_sensitive_actions.push_back (act);
274         act = ActionManager::register_action (editor_actions, "goto-mark-9", _("Locate to Mark 9"), bind (mem_fun (*this, &Editor::goto_nth_marker), 8));
275         ActionManager::session_sensitive_actions.push_back (act);
276
277         act = ActionManager::register_action (editor_actions, "jump-forward-to-mark", _("Jump Forward to Mark"), mem_fun(*this, &Editor::jump_forward_to_mark));
278         ActionManager::session_sensitive_actions.push_back (act);
279         act = ActionManager::register_action (editor_actions, "jump-backward-to-mark", _("Jump Backward to Mark"), mem_fun(*this, &Editor::jump_backward_to_mark));
280         ActionManager::session_sensitive_actions.push_back (act);
281         act = ActionManager::register_action (editor_actions, "add-location-from-playhead", _("Add Mark from Playhead"), mem_fun(*this, &Editor::add_location_from_playhead_cursor));
282         ActionManager::session_sensitive_actions.push_back (act);
283
284         act = ActionManager::register_action (editor_actions, "nudge-forward", _("Nudge Forward"), bind (mem_fun(*this, &Editor::nudge_forward), false, false));
285         ActionManager::session_sensitive_actions.push_back (act);
286         act = ActionManager::register_action (editor_actions, "nudge-next-forward", _("Nudge Next Forward"), bind (mem_fun(*this, &Editor::nudge_forward), true, false));
287         ActionManager::session_sensitive_actions.push_back (act);
288         act = ActionManager::register_action (editor_actions, "nudge-backward", _("Nudge Backward"), bind (mem_fun(*this, &Editor::nudge_backward), false, false));
289         ActionManager::session_sensitive_actions.push_back (act);
290         act = ActionManager::register_action (editor_actions, "nudge-next-backward", _("Nudge Next Backward"), bind (mem_fun(*this, &Editor::nudge_backward), true, false));
291         ActionManager::session_sensitive_actions.push_back (act);
292
293         act = ActionManager::register_action (editor_actions, "nudge-playhead-forward", _("Nudge Playhead Forward"), bind (mem_fun(*this, &Editor::nudge_forward), false, true));
294         ActionManager::session_sensitive_actions.push_back (act);
295         act = ActionManager::register_action (editor_actions, "nudge-playhead-backward", _("Nudge Playhead Backward"), bind (mem_fun(*this, &Editor::nudge_backward), false, true));
296         ActionManager::session_sensitive_actions.push_back (act);
297         act = ActionManager::register_action (editor_actions, "playhead-forward-to-grid", _("Forward to Grid"), mem_fun(*this, &Editor::playhead_forward_to_grid));
298         ActionManager::session_sensitive_actions.push_back (act);
299         act = ActionManager::register_action (editor_actions, "playhead-backward-to-grid", _("Backward to Grid"), mem_fun(*this, &Editor::playhead_backward_to_grid));
300         ActionManager::session_sensitive_actions.push_back (act);
301
302
303         act = ActionManager::register_action (editor_actions, "temporal-zoom-out", _("Zoom Out"), bind (mem_fun(*this, &Editor::temporal_zoom_step), true));
304         ActionManager::session_sensitive_actions.push_back (act);
305         act = ActionManager::register_action (editor_actions, "temporal-zoom-in", _("Zoom In"), bind (mem_fun(*this, &Editor::temporal_zoom_step), false));
306         ActionManager::session_sensitive_actions.push_back (act);
307         act = ActionManager::register_action (editor_actions, "zoom-to-session", _("Zoom to Session"), mem_fun(*this, &Editor::temporal_zoom_session));
308         ActionManager::session_sensitive_actions.push_back (act);
309         act = ActionManager::register_action (editor_actions, "zoom-to-region", _("Zoom to Region"), bind (mem_fun(*this, &Editor::toggle_zoom_region), false));
310         ActionManager::session_sensitive_actions.push_back (act);
311         act = ActionManager::register_action (editor_actions, "zoom-to-region-both-axes", _("Zoom to Region (W&H)"), bind (mem_fun(*this, &Editor::toggle_zoom_region), true));
312         ActionManager::session_sensitive_actions.push_back (act);
313         act = ActionManager::register_action (editor_actions, "toggle-zoom", _("Toggle Zoom State"), mem_fun(*this, &Editor::swap_visual_state));
314         ActionManager::session_sensitive_actions.push_back (act);
315
316         act = ActionManager::register_action (editor_actions, "move-selected-tracks-up", _("Move Selected Tracks Up"), bind (mem_fun(*_routes, &EditorRoutes::move_selected_tracks), true));
317         ActionManager::session_sensitive_actions.push_back (act);
318         act = ActionManager::register_action (editor_actions, "move-selected-tracks-down", _("Move Selected Tracks Down"), bind (mem_fun(*_routes, &EditorRoutes::move_selected_tracks), false));
319         ActionManager::session_sensitive_actions.push_back (act);
320
321         act = ActionManager::register_action (editor_actions, "scroll-tracks-up", _("Scroll Tracks Up"), mem_fun(*this, &Editor::scroll_tracks_up));
322         ActionManager::session_sensitive_actions.push_back (act);
323         act = ActionManager::register_action (editor_actions, "scroll-tracks-down", _("Scroll Tracks Down"), mem_fun(*this, &Editor::scroll_tracks_down));
324         ActionManager::session_sensitive_actions.push_back (act);
325         act = ActionManager::register_action (editor_actions, "step-tracks-up", _("Step Tracks Up"), mem_fun(*this, &Editor::scroll_tracks_up_line));
326         ActionManager::session_sensitive_actions.push_back (act);
327         act = ActionManager::register_action (editor_actions, "step-tracks-down", _("Step Tracks Down"), mem_fun(*this, &Editor::scroll_tracks_down_line));
328         ActionManager::session_sensitive_actions.push_back (act);
329
330         act = ActionManager::register_action (editor_actions, "scroll-backward", _("Scroll Backward"), bind (mem_fun(*this, &Editor::scroll_backward), 0.8f));
331         ActionManager::session_sensitive_actions.push_back (act);
332         act = ActionManager::register_action (editor_actions, "scroll-forward", _("Scroll Forward"), bind (mem_fun(*this, &Editor::scroll_forward), 0.8f));
333         ActionManager::session_sensitive_actions.push_back (act);
334         act = ActionManager::register_action (editor_actions, "goto", _("goto"), mem_fun(*this, &Editor::goto_frame));
335         ActionManager::session_sensitive_actions.push_back (act);
336         act = ActionManager::register_action (editor_actions, "center-playhead", _("Center Playhead"), mem_fun(*this, &Editor::center_playhead));
337         ActionManager::session_sensitive_actions.push_back (act);
338         act = ActionManager::register_action (editor_actions, "center-edit-cursor", _("Center Active Marker"), mem_fun(*this, &Editor::center_edit_point));
339         ActionManager::session_sensitive_actions.push_back (act);
340
341         act = ActionManager::register_action (editor_actions, "scroll-playhead-forward", _("Playhead Forward"), bind (mem_fun(*this, &Editor::scroll_playhead), true));;
342         ActionManager::session_sensitive_actions.push_back (act);
343         act = ActionManager::register_action (editor_actions, "scroll-playhead-backward", _("Playhead Backward"), bind (mem_fun(*this, &Editor::scroll_playhead), false));
344         ActionManager::session_sensitive_actions.push_back (act);
345
346         act = ActionManager::register_action (editor_actions, "playhead-to-edit", _("Playhead to Active Mark"), bind (mem_fun(*this, &Editor::cursor_align), true));
347         ActionManager::session_sensitive_actions.push_back (act);
348         act = ActionManager::register_action (editor_actions, "edit-to-playhead", _("Active Mark to Playhead"), bind (mem_fun(*this, &Editor::cursor_align), false));
349         ActionManager::session_sensitive_actions.push_back (act);
350
351         act = ActionManager::register_action (editor_actions, "trim-front", _("Trim Start at Edit Point"), mem_fun(*this, &Editor::trim_region_front));
352         ActionManager::session_sensitive_actions.push_back (act);
353         ActionManager::region_selection_sensitive_actions.push_back (act);
354         act = ActionManager::register_action (editor_actions, "trim-back", _("Trim End at Edit Point"), mem_fun(*this, &Editor::trim_region_back));
355         ActionManager::session_sensitive_actions.push_back (act);
356         ActionManager::region_selection_sensitive_actions.push_back (act);
357
358         act = ActionManager::register_action (editor_actions, "trim-from-start", _("Start to Edit Point"), mem_fun(*this, &Editor::trim_region_from_edit_point));
359         ActionManager::session_sensitive_actions.push_back (act);
360         ActionManager::region_selection_sensitive_actions.push_back (act);
361         act = ActionManager::register_action (editor_actions, "trim-to-end", _("Edit Point to End"), mem_fun(*this, &Editor::trim_region_to_edit_point));
362         ActionManager::session_sensitive_actions.push_back (act);
363         ActionManager::region_selection_sensitive_actions.push_back (act);
364         act = ActionManager::register_action (editor_actions, "trim-region-to-loop", _("Trim to Loop"), mem_fun(*this, &Editor::trim_region_to_loop));
365         ActionManager::session_sensitive_actions.push_back (act);
366         ActionManager::region_selection_sensitive_actions.push_back (act);
367         act = ActionManager::register_action (editor_actions, "trim-region-to-punch", _("Trim to Punch"), mem_fun(*this, &Editor::trim_region_to_punch));
368         ActionManager::session_sensitive_actions.push_back (act);
369         ActionManager::region_selection_sensitive_actions.push_back (act);
370
371         act = ActionManager::register_action (editor_actions, "trim-to-previous-region", _("Trim to Previous"), mem_fun(*this, &Editor::trim_region_to_previous_region_end));
372         ActionManager::session_sensitive_actions.push_back (act);
373         ActionManager::region_selection_sensitive_actions.push_back (act);
374         act = ActionManager::register_action (editor_actions, "trim-to-next-region", _("Trim to Next"), mem_fun(*this, &Editor::trim_region_to_next_region_start));
375         ActionManager::session_sensitive_actions.push_back (act);
376         ActionManager::region_selection_sensitive_actions.push_back (act);
377
378         act = ActionManager::register_action (editor_actions, "set-loop-from-edit-range", _("Set Loop from Edit Range"), bind (mem_fun(*this, &Editor::set_loop_from_edit_range), false));
379         ActionManager::session_sensitive_actions.push_back (act);
380         act = ActionManager::register_action (editor_actions, "set-loop-from-region", _("Set Loop from Region"), bind (mem_fun(*this, &Editor::set_loop_from_region), false));
381         ActionManager::session_sensitive_actions.push_back (act);
382         ActionManager::region_selection_sensitive_actions.push_back (act);
383         act = ActionManager::register_action (editor_actions, "loop-region", _("Loop Region"), bind (mem_fun(*this, &Editor::set_loop_from_region), true));
384         ActionManager::session_sensitive_actions.push_back (act);
385         ActionManager::region_selection_sensitive_actions.push_back (act);
386         act = ActionManager::register_action (editor_actions, "set-punch-from-edit-range", _("Set Punch from Edit Range"), mem_fun(*this, &Editor::set_punch_from_edit_range));
387         ActionManager::session_sensitive_actions.push_back (act);
388         act = ActionManager::register_action (editor_actions, "set-punch-from-region", _("Set Punch From Region"), mem_fun(*this, &Editor::set_punch_from_region));
389         ActionManager::session_sensitive_actions.push_back (act);
390         ActionManager::region_selection_sensitive_actions.push_back (act);
391         act = ActionManager::register_action (editor_actions, "pitch-shift-region", _("Transpose"), mem_fun(*this, &Editor::pitch_shift_regions));
392         ActionManager::session_sensitive_actions.push_back (act);
393         ActionManager::region_selection_sensitive_actions.push_back (act);
394         act = ActionManager::register_action (editor_actions, "toggle-opaque-region", _("Toggle Opaque"), mem_fun(*this, &Editor::toggle_region_opaque));
395         ActionManager::session_sensitive_actions.push_back (act);
396         ActionManager::region_selection_sensitive_actions.push_back (act);
397         act = ActionManager::register_action (editor_actions, "add-range-marker-from-region", _("Add 1 Range Marker"), mem_fun(*this, &Editor::add_location_from_audio_region));
398         ActionManager::session_sensitive_actions.push_back (act);
399         ActionManager::region_selection_sensitive_actions.push_back (act);
400         act = ActionManager::register_action (editor_actions, "add-range-markers-from-region", _("Add Range Marker(s)"), mem_fun(*this, &Editor::add_locations_from_audio_region));
401         ActionManager::session_sensitive_actions.push_back (act);
402         ActionManager::region_selection_sensitive_actions.push_back (act);
403         
404         act = ActionManager::register_action (editor_actions, "set-fade-in-length", _("Set Fade In Length"), bind (mem_fun(*this, &Editor::set_fade_length), true));
405         ActionManager::session_sensitive_actions.push_back (act);
406         act = ActionManager::register_action (editor_actions, "toggle-fade-in-active", _("Toggle Fade In Active"), bind (mem_fun(*this, &Editor::toggle_fade_active), true));
407         ActionManager::session_sensitive_actions.push_back (act);
408         act = ActionManager::register_action (editor_actions, "set-fade-out-length", _("Set Fade Out Length"), bind (mem_fun(*this, &Editor::set_fade_length), false));
409         ActionManager::session_sensitive_actions.push_back (act);
410         act = ActionManager::register_action (editor_actions, "toggle-fade-out-active", _("Toggle Fade Out Active"), bind (mem_fun(*this, &Editor::toggle_fade_active), false));
411         ActionManager::session_sensitive_actions.push_back (act);
412
413         act = ActionManager::register_action (editor_actions, "align-regions-start", _("Align Regions Start"), bind (mem_fun(*this, &Editor::align), ARDOUR::Start));
414         ActionManager::session_sensitive_actions.push_back (act);
415         ActionManager::region_selection_sensitive_actions.push_back (act);
416         act = ActionManager::register_action (editor_actions, "align-regions-start-relative", _("Align Regions Start Relative"), bind (mem_fun(*this, &Editor::align_relative), ARDOUR::Start));
417         ActionManager::session_sensitive_actions.push_back (act);
418         ActionManager::region_selection_sensitive_actions.push_back (act);
419         act = ActionManager::register_action (editor_actions, "align-regions-end", _("Align Regions End"), bind (mem_fun(*this, &Editor::align), ARDOUR::End));
420         ActionManager::session_sensitive_actions.push_back (act);
421         ActionManager::region_selection_sensitive_actions.push_back (act);
422         act = ActionManager::register_action (editor_actions, "align-regions-end-relative", _("Align Regions End Relative"), bind (mem_fun(*this, &Editor::align_relative), ARDOUR::End));
423         ActionManager::session_sensitive_actions.push_back (act);
424         ActionManager::region_selection_sensitive_actions.push_back (act);
425
426         act = ActionManager::register_action (editor_actions, "align-regions-sync", _("Align Regions Sync"), bind (mem_fun(*this, &Editor::align), ARDOUR::SyncPoint));
427         ActionManager::session_sensitive_actions.push_back (act);
428         ActionManager::region_selection_sensitive_actions.push_back (act);
429         act = ActionManager::register_action (editor_actions, "align-regions-sync-relative", _("Align Regions Sync Relative"), bind (mem_fun(*this, &Editor::align_relative), ARDOUR::SyncPoint));
430         ActionManager::session_sensitive_actions.push_back (act);
431         ActionManager::region_selection_sensitive_actions.push_back (act);
432
433         act = ActionManager::register_action (editor_actions, "play-from-edit-point", _("Play From Edit Point"), mem_fun(*this, &Editor::play_from_edit_point));
434         ActionManager::session_sensitive_actions.push_back (act);
435         act = ActionManager::register_action (editor_actions, "play-from-edit-point-and-return", _("Play from Edit Point & Return"), mem_fun(*this, &Editor::play_from_edit_point_and_return));
436         ActionManager::session_sensitive_actions.push_back (act);
437
438         act = ActionManager::register_action (editor_actions, "play-edit-range", _("Play Edit Range"), mem_fun(*this, &Editor::play_edit_range));
439         act = ActionManager::register_action (editor_actions, "play-selected-regions", _("Play Selected Region(s)"), mem_fun(*this, &Editor::play_selected_region));
440         ActionManager::session_sensitive_actions.push_back (act);
441         ActionManager::region_selection_sensitive_actions.push_back (act);
442         act = ActionManager::register_action (editor_actions, "brush-at-mouse", _("Brush at Mouse"), mem_fun(*this, &Editor::kbd_brush));
443         ActionManager::session_sensitive_actions.push_back (act);
444
445         act = ActionManager::register_action (editor_actions, "set-playhead", _("Playhead to Mouse"), mem_fun(*this, &Editor::set_playhead_cursor));
446         ActionManager::session_sensitive_actions.push_back (act);
447         act = ActionManager::register_action (editor_actions, "set-edit-point", _("Active Marker to Mouse"), mem_fun(*this, &Editor::set_edit_point));
448         ActionManager::session_sensitive_actions.push_back (act);
449
450         act = ActionManager::register_action (editor_actions, "duplicate-region", _("Duplicate Region"), bind (mem_fun(*this, &Editor::duplicate_dialog), false));
451         ActionManager::session_sensitive_actions.push_back (act);
452         ActionManager::region_selection_sensitive_actions.push_back (act);
453         act = ActionManager::register_action (editor_actions, "multi-duplicate-region", _("Multi-Duplicate Region"), bind (mem_fun(*this, &Editor::duplicate_dialog), true));
454         ActionManager::session_sensitive_actions.push_back (act);
455         ActionManager::region_selection_sensitive_actions.push_back (act);
456         act = ActionManager::register_action (editor_actions, "duplicate-range", _("Duplicate Range"), bind (mem_fun(*this, &Editor::duplicate_dialog), false));
457         ActionManager::session_sensitive_actions.push_back (act);
458         ActionManager::region_selection_sensitive_actions.push_back (act);
459         act = ActionManager::register_action (editor_actions, "insert-region", _("Insert Region"), mem_fun(*this, &Editor::keyboard_insert_region_list_selection));
460         ActionManager::session_sensitive_actions.push_back (act);
461         ActionManager::region_selection_sensitive_actions.push_back (act);
462         act = ActionManager::register_action (editor_actions, "normalize-region", _("Normalize Region"), mem_fun(*this, &Editor::normalize_region));
463         ActionManager::session_sensitive_actions.push_back (act);
464         ActionManager::region_selection_sensitive_actions.push_back (act);
465         act = ActionManager::register_action (editor_actions, "rename-region", _("Rename"), mem_fun(*this, &Editor::rename_region));
466         ActionManager::session_sensitive_actions.push_back (act);
467         ActionManager::region_selection_sensitive_actions.push_back (act);
468         act = ActionManager::register_action (editor_actions, "auto-rename-region", _("Auto-Rename"), mem_fun(*this, &Editor::rename_region));
469         ActionManager::session_sensitive_actions.push_back (act);
470         ActionManager::region_selection_sensitive_actions.push_back (act);
471         act = ActionManager::register_action (editor_actions, "boost-region-gain", _("Boost Region Gain"), bind (mem_fun(*this, &Editor::adjust_region_scale_amplitude), true));
472         ActionManager::session_sensitive_actions.push_back (act);
473         ActionManager::region_selection_sensitive_actions.push_back (act);
474         act = ActionManager::register_action (editor_actions, "cut-region-gain", _("Cut Region Gain"), bind (mem_fun(*this, &Editor::adjust_region_scale_amplitude), false));
475         ActionManager::session_sensitive_actions.push_back (act);
476         ActionManager::region_selection_sensitive_actions.push_back (act);
477         act = ActionManager::register_action (editor_actions, "split-region", _("Split Region"), mem_fun(*this, &Editor::split));
478         ActionManager::session_sensitive_actions.push_back (act);
479         ActionManager::region_selection_sensitive_actions.push_back (act);
480         act = ActionManager::register_action (editor_actions, "set-region-sync-position", _("Set Region Sync Position"), mem_fun(*this, &Editor::set_region_sync_from_edit_point));
481         ActionManager::session_sensitive_actions.push_back (act);
482         ActionManager::region_selection_sensitive_actions.push_back (act);
483         act = ActionManager::register_action (editor_actions, "remove-region-sync", _("Remove Region Sync"), mem_fun(*this, &Editor::remove_region_sync));
484         ActionManager::session_sensitive_actions.push_back (act);
485         ActionManager::region_selection_sensitive_actions.push_back (act);
486         act = ActionManager::register_action (editor_actions, "raise-region", _("Raise Region"), mem_fun(*this, &Editor::raise_region));
487         ActionManager::session_sensitive_actions.push_back (act);
488         ActionManager::region_selection_sensitive_actions.push_back (act);
489         act = ActionManager::register_action (editor_actions, "lower-region", _("Lower Region"), mem_fun(*this, &Editor::lower_region));
490         ActionManager::session_sensitive_actions.push_back (act);
491         ActionManager::region_selection_sensitive_actions.push_back (act);
492         act = ActionManager::register_action (editor_actions, "export-region", _("Export Region"), mem_fun(*this, &Editor::export_region));
493         ActionManager::session_sensitive_actions.push_back (act);
494         ActionManager::region_selection_sensitive_actions.push_back (act);
495         act = ActionManager::register_toggle_action (editor_actions, "lock-region", _("Lock Region"), mem_fun(*this, &Editor::toggle_region_lock));
496         ActionManager::session_sensitive_actions.push_back (act);
497         ActionManager::region_selection_sensitive_actions.push_back (act);
498         act = ActionManager::register_toggle_action (editor_actions, "glue-region", _("Glue Region to Bars & Beats"), bind (mem_fun (*this, &Editor::set_region_lock_style), Region::MusicTime));
499         ActionManager::session_sensitive_actions.push_back (act);
500         ActionManager::region_selection_sensitive_actions.push_back (act);
501         act = ActionManager::register_action (editor_actions, "naturalize-region", _("Move to Original Position"), mem_fun (*this, &Editor::naturalize));
502         ActionManager::session_sensitive_actions.push_back (act);
503         ActionManager::region_selection_sensitive_actions.push_back (act);
504         act = ActionManager::register_action (editor_actions, "reverse-region", _("Reverse"), mem_fun (*this, &Editor::reverse_region));
505         ActionManager::session_sensitive_actions.push_back (act);
506         ActionManager::region_selection_sensitive_actions.push_back (act);
507         act = ActionManager::register_action (editor_actions, "monoize-region", _("Make mono regions"), (mem_fun(*this, &Editor::split_multichannel_region)));
508         ActionManager::session_sensitive_actions.push_back (act);
509         ActionManager::region_selection_sensitive_actions.push_back (act);
510         act = ActionManager::register_action (editor_actions, "region-fill-track", _("Fill Track"), (mem_fun(*this, &Editor::region_fill_track)));
511         ActionManager::session_sensitive_actions.push_back (act);
512         ActionManager::region_selection_sensitive_actions.push_back (act);
513         act = ActionManager::register_action (editor_actions, "mute-unmute-region", _("Mute/Unmute Region"), mem_fun(*this, &Editor::kbd_mute_unmute_region));
514         ActionManager::session_sensitive_actions.push_back (act);
515         ActionManager::region_selection_sensitive_actions.push_back (act);
516
517         undo_action = act = ActionManager::register_action (editor_actions, "undo", _("Undo"), bind (mem_fun(*this, &Editor::undo), 1U));
518         ActionManager::session_sensitive_actions.push_back (act);
519         redo_action = act = ActionManager::register_action (editor_actions, "redo", _("Redo"), bind (mem_fun(*this, &Editor::redo), 1U));
520         ActionManager::session_sensitive_actions.push_back (act);
521
522         act = ActionManager::register_action (editor_actions, "export-audio", _("Export Audio"), mem_fun(*this, &Editor::export_audio));
523         ActionManager::session_sensitive_actions.push_back (act);
524         act = ActionManager::register_action (editor_actions, "export-range", _("Export Range"), mem_fun(*this, &Editor::export_range));
525         ActionManager::session_sensitive_actions.push_back (act);
526
527         act = ActionManager::register_action (editor_actions, "editor-separate", _("Separate"), mem_fun(*this, &Editor::separate_region_from_selection));
528         ActionManager::session_sensitive_actions.push_back (act);
529         ActionManager::mouse_edit_point_requires_canvas_actions.push_back (act);
530         act = ActionManager::register_action (editor_actions, "separate-from-punch", _("Separate Using Punch Range"), mem_fun(*this, &Editor::separate_region_from_punch));
531         ActionManager::session_sensitive_actions.push_back (act);
532         ActionManager::mouse_edit_point_requires_canvas_actions.push_back (act);
533         act = ActionManager::register_action (editor_actions, "separate-from-loop", _("Separate Using Loop Range"), mem_fun(*this, &Editor::separate_region_from_loop));
534         ActionManager::session_sensitive_actions.push_back (act);
535         ActionManager::mouse_edit_point_requires_canvas_actions.push_back (act);
536         act = ActionManager::register_action (editor_actions, "editor-crop", _("Crop"), mem_fun(*this, &Editor::crop_region_to_selection));
537         ActionManager::session_sensitive_actions.push_back (act);
538         ActionManager::mouse_edit_point_requires_canvas_actions.push_back (act);
539         act = ActionManager::register_action (editor_actions, "editor-cut", _("Cut"), mem_fun(*this, &Editor::cut));
540         ActionManager::session_sensitive_actions.push_back (act);
541         /* Note: for now, editor-delete does the exact same thing as editor-cut */
542         act = ActionManager::register_action (editor_actions, "editor-delete", _("Delete"), mem_fun(*this, &Editor::cut));
543         ActionManager::session_sensitive_actions.push_back (act);
544         act = ActionManager::register_action (editor_actions, "editor-copy", _("Copy"), mem_fun(*this, &Editor::copy));
545         ActionManager::session_sensitive_actions.push_back (act);
546         act = ActionManager::register_action (editor_actions, "editor-paste", _("Paste"), mem_fun(*this, &Editor::keyboard_paste));
547         ActionManager::session_sensitive_actions.push_back (act);
548
549         act = ActionManager::register_action (editor_actions, "quantize-region", _("Quantize Region"), mem_fun(*this, &Editor::quantize_region));
550         ActionManager::session_sensitive_actions.push_back (act);
551         ActionManager::region_selection_sensitive_actions.push_back (act);
552         
553         act = ActionManager::register_action (editor_actions, "set-tempo-from-region", _("Set Tempo from Region=Bar"), mem_fun(*this, &Editor::use_region_as_bar));
554         ActionManager::session_sensitive_actions.push_back (act);
555         ActionManager::region_selection_sensitive_actions.push_back (act);
556         act = ActionManager::register_action (editor_actions, "set-tempo-from-edit-range", _("Set Tempo from Edit Range=Bar"), mem_fun(*this, &Editor::use_range_as_bar));
557         ActionManager::session_sensitive_actions.push_back (act);
558
559         act = ActionManager::register_action (editor_actions, "split-region-at-transients", _("Split Regions At Percussion Onsets"), mem_fun(*this, &Editor::split_region_at_transients));
560         ActionManager::session_sensitive_actions.push_back (act);
561         ActionManager::region_selection_sensitive_actions.push_back (act);
562         act = ActionManager::register_action (editor_actions, "toggle-rhythm-ferret", _("Rhythm Ferret"), mem_fun(*this, &Editor::show_rhythm_ferret));
563         ActionManager::session_sensitive_actions.push_back (act);
564         act = ActionManager::register_action (editor_actions, "toggle-bundle-manager", _("Bundle Manager"), mem_fun (*this, &Editor::show_bundle_manager));
565         ActionManager::session_sensitive_actions.push_back (act);
566         act = ActionManager::register_action (editor_actions, "toggle-audio-connection-manager", _("Audio Connection Manager"), bind (mem_fun (*this, &Editor::show_global_port_matrix), ARDOUR::DataType::AUDIO));
567         ActionManager::session_sensitive_actions.push_back (act);
568         act = ActionManager::register_action (editor_actions, "toggle-midi-connection-manager", _("MIDI Connection Manager"), bind (mem_fun (*this, &Editor::show_global_port_matrix), ARDOUR::DataType::MIDI));
569         ActionManager::session_sensitive_actions.push_back (act);
570
571         act = ActionManager::register_action (editor_actions, "tab-to-transient-forwards", _("Move Forward to Transient"), bind (mem_fun(*this, &Editor::tab_to_transient), true));
572         ActionManager::session_sensitive_actions.push_back (act);
573         act = ActionManager::register_action (editor_actions, "tab-to-transient-backwards", _("Move Backwards to Transient"), bind (mem_fun(*this, &Editor::tab_to_transient), false));
574         ActionManager::session_sensitive_actions.push_back (act);
575
576         act = ActionManager::register_action (editor_actions, "crop", _("Crop"), mem_fun(*this, &Editor::crop_region_to_selection));
577         ActionManager::session_sensitive_actions.push_back (act);
578         act = ActionManager::register_action (editor_actions, "insert-chunk", _("Insert Chunk"), bind (mem_fun(*this, &Editor::paste_named_selection), 1.0f));
579         ActionManager::session_sensitive_actions.push_back (act);
580
581         act = ActionManager::register_action (editor_actions, "split-at-edit-cursor", _("Split At Edit Point"), mem_fun(*this, &Editor::split_region));
582         ActionManager::edit_point_in_region_sensitive_actions.push_back (act);
583
584         act = ActionManager::register_action (editor_actions, "start-range", _("Start Range"), mem_fun(*this, &Editor::keyboard_selection_begin));
585         ActionManager::session_sensitive_actions.push_back (act);
586         act = ActionManager::register_action (editor_actions, "finish-range", _("Finish Range"), bind (mem_fun(*this, &Editor::keyboard_selection_finish), false));
587         ActionManager::session_sensitive_actions.push_back (act);
588         act = ActionManager::register_action (editor_actions, "finish-add-range", _("Finish add Range"), bind (mem_fun(*this, &Editor::keyboard_selection_finish), true));
589         ActionManager::session_sensitive_actions.push_back (act);
590
591         act = ActionManager::register_action (editor_actions, "extend-range-to-end-of-region", _("Extend Range to End of Region"), bind (mem_fun(*this, &Editor::extend_selection_to_end_of_region), false));
592         ActionManager::session_sensitive_actions.push_back (act);
593         act = ActionManager::register_action (editor_actions, "extend-range-to-start-of-region", _("Extend Range to Start of Region"), bind (mem_fun(*this, &Editor::extend_selection_to_start_of_region), false));
594         ActionManager::session_sensitive_actions.push_back (act);
595
596         act = ActionManager::register_toggle_action (editor_actions, "toggle-follow-playhead", _("Follow Playhead"), (mem_fun(*this, &Editor::toggle_follow_playhead)));
597         ActionManager::session_sensitive_actions.push_back (act);
598         act = ActionManager::register_action (editor_actions, "remove-last-capture", _("Remove Last Capture"), (mem_fun(*this, &Editor::remove_last_capture)));
599         ActionManager::session_sensitive_actions.push_back (act);
600
601         act = ActionManager::register_action (editor_actions, "insert-time", _("Insert Time"), (mem_fun(*this, &Editor::do_insert_time)));
602         ActionManager::session_sensitive_actions.push_back (act);
603         ActionManager::track_selection_sensitive_actions.push_back (act);
604
605         act = ActionManager::register_action (editor_actions, "toggle-track-active", _("Toggle Active"), (mem_fun(*this, &Editor::toggle_tracks_active)));
606         ActionManager::session_sensitive_actions.push_back (act);
607         ActionManager::track_selection_sensitive_actions.push_back (act);
608         if (Profile->get_sae()) {
609                 act = ActionManager::register_action (editor_actions, "remove-track", _("Delete"), (mem_fun(*this, &Editor::remove_tracks)));
610         } else {
611                 act = ActionManager::register_action (editor_actions, "remove-track", _("Remove"), (mem_fun(*this, &Editor::remove_tracks)));
612         }
613         ActionManager::session_sensitive_actions.push_back (act);
614         ActionManager::track_selection_sensitive_actions.push_back (act);
615
616         act = ActionManager::register_action (editor_actions, "fit-tracks", _("Fit Selected Tracks"), mem_fun(*this, &Editor::fit_selected_tracks));
617         ActionManager::session_sensitive_actions.push_back (act);
618         act = ActionManager::register_action (editor_actions, "track-height-largest", _("Largest"), bind (
619                         mem_fun(*this, &Editor::set_track_height), TimeAxisView::hLargest));
620         ActionManager::session_sensitive_actions.push_back (act);
621         ActionManager::track_selection_sensitive_actions.push_back (act);
622         act = ActionManager::register_action (editor_actions, "track-height-larger", _("Larger"), bind (
623                         mem_fun(*this, &Editor::set_track_height), TimeAxisView::hLarger));
624         ActionManager::session_sensitive_actions.push_back (act);
625         ActionManager::track_selection_sensitive_actions.push_back (act);
626         act = ActionManager::register_action (editor_actions, "track-height-large", _("Large"), bind (
627                         mem_fun(*this, &Editor::set_track_height), TimeAxisView::hLarge));
628         ActionManager::session_sensitive_actions.push_back (act);
629         ActionManager::track_selection_sensitive_actions.push_back (act);
630         act = ActionManager::register_action (editor_actions, "track-height-normal", _("Normal"), bind (
631                         mem_fun(*this, &Editor::set_track_height), TimeAxisView::hNormal));
632         ActionManager::session_sensitive_actions.push_back (act);
633         ActionManager::track_selection_sensitive_actions.push_back (act);
634         act = ActionManager::register_action (editor_actions, "track-height-small", _("Small"), bind (
635                         mem_fun(*this, &Editor::set_track_height), TimeAxisView::hSmall));
636         ActionManager::track_selection_sensitive_actions.push_back (act);
637         ActionManager::session_sensitive_actions.push_back (act);
638         ActionManager::track_selection_sensitive_actions.push_back (act);
639         act = ActionManager::register_action (editor_actions, "track-height-smaller", _("Smaller"), bind (
640                         mem_fun(*this, &Editor::set_track_height), TimeAxisView::hSmaller));
641         ActionManager::session_sensitive_actions.push_back (act);
642         ActionManager::track_selection_sensitive_actions.push_back (act);
643
644         Glib::RefPtr<ActionGroup> zoom_actions = ActionGroup::create (X_("Zoom"));
645         RadioAction::Group zoom_group;
646
647         ActionManager::register_radio_action (zoom_actions, zoom_group, "zoom-focus-left", _("Zoom Focus Left"), bind (mem_fun(*this, &Editor::zoom_focus_chosen), Editing::ZoomFocusLeft));
648         ActionManager::session_sensitive_actions.push_back (act);
649         ActionManager::register_radio_action (zoom_actions, zoom_group, "zoom-focus-right", _("Zoom Focus Right"), bind (mem_fun(*this, &Editor::zoom_focus_chosen), Editing::ZoomFocusRight));
650         ActionManager::session_sensitive_actions.push_back (act);
651         ActionManager::register_radio_action (zoom_actions, zoom_group, "zoom-focus-center", _("Zoom Focus Center"), bind (mem_fun(*this, &Editor::zoom_focus_chosen), Editing::ZoomFocusCenter));
652         ActionManager::session_sensitive_actions.push_back (act);
653         ActionManager::register_radio_action (zoom_actions, zoom_group, "zoom-focus-playhead", _("Zoom Focus Playhead"), bind (mem_fun(*this, &Editor::zoom_focus_chosen), Editing::ZoomFocusPlayhead));
654         ActionManager::session_sensitive_actions.push_back (act);
655         ActionManager::register_radio_action (zoom_actions, zoom_group, "zoom-focus-mouse", _("Zoom Focus Mouse"), bind (mem_fun(*this, &Editor::zoom_focus_chosen), Editing::ZoomFocusMouse));
656         ActionManager::session_sensitive_actions.push_back (act);
657         ActionManager::register_radio_action (zoom_actions, zoom_group, "zoom-focus-edit", _("Zoom Focus Edit"), bind (mem_fun(*this, &Editor::zoom_focus_chosen), Editing::ZoomFocusEdit));
658         ActionManager::session_sensitive_actions.push_back (act);
659
660         Glib::RefPtr<ActionGroup> mouse_mode_actions = ActionGroup::create (X_("MouseMode"));
661         RadioAction::Group mouse_mode_group;
662
663         ActionManager::register_radio_action (mouse_mode_actions, mouse_mode_group, "set-mouse-mode-object", _("Object Tool"), bind (mem_fun(*this, &Editor::set_mouse_mode), Editing::MouseObject, false));
664         ActionManager::register_radio_action (mouse_mode_actions, mouse_mode_group, "set-mouse-mode-range", _("Range Tool"), bind (mem_fun(*this, &Editor::set_mouse_mode), Editing::MouseRange, false));
665         ActionManager::register_radio_action (mouse_mode_actions, mouse_mode_group, "set-mouse-mode-gain", _("Gain Tool"), bind (mem_fun(*this, &Editor::set_mouse_mode), Editing::MouseGain, false));
666         ActionManager::register_radio_action (mouse_mode_actions, mouse_mode_group, "set-mouse-mode-zoom", _("Zoom Tool"), bind (mem_fun(*this, &Editor::set_mouse_mode), Editing::MouseZoom, false));
667         ActionManager::register_radio_action (mouse_mode_actions, mouse_mode_group, "set-mouse-mode-timefx", _("Timefx Tool"), bind (mem_fun(*this, &Editor::set_mouse_mode), Editing::MouseTimeFX, false));
668         ActionManager::register_radio_action (mouse_mode_actions, mouse_mode_group, "set-mouse-mode-note", _("Note Tool"), bind (mem_fun(*this, &Editor::set_mouse_mode), Editing::MouseNote, false));
669
670         ActionManager::register_action (editor_actions, "step-mouse-mode", _("Step Mouse Mode"), bind (mem_fun(*this, &Editor::step_mouse_mode), true));
671         
672         RadioAction::Group edit_point_group;
673         ActionManager::register_radio_action (editor_actions, edit_point_group, X_("edit-at-playhead"), _("Playhead"), (bind (mem_fun(*this, &Editor::edit_point_chosen), Editing::EditAtPlayhead)));
674         ActionManager::register_radio_action (editor_actions, edit_point_group, X_("edit-at-mouse"), _("Mouse"), (bind (mem_fun(*this, &Editor::edit_point_chosen), Editing::EditAtPlayhead)));
675         ActionManager::register_radio_action (editor_actions, edit_point_group, X_("edit-at-selected-marker"), _("Marker"), (bind (mem_fun(*this, &Editor::edit_point_chosen), Editing::EditAtPlayhead)));
676
677         ActionManager::register_action (editor_actions, "cycle-edit-point", _("Change edit point"), bind (mem_fun (*this, &Editor::cycle_edit_point), false));
678         ActionManager::register_action (editor_actions, "cycle-edit-point-with-marker", _("Change edit point (w/Marker)"), bind (mem_fun (*this, &Editor::cycle_edit_point), true));
679         if (!Profile->get_sae()) {
680                 ActionManager::register_action (editor_actions, "set-edit-splice", _("Splice"), bind (mem_fun (*this, &Editor::set_edit_mode), Splice));
681         }
682         ActionManager::register_action (editor_actions, "set-edit-slide", _("Slide"), bind (mem_fun (*this, &Editor::set_edit_mode), Slide));
683         ActionManager::register_action (editor_actions, "set-edit-lock", _("Lock"), bind (mem_fun (*this, &Editor::set_edit_mode), Lock));
684         ActionManager::register_action (editor_actions, "toggle-edit-mode", _("Toggle Edit Mode"), mem_fun (*this, &Editor::cycle_edit_mode));
685
686         ActionManager::register_action (editor_actions, X_("SnapTo"), _("Snap to"));
687         ActionManager::register_action (editor_actions, X_("SnapMode"), _("Snap Mode"));
688
689         RadioAction::Group snap_mode_group;
690         ActionManager::register_radio_action (editor_actions, snap_mode_group, X_("snap-off"), _("No Grid"), (bind (mem_fun(*this, &Editor::snap_mode_chosen), Editing::SnapOff)));
691         ActionManager::register_radio_action (editor_actions, snap_mode_group, X_("snap-normal"), _("Grid"), (bind (mem_fun(*this, &Editor::snap_mode_chosen), Editing::SnapNormal)));
692         ActionManager::register_radio_action (editor_actions, snap_mode_group, X_("snap-magnetic"), _("Magnetic"), (bind (mem_fun(*this, &Editor::snap_mode_chosen), Editing::SnapMagnetic)));
693
694         ActionManager::register_action (editor_actions, X_("cycle-snap-mode"), _("Next Snap Mode"), mem_fun (*this, &Editor::cycle_snap_mode));
695         ActionManager::register_action (editor_actions, X_("cycle-snap-choice"), _("Next Snap Choice"), mem_fun (*this, &Editor::cycle_snap_choice));
696
697         Glib::RefPtr<ActionGroup> snap_actions = ActionGroup::create (X_("Snap"));
698         RadioAction::Group snap_choice_group;
699
700         ActionManager::register_radio_action (snap_actions, snap_choice_group, X_("snap-to-cd-frame"), _("Snap to CD Frame"), (bind (mem_fun(*this, &Editor::snap_type_chosen), Editing::SnapToCDFrame)));
701         ActionManager::register_radio_action (snap_actions, snap_choice_group, X_("snap-to-smpte-frame"), _("Snap to SMPTE frame"), (bind (mem_fun(*this, &Editor::snap_type_chosen), Editing::SnapToSMPTEFrame)));
702         ActionManager::register_radio_action (snap_actions, snap_choice_group, X_("snap-to-smpte-seconds"), _("Snap to SMPTE seconds"), (bind (mem_fun(*this, &Editor::snap_type_chosen), Editing::SnapToSMPTESeconds)));
703         ActionManager::register_radio_action (snap_actions, snap_choice_group, X_("snap-to-smpte-minutes"), _("Snap to SMPTE minutes"), (bind (mem_fun(*this, &Editor::snap_type_chosen), Editing::SnapToSMPTEMinutes)));
704         ActionManager::register_radio_action (snap_actions, snap_choice_group, X_("snap-to-seconds"), _("Snap to Seconds"), (bind (mem_fun(*this, &Editor::snap_type_chosen), Editing::SnapToSeconds)));
705         ActionManager::register_radio_action (snap_actions, snap_choice_group, X_("snap-to-minutes"), _("Snap to Minutes"), (bind (mem_fun(*this, &Editor::snap_type_chosen), Editing::SnapToMinutes)));
706         ActionManager::register_radio_action (snap_actions, snap_choice_group, X_("snap-to-thirtyseconds"), _("Snap to Thirtyseconds"), (bind (mem_fun(*this, &Editor::snap_type_chosen), Editing::SnapToAThirtysecondBeat)));
707         ActionManager::register_radio_action (snap_actions, snap_choice_group, X_("snap-to-asixteenthbeat"), _("Snap to Asixteenthbeat"), (bind (mem_fun(*this, &Editor::snap_type_chosen), Editing::SnapToASixteenthBeat)));
708         ActionManager::register_radio_action (snap_actions, snap_choice_group, X_("snap-to-eighths"), _("Snap to Eighths"), (bind (mem_fun(*this, &Editor::snap_type_chosen), Editing::SnapToAEighthBeat)));
709         ActionManager::register_radio_action (snap_actions, snap_choice_group, X_("snap-to-quarters"), _("Snap to Quarters"), (bind (mem_fun(*this, &Editor::snap_type_chosen), Editing::SnapToAQuarterBeat)));
710         ActionManager::register_radio_action (snap_actions, snap_choice_group, X_("snap-to-thirds"), _("Snap to Thirds"), (bind (mem_fun(*this, &Editor::snap_type_chosen), Editing::SnapToAThirdBeat)));
711         ActionManager::register_radio_action (snap_actions, snap_choice_group, X_("snap-to-beat"), _("Snap to Beat"), (bind (mem_fun(*this, &Editor::snap_type_chosen), Editing::SnapToBeat)));
712         ActionManager::register_radio_action (snap_actions, snap_choice_group, X_("snap-to-bar"), _("Snap to Bar"), (bind (mem_fun(*this, &Editor::snap_type_chosen), Editing::SnapToBar)));
713         ActionManager::register_radio_action (snap_actions, snap_choice_group, X_("snap-to-mark"), _("Snap to Mark"), (bind (mem_fun(*this, &Editor::snap_type_chosen), Editing::SnapToMark)));
714         ActionManager::register_radio_action (snap_actions, snap_choice_group, X_("snap-to-region-start"), _("Snap to Region start"), (bind (mem_fun(*this, &Editor::snap_type_chosen), Editing::SnapToRegionStart)));
715         ActionManager::register_radio_action (snap_actions, snap_choice_group, X_("snap-to-region-end"), _("Snap to Region End"), (bind (mem_fun(*this, &Editor::snap_type_chosen), Editing::SnapToRegionEnd)));
716         ActionManager::register_radio_action (snap_actions, snap_choice_group, X_("snap-to-region-sync"), _("Snap to Region Sync"), (bind (mem_fun(*this, &Editor::snap_type_chosen), Editing::SnapToRegionSync)));
717         ActionManager::register_radio_action (snap_actions, snap_choice_group, X_("snap-to-region-boundary"), _("Snap to Region Boundary"), (bind (mem_fun(*this, &Editor::snap_type_chosen), Editing::SnapToRegionBoundary)));
718
719         /* RULERS */
720         
721         Glib::RefPtr<ActionGroup> ruler_actions = ActionGroup::create (X_("Rulers"));
722         ruler_tempo_action = Glib::RefPtr<ToggleAction>::cast_static (ActionManager::register_toggle_action (ruler_actions, X_("toggle-tempo-ruler"), _("Tempo"), bind (mem_fun(*this, &Editor::toggle_ruler_visibility), ruler_time_tempo)));
723         ruler_meter_action = Glib::RefPtr<ToggleAction>::cast_static (ActionManager::register_toggle_action (ruler_actions, X_("toggle-meter-ruler"), _("Meter"), bind (mem_fun(*this, &Editor::toggle_ruler_visibility), ruler_time_meter)));
724         ruler_range_action = Glib::RefPtr<ToggleAction>::cast_static (ActionManager::register_toggle_action (ruler_actions, X_("toggle-range-ruler"), _("Ranges"), bind (mem_fun(*this, &Editor::toggle_ruler_visibility), ruler_time_range_marker)));
725         ruler_marker_action = Glib::RefPtr<ToggleAction>::cast_static (ActionManager::register_toggle_action (ruler_actions, X_("toggle-marker-ruler"), _("Markers"), bind (mem_fun(*this, &Editor::toggle_ruler_visibility), ruler_time_marker)));
726         ruler_cd_marker_action = Glib::RefPtr<ToggleAction>::cast_static (ActionManager::register_toggle_action (ruler_actions, X_("toggle-cd-marker-ruler"), _("CD Markers"), bind (mem_fun(*this, &Editor::toggle_ruler_visibility), ruler_time_cd_marker)));
727         ruler_loop_punch_action = Glib::RefPtr<ToggleAction>::cast_static (ActionManager::register_toggle_action (ruler_actions, X_("toggle-loop-punch-ruler"), _("Loop/Punch"), bind (mem_fun(*this, &Editor::toggle_ruler_visibility), ruler_time_transport_marker)));
728         ruler_bbt_action = Glib::RefPtr<ToggleAction>::cast_static (ActionManager::register_toggle_action (ruler_actions, X_("toggle-bbt-ruler"), _("Bars & Beats"), bind (mem_fun(*this, &Editor::toggle_ruler_visibility), ruler_metric_frames)));
729         ruler_samples_action = Glib::RefPtr<ToggleAction>::cast_static (ActionManager::register_toggle_action (ruler_actions, X_("toggle-samples-ruler"), _("Samples"), bind (mem_fun(*this, &Editor::toggle_ruler_visibility), ruler_metric_bbt)));
730         ruler_timecode_action = Glib::RefPtr<ToggleAction>::cast_static (ActionManager::register_toggle_action (ruler_actions, X_("toggle-timecode-ruler"), _("Timecode"), bind (mem_fun(*this, &Editor::toggle_ruler_visibility), ruler_metric_smpte)));
731         ruler_minsec_action = Glib::RefPtr<ToggleAction>::cast_static (ActionManager::register_toggle_action (ruler_actions, X_("toggle-minsec-ruler"), _("Min:Sec"), bind (mem_fun(*this, &Editor::toggle_ruler_visibility), ruler_metric_minsec)));
732
733         /* set defaults here */
734
735         no_ruler_shown_update = true;
736         ruler_meter_action->set_active (true);
737         ruler_tempo_action->set_active (true);
738         ruler_marker_action->set_active (true);
739         ruler_range_action->set_active (false);
740         ruler_loop_punch_action->set_active (true);
741         ruler_loop_punch_action->set_active (true);
742         if (Profile->get_sae()) {
743                 ruler_bbt_action->set_active (true);
744                 ruler_cd_marker_action->set_active (false);
745                 ruler_timecode_action->set_active (false);
746                 ruler_minsec_action->set_active (true);
747         } else {
748                 ruler_bbt_action->set_active (false);
749                 ruler_cd_marker_action->set_active (true);
750                 ruler_timecode_action->set_active (true);
751                 ruler_minsec_action->set_active (false);
752         }
753         ruler_samples_action->set_active (false);
754         no_ruler_shown_update = false;
755         
756         /* REGION LIST */
757
758         Glib::RefPtr<ActionGroup> rl_actions = ActionGroup::create (X_("RegionList"));
759         RadioAction::Group sort_type_group;
760         RadioAction::Group sort_order_group;
761
762         /* the region list popup menu */
763         ActionManager::register_action (rl_actions, X_("RegionListSort"), _("Sort"));
764
765         act = ActionManager::register_action (rl_actions, X_("rlAudition"), _("Audition"), mem_fun(*this, &Editor::audition_region_from_region_list));
766         ActionManager::region_list_selection_sensitive_actions.push_back (act);
767         act = ActionManager::register_action (rl_actions, X_("rlHide"), _("Hide"), mem_fun(*this, &Editor::hide_region_from_region_list));
768         ActionManager::region_list_selection_sensitive_actions.push_back (act);
769         act = ActionManager::register_action (rl_actions, X_("rlRemove"), _("Remove"), mem_fun (*this, &Editor::remove_region_from_region_list));
770         ActionManager::region_list_selection_sensitive_actions.push_back (act);
771         ActionManager::register_toggle_action (rl_actions, X_("rlShowAll"), _("Show All"), mem_fun(*this, &Editor::toggle_full_region_list));
772         ActionManager::register_toggle_action (rl_actions, X_("rlShowAuto"), _("Show Automatic Regions"), mem_fun(*this, &Editor::toggle_show_auto_regions));
773
774         ActionManager::register_radio_action (rl_actions, sort_order_group, X_("SortAscending"),  _("Ascending"),
775                                bind (mem_fun(*this, &Editor::reset_region_list_sort_direction), true));
776         ActionManager::register_radio_action (rl_actions, sort_order_group, X_("SortDescending"),   _("Descending"),
777                                bind (mem_fun(*this, &Editor::reset_region_list_sort_direction), false));
778         
779         ActionManager::register_radio_action (rl_actions, sort_type_group, X_("SortByRegionName"),  _("By Region Name"),
780                                bind (mem_fun(*this, &Editor::reset_region_list_sort_type), ByName));
781         ActionManager::register_radio_action (rl_actions, sort_type_group, X_("SortByRegionLength"),  _("By Region Length"),
782                                bind (mem_fun(*this, &Editor::reset_region_list_sort_type), ByLength));
783         ActionManager::register_radio_action (rl_actions, sort_type_group, X_("SortByRegionPosition"),  _("By Region Position"),
784                                bind (mem_fun(*this, &Editor::reset_region_list_sort_type), ByPosition));
785         ActionManager::register_radio_action (rl_actions, sort_type_group, X_("SortByRegionTimestamp"),  _("By Region Timestamp"),
786                                bind (mem_fun(*this, &Editor::reset_region_list_sort_type), ByTimestamp));
787         ActionManager::register_radio_action (rl_actions, sort_type_group, X_("SortByRegionStartinFile"),  _("By Region Start in File"),
788                                bind (mem_fun(*this, &Editor::reset_region_list_sort_type), ByStartInFile));
789         ActionManager::register_radio_action (rl_actions, sort_type_group, X_("SortByRegionEndinFile"),  _("By Region End in File"),
790                                bind (mem_fun(*this, &Editor::reset_region_list_sort_type), ByEndInFile));
791         ActionManager::register_radio_action (rl_actions, sort_type_group, X_("SortBySourceFileName"),  _("By Source File Name"),
792                                bind (mem_fun(*this, &Editor::reset_region_list_sort_type), BySourceFileName));
793         ActionManager::register_radio_action (rl_actions, sort_type_group, X_("SortBySourceFileLength"),  _("By Source File Length"),
794                                bind (mem_fun(*this, &Editor::reset_region_list_sort_type), BySourceFileLength));
795         ActionManager::register_radio_action (rl_actions, sort_type_group, X_("SortBySourceFileCreationDate"),  _("By Source File Creation Date"),
796                                bind (mem_fun(*this, &Editor::reset_region_list_sort_type), BySourceFileCreationDate));
797         ActionManager::register_radio_action (rl_actions, sort_type_group, X_("SortBySourceFilesystem"),  _("By Source Filesystem"),
798                                bind (mem_fun(*this, &Editor::reset_region_list_sort_type), BySourceFileFS));
799
800
801         /* the next two are duplicate items with different names for use in two different contexts */
802
803         act = ActionManager::register_action (editor_actions, X_("addExistingAudioFiles"), _("Import"), mem_fun (*this, &Editor::external_audio_dialog));
804         ActionManager::session_sensitive_actions.push_back (act);
805         act = ActionManager::register_action (editor_actions, X_("addExternalAudioToRegionList"), _("Import to Region List"), bind (mem_fun(*this, &Editor::add_external_audio_action), ImportAsRegion));
806         ActionManager::session_sensitive_actions.push_back (act);
807         
808         ActionManager::register_action (editor_actions, X_("importFromSession"), _("Import From Session"), mem_fun(*this, &Editor::session_import_dialog));
809
810         ActionManager::register_toggle_action (editor_actions, X_("ToggleWaveformsWhileRecording"), _("Show Waveforms While Recording"), mem_fun (*this, &Editor::toggle_waveforms_while_recording));
811
812         ActionManager::register_toggle_action (editor_actions, X_("ToggleSummary"), _("Show Summary"), mem_fun (*this, &Editor::set_summary));
813
814         ActionManager::register_toggle_action (editor_actions, X_("ToggleGroupTabs"), _("Show Group Tabs"), mem_fun (*this, &Editor::set_group_tabs));
815         
816         ActionManager::register_toggle_action (editor_actions, X_("ToggleMeasureVisibility"), _("Show Measures"), mem_fun (*this, &Editor::toggle_measure_visibility));
817         
818         /* if there is a logo in the editor canvas, its always visible at startup */
819
820         act = ActionManager::register_toggle_action (editor_actions, X_("ToggleLogoVisibility"), _("Show Logo"), mem_fun (*this, &Editor::toggle_logo_visibility));
821         Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic(act);
822         tact->set_active (true);
823
824         ActionManager::add_action_group (rl_actions);
825         ActionManager::add_action_group (ruler_actions);
826         ActionManager::add_action_group (zoom_actions);
827         ActionManager::add_action_group (mouse_mode_actions);
828         ActionManager::add_action_group (snap_actions);
829         ActionManager::add_action_group (editor_actions);
830 }
831
832 void
833 Editor::toggle_ruler_visibility (RulerType rt)
834 {
835         const char* action = 0;
836
837         if (no_ruler_shown_update) {
838                 return;
839         }
840
841         switch (rt) {
842         case ruler_metric_smpte:
843                 action = "toggle-timecode-ruler";
844                 break;
845         case ruler_metric_bbt:
846                 action = "toggle-bbt-ruler";
847                 break;
848         case ruler_metric_frames:
849                 action = "toggle-samples-ruler";
850                 break;
851         case ruler_metric_minsec:
852                 action = "toggle-minsec-ruler";
853                 break;
854         case ruler_time_tempo:
855                 action = "toggle-tempo-ruler";
856                 break;
857         case ruler_time_meter:
858                 action = "toggle-meter-ruler";
859                 break;
860         case ruler_time_marker:
861                 action = "toggle-marker-ruler";
862                 break;
863         case ruler_time_range_marker:
864                 action = "toggle-range-ruler";
865                 break;
866         case ruler_time_transport_marker:
867                 action = "toggle-loop-punch-ruler";
868                 break;
869         case ruler_time_cd_marker:
870                 action = "toggle-cd-marker-ruler";
871                 break;
872         }
873
874         Glib::RefPtr<Action> act = ActionManager::get_action (X_("Rulers"), action);
875         if (act) {
876                 Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic(act);
877                 update_ruler_visibility ();
878                 store_ruler_visibility ();
879         }
880 }
881
882 void
883 Editor::toggle_waveforms_while_recording ()
884 {
885         Glib::RefPtr<Action> act = ActionManager::get_action (X_("Editor"), X_("ToggleWaveformsWhileRecording"));
886         if (act) {
887                 Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic(act);
888                 set_show_waveforms_recording (tact->get_active());
889         }
890 }
891
892 void
893 Editor::set_summary ()
894 {
895         Glib::RefPtr<Action> act = ActionManager::get_action (X_("Editor"), X_("ToggleSummary"));
896         if (act) {
897                 Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic (act);
898                 session->config.set_show_summary (tact->get_active ());
899         }
900 }
901
902 void
903 Editor::set_group_tabs ()
904 {
905         Glib::RefPtr<Action> act = ActionManager::get_action (X_("Editor"), X_("ToggleGroupTabs"));
906         if (act) {
907                 Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic (act);
908                 session->config.set_show_group_tabs (tact->get_active ());
909         }
910 }
911
912 void
913 Editor::toggle_measure_visibility ()
914 {
915         Glib::RefPtr<Action> act = ActionManager::get_action (X_("Editor"), X_("ToggleMeasureVisibility"));
916         if (act) {
917                 Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic(act);
918                 set_show_measures (tact->get_active());
919         }
920 }
921
922 void
923 Editor::toggle_logo_visibility ()
924 {
925         Glib::RefPtr<Action> act = ActionManager::get_action (X_("Editor"), X_("ToggleLogoVisibility"));
926
927         if (act) {
928                 Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic(act);
929                 if (logo_item) {
930                         if (tact->get_active()) {
931                                 logo_item->show ();
932                         } else {
933                                 logo_item->hide ();
934                         }
935                 }
936         }
937 }
938
939 RefPtr<RadioAction>
940 Editor::snap_type_action (SnapType type)
941 {
942
943         const char* action = 0;
944         RefPtr<Action> act;
945         
946         switch (type) {
947         case Editing::SnapToCDFrame:
948                 action = "snap-to-cd-frame";
949                 break;
950         case Editing::SnapToSMPTEFrame:
951                 action = "snap-to-smpte-frame";
952                 break;
953         case Editing::SnapToSMPTESeconds:
954                 action = "snap-to-smpte-seconds";
955                 break;
956         case Editing::SnapToSMPTEMinutes:
957                 action = "snap-to-smpte-minutes";
958                 break;
959         case Editing::SnapToSeconds:
960                 action = "snap-to-seconds";
961                 break;
962         case Editing::SnapToMinutes:
963                 action = "snap-to-minutes";
964                 break;
965         case Editing::SnapToAThirtysecondBeat:
966                 action = "snap-to-thirtyseconds";
967                 break;
968         case Editing::SnapToASixteenthBeat:
969                 action = "snap-to-asixteenthbeat";
970                 break;
971         case Editing::SnapToAEighthBeat:
972                 action = "snap-to-eighths";
973                 break;
974         case Editing::SnapToAQuarterBeat:
975                 action = "snap-to-quarters";
976                 break;
977         case Editing::SnapToAThirdBeat:
978                 action = "snap-to-thirds";
979                 break;
980         case Editing::SnapToBeat:
981                 action = "snap-to-beat";
982                 break;
983         case Editing::SnapToBar:
984                 action = "snap-to-bar";
985                 break;
986         case Editing::SnapToMark:
987                 action = "snap-to-mark";
988                 break;
989         case Editing::SnapToRegionStart:
990                 action = "snap-to-region-start";
991                 break;
992         case Editing::SnapToRegionEnd:
993                 action = "snap-to-region-end";
994                 break;
995         case Editing::SnapToRegionSync:
996                 action = "snap-to-region-sync";
997                 break;
998         case Editing::SnapToRegionBoundary:
999                 action = "snap-to-region-boundary";
1000                 break;
1001         default:
1002                 fatal << string_compose (_("programming error: %1: %2"), "Editor: impossible snap-to type", (int) type) << endmsg;
1003                 /*NOTREACHED*/
1004         }
1005
1006         act = ActionManager::get_action (X_("Snap"), action);
1007
1008         if (act) {
1009                 RefPtr<RadioAction> ract = RefPtr<RadioAction>::cast_dynamic(act);
1010                 return ract;
1011
1012         } else  {
1013                 error << string_compose (_("programming error: %1"), "Editor::snap_type_chosen could not find action to match type.") << endmsg;
1014                 return RefPtr<RadioAction>();
1015         }
1016 }
1017
1018 void
1019 Editor::cycle_snap_choice()
1020 {
1021         switch (snap_type) {
1022         case Editing::SnapToCDFrame:
1023                 set_snap_to (Editing::SnapToSMPTEFrame);
1024                 break;
1025         case Editing::SnapToSMPTEFrame:
1026                 set_snap_to (Editing::SnapToSMPTESeconds);
1027                 break;
1028         case Editing::SnapToSMPTESeconds:
1029                 set_snap_to (Editing::SnapToSMPTEMinutes);
1030                 break;
1031         case Editing::SnapToSMPTEMinutes:
1032                 set_snap_to (Editing::SnapToSeconds);
1033                 break;
1034         case Editing::SnapToSeconds:
1035                 set_snap_to (Editing::SnapToMinutes);
1036                 break;
1037         case Editing::SnapToMinutes:
1038                 set_snap_to (Editing::SnapToAThirtysecondBeat);
1039                 break;
1040         case Editing::SnapToAThirtysecondBeat:
1041                 set_snap_to (Editing::SnapToASixteenthBeat);
1042                 break;
1043         case Editing::SnapToASixteenthBeat:
1044                 set_snap_to (Editing::SnapToAEighthBeat);
1045                 break;
1046         case Editing::SnapToAEighthBeat:
1047                 set_snap_to (Editing::SnapToAQuarterBeat);
1048                 break;
1049         case Editing::SnapToAQuarterBeat:
1050                 set_snap_to (Editing::SnapToAThirdBeat);
1051                 break;
1052         case Editing::SnapToAThirdBeat:
1053                 set_snap_to (Editing::SnapToBeat);
1054                 break;
1055         case Editing::SnapToBeat:
1056                 set_snap_to (Editing::SnapToBar);
1057                 break;
1058         case Editing::SnapToBar:
1059                 set_snap_to (Editing::SnapToMark);
1060                 break;
1061         case Editing::SnapToMark:
1062                 set_snap_to (Editing::SnapToRegionStart);
1063                 break;
1064         case Editing::SnapToRegionStart:
1065                 set_snap_to (Editing::SnapToRegionEnd);
1066                 break;
1067         case Editing::SnapToRegionEnd:
1068                 set_snap_to (Editing::SnapToRegionSync);
1069                 break;
1070         case Editing::SnapToRegionSync:
1071                 set_snap_to (Editing::SnapToRegionBoundary);
1072                 break;
1073         case Editing::SnapToRegionBoundary:
1074                 set_snap_to (Editing::SnapToCDFrame);
1075                 break;
1076         }
1077 }
1078
1079 void
1080 Editor::snap_type_chosen (SnapType type)
1081 {
1082         /* this is driven by a toggle on a radio group, and so is invoked twice,
1083            once for the item that became inactive and once for the one that became
1084            active.
1085         */
1086
1087         RefPtr<RadioAction> ract = snap_type_action (type);
1088
1089         if (ract && ract->get_active()) {
1090                 set_snap_to (type);
1091         }
1092 }
1093
1094 RefPtr<RadioAction>
1095 Editor::snap_mode_action (SnapMode mode)
1096 {
1097         const char* action = 0;
1098         RefPtr<Action> act;
1099         
1100         switch (mode) {
1101         case Editing::SnapOff:
1102                 action = X_("snap-off");
1103                 break;
1104         case Editing::SnapNormal:
1105                 action = X_("snap-normal");
1106                 break;
1107         case Editing::SnapMagnetic:
1108                 action = X_("snap-magnetic");
1109                 break;
1110         default:
1111                 fatal << string_compose (_("programming error: %1: %2"), "Editor: impossible snap mode type", (int) mode) << endmsg;
1112                 /*NOTREACHED*/
1113         }
1114         
1115         act = ActionManager::get_action (X_("Editor"), action);
1116         
1117         if (act) {
1118                 RefPtr<RadioAction> ract = RefPtr<RadioAction>::cast_dynamic(act);
1119                 return ract;
1120                 
1121         } else  {
1122                 error << string_compose (_("programming error: %1: %2"), "Editor::snap_mode_chosen could not find action to match mode.", action) << endmsg;
1123                 return RefPtr<RadioAction> ();
1124         }
1125 }
1126
1127 void
1128 Editor::cycle_snap_mode ()
1129 {
1130         switch (snap_mode) {
1131         case SnapOff:
1132                 set_snap_mode (SnapNormal);
1133                 break;
1134         case SnapNormal:
1135                 set_snap_mode (SnapMagnetic);
1136                 break;
1137         case SnapMagnetic:
1138                 set_snap_mode (SnapOff);
1139                 break;
1140         }
1141 }
1142
1143 void
1144 Editor::snap_mode_chosen (SnapMode mode)
1145 {
1146         /* this is driven by a toggle on a radio group, and so is invoked twice,
1147            once for the item that became inactive and once for the one that became
1148            active.
1149         */
1150
1151         RefPtr<RadioAction> ract = snap_mode_action (mode);
1152
1153         if (ract && ract->get_active()) {
1154                 set_snap_mode (mode);
1155         }
1156 }
1157
1158 RefPtr<RadioAction>
1159 Editor::edit_point_action (EditPoint ep)
1160 {
1161         const char* action = 0;
1162         RefPtr<Action> act;
1163         
1164         switch (ep) {
1165         case Editing::EditAtPlayhead:
1166                 action = X_("edit-at-playhead");
1167                 break;
1168         case Editing::EditAtSelectedMarker:
1169                 action = X_("edit-at-selected-marker");
1170                 break;
1171         case Editing::EditAtMouse:
1172                 action = X_("edit-at-mouse");
1173                 break;
1174         default:
1175                 fatal << string_compose (_("programming error: %1: %2"), "Editor: impossible edit point type", (int) ep) << endmsg;
1176                 /*NOTREACHED*/
1177         }
1178         
1179         act = ActionManager::get_action (X_("Editor"), action);
1180         
1181         if (act) {
1182                 RefPtr<RadioAction> ract = RefPtr<RadioAction>::cast_dynamic(act);
1183                 return ract;
1184                 
1185         } else  {
1186                 error << string_compose (_("programming error: %1: %2"), "Editor::edit_point_action could not find action to match edit point.", action) << endmsg;
1187                 return RefPtr<RadioAction> ();
1188         }
1189 }
1190
1191 void
1192 Editor::edit_point_chosen (EditPoint ep)
1193 {
1194         /* this is driven by a toggle on a radio group, and so is invoked twice,
1195            once for the item that became inactive and once for the one that became
1196            active.
1197         */
1198
1199         RefPtr<RadioAction> ract = edit_point_action (ep);
1200
1201         if (ract && ract->get_active()) {
1202                 set_edit_point_preference (ep);
1203         }
1204 }
1205
1206
1207 RefPtr<RadioAction>
1208 Editor::zoom_focus_action (ZoomFocus focus)
1209 {
1210         const char* action = 0;
1211         RefPtr<Action> act;
1212         
1213         switch (focus) {
1214         case ZoomFocusLeft:
1215                 action = X_("zoom-focus-left");
1216                 break;
1217         case ZoomFocusRight:
1218                 action = X_("zoom-focus-right");
1219                 break;
1220         case ZoomFocusCenter:
1221                 action = X_("zoom-focus-center");
1222                 break;
1223         case ZoomFocusPlayhead:
1224                 action = X_("zoom-focus-playhead");
1225                 break;
1226         case ZoomFocusMouse:
1227                 action = X_("zoom-focus-mouse");
1228                 break;
1229         case ZoomFocusEdit:
1230                 action = X_("zoom-focus-edit");
1231                 break;
1232         default:
1233                 fatal << string_compose (_("programming error: %1: %2"), "Editor: impossible focus type", (int) focus) << endmsg;
1234                 /*NOTREACHED*/
1235         }
1236         
1237         act = ActionManager::get_action (X_("Zoom"), action);
1238         
1239         if (act) {
1240                 RefPtr<RadioAction> ract = RefPtr<RadioAction>::cast_dynamic(act);
1241                 return ract;
1242         } else {
1243                 error << string_compose (_("programming error: %1: %2"), "Editor::zoom_focus_action could not find action to match focus.", action) << endmsg;
1244         }
1245
1246         return RefPtr<RadioAction> ();
1247 }
1248
1249 void
1250 Editor::zoom_focus_chosen (ZoomFocus focus)
1251 {
1252         /* this is driven by a toggle on a radio group, and so is invoked twice,
1253            once for the item that became inactive and once for the one that became
1254            active.
1255         */
1256
1257         RefPtr<RadioAction> ract = zoom_focus_action (focus);
1258
1259         if (ract && ract->get_active()) {
1260                 set_zoom_focus (focus);
1261         }
1262 }
1263
1264 /** A Configuration parameter has changed.
1265  * @param parameter_name Name of the changed parameter.
1266  */
1267 void
1268 Editor::parameter_changed (std::string p)
1269 {
1270         ENSURE_GUI_THREAD (bind (mem_fun (*this, &Editor::parameter_changed), p));
1271
1272         if (p == "auto-loop") {
1273                 update_loop_range_view (true);
1274         } else if (p == "punch-in") {
1275                 update_punch_range_view (true);
1276         } else if (p == "punch-out") {
1277                 update_punch_range_view (true);
1278         } else if (p == "smpte-format") {
1279                 update_just_smpte ();
1280         } else if (p == "xfades-visible") {
1281                 update_xfade_visibility ();
1282         } else if (p == "show-region-fades") {
1283                 update_region_fade_visibility ();
1284         } else if (p == "edit-mode") {
1285                 edit_mode_selector.set_active_text (edit_mode_to_string (Config->get_edit_mode()));
1286         } else if (p == "subframes-per-frame") {
1287                 update_just_smpte ();
1288         } else if (p == "show-track-meters") {
1289                 toggle_meter_updating();
1290         } else if (p == "show-summary") {
1291                 
1292                 bool const s = session->config.get_show_summary ();
1293                 if (s) {
1294                         _summary->show ();
1295                 } else {
1296                         _summary->hide ();
1297                 }
1298
1299                 Glib::RefPtr<Action> act = ActionManager::get_action (X_("Editor"), X_("ToggleSummary"));
1300                 if (act) {
1301                         Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic (act);
1302                         if (tact->get_active () != s) {
1303                                 tact->set_active (s);
1304                         }
1305                 }
1306         } else if (p == "show-group-tabs") {
1307
1308                 bool const s = session->config.get_show_group_tabs ();
1309                 if (s) {
1310                         _group_tabs->show ();
1311                 } else {
1312                         _group_tabs->hide ();
1313                 }
1314
1315                 Glib::RefPtr<Action> act = ActionManager::get_action (X_("Editor"), X_("ToggleGroupTabs"));
1316                 if (act) {
1317                         Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic (act);
1318                         if (tact->get_active () != s) {
1319                                 tact->set_active (s);
1320                         }
1321                 }
1322         }
1323 }
1324
1325 void
1326 Editor::reset_focus ()
1327 {
1328         track_canvas->grab_focus();
1329 }
1330
1331 void
1332 Editor::reset_canvas_action_sensitivity (bool onoff)
1333 {
1334         if (_edit_point != EditAtMouse) {
1335                 onoff = true;
1336         }
1337
1338         for (vector<Glib::RefPtr<Action> >::iterator x = ActionManager::mouse_edit_point_requires_canvas_actions.begin();  
1339              x != ActionManager::mouse_edit_point_requires_canvas_actions.end(); ++x) {
1340                 (*x)->set_sensitive (onoff);
1341         }
1342 }
1343