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