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