Apply panners/automation patch from torbenh (Panner is-a Processor).
[ardour.git] / gtk2_ardour / editor_actions.cc
1 /*
2     Copyright (C) 2000-2007 Paul Davis 
3
4     This program is free software; you can redistribute it and/or modify
5     it under the terms of the GNU General Public License as published by
6     the Free Software Foundation; either version 2 of the License, or
7     (at your option) any later version.
8
9     This program is distributed in the hope that it will be useful,
10     but WITHOUT ANY WARRANTY; without even the implied warranty of
11     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12     GNU General Public License for more details.
13
14     You should have received a copy of the GNU General Public License
15     along with this program; if not, write to the Free Software
16     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
17
18 */
19
20 #include <ardour/ardour.h>
21 #include <ardour/profile.h>
22
23 #include "utils.h"
24 #include "editor.h"
25 #include "editing.h"
26 #include "actions.h"
27 #include "ardour_ui.h"
28 #include "gui_thread.h"
29 #include "i18n.h"
30
31 using namespace Gtk;
32 using namespace Glib;
33 using namespace std;
34 using namespace sigc;
35 using namespace ARDOUR;
36 using namespace PBD;
37 using namespace Editing;
38
39 void
40 Editor::register_actions ()
41 {
42         RefPtr<Action> act;
43
44         editor_actions = ActionGroup::create (X_("Editor"));
45         
46         /* non-operative menu items for menu bar */
47
48         ActionManager::register_action (editor_actions, X_("AlignMenu"), _("Align"));
49         ActionManager::register_action (editor_actions, X_("Autoconnect"), _("Autoconnect"));
50         ActionManager::register_action (editor_actions, X_("Crossfades"), _("Crossfades"));
51         ActionManager::register_action (editor_actions, X_("Edit"), _("Edit"));
52         ActionManager::register_action (editor_actions, X_("EditCursorMovementOptions"), _("Move Selected Marker"));
53         ActionManager::register_action (editor_actions, X_("EditSelectRangeOptions"), _("Select Range Operations"));
54         ActionManager::register_action (editor_actions, X_("EditSelectRegionOptions"), _("Select Regions"));
55         ActionManager::register_action (editor_actions, X_("EditPointMenu"), _("Edit Point"));
56         ActionManager::register_action (editor_actions, X_("FadeMenu"), _("Fade"));
57         ActionManager::register_action (editor_actions, X_("LatchMenu"), _("Latch"));
58         ActionManager::register_action (editor_actions, X_("Layering"), _("Layering"));
59         ActionManager::register_action (editor_actions, X_("Link"), _("Link"));
60         ActionManager::register_action (editor_actions, X_("LocateToMarker"), _("Locate To Markers"));
61         ActionManager::register_action (editor_actions, X_("MarkerMenu"), _("Markers"));
62         ActionManager::register_action (editor_actions, X_("MeterFalloff"), _("Meter falloff"));
63         ActionManager::register_action (editor_actions, X_("MeterHold"), _("Meter hold"));
64         ActionManager::register_action (editor_actions, X_("MiscOptions"), _("Misc Options"));
65         ActionManager::register_action (editor_actions, X_("Monitoring"), _("Monitoring"));
66         ActionManager::register_action (editor_actions, X_("MoveActiveMarkMenu"), _("Active Mark"));
67         ActionManager::register_action (editor_actions, X_("MovePlayHeadMenu"), _("Playhead"));
68         ActionManager::register_action (editor_actions, X_("NudgeRegionMenu"), _("Nudge"));
69         ActionManager::register_action (editor_actions, X_("PlayMenu"), _("Play"));
70         ActionManager::register_action (editor_actions, X_("PrimaryClockMenu"), _("Primary Clock"));
71         ActionManager::register_action (editor_actions, X_("Pullup"), _("Pullup / Pulldown"));
72         ActionManager::register_action (editor_actions, X_("RegionMenu"), _("Region"));
73         ActionManager::register_action (editor_actions, X_("RegionEditOps"), _("Region operations"));
74         ActionManager::register_action (editor_actions, X_("RegionGainMenu"), _("Gain"));
75         ActionManager::register_action (editor_actions, X_("RulerMenu"), _("Rulers"));
76         ActionManager::register_action (editor_actions, X_("SavedViewMenu"), _("Views"));
77         ActionManager::register_action (editor_actions, X_("ScrollMenu"), _("Scroll"));
78         ActionManager::register_action (editor_actions, X_("SecondaryClockMenu"), _("Secondary Clock"));
79         ActionManager::register_action (editor_actions, X_("Select"), _("Select"));
80         ActionManager::register_action (editor_actions, X_("SelectMenu"), _("Select"));
81         ActionManager::register_action (editor_actions, X_("SeparateMenu"), _("Separate"));
82         ActionManager::register_action (editor_actions, X_("SetLoopMenu"), _("Loop"));
83         ActionManager::register_action (editor_actions, X_("SetPunchMenu"), _("Punch"));
84         ActionManager::register_action (editor_actions, X_("Solo"), _("Solo"));
85         ActionManager::register_action (editor_actions, X_("Subframes"), _("Subframes"));
86         ActionManager::register_action (editor_actions, X_("SyncMenu"), _("Sync"));
87         ActionManager::register_action (editor_actions, X_("TempoMenu"), _("Tempo"));
88         ActionManager::register_action (editor_actions, X_("Timecode"), _("Timecode fps"));
89         ActionManager::register_action (editor_actions, X_("TrackHeightMenu"), _("Height"));
90         ActionManager::register_action (editor_actions, X_("TrackMenu"), _("Track"));
91         ActionManager::register_action (editor_actions, X_("Tools"), _("Tools"));
92         ActionManager::register_action (editor_actions, X_("TrimMenu"), _("Trim"));
93         ActionManager::register_action (editor_actions, X_("View"), _("View"));
94         ActionManager::register_action (editor_actions, X_("WaveformMenu"), _("Waveforms"));
95         ActionManager::register_action (editor_actions, X_("ZoomFocus"), _("Zoom Focus"));
96         ActionManager::register_action (editor_actions, X_("ZoomMenu"), _("Zoom"));
97
98         /* add named actions for the editor */
99
100         ActionManager::register_toggle_action (editor_actions, "link-region-and-track-selection", _("Link Region/Track Selection"), mem_fun (*this, &Editor::toggle_link_region_and_track_selection));
101         ActionManager::register_action (editor_actions, "break-drag", _("Break drag"), mem_fun (*this, &Editor::break_drag));
102
103         act = ActionManager::register_toggle_action (editor_actions, "show-editor-mixer", _("Show Editor Mixer"), mem_fun (*this, &Editor::editor_mixer_button_toggled));
104         ActionManager::session_sensitive_actions.push_back (act);
105         act = ActionManager::register_toggle_action (editor_actions, "show-editor-list", _("Show Editor List"), mem_fun (*this, &Editor::editor_list_button_toggled));
106         ActionManager::session_sensitive_actions.push_back (act);
107
108         RadioAction::Group crossfade_model_group;
109
110         act = ActionManager::register_radio_action (editor_actions, crossfade_model_group, "CrossfadesFull", _("Span Entire Overlap"), bind (mem_fun(*this, &Editor::set_crossfade_model), FullCrossfade));
111         ActionManager::session_sensitive_actions.push_back (act);
112         act = ActionManager::register_radio_action (editor_actions, crossfade_model_group, "CrossfadesShort", _("Short"), bind (mem_fun(*this, &Editor::set_crossfade_model), ShortCrossfade));
113         ActionManager::session_sensitive_actions.push_back (act);
114
115         act = ActionManager::register_toggle_action (editor_actions, "toggle-xfades-active", _("Active"), mem_fun(*this, &Editor::toggle_xfades_active));
116         ActionManager::session_sensitive_actions.push_back (act);
117         act = ActionManager::register_toggle_action (editor_actions, "toggle-xfades-visible", _("Show"), mem_fun(*this, &Editor::toggle_xfade_visibility));
118         ActionManager::session_sensitive_actions.push_back (act);
119         act = ActionManager::register_toggle_action (editor_actions, "toggle-auto-xfades", _("Created Automatically"), mem_fun(*this, &Editor::toggle_auto_xfade));
120         ActionManager::session_sensitive_actions.push_back (act);
121
122         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), playhead_cursor));
123         ActionManager::session_sensitive_actions.push_back (act);
124         act = ActionManager::register_action (editor_actions, "playhead-to-previous-region-boundary", _("Playhead to Previous Region Boundary"), bind (mem_fun(*this, &Editor::cursor_to_previous_region_boundary), playhead_cursor));
125         ActionManager::session_sensitive_actions.push_back (act);
126
127         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)));
128         ActionManager::session_sensitive_actions.push_back (act);
129         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)));
130         ActionManager::session_sensitive_actions.push_back (act);
131         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)));
132         ActionManager::session_sensitive_actions.push_back (act);
133
134         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)));
135         ActionManager::session_sensitive_actions.push_back (act);
136         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)));
137         ActionManager::session_sensitive_actions.push_back (act);
138         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)));
139         ActionManager::session_sensitive_actions.push_back (act);
140
141         act = ActionManager::register_action (editor_actions, "selected-marker-to-next-region-boundary", _("to Next Region Boundary"), mem_fun(*this, &Editor::selected_marker_to_next_region_boundary));
142         ActionManager::session_sensitive_actions.push_back (act);
143         act = ActionManager::register_action (editor_actions, "selected-marker-to-previous-region-boundary", _("to Previous Region Boundary"), mem_fun(*this, &Editor::selected_marker_to_previous_region_boundary));
144         ActionManager::session_sensitive_actions.push_back (act);
145
146         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)));
147         ActionManager::session_sensitive_actions.push_back (act);
148         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)));
149         ActionManager::session_sensitive_actions.push_back (act);
150         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)));
151         ActionManager::session_sensitive_actions.push_back (act);
152
153         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)));
154         ActionManager::session_sensitive_actions.push_back (act);
155         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)));
156         ActionManager::session_sensitive_actions.push_back (act);
157         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)));
158         ActionManager::session_sensitive_actions.push_back (act);
159
160         act = ActionManager::register_action (editor_actions, "edit-cursor-to-range-start", _("to Range Start"), mem_fun(*this, &Editor::selected_marker_to_selection_start));
161         ActionManager::session_sensitive_actions.push_back (act);
162         act = ActionManager::register_action (editor_actions, "edit-cursor-to-range-end", _("to Range End"), mem_fun(*this, &Editor::selected_marker_to_selection_end));
163         ActionManager::session_sensitive_actions.push_back (act);
164
165         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));
166         ActionManager::session_sensitive_actions.push_back (act);
167         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));
168         ActionManager::session_sensitive_actions.push_back (act);
169
170         act = ActionManager::register_action (editor_actions, "select-all", _("Select All"), bind (mem_fun(*this, &Editor::select_all), Selection::Set));
171         ActionManager::session_sensitive_actions.push_back (act);
172         act = ActionManager::register_action (editor_actions, "deselect-all", _("Deselect All"), mem_fun(*this, &Editor::deselect_all));
173         ActionManager::session_sensitive_actions.push_back (act);
174         act = ActionManager::register_action (editor_actions, "invert-selection", _("Invert Selection"), mem_fun(*this, &Editor::invert_selection));
175         ActionManager::session_sensitive_actions.push_back (act);
176         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));
177         ActionManager::session_sensitive_actions.push_back (act);
178         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));
179         ActionManager::session_sensitive_actions.push_back (act);
180
181         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));
182         ActionManager::session_sensitive_actions.push_back (act);
183         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));
184         ActionManager::session_sensitive_actions.push_back (act);
185
186         act = ActionManager::register_action (editor_actions, "select-range-between-cursors", _("Select Edit Range"), mem_fun(*this, &Editor::select_range_between));
187         ActionManager::session_sensitive_actions.push_back (act);
188
189         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));
190         ActionManager::session_sensitive_actions.push_back (act);
191         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));
192         ActionManager::session_sensitive_actions.push_back (act);
193         
194         act = ActionManager::register_action (editor_actions, "select-next-route", _("Select Next Track/Bus"), mem_fun(*this, &Editor::select_next_route));
195         ActionManager::session_sensitive_actions.push_back (act);
196         act = ActionManager::register_action (editor_actions, "select-prev-route", _("Select Previous Track/Bus"), mem_fun(*this, &Editor::select_prev_route));
197         ActionManager::session_sensitive_actions.push_back (act);
198         
199
200         act = ActionManager::register_action (editor_actions, "save-visual-state-1", _("Save View 1"), bind (mem_fun (*this, &Editor::start_visual_state_op), 0));
201         ActionManager::session_sensitive_actions.push_back (act);
202         act = ActionManager::register_action (editor_actions, "goto-visual-state-1", _("Goto View 1"), bind (mem_fun (*this, &Editor::cancel_visual_state_op), 0));
203         ActionManager::session_sensitive_actions.push_back (act);
204         act = ActionManager::register_action (editor_actions, "save-visual-state-2", _("Save View 2"), bind (mem_fun (*this, &Editor::start_visual_state_op), 1));
205         ActionManager::session_sensitive_actions.push_back (act);
206         act = ActionManager::register_action (editor_actions, "goto-visual-state-2", _("Goto View 2"), bind (mem_fun (*this, &Editor::cancel_visual_state_op), 1));
207         ActionManager::session_sensitive_actions.push_back (act);
208         act = ActionManager::register_action (editor_actions, "save-visual-state-3", _("Save View 3"), bind (mem_fun (*this, &Editor::start_visual_state_op), 2));
209         ActionManager::session_sensitive_actions.push_back (act);
210         act = ActionManager::register_action (editor_actions, "goto-visual-state-3", _("Goto View 3"), bind (mem_fun (*this, &Editor::cancel_visual_state_op), 2));
211         ActionManager::session_sensitive_actions.push_back (act);
212         act = ActionManager::register_action (editor_actions, "save-visual-state-4", _("Save View 4"), bind (mem_fun (*this, &Editor::start_visual_state_op), 3));
213         ActionManager::session_sensitive_actions.push_back (act);
214         act = ActionManager::register_action (editor_actions, "goto-visual-state-4", _("Goto View 4"), bind (mem_fun (*this, &Editor::cancel_visual_state_op), 3));
215         ActionManager::session_sensitive_actions.push_back (act);
216         act = ActionManager::register_action (editor_actions, "save-visual-state-5", _("Save View 5"), bind (mem_fun (*this, &Editor::start_visual_state_op), 4));
217         ActionManager::session_sensitive_actions.push_back (act);
218         act = ActionManager::register_action (editor_actions, "goto-visual-state-5", _("Goto View 5"), bind (mem_fun (*this, &Editor::cancel_visual_state_op), 4));
219         ActionManager::session_sensitive_actions.push_back (act);
220         act = ActionManager::register_action (editor_actions, "save-visual-state-6", _("Save View 6"), bind (mem_fun (*this, &Editor::start_visual_state_op), 5));
221         ActionManager::session_sensitive_actions.push_back (act);
222         act = ActionManager::register_action (editor_actions, "goto-visual-state-6", _("Goto View 6"), bind (mem_fun (*this, &Editor::cancel_visual_state_op), 5));
223         ActionManager::session_sensitive_actions.push_back (act);
224         act = ActionManager::register_action (editor_actions, "save-visual-state-7", _("Save View 7"), bind (mem_fun (*this, &Editor::start_visual_state_op), 6));
225         ActionManager::session_sensitive_actions.push_back (act);
226         act = ActionManager::register_action (editor_actions, "goto-visual-state-7", _("Goto View 7"), bind (mem_fun (*this, &Editor::cancel_visual_state_op), 6));
227         ActionManager::session_sensitive_actions.push_back (act);
228         act = ActionManager::register_action (editor_actions, "save-visual-state-8", _("Save View 8"), bind (mem_fun (*this, &Editor::start_visual_state_op), 7));
229         ActionManager::session_sensitive_actions.push_back (act);
230         act = ActionManager::register_action (editor_actions, "goto-visual-state-8", _("Goto View 8"), bind (mem_fun (*this, &Editor::cancel_visual_state_op), 7));
231         ActionManager::session_sensitive_actions.push_back (act);
232         act = ActionManager::register_action (editor_actions, "save-visual-state-9", _("Save View 9"), bind (mem_fun (*this, &Editor::start_visual_state_op), 8));
233         ActionManager::session_sensitive_actions.push_back (act);
234         act = ActionManager::register_action (editor_actions, "goto-visual-state-9", _("Goto View 9"), bind (mem_fun (*this, &Editor::cancel_visual_state_op), 8));
235         ActionManager::session_sensitive_actions.push_back (act);
236         act = ActionManager::register_action (editor_actions, "save-visual-state-10", _("Save View 10"), bind (mem_fun (*this, &Editor::start_visual_state_op), 9));
237         ActionManager::session_sensitive_actions.push_back (act);
238         act = ActionManager::register_action (editor_actions, "goto-visual-state-10", _("Goto View 10"), bind (mem_fun (*this, &Editor::cancel_visual_state_op), 9));
239         ActionManager::session_sensitive_actions.push_back (act);
240         act = ActionManager::register_action (editor_actions, "save-visual-state-11", _("Save View 11"), bind (mem_fun (*this, &Editor::start_visual_state_op), 10));
241         ActionManager::session_sensitive_actions.push_back (act);
242         act = ActionManager::register_action (editor_actions, "goto-visual-state-11", _("Goto View 11"), bind (mem_fun (*this, &Editor::cancel_visual_state_op), 10));
243         ActionManager::session_sensitive_actions.push_back (act);
244         act = ActionManager::register_action (editor_actions, "save-visual-state-12", _("Save View 12"), bind (mem_fun (*this, &Editor::start_visual_state_op), 11));
245         ActionManager::session_sensitive_actions.push_back (act);
246         act = ActionManager::register_action (editor_actions, "goto-visual-state-12", _("Goto View 12"), bind (mem_fun (*this, &Editor::cancel_visual_state_op), 11));
247         ActionManager::session_sensitive_actions.push_back (act);
248
249
250         act = ActionManager::register_action (editor_actions, "goto-mark-1", _("Locate to Mark 1"), bind (mem_fun (*this, &Editor::goto_nth_marker), 0));
251         ActionManager::session_sensitive_actions.push_back (act);
252         act = ActionManager::register_action (editor_actions, "goto-mark-2", _("Locate to Mark 2"), bind (mem_fun (*this, &Editor::goto_nth_marker), 1));
253         ActionManager::session_sensitive_actions.push_back (act);
254         act = ActionManager::register_action (editor_actions, "goto-mark-3", _("Locate to Mark 3"), bind (mem_fun (*this, &Editor::goto_nth_marker), 2));
255         ActionManager::session_sensitive_actions.push_back (act);
256         act = ActionManager::register_action (editor_actions, "goto-mark-4", _("Locate to Mark 4"), bind (mem_fun (*this, &Editor::goto_nth_marker), 3));
257         ActionManager::session_sensitive_actions.push_back (act);
258         act = ActionManager::register_action (editor_actions, "goto-mark-5", _("Locate to Mark 5"), bind (mem_fun (*this, &Editor::goto_nth_marker), 4));
259         ActionManager::session_sensitive_actions.push_back (act);
260         act = ActionManager::register_action (editor_actions, "goto-mark-6", _("Locate to Mark 6"), bind (mem_fun (*this, &Editor::goto_nth_marker), 5));
261         ActionManager::session_sensitive_actions.push_back (act);
262         act = ActionManager::register_action (editor_actions, "goto-mark-7", _("Locate to Mark 7"), bind (mem_fun (*this, &Editor::goto_nth_marker), 6));
263         ActionManager::session_sensitive_actions.push_back (act);
264         act = ActionManager::register_action (editor_actions, "goto-mark-8", _("Locate to Mark 8"), bind (mem_fun (*this, &Editor::goto_nth_marker), 7));
265         ActionManager::session_sensitive_actions.push_back (act);
266         act = ActionManager::register_action (editor_actions, "goto-mark-9", _("Locate to Mark 9"), bind (mem_fun (*this, &Editor::goto_nth_marker), 8));
267         ActionManager::session_sensitive_actions.push_back (act);
268
269         act = ActionManager::register_action (editor_actions, "jump-forward-to-mark", _("Jump Forward to Mark"), mem_fun(*this, &Editor::jump_forward_to_mark));
270         ActionManager::session_sensitive_actions.push_back (act);
271         act = ActionManager::register_action (editor_actions, "jump-backward-to-mark", _("Jump Backward to Mark"), mem_fun(*this, &Editor::jump_backward_to_mark));
272         ActionManager::session_sensitive_actions.push_back (act);
273         act = ActionManager::register_action (editor_actions, "add-location-from-playhead", _("Add Mark from Playhead"), mem_fun(*this, &Editor::add_location_from_playhead_cursor));
274         ActionManager::session_sensitive_actions.push_back (act);
275
276         act = ActionManager::register_action (editor_actions, "nudge-forward", _("Nudge Forward"), bind (mem_fun(*this, &Editor::nudge_forward), false, false));
277         ActionManager::session_sensitive_actions.push_back (act);
278         act = ActionManager::register_action (editor_actions, "nudge-next-forward", _("Nudge Next Forward"), bind (mem_fun(*this, &Editor::nudge_forward), true, false));
279         ActionManager::session_sensitive_actions.push_back (act);
280         act = ActionManager::register_action (editor_actions, "nudge-backward", _("Nudge Backward"), bind (mem_fun(*this, &Editor::nudge_backward), false, false));
281         ActionManager::session_sensitive_actions.push_back (act);
282         act = ActionManager::register_action (editor_actions, "nudge-next-backward", _("Nudge Next Backward"), bind (mem_fun(*this, &Editor::nudge_backward), true, false));
283         ActionManager::session_sensitive_actions.push_back (act);
284
285         act = ActionManager::register_action (editor_actions, "nudge-playhead-forward", _("Nudge Playhead Forward"), bind (mem_fun(*this, &Editor::nudge_forward), false, true));
286         ActionManager::session_sensitive_actions.push_back (act);
287         act = ActionManager::register_action (editor_actions, "nudge-playhead-backward", _("Nudge Playhead Backward"), bind (mem_fun(*this, &Editor::nudge_backward), false, true));
288         ActionManager::session_sensitive_actions.push_back (act);
289         act = ActionManager::register_action (editor_actions, "playhead-forward-to-grid", _("Forward To Grid"), mem_fun(*this, &Editor::playhead_forward_to_grid));
290         ActionManager::session_sensitive_actions.push_back (act);
291         act = ActionManager::register_action (editor_actions, "playhead-backward-to-grid", _("Backward To Grid"), mem_fun(*this, &Editor::playhead_backward_to_grid));
292         ActionManager::session_sensitive_actions.push_back (act);
293
294
295         act = ActionManager::register_action (editor_actions, "temporal-zoom-out", _("Zoom Out"), bind (mem_fun(*this, &Editor::temporal_zoom_step), true));
296         ActionManager::session_sensitive_actions.push_back (act);
297         act = ActionManager::register_action (editor_actions, "temporal-zoom-in", _("Zoom In"), bind (mem_fun(*this, &Editor::temporal_zoom_step), false));
298         ActionManager::session_sensitive_actions.push_back (act);
299         act = ActionManager::register_action (editor_actions, "zoom-to-session", _("Zoom to Session"), mem_fun(*this, &Editor::temporal_zoom_session));
300         ActionManager::session_sensitive_actions.push_back (act);
301         act = ActionManager::register_action (editor_actions, "zoom-to-region", _("Zoom to Region"), bind (mem_fun(*this, &Editor::toggle_zoom_region), false));
302         ActionManager::session_sensitive_actions.push_back (act);
303         act = ActionManager::register_action (editor_actions, "zoom-to-region-both-axes", _("Zoom to Region (W&H)"), bind (mem_fun(*this, &Editor::toggle_zoom_region), true));
304         ActionManager::session_sensitive_actions.push_back (act);
305         act = ActionManager::register_action (editor_actions, "toggle-zoom", _("Toggle Zoom State"), mem_fun(*this, &Editor::swap_visual_state));
306         ActionManager::session_sensitive_actions.push_back (act);
307
308         act = ActionManager::register_action (editor_actions, "scroll-tracks-up", _("Scroll Tracks Up"), mem_fun(*this, &Editor::scroll_tracks_up));
309         ActionManager::session_sensitive_actions.push_back (act);
310         act = ActionManager::register_action (editor_actions, "scroll-tracks-down", _("Scroll Tracks Down"), mem_fun(*this, &Editor::scroll_tracks_down));
311         ActionManager::session_sensitive_actions.push_back (act);
312         act = ActionManager::register_action (editor_actions, "step-tracks-up", _("Step Tracks Up"), mem_fun(*this, &Editor::scroll_tracks_up_line));
313         ActionManager::session_sensitive_actions.push_back (act);
314         act = ActionManager::register_action (editor_actions, "step-tracks-down", _("Step Tracks Down"), mem_fun(*this, &Editor::scroll_tracks_down_line));
315         ActionManager::session_sensitive_actions.push_back (act);
316
317         act = ActionManager::register_action (editor_actions, "scroll-backward", _("Scroll Backward"), bind (mem_fun(*this, &Editor::scroll_backward), 0.8f));
318         ActionManager::session_sensitive_actions.push_back (act);
319         act = ActionManager::register_action (editor_actions, "scroll-forward", _("Scroll Forward"), bind (mem_fun(*this, &Editor::scroll_forward), 0.8f));
320         ActionManager::session_sensitive_actions.push_back (act);
321         act = ActionManager::register_action (editor_actions, "goto", _("goto"), mem_fun(*this, &Editor::goto_frame));
322         ActionManager::session_sensitive_actions.push_back (act);
323         act = ActionManager::register_action (editor_actions, "center-playhead", _("Center Playhead"), mem_fun(*this, &Editor::center_playhead));
324         ActionManager::session_sensitive_actions.push_back (act);
325         act = ActionManager::register_action (editor_actions, "center-edit-cursor", _("Center Active Marker"), mem_fun(*this, &Editor::center_edit_point));
326         ActionManager::session_sensitive_actions.push_back (act);
327
328         act = ActionManager::register_action (editor_actions, "scroll-playhead-forward", _("Playhead Forward"), bind (mem_fun(*this, &Editor::scroll_playhead), true));;
329         ActionManager::session_sensitive_actions.push_back (act);
330         act = ActionManager::register_action (editor_actions, "scroll-playhead-backward", _("Playhead Backward"), bind (mem_fun(*this, &Editor::scroll_playhead), false));
331         ActionManager::session_sensitive_actions.push_back (act);
332
333         act = ActionManager::register_action (editor_actions, "playhead-to-edit", _("Playhead To Active Mark"), bind (mem_fun(*this, &Editor::cursor_align), true));
334         ActionManager::session_sensitive_actions.push_back (act);
335         act = ActionManager::register_action (editor_actions, "edit-to-playhead", _("Active Mark To Playhead"), bind (mem_fun(*this, &Editor::cursor_align), false));
336         ActionManager::session_sensitive_actions.push_back (act);
337
338         act = ActionManager::register_action (editor_actions, "trim-front", _("Trim Start At Edit Point"), mem_fun(*this, &Editor::trim_region_front));
339         ActionManager::session_sensitive_actions.push_back (act);
340         ActionManager::region_selection_sensitive_actions.push_back (act);
341         act = ActionManager::register_action (editor_actions, "trim-back", _("Trim End At Edit Point"), mem_fun(*this, &Editor::trim_region_back));
342         ActionManager::session_sensitive_actions.push_back (act);
343         ActionManager::region_selection_sensitive_actions.push_back (act);
344
345         act = ActionManager::register_action (editor_actions, "trim-from-start", _("Start To Edit Point"), mem_fun(*this, &Editor::trim_region_from_edit_point));
346         ActionManager::session_sensitive_actions.push_back (act);
347         ActionManager::region_selection_sensitive_actions.push_back (act);
348         act = ActionManager::register_action (editor_actions, "trim-to-end", _("Edit Point To End"), mem_fun(*this, &Editor::trim_region_to_edit_point));
349         ActionManager::session_sensitive_actions.push_back (act);
350         ActionManager::region_selection_sensitive_actions.push_back (act);
351         act = ActionManager::register_action (editor_actions, "trim-region-to-loop", _("Trim To Loop"), mem_fun(*this, &Editor::trim_region_to_loop));
352         ActionManager::session_sensitive_actions.push_back (act);
353         ActionManager::region_selection_sensitive_actions.push_back (act);
354         act = ActionManager::register_action (editor_actions, "trim-region-to-punch", _("Trim To Punch"), mem_fun(*this, &Editor::trim_region_to_punch));
355         ActionManager::session_sensitive_actions.push_back (act);
356         ActionManager::region_selection_sensitive_actions.push_back (act);
357
358         act = ActionManager::register_action (editor_actions, "set-loop-from-edit-range", _("Set Loop From Edit Range"), bind (mem_fun(*this, &Editor::set_loop_from_edit_range), false));
359         ActionManager::session_sensitive_actions.push_back (act);
360         act = ActionManager::register_action (editor_actions, "set-loop-from-region", _("Set Loop From Region"), bind (mem_fun(*this, &Editor::set_loop_from_region), false));
361         ActionManager::session_sensitive_actions.push_back (act);
362         ActionManager::region_selection_sensitive_actions.push_back (act);
363         act = ActionManager::register_action (editor_actions, "loop-region", _("Loop Region"), bind (mem_fun(*this, &Editor::set_loop_from_region), true));
364         ActionManager::session_sensitive_actions.push_back (act);
365         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));
366         ActionManager::session_sensitive_actions.push_back (act);
367         act = ActionManager::register_action (editor_actions, "set-punch-from-region", _("Set Punch From Region"), mem_fun(*this, &Editor::set_punch_from_region));
368         ActionManager::session_sensitive_actions.push_back (act);
369         ActionManager::region_selection_sensitive_actions.push_back (act);
370         act = ActionManager::register_action (editor_actions, "pitch-shift-region", _("Transpose"), mem_fun(*this, &Editor::pitch_shift_regions));
371         ActionManager::session_sensitive_actions.push_back (act);
372         ActionManager::region_selection_sensitive_actions.push_back (act);
373         act = ActionManager::register_action (editor_actions, "toggle-opaque-region", _("Toggle Opaque"), mem_fun(*this, &Editor::toggle_region_opaque));
374         ActionManager::session_sensitive_actions.push_back (act);
375         ActionManager::region_selection_sensitive_actions.push_back (act);
376         
377         act = ActionManager::register_action (editor_actions, "set-fade-in-length", _("Set Fade In Length"), bind (mem_fun(*this, &Editor::set_fade_length), true));
378         ActionManager::session_sensitive_actions.push_back (act);
379         act = ActionManager::register_action (editor_actions, "toggle-fade-in-active", _("Toggle Fade In Active"), bind (mem_fun(*this, &Editor::toggle_fade_active), true));
380         ActionManager::session_sensitive_actions.push_back (act);
381         act = ActionManager::register_action (editor_actions, "set-fade-out-length", _("Set Fade Out Length"), bind (mem_fun(*this, &Editor::set_fade_length), false));
382         ActionManager::session_sensitive_actions.push_back (act);
383         act = ActionManager::register_action (editor_actions, "toggle-fade-out-active", _("Toggle Fade Out Active"), bind (mem_fun(*this, &Editor::toggle_fade_active), false));
384         ActionManager::session_sensitive_actions.push_back (act);
385
386         act = ActionManager::register_action (editor_actions, "align-regions-start", _("Align Regions Start"), bind (mem_fun(*this, &Editor::align), ARDOUR::Start));
387         ActionManager::session_sensitive_actions.push_back (act);
388         ActionManager::region_selection_sensitive_actions.push_back (act);
389         act = ActionManager::register_action (editor_actions, "align-regions-start-relative", _("Align Regions Start Relative"), bind (mem_fun(*this, &Editor::align_relative), ARDOUR::Start));
390         ActionManager::session_sensitive_actions.push_back (act);
391         ActionManager::region_selection_sensitive_actions.push_back (act);
392         act = ActionManager::register_action (editor_actions, "align-regions-end", _("Align Regions End"), bind (mem_fun(*this, &Editor::align), ARDOUR::End));
393         ActionManager::session_sensitive_actions.push_back (act);
394         ActionManager::region_selection_sensitive_actions.push_back (act);
395         act = ActionManager::register_action (editor_actions, "align-regions-end-relative", _("Align Regions End Relative"), bind (mem_fun(*this, &Editor::align_relative), ARDOUR::End));
396         ActionManager::session_sensitive_actions.push_back (act);
397         ActionManager::region_selection_sensitive_actions.push_back (act);
398
399         act = ActionManager::register_action (editor_actions, "align-regions-sync", _("Align Regions Sync"), bind (mem_fun(*this, &Editor::align), ARDOUR::SyncPoint));
400         ActionManager::session_sensitive_actions.push_back (act);
401         ActionManager::region_selection_sensitive_actions.push_back (act);
402         act = ActionManager::register_action (editor_actions, "align-regions-sync-relative", _("Align Regions Sync Relative"), bind (mem_fun(*this, &Editor::align_relative), ARDOUR::SyncPoint));
403         ActionManager::session_sensitive_actions.push_back (act);
404         ActionManager::region_selection_sensitive_actions.push_back (act);
405
406         act = ActionManager::register_action (editor_actions, "play-from-edit-point", _("Play From Edit Point"), mem_fun(*this, &Editor::play_from_edit_point));
407         ActionManager::session_sensitive_actions.push_back (act);
408         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));
409         ActionManager::session_sensitive_actions.push_back (act);
410
411         act = ActionManager::register_action (editor_actions, "play-edit-range", _("Play Edit Range"), mem_fun(*this, &Editor::play_edit_range));
412         act = ActionManager::register_action (editor_actions, "play-selected-regions", _("Play Selected Region(s)"), mem_fun(*this, &Editor::play_selected_region));
413         ActionManager::session_sensitive_actions.push_back (act);
414         ActionManager::region_selection_sensitive_actions.push_back (act);
415         act = ActionManager::register_action (editor_actions, "brush-at-mouse", _("Brush at Mouse"), mem_fun(*this, &Editor::kbd_brush));
416         ActionManager::session_sensitive_actions.push_back (act);
417
418         act = ActionManager::register_action (editor_actions, "set-playhead", _("Playhead to Mouse"), mem_fun(*this, &Editor::set_playhead_cursor));
419         ActionManager::session_sensitive_actions.push_back (act);
420         act = ActionManager::register_action (editor_actions, "set-edit-point", _("Active Marker to Mouse"), mem_fun(*this, &Editor::set_edit_point));
421         ActionManager::session_sensitive_actions.push_back (act);
422
423         act = ActionManager::register_action (editor_actions, "duplicate-region", _("Duplicate Region"), bind (mem_fun(*this, &Editor::duplicate_dialog), false));
424         ActionManager::session_sensitive_actions.push_back (act);
425         ActionManager::region_selection_sensitive_actions.push_back (act);
426         act = ActionManager::register_action (editor_actions, "multi-duplicate-region", _("Multi-Duplicate Region"), bind (mem_fun(*this, &Editor::duplicate_dialog), true));
427         ActionManager::session_sensitive_actions.push_back (act);
428         ActionManager::region_selection_sensitive_actions.push_back (act);
429         act = ActionManager::register_action (editor_actions, "duplicate-range", _("Duplicate Range"), bind (mem_fun(*this, &Editor::duplicate_dialog), false));
430         ActionManager::session_sensitive_actions.push_back (act);
431         ActionManager::region_selection_sensitive_actions.push_back (act);
432         act = ActionManager::register_action (editor_actions, "insert-region", _("Insert Region"), mem_fun(*this, &Editor::keyboard_insert_region_list_selection));
433         ActionManager::session_sensitive_actions.push_back (act);
434         ActionManager::region_selection_sensitive_actions.push_back (act);
435         act = ActionManager::register_action (editor_actions, "normalize-region", _("Normalize Region"), mem_fun(*this, &Editor::normalize_region));
436         ActionManager::session_sensitive_actions.push_back (act);
437         ActionManager::region_selection_sensitive_actions.push_back (act);
438         act = ActionManager::register_action (editor_actions, "rename-region", _("Rename"), mem_fun(*this, &Editor::rename_region));
439         ActionManager::session_sensitive_actions.push_back (act);
440         ActionManager::region_selection_sensitive_actions.push_back (act);
441         act = ActionManager::register_action (editor_actions, "auto-rename-region", _("Auto-Rename"), mem_fun(*this, &Editor::rename_region));
442         ActionManager::session_sensitive_actions.push_back (act);
443         ActionManager::region_selection_sensitive_actions.push_back (act);
444         act = ActionManager::register_action (editor_actions, "boost-region-gain", _("Boost Region Gain"), bind (mem_fun(*this, &Editor::adjust_region_scale_amplitude), true));
445         ActionManager::session_sensitive_actions.push_back (act);
446         ActionManager::region_selection_sensitive_actions.push_back (act);
447         act = ActionManager::register_action (editor_actions, "cut-region-gain", _("Cut Region Gain"), bind (mem_fun(*this, &Editor::adjust_region_scale_amplitude), false));
448         ActionManager::session_sensitive_actions.push_back (act);
449         ActionManager::region_selection_sensitive_actions.push_back (act);
450         act = ActionManager::register_action (editor_actions, "split-region", _("Split Region"), mem_fun(*this, &Editor::split));
451         ActionManager::session_sensitive_actions.push_back (act);
452         ActionManager::region_selection_sensitive_actions.push_back (act);
453         act = ActionManager::register_action (editor_actions, "set-region-sync-position", _("Set Region Sync Position"), mem_fun(*this, &Editor::set_region_sync_from_edit_point));
454         ActionManager::session_sensitive_actions.push_back (act);
455         ActionManager::region_selection_sensitive_actions.push_back (act);
456         act = ActionManager::register_action (editor_actions, "remove-region-sync", _("Remove Region Sync"), mem_fun(*this, &Editor::remove_region_sync));
457         ActionManager::session_sensitive_actions.push_back (act);
458         ActionManager::region_selection_sensitive_actions.push_back (act);
459         act = ActionManager::register_action (editor_actions, "raise-region", _("Raise Region"), mem_fun(*this, &Editor::raise_region));
460         ActionManager::session_sensitive_actions.push_back (act);
461         ActionManager::region_selection_sensitive_actions.push_back (act);
462         act = ActionManager::register_action (editor_actions, "lower-region", _("Lower Region"), mem_fun(*this, &Editor::lower_region));
463         ActionManager::session_sensitive_actions.push_back (act);
464         ActionManager::region_selection_sensitive_actions.push_back (act);
465         act = ActionManager::register_action (editor_actions, "export-region", _("Export Region"), mem_fun(*this, &Editor::export_region));
466         ActionManager::session_sensitive_actions.push_back (act);
467         ActionManager::region_selection_sensitive_actions.push_back (act);
468         act = ActionManager::register_toggle_action (editor_actions, "lock-region", _("Lock Region"), mem_fun(*this, &Editor::toggle_region_lock));
469         ActionManager::session_sensitive_actions.push_back (act);
470         ActionManager::region_selection_sensitive_actions.push_back (act);
471         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));
472         ActionManager::session_sensitive_actions.push_back (act);
473         ActionManager::region_selection_sensitive_actions.push_back (act);
474         act = ActionManager::register_action (editor_actions, "naturalize-region", _("Move To Original Position"), mem_fun (*this, &Editor::naturalize));
475         ActionManager::session_sensitive_actions.push_back (act);
476         ActionManager::region_selection_sensitive_actions.push_back (act);
477         act = ActionManager::register_action (editor_actions, "reverse-region", _("Reverse"), mem_fun (*this, &Editor::reverse_region));
478         ActionManager::session_sensitive_actions.push_back (act);
479         ActionManager::region_selection_sensitive_actions.push_back (act);
480         act = ActionManager::register_action (editor_actions, "monoize-region", _("Make mono regions"), (mem_fun(*this, &Editor::split_multichannel_region)));
481         ActionManager::session_sensitive_actions.push_back (act);
482         ActionManager::region_selection_sensitive_actions.push_back (act);
483         act = ActionManager::register_action (editor_actions, "region-fill-track", _("Fill Track"), (mem_fun(*this, &Editor::region_fill_track)));
484         ActionManager::session_sensitive_actions.push_back (act);
485         ActionManager::region_selection_sensitive_actions.push_back (act);
486         act = ActionManager::register_action (editor_actions, "mute-unmute-region", _("Mute/Unmute Region"), mem_fun(*this, &Editor::kbd_mute_unmute_region));
487         ActionManager::session_sensitive_actions.push_back (act);
488         ActionManager::region_selection_sensitive_actions.push_back (act);
489
490         undo_action = act = ActionManager::register_action (editor_actions, "undo", _("Undo"), bind (mem_fun(*this, &Editor::undo), 1U));
491         ActionManager::session_sensitive_actions.push_back (act);
492         redo_action = act = ActionManager::register_action (editor_actions, "redo", _("Redo"), bind (mem_fun(*this, &Editor::redo), 1U));
493         ActionManager::session_sensitive_actions.push_back (act);
494
495         act = ActionManager::register_action (editor_actions, "export-audio", _("Export Audio"), mem_fun(*this, &Editor::export_audio));
496         ActionManager::session_sensitive_actions.push_back (act);
497         act = ActionManager::register_action (editor_actions, "export-range", _("Export Range"), mem_fun(*this, &Editor::export_range));
498         ActionManager::session_sensitive_actions.push_back (act);
499
500         act = ActionManager::register_action (editor_actions, "editor-separate", _("Separate"), mem_fun(*this, &Editor::separate_region_from_selection));
501         ActionManager::session_sensitive_actions.push_back (act);
502         ActionManager::mouse_edit_point_requires_canvas_actions.push_back (act);
503         act = ActionManager::register_action (editor_actions, "separate-from-punch", _("Separate Using Punch Range"), mem_fun(*this, &Editor::separate_region_from_punch));
504         ActionManager::session_sensitive_actions.push_back (act);
505         ActionManager::mouse_edit_point_requires_canvas_actions.push_back (act);
506         act = ActionManager::register_action (editor_actions, "separate-from-loop", _("Separate Using Loop Range"), mem_fun(*this, &Editor::separate_region_from_loop));
507         ActionManager::session_sensitive_actions.push_back (act);
508         ActionManager::mouse_edit_point_requires_canvas_actions.push_back (act);
509         act = ActionManager::register_action (editor_actions, "editor-crop", _("Crop"), mem_fun(*this, &Editor::crop_region_to_selection));
510         ActionManager::session_sensitive_actions.push_back (act);
511         ActionManager::mouse_edit_point_requires_canvas_actions.push_back (act);
512         act = ActionManager::register_action (editor_actions, "editor-cut", _("Cut"), mem_fun(*this, &Editor::cut));
513         ActionManager::session_sensitive_actions.push_back (act);
514         /* Note: for now, editor-delete does the exact same thing as editor-cut */
515         act = ActionManager::register_action (editor_actions, "editor-delete", _("Delete"), mem_fun(*this, &Editor::cut));
516         ActionManager::session_sensitive_actions.push_back (act);
517         act = ActionManager::register_action (editor_actions, "editor-copy", _("Copy"), mem_fun(*this, &Editor::copy));
518         ActionManager::session_sensitive_actions.push_back (act);
519         act = ActionManager::register_action (editor_actions, "editor-paste", _("Paste"), mem_fun(*this, &Editor::keyboard_paste));
520         ActionManager::session_sensitive_actions.push_back (act);
521
522         act = ActionManager::register_action (editor_actions, "quantize-region", _("Quantize Region"), mem_fun(*this, &Editor::quantize_region));
523         ActionManager::session_sensitive_actions.push_back (act);
524         ActionManager::region_selection_sensitive_actions.push_back (act);
525         
526         act = ActionManager::register_action (editor_actions, "set-tempo-from-region", _("Set Tempo from Region=Bar"), mem_fun(*this, &Editor::use_region_as_bar));
527         ActionManager::session_sensitive_actions.push_back (act);
528         ActionManager::region_selection_sensitive_actions.push_back (act);
529         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));
530         ActionManager::session_sensitive_actions.push_back (act);
531
532         act = ActionManager::register_action (editor_actions, "split-region-at-transients", _("Split Regions At Percussion Onsets"), mem_fun(*this, &Editor::split_region_at_transients));
533         ActionManager::session_sensitive_actions.push_back (act);
534         ActionManager::region_selection_sensitive_actions.push_back (act);
535         act = ActionManager::register_action (editor_actions, "toggle-rhythm-ferret", _("Rhythm Ferret"), mem_fun(*this, &Editor::show_rhythm_ferret));
536         ActionManager::session_sensitive_actions.push_back (act);
537
538         act = ActionManager::register_action (editor_actions, "tab-to-transient-forwards", _("Move Forward to Transient"), bind (mem_fun(*this, &Editor::tab_to_transient), true));
539         ActionManager::session_sensitive_actions.push_back (act);
540         act = ActionManager::register_action (editor_actions, "tab-to-transient-backwards", _("Move Backwards to Transient"), bind (mem_fun(*this, &Editor::tab_to_transient), false));
541         ActionManager::session_sensitive_actions.push_back (act);
542
543         act = ActionManager::register_action (editor_actions, "crop", _("Crop"), mem_fun(*this, &Editor::crop_region_to_selection));
544         ActionManager::session_sensitive_actions.push_back (act);
545         act = ActionManager::register_action (editor_actions, "insert-chunk", _("Insert Chunk"), bind (mem_fun(*this, &Editor::paste_named_selection), 1.0f));
546         ActionManager::session_sensitive_actions.push_back (act);
547
548         act = ActionManager::register_action (editor_actions, "split-at-edit-cursor", _("Split At Edit Point"), mem_fun(*this, &Editor::split_region));
549         ActionManager::edit_point_in_region_sensitive_actions.push_back (act);
550
551         act = ActionManager::register_action (editor_actions, "start-range", _("Start Range"), mem_fun(*this, &Editor::keyboard_selection_begin));
552         ActionManager::session_sensitive_actions.push_back (act);
553         act = ActionManager::register_action (editor_actions, "finish-range", _("Finish Range"), bind (mem_fun(*this, &Editor::keyboard_selection_finish), false));
554         ActionManager::session_sensitive_actions.push_back (act);
555         act = ActionManager::register_action (editor_actions, "finish-add-range", _("Finish add Range"), bind (mem_fun(*this, &Editor::keyboard_selection_finish), true));
556         ActionManager::session_sensitive_actions.push_back (act);
557
558         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));
559         ActionManager::session_sensitive_actions.push_back (act);
560         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));
561         ActionManager::session_sensitive_actions.push_back (act);
562
563         act = ActionManager::register_toggle_action (editor_actions, "toggle-follow-playhead", _("Follow Playhead"), (mem_fun(*this, &Editor::toggle_follow_playhead)));
564         ActionManager::session_sensitive_actions.push_back (act);
565         act = ActionManager::register_action (editor_actions, "remove-last-capture", _("Remove Last Capture"), (mem_fun(*this, &Editor::remove_last_capture)));
566         ActionManager::session_sensitive_actions.push_back (act);
567
568         act = ActionManager::register_action (editor_actions, "insert-time", _("Insert Time"), (mem_fun(*this, &Editor::do_insert_time)));
569         ActionManager::session_sensitive_actions.push_back (act);
570         ActionManager::track_selection_sensitive_actions.push_back (act);
571
572         act = ActionManager::register_action (editor_actions, "toggle-track-active", _("Toggle Active"), (mem_fun(*this, &Editor::toggle_tracks_active)));
573         ActionManager::session_sensitive_actions.push_back (act);
574         ActionManager::track_selection_sensitive_actions.push_back (act);
575         act = ActionManager::register_action (editor_actions, "remove-track", _("Remove"), (mem_fun(*this, &Editor::remove_tracks)));
576         ActionManager::session_sensitive_actions.push_back (act);
577         ActionManager::track_selection_sensitive_actions.push_back (act);
578
579         act = ActionManager::register_action (editor_actions, "fit-tracks", _("Fit Selected Tracks"), (mem_fun(*this, &Editor::fit_tracks)));
580         ActionManager::session_sensitive_actions.push_back (act);
581         act = ActionManager::register_action (editor_actions, "track-height-largest", _("Largest"), (mem_fun(*this, &Editor::set_track_height_largest)));
582         ActionManager::session_sensitive_actions.push_back (act);
583         ActionManager::track_selection_sensitive_actions.push_back (act);
584         act = ActionManager::register_action (editor_actions, "track-height-larger", _("Larger"), (mem_fun(*this, &Editor::set_track_height_larger)));
585         ActionManager::session_sensitive_actions.push_back (act);
586         ActionManager::track_selection_sensitive_actions.push_back (act);
587         act = ActionManager::register_action (editor_actions, "track-height-large", _("Large"), (mem_fun(*this, &Editor::set_track_height_large)));
588         ActionManager::session_sensitive_actions.push_back (act);
589         ActionManager::track_selection_sensitive_actions.push_back (act);
590         act = ActionManager::register_action (editor_actions, "track-height-normal", _("Normal"), (mem_fun(*this, &Editor::set_track_height_normal)));
591         ActionManager::session_sensitive_actions.push_back (act);
592         ActionManager::track_selection_sensitive_actions.push_back (act);
593         act = ActionManager::register_action (editor_actions, "track-height-small", _("Small"), (mem_fun(*this, &Editor::set_track_height_small)));
594         ActionManager::track_selection_sensitive_actions.push_back (act);
595         ActionManager::session_sensitive_actions.push_back (act);
596         ActionManager::track_selection_sensitive_actions.push_back (act);
597         act = ActionManager::register_action (editor_actions, "track-height-smaller", _("Smaller"), (mem_fun(*this, &Editor::set_track_height_smaller)));
598         ActionManager::session_sensitive_actions.push_back (act);
599         ActionManager::track_selection_sensitive_actions.push_back (act);
600
601         Glib::RefPtr<ActionGroup> zoom_actions = ActionGroup::create (X_("Zoom"));
602         RadioAction::Group zoom_group;
603
604         ActionManager::register_radio_action (zoom_actions, zoom_group, "zoom-focus-left", _("Zoom Focus Left"), bind (mem_fun(*this, &Editor::zoom_focus_chosen), Editing::ZoomFocusLeft));
605         ActionManager::session_sensitive_actions.push_back (act);
606         ActionManager::register_radio_action (zoom_actions, zoom_group, "zoom-focus-right", _("Zoom Focus Right"), bind (mem_fun(*this, &Editor::zoom_focus_chosen), Editing::ZoomFocusRight));
607         ActionManager::session_sensitive_actions.push_back (act);
608         ActionManager::register_radio_action (zoom_actions, zoom_group, "zoom-focus-center", _("Zoom Focus Center"), bind (mem_fun(*this, &Editor::zoom_focus_chosen), Editing::ZoomFocusCenter));
609         ActionManager::session_sensitive_actions.push_back (act);
610         ActionManager::register_radio_action (zoom_actions, zoom_group, "zoom-focus-playhead", _("Zoom Focus Playhead"), bind (mem_fun(*this, &Editor::zoom_focus_chosen), Editing::ZoomFocusPlayhead));
611         ActionManager::session_sensitive_actions.push_back (act);
612         ActionManager::register_radio_action (zoom_actions, zoom_group, "zoom-focus-mouse", _("Zoom Focus Mouse"), bind (mem_fun(*this, &Editor::zoom_focus_chosen), Editing::ZoomFocusMouse));
613         ActionManager::session_sensitive_actions.push_back (act);
614         ActionManager::register_radio_action (zoom_actions, zoom_group, "zoom-focus-edit", _("Zoom Focus Edit"), bind (mem_fun(*this, &Editor::zoom_focus_chosen), Editing::ZoomFocusEdit));
615         ActionManager::session_sensitive_actions.push_back (act);
616
617         Glib::RefPtr<ActionGroup> mouse_mode_actions = ActionGroup::create (X_("MouseMode"));
618         RadioAction::Group mouse_mode_group;
619
620         ActionManager::register_radio_action (mouse_mode_actions, mouse_mode_group, "set-mouse-mode-object", _("Object Tool"), bind (mem_fun(*this, &Editor::set_mouse_mode), Editing::MouseObject, false));
621         ActionManager::register_radio_action (mouse_mode_actions, mouse_mode_group, "set-mouse-mode-range", _("Range Tool"), bind (mem_fun(*this, &Editor::set_mouse_mode), Editing::MouseRange, false));
622         ActionManager::register_radio_action (mouse_mode_actions, mouse_mode_group, "set-mouse-mode-gain", _("Gain Tool"), bind (mem_fun(*this, &Editor::set_mouse_mode), Editing::MouseGain, false));
623         ActionManager::register_radio_action (mouse_mode_actions, mouse_mode_group, "set-mouse-mode-zoom", _("Zoom Tool"), bind (mem_fun(*this, &Editor::set_mouse_mode), Editing::MouseZoom, false));
624         ActionManager::register_radio_action (mouse_mode_actions, mouse_mode_group, "set-mouse-mode-timefx", _("Timefx Tool"), bind (mem_fun(*this, &Editor::set_mouse_mode), Editing::MouseTimeFX, false));
625         ActionManager::register_radio_action (mouse_mode_actions, mouse_mode_group, "set-mouse-mode-note", _("Note Tool"), bind (mem_fun(*this, &Editor::set_mouse_mode), Editing::MouseNote, false));
626
627         RadioAction::Group edit_point_group;
628         ActionManager::register_radio_action (editor_actions, edit_point_group, X_("edit-at-playhead"), _("Playhead"), (bind (mem_fun(*this, &Editor::edit_point_chosen), Editing::EditAtPlayhead)));
629         ActionManager::register_radio_action (editor_actions, edit_point_group, X_("edit-at-mouse"), _("Mouse"), (bind (mem_fun(*this, &Editor::edit_point_chosen), Editing::EditAtPlayhead)));
630         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)));
631
632         ActionManager::register_action (editor_actions, "cycle-edit-point", _("Change edit point"), bind (mem_fun (*this, &Editor::cycle_edit_point), false));
633         ActionManager::register_action (editor_actions, "cycle-edit-point-with-marker", _("Change edit point (w/Marker)"), bind (mem_fun (*this, &Editor::cycle_edit_point), true));
634
635         ActionManager::register_action (editor_actions, "set-edit-splice", _("Splice"), bind (mem_fun (*this, &Editor::set_edit_mode), Splice));
636         ActionManager::register_action (editor_actions, "set-edit-slide", _("Slide"), bind (mem_fun (*this, &Editor::set_edit_mode), Slide));
637         ActionManager::register_action (editor_actions, "set-edit-lock", _("Lock"), bind (mem_fun (*this, &Editor::set_edit_mode), Lock));
638         ActionManager::register_action (editor_actions, "toggle-edit-mode", _("Toggle Edit Mode"), mem_fun (*this, &Editor::cycle_edit_mode));
639
640         ActionManager::register_action (editor_actions, X_("SnapTo"), _("Snap To"));
641         ActionManager::register_action (editor_actions, X_("SnapMode"), _("Snap Mode"));
642
643         RadioAction::Group snap_mode_group;
644         ActionManager::register_radio_action (editor_actions, snap_mode_group, X_("snap-off"), _("No Grid"), (bind (mem_fun(*this, &Editor::snap_mode_chosen), Editing::SnapOff)));
645         ActionManager::register_radio_action (editor_actions, snap_mode_group, X_("snap-normal"), _("Grid"), (bind (mem_fun(*this, &Editor::snap_mode_chosen), Editing::SnapNormal)));
646         ActionManager::register_radio_action (editor_actions, snap_mode_group, X_("snap-magnetic"), _("Magnetic"), (bind (mem_fun(*this, &Editor::snap_mode_chosen), Editing::SnapMagnetic)));
647
648         ActionManager::register_action (editor_actions, X_("cycle-snap-mode"), _("Next Snap Mode"), mem_fun (*this, &Editor::cycle_snap_mode));
649         ActionManager::register_action (editor_actions, X_("cycle-snap-choice"), _("Next Snap Choice"), mem_fun (*this, &Editor::cycle_snap_choice));
650
651         Glib::RefPtr<ActionGroup> snap_actions = ActionGroup::create (X_("Snap"));
652         RadioAction::Group snap_choice_group;
653
654         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)));
655         ActionManager::register_radio_action (snap_actions, snap_choice_group, X_("snap-to-smpte-frame"), _("Snap to SMPTE frame"), (bind (mem_fun(*this, &Editor::snap_type_chosen), Editing::SnapToSMPTEFrame)));
656         ActionManager::register_radio_action (snap_actions, snap_choice_group, X_("snap-to-smpte-seconds"), _("Snap to SMPTE seconds"), (bind (mem_fun(*this, &Editor::snap_type_chosen), Editing::SnapToSMPTESeconds)));
657         ActionManager::register_radio_action (snap_actions, snap_choice_group, X_("snap-to-smpte-minutes"), _("Snap to SMPTE minutes"), (bind (mem_fun(*this, &Editor::snap_type_chosen), Editing::SnapToSMPTEMinutes)));
658         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)));
659         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)));
660         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)));
661         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)));
662         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)));
663         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)));
664         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)));
665         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)));
666         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)));
667         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)));
668         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)));
669         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)));
670         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)));
671         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)));
672
673         /* RULERS */
674         
675         Glib::RefPtr<ActionGroup> ruler_actions = ActionGroup::create (X_("Rulers"));
676         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)));
677         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)));
678         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)));
679         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)));
680         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)));
681         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)));
682         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)));
683         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)));
684         ruler_timecode_action = Glib::RefPtr<ToggleAction>::cast_static (ActionManager::register_toggle_action (ruler_actions, X_("toggle-timecode-ruler"), _("Timecode"), bind (mem_fun(*this, &Editor::toggle_ruler_visibility), ruler_metric_smpte)));
685         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)));
686
687         /* set defaults here */
688
689         no_ruler_shown_update = true;
690         ruler_meter_action->set_active (true);
691         ruler_tempo_action->set_active (true);
692         ruler_marker_action->set_active (true);
693         ruler_range_action->set_active (true);
694         if (Profile->get_sae()) {
695                 ruler_cd_marker_action->set_active (false);
696                 ruler_timecode_action->set_active (false);
697                 ruler_minsec_action->set_active (true);
698         } else {
699                 ruler_cd_marker_action->set_active (true);
700                 ruler_timecode_action->set_active (true);
701                 ruler_minsec_action->set_active (false);
702         }
703         ruler_samples_action->set_active (false);
704         no_ruler_shown_update = false;
705         
706         /* REGION LIST */
707
708         Glib::RefPtr<ActionGroup> rl_actions = ActionGroup::create (X_("RegionList"));
709         RadioAction::Group sort_type_group;
710         RadioAction::Group sort_order_group;
711
712         /* the region list popup menu */
713         ActionManager::register_action (rl_actions, X_("RegionListSort"), _("Sort"));
714
715         act = ActionManager::register_action (rl_actions, X_("rlAudition"), _("Audition"), mem_fun(*this, &Editor::audition_region_from_region_list));
716         ActionManager::region_list_selection_sensitive_actions.push_back (act);
717         act = ActionManager::register_action (rl_actions, X_("rlHide"), _("Hide"), mem_fun(*this, &Editor::hide_region_from_region_list));
718         ActionManager::region_list_selection_sensitive_actions.push_back (act);
719         act = ActionManager::register_action (rl_actions, X_("rlRemove"), _("Remove"), mem_fun (*this, &Editor::remove_region_from_region_list));
720         ActionManager::region_list_selection_sensitive_actions.push_back (act);
721         ActionManager::register_toggle_action (rl_actions, X_("rlShowAll"), _("Show all"), mem_fun(*this, &Editor::toggle_full_region_list));
722         ActionManager::register_toggle_action (rl_actions, X_("rlShowAuto"), _("Show automatic regions"), mem_fun(*this, &Editor::toggle_show_auto_regions));
723
724         ActionManager::register_radio_action (rl_actions, sort_order_group, X_("SortAscending"),  _("Ascending"),
725                                bind (mem_fun(*this, &Editor::reset_region_list_sort_direction), true));
726         ActionManager::register_radio_action (rl_actions, sort_order_group, X_("SortDescending"),   _("Descending"),
727                                bind (mem_fun(*this, &Editor::reset_region_list_sort_direction), false));
728         
729         ActionManager::register_radio_action (rl_actions, sort_type_group, X_("SortByRegionName"),  _("By Region Name"),
730                                bind (mem_fun(*this, &Editor::reset_region_list_sort_type), ByName));
731         ActionManager::register_radio_action (rl_actions, sort_type_group, X_("SortByRegionLength"),  _("By Region Length"),
732                                bind (mem_fun(*this, &Editor::reset_region_list_sort_type), ByLength));
733         ActionManager::register_radio_action (rl_actions, sort_type_group, X_("SortByRegionPosition"),  _("By Region Position"),
734                                bind (mem_fun(*this, &Editor::reset_region_list_sort_type), ByPosition));
735         ActionManager::register_radio_action (rl_actions, sort_type_group, X_("SortByRegionTimestamp"),  _("By Region Timestamp"),
736                                bind (mem_fun(*this, &Editor::reset_region_list_sort_type), ByTimestamp));
737         ActionManager::register_radio_action (rl_actions, sort_type_group, X_("SortByRegionStartinFile"),  _("By Region Start in File"),
738                                bind (mem_fun(*this, &Editor::reset_region_list_sort_type), ByStartInFile));
739         ActionManager::register_radio_action (rl_actions, sort_type_group, X_("SortByRegionEndinFile"),  _("By Region End in File"),
740                                bind (mem_fun(*this, &Editor::reset_region_list_sort_type), ByEndInFile));
741         ActionManager::register_radio_action (rl_actions, sort_type_group, X_("SortBySourceFileName"),  _("By Source File Name"),
742                                bind (mem_fun(*this, &Editor::reset_region_list_sort_type), BySourceFileName));
743         ActionManager::register_radio_action (rl_actions, sort_type_group, X_("SortBySourceFileLength"),  _("By Source File Length"),
744                                bind (mem_fun(*this, &Editor::reset_region_list_sort_type), BySourceFileLength));
745         ActionManager::register_radio_action (rl_actions, sort_type_group, X_("SortBySourceFileCreationDate"),  _("By Source File Creation Date"),
746                                bind (mem_fun(*this, &Editor::reset_region_list_sort_type), BySourceFileCreationDate));
747         ActionManager::register_radio_action (rl_actions, sort_type_group, X_("SortBySourceFilesystem"),  _("By Source Filesystem"),
748                                bind (mem_fun(*this, &Editor::reset_region_list_sort_type), BySourceFileFS));
749
750
751         /* the next two are duplicate items with different names for use in two different contexts */
752
753         act = ActionManager::register_action (editor_actions, X_("addExistingAudioFiles"), _("Import"), mem_fun (*this, &Editor::external_audio_dialog));
754         ActionManager::session_sensitive_actions.push_back (act);
755         act = ActionManager::register_action (editor_actions, X_("addExternalAudioToRegionList"), _("Import to Region List"), bind (mem_fun(*this, &Editor::add_external_audio_action), ImportAsRegion));
756         ActionManager::session_sensitive_actions.push_back (act);
757         
758         ActionManager::register_action (editor_actions, X_("importFromSession"), _("Import From Session"), mem_fun(*this, &Editor::session_import_dialog));
759
760         act = ActionManager::register_toggle_action (editor_actions, X_("toggle-waveform-visible"), _("Show Waveforms"), mem_fun (*this, &Editor::toggle_waveform_visibility));
761         ActionManager::track_selection_sensitive_actions.push_back (act);
762
763         ActionManager::register_toggle_action (editor_actions, X_("ToggleWaveformsWhileRecording"), _("Show Waveforms While Recording"), mem_fun (*this, &Editor::toggle_waveforms_while_recording));
764         ActionManager::register_toggle_action (editor_actions, X_("ToggleMeasureVisibility"), _("Show Measures"), mem_fun (*this, &Editor::toggle_measure_visibility));
765         
766
767         RadioAction::Group waveform_scale_group;
768         act = ActionManager::register_radio_action (editor_actions, waveform_scale_group, X_("linear-waveforms"), _("Linear"), bind (mem_fun (*this, &Editor::waveform_scale_chosen), Editing::LinearWaveform));
769         ActionManager::track_selection_sensitive_actions.push_back (act);
770         act = ActionManager::register_radio_action (editor_actions, waveform_scale_group, X_("logarithmic-waveforms"), _("Logarithmic"), bind (mem_fun (*this, &Editor::waveform_scale_chosen), Editing::LogWaveform));
771         ActionManager::track_selection_sensitive_actions.push_back (act);
772
773         /* if there is a logo in the editor canvas, its always visible at startup */
774
775         act = ActionManager::register_toggle_action (editor_actions, X_("ToggleLogoVisibility"), _("Show Logo"), mem_fun (*this, &Editor::toggle_logo_visibility));
776         Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic(act);
777         tact->set_active (true);
778
779         RadioAction::Group layer_model_group;
780
781         ActionManager::register_radio_action (editor_actions, layer_model_group,  X_("LayerLaterHigher"), _("Later is Higher"), bind (mem_fun (*this, &Editor::set_layer_model), LaterHigher));
782         ActionManager::register_radio_action (editor_actions, layer_model_group,  X_("LayerMoveAddHigher"), _("Most Recently Moved/Added is Higher"), bind (mem_fun (*this, &Editor::set_layer_model), MoveAddHigher));
783         ActionManager::register_radio_action (editor_actions, layer_model_group,  X_("LayerAddHigher"), _("Most Recently Added is Higher"), bind (mem_fun (*this, &Editor::set_layer_model), AddHigher));
784
785         RadioAction::Group smpte_group;
786
787         ActionManager::register_radio_action (editor_actions, smpte_group,  X_("Smpte23976"), _("23.976"), bind (mem_fun (*this, &Editor::smpte_fps_chosen), smpte_23976));
788         ActionManager::register_radio_action (editor_actions, smpte_group,  X_("Smpte24"), _("24"), bind (mem_fun (*this, &Editor::smpte_fps_chosen), smpte_24));
789         ActionManager::register_radio_action (editor_actions, smpte_group,  X_("Smpte24976"), _("24.976"), bind (mem_fun (*this, &Editor::smpte_fps_chosen), smpte_24976));
790         ActionManager::register_radio_action (editor_actions, smpte_group,  X_("Smpte25"), _("25"), bind (mem_fun (*this, &Editor::smpte_fps_chosen), smpte_25));
791         ActionManager::register_radio_action (editor_actions, smpte_group,  X_("Smpte2997"), _("29.97"), bind (mem_fun (*this, &Editor::smpte_fps_chosen), smpte_2997));
792         ActionManager::register_radio_action (editor_actions, smpte_group,  X_("Smpte2997drop"), _("29.97 drop"), bind (mem_fun (*this, &Editor::smpte_fps_chosen), smpte_2997drop));
793         ActionManager::register_radio_action (editor_actions, smpte_group,  X_("Smpte30"), _("30"), bind (mem_fun (*this, &Editor::smpte_fps_chosen), smpte_30));
794         ActionManager::register_radio_action (editor_actions, smpte_group,  X_("Smpte30drop"), _("30 drop"), bind (mem_fun (*this, &Editor::smpte_fps_chosen), smpte_30drop));
795         ActionManager::register_radio_action (editor_actions, smpte_group,  X_("Smpte5994"), _("59.94"), bind (mem_fun (*this, &Editor::smpte_fps_chosen), smpte_5994));
796         ActionManager::register_radio_action (editor_actions, smpte_group,  X_("Smpte60"), _("60"), bind (mem_fun (*this, &Editor::smpte_fps_chosen), smpte_60));
797
798         RadioAction::Group pullup_group;
799
800         ActionManager::register_radio_action (editor_actions, pullup_group,  X_("PullupPlus4Plus1"), _("+4.1667% + 0.1%"), bind (mem_fun (*this, &Editor::video_pullup_chosen), Session::pullup_Plus4Plus1));
801         ActionManager::register_radio_action (editor_actions, pullup_group,  X_("PullupPlus4"), _("+4.1667%"), bind (mem_fun (*this, &Editor::video_pullup_chosen), Session::pullup_Plus4));
802         ActionManager::register_radio_action (editor_actions, pullup_group,  X_("PullupPlus4Minus1"), _("+4.1667% - 0.1%"), bind (mem_fun (*this, &Editor::video_pullup_chosen), Session::pullup_Plus4Minus1));
803         ActionManager::register_radio_action (editor_actions, pullup_group,  X_("PullupPlus1"), _("+ 0.1%"), bind (mem_fun (*this, &Editor::video_pullup_chosen), Session::pullup_Plus1));
804         ActionManager::register_radio_action (editor_actions, pullup_group,  X_("PullupNone"), _("None"), bind (mem_fun (*this, &Editor::video_pullup_chosen), Session::pullup_None));
805         ActionManager::register_radio_action (editor_actions, pullup_group,  X_("PullupMinus1"), _("- 0.1%"), bind (mem_fun (*this, &Editor::video_pullup_chosen), Session::pullup_Minus1));
806         ActionManager::register_radio_action (editor_actions, pullup_group,  X_("PullupMinus4Plus1"), _("-4.1667% + 0.1%"), bind (mem_fun (*this, &Editor::video_pullup_chosen), Session::pullup_Minus4Plus1));
807         ActionManager::register_radio_action (editor_actions, pullup_group,  X_("PullupMinus4"), _("-4.1667%"), bind (mem_fun (*this, &Editor::video_pullup_chosen), Session::pullup_Minus4));
808         ActionManager::register_radio_action (editor_actions, pullup_group,  X_("PullupMinus4Minus1"), _("-4.1667% - 0.1%"), bind (mem_fun (*this, &Editor::video_pullup_chosen), Session::pullup_Minus4Minus1));
809
810         RadioAction::Group subframe_group;
811
812         ActionManager::register_radio_action (editor_actions, subframe_group,  X_("Subframes80"), _("80 per frame"), bind (mem_fun (*this, 
813 &Editor::subframes_per_frame_chosen), 80));
814         ActionManager::register_radio_action (editor_actions, subframe_group,  X_("Subframes100"), _("100 per frame"), bind (mem_fun (*this, 
815 &Editor::subframes_per_frame_chosen), 100));
816
817         ActionManager::add_action_group (rl_actions);
818         ActionManager::add_action_group (ruler_actions);
819         ActionManager::add_action_group (zoom_actions);
820         ActionManager::add_action_group (mouse_mode_actions);
821         ActionManager::add_action_group (snap_actions);
822         ActionManager::add_action_group (editor_actions);
823 }
824
825 void
826 Editor::toggle_ruler_visibility (RulerType rt)
827 {
828         const char* action = 0;
829
830         if (no_ruler_shown_update) {
831                 return;
832         }
833
834         switch (rt) {
835         case ruler_metric_smpte:
836                 action = "toggle-timecode-ruler";
837                 break;
838         case ruler_metric_bbt:
839                 action = "toggle-bbt-ruler";
840                 break;
841         case ruler_metric_frames:
842                 action = "toggle-samples-ruler";
843                 break;
844         case ruler_metric_minsec:
845                 action = "toggle-minsec-ruler";
846                 break;
847         case ruler_time_tempo:
848                 action = "toggle-tempo-ruler";
849                 break;
850         case ruler_time_meter:
851                 action = "toggle-meter-ruler";
852                 break;
853         case ruler_time_marker:
854                 action = "toggle-marker-ruler";
855                 break;
856         case ruler_time_range_marker:
857                 action = "toggle-range-ruler";
858                 break;
859         case ruler_time_transport_marker:
860                 action = "toggle-loop-punch-ruler";
861                 break;
862         case ruler_time_cd_marker:
863                 action = "toggle-cd-marker-ruler";
864                 break;
865         }
866
867         Glib::RefPtr<Action> act = ActionManager::get_action (X_("Rulers"), action);
868         if (act) {
869                 Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic(act);
870                 update_ruler_visibility ();
871                 store_ruler_visibility ();
872         }
873 }
874
875 void
876 Editor::toggle_waveform_visibility ()
877 {
878         Glib::RefPtr<Action> act = ActionManager::get_action (X_("Editor"), X_("toggle-waveform-visible"));
879         if (act) {
880                 Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic(act);
881                 set_show_waveforms (tact->get_active());
882         }
883 }
884
885 void
886 Editor::toggle_waveforms_while_recording ()
887 {
888         Glib::RefPtr<Action> act = ActionManager::get_action (X_("Editor"), X_("ToggleWaveformsWhileRecording"));
889         if (act) {
890                 Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic(act);
891                 set_show_waveforms_recording (tact->get_active());
892         }
893 }
894
895 void
896 Editor::toggle_measure_visibility ()
897 {
898         Glib::RefPtr<Action> act = ActionManager::get_action (X_("Editor"), X_("ToggleMeasureVisibility"));
899         if (act) {
900                 Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic(act);
901                 set_show_measures (tact->get_active());
902         }
903 }
904
905 void
906 Editor::toggle_logo_visibility ()
907 {
908         Glib::RefPtr<Action> act = ActionManager::get_action (X_("Editor"), X_("ToggleLogoVisibility"));
909
910         if (act) {
911                 Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic(act);
912                 if (logo_item) {
913                         if (tact->get_active()) {
914                                 logo_item->show ();
915                         } else {
916                                 logo_item->hide ();
917                         }
918                 }
919         }
920 }
921
922 void
923 Editor::waveform_scale_chosen (Editing::WaveformScale ws)
924 {
925         RefPtr<Action> act;
926
927         /* this is driven by a toggle on a radio group, and so is invoked twice,
928            once for the item that became inactive and once for the one that became
929            active.
930         */
931
932         switch (ws) {
933         case LinearWaveform:
934                 act = ActionManager::get_action (X_("Editor"), X_("linear-waveforms"));
935                 break;
936         case LogWaveform:
937                 act = ActionManager::get_action (X_("Editor"), X_("logarithmic-waveforms"));
938                 break;
939         }
940         
941         if (act) {
942                 RefPtr<RadioAction> ract = RefPtr<RadioAction>::cast_dynamic(act);
943                 if (ract && ract->get_active()) {
944                         set_waveform_scale (ws);
945                 }
946         }
947 }
948
949 void
950 Editor::set_crossfade_model (CrossfadeModel model)
951 {
952         RefPtr<Action> act;
953
954         /* this is driven by a toggle on a radio group, and so is invoked twice,
955            once for the item that became inactive and once for the one that became
956            active.
957         */
958
959         switch (model) {
960         case FullCrossfade:
961                 act = ActionManager::get_action (X_("Editor"), X_("CrossfadesFull"));
962                 break;
963         case ShortCrossfade:
964                 act = ActionManager::get_action (X_("Editor"), X_("CrossfadesShort"));
965                 break;
966         }
967         
968         if (act) {
969                 RefPtr<RadioAction> ract = RefPtr<RadioAction>::cast_dynamic(act);
970                 if (ract && ract->get_active()) {
971                         Config->set_xfade_model (model);
972                 }
973         }
974 }
975
976 void
977 Editor::update_crossfade_model ()
978 {
979         RefPtr<Action> act;
980
981         switch (Config->get_xfade_model()) {
982         case FullCrossfade:
983                 act = ActionManager::get_action (X_("Editor"), X_("CrossfadesFull"));
984                 break;
985         case ShortCrossfade:
986                 act = ActionManager::get_action (X_("Editor"), X_("CrossfadesShort"));
987                 break;
988         }
989
990         if (act) {
991                 RefPtr<RadioAction> ract = RefPtr<RadioAction>::cast_dynamic(act);
992                 if (ract && !ract->get_active()) {
993                         ract->set_active (true);
994                 }
995         }
996 }
997
998
999 void
1000 Editor::update_smpte_mode ()
1001 {
1002         ENSURE_GUI_THREAD(mem_fun(*this, &Editor::update_smpte_mode));
1003
1004         RefPtr<Action> act;
1005         const char* action = 0;
1006
1007         switch (Config->get_smpte_format()) {
1008         case smpte_23976:
1009                 action = X_("Smpte23976");
1010                 break;
1011         case smpte_24:
1012                 action = X_("Smpte24");
1013                 break;
1014         case smpte_24976:
1015                 action = X_("Smpte24976");
1016                 break;
1017         case smpte_25:
1018                 action = X_("Smpte25");
1019                 break;
1020         case smpte_2997:
1021                 action = X_("Smpte2997");
1022                 break;
1023         case smpte_2997drop:
1024                 action = X_("Smpte2997drop");
1025                 break;
1026         case smpte_30:
1027                 action = X_("Smpte30");
1028                 break;
1029         case smpte_30drop:
1030                 action = X_("Smpte30drop");
1031                 break;
1032         case smpte_5994:
1033                 action = X_("Smpte5994");
1034                 break;
1035         case smpte_60:
1036                 action = X_("Smpte60");
1037                 break;
1038         }
1039
1040         act = ActionManager::get_action (X_("Editor"), action);
1041
1042         if (act) {
1043                 RefPtr<RadioAction> ract = RefPtr<RadioAction>::cast_dynamic(act);
1044                 if (ract && !ract->get_active()) {
1045                         ract->set_active (true);
1046                 }
1047         }
1048 }
1049
1050 void
1051 Editor::update_video_pullup ()
1052 {
1053         ENSURE_GUI_THREAD (mem_fun(*this, &Editor::update_video_pullup));
1054
1055         RefPtr<Action> act;
1056         const char* action = 0;
1057
1058         float pullup = Config->get_video_pullup();
1059
1060         if ( pullup < (-4.1667 - 0.1) * 0.99) {
1061                 action = X_("PullupMinus4Minus1");
1062         } else if ( pullup < (-4.1667) * 0.99 ) {
1063                 action = X_("PullupMinus4");
1064         } else if ( pullup < (-4.1667 + 0.1) * 0.99 ) {
1065                 action = X_("PullupMinus4Plus1");
1066         } else if ( pullup < (-0.1) * 0.99 ) {
1067                 action = X_("PullupMinus1");
1068         } else if (pullup > (4.1667 + 0.1) * 0.99 ) {
1069                 action = X_("PullupPlus4Plus1");
1070         } else if ( pullup > (4.1667) * 0.99 ) {
1071                 action = X_("PullupPlus4");
1072         } else if ( pullup > (4.1667 - 0.1) * 0.99) {
1073                 action = X_("PullupPlus4Minus1");
1074         } else if ( pullup > (0.1) * 0.99 ) {
1075                 action = X_("PullupPlus1");
1076         } else {
1077                 action = X_("PullupNone");
1078         }
1079
1080         act = ActionManager::get_action (X_("Editor"), action);
1081
1082         if (act) {
1083                 RefPtr<RadioAction> ract = RefPtr<RadioAction>::cast_dynamic(act);
1084                 if (ract && !ract->get_active()) {
1085                         ract->set_active (true);
1086                 }
1087         }
1088 }
1089
1090 void
1091 Editor::update_layering_model ()
1092 {
1093         RefPtr<Action> act;
1094
1095         switch (Config->get_layer_model()) {
1096         case LaterHigher:
1097                 act = ActionManager::get_action (X_("Editor"), X_("LayerLaterHigher"));
1098                 break;
1099         case MoveAddHigher:
1100                 act = ActionManager::get_action (X_("Editor"), X_("LayerMoveAddHigher"));
1101                 break;
1102         case AddHigher:
1103                 act = ActionManager::get_action (X_("Editor"), X_("LayerAddHigher"));
1104                 break;
1105         }
1106
1107         if (act) {
1108                 RefPtr<RadioAction> ract = RefPtr<RadioAction>::cast_dynamic(act);
1109                 if (ract && !ract->get_active()) {
1110                         ract->set_active (true);
1111                 }
1112         }
1113 }
1114
1115 void
1116 Editor::set_layer_model (LayerModel model)
1117 {
1118         /* this is driven by a toggle on a radio group, and so is invoked twice,
1119            once for the item that became inactive and once for the one that became
1120            active.
1121         */
1122
1123         RefPtr<Action> act;
1124
1125         switch (model) {
1126         case LaterHigher:
1127                 act = ActionManager::get_action (X_("Editor"), X_("LayerLaterHigher"));
1128                 break;
1129         case MoveAddHigher:
1130                 act = ActionManager::get_action (X_("Editor"), X_("LayerMoveAddHigher"));
1131                 break;
1132         case AddHigher:
1133                 act = ActionManager::get_action (X_("Editor"), X_("LayerAddHigher"));
1134                 break;
1135         }
1136         
1137         if (act) {
1138                 RefPtr<RadioAction> ract = RefPtr<RadioAction>::cast_dynamic(act);
1139                 if (ract && ract->get_active() && Config->get_layer_model() != model) {
1140                         Config->set_layer_model (model);
1141                 }
1142         }
1143 }
1144
1145 RefPtr<RadioAction>
1146 Editor::snap_type_action (SnapType type)
1147 {
1148
1149         const char* action = 0;
1150         RefPtr<Action> act;
1151         
1152         switch (type) {
1153         case Editing::SnapToCDFrame:
1154                 action = "snap-to-cd-frame";
1155                 break;
1156         case Editing::SnapToSMPTEFrame:
1157                 action = "snap-to-smpte-frame";
1158                 break;
1159         case Editing::SnapToSMPTESeconds:
1160                 action = "snap-to-smpte-seconds";
1161                 break;
1162         case Editing::SnapToSMPTEMinutes:
1163                 action = "snap-to-smpte-minutes";
1164                 break;
1165         case Editing::SnapToSeconds:
1166                 action = "snap-to-seconds";
1167                 break;
1168         case Editing::SnapToMinutes:
1169                 action = "snap-to-minutes";
1170                 break;
1171         case Editing::SnapToAThirtysecondBeat:
1172                 action = "snap-to-thirtyseconds";
1173                 break;
1174         case Editing::SnapToASixteenthBeat:
1175                 action = "snap-to-asixteenthbeat";
1176                 break;
1177         case Editing::SnapToAEighthBeat:
1178                 action = "snap-to-eighths";
1179                 break;
1180         case Editing::SnapToAQuarterBeat:
1181                 action = "snap-to-quarters";
1182                 break;
1183         case Editing::SnapToAThirdBeat:
1184                 action = "snap-to-thirds";
1185                 break;
1186         case Editing::SnapToBeat:
1187                 action = "snap-to-beat";
1188                 break;
1189         case Editing::SnapToBar:
1190                 action = "snap-to-bar";
1191                 break;
1192         case Editing::SnapToMark:
1193                 action = "snap-to-mark";
1194                 break;
1195         case Editing::SnapToRegionStart:
1196                 action = "snap-to-region-start";
1197                 break;
1198         case Editing::SnapToRegionEnd:
1199                 action = "snap-to-region-end";
1200                 break;
1201         case Editing::SnapToRegionSync:
1202                 action = "snap-to-region-sync";
1203                 break;
1204         case Editing::SnapToRegionBoundary:
1205                 action = "snap-to-region-boundary";
1206                 break;
1207         default:
1208                 fatal << string_compose (_("programming error: %1: %2"), "Editor: impossible snap-to type", (int) type) << endmsg;
1209                 /*NOTREACHED*/
1210         }
1211
1212         act = ActionManager::get_action (X_("Snap"), action);
1213
1214         if (act) {
1215                 RefPtr<RadioAction> ract = RefPtr<RadioAction>::cast_dynamic(act);
1216                 return ract;
1217
1218         } else  {
1219                 error << string_compose (_("programming error: %1"), "Editor::snap_type_chosen could not find action to match type.") << endmsg;
1220                 return RefPtr<RadioAction>();
1221         }
1222 }
1223
1224 void
1225 Editor::cycle_snap_choice()
1226 {
1227         switch (snap_type) {
1228         case Editing::SnapToCDFrame:
1229                 set_snap_to (Editing::SnapToSMPTEFrame);
1230                 break;
1231         case Editing::SnapToSMPTEFrame:
1232                 set_snap_to (Editing::SnapToSMPTESeconds);
1233                 break;
1234         case Editing::SnapToSMPTESeconds:
1235                 set_snap_to (Editing::SnapToSMPTEMinutes);
1236                 break;
1237         case Editing::SnapToSMPTEMinutes:
1238                 set_snap_to (Editing::SnapToSeconds);
1239                 break;
1240         case Editing::SnapToSeconds:
1241                 set_snap_to (Editing::SnapToMinutes);
1242                 break;
1243         case Editing::SnapToMinutes:
1244                 set_snap_to (Editing::SnapToAThirtysecondBeat);
1245                 break;
1246         case Editing::SnapToAThirtysecondBeat:
1247                 set_snap_to (Editing::SnapToASixteenthBeat);
1248                 break;
1249         case Editing::SnapToASixteenthBeat:
1250                 set_snap_to (Editing::SnapToAEighthBeat);
1251                 break;
1252         case Editing::SnapToAEighthBeat:
1253                 set_snap_to (Editing::SnapToAQuarterBeat);
1254                 break;
1255         case Editing::SnapToAQuarterBeat:
1256                 set_snap_to (Editing::SnapToAThirdBeat);
1257                 break;
1258         case Editing::SnapToAThirdBeat:
1259                 set_snap_to (Editing::SnapToBeat);
1260                 break;
1261         case Editing::SnapToBeat:
1262                 set_snap_to (Editing::SnapToBar);
1263                 break;
1264         case Editing::SnapToBar:
1265                 set_snap_to (Editing::SnapToMark);
1266                 break;
1267         case Editing::SnapToMark:
1268                 set_snap_to (Editing::SnapToRegionStart);
1269                 break;
1270         case Editing::SnapToRegionStart:
1271                 set_snap_to (Editing::SnapToRegionEnd);
1272                 break;
1273         case Editing::SnapToRegionEnd:
1274                 set_snap_to (Editing::SnapToRegionSync);
1275                 break;
1276         case Editing::SnapToRegionSync:
1277                 set_snap_to (Editing::SnapToRegionBoundary);
1278                 break;
1279         case Editing::SnapToRegionBoundary:
1280                 set_snap_to (Editing::SnapToCDFrame);
1281                 break;
1282         }
1283 }
1284
1285 void
1286 Editor::snap_type_chosen (SnapType type)
1287 {
1288         /* this is driven by a toggle on a radio group, and so is invoked twice,
1289            once for the item that became inactive and once for the one that became
1290            active.
1291         */
1292
1293         RefPtr<RadioAction> ract = snap_type_action (type);
1294
1295         if (ract && ract->get_active()) {
1296                 set_snap_to (type);
1297         }
1298 }
1299
1300 RefPtr<RadioAction>
1301 Editor::snap_mode_action (SnapMode mode)
1302 {
1303         const char* action = 0;
1304         RefPtr<Action> act;
1305         
1306         switch (mode) {
1307         case Editing::SnapOff:
1308                 action = X_("snap-off");
1309                 break;
1310         case Editing::SnapNormal:
1311                 action = X_("snap-normal");
1312                 break;
1313         case Editing::SnapMagnetic:
1314                 action = X_("snap-magnetic");
1315                 break;
1316         default:
1317                 fatal << string_compose (_("programming error: %1: %2"), "Editor: impossible snap mode type", (int) mode) << endmsg;
1318                 /*NOTREACHED*/
1319         }
1320         
1321         act = ActionManager::get_action (X_("Editor"), action);
1322         
1323         if (act) {
1324                 RefPtr<RadioAction> ract = RefPtr<RadioAction>::cast_dynamic(act);
1325                 return ract;
1326                 
1327         } else  {
1328                 error << string_compose (_("programming error: %1: %2"), "Editor::snap_mode_chosen could not find action to match mode.", action) << endmsg;
1329                 return RefPtr<RadioAction> ();
1330         }
1331 }
1332
1333 void
1334 Editor::cycle_snap_mode ()
1335 {
1336         switch (snap_mode) {
1337         case SnapOff:
1338                 set_snap_mode (SnapNormal);
1339                 break;
1340         case SnapNormal:
1341                 set_snap_mode (SnapMagnetic);
1342                 break;
1343         case SnapMagnetic:
1344                 set_snap_mode (SnapOff);
1345                 break;
1346         }
1347 }
1348
1349 void
1350 Editor::snap_mode_chosen (SnapMode mode)
1351 {
1352         /* this is driven by a toggle on a radio group, and so is invoked twice,
1353            once for the item that became inactive and once for the one that became
1354            active.
1355         */
1356
1357         RefPtr<RadioAction> ract = snap_mode_action (mode);
1358
1359         if (ract && ract->get_active()) {
1360                 set_snap_mode (mode);
1361         }
1362 }
1363
1364 RefPtr<RadioAction>
1365 Editor::edit_point_action (EditPoint ep)
1366 {
1367         const char* action = 0;
1368         RefPtr<Action> act;
1369         
1370         switch (ep) {
1371         case Editing::EditAtPlayhead:
1372                 action = X_("edit-at-playhead");
1373                 break;
1374         case Editing::EditAtSelectedMarker:
1375                 action = X_("edit-at-selected-marker");
1376                 break;
1377         case Editing::EditAtMouse:
1378                 action = X_("edit-at-mouse");
1379                 break;
1380         default:
1381                 fatal << string_compose (_("programming error: %1: %2"), "Editor: impossible edit point type", (int) ep) << endmsg;
1382                 /*NOTREACHED*/
1383         }
1384         
1385         act = ActionManager::get_action (X_("Editor"), action);
1386         
1387         if (act) {
1388                 RefPtr<RadioAction> ract = RefPtr<RadioAction>::cast_dynamic(act);
1389                 return ract;
1390                 
1391         } else  {
1392                 error << string_compose (_("programming error: %1: %2"), "Editor::edit_point_action could not find action to match edit point.", action) << endmsg;
1393                 return RefPtr<RadioAction> ();
1394         }
1395 }
1396
1397 void
1398 Editor::edit_point_chosen (EditPoint ep)
1399 {
1400         /* this is driven by a toggle on a radio group, and so is invoked twice,
1401            once for the item that became inactive and once for the one that became
1402            active.
1403         */
1404
1405         RefPtr<RadioAction> ract = edit_point_action (ep);
1406
1407         if (ract && ract->get_active()) {
1408                 set_edit_point_preference (ep);
1409         }
1410 }
1411
1412
1413 RefPtr<RadioAction>
1414 Editor::zoom_focus_action (ZoomFocus focus)
1415 {
1416         const char* action = 0;
1417         RefPtr<Action> act;
1418         
1419         switch (focus) {
1420         case ZoomFocusLeft:
1421                 action = X_("zoom-focus-left");
1422                 break;
1423         case ZoomFocusRight:
1424                 action = X_("zoom-focus-right");
1425                 break;
1426         case ZoomFocusCenter:
1427                 action = X_("zoom-focus-center");
1428                 break;
1429         case ZoomFocusPlayhead:
1430                 action = X_("zoom-focus-playhead");
1431                 break;
1432         case ZoomFocusMouse:
1433                 action = X_("zoom-focus-mouse");
1434                 break;
1435         case ZoomFocusEdit:
1436                 action = X_("zoom-focus-edit");
1437                 break;
1438         default:
1439                 fatal << string_compose (_("programming error: %1: %2"), "Editor: impossible focus type", (int) focus) << endmsg;
1440                 /*NOTREACHED*/
1441         }
1442         
1443         act = ActionManager::get_action (X_("Zoom"), action);
1444         
1445         if (act) {
1446                 RefPtr<RadioAction> ract = RefPtr<RadioAction>::cast_dynamic(act);
1447                 return ract;
1448         } else {
1449                 error << string_compose (_("programming error: %1: %2"), "Editor::zoom_focus_action could not find action to match focus.", action) << endmsg;
1450         }
1451
1452         return RefPtr<RadioAction> ();
1453 }
1454
1455 void
1456 Editor::zoom_focus_chosen (ZoomFocus focus)
1457 {
1458         /* this is driven by a toggle on a radio group, and so is invoked twice,
1459            once for the item that became inactive and once for the one that became
1460            active.
1461         */
1462
1463         RefPtr<RadioAction> ract = zoom_focus_action (focus);
1464
1465         if (ract && ract->get_active()) {
1466                 set_zoom_focus (focus);
1467         }
1468 }
1469
1470 void
1471 Editor::smpte_fps_chosen (SmpteFormat format)
1472 {
1473         /* this is driven by a toggle on a radio group, and so is invoked twice,
1474            once for the item that became inactive and once for the one that became
1475            active.
1476         */
1477
1478         if (session) {
1479
1480                 RefPtr<Action> act;
1481
1482                 switch (format) {
1483                         case smpte_23976: 
1484                                 act = ActionManager::get_action (X_("Editor"), X_("Smpte23976"));
1485                          break;
1486                         case smpte_24: 
1487                                 act = ActionManager::get_action (X_("Editor"), X_("Smpte24"));
1488                          break;
1489                         case smpte_24976: 
1490                                 act = ActionManager::get_action (X_("Editor"), X_("Smpte24976"));
1491                          break;
1492                         case smpte_25: 
1493                                 act = ActionManager::get_action (X_("Editor"), X_("Smpte25"));
1494                          break;
1495                         case smpte_2997: 
1496                                 act = ActionManager::get_action (X_("Editor"), X_("Smpte2997"));
1497                          break;
1498                         case smpte_2997drop: 
1499                                 act = ActionManager::get_action (X_("Editor"), X_("Smpte2997drop"));
1500                          break;
1501                         case smpte_30: 
1502                                 act = ActionManager::get_action (X_("Editor"), X_("Smpte30"));
1503                          break;
1504                         case smpte_30drop: 
1505                                 act = ActionManager::get_action (X_("Editor"), X_("Smpte30drop"));
1506                          break;
1507                         case smpte_5994: 
1508                                 act = ActionManager::get_action (X_("Editor"), X_("Smpte5994"));
1509                          break;
1510                         case smpte_60: 
1511                                 act = ActionManager::get_action (X_("Editor"), X_("Smpte60"));
1512                          break;
1513                         default:
1514                                 cerr << "Editor received unexpected smpte type" << endl;
1515                 }
1516
1517                 if (act) {
1518                         RefPtr<RadioAction> ract = RefPtr<RadioAction>::cast_dynamic(act);
1519                         if (ract && ract->get_active()) {
1520                                 session->set_smpte_format (format);
1521                         }
1522                 }
1523         }
1524 }
1525
1526 void
1527 Editor::video_pullup_chosen (Session::PullupFormat pullup)
1528 {
1529         /* this is driven by a toggle on a radio group, and so is invoked twice,
1530            once for the item that became inactive and once for the one that became
1531            active.
1532         */
1533
1534         const char* action = 0;
1535
1536         RefPtr<Action> act;
1537         
1538         float pull = 0.0;
1539         
1540         switch (pullup) {
1541         case Session::pullup_Plus4Plus1:
1542                 pull = 4.1667 + 0.1;
1543                 action = X_("PullupPlus4Plus1");
1544                 break;
1545         case Session::pullup_Plus4:
1546                 pull = 4.1667;
1547                 action = X_("PullupPlus4");
1548                 break;
1549         case Session::pullup_Plus4Minus1:
1550                 pull = 4.1667 - 0.1;
1551                 action = X_("PullupPlus4Minus1");
1552                 break;
1553         case Session::pullup_Plus1:
1554                 pull = 0.1;
1555                 action = X_("PullupPlus1");
1556                 break;
1557         case Session::pullup_None:
1558                 pull = 0.0;
1559                 action = X_("PullupNone");
1560                 break;
1561         case Session::pullup_Minus1:
1562                 pull = -0.1;
1563                 action = X_("PullupMinus1");
1564                 break;
1565         case Session::pullup_Minus4Plus1:
1566                 pull = -4.1667 + 0.1;
1567                 action = X_("PullupMinus4Plus1");
1568                 break;
1569         case Session::pullup_Minus4:
1570                 pull = -4.1667;
1571                 action = X_("PullupMinus4");
1572                 break;
1573         case Session::pullup_Minus4Minus1:
1574                 pull = -4.1667 - 0.1;
1575                 action = X_("PullupMinus4Minus1");
1576                 break;
1577         default:
1578                 fatal << string_compose (_("programming error: %1"), "Session received unexpected pullup type") << endmsg;
1579                 /*NOTREACHED*/
1580         }
1581         
1582         act = ActionManager::get_action (X_("Editor"), action);
1583         
1584         if (act) {
1585                 RefPtr<RadioAction> ract = RefPtr<RadioAction>::cast_dynamic(act);
1586                 if (ract && ract->get_active()) {
1587                         Config->set_video_pullup ( pull );
1588                 }
1589                 
1590         } else  {
1591                 error << string_compose (_("programming error: %1"), "Editor::video_pullup_chosen could not find action to match pullup.") << endmsg;
1592         }
1593 }
1594
1595 void
1596 Editor::update_subframes_per_frame ()
1597 {
1598         ENSURE_GUI_THREAD (mem_fun(*this, &Editor::update_subframes_per_frame));
1599
1600         RefPtr<Action> act;
1601         const char* action = 0;
1602
1603         uint32_t sfpf = Config->get_subframes_per_frame();
1604
1605         if (sfpf == 80) {
1606                 action = X_("Subframes80");
1607         } else if (sfpf == 100) {
1608                 action = X_("Subframes100");
1609         } else {
1610                 warning << string_compose (_("Configuraton is using unhandled subframes per frame value: %1"), sfpf) << endmsg;
1611                 /*NOTREACHED*/
1612                 return;
1613         }
1614
1615         act = ActionManager::get_action (X_("Editor"), action);
1616
1617         if (act) {
1618                 RefPtr<RadioAction> ract = RefPtr<RadioAction>::cast_dynamic(act);
1619                 if (ract && !ract->get_active()) {
1620                         ract->set_active (true);
1621                 }
1622         }
1623 }
1624
1625 void
1626 Editor::subframes_per_frame_chosen (uint32_t sfpf)
1627 {
1628         /* this is driven by a toggle on a radio group, and so is invoked twice,
1629            once for the item that became inactive and once for the one that became
1630            active.
1631         */
1632
1633         const char* action = 0;
1634
1635         RefPtr<Action> act;
1636         
1637         if (sfpf == 80) {
1638                 action = X_("Subframes80");
1639         } else if (sfpf == 100) {       
1640                 action = X_("Subframes100");
1641         } else {
1642                 fatal << string_compose (_("programming error: %1 %2"), "Session received unexpected subframes per frame value: ", sfpf) << endmsg;
1643                 /*NOTREACHED*/
1644         }
1645         
1646         act = ActionManager::get_action (X_("Editor"), action);
1647         
1648         if (act) {
1649                 RefPtr<RadioAction> ract = RefPtr<RadioAction>::cast_dynamic(act);
1650                 if (ract && ract->get_active()) {
1651                         Config->set_subframes_per_frame ((uint32_t) rint (sfpf));
1652                 }
1653                 
1654         } else  {
1655                 error << string_compose (_("programming error: %1"), "Editor::subframes_per_frame_chosen could not find action to match value.") << endmsg;
1656         }
1657 }
1658
1659 void
1660 Editor::toggle_auto_xfade ()
1661 {
1662         ActionManager::toggle_config_state ("Editor", "toggle-auto-xfades", &Configuration::set_auto_xfade, &Configuration::get_auto_xfade);
1663 }
1664
1665 void
1666 Editor::toggle_xfades_active ()
1667 {
1668         ActionManager::toggle_config_state ("Editor", "toggle-xfades-active", &Configuration::set_xfades_active, &Configuration::get_xfades_active);
1669 }
1670
1671 void
1672 Editor::toggle_xfade_visibility ()
1673 {
1674         ActionManager::toggle_config_state ("Editor", "toggle-xfades-visible", &Configuration::set_xfades_visible, &Configuration::get_xfades_visible);
1675 }
1676
1677 void
1678 Editor::toggle_link_region_and_track_selection ()
1679 {
1680         ActionManager::toggle_config_state ("Editor", "link-region-and-track-selection", &Configuration::set_link_region_and_track_selection, &Configuration::get_link_region_and_track_selection);
1681 }
1682
1683 /** A Configuration parameter has changed.
1684  * @param parameter_name Name of the changed parameter.
1685  */
1686 void
1687 Editor::parameter_changed (const char* parameter_name)
1688 {
1689 #define PARAM_IS(x) (!strcmp (parameter_name, (x)))
1690         //cerr << "Editor::parameter_changed: " << parameter_name << endl;
1691         ENSURE_GUI_THREAD (bind (mem_fun (*this, &Editor::parameter_changed), parameter_name));
1692
1693         if (PARAM_IS ("auto-loop")) {
1694                 update_loop_range_view (true);
1695         } else if (PARAM_IS ("punch-in")) {
1696                 update_punch_range_view (true);
1697         } else if (PARAM_IS ("punch-out")) {
1698                 update_punch_range_view (true);
1699         } else if (PARAM_IS ("layer-model")) {
1700                 update_layering_model ();
1701         } else if (PARAM_IS ("smpte-format")) {
1702                 update_smpte_mode ();
1703                 update_just_smpte ();
1704         } else if (PARAM_IS ("video-pullup")) {
1705                 update_video_pullup ();
1706         } else if (PARAM_IS ("xfades-active")) {
1707                 ActionManager::map_some_state ("Editor", "toggle-xfades-active", &Configuration::get_xfades_active);
1708         } else if (PARAM_IS ("xfades-visible")) {
1709                 ActionManager::map_some_state ("Editor", "toggle-xfades-visible", &Configuration::get_xfades_visible);
1710                 update_xfade_visibility ();
1711         } else if (PARAM_IS ("auto-xfade")) {
1712                 ActionManager::map_some_state ("Editor", "toggle-auto-xfades", &Configuration::get_auto_xfade);
1713         } else if (PARAM_IS ("xfade-model")) {
1714                 update_crossfade_model ();
1715         } else if (PARAM_IS ("edit-mode")) {
1716                 edit_mode_selector.set_active_text (edit_mode_to_string (Config->get_edit_mode()));
1717         } else if (PARAM_IS ("subframes-per-frame")) {
1718                 update_subframes_per_frame ();
1719                 update_just_smpte ();
1720         } else if (PARAM_IS ("show-track-meters")) {
1721                 toggle_meter_updating();
1722         } else if (PARAM_IS ("link-region-and-track-selection")) {
1723                 ActionManager::map_some_state ("Editor", "link-region-and-track-selection", &Configuration::get_link_region_and_track_selection);
1724         }
1725
1726 #undef PARAM_IS
1727 }
1728
1729 void
1730 Editor::reset_focus ()
1731 {
1732         track_canvas->grab_focus();
1733 }
1734
1735 void
1736 Editor::reset_canvas_action_sensitivity (bool onoff)
1737 {
1738         if (_edit_point != EditAtMouse) {
1739                 onoff = true;
1740         }
1741
1742         for (vector<Glib::RefPtr<Action> >::iterator x = ActionManager::mouse_edit_point_requires_canvas_actions.begin();  
1743              x != ActionManager::mouse_edit_point_requires_canvas_actions.end(); ++x) {
1744                 (*x)->set_sensitive (onoff);
1745         }
1746 }