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