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