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