extend strict-i/o to include route outputs.
[ardour.git] / gtk2_ardour / ardour_ui.h
index d10b7c7ac502e1a187150c6c9527a83895ef46f1..632fe07c85b1778042c882f1ecf5f6ea149055b3 100644 (file)
 #include <gtkmm/menubar.h>
 #include <gtkmm/textbuffer.h>
 #include <gtkmm/adjustment.h>
-#include <gtkmm2ext/gtk_ui.h>
-#include <gtkmm2ext/click_box.h>
-#include <gtkmm2ext/stateful_button.h>
-#include <gtkmm2ext/bindable_button.h>
+
+#include "gtkmm2ext/gtk_ui.h"
+#include "gtkmm2ext/click_box.h"
+#include "gtkmm2ext/stateful_button.h"
+#include "gtkmm2ext/bindable_button.h"
+#include "gtkmm2ext/bindings.h"
 
 #include "ardour/ardour.h"
 #include "ardour/types.h"
@@ -86,6 +88,7 @@
 #include "global_port_matrix.h"
 #include "keyeditor.h"
 #include "location_ui.h"
+#include "lua_script_manager.h"
 #include "rc_option_editor.h"
 #include "route_params_ui.h"
 #include "session_option_editor.h"
@@ -100,6 +103,7 @@ class EngineControl;
 class ExportVideoDialog;
 class KeyEditor;
 class LocationUIWindow;
+class LuaScriptManager;
 class RCOptionEditor;
 class RouteParams_UI;
 class SessionOptionEditor;
@@ -112,17 +116,19 @@ class ArdourKeyboard;
 class AudioClock;
 class ButtonJoiner;
 class ConnectionEditor;
+class DuplicateRouteDialog;
 class MainClock;
 class Mixer_UI;
 class ArdourPrompter;
 class PublicEditor;
 class SaveAsDialog;
 class SessionDialog;
-class SessionOptionEditor;
+class SessionOptionEditorWindow;
 class ShuttleControl;
 class Splash;
 class TimeInfoBox;
 class Meterbridge;
+class LuaWindow;
 class MidiTracer;
 class NSM_Client;
 class LevelMeterHBox;
@@ -138,14 +144,14 @@ namespace ARDOUR {
        class ProcessThread;
 }
 
-namespace Gtkmm2ext {
-       class TearOff;
-}
-
 namespace Gtk {
        class ProgressBar;
 }
 
+namespace Gtkmm2ext {
+       class Tabbable;
+}
+
 class ARDOUR_UI : public Gtkmm2ext::UI, public ARDOUR::SessionHandlePtr
 {
     public:
@@ -201,8 +207,12 @@ class ARDOUR_UI : public Gtkmm2ext::UI, public ARDOUR::SessionHandlePtr
        void new_midi_tracer_window ();
        void toggle_editing_space();
        void toggle_mixer_space();
+       void toggle_mixer_list();
+       void toggle_monitor_section_visibility ();
        void toggle_keep_tearoffs();
 
+       void lua_script_manager();
+
        static PublicEditor* _instance;
 
        /** Emitted frequently with the audible frame, false, and the edit point as
@@ -215,6 +225,7 @@ class ARDOUR_UI : public Gtkmm2ext::UI, public ARDOUR::SessionHandlePtr
        static void close_all_dialogs () { CloseAllDialogs(); }
         static sigc::signal<void> CloseAllDialogs;
 
+       XMLNode* main_window_settings() const;
        XMLNode* editor_settings() const;
        XMLNode* mixer_settings () const;
        XMLNode* keyboard_settings () const;
@@ -248,7 +259,10 @@ class ARDOUR_UI : public Gtkmm2ext::UI, public ARDOUR::SessionHandlePtr
         void add_routes_part_two ();
         void add_routes_thread ();
 
-       void duplicate_routes ();
+       void start_duplicate_routes ();
+
+       void add_lua_script ();
+       void remove_lua_script ();
 
        void add_video (Gtk::Window* float_window);
        void remove_video ();
@@ -264,30 +278,40 @@ class ARDOUR_UI : public Gtkmm2ext::UI, public ARDOUR::SessionHandlePtr
                ARDOUR::TrackMode mode,
                ARDOUR::RouteGroup* route_group,
                uint32_t how_many,
-               std::string const & name_template
+               std::string const & name_template,
+               bool strict_io
                ) {
-
-               session_add_audio_route (true, input_channels, output_channels, mode, route_group, how_many, name_template);
+               session_add_audio_route (true, input_channels, output_channels, mode, route_group, how_many, name_template, strict_io);
        }
 
-       void session_add_audio_bus (int input_channels, int32_t output_channels, ARDOUR::RouteGroup* route_group,
-                                   uint32_t how_many, std::string const & name_template) {
-               session_add_audio_route (false, input_channels, output_channels, ARDOUR::Normal, route_group, how_many, name_template);
+       void session_add_audio_bus (
+                       int input_channels,
+                       int32_t output_channels,
+                       ARDOUR::RouteGroup* route_group,
+                       uint32_t how_many,
+                       std::string const & name_template,
+                       bool strict_io
+                       ) {
+               session_add_audio_route (false, input_channels, output_channels, ARDOUR::Normal, route_group, how_many, name_template, strict_io);
        }
 
-       void session_add_midi_track (ARDOUR::RouteGroup* route_group, uint32_t how_many, std::string const & name_template,
-                                    ARDOUR::PluginInfoPtr instrument) {
-               session_add_midi_route (true, route_group, how_many, name_template, instrument);
+       void session_add_midi_track (
+                       ARDOUR::RouteGroup* route_group,
+                       uint32_t how_many,
+                       std::string const & name_template,
+                       bool strict_io,
+                       ARDOUR::PluginInfoPtr instrument) {
+               session_add_midi_route (true, route_group, how_many, name_template, strict_io, instrument);
        }
 
-        void session_add_mixed_track (const ARDOUR::ChanCount& input, const ARDOUR::ChanCount& output, ARDOUR::RouteGroup* route_group, uint32_t how_many, std::string const & name_template,
-                                     ARDOUR::PluginInfoPtr instrument);
+       void session_add_mixed_track (const ARDOUR::ChanCount&, const ARDOUR::ChanCount&, ARDOUR::RouteGroup*, uint32_t, std::string const &, bool, ARDOUR::PluginInfoPtr);
+       void session_add_midi_bus (ARDOUR::RouteGroup*, uint32_t, std::string const &, bool, ARDOUR::PluginInfoPtr);
+       void session_add_audio_route (bool, int32_t, int32_t, ARDOUR::TrackMode, ARDOUR::RouteGroup *, uint32_t, std::string const &, bool);
+       void session_add_midi_route (bool, ARDOUR::RouteGroup *, uint32_t, std::string const &, bool, ARDOUR::PluginInfoPtr);
 
-       /*void session_add_midi_bus () {
-               session_add_midi_route (false);
-       }*/
+       void display_insufficient_ports_message ();
 
-        void attach_to_engine ();
+       void attach_to_engine ();
        void post_engine ();
 
        gint exit_on_main_window_close (GdkEventAny *);
@@ -299,8 +323,6 @@ class ARDOUR_UI : public Gtkmm2ext::UI, public ARDOUR::SessionHandlePtr
 
        bool check_audioengine(Gtk::Window&);
 
-       void update_tearoff_visibility ();
-
        void setup_profile ();
        void setup_tooltips ();
 
@@ -317,6 +339,24 @@ class ARDOUR_UI : public Gtkmm2ext::UI, public ARDOUR::SessionHandlePtr
 
        void hide_application ();
 
+       Gtk::Notebook& tabs();
+       Gtk::Window& main_window () { return _main_window; }
+
+       void setup_toplevel_window (Gtk::Window&, const std::string& name, void* owner);
+
+       /* called from a static C function */
+
+       GtkNotebook* tab_window_root_drop (GtkNotebook* src,
+                                          GtkWidget* w,
+                                          gint x,
+                                          gint y,
+                                          gpointer user_data);
+
+       bool tabbed_window_state_event_handler (GdkEventWindowState*, void* object);
+       bool key_event_handler (GdkEventKey*, Gtk::Window* window);
+
+       Gtkmm2ext::ActionMap global_actions;
+
   protected:
        friend class PublicEditor;
 
@@ -337,25 +377,38 @@ class ARDOUR_UI : public Gtkmm2ext::UI, public ARDOUR::SessionHandlePtr
        void toggle_session_options_window ();
 
   private:
-       PublicEditor*        editor;
-       Mixer_UI*            mixer;
-       NSM_Client*          nsm;
-       bool                _was_dirty;
-        bool                _mixer_on_top;
-        bool                _initial_verbose_plugin_scan;
-        bool first_time_engine_run;
-
-       void goto_editor_window ();
-       void goto_mixer_window ();
-       void toggle_mixer_window ();
+       Gtk::Window   _main_window;
+       Gtk::VBox      main_vpacker;
+       Gtk::HBox      status_bar_hpacker;
+       Gtk::Notebook _tabs;
+       PublicEditor*  editor;
+       Mixer_UI*      mixer;
+       Gtk::Tooltips _tooltips;
+       NSM_Client*    nsm;
+       bool          _was_dirty;
+        bool          _mixer_on_top;
+        bool          _initial_verbose_plugin_scan;
+       bool           first_time_engine_run;
+
+       void show_tabbable (Gtkmm2ext::Tabbable*);
+       void hide_tabbable (Gtkmm2ext::Tabbable*);
+       void detach_tabbable (Gtkmm2ext::Tabbable*);
+       void attach_tabbable (Gtkmm2ext::Tabbable*);
+       void button_change_tabbable_visibility (Gtkmm2ext::Tabbable*);
+       void key_change_tabbable_visibility (Gtkmm2ext::Tabbable*);
+       void toggle_editor_and_mixer ();
+       
+       void tabbable_state_change (Gtkmm2ext::Tabbable&);
+
        void toggle_meterbridge ();
-        void toggle_editor_mixer ();
+       void toggle_luawindow ();
 
        int  setup_windows ();
        void setup_transport ();
        void setup_clock ();
 
        static ARDOUR_UI *theArdourUI;
+       SessionDialog *_session_dialog;
 
         int starting ();
 
@@ -367,6 +420,9 @@ class ARDOUR_UI : public Gtkmm2ext::UI, public ARDOUR::SessionHandlePtr
        void update_autosave();
        sigc::connection _autosave_connection;
 
+       void session_dirty_changed ();
+       void update_title ();
+
        void map_transport_state ();
        int32_t do_engine_start ();
 
@@ -385,22 +441,14 @@ class ARDOUR_UI : public Gtkmm2ext::UI, public ARDOUR::SessionHandlePtr
        void         start_clocking ();
        void         stop_clocking ();
 
-       bool main_window_state_event_handler (GdkEventWindowState*, bool window_was_editor);
-
        void update_transport_clocks (framepos_t pos);
        void record_state_changed ();
 
        std::list<MidiTracer*> _midi_tracer_windows;
 
-       void detach_tearoff (Gtk::Box* parent, Gtk::Widget* contents);
-       void reattach_tearoff (Gtk::Box* parent, Gtk::Widget* contents, int32_t order);
-       void reattach_all_tearoffs ();
-
        /* Transport Control */
 
-       Gtkmm2ext::TearOff*      transport_tearoff;
        Gtk::Frame               transport_frame;
-       Gtk::HBox                transport_tearoff_hbox;
        Gtk::HBox                transport_hbox;
        Gtk::Fixed               transport_base;
        Gtk::Fixed               transport_button_base;
@@ -426,7 +474,7 @@ class ARDOUR_UI : public Gtkmm2ext::UI, public ARDOUR::SessionHandlePtr
            };
 
            TransportControllable (std::string name, ARDOUR_UI&, ToggleType);
-           void set_value (double);
+           void set_value (double, PBD::Controllable::GroupControlDisposition group_override);
            double get_value (void) const;
 
            ARDOUR_UI& ui;
@@ -564,9 +612,6 @@ class ARDOUR_UI : public Gtkmm2ext::UI, public ARDOUR::SessionHandlePtr
        void edit_metadata ();
        void import_metadata ();
 
-       void session_add_audio_route (bool, int32_t, int32_t, ARDOUR::TrackMode, ARDOUR::RouteGroup *, uint32_t, std::string const &);
-       void session_add_midi_route (bool, ARDOUR::RouteGroup *, uint32_t, std::string const &, ARDOUR::PluginInfoPtr);
-
        void set_transport_sensitivity (bool);
 
        //stuff for ProTools-style numpad
@@ -605,6 +650,8 @@ class ARDOUR_UI : public Gtkmm2ext::UI, public ARDOUR::SessionHandlePtr
        bool process_snapshot_session_prompter (ArdourPrompter& prompter, bool switch_to_it);
        void snapshot_session (bool switch_to_it);
 
+       void quick_snapshot_session (bool switch_to_it);  //does not promtp for name, just makes a timestamped file
+
        SaveAsDialog* save_as_dialog;
 
        bool save_as_progress_update (float fraction, int64_t cnt, int64_t total, Gtk::Label* label, Gtk::ProgressBar* bar);
@@ -614,20 +661,25 @@ class ARDOUR_UI : public Gtkmm2ext::UI, public ARDOUR::SessionHandlePtr
 
        int         create_mixer ();
        int         create_editor ();
+       int         create_meterbridge ();
+       int         create_luawindow ();
 
        Meterbridge  *meterbridge;
-       int         create_meterbridge ();
+       LuaWindow    *luawindow;
+
         /* Dialogs that can be created via new<T> */
 
+        RCOptionEditor* rc_option_editor;
+       Gtk::HBox rc_option_editor_placeholder;
+
         WM::Proxy<SpeakerDialog> speaker_config_window;
-        WM::Proxy<KeyEditor> key_editor;
-        WM::Proxy<RCOptionEditor> rc_option_editor;
         WM::Proxy<AddRouteDialog> add_route_dialog;
         WM::Proxy<About> about;
         WM::Proxy<LocationUIWindow> location_ui;
         WM::Proxy<RouteParams_UI> route_params;
         WM::Proxy<EngineControl> audio_midi_setup;
         WM::Proxy<ExportVideoDialog> export_video_dialog;
+        WM::Proxy<LuaScriptManager> lua_script_window;
 
         /* Windows/Dialogs that require a creator method */
 
@@ -637,6 +689,7 @@ class ARDOUR_UI : public Gtkmm2ext::UI, public ARDOUR::SessionHandlePtr
         WM::ProxyWithConstructor<BigClockWindow> big_clock_window;
         WM::ProxyWithConstructor<GlobalPortMatrixWindow> audio_port_matrix;
         WM::ProxyWithConstructor<GlobalPortMatrixWindow> midi_port_matrix;
+        WM::ProxyWithConstructor<KeyEditor> key_editor;
 
         /* creator methods */
 
@@ -645,6 +698,7 @@ class ARDOUR_UI : public Gtkmm2ext::UI, public ARDOUR::SessionHandlePtr
         AddVideoDialog*         create_add_video_dialog ();
         BigClockWindow*         create_big_clock_window();
         GlobalPortMatrixWindow* create_global_port_matrix (ARDOUR::DataType);
+       KeyEditor*              create_key_editor ();
 
        ARDOUR::SystemExec *video_server_process;
 
@@ -787,6 +841,29 @@ class ARDOUR_UI : public Gtkmm2ext::UI, public ARDOUR::SessionHandlePtr
 
         int do_audio_midi_setup (uint32_t);
        void audioengine_became_silent ();
+
+       DuplicateRouteDialog* duplicate_routes_dialog;
+
+       void grab_focus_after_dialog ();
+
+       void tabs_switch (GtkNotebookPage*, guint page_number);
+       void tabs_page_added (Gtk::Widget*, guint);
+       void tabs_page_removed (Gtk::Widget*, guint);
+       ArdourButton editor_visibility_button;
+       ArdourButton mixer_visibility_button;
+       ArdourButton prefs_visibility_button;
+
+       bool key_press_focus_accelerator_handler (Gtk::Window& window, GdkEventKey* ev, Gtkmm2ext::Bindings*);
+       bool try_gtk_accel_binding (GtkWindow* win, GdkEventKey* ev, bool translate, GdkModifierType modifier);
+
+       bool main_window_delete_event (GdkEventAny*);
+       bool idle_ask_about_quit ();
+
+       void load_bindings ();
+       bool tabbable_visibility_button_press (GdkEventButton* ev, std::string const& tabbable_name);
+
+       void step_up_through_tabs ();
+       void step_down_through_tabs ();
 };
 
 #endif /* __ardour_gui_h__ */