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