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