da62ce206246ff0dfede1117d7cd0eb62632811e
[ardour.git] / gtk2_ardour / ardour_ui.h
1 /*
2  * Copyright (C) 2005-2019 Paul Davis <paul@linuxaudiosystems.com>
3  * Copyright (C) 2005 Karsten Wiese <fzuuzf@googlemail.com>
4  * Copyright (C) 2005 Taybin Rutkin <taybin@taybin.com>
5  * Copyright (C) 2006-2007 Doug McLain <doug@nostar.net>
6  * Copyright (C) 2006-2011 David Robillard <d@drobilla.net>
7  * Copyright (C) 2007-2012 Carl Hetherington <carl@carlh.net>
8  * Copyright (C) 2007-2015 Tim Mayberry <mojofunk@gmail.com>
9  * Copyright (C) 2008 Hans Baier <hansfbaier@googlemail.com>
10  * Copyright (C) 2012-2015 Colin Fletcher <colin.m.fletcher@googlemail.com>
11  * Copyright (C) 2013-2015 Nick Mainsbridge <mainsbridge@gmail.com>
12  * Copyright (C) 2013-2016 John Emmas <john@creativepost.co.uk>
13  * Copyright (C) 2013-2019 Robin Gareus <robin@gareus.org>
14  * Copyright (C) 2014-2018 Ben Loftis <ben@harrisonconsoles.com>
15  * Copyright (C) 2017 Johannes Mueller <github@johannes-mueller.org>
16  * Copyright (C) 2018 Len Ovens <len@ovenwerks.net>
17  *
18  * This program is free software; you can redistribute it and/or modify
19  * it under the terms of the GNU General Public License as published by
20  * the Free Software Foundation; either version 2 of the License, or
21  * (at your option) any later version.
22  *
23  * This program is distributed in the hope that it will be useful,
24  * but WITHOUT ANY WARRANTY; without even the implied warranty of
25  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
26  * GNU General Public License for more details.
27  *
28  * You should have received a copy of the GNU General Public License along
29  * with this program; if not, write to the Free Software Foundation, Inc.,
30  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
31  */
32
33 #ifndef __ardour_gui_h__
34 #define __ardour_gui_h__
35
36 #include <time.h>
37
38 /* need _BSD_SOURCE to get timersub macros */
39
40 #ifdef _BSD_SOURCE
41 #include <sys/time.h>
42 #else
43 #define _BSD_SOURCE
44 #include <sys/time.h>
45 #undef _BSD_SOURCE
46 #endif
47
48 #include <list>
49 #include <cmath>
50
51
52 #include "pbd/xml++.h"
53 #include <gtkmm/box.h>
54 #include <gtkmm/frame.h>
55 #include <gtkmm/label.h>
56 #include <gtkmm/table.h>
57 #include <gtkmm/fixed.h>
58 #include <gtkmm/drawingarea.h>
59 #include <gtkmm/eventbox.h>
60 #include <gtkmm/menu.h>
61 #include <gtkmm/menuitem.h>
62 #include <gtkmm/messagedialog.h>
63 #include <gtkmm/notebook.h>
64 #include <gtkmm/button.h>
65 #include <gtkmm/togglebutton.h>
66 #include <gtkmm/treeview.h>
67 #include <gtkmm/menubar.h>
68 #include <gtkmm/textbuffer.h>
69 #include <gtkmm/adjustment.h>
70
71 #include "gtkmm2ext/gtk_ui.h"
72 #include "gtkmm2ext/bindings.h"
73 #include "gtkmm2ext/visibility_tracker.h"
74
75 #include "ardour/ardour.h"
76 #include "ardour/types.h"
77 #include "ardour/utils.h"
78 #include "ardour/plugin.h"
79 #include "ardour/session_handle.h"
80 #include "ardour/system_exec.h"
81
82 #include "video_timeline.h"
83
84 #include "widgets/ardour_button.h"
85 #include "widgets/ardour_spacer.h"
86
87 #include "add_route_dialog.h"
88 #include "ardour_dialog.h"
89 #include "ardour_window.h"
90 #include "editing.h"
91 #include "enums.h"
92 #include "mini_timeline.h"
93 #include "shuttle_control.h"
94 #include "startup_fsm.h"
95 #include "transport_control.h"
96 #include "transport_control_ui.h"
97 #include "visibility_group.h"
98 #include "window_manager.h"
99
100 #ifdef COMPILER_MSVC
101 #include "about.h"
102 #include "add_video_dialog.h"
103 #include "big_clock_window.h"
104 #include "big_transport_window.h"
105 #include "bundle_manager.h"
106 #include "engine_dialog.h"
107 #include "export_video_dialog.h"
108 #include "global_port_matrix.h"
109 #include "idleometer.h"
110 #include "keyeditor.h"
111 #include "location_ui.h"
112 #include "lua_script_manager.h"
113 #include "plugin_dspload_window.h"
114 #include "rc_option_editor.h"
115 #include "route_dialogs.h"
116 #include "route_params_ui.h"
117 #include "session_option_editor.h"
118 #include "speaker_dialog.h"
119 #include "transport_masters_dialog.h"
120 #include "virtual_keyboard_window.h"
121 #else
122 class About;
123 class AddRouteDialog;
124 class AddVideoDialog;
125 class BigClockWindow;
126 class BigTransportWindow;
127 class BundleManager;
128 class EngineControl;
129 class ExportVideoDialog;
130 class KeyEditor;
131 class LocationUIWindow;
132 class LuaScriptManager;
133 class RCOptionEditor;
134 class RouteParams_UI;
135 class SessionOptionEditor;
136 class SpeakerDialog;
137 class GlobalPortMatrixWindow;
138 class IdleOMeter;
139 class PluginDSPLoadWindow;
140 class TransportMastersWindow;
141 class VirtualKeyboardWindow;
142 #endif
143
144 class VideoTimeLine;
145 class ArdourKeyboard;
146 class AudioClock;
147 class ConnectionEditor;
148 class DuplicateRouteDialog;
149 class MainClock;
150 class Mixer_UI;
151 class PublicEditor;
152 class SaveAsDialog;
153 class SaveTemplateDialog;
154 class SessionDialog;
155 class SessionOptionEditorWindow;
156 class Splash;
157 class TimeInfoBox;
158 class Meterbridge;
159 class LuaWindow;
160 class MidiTracer;
161 class NSM_Client;
162 class LevelMeterHBox;
163 class GUIObjectState;
164
165 namespace ARDOUR {
166         class ControlProtocolInfo;
167         class IO;
168         class Port;
169         class Route;
170         class RouteGroup;
171         class Location;
172         class ProcessThread;
173 }
174
175 namespace Gtk {
176         class ProgressBar;
177 }
178
179 namespace ArdourWidgets {
180         class Prompter;
181         class Tabbable;
182 }
183
184 #define MAX_LUA_ACTION_SCRIPTS 32
185 #define MAX_LUA_ACTION_BUTTONS 12
186
187 class ARDOUR_UI : public Gtkmm2ext::UI, public ARDOUR::SessionHandlePtr, public TransportControlProvider
188 {
189 public:
190         ARDOUR_UI (int *argcp, char **argvp[], const char* localedir);
191         ~ARDOUR_UI();
192
193         bool run_startup (bool should_be_new, std::string load_template);
194
195         void hide_splash ();
196         static void pop_back_splash (Gtk::Window&);
197
198         void launch_chat ();
199         void launch_manual ();
200         void launch_reference ();
201         void launch_tracker ();
202         void launch_subscribe ();
203         void launch_cheat_sheet ();
204         void launch_website ();
205         void launch_website_dev ();
206         void launch_forums ();
207         void launch_howto_report ();
208         void show_about ();
209         void hide_about ();
210
211         void load_from_application_api (const std::string& path);
212         void finish();
213
214         int load_session (const std::string& path, const std::string& snapshot, std::string mix_template = std::string());
215         bool session_load_in_progress;
216         int build_session (const std::string& path, const std::string& snapshot, ARDOUR::BusProfile const *);
217         bool session_is_new() const { return _session_is_new; }
218
219         ARDOUR::Session* the_session() { return _session; }
220
221         bool get_smart_mode () const;
222
223         RCOptionEditor* get_rc_option_editor() { return rc_option_editor; }
224         void show_tabbable (ArdourWidgets::Tabbable*);
225
226         void start_session_load (bool create_new);
227         void session_dialog_response_handler (int response, SessionDialog* session_dialog);
228         int  build_session_from_dialog (SessionDialog&, const std::string& session_name, const std::string& session_path);
229         bool ask_about_loading_existing_session (const std::string& session_path);
230         int load_session_from_startup_fsm ();
231
232         /// @return true if session was successfully unloaded.
233         int unload_session (bool hide_stuff = false);
234         void close_session();
235
236         int  save_state_canfail (std::string state_name = "", bool switch_to_it = false);
237         void save_state (const std::string & state_name = "", bool switch_to_it = false);
238
239         static ARDOUR_UI *instance () { return theArdourUI; }
240
241         /* signal emitted when escape key is pressed. All UI components that
242            need to respond to Escape in some way (e.g. break drag, clear
243            selection, etc) should connect to and handle this.
244         */
245         PBD::Signal0<void> Escape;
246
247         PublicEditor&     the_editor() { return *editor;}
248         Mixer_UI* the_mixer() { return mixer; }
249
250         Gtk::Menu* shared_popup_menu ();
251
252         void new_midi_tracer_window ();
253         void toggle_editing_space();
254         void toggle_mixer_space();
255         void toggle_keep_tearoffs();
256
257         void reset_focus (Gtk::Widget*);
258
259         static PublicEditor* _instance;
260
261         /** Emitted frequently with the audible sample, false, and the edit point as
262          *  parameters respectively.
263          *
264          *  (either RapidScreenUpdate || SuperRapidScreenUpdate - user-config)
265          */
266         static sigc::signal<void, samplepos_t> Clock;
267
268         static void close_all_dialogs () { CloseAllDialogs(); }
269         static sigc::signal<void> CloseAllDialogs;
270
271         XMLNode* main_window_settings() const;
272         XMLNode* editor_settings() const;
273         XMLNode* preferences_settings() const;
274         XMLNode* mixer_settings () const;
275         XMLNode* keyboard_settings () const;
276         XMLNode* tearoff_settings (const char*) const;
277
278         void save_ardour_state ();
279         gboolean configure_handler (GdkEventConfigure* conf);
280
281         void halt_on_xrun_message ();
282         void xrun_handler (samplepos_t);
283         void create_xrun_marker (samplepos_t);
284
285         GUIObjectState* gui_object_state;
286
287         MainClock* primary_clock;
288         MainClock* secondary_clock;
289         void focus_on_clock ();
290         AudioClock*   big_clock;
291
292         VideoTimeLine *video_timeline;
293
294         void store_clock_modes ();
295         void restore_clock_modes ();
296         void reset_main_clocks ();
297
298         void synchronize_sync_source_and_video_pullup ();
299
300         void add_route ();
301         void add_route_dialog_response (int);
302
303         void add_routes_part_two ();
304         void add_routes_thread ();
305
306         void start_duplicate_routes ();
307
308         void add_video (Gtk::Window* float_window);
309         void remove_video ();
310         void start_video_server_menu (Gtk::Window* float_window);
311         bool start_video_server (Gtk::Window* float_window, bool popup_msg);
312         void stop_video_server (bool ask_confirm=false);
313         void flush_videotimeline_cache (bool localcacheonly=false);
314         void export_video (bool range = false);
315
316         void session_add_audio_route (bool, int32_t, int32_t, ARDOUR::TrackMode, ARDOUR::RouteGroup *,
317                                       uint32_t, std::string const &, bool, ARDOUR::PresentationInfo::order_t order);
318
319         void session_add_mixed_track (const ARDOUR::ChanCount&, const ARDOUR::ChanCount&, ARDOUR::RouteGroup*,
320                                       uint32_t, std::string const &, bool strict_io,
321                                       ARDOUR::PluginInfoPtr, ARDOUR::Plugin::PresetRecord* pset,
322                                       ARDOUR::PresentationInfo::order_t order);
323
324         void session_add_midi_bus (ARDOUR::RouteGroup*, uint32_t, std::string const &, bool strict_io,
325                                    ARDOUR::PluginInfoPtr, ARDOUR::Plugin::PresetRecord* pset,
326                                    ARDOUR::PresentationInfo::order_t order);
327
328         void session_add_midi_route (bool, ARDOUR::RouteGroup *, uint32_t, std::string const &, bool,
329                                      ARDOUR::PluginInfoPtr, ARDOUR::Plugin::PresetRecord*,
330                                      ARDOUR::PresentationInfo::order_t order);
331
332         void session_add_foldback_bus (int32_t, uint32_t, std::string const &);
333
334         void display_insufficient_ports_message ();
335
336         void attach_to_engine ();
337         void post_engine ();
338
339         gint exit_on_main_window_close (GdkEventAny *);
340
341         void maximise_editing_space ();
342         void restore_editing_space ();
343
344         void show_ui_prefs ();
345
346         bool check_audioengine(Gtk::Window&);
347
348         void setup_profile ();
349         void setup_tooltips ();
350
351         void set_shuttle_fract (double);
352
353         void get_process_buffers ();
354         void drop_process_buffers ();
355
356         void reset_peak_display ();
357         void reset_route_peak_display (ARDOUR::Route*);
358         void reset_group_peak_display (ARDOUR::RouteGroup*);
359
360         const std::string& announce_string() const { return _announce_string; }
361
362         void hide_application ();
363
364         Gtk::Notebook& tabs();
365         Gtk::Window& main_window () { return _main_window; }
366
367         void setup_toplevel_window (Gtk::Window&, const std::string& name, void* owner);
368
369         /* called from a static C function */
370
371         GtkNotebook* tab_window_root_drop (GtkNotebook* src,
372                                            GtkWidget* w,
373                                            gint x,
374                                            gint y,
375                                            gpointer user_data);
376
377         bool tabbed_window_state_event_handler (GdkEventWindowState*, void* object);
378         bool key_event_handler (GdkEventKey*, Gtk::Window* window);
379
380         ARDOUR::PresentationInfo::order_t translate_order (RouteDialogs::InsertAt);
381
382         std::map<std::string, std::string> route_setup_info (const std::string& script_path);
383
384         void gui_idle_handler ();
385
386 protected:
387         friend class PublicEditor;
388
389         void toggle_use_monitor_section ();
390         void monitor_dim_all ();
391         void monitor_cut_all ();
392         void monitor_mono ();
393
394         void toggle_auto_play ();
395         void toggle_auto_input ();
396         void toggle_punch ();
397         void unset_dual_punch ();
398         bool ignore_dual_punch;
399         void toggle_punch_in ();
400         void toggle_punch_out ();
401         void toggle_session_monitoring_in ();
402         void toggle_session_monitoring_disk ();
403         void show_loop_punch_ruler_and_disallow_hide ();
404         void reenable_hide_loop_punch_ruler_if_appropriate ();
405         void toggle_auto_return ();
406         void toggle_click ();
407         void toggle_audio_midi_setup ();
408         void toggle_session_auto_loop ();
409         void toggle_rc_options_window ();
410         void toggle_session_options_window ();
411
412 private:
413
414         Gtk::Window   _main_window;
415         Gtkmm2ext::VisibilityTracker* main_window_visibility;
416         Gtk::VBox      main_vpacker;
417         Gtk::HBox      status_bar_hpacker;
418         Gtk::Notebook _tabs;
419         PublicEditor*  editor;
420         Mixer_UI*      mixer;
421         Gtk::Tooltips _tooltips;
422         NSM_Client*    nsm;
423         bool          _was_dirty;
424         bool          _mixer_on_top;
425
426         Gtk::Menu*    _shared_popup_menu;
427
428         void hide_tabbable (ArdourWidgets::Tabbable*);
429         void detach_tabbable (ArdourWidgets::Tabbable*);
430         void attach_tabbable (ArdourWidgets::Tabbable*);
431         void button_change_tabbable_visibility (ArdourWidgets::Tabbable*);
432         void key_change_tabbable_visibility (ArdourWidgets::Tabbable*);
433         void toggle_editor_and_mixer ();
434
435         void tabbable_state_change (ArdourWidgets::Tabbable&);
436
437         void toggle_meterbridge ();
438         void toggle_luawindow ();
439
440         int  setup_windows ();
441         void setup_transport ();
442         void setup_clock ();
443
444         static ARDOUR_UI *theArdourUI;
445         SessionDialog *_session_dialog;
446
447         StartupFSM* startup_fsm;
448
449         int starting ();
450         int nsm_init ();
451         void startup_done ();
452         void sfsm_response (StartupFSM::Result);
453
454         int  ask_about_saving_session (const std::vector<std::string>& actions);
455
456         void save_session_at_its_request (std::string);
457         /* periodic safety backup, to be precise */
458         gint autosave_session();
459         void update_autosave();
460         sigc::connection _autosave_connection;
461
462         void session_dirty_changed ();
463         void update_title ();
464
465         void map_transport_state ();
466         int32_t do_engine_start ();
467
468         void engine_halted (const char* reason, bool free_reason);
469         void engine_stopped ();
470         void engine_running (uint32_t cnt);
471
472         void use_config ();
473
474         void about_signal_response(int response);
475
476         Gtk::VBox    top_packer;
477
478         sigc::connection clock_signal_connection;
479         void         update_clocks ();
480         void         start_clocking ();
481         void         stop_clocking ();
482
483         void update_transport_clocks (samplepos_t pos);
484         void record_state_changed ();
485
486         std::list<MidiTracer*> _midi_tracer_windows;
487
488         /* Transport Control */
489
490         Gtk::Table               transport_table;
491         Gtk::Frame               transport_frame;
492         Gtk::HBox                transport_hbox;
493
494         ArdourWidgets::ArdourVSpacer* secondary_clock_spacer;
495         void repack_transport_hbox ();
496         void update_clock_visibility ();
497         void toggle_follow_edits ();
498
499         void set_transport_controllable_state (const XMLNode&);
500         XMLNode& get_transport_controllable_state ();
501
502         TransportControlUI transport_ctrl;
503
504         ArdourWidgets::ArdourButton punch_in_button;
505         ArdourWidgets::ArdourButton punch_out_button;
506         ArdourWidgets::ArdourButton layered_button;
507
508         ArdourWidgets::ArdourVSpacer recpunch_spacer;
509         ArdourWidgets::ArdourVSpacer monitoring_spacer;
510         ArdourWidgets::ArdourVSpacer latency_spacer;
511
512         ArdourWidgets::ArdourButton monitor_in_button;
513         ArdourWidgets::ArdourButton monitor_disk_button;
514         ArdourWidgets::ArdourButton auto_input_button;
515
516         Gtk::Label   punch_label;
517         Gtk::Label   layered_label;
518
519         Gtk::Label   punch_space;
520         Gtk::Label   mon_space;
521
522         void toggle_external_sync ();
523         void toggle_time_master ();
524         void toggle_video_sync ();
525
526
527         ArdourWidgets::ArdourButton latency_disable_button;
528
529         Gtk::Label route_latency_value;
530         Gtk::Label io_latency_label;
531         Gtk::Label io_latency_value;
532
533         ShuttleControl     shuttle_box;
534         MiniTimeline       mini_timeline;
535         TimeInfoBox*       time_info_box;
536
537
538         ArdourWidgets::ArdourVSpacer      meterbox_spacer;
539         ArdourWidgets::ArdourVSpacer      meterbox_spacer2;
540
541         ArdourWidgets::ArdourButton auto_return_button;
542         ArdourWidgets::ArdourButton follow_edits_button;
543         ArdourWidgets::ArdourButton sync_button;
544
545         ArdourWidgets::ArdourButton auditioning_alert_button;
546         ArdourWidgets::ArdourButton solo_alert_button;
547         ArdourWidgets::ArdourButton feedback_alert_button;
548         ArdourWidgets::ArdourButton error_alert_button;
549
550         ArdourWidgets::ArdourButton action_script_call_btn[MAX_LUA_ACTION_BUTTONS];
551
552         Gtk::VBox alert_box;
553         Gtk::Table editor_meter_table;
554         ArdourWidgets::ArdourButton editor_meter_peak_display;
555         LevelMeterHBox *            editor_meter;
556         float                       editor_meter_max_peak;
557         bool                        editor_meter_peak_button_release (GdkEventButton*);
558
559         void blink_handler (bool);
560         sigc::connection blink_connection;
561
562         void cancel_solo ();
563         void solo_blink (bool);
564         void sync_blink (bool);
565         void audition_blink (bool);
566         void feedback_blink (bool);
567         void error_blink (bool);
568
569         void set_flat_buttons();
570
571         void soloing_changed (bool);
572         void auditioning_changed (bool);
573         void _auditioning_changed (bool);
574
575         bool solo_alert_press (GdkEventButton* ev);
576         void audition_alert_clicked ();
577         bool error_alert_press (GdkEventButton *);
578
579         void layered_button_clicked ();
580
581         void big_clock_value_changed ();
582         void primary_clock_value_changed ();
583         void secondary_clock_value_changed ();
584
585         /* called by Blink signal */
586
587         void transport_rec_enable_blink (bool onoff);
588
589         /* menu bar and associated stuff */
590
591         Gtk::MenuBar* menu_bar;
592         Gtk::EventBox menu_bar_base;
593         Gtk::HBox     menu_hbox;
594
595         void use_menubar_as_top_menubar ();
596         void build_menu_bar ();
597
598         Gtk::Label   wall_clock_label;
599         gint update_wall_clock ();
600
601         Gtk::Label  disk_space_label;
602         void update_disk_space ();
603         void format_disk_space_label (float);
604
605         Gtk::Label   timecode_format_label;
606         void update_timecode_format ();
607
608         Gtk::Label  dsp_load_label;
609         void update_cpu_load ();
610
611         Gtk::Label   peak_thread_work_label;
612         void update_peak_thread_work ();
613
614         Gtk::Label   sample_rate_label;
615         void update_sample_rate (ARDOUR::samplecnt_t);
616
617         Gtk::Label    format_label;
618         void update_format ();
619
620         void every_second ();
621         void every_point_one_seconds ();
622         void every_point_zero_something_seconds ();
623
624         sigc::connection second_connection;
625         sigc::connection point_one_second_connection;
626         sigc::connection point_zero_something_second_connection;
627         sigc::connection fps_connection;
628
629         void set_fps_timeout_connection ();
630
631         void open_session ();
632         void open_recent_session ();
633         void save_template_dialog_response (int response, SaveTemplateDialog* d);
634         void save_template ();
635         void manage_templates ();
636
637         void meta_session_setup (const std::string& script_path);
638         void meta_route_setup (const std::string& script_path);
639
640         void edit_metadata ();
641         void import_metadata ();
642
643         void set_transport_sensitivity (bool);
644
645         //stuff for ProTools-style numpad
646         void transport_numpad_event (int num);
647         void transport_numpad_decimal ();
648         bool _numpad_locate_happening;
649         int _pending_locate_num;
650         gint transport_numpad_timeout ();
651         sigc::connection _numpad_timeout_connection;
652
653         void transport_goto_nth_marker (int nth);
654         void transport_goto_zero ();
655         void transport_goto_start ();
656         void transport_goto_end ();
657         void transport_goto_wallclock ();
658         void transport_stop ();
659         void transport_record (bool roll);
660         void transport_roll ();
661         void transport_play_selection();
662         void transport_play_preroll();
663         void transport_rec_preroll();
664         void transport_rec_count_in();
665         void transport_forward (int option);
666         void transport_rewind (int option);
667         void transport_loop ();
668         void toggle_roll (bool with_abort, bool roll_out_of_bounded_mode);
669         bool trx_record_enable_all_tracks ();
670
671         bool _session_is_new;
672         void set_session (ARDOUR::Session *);
673         void connect_dependents_to_session (ARDOUR::Session *);
674         void we_have_dependents ();
675
676         void setup_session_options ();
677
678         guint32  last_key_press_time;
679
680         bool process_snapshot_session_prompter (ArdourWidgets::Prompter& prompter, bool switch_to_it);
681         void snapshot_session (bool switch_to_it);
682
683         void quick_snapshot_session (bool switch_to_it);  //does not promtp for name, just makes a timestamped file
684
685         SaveAsDialog* save_as_dialog;
686
687         bool save_as_progress_update (float fraction, int64_t cnt, int64_t total, Gtk::Label* label, Gtk::ProgressBar* bar);
688         void save_session_as ();
689         void archive_session ();
690         void rename_session ();
691
692         int         create_mixer ();
693         int         create_editor ();
694         int         create_meterbridge ();
695         int         create_luawindow ();
696         int         create_masters ();
697
698         Meterbridge  *meterbridge;
699         LuaWindow    *luawindow;
700
701         /* Dialogs that can be created via new<T> */
702
703         RCOptionEditor* rc_option_editor;
704         Gtk::HBox rc_option_editor_placeholder;
705
706         WM::Proxy<SpeakerDialog> speaker_config_window;
707         WM::Proxy<AddRouteDialog> add_route_dialog;
708         WM::Proxy<About> about;
709         WM::Proxy<LocationUIWindow> location_ui;
710         WM::Proxy<RouteParams_UI> route_params;
711         WM::Proxy<EngineControl> audio_midi_setup;
712         WM::Proxy<ExportVideoDialog> export_video_dialog;
713         WM::Proxy<LuaScriptManager> lua_script_window;
714         WM::Proxy<IdleOMeter> idleometer;
715         WM::Proxy<PluginDSPLoadWindow> plugin_dsp_load_window;
716         WM::Proxy<TransportMastersWindow> transport_masters_window;
717
718         /* Windows/Dialogs that require a creator method */
719
720         WM::ProxyWithConstructor<SessionOptionEditor> session_option_editor;
721         WM::ProxyWithConstructor<AddVideoDialog> add_video_dialog;
722         WM::ProxyWithConstructor<BundleManager> bundle_manager;
723         WM::ProxyWithConstructor<BigClockWindow> big_clock_window;
724         WM::ProxyWithConstructor<BigTransportWindow> big_transport_window;
725         WM::ProxyWithConstructor<VirtualKeyboardWindow> virtual_keyboard_window;
726         WM::ProxyWithConstructor<GlobalPortMatrixWindow> audio_port_matrix;
727         WM::ProxyWithConstructor<GlobalPortMatrixWindow> midi_port_matrix;
728         WM::ProxyWithConstructor<KeyEditor> key_editor;
729
730         /* creator methods */
731
732         SessionOptionEditor*    create_session_option_editor ();
733         BundleManager*          create_bundle_manager ();
734         AddVideoDialog*         create_add_video_dialog ();
735         BigClockWindow*         create_big_clock_window();
736         BigTransportWindow*     create_big_transport_window();
737         VirtualKeyboardWindow*  create_virtual_keyboard_window();
738         GlobalPortMatrixWindow* create_global_port_matrix (ARDOUR::DataType);
739         KeyEditor*              create_key_editor ();
740
741         ARDOUR::SystemExec *video_server_process;
742
743         void handle_locations_change (ARDOUR::Location*);
744
745         /* Keyboard Handling */
746
747         ArdourKeyboard* keyboard;
748
749         /* Keymap handling */
750
751         void install_actions ();
752         void install_dependent_actions ();
753
754         void toggle_record_enable (uint16_t);
755
756         uint32_t rec_enabled_streams;
757         void count_recenabled_streams (ARDOUR::Route&);
758
759         /* cleanup */
760
761         Gtk::MenuItem *cleanup_item;
762
763         void display_cleanup_results (ARDOUR::CleanupReport& rep, const gchar* list_title, const bool msg_delete);
764         void cleanup ();
765         void cleanup_peakfiles ();
766         void flush_trash ();
767
768         bool have_configure_timeout;
769         ARDOUR::microseconds_t last_configure_time;
770         gint configure_timeout ();
771
772         ARDOUR::microseconds_t last_peak_grab;
773         ARDOUR::microseconds_t last_shuttle_request;
774
775         bool have_disk_speed_dialog_displayed;
776         void disk_speed_dialog_gone (int ignored_response, Gtk::MessageDialog*);
777         void disk_overrun_handler ();
778         void disk_underrun_handler ();
779
780         void session_format_mismatch (std::string, std::string);
781
782         void session_dialog (std::string);
783         int pending_state_dialog ();
784         int sr_mismatch_dialog (ARDOUR::samplecnt_t, ARDOUR::samplecnt_t);
785         void sr_mismatch_message (ARDOUR::samplecnt_t, ARDOUR::samplecnt_t);
786
787         Gtk::MenuItem* jack_disconnect_item;
788         Gtk::MenuItem* jack_reconnect_item;
789         Gtk::Menu*     jack_bufsize_menu;
790
791         Glib::RefPtr<Gtk::ActionGroup> common_actions;
792
793         void editor_realized ();
794
795         std::vector<std::string> positional_sync_strings;
796
797         void toggle_use_mmc ();
798         void toggle_send_mmc ();
799         void toggle_send_mtc ();
800         void toggle_send_midi_clock ();
801
802         void toggle_use_osc ();
803
804         void parameter_changed (std::string);
805         void session_parameter_changed (std::string);
806
807         bool first_idle ();
808
809         void check_memory_locking ();
810
811         void audioengine_setup ();
812
813         void display_message (const char* prefix, gint prefix_len, Glib::RefPtr<Gtk::TextBuffer::Tag>, Glib::RefPtr<Gtk::TextBuffer::Tag>, const char* msg);
814         Gtk::Label status_bar_label;
815         bool status_bar_button_press (GdkEventButton*);
816
817         PBD::ScopedConnectionList forever_connections;
818         PBD::ScopedConnection halt_connection;
819         PBD::ScopedConnection editor_meter_connection;
820
821         /* these are used only in response to a platform-specific "ShouldQuit" signal */
822         bool idle_finish ();
823         void queue_finish ();
824         void fontconfig_dialog ();
825
826         int missing_file (ARDOUR::Session*s, std::string str, ARDOUR::DataType type);
827         int ambiguous_file (std::string file, std::vector<std::string> hits);
828
829         bool click_button_clicked (GdkEventButton *);
830         bool sync_button_clicked (GdkEventButton *);
831
832         VisibilityGroup _status_bar_visibility;
833
834         /** A ProcessThread so that we have some thread-local buffers for use by
835          *  PluginEqGui::impulse_analysis ().
836          */
837         ARDOUR::ProcessThread* _process_thread;
838
839         void toggle_latency_switch ();
840         void latency_switch_changed ();
841         void session_latency_updated ();
842
843         void feedback_detected ();
844
845         ArdourWidgets::ArdourButton             midi_panic_button;
846         void                     midi_panic ();
847
848         void successful_graph_sort ();
849         bool _feedback_exists;
850
851         enum ArdourLogLevel {
852                 LogLevelNone = 0,
853                 LogLevelInfo,
854                 LogLevelWarning,
855                 LogLevelError
856         };
857
858         ArdourLogLevel _log_not_acknowledged;
859
860         void on_theme_changed ();
861
862         bool xrun_button_release (GdkEventButton* ev);
863
864         std::string _announce_string;
865         void check_announcements ();
866
867         void audioengine_became_silent ();
868
869         DuplicateRouteDialog* duplicate_routes_dialog;
870
871         void grab_focus_after_dialog ();
872
873         void tabs_switch (GtkNotebookPage*, guint page_number);
874         void tabs_page_added (Gtk::Widget*, guint);
875         void tabs_page_removed (Gtk::Widget*, guint);
876         ArdourWidgets::ArdourButton editor_visibility_button;
877         ArdourWidgets::ArdourButton mixer_visibility_button;
878         ArdourWidgets::ArdourButton prefs_visibility_button;
879
880         bool key_press_focus_accelerator_handler (Gtk::Window& window, GdkEventKey* ev, Gtkmm2ext::Bindings*);
881         bool try_gtk_accel_binding (GtkWindow* win, GdkEventKey* ev, bool translate, GdkModifierType modifier);
882
883         bool main_window_delete_event (GdkEventAny*);
884         bool idle_ask_about_quit ();
885
886         bool tabbable_visibility_button_press (GdkEventButton* ev, std::string const& tabbable_name);
887
888         void step_up_through_tabs ();
889         void step_down_through_tabs ();
890
891         void escape ();
892         void close_current_dialog ();
893
894         bool bind_lua_action_script (GdkEventButton*, int);
895         void update_action_script_btn (int i, const std::string&);
896 };
897
898 #endif /* __ardour_gui_h__ */