Committed filthy mess of a working copy solely for moving between machines.
[ardour.git] / gtk2_ardour / editor_actions.cc
1 #include <ardour/ardour.h>
2
3 #include "utils.h"
4 #include "editor.h"
5 #include "editing.h"
6 #include "actions.h"
7 #include "ardour_ui.h"
8 #include "i18n.h"
9
10 using namespace Gtk;
11 using namespace Glib;
12 using namespace std;
13 using namespace sigc;
14 using namespace ARDOUR;
15 using namespace Editing;
16
17 void
18 Editor::register_actions ()
19 {
20         RefPtr<Action> act;
21
22         editor_actions = ActionGroup::create (X_("Editor"));
23         
24         /* non-operative menu items for menu bar */
25
26         ActionManager::register_action (editor_actions, X_("Edit"), _("Edit"));
27         ActionManager::register_action (editor_actions, X_("EditSelectRegionOptions"), _("Select regions"));
28         ActionManager::register_action (editor_actions, X_("EditSelectRangeOptions"), _("Select range operations"));
29         ActionManager::register_action (editor_actions, X_("EditCursorMovementOptions"), _("Move edit cursor"));
30         ActionManager::register_action (editor_actions, X_("RegionEditOps"), _("Region operations"));
31         ActionManager::register_action (editor_actions, X_("Tools"), _("Tools"));
32         ActionManager::register_action (editor_actions, X_("View"), _("View"));
33         ActionManager::register_action (editor_actions, X_("ZoomFocus"), _("ZoomFocus"));
34         ActionManager::register_action (editor_actions, X_("MeterHold"), _("Meter hold"));
35         ActionManager::register_action (editor_actions, X_("MeterFalloff"), _("Meter falloff"));
36         ActionManager::register_action (editor_actions, X_("Solo"), _("Solo"));
37         ActionManager::register_action (editor_actions, X_("Crossfades"), _("Crossfades"));
38         ActionManager::register_action (editor_actions, X_("Monitoring"), _("Monitoring"));
39         ActionManager::register_action (editor_actions, X_("Autoconnect"), _("Autoconnect"));
40         ActionManager::register_action (editor_actions, X_("Layering"), _("Layering"));
41         ActionManager::register_action (editor_actions, X_("Metering"), _("Metering"));
42         ActionManager::register_action (editor_actions, X_("MeteringFallOffRate"), _("Fall off rate"));
43         ActionManager::register_action (editor_actions, X_("MeteringHoldTime"), _("Hold Time"));
44         ActionManager::register_action (editor_actions, X_("addExistingAudioFiles"), _("Add Existing Audio"));
45
46         /* add named actions for the editor */
47
48
49         act = ActionManager::register_toggle_action (editor_actions, "show-editor-mixer", _("Show Editor Mixer"), mem_fun (*this, &Editor::editor_mixer_button_toggled));
50         ActionManager::session_sensitive_actions.push_back (act);
51
52         RadioAction::Group crossfade_model_group;
53
54         act = ActionManager::register_radio_action (editor_actions, crossfade_model_group, "CrossfadesFull", _("Span Entire Overlap"), bind (mem_fun(*this, &Editor::set_crossfade_model), FullCrossfade));
55         ActionManager::session_sensitive_actions.push_back (act);
56         act = ActionManager::register_radio_action (editor_actions, crossfade_model_group, "CrossfadesShort", _("Short"), bind (mem_fun(*this, &Editor::set_crossfade_model), ShortCrossfade));
57         ActionManager::session_sensitive_actions.push_back (act);
58
59         act = ActionManager::register_toggle_action (editor_actions, "toggle-xfades-active", _("Active"), mem_fun(*this, &Editor::toggle_xfades_active));
60         ActionManager::session_sensitive_actions.push_back (act);
61         act = ActionManager::register_toggle_action (editor_actions, "toggle-xfades-visible", _("Visible"), mem_fun(*this, &Editor::toggle_xfade_visibility));
62         ActionManager::session_sensitive_actions.push_back (act);
63         act = ActionManager::register_toggle_action (editor_actions, "toggle-auto-xfades", _("Created Automatically"), mem_fun(*this, &Editor::toggle_auto_xfade));
64         ActionManager::session_sensitive_actions.push_back (act);
65
66         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)));
67         ActionManager::session_sensitive_actions.push_back (act);
68         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)));
69         ActionManager::session_sensitive_actions.push_back (act);
70         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)));
71         ActionManager::session_sensitive_actions.push_back (act);
72
73         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)));
74         ActionManager::session_sensitive_actions.push_back (act);
75         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)));
76         ActionManager::session_sensitive_actions.push_back (act);
77         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)));
78         ActionManager::session_sensitive_actions.push_back (act);
79
80         act = ActionManager::register_action (editor_actions, "edit-cursor-to-next-region-start", _("Edit Cursor to Next Region Start"), bind (mem_fun(*this, &Editor::cursor_to_next_region_point), edit_cursor, RegionPoint (Start)));
81         ActionManager::session_sensitive_actions.push_back (act);
82         act = ActionManager::register_action (editor_actions, "edit-cursor-to-next-region-end", _("Edit Cursor to Next Region End"), bind (mem_fun(*this, &Editor::cursor_to_next_region_point), edit_cursor, RegionPoint (End)));
83         ActionManager::session_sensitive_actions.push_back (act);
84         act = ActionManager::register_action (editor_actions, "edit-cursor-to-next-region-sync", _("Edit Cursor to Next Region Sync"), bind (mem_fun(*this, &Editor::cursor_to_next_region_point), edit_cursor, RegionPoint (SyncPoint)));
85         ActionManager::session_sensitive_actions.push_back (act);
86
87         act = ActionManager::register_action (editor_actions, "edit-cursor-to-previous-region-start", _("Edit Cursor to Previous Region Start"), bind (mem_fun(*this, &Editor::cursor_to_previous_region_point), edit_cursor, RegionPoint (Start)));
88         ActionManager::session_sensitive_actions.push_back (act);
89         act = ActionManager::register_action (editor_actions, "edit-cursor-to-previous-region-end", _("Edit Cursor to Previous Region End"), bind (mem_fun(*this, &Editor::cursor_to_previous_region_point), edit_cursor, RegionPoint (End)));
90         ActionManager::session_sensitive_actions.push_back (act);
91         act = ActionManager::register_action (editor_actions, "edit-cursor-to-previous-region-sync", _("Edit Cursor to Previous Region Sync"), bind (mem_fun(*this, &Editor::cursor_to_previous_region_point), edit_cursor, RegionPoint (SyncPoint)));
92         ActionManager::session_sensitive_actions.push_back (act);
93
94         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));
95         ActionManager::session_sensitive_actions.push_back (act);
96         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));
97         ActionManager::session_sensitive_actions.push_back (act);
98
99         act = ActionManager::register_action (editor_actions, "edit-cursor-to-range-start", _("Edit Cursor to Range Start"), bind (mem_fun(*this, &Editor::cursor_to_selection_start), edit_cursor));
100         ActionManager::session_sensitive_actions.push_back (act);
101         act = ActionManager::register_action (editor_actions, "edit-cursor-to-range-end", _("Edit Cursor to Range End"), bind (mem_fun(*this, &Editor::cursor_to_selection_end), edit_cursor));
102         ActionManager::session_sensitive_actions.push_back (act);
103
104         act = ActionManager::register_action (editor_actions, "select-all", _("select all"), bind (mem_fun(*this, &Editor::select_all), Selection::Set));
105         ActionManager::session_sensitive_actions.push_back (act);
106         act = ActionManager::register_action (editor_actions, "select-all-after-edit-cursor", _("Select All After Edit Cursor"), bind (mem_fun(*this, &Editor::select_all_selectables_using_cursor), edit_cursor, true));
107         ActionManager::session_sensitive_actions.push_back (act);
108         act = ActionManager::register_action (editor_actions, "select-all-before-edit-cursor", _("Select All Before Edit Cursor"), bind (mem_fun(*this, &Editor::select_all_selectables_using_cursor), edit_cursor, false));
109         ActionManager::session_sensitive_actions.push_back (act);
110
111         act = ActionManager::register_action (editor_actions, "select-all-after-playhead", _("Select All After Playhead"), bind (mem_fun(*this, &Editor::select_all_selectables_using_cursor), playhead_cursor, true));
112         ActionManager::session_sensitive_actions.push_back (act);
113         act = ActionManager::register_action (editor_actions, "select-all-before-playhead", _("Select All Before Playhead"), bind (mem_fun(*this, &Editor::select_all_selectables_using_cursor), playhead_cursor, false));
114         ActionManager::session_sensitive_actions.push_back (act);
115         act = ActionManager::register_action (editor_actions, "select-all-between-cursors", _("Select All Between Cursors"), bind (mem_fun(*this, &Editor::select_all_selectables_between_cursors), playhead_cursor, edit_cursor));
116         ActionManager::session_sensitive_actions.push_back (act);
117
118         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));
119         ActionManager::session_sensitive_actions.push_back (act);
120         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));
121         ActionManager::session_sensitive_actions.push_back (act);
122
123         act = ActionManager::register_action (editor_actions, "jump-forward-to-mark", _("Jump Forward to Mark"), mem_fun(*this, &Editor::jump_forward_to_mark));
124         ActionManager::session_sensitive_actions.push_back (act);
125         act = ActionManager::register_action (editor_actions, "jump-backward-to-mark", _("Jump Backward to Mark"), mem_fun(*this, &Editor::jump_backward_to_mark));
126         ActionManager::session_sensitive_actions.push_back (act);
127         act = ActionManager::register_action (editor_actions, "add-location-from-playhead", _("Add Location from Playhead"), mem_fun(*this, &Editor::add_location_from_playhead_cursor));
128         ActionManager::session_sensitive_actions.push_back (act);
129
130         act = ActionManager::register_action (editor_actions, "nudge-forward", _("Nudge Forward"), bind (mem_fun(*this, &Editor::nudge_forward), false));
131         ActionManager::session_sensitive_actions.push_back (act);
132         act = ActionManager::register_action (editor_actions, "nudge-next-forward", _("Nudge Next Forward"), bind (mem_fun(*this, &Editor::nudge_forward), true));
133         ActionManager::session_sensitive_actions.push_back (act);
134         act = ActionManager::register_action (editor_actions, "nudge-backward", _("Nudge Backward"), bind (mem_fun(*this, &Editor::nudge_backward), false));
135         ActionManager::session_sensitive_actions.push_back (act);
136         act = ActionManager::register_action (editor_actions, "nudge-next-backward", _("Nudge Next Backward"), bind (mem_fun(*this, &Editor::nudge_backward), true));
137         ActionManager::session_sensitive_actions.push_back (act);
138
139         act = ActionManager::register_action (editor_actions, "temporal-zoom-out", _("Zoom Out"), bind (mem_fun(*this, &Editor::temporal_zoom_step), true));
140         ActionManager::session_sensitive_actions.push_back (act);
141         act = ActionManager::register_action (editor_actions, "temporal-zoom-in", _("Zoom In"), bind (mem_fun(*this, &Editor::temporal_zoom_step), false));
142         ActionManager::session_sensitive_actions.push_back (act);
143         act = ActionManager::register_action (editor_actions, "zoom-to-session", _("Zoom to Session"), mem_fun(*this, &Editor::temporal_zoom_session));
144         ActionManager::session_sensitive_actions.push_back (act);
145
146         act = ActionManager::register_action (editor_actions, "scroll-tracks-up", _("Scroll Tracks Up"), mem_fun(*this, &Editor::scroll_tracks_up));
147         ActionManager::session_sensitive_actions.push_back (act);
148         act = ActionManager::register_action (editor_actions, "scroll-tracks-down", _("Scroll Tracks Down"), mem_fun(*this, &Editor::scroll_tracks_down));
149         ActionManager::session_sensitive_actions.push_back (act);
150         act = ActionManager::register_action (editor_actions, "step-tracks-up", _("Step Tracks Up"), mem_fun(*this, &Editor::scroll_tracks_up_line));
151         ActionManager::session_sensitive_actions.push_back (act);
152         act = ActionManager::register_action (editor_actions, "step-tracks-down", _("Step Tracks Down"), mem_fun(*this, &Editor::scroll_tracks_down_line));
153         ActionManager::session_sensitive_actions.push_back (act);
154
155         act = ActionManager::register_action (editor_actions, "scroll-backward", _("Scroll Backward"), bind (mem_fun(*this, &Editor::scroll_backward), 0.8f));
156         ActionManager::session_sensitive_actions.push_back (act);
157         act = ActionManager::register_action (editor_actions, "scroll-forward", _("Scroll Forward"), bind (mem_fun(*this, &Editor::scroll_forward), 0.8f));
158         ActionManager::session_sensitive_actions.push_back (act);
159         act = ActionManager::register_action (editor_actions, "goto", _("goto"), mem_fun(*this, &Editor::goto_frame));
160         ActionManager::session_sensitive_actions.push_back (act);
161         act = ActionManager::register_action (editor_actions, "center-playhead", _("Center Playhead"), mem_fun(*this, &Editor::center_playhead));
162         ActionManager::session_sensitive_actions.push_back (act);
163         act = ActionManager::register_action (editor_actions, "center-edit-cursor", _("Center Edit Cursor"), mem_fun(*this, &Editor::center_edit_cursor));
164         ActionManager::session_sensitive_actions.push_back (act);
165         act = ActionManager::register_action (editor_actions, "playhead-forward", _("Playhead Forward"), mem_fun(*this, &Editor::playhead_forward));
166         ActionManager::session_sensitive_actions.push_back (act);
167         act = ActionManager::register_action (editor_actions, "playhead-backward", _("Playhead Backward"), mem_fun(*this, &Editor::playhead_backward));
168         ActionManager::session_sensitive_actions.push_back (act);
169         act = ActionManager::register_action (editor_actions, "playhead-to-edit", _("Playhead to Edit"), bind (mem_fun(*this, &Editor::cursor_align), true));
170         ActionManager::session_sensitive_actions.push_back (act);
171         act = ActionManager::register_action (editor_actions, "edit-to-playhead", _("Edit to Playhead"), bind (mem_fun(*this, &Editor::cursor_align), false));
172         ActionManager::session_sensitive_actions.push_back (act);
173
174         act = ActionManager::register_action (editor_actions, "align-regions-start", _("Align Regions Start"), bind (mem_fun(*this, &Editor::align), ARDOUR::Start));
175         ActionManager::session_sensitive_actions.push_back (act);
176         act = ActionManager::register_action (editor_actions, "align-regions-start-relative", _("Align Regions Start Relative"), bind (mem_fun(*this, &Editor::align_relative), ARDOUR::Start));
177         ActionManager::session_sensitive_actions.push_back (act);
178         act = ActionManager::register_action (editor_actions, "align-regions-end", _("Align Regions End"), bind (mem_fun(*this, &Editor::align), ARDOUR::End));
179         ActionManager::session_sensitive_actions.push_back (act);
180         act = ActionManager::register_action (editor_actions, "align-regions-end-relative", _("Align Regions End Relative"), bind (mem_fun(*this, &Editor::align_relative), ARDOUR::End));
181         ActionManager::session_sensitive_actions.push_back (act);
182
183         act = ActionManager::register_action (editor_actions, "align-regions-sync", _("Align Regions Sync"), bind (mem_fun(*this, &Editor::align), ARDOUR::SyncPoint));
184         ActionManager::session_sensitive_actions.push_back (act);
185         act = ActionManager::register_action (editor_actions, "align-regions-sync-relative", _("Align Regions Sync Relative"), bind (mem_fun(*this, &Editor::align_relative), ARDOUR::SyncPoint));
186         ActionManager::session_sensitive_actions.push_back (act);
187         
188         act = ActionManager::register_action (editor_actions, "audition-at-mouse", _("Audition at Mouse"), mem_fun(*this, &Editor::kbd_audition));
189         ActionManager::session_sensitive_actions.push_back (act);
190         act = ActionManager::register_action (editor_actions, "brush-at-mouse", _("Brush at Mouse"), mem_fun(*this, &Editor::kbd_brush));
191         ActionManager::session_sensitive_actions.push_back (act);
192         act = ActionManager::register_action (editor_actions, "set-edit-cursor", _("Set Edit Cursor"), mem_fun(*this, &Editor::kbd_set_edit_cursor));
193         ActionManager::session_sensitive_actions.push_back (act);
194         act = ActionManager::register_action (editor_actions, "mute-unmute-region", _("Mute/Unmute Region"), mem_fun(*this, &Editor::kbd_mute_unmute_region));
195         ActionManager::session_sensitive_actions.push_back (act);
196         act = ActionManager::register_action (editor_actions, "set-playhead", _("Set Playhead"), mem_fun(*this, &Editor::kbd_set_playhead_cursor));
197         ActionManager::session_sensitive_actions.push_back (act);
198         act = ActionManager::register_action (editor_actions, "split-region", _("Split Region"), mem_fun(*this, &Editor::kbd_split));
199         ActionManager::session_sensitive_actions.push_back (act);
200         act = ActionManager::register_action (editor_actions, "set-region-sync-position", _("Set Region Sync Position"), mem_fun(*this, &Editor::kbd_set_sync_position));
201         ActionManager::session_sensitive_actions.push_back (act);
202
203         act = ActionManager::register_action (editor_actions, "undo", _("Undo"), bind (mem_fun(*this, &Editor::undo), 1U));
204         ActionManager::session_sensitive_actions.push_back (act);
205         act = ActionManager::register_action (editor_actions, "redo", _("Redo"), bind (mem_fun(*this, &Editor::redo), 1U));
206         ActionManager::session_sensitive_actions.push_back (act);
207
208         act = ActionManager::register_action (editor_actions, "export-session", _("Export Session"), mem_fun(*this, &Editor::export_session));
209         ActionManager::session_sensitive_actions.push_back (act);
210         act = ActionManager::register_action (editor_actions, "export-range", _("Export Range"), mem_fun(*this, &Editor::export_selection));
211         ActionManager::session_sensitive_actions.push_back (act);
212
213         act = ActionManager::register_action (editor_actions, "editor-cut", _("Cut"), mem_fun(*this, &Editor::cut));
214         ActionManager::session_sensitive_actions.push_back (act);
215         /* Note: for now, editor-delete does the exact same thing as editor-cut */
216         act = ActionManager::register_action (editor_actions, "editor-delete", _("Delete"), mem_fun(*this, &Editor::cut));
217         ActionManager::session_sensitive_actions.push_back (act);
218         act = ActionManager::register_action (editor_actions, "editor-copy", _("Copy"), mem_fun(*this, &Editor::copy));
219         ActionManager::session_sensitive_actions.push_back (act);
220         act = ActionManager::register_action (editor_actions, "editor-paste", _("Paste"), mem_fun(*this, &Editor::keyboard_paste));
221         ActionManager::session_sensitive_actions.push_back (act);
222         act = ActionManager::register_action (editor_actions, "duplicate-region", _("Duplicate Region"), mem_fun(*this, &Editor::keyboard_duplicate_region));
223         ActionManager::session_sensitive_actions.push_back (act);
224         act = ActionManager::register_action (editor_actions, "duplicate-range", _("Duplicate Range"), mem_fun(*this, &Editor::keyboard_duplicate_selection));
225         ActionManager::session_sensitive_actions.push_back (act);
226         act = ActionManager::register_action (editor_actions, "insert-region", _("Insert Region"), mem_fun(*this, &Editor::keyboard_insert_region_list_selection));
227         ActionManager::session_sensitive_actions.push_back (act);
228         act = ActionManager::register_action (editor_actions, "reverse-region", _("Reverse Region"), mem_fun(*this, &Editor::reverse_region));
229         ActionManager::session_sensitive_actions.push_back (act);
230         act = ActionManager::register_action (editor_actions, "normalize-region", _("Normalize Region"), mem_fun(*this, &Editor::normalize_region));
231         ActionManager::session_sensitive_actions.push_back (act);
232         act = ActionManager::register_action (editor_actions, "crop", _("crop"), mem_fun(*this, &Editor::crop_region_to_selection));
233         ActionManager::session_sensitive_actions.push_back (act);
234         act = ActionManager::register_action (editor_actions, "insert-chunk", _("Insert Chunk"), bind (mem_fun(*this, &Editor::paste_named_selection), 1.0f));
235         ActionManager::session_sensitive_actions.push_back (act);
236
237         act = ActionManager::register_action (editor_actions, "split-at-edit-cursor", _("Split at edit cursor"), mem_fun(*this, &Editor::split_region));
238         ActionManager::edit_cursor_in_region_sensitive_actions.push_back (act);
239
240         act = ActionManager::register_action (editor_actions, "start-range", _("Start Range"), mem_fun(*this, &Editor::keyboard_selection_begin));
241         ActionManager::session_sensitive_actions.push_back (act);
242         act = ActionManager::register_action (editor_actions, "finish-range", _("Finish Range"), bind (mem_fun(*this, &Editor::keyboard_selection_finish), false));
243         ActionManager::session_sensitive_actions.push_back (act);
244         act = ActionManager::register_action (editor_actions, "finish-add-range", _("Finish add Range"), bind (mem_fun(*this, &Editor::keyboard_selection_finish), true));
245         ActionManager::session_sensitive_actions.push_back (act);
246
247         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));
248         ActionManager::session_sensitive_actions.push_back (act);
249         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));
250         ActionManager::session_sensitive_actions.push_back (act);
251
252         act = ActionManager::register_toggle_action (editor_actions, "toggle-follow-playhead", _("Follow Playhead"), (mem_fun(*this, &Editor::toggle_follow_playhead)));
253         ActionManager::session_sensitive_actions.push_back (act);
254         act = ActionManager::register_action (editor_actions, "remove-last-capture", _("Remove Last Capture"), (mem_fun(*this, &Editor::remove_last_capture)));
255         ActionManager::session_sensitive_actions.push_back (act);
256
257         Glib::RefPtr<ActionGroup> zoom_actions = ActionGroup::create (X_("Zoom"));
258         RadioAction::Group zoom_group;
259
260         ActionManager::register_radio_action (zoom_actions, zoom_group, "zoom-focus-left", _("Zoom Focus Left"), bind (mem_fun(*this, &Editor::set_zoom_focus), Editing::ZoomFocusLeft));
261         ActionManager::session_sensitive_actions.push_back (act);
262         ActionManager::register_radio_action (zoom_actions, zoom_group, "zoom-focus-right", _("Zoom Focus Right"), bind (mem_fun(*this, &Editor::set_zoom_focus), Editing::ZoomFocusRight));
263         ActionManager::session_sensitive_actions.push_back (act);
264         ActionManager::register_radio_action (zoom_actions, zoom_group, "zoom-focus-center", _("Zoom Focus Center"), bind (mem_fun(*this, &Editor::set_zoom_focus), Editing::ZoomFocusCenter));
265         ActionManager::session_sensitive_actions.push_back (act);
266         ActionManager::register_radio_action (zoom_actions, zoom_group, "zoom-focus-playhead", _("Zoom Focus Playhead"), bind (mem_fun(*this, &Editor::set_zoom_focus), Editing::ZoomFocusPlayhead));
267         ActionManager::session_sensitive_actions.push_back (act);
268         ActionManager::register_radio_action (zoom_actions, zoom_group, "zoom-focus-edit", _("Zoom Focus Edit"), bind (mem_fun(*this, &Editor::set_zoom_focus), Editing::ZoomFocusEdit));
269         ActionManager::session_sensitive_actions.push_back (act);
270
271         Glib::RefPtr<ActionGroup> mouse_mode_actions = ActionGroup::create (X_("MouseMode"));
272         RadioAction::Group mouse_mode_group;
273
274         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));
275         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));
276         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));
277         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));
278         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));
279
280         Glib::RefPtr<ActionGroup> snap_actions = ActionGroup::create (X_("Snap"));
281         RadioAction::Group snap_choice_group;
282
283         ActionManager::register_action (editor_actions, X_("SnapTo"), _("Snap To"));
284
285         ActionManager::register_radio_action (snap_actions, snap_choice_group, X_("snap-to-frame"), _("Snap to frame"), (bind (mem_fun(*this, &Editor::set_snap_to), Editing::SnapToFrame)));
286         ActionManager::register_radio_action (snap_actions, snap_choice_group, X_("snap-to-cd-frame"), _("Snap to cd frame"), (bind (mem_fun(*this, &Editor::set_snap_to), Editing::SnapToCDFrame)));
287         ActionManager::register_radio_action (snap_actions, snap_choice_group, X_("snap-to-smpte-frame"), _("Snap to SMPTE frame"), (bind (mem_fun(*this, &Editor::set_snap_to), Editing::SnapToSMPTEFrame)));
288         ActionManager::register_radio_action (snap_actions, snap_choice_group, X_("snap-to-smpte-seconds"), _("Snap to SMPTE seconds"), (bind (mem_fun(*this, &Editor::set_snap_to), Editing::SnapToSMPTESeconds)));
289         ActionManager::register_radio_action (snap_actions, snap_choice_group, X_("snap-to-smpte-minutes"), _("Snap to SMPTE minutes"), (bind (mem_fun(*this, &Editor::set_snap_to), Editing::SnapToSMPTEMinutes)));
290         ActionManager::register_radio_action (snap_actions, snap_choice_group, X_("snap-to-seconds"), _("Snap to seconds"), (bind (mem_fun(*this, &Editor::set_snap_to), Editing::SnapToSeconds)));
291         ActionManager::register_radio_action (snap_actions, snap_choice_group, X_("snap-to-minutes"), _("Snap to minutes"), (bind (mem_fun(*this, &Editor::set_snap_to), Editing::SnapToMinutes)));
292         ActionManager::register_radio_action (snap_actions, snap_choice_group, X_("snap-to-thirtyseconds"), _("Snap to thirtyseconds"), (bind (mem_fun(*this, &Editor::set_snap_to), Editing::SnapToAThirtysecondBeat)));
293         ActionManager::register_radio_action (snap_actions, snap_choice_group, X_("snap-to-asixteenthbeat"), _("Snap to asixteenthbeat"), (bind (mem_fun(*this, &Editor::set_snap_to), Editing::SnapToASixteenthBeat)));
294         ActionManager::register_radio_action (snap_actions, snap_choice_group, X_("snap-to-eighths"), _("Snap to eighths"), (bind (mem_fun(*this, &Editor::set_snap_to), Editing::SnapToAEighthBeat)));
295         ActionManager::register_radio_action (snap_actions, snap_choice_group, X_("snap-to-quarters"), _("Snap to quarters"), (bind (mem_fun(*this, &Editor::set_snap_to), Editing::SnapToAQuarterBeat)));
296         ActionManager::register_radio_action (snap_actions, snap_choice_group, X_("snap-to-thirds"), _("Snap to thirds"), (bind (mem_fun(*this, &Editor::set_snap_to), Editing::SnapToAThirdBeat)));
297         ActionManager::register_radio_action (snap_actions, snap_choice_group, X_("snap-to-beat"), _("Snap to beat"), (bind (mem_fun(*this, &Editor::set_snap_to), Editing::SnapToBeat)));
298         ActionManager::register_radio_action (snap_actions, snap_choice_group, X_("snap-to-bar"), _("Snap to bar"), (bind (mem_fun(*this, &Editor::set_snap_to), Editing::SnapToBar)));
299         ActionManager::register_radio_action (snap_actions, snap_choice_group, X_("snap-to-mark"), _("Snap to mark"), (bind (mem_fun(*this, &Editor::set_snap_to), Editing::SnapToMark)));
300         ActionManager::register_radio_action (snap_actions, snap_choice_group, X_("snap-to-edit-cursor"), _("Snap to edit cursor"), (bind (mem_fun(*this, &Editor::set_snap_to), Editing::SnapToEditCursor)));
301         ActionManager::register_radio_action (snap_actions, snap_choice_group, X_("snap-to-region-start"), _("Snap to region start"), (bind (mem_fun(*this, &Editor::set_snap_to), Editing::SnapToRegionStart)));
302         ActionManager::register_radio_action (snap_actions, snap_choice_group, X_("snap-to-region-end"), _("Snap to region end"), (bind (mem_fun(*this, &Editor::set_snap_to), Editing::SnapToRegionEnd)));
303         ActionManager::register_radio_action (snap_actions, snap_choice_group, X_("snap-to-region-sync"), _("Snap to region sync"), (bind (mem_fun(*this, &Editor::set_snap_to), Editing::SnapToRegionSync)));
304         ActionManager::register_radio_action (snap_actions, snap_choice_group, X_("snap-to-region-boundary"), _("Snap to region boundary"), (bind (mem_fun(*this, &Editor::set_snap_to), Editing::SnapToRegionBoundary)));
305
306         /* REGION LIST */
307
308         Glib::RefPtr<ActionGroup> rl_actions = ActionGroup::create (X_("RegionList"));
309         RadioAction::Group sort_type_group;
310         RadioAction::Group sort_order_group;
311
312         /* the region list popup menu */
313         ActionManager::register_action (rl_actions, X_("RegionListSort"), _("Sort"));
314
315         act = ActionManager::register_action (rl_actions, X_("rlAudition"), _("Audition"), mem_fun(*this, &Editor::audition_region_from_region_list));
316         ActionManager::region_list_selection_sensitive_actions.push_back (act);
317         act = ActionManager::register_action (rl_actions, X_("rlHide"), _("Hide"), mem_fun(*this, &Editor::hide_region_from_region_list));
318         ActionManager::region_list_selection_sensitive_actions.push_back (act);
319         act = ActionManager::register_action (rl_actions, X_("rlRemove"), _("Remove"), mem_fun (*this, &Editor::remove_region_from_region_list));
320         ActionManager::region_list_selection_sensitive_actions.push_back (act);
321         ActionManager::register_toggle_action (rl_actions, X_("rlShowAll"), _("Show all"), mem_fun(*this, &Editor::toggle_full_region_list));
322         ActionManager::register_toggle_action (rl_actions, X_("rlShowAuto"), _("Show automatic regions"), mem_fun(*this, &Editor::toggle_show_auto_regions));
323
324         ActionManager::register_radio_action (rl_actions, sort_order_group, X_("SortAscending"),  _("Ascending"),
325                                bind (mem_fun(*this, &Editor::reset_region_list_sort_direction), true));
326         ActionManager::register_radio_action (rl_actions, sort_order_group, X_("SortDescending"),   _("Descending"),
327                                bind (mem_fun(*this, &Editor::reset_region_list_sort_direction), false));
328         
329         ActionManager::register_radio_action (rl_actions, sort_type_group, X_("SortByRegionName"),  _("By Region Name"),
330                                bind (mem_fun(*this, &Editor::reset_region_list_sort_type), ByName));
331         ActionManager::register_radio_action (rl_actions, sort_type_group, X_("SortByRegionLength"),  _("By Region Length"),
332                                bind (mem_fun(*this, &Editor::reset_region_list_sort_type), ByLength));
333         ActionManager::register_radio_action (rl_actions, sort_type_group, X_("SortByRegionPosition"),  _("By Region Position"),
334                                bind (mem_fun(*this, &Editor::reset_region_list_sort_type), ByPosition));
335         ActionManager::register_radio_action (rl_actions, sort_type_group, X_("SortByRegionTimestamp"),  _("By Region Timestamp"),
336                                bind (mem_fun(*this, &Editor::reset_region_list_sort_type), ByTimestamp));
337         ActionManager::register_radio_action (rl_actions, sort_type_group, X_("SortByRegionStartinFile"),  _("By Region Start in File"),
338                                bind (mem_fun(*this, &Editor::reset_region_list_sort_type), ByStartInFile));
339         ActionManager::register_radio_action (rl_actions, sort_type_group, X_("SortByRegionEndinFile"),  _("By Region End in File"),
340                                bind (mem_fun(*this, &Editor::reset_region_list_sort_type), ByEndInFile));
341         ActionManager::register_radio_action (rl_actions, sort_type_group, X_("SortBySourceFileName"),  _("By Source File Name"),
342                                bind (mem_fun(*this, &Editor::reset_region_list_sort_type), BySourceFileName));
343         ActionManager::register_radio_action (rl_actions, sort_type_group, X_("SortBySourceFileLength"),  _("By Source File Length"),
344                                bind (mem_fun(*this, &Editor::reset_region_list_sort_type), BySourceFileLength));
345         ActionManager::register_radio_action (rl_actions, sort_type_group, X_("SortBySourceFileCreationDate"),  _("By Source File Creation Date"),
346                                bind (mem_fun(*this, &Editor::reset_region_list_sort_type), BySourceFileCreationDate));
347         ActionManager::register_radio_action (rl_actions, sort_type_group, X_("SortBySourceFilesystem"),  _("By Source Filesystem"),
348                                bind (mem_fun(*this, &Editor::reset_region_list_sort_type), BySourceFileFS));
349
350
351         /* the next two are duplicate items with different names for use in two different contexts */
352
353         act = ActionManager::register_action (editor_actions, X_("addExternalAudioToRegionList"), _("Add External Audio"), bind (mem_fun(*this, &Editor::add_external_audio_action), ImportAsRegion));
354         ActionManager::session_sensitive_actions.push_back (act);
355         act = ActionManager::register_action (editor_actions, X_("addExternalAudioAsRegion"), _("as Region(s)"), bind (mem_fun(*this, &Editor::add_external_audio_action), ImportAsRegion));
356         ActionManager::session_sensitive_actions.push_back (act);
357         act = ActionManager::register_action (editor_actions, X_("addExternalAudioAsTrack"), _("as Tracks"), bind (mem_fun(*this, &Editor::add_external_audio_action), ImportAsTrack));
358         ActionManager::session_sensitive_actions.push_back (act);
359         act = ActionManager::register_action (editor_actions, X_("addExternalAudioToTrack"), _("to Tracks"), bind (mem_fun(*this, &Editor::add_external_audio_action), ImportToTrack));
360         ActionManager::session_sensitive_actions.push_back (act);
361
362         ActionManager::register_toggle_action (editor_actions, X_("ToggleWaveformVisibility"), _("Show Waveforms"), mem_fun (*this, &Editor::toggle_waveform_visibility));
363         ActionManager::register_toggle_action (editor_actions, X_("ToggleWaveformsWhileRecording"), _("Show Waveforms While Recording"), mem_fun (*this, &Editor::toggle_waveforms_while_recording));
364         act = ActionManager::register_toggle_action (editor_actions, X_("ToggleMeasureVisibility"), _("Show Measures"), mem_fun (*this, &Editor::toggle_measure_visibility));
365         
366         RadioAction::Group meter_falloff_group;
367         RadioAction::Group meter_hold_group;
368
369         /*
370             Slowest = 6.6dB/sec falloff at update rate of 40ms
371             Slow    = 6.8dB/sec falloff at update rate of 40ms
372         */
373
374         ActionManager::register_radio_action (editor_actions, meter_falloff_group, X_("MeterFalloffOff"), _("Off"), bind (mem_fun (*this, &Editor::set_meter_falloff), 0));
375         ActionManager::register_radio_action (editor_actions, meter_falloff_group, X_("MeterFalloffSlowest"), _("Slowest"), bind (mem_fun (*this, &Editor::set_meter_falloff), 1)); 
376         ActionManager::register_radio_action (editor_actions, meter_falloff_group, X_("MeterFalloffSlow"), _("Slow"), bind (mem_fun (*this, &Editor::set_meter_falloff), 2));
377         ActionManager::register_radio_action (editor_actions, meter_falloff_group, X_("MeterFalloffMedium"), _("Medium"), bind (mem_fun (*this, &Editor::set_meter_falloff), 3));
378         ActionManager::register_radio_action (editor_actions, meter_falloff_group, X_("MeterFalloffFast"), _("Fast"), bind (mem_fun (*this, &Editor::set_meter_falloff), 4));
379         ActionManager::register_radio_action (editor_actions, meter_falloff_group, X_("MeterFalloffFaster"), _("Faster"), bind (mem_fun (*this, &Editor::set_meter_falloff), 5));
380         ActionManager::register_radio_action (editor_actions, meter_falloff_group, X_("MeterFalloffFastest"), _("Fastest"), bind (mem_fun (*this, &Editor::set_meter_falloff), 6));
381
382         ActionManager::register_radio_action (editor_actions, meter_hold_group,  X_("MeterHoldOff"), _("Off"), bind (mem_fun (*this, &Editor::set_meter_hold), 0));
383         ActionManager::register_radio_action (editor_actions, meter_hold_group,  X_("MeterHoldShort"), _("Short"), bind (mem_fun (*this, &Editor::set_meter_hold), 40));
384         ActionManager::register_radio_action (editor_actions, meter_hold_group,  X_("MeterHoldMedium"), _("Medium"), bind (mem_fun (*this, &Editor::set_meter_hold), 100));
385         ActionManager::register_radio_action (editor_actions, meter_hold_group,  X_("MeterHoldLong"), _("Long"), bind (mem_fun (*this, &Editor::set_meter_hold), 200));
386
387         RadioAction::Group layer_model_group;
388
389         ActionManager::register_radio_action (editor_actions, layer_model_group,  X_("LayerLaterHigher"), _("Later is Higher"), bind (mem_fun (*this, &Editor::set_layer_model), Session::LaterHigher));
390         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), Session::MoveAddHigher));
391         ActionManager::register_radio_action (editor_actions, layer_model_group,  X_("LayerAddHigher"), _("Most Recently Added is Higher"), bind (mem_fun (*this, &Editor::set_layer_model), Session::AddHigher));
392
393         ActionManager::add_action_group (rl_actions);
394         ActionManager::add_action_group (zoom_actions);
395         ActionManager::add_action_group (mouse_mode_actions);
396         ActionManager::add_action_group (snap_actions);
397         ActionManager::add_action_group (editor_actions);
398 }
399
400 void
401 Editor::toggle_waveform_visibility ()
402 {
403         Glib::RefPtr<Action> act = ActionManager::get_action (X_("Editor"), X_("ToggleWaveformVisibility"));
404         if (act) {
405                 Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic(act);
406                 set_show_waveforms (tact->get_active());
407         }
408 }
409
410 void
411 Editor::toggle_waveforms_while_recording ()
412 {
413         Glib::RefPtr<Action> act = ActionManager::get_action (X_("Editor"), X_("ToggleWaveformVisibility"));
414         if (act) {
415                 Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic(act);
416                 set_show_waveforms_recording (tact->get_active());
417         }
418 }
419
420 void
421 Editor::toggle_measure_visibility ()
422 {
423         Glib::RefPtr<Action> act = ActionManager::get_action (X_("Editor"), X_("ToggleMeasureVisibility"));
424         if (act) {
425                 Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic(act);
426                 set_show_measures (tact->get_active());
427         }
428 }
429
430 void
431 Editor::toggle_auto_xfade ()
432 {
433         Glib::RefPtr<Action> act = ActionManager::get_action (X_("Editor"), X_("toggle-auto-xfades"));
434         if (act) {
435                 Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic(act);
436                 Config->set_auto_xfade (tact->get_active());
437         }
438 }
439
440 void
441 Editor::toggle_xfades_active ()
442 {
443         Glib::RefPtr<Action> act = ActionManager::get_action (X_("Editor"), X_("toggle-xfades-active"));
444         if (session && act) {
445                 Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic(act);
446                 session->set_crossfades_active (tact->get_active());
447         }
448 }
449
450 void
451 Editor::toggle_xfade_visibility ()
452 {
453         Glib::RefPtr<Action> act = ActionManager::get_action (X_("Editor"), X_("toggle-xfades-visible"));
454         if (session && act) {
455                 Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic(act);
456                 // set_xfade_visibility (tact->get_active());
457         }
458 }
459
460 void
461 Editor::set_layer_model (Session::LayerModel model)
462 {
463         /* this is driven by a toggle on a radio group, and so is invoked twice,
464            once for the item that became inactive and once for the one that became
465            active.
466         */
467
468         RefPtr<Action> act;
469
470         if (session) {
471                 switch (model) {
472                 case Session::LaterHigher:
473                         act = ActionManager::get_action (X_("Editor"), X_("LayerLaterHigher"));
474                         break;
475                 case Session::MoveAddHigher:
476                         act = ActionManager::get_action (X_("Editor"), X_("LayerMoveAddHigher"));
477                         break;
478                 case Session::AddHigher:
479                         act = ActionManager::get_action (X_("Editor"), X_("LayerAddHigher"));
480                         break;
481                 }
482                 
483                 if (act) {
484                         RefPtr<RadioAction> ract = RefPtr<RadioAction>::cast_dynamic(act);
485                         if (ract && ract->get_active()) {
486                                 session->set_layer_model (model);
487                         }
488                 }
489         }
490 }
491
492 void
493 Editor::set_crossfade_model (CrossfadeModel model)
494 {
495         RefPtr<Action> act;
496
497         /* this is driven by a toggle on a radio group, and so is invoked twice,
498            once for the item that became inactive and once for the one that became
499            active.
500         */
501
502         if (session) {
503                 switch (model) {
504                 case FullCrossfade:
505                         act = ActionManager::get_action (X_("Editor"), X_("CrossfadesFull"));
506                         break;
507                 case ShortCrossfade:
508                         act = ActionManager::get_action (X_("Editor"), X_("CrossfadesShort"));
509                         break;
510                 }
511                 
512                 if (act) {
513                         RefPtr<RadioAction> ract = RefPtr<RadioAction>::cast_dynamic(act);
514                         if (ract && ract->get_active()) {
515                                 session->set_xfade_model (model);
516                         }
517                 }
518         }
519 }