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