Added Write All, Play All, etc. automation buttons to generic plugin UI
authorJeremy Carter <Jeremy@JeremyCarter.ca>
Tue, 11 Nov 2014 23:05:27 +0000 (18:05 -0500)
committerJeremy Carter <Jeremy@JeremyCarter.ca>
Tue, 11 Nov 2014 23:05:27 +0000 (18:05 -0500)
gtk2_ardour/generic_pluginui.cc
gtk2_ardour/plugin_ui.h

index a26ccfb694644c0f57b38541a3696accfc5cd291..dbb86277e0a19b69c647ebb13308e11d7c125eef 100644 (file)
@@ -76,7 +76,9 @@ GenericPluginUI::GenericPluginUI (boost::shared_ptr<PluginInsert> pi, bool scrol
 
        HBox* constraint_hbox = manage (new HBox);
        HBox* smaller_hbox = manage (new HBox);
+       HBox* automation_hbox = manage (new HBox);
        smaller_hbox->set_spacing (4);
+       automation_hbox->set_spacing (4);
        Label* combo_label = manage (new Label (_("<span size=\"large\">Presets</span>")));
        combo_label->set_use_markup (true);
 
@@ -91,6 +93,20 @@ GenericPluginUI::GenericPluginUI (boost::shared_ptr<PluginInsert> pi, bool scrol
        smaller_hbox->pack_start (save_button, false, false);
        smaller_hbox->pack_start (delete_button, false, false);
        smaller_hbox->pack_start (bypass_button, false, true);
+       
+       automation_manual_all_button.set_label(_("Manual All"));
+       automation_play_all_button.set_label(_("Play All"));
+       automation_write_all_button.set_label(_("Write All"));
+       automation_touch_all_button.set_label(_("Touch All"));
+       
+       Gtk::Alignment *al = Gtk::manage(new Gtk::Alignment());
+    al->set_size_request(6, 2);
+    automation_hbox->pack_start(*al, false, true);
+    
+       automation_hbox->pack_start (automation_manual_all_button, false, false);
+       automation_hbox->pack_start (automation_play_all_button, false, false);
+       automation_hbox->pack_start (automation_write_all_button, false, false);
+       automation_hbox->pack_start (automation_touch_all_button, false, false);
 
        constraint_hbox->set_spacing (5);
        constraint_hbox->set_homogeneous (false);
@@ -103,6 +119,7 @@ GenericPluginUI::GenericPluginUI (boost::shared_ptr<PluginInsert> pi, bool scrol
        }
 
        v1_box->pack_start (*smaller_hbox, false, true);
+       v1_box->pack_start (*automation_hbox, false, true);
        v2_box->pack_start (focus_button, false, true);
 
        main_contents.pack_start (settings_box, false, false);
@@ -309,6 +326,12 @@ GenericPluginUI::build ()
        if (!descs.empty()) {
                plugin->announce_property_values();
        }
+       
+       // Connect automation *_all buttons
+       automation_manual_all_button.signal_clicked().connect(boost::bind(&GenericPluginUI::automation_manual_all, this, control_uis));
+       automation_play_all_button.signal_clicked().connect(boost::bind(&GenericPluginUI::automation_play_all, this, control_uis));
+    automation_write_all_button.signal_clicked().connect(boost::bind(&GenericPluginUI::automation_write_all, this, control_uis));
+    automation_touch_all_button.signal_clicked().connect(boost::bind(&GenericPluginUI::automation_touch_all, this, control_uis));
 
        // Add special controls to UI, and build list of normal controls to be layed out later
        std::vector<ControlUI *> cui_controls_list;
@@ -814,6 +837,42 @@ GenericPluginUI::astate_clicked (ControlUI* cui)
        automation_menu->popup (1, gtk_get_current_event_time());
 }
 
+void 
+GenericPluginUI::automation_manual_all(std::vector<ControlUI *>& controls)
+{
+    for (std::vector<ControlUI *>::iterator control_it = controls.begin(); control_it != controls.end(); ++control_it)
+    {
+        set_automation_state((AutoState) ARDOUR::Off, (*control_it));
+    }
+}
+
+void 
+GenericPluginUI::automation_play_all(std::vector<ControlUI *>& controls)
+{
+    for (std::vector<ControlUI *>::iterator control_it = controls.begin(); control_it != controls.end(); ++control_it)
+    {
+        set_automation_state((AutoState) Play, (*control_it));
+    }
+}
+
+void 
+GenericPluginUI::automation_write_all(std::vector<ControlUI *>& controls)
+{
+    for (std::vector<ControlUI *>::iterator control_it = controls.begin(); control_it != controls.end(); ++control_it)
+    {
+        set_automation_state((AutoState) Write, (*control_it));
+    }
+}
+
+void 
+GenericPluginUI::automation_touch_all(std::vector<ControlUI *>& controls)
+{
+    for (std::vector<ControlUI *>::iterator control_it = controls.begin(); control_it != controls.end(); ++control_it)
+    {
+        set_automation_state((AutoState) Touch, (*control_it));
+    }
+}
+
 void
 GenericPluginUI::set_automation_state (AutoState state, ControlUI* cui)
 {
index e02d8eab57da9a38e09fb3e1ba592d8354d03752..0407afcb71d4055b91d8625764344e5bb9f9f400 100644 (file)
@@ -135,6 +135,14 @@ class PlugUIBase : public virtual sigc::trackable, public PBD::ScopedConnectionL
        Gtk::Label latency_label;
        /** a button which, when clicked, opens the latency GUI */
        Gtk::Button latency_button;
+       /** a button which sets all controls' automation setting to Manual */
+       Gtk::Button automation_manual_all_button;
+       /** a button which sets all controls' automation setting to Play */
+       Gtk::Button automation_play_all_button;
+    /** a button which sets all controls' automation setting to Write */
+       Gtk::Button automation_write_all_button;
+       /** a button which sets all controls' automation setting to Touch */
+       Gtk::Button automation_touch_all_button;
        
        void set_latency_label ();
 
@@ -280,6 +288,10 @@ class GenericPluginUI : public PlugUIBase, public Gtk::VBox
        void set_automation_state (ARDOUR::AutoState state, ControlUI* cui);
        void start_touch (ControlUI*);
        void stop_touch (ControlUI*);
+       void automation_manual_all(std::vector<ControlUI*>&);
+       void automation_play_all(std::vector<ControlUI*>&);
+       void automation_write_all(std::vector<ControlUI*>&);
+       void automation_touch_all(std::vector<ControlUI*>&);
 
        /* XXX: remove */
        void print_parameter (char *buf, uint32_t len, uint32_t param);