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