Edit menu reorganization, abort if problems with ardour.menus.
[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         RefPtr<ActionGroup> editor_actions = ActionGroup::create (X_("Editor"));
22         
23         /* non-operative menu items for menu bar */
24
25         ActionManager::register_action (editor_actions, X_("Edit"), _("Edit"));
26         ActionManager::register_action (editor_actions, X_("EditSelectRegionOptions"), _("Select regions"));
27         ActionManager::register_action (editor_actions, X_("EditCursorMovementOptions"), _("Move edit cursor"));
28         ActionManager::register_action (editor_actions, X_("RegionEditOps"), _("Region operations"));
29         ActionManager::register_action (editor_actions, X_("View"), _("View"));
30         ActionManager::register_action (editor_actions, X_("ZoomFocus"), _("ZoomFocus"));
31         ActionManager::register_action (editor_actions, X_("MeterHold"), _("Meter hold"));
32         ActionManager::register_action (editor_actions, X_("MeterFalloff"), _("Meter falloff"));
33         ActionManager::register_action (editor_actions, X_("Solo"), _("Solo"));
34         ActionManager::register_action (editor_actions, X_("Monitoring"), _("Monitoring"));
35         ActionManager::register_action (editor_actions, X_("Autoconnect"), _("Autoconnect"));
36
37         /* add named actions for the editor */
38
39         act = ActionManager::register_action (editor_actions, "toggle-xfades-active", _("toggle xfades active"), mem_fun(*this, &Editor::toggle_xfades_active));
40         ActionManager::session_sensitive_actions.push_back (act);
41
42         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)));
43         ActionManager::session_sensitive_actions.push_back (act);
44         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)));
45         ActionManager::session_sensitive_actions.push_back (act);
46         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)));
47         ActionManager::session_sensitive_actions.push_back (act);
48
49         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)));
50         ActionManager::session_sensitive_actions.push_back (act);
51         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)));
52         ActionManager::session_sensitive_actions.push_back (act);
53         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)));
54         ActionManager::session_sensitive_actions.push_back (act);
55
56         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)));
57         ActionManager::session_sensitive_actions.push_back (act);
58         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)));
59         ActionManager::session_sensitive_actions.push_back (act);
60         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)));
61         ActionManager::session_sensitive_actions.push_back (act);
62
63         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)));
64         ActionManager::session_sensitive_actions.push_back (act);
65         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)));
66         ActionManager::session_sensitive_actions.push_back (act);
67         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)));
68         ActionManager::session_sensitive_actions.push_back (act);
69
70         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));
71         ActionManager::session_sensitive_actions.push_back (act);
72         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));
73         ActionManager::session_sensitive_actions.push_back (act);
74
75         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));
76         ActionManager::session_sensitive_actions.push_back (act);
77         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));
78         ActionManager::session_sensitive_actions.push_back (act);
79
80         act = ActionManager::register_action (editor_actions, "select-all", _("select all"), bind (mem_fun(*this, &Editor::select_all), false));
81         ActionManager::session_sensitive_actions.push_back (act);
82         act = ActionManager::register_action (editor_actions, "select-all-after-edit-cursor", _("select all after edit cursor"), bind (mem_fun(*this, &Editor::select_all_after_cursor), edit_cursor, true));
83         ActionManager::session_sensitive_actions.push_back (act);
84         act = ActionManager::register_action (editor_actions, "select-all-before-edit-cursor", _("select all before edit cursor"), bind (mem_fun(*this, &Editor::select_all_after_cursor), edit_cursor, false));
85         ActionManager::session_sensitive_actions.push_back (act);
86
87         act = ActionManager::register_action (editor_actions, "select-all-after-playhead", _("select all after playhead"), bind (mem_fun(*this, &Editor::select_all_after_cursor), playhead_cursor, true));
88         ActionManager::session_sensitive_actions.push_back (act);
89         act = ActionManager::register_action (editor_actions, "select-all-before-playhead", _("select all before playhead"), bind (mem_fun(*this, &Editor::select_all_after_cursor), playhead_cursor, false));
90         ActionManager::session_sensitive_actions.push_back (act);
91
92         act = ActionManager::register_action (editor_actions, "select-all-in-punch-range", _("select all in punch range"), mem_fun(*this, &Editor::select_all_from_punch));
93         ActionManager::session_sensitive_actions.push_back (act);
94         act = ActionManager::register_action (editor_actions, "select-all-in-loop-range", _("select all in loop range"), mem_fun(*this, &Editor::select_all_from_loop));
95         ActionManager::session_sensitive_actions.push_back (act);
96
97         act = ActionManager::register_action (editor_actions, "jump-forward-to-mark", _("jump forward to mark"), mem_fun(*this, &Editor::jump_forward_to_mark));
98         ActionManager::session_sensitive_actions.push_back (act);
99         act = ActionManager::register_action (editor_actions, "jump-backward-to-mark", _("jump backward to mark"), mem_fun(*this, &Editor::jump_backward_to_mark));
100         ActionManager::session_sensitive_actions.push_back (act);
101         act = ActionManager::register_action (editor_actions, "add-location-from-playhead", _("add location from playhead"), mem_fun(*this, &Editor::add_location_from_playhead_cursor));
102         ActionManager::session_sensitive_actions.push_back (act);
103
104         act = ActionManager::register_action (editor_actions, "nudge-forward", _("nudge forward"), bind (mem_fun(*this, &Editor::nudge_forward), false));
105         ActionManager::session_sensitive_actions.push_back (act);
106         act = ActionManager::register_action (editor_actions, "nudge-next-forward", _("nudge next forward"), bind (mem_fun(*this, &Editor::nudge_forward), true));
107         ActionManager::session_sensitive_actions.push_back (act);
108         act = ActionManager::register_action (editor_actions, "nudge-backward", _("nudge backward"), bind (mem_fun(*this, &Editor::nudge_backward), false));
109         ActionManager::session_sensitive_actions.push_back (act);
110         act = ActionManager::register_action (editor_actions, "nudge-next-backward", _("nudge next backward"), bind (mem_fun(*this, &Editor::nudge_backward), true));
111         ActionManager::session_sensitive_actions.push_back (act);
112
113         act = ActionManager::register_action (editor_actions, "temporal-zoom-out", _("zoom out"), bind (mem_fun(*this, &Editor::temporal_zoom_step), true));
114         ActionManager::session_sensitive_actions.push_back (act);
115         act = ActionManager::register_action (editor_actions, "temporal-zoom-in", _("zoom in"), bind (mem_fun(*this, &Editor::temporal_zoom_step), false));
116         ActionManager::session_sensitive_actions.push_back (act);
117         act = ActionManager::register_action (editor_actions, "zoom-to-session", _("zoom to session"), mem_fun(*this, &Editor::temporal_zoom_session));
118         ActionManager::session_sensitive_actions.push_back (act);
119
120         act = ActionManager::register_action (editor_actions, "scroll-tracks-up", _("scroll tracks up"), mem_fun(*this, &Editor::scroll_tracks_up));
121         ActionManager::session_sensitive_actions.push_back (act);
122         act = ActionManager::register_action (editor_actions, "scroll-tracks-down", _("scroll tracks down"), mem_fun(*this, &Editor::scroll_tracks_down));
123         ActionManager::session_sensitive_actions.push_back (act);
124         act = ActionManager::register_action (editor_actions, "step-tracks-up", _("step tracks up"), mem_fun(*this, &Editor::scroll_tracks_up_line));
125         ActionManager::session_sensitive_actions.push_back (act);
126         act = ActionManager::register_action (editor_actions, "step-tracks-down", _("step tracks down"), mem_fun(*this, &Editor::scroll_tracks_down_line));
127         ActionManager::session_sensitive_actions.push_back (act);
128
129         act = ActionManager::register_action (editor_actions, "scroll-backward", _("scroll backward"), bind (mem_fun(*this, &Editor::scroll_backward), 0.8f));
130         ActionManager::session_sensitive_actions.push_back (act);
131         act = ActionManager::register_action (editor_actions, "scroll-forward", _("scroll forward"), bind (mem_fun(*this, &Editor::scroll_forward), 0.8f));
132         ActionManager::session_sensitive_actions.push_back (act);
133         act = ActionManager::register_action (editor_actions, "goto", _("goto"), mem_fun(*this, &Editor::goto_frame));
134         ActionManager::session_sensitive_actions.push_back (act);
135         act = ActionManager::register_action (editor_actions, "center-playhead", _("center playhead"), mem_fun(*this, &Editor::center_playhead));
136         ActionManager::session_sensitive_actions.push_back (act);
137         act = ActionManager::register_action (editor_actions, "center-edit-cursor", _("center edit cursor"), mem_fun(*this, &Editor::center_edit_cursor));
138         ActionManager::session_sensitive_actions.push_back (act);
139         act = ActionManager::register_action (editor_actions, "playhead-forward", _("playhead forward"), mem_fun(*this, &Editor::playhead_forward));
140         ActionManager::session_sensitive_actions.push_back (act);
141         act = ActionManager::register_action (editor_actions, "playhead-backward", _("playhead backward"), mem_fun(*this, &Editor::playhead_backward));
142         ActionManager::session_sensitive_actions.push_back (act);
143         act = ActionManager::register_action (editor_actions, "playhead-to-edit", _("playhead to edit"), bind (mem_fun(*this, &Editor::cursor_align), true));
144         ActionManager::session_sensitive_actions.push_back (act);
145         act = ActionManager::register_action (editor_actions, "edit-to-playhead", _("edit to playhead"), bind (mem_fun(*this, &Editor::cursor_align), false));
146         ActionManager::session_sensitive_actions.push_back (act);
147
148         act = ActionManager::register_action (editor_actions, "align-regions-start", _("align regions start"), bind (mem_fun(*this, &Editor::align), ARDOUR::Start));
149         ActionManager::session_sensitive_actions.push_back (act);
150         act = ActionManager::register_action (editor_actions, "align-regions-start-relative", _("align regions start relative"), bind (mem_fun(*this, &Editor::align_relative), ARDOUR::Start));
151         ActionManager::session_sensitive_actions.push_back (act);
152         act = ActionManager::register_action (editor_actions, "align-regions-end", _("align regions end"), bind (mem_fun(*this, &Editor::align), ARDOUR::End));
153         ActionManager::session_sensitive_actions.push_back (act);
154         act = ActionManager::register_action (editor_actions, "align-regions-end-relative", _("align regions end relative"), bind (mem_fun(*this, &Editor::align_relative), ARDOUR::End));
155         ActionManager::session_sensitive_actions.push_back (act);
156
157         act = ActionManager::register_action (editor_actions, "align-regions-sync", _("align regions sync"), bind (mem_fun(*this, &Editor::align), ARDOUR::SyncPoint));
158         ActionManager::session_sensitive_actions.push_back (act);
159         act = ActionManager::register_action (editor_actions, "align-regions-sync-relative", _("align regions sync relative"), bind (mem_fun(*this, &Editor::align_relative), ARDOUR::SyncPoint));
160         ActionManager::session_sensitive_actions.push_back (act);
161         
162         act = ActionManager::register_action (editor_actions, "audition-at-mouse", _("audition at mouse"), mem_fun(*this, &Editor::kbd_audition));
163         ActionManager::session_sensitive_actions.push_back (act);
164         act = ActionManager::register_action (editor_actions, "brush-at-mouse", _("brush at mouse"), mem_fun(*this, &Editor::kbd_brush));
165         ActionManager::session_sensitive_actions.push_back (act);
166         act = ActionManager::register_action (editor_actions, "set-edit-cursor", _("set edit cursor"), mem_fun(*this, &Editor::kbd_set_edit_cursor));
167         ActionManager::session_sensitive_actions.push_back (act);
168         act = ActionManager::register_action (editor_actions, "mute-unmute-region", _("mute/unmute region"), mem_fun(*this, &Editor::kbd_mute_unmute_region));
169         ActionManager::session_sensitive_actions.push_back (act);
170         act = ActionManager::register_action (editor_actions, "set-playhead", _("set playhead"), mem_fun(*this, &Editor::kbd_set_playhead_cursor));
171         ActionManager::session_sensitive_actions.push_back (act);
172         act = ActionManager::register_action (editor_actions, "split-region", _("split region"), mem_fun(*this, &Editor::kbd_split));
173         ActionManager::session_sensitive_actions.push_back (act);
174         act = ActionManager::register_action (editor_actions, "set-region-sync-position", _("set region sync position"), mem_fun(*this, &Editor::kbd_set_sync_position));
175         ActionManager::session_sensitive_actions.push_back (act);
176
177         act = ActionManager::register_action (editor_actions, "undo", _("undo"), bind (mem_fun(*this, &Editor::undo), 1U));
178         ActionManager::session_sensitive_actions.push_back (act);
179         act = ActionManager::register_action (editor_actions, "redo", _("redo"), bind (mem_fun(*this, &Editor::redo), 1U));
180         ActionManager::session_sensitive_actions.push_back (act);
181
182         act = ActionManager::register_action (editor_actions, "export-session", _("export session"), mem_fun(*this, &Editor::export_session));
183         ActionManager::session_sensitive_actions.push_back (act);
184         act = ActionManager::register_action (editor_actions, "export-range", _("export range"), mem_fun(*this, &Editor::export_selection));
185         ActionManager::session_sensitive_actions.push_back (act);
186
187         act = ActionManager::register_action (editor_actions, "editor-cut", _("Cut"), mem_fun(*this, &Editor::cut));
188         ActionManager::session_sensitive_actions.push_back (act);
189         act = ActionManager::register_action (editor_actions, "editor-copy", _("Copy"), mem_fun(*this, &Editor::copy));
190         ActionManager::session_sensitive_actions.push_back (act);
191         act = ActionManager::register_action (editor_actions, "editor-paste", _("Paste"), mem_fun(*this, &Editor::keyboard_paste));
192         ActionManager::session_sensitive_actions.push_back (act);
193         act = ActionManager::register_action (editor_actions, "duplicate-region", _("duplicate region"), mem_fun(*this, &Editor::keyboard_duplicate_region));
194         ActionManager::session_sensitive_actions.push_back (act);
195         act = ActionManager::register_action (editor_actions, "duplicate-range", _("duplicate range"), mem_fun(*this, &Editor::keyboard_duplicate_selection));
196         ActionManager::session_sensitive_actions.push_back (act);
197         act = ActionManager::register_action (editor_actions, "insert-region", _("insert region"), mem_fun(*this, &Editor::keyboard_insert_region_list_selection));
198         ActionManager::session_sensitive_actions.push_back (act);
199         act = ActionManager::register_action (editor_actions, "reverse-region", _("reverse region"), mem_fun(*this, &Editor::reverse_region));
200         ActionManager::session_sensitive_actions.push_back (act);
201         act = ActionManager::register_action (editor_actions, "normalize-region", _("normalize region"), mem_fun(*this, &Editor::normalize_region));
202         ActionManager::session_sensitive_actions.push_back (act);
203         act = ActionManager::register_action (editor_actions, "crop", _("crop"), mem_fun(*this, &Editor::crop_region_to_selection));
204         ActionManager::session_sensitive_actions.push_back (act);
205         act = ActionManager::register_action (editor_actions, "insert-chunk", _("insert chunk"), bind (mem_fun(*this, &Editor::paste_named_selection), 1.0f));
206         ActionManager::session_sensitive_actions.push_back (act);
207
208         act = ActionManager::register_action (editor_actions, "split-at-edit-cursor", _("split at edit cursor"), mem_fun(*this, &Editor::split_region));
209         ActionManager::edit_cursor_in_region_sensitive_actions.push_back (act);
210
211         act = ActionManager::register_action (editor_actions, "start-range", _("start range"), mem_fun(*this, &Editor::keyboard_selection_begin));
212         ActionManager::session_sensitive_actions.push_back (act);
213         act = ActionManager::register_action (editor_actions, "finish-range", _("finish range"), bind (mem_fun(*this, &Editor::keyboard_selection_finish), false));
214         ActionManager::session_sensitive_actions.push_back (act);
215         act = ActionManager::register_action (editor_actions, "finish-add-range", _("finish add range"), bind (mem_fun(*this, &Editor::keyboard_selection_finish), true));
216         ActionManager::session_sensitive_actions.push_back (act);
217
218         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));
219         ActionManager::session_sensitive_actions.push_back (act);
220         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));
221         ActionManager::session_sensitive_actions.push_back (act);
222
223         act = ActionManager::register_toggle_action (editor_actions, "ToggleFollowPlayhead", _("follow playhead"), (mem_fun(*this, &Editor::toggle_follow_playhead)));
224         ActionManager::session_sensitive_actions.push_back (act);
225         act = ActionManager::register_action (editor_actions, "remove-last-capture", _("remove last capture"), (mem_fun(*this, &Editor::remove_last_capture)));
226         ActionManager::session_sensitive_actions.push_back (act);
227
228         Glib::RefPtr<ActionGroup> zoom_actions = ActionGroup::create (X_("Zoom"));
229         RadioAction::Group zoom_group;
230
231         ActionManager::register_radio_action (zoom_actions, zoom_group, "zoom-focus-left", _("zoom focus left"), bind (mem_fun(*this, &Editor::set_zoom_focus), Editing::ZoomFocusLeft));
232         ActionManager::session_sensitive_actions.push_back (act);
233         ActionManager::register_radio_action (zoom_actions, zoom_group, "zoom-focus-right", _("zoom focus right"), bind (mem_fun(*this, &Editor::set_zoom_focus), Editing::ZoomFocusRight));
234         ActionManager::session_sensitive_actions.push_back (act);
235         ActionManager::register_radio_action (zoom_actions, zoom_group, "zoom-focus-center", _("zoom focus center"), bind (mem_fun(*this, &Editor::set_zoom_focus), Editing::ZoomFocusCenter));
236         ActionManager::session_sensitive_actions.push_back (act);
237         ActionManager::register_radio_action (zoom_actions, zoom_group, "zoom-focus-playhead", _("zoom focus playhead"), bind (mem_fun(*this, &Editor::set_zoom_focus), Editing::ZoomFocusPlayhead));
238         ActionManager::session_sensitive_actions.push_back (act);
239         ActionManager::register_radio_action (zoom_actions, zoom_group, "zoom-focus-edit", _("zoom focus edit"), bind (mem_fun(*this, &Editor::set_zoom_focus), Editing::ZoomFocusEdit));
240         ActionManager::session_sensitive_actions.push_back (act);
241
242         Glib::RefPtr<ActionGroup> mouse_mode_actions = ActionGroup::create (X_("MouseMode"));
243         RadioAction::Group mouse_mode_group;
244
245         ActionManager::register_radio_action (mouse_mode_actions, mouse_mode_group, "set-mouse-mode-object", _("set mouse mode object"), bind (mem_fun(*this, &Editor::set_mouse_mode), Editing::MouseObject, false));
246         ActionManager::register_radio_action (mouse_mode_actions, mouse_mode_group, "set-mouse-mode-range", _("set mouse mode range"), bind (mem_fun(*this, &Editor::set_mouse_mode), Editing::MouseRange, false));
247         ActionManager::register_radio_action (mouse_mode_actions, mouse_mode_group, "set-mouse-mode-gain", _("set mouse mode gain"), bind (mem_fun(*this, &Editor::set_mouse_mode), Editing::MouseGain, false));
248         ActionManager::register_radio_action (mouse_mode_actions, mouse_mode_group, "set-mouse-mode-zoom", _("set mouse mode zoom"), bind (mem_fun(*this, &Editor::set_mouse_mode), Editing::MouseZoom, false));
249         ActionManager::register_radio_action (mouse_mode_actions, mouse_mode_group, "set-mouse-mode-timefx", _("set mouse mode timefx"), bind (mem_fun(*this, &Editor::set_mouse_mode), Editing::MouseTimeFX, false));
250
251         Glib::RefPtr<ActionGroup> snap_actions = ActionGroup::create (X_("Snap"));
252         RadioAction::Group snap_choice_group;
253
254         ActionManager::register_action (editor_actions, X_("SnapTo"), _("Snap To"));
255
256         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)));
257         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)));
258         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)));
259         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)));
260         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)));
261         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)));
262         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)));
263         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)));
264         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)));
265         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)));
266         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)));
267         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)));
268         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)));
269         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)));
270         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)));
271         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)));
272         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)));
273         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)));
274         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)));
275         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)));
276
277         /* REGION LIST */
278
279         Glib::RefPtr<ActionGroup> rl_actions = ActionGroup::create (X_("RegionList"));
280         RadioAction::Group sort_type_group;
281         RadioAction::Group sort_order_group;
282
283         /* the region list popup menu */
284         ActionManager::register_action (rl_actions, X_("RegionListSort"), _("Sort"));
285
286         act = ActionManager::register_action (rl_actions, X_("rlAudition"), _("Audition"), mem_fun(*this, &Editor::audition_region_from_region_list));
287         ActionManager::region_list_selection_sensitive_actions.push_back (act);
288         act = ActionManager::register_action (rl_actions, X_("rlHide"), _("Hide"), mem_fun(*this, &Editor::hide_region_from_region_list));
289         ActionManager::region_list_selection_sensitive_actions.push_back (act);
290         act = ActionManager::register_action (rl_actions, X_("rlRemove"), _("Remove"), mem_fun (*this, &Editor::remove_region_from_region_list));
291         ActionManager::region_list_selection_sensitive_actions.push_back (act);
292         ActionManager::register_toggle_action (rl_actions, X_("rlShowAll"), _("Show all"), mem_fun(*this, &Editor::toggle_full_region_list));
293         ActionManager::register_toggle_action (rl_actions, X_("rlShowAuto"), _("Show automatic regions"), mem_fun(*this, &Editor::toggle_show_auto_regions));
294
295         ActionManager::register_radio_action (rl_actions, sort_order_group, X_("SortAscending"),  _("Ascending"),
296                                bind (mem_fun(*this, &Editor::reset_region_list_sort_direction), true));
297         ActionManager::register_radio_action (rl_actions, sort_order_group, X_("SortDescending"),   _("Descending"),
298                                bind (mem_fun(*this, &Editor::reset_region_list_sort_direction), false));
299         
300         ActionManager::register_radio_action (rl_actions, sort_type_group, X_("SortByRegionName"),  _("By Region Name"),
301                                bind (mem_fun(*this, &Editor::reset_region_list_sort_type), ByName));
302         ActionManager::register_radio_action (rl_actions, sort_type_group, X_("SortByRegionLength"),  _("By Region Length"),
303                                bind (mem_fun(*this, &Editor::reset_region_list_sort_type), ByLength));
304         ActionManager::register_radio_action (rl_actions, sort_type_group, X_("SortByRegionPosition"),  _("By Region Position"),
305                                bind (mem_fun(*this, &Editor::reset_region_list_sort_type), ByPosition));
306         ActionManager::register_radio_action (rl_actions, sort_type_group, X_("SortByRegionTimestamp"),  _("By Region Timestamp"),
307                                bind (mem_fun(*this, &Editor::reset_region_list_sort_type), ByTimestamp));
308         ActionManager::register_radio_action (rl_actions, sort_type_group, X_("SortByRegionStartinFile"),  _("By Region Start in File"),
309                                bind (mem_fun(*this, &Editor::reset_region_list_sort_type), ByStartInFile));
310         ActionManager::register_radio_action (rl_actions, sort_type_group, X_("SortByRegionEndinFile"),  _("By Region End in File"),
311                                bind (mem_fun(*this, &Editor::reset_region_list_sort_type), ByEndInFile));
312         ActionManager::register_radio_action (rl_actions, sort_type_group, X_("SortBySourceFileName"),  _("By Source File Name"),
313                                bind (mem_fun(*this, &Editor::reset_region_list_sort_type), BySourceFileName));
314         ActionManager::register_radio_action (rl_actions, sort_type_group, X_("SortBySourceFileLength"),  _("By Source File Length"),
315                                bind (mem_fun(*this, &Editor::reset_region_list_sort_type), BySourceFileLength));
316         ActionManager::register_radio_action (rl_actions, sort_type_group, X_("SortBySourceFileCreationDate"),  _("By Source File Creation Date"),
317                                bind (mem_fun(*this, &Editor::reset_region_list_sort_type), BySourceFileCreationDate));
318         ActionManager::register_radio_action (rl_actions, sort_type_group, X_("SortBySourceFilesystem"),  _("By Source Filesystem"),
319                                bind (mem_fun(*this, &Editor::reset_region_list_sort_type), BySourceFileFS));
320         
321         act = ActionManager::register_action (rl_actions, X_("rlEmbedAudio"), _("Embed audio (link)"), mem_fun(*this, &Editor::embed_audio));
322         ActionManager::session_sensitive_actions.push_back (act);
323         act = ActionManager::register_action (rl_actions, X_("rlImportAudio"), _("Embed audio (link)"), bind (mem_fun(*this, &Editor::import_audio), false));
324         ActionManager::session_sensitive_actions.push_back (act);
325
326         ActionManager::register_toggle_action (editor_actions, X_("ToggleWaveformVisibility"), _("show waveforms"), mem_fun (*this, &Editor::toggle_waveform_visibility));
327         ActionManager::register_toggle_action (editor_actions, X_("ToggleWaveformsWhileRecording"), _("show waveforms while recording"), mem_fun (*this, &Editor::toggle_waveforms_while_recording));
328         act = ActionManager::register_toggle_action (editor_actions, X_("ToggleMeasureVisibility"), _("show measures"), mem_fun (*this, &Editor::toggle_measure_visibility));
329         
330         RadioAction::Group meter_falloff_group;
331         RadioAction::Group meter_hold_group;
332
333         /*
334             Slowest = 6.6dB/sec falloff at update rate of 40ms
335             Slow    = 6.8dB/sec falloff at update rate of 40ms
336         */
337
338         ActionManager::register_radio_action (editor_actions, meter_falloff_group, X_("MeterFalloffOff"), _("off"), bind (mem_fun (*this, &Editor::set_meter_falloff), 0.0f));
339         ActionManager::register_radio_action (editor_actions, meter_falloff_group, X_("MeterFalloffSlowest"), _("slowest"), bind (mem_fun (*this, &Editor::set_meter_falloff), 0.266f)); 
340         ActionManager::register_radio_action (editor_actions, meter_falloff_group, X_("MeterFalloffSlow"), _("slow"), bind (mem_fun (*this, &Editor::set_meter_falloff), 0.342f));
341         ActionManager::register_radio_action (editor_actions, meter_falloff_group, X_("MeterFalloffMedium"), _("medium"), bind (mem_fun (*this, &Editor::set_meter_falloff), 0.7f));
342         ActionManager::register_radio_action (editor_actions, meter_falloff_group, X_("MeterFalloffFast"), _("fast"), bind (mem_fun (*this, &Editor::set_meter_falloff), 1.1f));
343         ActionManager::register_radio_action (editor_actions, meter_falloff_group, X_("MeterFalloffFaster"), _("faster"), bind (mem_fun (*this, &Editor::set_meter_falloff), 1.5f));
344         ActionManager::register_radio_action (editor_actions, meter_falloff_group, X_("MeterFalloffFastest"), _("fastest"), bind (mem_fun (*this, &Editor::set_meter_falloff), 2.5f));
345
346         ActionManager::register_radio_action (editor_actions, meter_hold_group,  X_("MeterHoldOff"), _("off"), bind (mem_fun (*this, &Editor::set_meter_hold), 0));
347         ActionManager::register_radio_action (editor_actions, meter_hold_group,  X_("MeterHoldShort"), _("short"), bind (mem_fun (*this, &Editor::set_meter_hold), 40));
348         ActionManager::register_radio_action (editor_actions, meter_hold_group,  X_("MeterHoldMedium"), _("medium"), bind (mem_fun (*this, &Editor::set_meter_hold), 100));
349         ActionManager::register_radio_action (editor_actions, meter_hold_group,  X_("MeterHoldLong"), _("long"), bind (mem_fun (*this, &Editor::set_meter_hold), 200));
350
351         ActionManager::add_action_group (rl_actions);
352         ActionManager::add_action_group (zoom_actions);
353         ActionManager::add_action_group (mouse_mode_actions);
354         ActionManager::add_action_group (snap_actions);
355         ActionManager::add_action_group (editor_actions);
356 }
357
358 void
359 Editor::toggle_waveform_visibility ()
360 {
361         Glib::RefPtr<Action> act = ActionManager::get_action (X_("Editor"), X_("ToggleWaveformVisibility"));
362         if (act) {
363                 Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic(act);
364                 set_show_waveforms (tact->get_active());
365         }
366 }
367
368 void
369 Editor::toggle_waveforms_while_recording ()
370 {
371         Glib::RefPtr<Action> act = ActionManager::get_action (X_("Editor"), X_("ToggleWaveformVisibility"));
372         if (act) {
373                 Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic(act);
374                 set_show_waveforms_recording (tact->get_active());
375         }
376 }
377
378 void
379 Editor::toggle_measure_visibility ()
380 {
381         Glib::RefPtr<Action> act = ActionManager::get_action (X_("Editor"), X_("ToggleMeasureVisibility"));
382         if (act) {
383                 Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic(act);
384                 set_show_measures (tact->get_active());
385         }
386 }
387