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