a-fluidsynth: implement LV2_BANKPATCH__notify
[ardour.git] / gtk2_ardour / ardour_ui.h
index 29b529ccbdae8724e9302f308e80f5aed17c46d0..fbe1486736008289c3ded60fb763f32d274a93a6 100644 (file)
@@ -47,6 +47,8 @@
 #include <gtkmm/eventbox.h>
 #include <gtkmm/menu.h>
 #include <gtkmm/menuitem.h>
+#include <gtkmm/messagedialog.h>
+#include <gtkmm/notebook.h>
 #include <gtkmm/button.h>
 #include <gtkmm/togglebutton.h>
 #include <gtkmm/treeview.h>
@@ -55,9 +57,6 @@
 #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/bindings.h"
 #include "gtkmm2ext/visibility_tracker.h"
 
 
 #include "video_timeline.h"
 
+#include "widgets/ardour_button.h"
+#include "widgets/ardour_spacer.h"
+
 #include "add_route_dialog.h"
-#include "ardour_button.h"
 #include "ardour_dialog.h"
-#include "ardour_spacer.h"
 #include "ardour_window.h"
 #include "editing.h"
 #include "enums.h"
@@ -90,6 +90,7 @@
 #include "engine_dialog.h"
 #include "export_video_dialog.h"
 #include "global_port_matrix.h"
+#include "idleometer.h"
 #include "keyeditor.h"
 #include "location_ui.h"
 #include "lua_script_manager.h"
@@ -114,20 +115,19 @@ class RouteParams_UI;
 class SessionOptionEditor;
 class SpeakerDialog;
 class GlobalPortMatrixWindow;
+class IdleOMeter;
 #endif
 
 class VideoTimeLine;
 class ArdourKeyboard;
-class ArdourVSpacer;
 class AudioClock;
-class ButtonJoiner;
 class ConnectionEditor;
 class DuplicateRouteDialog;
 class MainClock;
 class Mixer_UI;
-class ArdourPrompter;
 class PublicEditor;
 class SaveAsDialog;
+class SaveTemplateDialog;
 class SessionDialog;
 class SessionOptionEditorWindow;
 class Splash;
@@ -153,7 +153,8 @@ namespace Gtk {
        class ProgressBar;
 }
 
-namespace Gtkmm2ext {
+namespace ArdourWidgets {
+       class Prompter;
        class Tabbable;
 }
 
@@ -186,7 +187,8 @@ public:
 
        int load_session (const std::string& path, const std::string& snapshot, std::string mix_template = std::string());
        bool session_loaded;
-       int build_session (const std::string& path, const std::string& snapshot, ARDOUR::BusProfile&);
+       bool session_load_in_progress;
+       int build_session (const std::string& path, const std::string& snapshot, ARDOUR::BusProfile*);
        bool session_is_new() const { return _session_is_new; }
 
        ARDOUR::Session* the_session() { return _session; }
@@ -266,16 +268,13 @@ public:
        void synchronize_sync_source_and_video_pullup ();
 
        void add_route ();
-       void add_route_dialog_finished (int);
+       void add_route_dialog_response (int);
 
        void add_routes_part_two ();
        void add_routes_thread ();
 
        void start_duplicate_routes ();
 
-       void add_lua_script ();
-       void remove_lua_script ();
-
        void add_video (Gtk::Window* float_window);
        void remove_video ();
        void start_video_server_menu (Gtk::Window* float_window);
@@ -284,54 +283,21 @@ public:
        void flush_videotimeline_cache (bool localcacheonly=false);
        void export_video (bool range = false);
 
-       void session_add_vca (std::string const &, uint32_t);
-
        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);
-       void session_add_audio_track (
-               int input_channels,
-               int32_t output_channels,
-               ARDOUR::TrackMode mode,
-               ARDOUR::RouteGroup* route_group,
-               uint32_t how_many,
-               std::string const & name_template,
-               bool strict_io,
-               ARDOUR::PresentationInfo::order_t order
-               ) {
-               session_add_audio_route (true, input_channels, output_channels, mode, route_group, how_many, name_template, strict_io, order);
-       }
-
-       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,
-                       ARDOUR::PresentationInfo::order_t order
-                       ) {
-               session_add_audio_route (false, input_channels, output_channels, ARDOUR::Normal, route_group, how_many, name_template, strict_io, order);
-       }
-
-       void session_add_midi_track (
-                       ARDOUR::RouteGroup* route_group,
-                       uint32_t how_many,
-                       std::string const & name_template,
-                       bool strict_io,
-                       ARDOUR::PluginInfoPtr instrument,
-                       ARDOUR::Plugin::PresetRecord* preset,
-                       ARDOUR::PresentationInfo::order_t order
-               ) {
-               session_add_midi_route (true, route_group, how_many, name_template, strict_io, instrument, preset, order);
-       }
-
-       void session_add_mixed_track (const ARDOUR::ChanCount&, const ARDOUR::ChanCount&, ARDOUR::RouteGroup*, uint32_t, std::string const &, bool,
+
+       void session_add_mixed_track (const ARDOUR::ChanCount&, const ARDOUR::ChanCount&, ARDOUR::RouteGroup*,
+                                     uint32_t, std::string const &, bool strict_io,
                                      ARDOUR::PluginInfoPtr, ARDOUR::Plugin::PresetRecord* pset,
                                      ARDOUR::PresentationInfo::order_t order);
-       void session_add_midi_bus (ARDOUR::RouteGroup*, uint32_t, std::string const &, bool, ARDOUR::PluginInfoPtr, ARDOUR::Plugin::PresetRecord* pset,
+
+       void session_add_midi_bus (ARDOUR::RouteGroup*, uint32_t, std::string const &, bool strict_io,
+                                  ARDOUR::PluginInfoPtr, ARDOUR::Plugin::PresetRecord* pset,
                                   ARDOUR::PresentationInfo::order_t order);
+
        void session_add_midi_route (bool, ARDOUR::RouteGroup *, uint32_t, std::string const &, bool,
                                     ARDOUR::PluginInfoPtr, ARDOUR::Plugin::PresetRecord*,
                                     ARDOUR::PresentationInfo::order_t order);
+
        void display_insufficient_ports_message ();
 
        void attach_to_engine ();
@@ -382,6 +348,8 @@ public:
 
        ARDOUR::PresentationInfo::order_t translate_order (RouteDialogs::InsertAt);
 
+       std::map<std::string, std::string> route_setup_info (const std::string& script_path);
+
 protected:
        friend class PublicEditor;
 
@@ -418,15 +386,15 @@ private:
        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 show_tabbable (ArdourWidgets::Tabbable*);
+       void hide_tabbable (ArdourWidgets::Tabbable*);
+       void detach_tabbable (ArdourWidgets::Tabbable*);
+       void attach_tabbable (ArdourWidgets::Tabbable*);
+       void button_change_tabbable_visibility (ArdourWidgets::Tabbable*);
+       void key_change_tabbable_visibility (ArdourWidgets::Tabbable*);
        void toggle_editor_and_mixer ();
 
-       void tabbable_state_change (Gtkmm2ext::Tabbable&);
+       void tabbable_state_change (ArdourWidgets::Tabbable&);
 
        void toggle_meterbridge ();
        void toggle_luawindow ();
@@ -435,8 +403,6 @@ private:
        void setup_transport ();
        void setup_clock ();
 
-       bool transport_expose (GdkEventExpose*);
-
        static ARDOUR_UI *theArdourUI;
        SessionDialog *_session_dialog;
 
@@ -464,7 +430,7 @@ private:
 
        void about_signal_response(int response);
 
-       Gtk::VBox     top_packer;
+       Gtk::VBox    top_packer;
 
        sigc::connection clock_signal_connection;
        void         update_clocks ();
@@ -482,48 +448,59 @@ private:
        Gtk::Frame               transport_frame;
        Gtk::HBox                transport_hbox;
 
-       ArdourVSpacer *secondary_clock_spacer;
+       ArdourWidgets::ArdourVSpacer* secondary_clock_spacer;
        void repack_transport_hbox ();
        void update_clock_visibility ();
 
        struct TransportControllable : public PBD::Controllable {
-           enum ToggleType {
-                   Roll = 0,
-                   Stop,
-                   RecordEnable,
-                   GotoStart,
-                   GotoEnd,
-                   AutoLoop,
-                   PlaySelection,
-           };
-
-           TransportControllable (std::string name, ARDOUR_UI&, ToggleType);
-           void set_value (double, PBD::Controllable::GroupControlDisposition group_override);
-           double get_value (void) const;
-
-           ARDOUR_UI& ui;
-           ToggleType type;
+               enum ToggleType {
+                       Roll = 0,
+                       Stop,
+                       RecordEnable,
+                       GotoStart,
+                       GotoEnd,
+                       AutoLoop,
+                       PlaySelection,
+               };
+
+               TransportControllable (std::string name, ARDOUR_UI&, ToggleType);
+               void set_value (double, PBD::Controllable::GroupControlDisposition group_override);
+               double get_value (void) const;
+
+               ARDOUR_UI& ui;
+               ToggleType type;
        };
 
+       boost::shared_ptr<TransportControllable> roll_controllable;
+       boost::shared_ptr<TransportControllable> stop_controllable;
+       boost::shared_ptr<TransportControllable> goto_start_controllable;
+       boost::shared_ptr<TransportControllable> goto_end_controllable;
+       boost::shared_ptr<TransportControllable> auto_loop_controllable;
+       boost::shared_ptr<TransportControllable> play_selection_controllable;
+       boost::shared_ptr<TransportControllable> rec_controllable;
+
        void toggle_follow_edits ();
 
-       ArdourButton roll_button;
-       ArdourButton stop_button;
-       ArdourButton goto_start_button;
-       ArdourButton goto_end_button;
-       ArdourButton auto_loop_button;
-       ArdourButton play_selection_button;
-       ArdourButton rec_button;
-       ArdourButton punch_in_button;
-       ArdourButton punch_out_button;
-       ArdourButton layered_button;
+       void set_transport_controllable_state (const XMLNode&);
+       XMLNode& get_transport_controllable_state ();
+
+       ArdourWidgets::ArdourButton roll_button;
+       ArdourWidgets::ArdourButton stop_button;
+       ArdourWidgets::ArdourButton goto_start_button;
+       ArdourWidgets::ArdourButton goto_end_button;
+       ArdourWidgets::ArdourButton auto_loop_button;
+       ArdourWidgets::ArdourButton play_selection_button;
+       ArdourWidgets::ArdourButton rec_button;
+       ArdourWidgets::ArdourButton punch_in_button;
+       ArdourWidgets::ArdourButton punch_out_button;
+       ArdourWidgets::ArdourButton layered_button;
 
-       ArdourVSpacer recpunch_spacer;
-       ArdourVSpacer monitoring_spacer;
+       ArdourWidgets::ArdourVSpacer recpunch_spacer;
+       ArdourWidgets::ArdourVSpacer monitoring_spacer;
 
-       ArdourButton monitor_in_button;
-       ArdourButton monitor_disk_button;
-       ArdourButton auto_input_button;
+       ArdourWidgets::ArdourButton monitor_in_button;
+       ArdourWidgets::ArdourButton monitor_disk_button;
+       ArdourWidgets::ArdourButton auto_input_button;
 
        Gtk::Label   punch_label;
        Gtk::Label   layered_label;
@@ -539,25 +516,30 @@ private:
        MiniTimeline   mini_timeline;
        TimeInfoBox   *time_info_box;
 
-       ArdourButton auto_return_button;
-       ArdourButton follow_edits_button;
-       ArdourButton click_button;
-       ArdourButton sync_button;
+       ArdourWidgets::ArdourButton auto_return_button;
+       ArdourWidgets::ArdourButton follow_edits_button;
+       ArdourWidgets::ArdourButton click_button;
+       ArdourWidgets::ArdourButton sync_button;
 
-       ArdourButton auditioning_alert_button;
-       ArdourButton solo_alert_button;
-       ArdourButton feedback_alert_button;
-       ArdourButton error_alert_button;
+       ArdourWidgets::ArdourButton auditioning_alert_button;
+       ArdourWidgets::ArdourButton solo_alert_button;
+       ArdourWidgets::ArdourButton feedback_alert_button;
+       ArdourWidgets::ArdourButton error_alert_button;
 
-       ArdourButton action_script_call_btn[10];
+       ArdourWidgets::ArdourButton action_script_call_btn[10];
        Gtk::Table action_script_table;
 
        Gtk::VBox alert_box;
        Gtk::VBox meter_box;
-       LevelMeterHBox * editor_meter;
-       float            editor_meter_max_peak;
-       ArdourButton     editor_meter_peak_display;
-       bool             editor_meter_peak_button_release (GdkEventButton*);
+       ArdourWidgets::ArdourButton editor_meter_peak_display;
+       LevelMeterHBox *            editor_meter;
+       float                       editor_meter_max_peak;
+       bool                        editor_meter_peak_button_release (GdkEventButton*);
+
+       bool editor_meter_button_press (GdkEventButton* ev);
+       void popup_editor_meter_menu (GdkEventButton* ev);
+       void add_editor_meter_type_item (Gtk::Menu_Helpers::MenuList&, Gtk::RadioMenuItem::Group&, std::string const &, ARDOUR::MeterType);
+       bool _suspend_editor_meter_callbacks;
 
        void blink_handler (bool);
        sigc::connection blink_connection;
@@ -640,8 +622,12 @@ private:
 
        void open_session ();
        void open_recent_session ();
-       bool process_save_template_prompter (ArdourPrompter& prompter);
+       void save_template_dialog_response (int response, SaveTemplateDialog* d);
        void save_template ();
+       void manage_templates ();
+
+       void meta_session_setup (const std::string& script_path);
+       void meta_route_setup (const std::string& script_path);
 
        void edit_metadata ();
        void import_metadata ();
@@ -668,6 +654,7 @@ private:
        void transport_play_selection();
        void transport_play_preroll();
        void transport_rec_preroll();
+       void transport_rec_count_in();
        void transport_forward (int option);
        void transport_rewind (int option);
        void transport_loop ();
@@ -683,7 +670,7 @@ private:
 
        guint32  last_key_press_time;
 
-       bool process_snapshot_session_prompter (ArdourPrompter& prompter, bool switch_to_it);
+       bool process_snapshot_session_prompter (ArdourWidgets::Prompter& 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
@@ -717,6 +704,7 @@ private:
        WM::Proxy<EngineControl> audio_midi_setup;
        WM::Proxy<ExportVideoDialog> export_video_dialog;
        WM::Proxy<LuaScriptManager> lua_script_window;
+       WM::Proxy<IdleOMeter> idleometer;
 
        /* Windows/Dialogs that require a creator method */
 
@@ -828,6 +816,7 @@ private:
 
        PBD::ScopedConnectionList forever_connections;
        PBD::ScopedConnection halt_connection;
+       PBD::ScopedConnection editor_meter_connection;
 
        void step_edit_status_change (bool);
 
@@ -852,7 +841,7 @@ private:
 
        void feedback_detected ();
 
-       ArdourButton             midi_panic_button;
+       ArdourWidgets::ArdourButton             midi_panic_button;
        void                     midi_panic ();
 
        void successful_graph_sort ();
@@ -884,9 +873,9 @@ private:
        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;
+       ArdourWidgets::ArdourButton editor_visibility_button;
+       ArdourWidgets::ArdourButton mixer_visibility_button;
+       ArdourWidgets::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);
@@ -903,6 +892,9 @@ private:
        void escape ();
        void close_current_dialog ();
        void pre_release_dialog ();
+
+       bool bind_lua_action_script (GdkEventButton*, int);
+       void update_action_script_btn (int i, const std::string&);
 };
 
 #endif /* __ardour_gui_h__ */