2 Copyright (C) 20002-2004 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.
21 #include "gtk2ardour-config.h"
24 /* This file contains any ARDOUR_UI methods that require knowledge of
25 the editor, and exists so that no compilation dependency exists
26 between the main ARDOUR_UI modules and the PublicEditor class. This
27 is to cut down on the nasty compile times for both these classes.
32 #include <glibmm/miscutils.h>
33 #include <gtkmm/accelmap.h>
36 #include "gtkmm2ext/cairo_packer.h"
37 #include "gtkmm2ext/tearoff.h"
38 #include "gtkmm2ext/utils.h"
39 #include "gtkmm2ext/window_title.h"
41 #include "pbd/file_utils.h"
43 #include "pbd/convert.h"
45 #include "ardour_ui.h"
46 #include "public_editor.h"
47 #include "audio_clock.h"
49 #include "monitor_section.h"
50 #include "engine_dialog.h"
53 #include "meterbridge.h"
56 #include "window_manager.h"
57 #include "global_port_matrix.h"
58 #include "location_ui.h"
59 #include "main_clock.h"
60 #include "rc_option_editor.h"
62 #include <gtkmm2ext/application.h>
64 #include "ardour/session.h"
65 #include "ardour/profile.h"
66 #include "ardour/audioengine.h"
68 #include "control_protocol/control_protocol.h"
73 using namespace ARDOUR;
75 using namespace Gtkmm2ext;
80 ARDOUR_UI::create_editor ()
83 editor = new Editor ();
84 editor->StateChange.connect (sigc::mem_fun (*this, &ARDOUR_UI::tabbable_state_change));
87 catch (failed_constructor& err) {
91 editor->signal_event().connect (sigc::bind (sigc::ptr_fun (&Keyboard::catch_user_event_for_pre_dialog_focus), editor));
97 ARDOUR_UI::install_actions ()
99 Glib::RefPtr<ActionGroup> main_actions = global_actions.create_action_group (X_("Main"));
100 Glib::RefPtr<ActionGroup> main_menu_actions = global_actions.create_action_group (X_("Main_menu"));
101 Glib::RefPtr<Action> act;
103 /* menus + submenus that need action items */
105 global_actions.register_action (main_menu_actions, X_("Session"), _("Session"));
106 act = global_actions.register_action (main_menu_actions, X_("Cleanup"), _("Clean-up"));
107 ActionManager::write_sensitive_actions.push_back (act);
108 global_actions.register_action (main_menu_actions, X_("Sync"), _("Sync"));
109 global_actions.register_action (main_menu_actions, X_("TransportOptions"), _("Options"));
110 global_actions.register_action (main_menu_actions, X_("WindowMenu"), _("Window"));
111 global_actions.register_action (main_menu_actions, X_("MixerMenu"), _("Mixer"));
112 global_actions.register_action (main_menu_actions, X_("EditorMenu"), _("Editor"));
113 global_actions.register_action (main_menu_actions, X_("PrefsMenu"), _("Preferences"));
114 global_actions.register_action (main_menu_actions, X_("DetachMenu"), _("Detach"));
115 global_actions.register_action (main_menu_actions, X_("Help"), _("Help"));
116 global_actions.register_action (main_menu_actions, X_("KeyMouseActions"), _("Misc. Shortcuts"));
117 global_actions.register_action (main_menu_actions, X_("AudioFileFormat"), _("Audio File Format"));
118 global_actions.register_action (main_menu_actions, X_("AudioFileFormatHeader"), _("File Type"));
119 global_actions.register_action (main_menu_actions, X_("AudioFileFormatData"), _("Sample Format"));
120 global_actions.register_action (main_menu_actions, X_("ControlSurfaces"), _("Control Surfaces"));
121 global_actions.register_action (main_menu_actions, X_("Plugins"), _("Plugins"));
122 global_actions.register_action (main_menu_actions, X_("Metering"), _("Metering"));
123 global_actions.register_action (main_menu_actions, X_("MeteringFallOffRate"), _("Fall Off Rate"));
124 global_actions.register_action (main_menu_actions, X_("MeteringHoldTime"), _("Hold Time"));
125 global_actions.register_action (main_menu_actions, X_("Denormals"), _("Denormal Handling"));
127 /* the real actions */
129 act = global_actions.register_action (main_actions, X_("New"), _("New..."), hide_return (sigc::bind (sigc::mem_fun(*this, &ARDOUR_UI::get_session_parameters), false, true, "")));
131 global_actions.register_action (main_actions, X_("Open"), _("Open..."), sigc::mem_fun(*this, &ARDOUR_UI::open_session));
132 global_actions.register_action (main_actions, X_("Recent"), _("Recent..."), sigc::mem_fun(*this, &ARDOUR_UI::open_recent_session));
133 act = global_actions.register_action (main_actions, X_("Close"), _("Close"), sigc::mem_fun(*this, &ARDOUR_UI::close_session));
134 ActionManager::session_sensitive_actions.push_back (act);
136 act = global_actions.register_action (main_actions, X_("AddTrackBus"), _("Add Track or Bus..."),
137 sigc::bind (sigc::mem_fun(*this, &ARDOUR_UI::add_route), (Gtk::Window*) 0));
138 ActionManager::session_sensitive_actions.push_back (act);
139 ActionManager::write_sensitive_actions.push_back (act);
141 act = global_actions.register_action (main_actions, X_("duplicate-routes"), _("Duplicate Tracks/Busses..."),
142 sigc::mem_fun(*this, &ARDOUR_UI::start_duplicate_routes));
143 ActionManager::session_sensitive_actions.push_back (act);
144 ActionManager::write_sensitive_actions.push_back (act);
145 ActionManager::track_selection_sensitive_actions.push_back (act);
147 act = global_actions.register_action (main_actions, X_("cancel-solo"), _("Cancel Solo"), sigc::mem_fun(*this, &ARDOUR_UI::cancel_solo));
148 ActionManager::session_sensitive_actions.push_back (act);
149 ActionManager::write_sensitive_actions.push_back (act);
151 act = global_actions.register_action (main_actions, X_("OpenVideo"), _("Open Video"),
152 sigc::bind (sigc::mem_fun(*this, &ARDOUR_UI::add_video), (Gtk::Window*) 0));
153 ActionManager::session_sensitive_actions.push_back (act);
154 act = global_actions.register_action (main_actions, X_("CloseVideo"), _("Remove Video"),
155 sigc::mem_fun (*this, &ARDOUR_UI::remove_video));
156 act->set_sensitive (false);
157 act = global_actions.register_action (main_actions, X_("ExportVideo"), _("Export to Video File"),
158 hide_return (sigc::bind (sigc::mem_fun(*this, &ARDOUR_UI::export_video), false)));
159 ActionManager::session_sensitive_actions.push_back (act);
161 act = global_actions.register_action (main_actions, X_("SnapshotStay"), _("Snapshot (& keep working on current version) ..."), sigc::bind (sigc::mem_fun(*this, &ARDOUR_UI::snapshot_session), false));
162 ActionManager::session_sensitive_actions.push_back (act);
163 ActionManager::write_sensitive_actions.push_back (act);
165 act = global_actions.register_action (main_actions, X_("SnapshotSwitch"), _("Snapshot (& switch to new version) ..."), sigc::bind (sigc::mem_fun(*this, &ARDOUR_UI::snapshot_session), true));
166 ActionManager::session_sensitive_actions.push_back (act);
167 ActionManager::write_sensitive_actions.push_back (act);
169 act = global_actions.register_action (main_actions, X_("QuickSnapshotStay"), _("Quick Snapshot(& keep working on current version) ..."), sigc::bind (sigc::mem_fun(*this, &ARDOUR_UI::quick_snapshot_session), false));
170 ActionManager::session_sensitive_actions.push_back (act);
171 ActionManager::write_sensitive_actions.push_back (act);
173 act = global_actions.register_action (main_actions, X_("QuickSnapshotSwitch"), _("Quick Snapshot (& switch to new version) ..."), sigc::bind (sigc::mem_fun(*this, &ARDOUR_UI::quick_snapshot_session), true));
174 ActionManager::session_sensitive_actions.push_back (act);
175 ActionManager::write_sensitive_actions.push_back (act);
177 act = global_actions.register_action (main_actions, X_("SaveAs"), _("Save As..."), sigc::mem_fun(*this, &ARDOUR_UI::save_session_as));
178 ActionManager::session_sensitive_actions.push_back (act);
179 ActionManager::write_sensitive_actions.push_back (act);
181 act = global_actions.register_action (main_actions, X_("Rename"), _("Rename..."), sigc::mem_fun(*this, &ARDOUR_UI::rename_session));
182 ActionManager::session_sensitive_actions.push_back (act);
183 ActionManager::write_sensitive_actions.push_back (act);
185 act = global_actions.register_action (main_actions, X_("SaveTemplate"), _("Save Template..."), sigc::mem_fun(*this, &ARDOUR_UI::save_template));
186 ActionManager::session_sensitive_actions.push_back (act);
188 act = global_actions.register_action (main_actions, X_("Metadata"), _("Metadata"));
189 ActionManager::session_sensitive_actions.push_back (act);
191 act = global_actions.register_action (main_actions, X_("EditMetadata"), _("Edit Metadata..."), sigc::mem_fun(*this, &ARDOUR_UI::edit_metadata));
192 ActionManager::session_sensitive_actions.push_back (act);
194 act = global_actions.register_action (main_actions, X_("ImportMetadata"), _("Import Metadata..."), sigc::mem_fun(*this, &ARDOUR_UI::import_metadata));
195 ActionManager::session_sensitive_actions.push_back (act);
197 act = global_actions.register_action (main_actions, X_("ExportAudio"), _("Export to Audio File(s)..."), sigc::mem_fun (*editor, &PublicEditor::export_audio));
198 ActionManager::session_sensitive_actions.push_back (act);
200 act = global_actions.register_action (main_actions, X_("StemExport"), _("Stem export..."), sigc::mem_fun (*editor, &PublicEditor::stem_export));
201 ActionManager::session_sensitive_actions.push_back (act);
203 act = global_actions.register_action (main_actions, X_("Export"), _("Export"));
204 ActionManager::session_sensitive_actions.push_back (act);
206 act = global_actions.register_action (main_actions, X_("CleanupUnused"), _("Clean-up Unused Sources..."), sigc::mem_fun (*(ARDOUR_UI::instance()), &ARDOUR_UI::cleanup));
207 ActionManager::session_sensitive_actions.push_back (act);
208 ActionManager::write_sensitive_actions.push_back (act);
210 act = global_actions.register_action (main_actions, X_("CleanupPeakFiles"), _("Reset Peak Files"), sigc::mem_fun (*(ARDOUR_UI::instance()), &ARDOUR_UI::cleanup_peakfiles));
211 ActionManager::session_sensitive_actions.push_back (act);
212 ActionManager::write_sensitive_actions.push_back (act);
214 act = global_actions.register_action (main_actions, X_("FlushWastebasket"), _("Flush Wastebasket"), sigc::mem_fun (*(ARDOUR_UI::instance()), &ARDOUR_UI::flush_trash));
216 ActionManager::write_sensitive_actions.push_back (act);
217 ActionManager::session_sensitive_actions.push_back (act);
219 /* these actions are intended to be shared across all windows */
221 common_actions = global_actions.create_action_group (X_("Common"));
222 global_actions.register_action (common_actions, X_("Quit"), _("Quit"), (hide_return (sigc::mem_fun(*this, &ARDOUR_UI::finish))));
223 global_actions.register_action (common_actions, X_("Hide"), _("Hide"), sigc::mem_fun (*this, &ARDOUR_UI::hide_application));
225 global_actions.register_action (common_actions, X_("show-editor"), _("Show"), sigc::bind (sigc::mem_fun (*this, &ARDOUR_UI::show_tabbable), editor));
226 global_actions.register_action (common_actions, X_("show-mixer"), _("Show"), sigc::bind (sigc::mem_fun (*this, &ARDOUR_UI::show_tabbable), mixer));
227 global_actions.register_action (common_actions, X_("show-preferences"), _("Show"), sigc::bind (sigc::mem_fun (*this, &ARDOUR_UI::show_tabbable), rc_option_editor));
228 global_actions.register_action (common_actions, X_("menu-show-preferences"), _("Preferences"), sigc::bind (sigc::mem_fun (*this, &ARDOUR_UI::show_tabbable), rc_option_editor));
230 global_actions.register_action (common_actions, X_("hide-editor"), _("Hide"), sigc::bind (sigc::mem_fun (*this, &ARDOUR_UI::hide_tabbable), editor));
231 global_actions.register_action (common_actions, X_("hide-mixer"), _("Hide"), sigc::bind (sigc::mem_fun (*this, &ARDOUR_UI::hide_tabbable), mixer));
232 global_actions.register_action (common_actions, X_("hide-preferences"), _("Hide"), sigc::bind (sigc::mem_fun (*this, &ARDOUR_UI::hide_tabbable), rc_option_editor));
234 global_actions.register_action (common_actions, X_("attach-editor"), _("Attach"), sigc::bind (sigc::mem_fun (*this, &ARDOUR_UI::attach_tabbable), editor));
235 global_actions.register_action (common_actions, X_("attach-mixer"), _("Attach"), sigc::bind (sigc::mem_fun (*this, &ARDOUR_UI::attach_tabbable), mixer));
236 global_actions.register_action (common_actions, X_("attach-preferences"), _("Attach"), sigc::bind (sigc::mem_fun (*this, &ARDOUR_UI::attach_tabbable), rc_option_editor));
238 global_actions.register_action (common_actions, X_("detach-editor"), _("Detach"), sigc::bind (sigc::mem_fun (*this, &ARDOUR_UI::detach_tabbable), editor));
239 global_actions.register_action (common_actions, X_("detach-mixer"), _("Detach"), sigc::bind (sigc::mem_fun (*this, &ARDOUR_UI::detach_tabbable), mixer));
240 global_actions.register_action (common_actions, X_("detach-preferences"), _("Detach"), sigc::bind (sigc::mem_fun (*this, &ARDOUR_UI::detach_tabbable), rc_option_editor));
242 /* These "change" actions are not intended to be used inside menus, but
243 are for the tab/window control buttons, which have somewhat odd
246 global_actions.register_action (common_actions, X_("change-editor-visibility"), _("Change"), sigc::bind (sigc::mem_fun (*this, &ARDOUR_UI::button_change_tabbable_visibility), editor));
247 global_actions.register_action (common_actions, X_("change-mixer-visibility"), _("Change"), sigc::bind (sigc::mem_fun (*this, &ARDOUR_UI::button_change_tabbable_visibility), mixer));
248 global_actions.register_action (common_actions, X_("change-preferences-visibility"), _("Change"), sigc::bind (sigc::mem_fun (*this, &ARDOUR_UI::button_change_tabbable_visibility), rc_option_editor));
250 /* These "change" actions are not intended to be used inside menus, but
251 are for the tab/window control key bindings, which have somewhat odd
254 global_actions.register_action (common_actions, X_("key-change-editor-visibility"), _("Change"), sigc::bind (sigc::mem_fun (*this, &ARDOUR_UI::key_change_tabbable_visibility), editor));
255 global_actions.register_action (common_actions, X_("key-change-mixer-visibility"), _("Change"), sigc::bind (sigc::mem_fun (*this, &ARDOUR_UI::key_change_tabbable_visibility), mixer));
256 global_actions.register_action (common_actions, X_("key-change-preferences-visibility"), _("Change"), sigc::bind (sigc::mem_fun (*this, &ARDOUR_UI::key_change_tabbable_visibility), rc_option_editor));
258 global_actions.register_action (common_actions, X_("toggle-editor-and-mixer"), _("Toggle Editor & Mixer"), sigc::mem_fun (*this, &ARDOUR_UI::toggle_editor_and_mixer));
260 /* windows visibility actions */
262 global_actions.register_toggle_action (common_actions, X_("ToggleMaximalEditor"), _("Maximise Editor Space"), sigc::mem_fun (*this, &ARDOUR_UI::toggle_editing_space));
263 global_actions.register_toggle_action (common_actions, X_("ToggleMaximalMixer"), _("Maximise Mixer Space"), sigc::mem_fun (*this, &ARDOUR_UI::toggle_mixer_space));
264 ActionManager::session_sensitive_actions.push_back (act);
266 act = global_actions.register_toggle_action (common_actions, X_("ToggleMixerList"), _("Toggle Mixer List"), sigc::mem_fun (*this, &ARDOUR_UI::toggle_mixer_list));
267 ActionManager::session_sensitive_actions.push_back (act);
269 act = global_actions.register_toggle_action (common_actions, X_("ToggleMonitorSection"), _("Toggle Monitor Section Visibility"), sigc::mem_fun (*this, &ARDOUR_UI::toggle_monitor_section_visibility));
270 act->set_sensitive (false);
272 if (Profile->get_mixbus()) {
273 global_actions.register_action (common_actions, X_("show-ui-prefs"), _("Show more UI preferences"), sigc::mem_fun (*this, &ARDOUR_UI::show_ui_prefs));
276 global_actions.register_action (common_actions, X_("toggle-meterbridge"), S_("Window|Meterbridge"), sigc::mem_fun(*this, &ARDOUR_UI::toggle_meterbridge));
278 act = global_actions.register_action (common_actions, X_("NewMIDITracer"), _("MIDI Tracer"), sigc::mem_fun(*this, &ARDOUR_UI::new_midi_tracer_window));
279 ActionManager::session_sensitive_actions.push_back (act);
281 global_actions.register_action (common_actions, X_("chat"), _("Chat"), sigc::mem_fun(*this, &ARDOUR_UI::launch_chat));
282 /** TRANSLATORS: This is `Manual' in the sense of an instruction book that tells a user how to use Ardour */
283 global_actions.register_action (common_actions, X_("manual"), S_("Help|Manual"), mem_fun(*this, &ARDOUR_UI::launch_manual));
284 global_actions.register_action (common_actions, X_("reference"), S_("Manual|Reference"), mem_fun(*this, &ARDOUR_UI::launch_reference));
285 global_actions.register_action (common_actions, X_("tracker"), _("Report a Bug"), mem_fun(*this, &ARDOUR_UI::launch_tracker));
286 global_actions.register_action (common_actions, X_("cheat-sheet"), _("Cheat Sheet"), mem_fun(*this, &ARDOUR_UI::launch_cheat_sheet));
287 global_actions.register_action (common_actions, X_("website"), _("Ardour Website"), mem_fun(*this, &ARDOUR_UI::launch_website));
288 global_actions.register_action (common_actions, X_("website-dev"), _("Ardour Development"), mem_fun(*this, &ARDOUR_UI::launch_website_dev));
289 global_actions.register_action (common_actions, X_("forums"), _("User Forums"), mem_fun(*this, &ARDOUR_UI::launch_forums));
290 global_actions.register_action (common_actions, X_("howto-report"), _("How to Report a Bug"), mem_fun(*this, &ARDOUR_UI::launch_howto_report));
292 act = global_actions.register_action (common_actions, X_("Save"), _("Save"), sigc::hide_return (sigc::bind (sigc::mem_fun(*this, &ARDOUR_UI::save_state), string(""), false)));
293 ActionManager::session_sensitive_actions.push_back (act);
294 ActionManager::write_sensitive_actions.push_back (act);
296 Glib::RefPtr<ActionGroup> transport_actions = global_actions.create_action_group (X_("Transport"));
298 /* do-nothing action for the "transport" menu bar item */
300 global_actions.register_action (transport_actions, X_("Transport"), _("Transport"));
302 /* these two are not used by key bindings, instead use ToggleRoll for that. these two do show up in
303 menus and via button proxies.
306 act = global_actions.register_action (transport_actions, X_("Stop"), _("Stop"), sigc::mem_fun(*this, &ARDOUR_UI::transport_stop));
307 ActionManager::session_sensitive_actions.push_back (act);
308 ActionManager::transport_sensitive_actions.push_back (act);
309 act = global_actions.register_action (transport_actions, X_("Roll"), _("Roll"), sigc::mem_fun(*this, &ARDOUR_UI::transport_roll));
310 ActionManager::session_sensitive_actions.push_back (act);
311 ActionManager::transport_sensitive_actions.push_back (act);
313 act = global_actions.register_action (transport_actions, X_("ToggleRoll"), _("Start/Stop"), sigc::bind (sigc::mem_fun (*this, &ARDOUR_UI::toggle_roll), false, false));
314 ActionManager::session_sensitive_actions.push_back (act);
315 ActionManager::transport_sensitive_actions.push_back (act);
316 act = global_actions.register_action (transport_actions, X_("alternate-ToggleRoll"), _("Start/Stop"), sigc::bind (sigc::mem_fun (*this, &ARDOUR_UI::toggle_roll), false, false));
317 ActionManager::session_sensitive_actions.push_back (act);
318 ActionManager::transport_sensitive_actions.push_back (act);
319 act = global_actions.register_action (transport_actions, X_("ToggleRollMaybe"), _("Start/Continue/Stop"), sigc::bind (sigc::mem_fun (*this, &ARDOUR_UI::toggle_roll), false, true));
320 ActionManager::session_sensitive_actions.push_back (act);
321 ActionManager::transport_sensitive_actions.push_back (act);
322 act = global_actions.register_action (transport_actions, X_("ToggleRollForgetCapture"), _("Stop and Forget Capture"), sigc::bind (sigc::mem_fun(*this, &ARDOUR_UI::toggle_roll), true, false));
323 ActionManager::session_sensitive_actions.push_back (act);
324 ActionManager::transport_sensitive_actions.push_back (act);
326 /* these two behave as follows:
328 - if transport speed != 1.0 or != -1.0, change speed to 1.0 or -1.0 (respectively)
329 - otherwise do nothing
332 act = global_actions.register_action (transport_actions, X_("TransitionToRoll"), _("Transition to Roll"), sigc::bind (sigc::mem_fun (*editor, &PublicEditor::transition_to_rolling), true));
333 ActionManager::session_sensitive_actions.push_back (act);
334 ActionManager::transport_sensitive_actions.push_back (act);
336 act = global_actions.register_action (transport_actions, X_("TransitionToReverse"), _("Transition to Reverse"), sigc::bind (sigc::mem_fun (*editor, &PublicEditor::transition_to_rolling), false));
337 ActionManager::session_sensitive_actions.push_back (act);
338 ActionManager::transport_sensitive_actions.push_back (act);
340 act = global_actions.register_action (transport_actions, X_("Loop"), _("Play Loop Range"), sigc::mem_fun(*this, &ARDOUR_UI::toggle_session_auto_loop));
341 ActionManager::session_sensitive_actions.push_back (act);
342 ActionManager::transport_sensitive_actions.push_back (act);
343 act = global_actions.register_action (transport_actions, X_("PlaySelection"), _("Play Selection"), sigc::mem_fun(*this, &ARDOUR_UI::transport_play_selection));
344 ActionManager::session_sensitive_actions.push_back (act);
345 ActionManager::transport_sensitive_actions.push_back (act);
346 act = global_actions.register_action (transport_actions, X_("PlayPreroll"), _("Play Selection w/Preroll"), sigc::mem_fun(*this, &ARDOUR_UI::transport_play_preroll));
347 ActionManager::session_sensitive_actions.push_back (act);
348 ActionManager::transport_sensitive_actions.push_back (act);
350 act = global_actions.register_action (transport_actions, X_("Record"), _("Enable Record"), sigc::bind (sigc::mem_fun(*this, &ARDOUR_UI::transport_record), false));
351 ActionManager::session_sensitive_actions.push_back (act);
352 ActionManager::write_sensitive_actions.push_back (act);
353 act = global_actions.register_action (transport_actions, X_("record-roll"), _("Start Recording"), sigc::bind (sigc::mem_fun(*this, &ARDOUR_UI::transport_record), true));
354 ActionManager::session_sensitive_actions.push_back (act);
355 ActionManager::write_sensitive_actions.push_back (act);
356 ActionManager::transport_sensitive_actions.push_back (act);
357 act = global_actions.register_action (transport_actions, X_("alternate-record-roll"), _("Start Recording"), sigc::bind (sigc::mem_fun(*this, &ARDOUR_UI::transport_record), true));
358 ActionManager::session_sensitive_actions.push_back (act);
359 ActionManager::write_sensitive_actions.push_back (act);
360 ActionManager::transport_sensitive_actions.push_back (act);
361 act = global_actions.register_action (transport_actions, X_("Rewind"), _("Rewind"), sigc::bind (sigc::mem_fun(*this, &ARDOUR_UI::transport_rewind), 0));
362 ActionManager::session_sensitive_actions.push_back (act);
363 ActionManager::transport_sensitive_actions.push_back (act);
364 act = global_actions.register_action (transport_actions, X_("RewindSlow"), _("Rewind (Slow)"), sigc::bind (sigc::mem_fun(*this, &ARDOUR_UI::transport_rewind), -1));
365 ActionManager::session_sensitive_actions.push_back (act);
366 ActionManager::transport_sensitive_actions.push_back (act);
367 act = global_actions.register_action (transport_actions, X_("RewindFast"), _("Rewind (Fast)"), sigc::bind (sigc::mem_fun(*this, &ARDOUR_UI::transport_rewind), 1));
368 ActionManager::session_sensitive_actions.push_back (act);
369 ActionManager::transport_sensitive_actions.push_back (act);
370 act = global_actions.register_action (transport_actions, X_("Forward"), _("Forward"), sigc::bind (sigc::mem_fun(*this, &ARDOUR_UI::transport_forward), 0));
371 ActionManager::session_sensitive_actions.push_back (act);
372 ActionManager::transport_sensitive_actions.push_back (act);
373 act = global_actions.register_action (transport_actions, X_("ForwardSlow"), _("Forward (Slow)"), sigc::bind (sigc::mem_fun(*this, &ARDOUR_UI::transport_forward), -1));
374 ActionManager::session_sensitive_actions.push_back (act);
375 ActionManager::transport_sensitive_actions.push_back (act);
376 act = global_actions.register_action (transport_actions, X_("ForwardFast"), _("Forward (Fast)"), sigc::bind (sigc::mem_fun(*this, &ARDOUR_UI::transport_forward), 1));
377 ActionManager::session_sensitive_actions.push_back (act);
378 ActionManager::transport_sensitive_actions.push_back (act);
379 act = global_actions.register_action (transport_actions, X_("GotoZero"), _("Go to Zero"), sigc::mem_fun(*this, &ARDOUR_UI::transport_goto_zero));
380 ActionManager::session_sensitive_actions.push_back (act);
381 ActionManager::transport_sensitive_actions.push_back (act);
382 act = global_actions.register_action (transport_actions, X_("GotoStart"), _("Go to Start"), sigc::mem_fun(*this, &ARDOUR_UI::transport_goto_start));
383 ActionManager::session_sensitive_actions.push_back (act);
384 ActionManager::transport_sensitive_actions.push_back (act);
385 act = global_actions.register_action (transport_actions, X_("alternate-GotoStart"), _("Go to Start"), sigc::mem_fun(*this, &ARDOUR_UI::transport_goto_start));
386 ActionManager::session_sensitive_actions.push_back (act);
387 ActionManager::transport_sensitive_actions.push_back (act);
388 act = global_actions.register_action (transport_actions, X_("GotoEnd"), _("Go to End"), sigc::mem_fun(*this, &ARDOUR_UI::transport_goto_end));
389 ActionManager::session_sensitive_actions.push_back (act);
390 ActionManager::transport_sensitive_actions.push_back (act);
391 act = global_actions.register_action (transport_actions, X_("GotoWallClock"), _("Go to Wall Clock"), sigc::mem_fun(*this, &ARDOUR_UI::transport_goto_wallclock));
392 ActionManager::session_sensitive_actions.push_back (act);
393 ActionManager::transport_sensitive_actions.push_back (act);
395 //these actions handle the numpad events, ProTools style
396 act = global_actions.register_action (transport_actions, X_("numpad-decimal"), _("Numpad Decimal"), mem_fun(*this, &ARDOUR_UI::transport_numpad_decimal));
397 ActionManager::session_sensitive_actions.push_back (act);
398 ActionManager::transport_sensitive_actions.push_back (act);
399 act = global_actions.register_action (transport_actions, X_("alternate-numpad-decimal"), _("Numpad Decimal"), mem_fun(*this, &ARDOUR_UI::transport_numpad_decimal));
400 ActionManager::session_sensitive_actions.push_back (act);
401 ActionManager::transport_sensitive_actions.push_back (act);
402 act = global_actions.register_action (transport_actions, X_("numpad-0"), _("Numpad 0"), bind (mem_fun(*this, &ARDOUR_UI::transport_numpad_event), 0));
403 ActionManager::session_sensitive_actions.push_back (act);
404 ActionManager::transport_sensitive_actions.push_back (act);
405 act = global_actions.register_action (transport_actions, X_("numpad-1"), _("Numpad 1"), bind (mem_fun(*this, &ARDOUR_UI::transport_numpad_event), 1));
406 ActionManager::session_sensitive_actions.push_back (act);
407 ActionManager::transport_sensitive_actions.push_back (act);
408 act = global_actions.register_action (transport_actions, X_("numpad-2"), _("Numpad 2"), bind (mem_fun(*this, &ARDOUR_UI::transport_numpad_event), 2));
409 ActionManager::session_sensitive_actions.push_back (act);
410 ActionManager::transport_sensitive_actions.push_back (act);
411 act = global_actions.register_action (transport_actions, X_("numpad-3"), _("Numpad 3"), bind (mem_fun(*this, &ARDOUR_UI::transport_numpad_event), 3));
412 ActionManager::session_sensitive_actions.push_back (act);
413 ActionManager::transport_sensitive_actions.push_back (act);
414 act = global_actions.register_action (transport_actions, X_("numpad-4"), _("Numpad 4"), bind (mem_fun(*this, &ARDOUR_UI::transport_numpad_event), 4));
415 ActionManager::session_sensitive_actions.push_back (act);
416 ActionManager::transport_sensitive_actions.push_back (act);
417 act = global_actions.register_action (transport_actions, X_("numpad-5"), _("Numpad 5"), bind (mem_fun(*this, &ARDOUR_UI::transport_numpad_event), 5));
418 ActionManager::session_sensitive_actions.push_back (act);
419 ActionManager::transport_sensitive_actions.push_back (act);
420 act = global_actions.register_action (transport_actions, X_("numpad-6"), _("Numpad 6"), bind (mem_fun(*this, &ARDOUR_UI::transport_numpad_event), 6));
421 ActionManager::session_sensitive_actions.push_back (act);
422 ActionManager::transport_sensitive_actions.push_back (act);
423 act = global_actions.register_action (transport_actions, X_("numpad-7"), _("Numpad 7"), bind (mem_fun(*this, &ARDOUR_UI::transport_numpad_event), 7));
424 ActionManager::session_sensitive_actions.push_back (act);
425 ActionManager::transport_sensitive_actions.push_back (act);
426 act = global_actions.register_action (transport_actions, X_("numpad-8"), _("Numpad 8"), bind (mem_fun(*this, &ARDOUR_UI::transport_numpad_event), 8));
427 ActionManager::session_sensitive_actions.push_back (act);
428 ActionManager::transport_sensitive_actions.push_back (act);
429 act = global_actions.register_action (transport_actions, X_("numpad-9"), _("Numpad 9"), bind (mem_fun(*this, &ARDOUR_UI::transport_numpad_event), 9));
430 ActionManager::session_sensitive_actions.push_back (act);
431 ActionManager::transport_sensitive_actions.push_back (act);
433 act = global_actions.register_action (transport_actions, X_("focus-on-clock"), _("Focus On Clock"), sigc::mem_fun(*this, &ARDOUR_UI::focus_on_clock));
434 ActionManager::session_sensitive_actions.push_back (act);
435 ActionManager::transport_sensitive_actions.push_back (act);
437 act = global_actions.register_action (transport_actions, X_("primary-clock-timecode"), _("Timecode"), sigc::bind (sigc::mem_fun(primary_clock, &AudioClock::set_mode), AudioClock::Timecode));
438 ActionManager::session_sensitive_actions.push_back (act);
439 act = global_actions.register_action (transport_actions, X_("primary-clock-bbt"), _("Bars & Beats"), sigc::bind (sigc::mem_fun(primary_clock, &AudioClock::set_mode), AudioClock::BBT));
440 ActionManager::session_sensitive_actions.push_back (act);
441 act = global_actions.register_action (transport_actions, X_("primary-clock-minsec"), _("Minutes & Seconds"), sigc::bind (sigc::mem_fun(primary_clock, &AudioClock::set_mode), AudioClock::MinSec));
442 ActionManager::session_sensitive_actions.push_back (act);
443 act = global_actions.register_action (transport_actions, X_("primary-clock-samples"), _("Samples"), sigc::bind (sigc::mem_fun(primary_clock, &AudioClock::set_mode), AudioClock::Frames));
444 ActionManager::session_sensitive_actions.push_back (act);
446 act = global_actions.register_action (transport_actions, X_("secondary-clock-timecode"), _("Timecode"), sigc::bind (sigc::mem_fun(secondary_clock, &AudioClock::set_mode), AudioClock::Timecode));
447 ActionManager::session_sensitive_actions.push_back (act);
448 act = global_actions.register_action (transport_actions, X_("secondary-clock-bbt"), _("Bars & Beats"), sigc::bind (sigc::mem_fun(secondary_clock, &AudioClock::set_mode), AudioClock::BBT));
449 ActionManager::session_sensitive_actions.push_back (act);
450 act = global_actions.register_action (transport_actions, X_("secondary-clock-minsec"), _("Minutes & Seconds"), sigc::bind (sigc::mem_fun(secondary_clock, &AudioClock::set_mode), AudioClock::MinSec));
451 ActionManager::session_sensitive_actions.push_back (act);
452 act = global_actions.register_action (transport_actions, X_("secondary-clock-samples"), _("Samples"), sigc::bind (sigc::mem_fun(secondary_clock, &AudioClock::set_mode), AudioClock::Frames));
453 ActionManager::session_sensitive_actions.push_back (act);
455 act = global_actions.register_toggle_action (transport_actions, X_("TogglePunchIn"), _("Punch In"), sigc::mem_fun(*this, &ARDOUR_UI::toggle_punch_in));
456 act->set_short_label (_("In"));
457 ActionManager::session_sensitive_actions.push_back (act);
458 ActionManager::transport_sensitive_actions.push_back (act);
459 act = global_actions.register_toggle_action (transport_actions, X_("TogglePunchOut"), _("Punch Out"), sigc::mem_fun(*this, &ARDOUR_UI::toggle_punch_out));
460 act->set_short_label (_("Out"));
461 ActionManager::session_sensitive_actions.push_back (act);
462 ActionManager::transport_sensitive_actions.push_back (act);
463 act = global_actions.register_toggle_action (transport_actions, X_("TogglePunch"), _("Punch In/Out"), sigc::mem_fun(*this, &ARDOUR_UI::toggle_punch));
464 act->set_short_label (_("In/Out"));
465 ActionManager::session_sensitive_actions.push_back (act);
466 ActionManager::transport_sensitive_actions.push_back (act);
467 act = global_actions.register_toggle_action (transport_actions, X_("ToggleClick"), _("Click"), sigc::mem_fun(*this, &ARDOUR_UI::toggle_click));
468 ActionManager::session_sensitive_actions.push_back (act);
469 ActionManager::transport_sensitive_actions.push_back (act);
470 act = global_actions.register_toggle_action (transport_actions, X_("ToggleAutoInput"), _("Auto Input"), sigc::mem_fun(*this, &ARDOUR_UI::toggle_auto_input));
471 ActionManager::session_sensitive_actions.push_back (act);
472 ActionManager::transport_sensitive_actions.push_back (act);
473 act = global_actions.register_toggle_action (transport_actions, X_("ToggleAutoPlay"), _("Auto Play"), sigc::mem_fun(*this, &ARDOUR_UI::toggle_auto_play));
474 ActionManager::session_sensitive_actions.push_back (act);
475 ActionManager::transport_sensitive_actions.push_back (act);
476 act = global_actions.register_toggle_action (transport_actions, X_("ToggleAutoReturn"), _("Auto Return"), sigc::mem_fun(*this, &ARDOUR_UI::toggle_auto_return));
477 ActionManager::session_sensitive_actions.push_back (act);
478 ActionManager::transport_sensitive_actions.push_back (act);
479 act = global_actions.register_toggle_action (transport_actions, X_("ToggleFollowEdits"), _("Follow Edits"), sigc::mem_fun(*this, &ARDOUR_UI::toggle_follow_edits));
480 ActionManager::session_sensitive_actions.push_back (act);
481 ActionManager::transport_sensitive_actions.push_back (act);
484 act = global_actions.register_toggle_action (transport_actions, X_("ToggleVideoSync"), _("Sync Startup to Video"), sigc::mem_fun(*this, &ARDOUR_UI::toggle_video_sync));
485 ActionManager::session_sensitive_actions.push_back (act);
486 act = global_actions.register_toggle_action (transport_actions, X_("ToggleTimeMaster"), _("Time Master"), sigc::mem_fun(*this, &ARDOUR_UI::toggle_time_master));
487 ActionManager::session_sensitive_actions.push_back (act);
488 act = global_actions.register_toggle_action (transport_actions, X_("ToggleExternalSync"), _("Use External Positional Sync Source"), sigc::mem_fun(*this, &ARDOUR_UI::toggle_external_sync));
489 ActionManager::session_sensitive_actions.push_back (act);
491 for (int i = 1; i <= 32; ++i) {
492 string const a = string_compose (X_("ToggleRecordEnableTrack%1"), i);
493 string const n = string_compose (_("Toggle Record Enable Track %1"), i);
494 act = global_actions.register_action (common_actions, a.c_str(), n.c_str(), sigc::bind (sigc::mem_fun (*this, &ARDOUR_UI::toggle_record_enable), i - 1));
495 ActionManager::session_sensitive_actions.push_back (act);
498 Glib::RefPtr<ActionGroup> shuttle_actions = global_actions.create_action_group ("ShuttleActions");
500 shuttle_actions->add (Action::create (X_("SetShuttleUnitsPercentage"), _("Percentage")), hide_return (sigc::bind (sigc::mem_fun (*Config, &RCConfiguration::set_shuttle_units), Percentage)));
501 shuttle_actions->add (Action::create (X_("SetShuttleUnitsSemitones"), _("Semitones")), hide_return (sigc::bind (sigc::mem_fun (*Config, &RCConfiguration::set_shuttle_units), Semitones)));
503 Glib::RefPtr<ActionGroup> option_actions = global_actions.create_action_group ("options");
505 act = global_actions.register_toggle_action (option_actions, X_("SendMTC"), _("Send MTC"), sigc::mem_fun (*this, &ARDOUR_UI::toggle_send_mtc));
506 ActionManager::session_sensitive_actions.push_back (act);
507 act = global_actions.register_toggle_action (option_actions, X_("SendMMC"), _("Send MMC"), sigc::mem_fun (*this, &ARDOUR_UI::toggle_send_mmc));
508 ActionManager::session_sensitive_actions.push_back (act);
509 act = global_actions.register_toggle_action (option_actions, X_("UseMMC"), _("Use MMC"), sigc::mem_fun (*this, &ARDOUR_UI::toggle_use_mmc));
510 ActionManager::session_sensitive_actions.push_back (act);
511 act = global_actions.register_toggle_action (option_actions, X_("SendMidiClock"), _("Send MIDI Clock"), sigc::mem_fun (*this, &ARDOUR_UI::toggle_send_midi_clock));
512 ActionManager::session_sensitive_actions.push_back (act);
513 act = global_actions.register_toggle_action (option_actions, X_("SendMIDIfeedback"), _("Send MIDI Feedback"), sigc::mem_fun (*this, &ARDOUR_UI::toggle_send_midi_feedback));
514 ActionManager::session_sensitive_actions.push_back (act);
518 Glib::RefPtr<ActionGroup> midi_actions = global_actions.create_action_group (X_("MIDI"));
519 global_actions.register_action (midi_actions, X_("panic"), _("Panic"), sigc::mem_fun(*this, &ARDOUR_UI::midi_panic));
523 bool drag_failed (const Glib::RefPtr<Gdk::DragContext>& context, DragResult result, Tabbable* tab)
525 if (result == Gtk::DRAG_RESULT_NO_TARGET) {
533 ARDOUR_UI::build_menu_bar ()
535 menu_bar = dynamic_cast<MenuBar*> (ActionManager::get_widget (X_("/Main")));
536 menu_bar->set_name ("MainMenuBar");
538 EventBox* ev = manage (new EventBox);
540 CairoHPacker* hbox = manage (new CairoHPacker);
541 hbox->set_name (X_("StatusBarBox"));
543 hbox->set_border_width (3);
545 VBox* vbox = manage (new VBox);
546 vbox->pack_start (*hbox, true, false);
551 wall_clock_label.set_name ("WallClock");
552 wall_clock_label.set_use_markup ();
553 disk_space_label.set_name ("WallClock");
554 disk_space_label.set_use_markup ();
555 timecode_format_label.set_name ("WallClock");
556 timecode_format_label.set_use_markup ();
557 cpu_load_label.set_name ("CPULoad");
558 cpu_load_label.set_use_markup ();
559 xrun_label.set_name ("XrunLabel");
560 xrun_label.set_use_markup ();
561 peak_thread_work_label.set_name ("PeakThreadWork");
562 peak_thread_work_label.set_use_markup ();
563 buffer_load_label.set_name ("BufferLoad");
564 buffer_load_label.set_use_markup ();
565 sample_rate_label.set_name ("SampleRate");
566 sample_rate_label.set_use_markup ();
567 format_label.set_name ("Format");
568 format_label.set_use_markup ();
571 menu_hbox.pack_start (*menu_bar, false, false);
573 use_menubar_as_top_menubar ();
576 Gtk::HBox* window_button_box = manage (new Gtk::HBox);
578 editor_visibility_button.signal_drag_failed().connect (sigc::bind (sigc::ptr_fun (drag_failed), editor));
579 mixer_visibility_button.signal_drag_failed().connect (sigc::bind (sigc::ptr_fun (drag_failed), mixer));
580 prefs_visibility_button.signal_drag_failed().connect (sigc::bind (sigc::ptr_fun (drag_failed), rc_option_editor));
582 /* catch context clicks so that we can show a menu on these buttons */
584 editor_visibility_button.signal_button_press_event().connect (sigc::bind (sigc::mem_fun (*this, &ARDOUR_UI::tabbable_visibility_button_press), X_("editor")), false);
585 mixer_visibility_button.signal_button_press_event().connect (sigc::bind (sigc::mem_fun (*this, &ARDOUR_UI::tabbable_visibility_button_press), X_("mixer")), false);
586 prefs_visibility_button.signal_button_press_event().connect (sigc::bind (sigc::mem_fun (*this, &ARDOUR_UI::tabbable_visibility_button_press), X_("preferences")), false);
588 editor_visibility_button.set_related_action (ActionManager::get_action (X_("Common"), X_("change-editor-visibility")));
589 editor_visibility_button.set_name (X_("page switch button"));
590 mixer_visibility_button.set_related_action (ActionManager::get_action (X_("Common"), X_("change-mixer-visibility")));
591 mixer_visibility_button.set_name (X_("page switch button"));
592 prefs_visibility_button.set_related_action (ActionManager::get_action (X_("Common"), X_("change-preferences-visibility")));
593 prefs_visibility_button.set_name (X_("page switch button"));
595 Gtkmm2ext::UI::instance()->set_tip (editor_visibility_button,
596 string_compose (_("Drag this tab to the desktop to show %1 in its own window\n\n"
597 "To put the window back, use the Window > %1 > Attach menu action"), editor->name()));
599 Gtkmm2ext::UI::instance()->set_tip (mixer_visibility_button,
600 string_compose (_("Drag this tab to the desktop to show %1 in its own window\n\n"
601 "To put the window back, use the Window > %1 > Attach menu action"), mixer->name()));
603 Gtkmm2ext::UI::instance()->set_tip (prefs_visibility_button,
604 string_compose (_("Drag this tab to the desktop to show %1 in its own window\n\n"
605 "To put the window back, use the Window > %1 > Attach menu action"), rc_option_editor->name()));
607 window_button_box->pack_start (editor_visibility_button, false, false);
608 window_button_box->pack_start (mixer_visibility_button, false, false);
609 window_button_box->pack_start (prefs_visibility_button, false, false);
611 menu_hbox.pack_start (*window_button_box, false, false, 20);
613 bool wall_clock = false;
614 bool disk_space = false;
616 if (!Profile->get_small_screen()) {
618 // OSX provides its own wallclock, thank you very much
625 hbox->pack_end (error_alert_button, false, false, 2);
627 hbox->pack_end (wall_clock_label, false, false, 2);
628 hbox->pack_end (disk_space_label, false, false, 4);
629 hbox->pack_end (xrun_label, false, false, 4);
630 hbox->pack_end (peak_thread_work_label, false, false, 4);
631 hbox->pack_end (cpu_load_label, false, false, 4);
632 hbox->pack_end (buffer_load_label, false, false, 4);
633 hbox->pack_end (sample_rate_label, false, false, 4);
634 hbox->pack_end (timecode_format_label, false, false, 4);
635 hbox->pack_end (format_label, false, false, 4);
637 menu_hbox.pack_end (*ev, false, false, 2);
639 menu_bar_base.set_name ("MainMenuBar");
640 menu_bar_base.add (menu_hbox);
643 _status_bar_visibility.add (&wall_clock_label, X_("WallClock"), _("Wall Clock"), wall_clock);
645 _status_bar_visibility.add (&disk_space_label, X_("Disk"), _("Disk Space"), disk_space);
646 _status_bar_visibility.add (&cpu_load_label, X_("DSP"), _("DSP"), true);
647 _status_bar_visibility.add (&xrun_label, X_("XRun"), _("X-run"), false);
648 _status_bar_visibility.add (&peak_thread_work_label,X_("Peakfile"), _("Active Peak-file Work"), false);
649 _status_bar_visibility.add (&buffer_load_label, X_("Buffers"), _("Buffers"), true);
650 _status_bar_visibility.add (&sample_rate_label, X_("Audio"), _("Audio"), true);
651 _status_bar_visibility.add (&timecode_format_label, X_("TCFormat"), _("Timecode Format"), true);
652 _status_bar_visibility.add (&format_label, X_("Format"), _("File Format"), true);
654 ev->signal_button_press_event().connect (sigc::mem_fun (_status_bar_visibility, &VisibilityGroup::button_press_event));
655 ev->signal_button_release_event().connect (sigc::mem_fun (*this, &ARDOUR_UI::xrun_button_release));
659 ARDOUR_UI::use_menubar_as_top_menubar ()
662 Application* app = Application::instance ();
664 /* the addresses ("/ui/Main...") used below are based on the menu definitions in the menus file
667 /* Quit will be taken care of separately */
669 if ((widget = ActionManager::get_widget ("/ui/Main/Session/Quit"))) {
673 /* Put items for About and Preferences into App menu (the
674 * ardour.menus.in file does not list them for OS X)
677 GtkApplicationMenuGroup* group = app->add_app_menu_group ();
679 if ((widget = ActionManager::get_widget ("/ui/Main/Session/toggle-about"))) {
680 app->add_app_menu_item (group, dynamic_cast<MenuItem*>(widget));
683 if ((widget = ActionManager::get_widget ("/ui/Main/Session/toggle-rc-options-editor"))) {
684 app->add_app_menu_item (group, dynamic_cast<MenuItem*>(widget));
687 app->set_menu_bar (*menu_bar);
691 ARDOUR_UI::save_ardour_state ()
693 if (!keyboard || !mixer || !editor || !meterbridge) {
697 /* XXX this is all a bit dubious. add_extra_xml() uses
698 a different lifetime model from add_instant_xml().
701 XMLNode* node = new XMLNode (keyboard->get_state());
702 Config->add_extra_xml (*node);
703 Config->add_extra_xml (get_transport_controllable_state());
705 XMLNode* window_node = new XMLNode (X_("UI"));
706 window_node->add_property (_status_bar_visibility.get_state_name().c_str(), _status_bar_visibility.get_state_value ());
711 _main_window.get_position (mx, my);
712 _main_window.get_size (mw, mh);
714 XMLNode main_window_node (X_("Main"));
715 main_window_node.add_property (X_("x"), PBD::to_string (mx, std::dec));
716 main_window_node.add_property (X_("y"), PBD::to_string (my, std::dec));
717 main_window_node.add_property (X_("w"), PBD::to_string (mw, std::dec));
718 main_window_node.add_property (X_("h"), PBD::to_string (mh, std::dec));
721 int current_page_number = _tabs.get_current_page ();
722 if (editor && (current_page_number == _tabs.page_num (editor->contents()))) {
723 current_tab = "editor";
724 } else if (mixer && (current_page_number == _tabs.page_num (mixer->contents()))) {
725 current_tab = "mixer";
726 } else if (rc_option_editor && (current_page_number == _tabs.page_num (rc_option_editor->contents()))) {
727 current_tab == "preferences";
730 main_window_node.add_property (X_("current-tab"), current_tab);
734 WM::Manager::instance().add_state (*window_node);
736 XMLNode* tearoff_node = new XMLNode (X_("Tearoffs"));
738 if (mixer->monitor_section()) {
739 XMLNode* t = new XMLNode (X_("monitor-section"));
740 mixer->monitor_section()->tearoff().add_state (*t);
741 tearoff_node->add_child_nocopy (*t);
744 window_node->add_child_nocopy (*tearoff_node);
746 XMLNode& enode (editor->get_state());
747 XMLNode& mnode (mixer->get_state());
748 XMLNode& bnode (meterbridge->get_state());
750 Config->add_extra_xml (*window_node);
751 Config->add_extra_xml (audio_midi_setup->get_state());
753 Config->save_state();
755 UIConfiguration::instance().save_state ();
758 _session->add_instant_xml (main_window_node);
759 _session->add_instant_xml (enode);
760 _session->add_instant_xml (mnode);
761 _session->add_instant_xml (bnode);
763 _session->add_instant_xml (location_ui->ui().get_state ());
766 Config->add_instant_xml (main_window_node);
767 Config->add_instant_xml (enode);
768 Config->add_instant_xml (mnode);
769 Config->add_instant_xml (bnode);
771 Config->add_instant_xml (location_ui->ui().get_state ());
776 Keyboard::save_keybindings ();
780 ARDOUR_UI::resize_text_widgets ()
782 set_size_request_to_display_given_text (cpu_load_label, "DSP: 100.0%", 2, 2);
783 set_size_request_to_display_given_text (buffer_load_label, "Buffers: p:100% c:100%", 2, 2);
784 set_size_request_to_display_given_text (xrun_label, "X: 9999", 2, 2);
788 ARDOUR_UI::focus_on_clock ()
790 if (editor && primary_clock) {
792 primary_clock->focus ();
797 ARDOUR_UI::xrun_button_release (GdkEventButton* ev)
799 if (ev->button != 1 || !Keyboard::modifier_state_equals (ev->state, Keyboard::TertiaryModifier)) {
804 _session->reset_xrun_count ();
805 update_xrun_count ();
817 ARDOUR_UI::tabbable_visibility_button_press (GdkEventButton* ev, string const& tabbable_name)
819 if (ev->button != 3) {
823 /* context menu is defined in *.menus.in
826 string menu_name = string ("/ui/") + tabbable_name + X_("TabbableButtonMenu");
827 Gtk::Menu* menu = dynamic_cast<Gtk::Menu*> (ActionManager::get_widget (menu_name.c_str()));
829 menu->popup (3, ev->time);