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