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