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