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