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