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