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