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