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