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