change ownership of the AutomationControl used by Amp.
[ardour.git] / gtk2_ardour / processor_box.cc
index 181fc22a19c6342e5576aa47c7bda50d237e2e55..68beac400abf8028e429219b75eaf462e0b71613 100644 (file)
@@ -711,7 +711,7 @@ ProcessorEntry::Control::slider_adjusted ()
                return;
        }
 
-       c->set_value ( c->interface_to_internal(_adjustment.get_value ()) );
+       c->set_value ( c->interface_to_internal(_adjustment.get_value ()) , Controllable::NoGroup);
        set_tooltip ();
 }
 
@@ -726,7 +726,7 @@ ProcessorEntry::Control::button_clicked ()
 
        bool const n = _button.get_active ();
 
-       c->set_value (n ? 0 : 1);
+       c->set_value (n ? 0 : 1, Controllable::NoGroup);
        _button.set_active (!n);
        set_tooltip ();
 }
@@ -1105,16 +1105,24 @@ ProcessorEntry::RoutingIcon::on_expose_event (GdkEventExpose* ev)
 static std::list<Gtk::TargetEntry> drop_targets()
 {
        std::list<Gtk::TargetEntry> tmp;
-       tmp.push_back (Gtk::TargetEntry ("processor"));
-       tmp.push_back (Gtk::TargetEntry ("PluginInfoPtr"));
-       tmp.push_back (Gtk::TargetEntry ("PluginPresetPtr"));
+       tmp.push_back (Gtk::TargetEntry ("processor")); // from processor-box to processor-box
+       tmp.push_back (Gtk::TargetEntry ("PluginInfoPtr")); // from plugin-manager
+       tmp.push_back (Gtk::TargetEntry ("PluginPresetPtr")); // from sidebar
        return tmp;
 }
 
-static std::list<Gtk::TargetEntry> drop_targets_noplugin()
+static std::list<Gtk::TargetEntry> drag_targets()
 {
        std::list<Gtk::TargetEntry> tmp;
-       tmp.push_back (Gtk::TargetEntry ("processor"));
+       tmp.push_back (Gtk::TargetEntry ("PluginPresetPtr")); // to sidebar (optional preset)
+       tmp.push_back (Gtk::TargetEntry ("processor")); // to processor-box (copy)
+       return tmp;
+}
+
+static std::list<Gtk::TargetEntry> drag_targets_noplugin()
+{
+       std::list<Gtk::TargetEntry> tmp;
+       tmp.push_back (Gtk::TargetEntry ("processor")); // to processor box (sends, faders re-order)
        return tmp;
 }
 
@@ -2019,7 +2027,8 @@ ProcessorBox::help_count_visible_prefader_processors (boost::weak_ptr<Processor>
                         )
           ) {
 
-               if (boost::dynamic_pointer_cast<Amp>(processor) && boost::dynamic_pointer_cast<Amp>(processor)->type() == X_("amp")) {
+               if (boost::dynamic_pointer_cast<Amp>(processor) && 
+                   boost::dynamic_pointer_cast<Amp>(processor)->gain_control()->parameter().type() == GainAutomation) {
                        *amp_seen = true;
                } else {
                        if (!*amp_seen) {
@@ -2088,9 +2097,9 @@ ProcessorBox::add_processor_to_display (boost::weak_ptr<Processor> p)
 #endif
                 )
        {
-               processor_display.add_child (e);
+               processor_display.add_child (e, drag_targets());
        } else {
-               processor_display.add_child (e, drop_targets_noplugin());
+               processor_display.add_child (e, drag_targets_noplugin());
        }
 }
 
@@ -2109,7 +2118,8 @@ ProcessorBox::setup_entry_positions ()
 
        uint32_t num = 0;
        for (list<ProcessorEntry*>::iterator i = children.begin(); i != children.end(); ++i) {
-               if (boost::dynamic_pointer_cast<Amp>((*i)->processor()) && boost::dynamic_pointer_cast<Amp>((*i)->processor())->type() == X_("amp")) {
+               if (boost::dynamic_pointer_cast<Amp>((*i)->processor()) && 
+                   boost::dynamic_pointer_cast<Amp>((*i)->processor())->gain_control()->parameter().type() == GainAutomation) {
                        pre_fader = false;
                        (*i)->set_position (ProcessorEntry::Fader, num++);
                } else {
@@ -2681,7 +2691,7 @@ ProcessorBox::get_editor_window (boost::shared_ptr<Processor> processor, bool us
                }
        }
 
-       if (boost::dynamic_pointer_cast<Amp> (processor) && boost::dynamic_pointer_cast<Amp> (processor)->type() == X_("amp")) {
+       if (boost::dynamic_pointer_cast<Amp> (processor) && boost::dynamic_pointer_cast<Amp> (processor)->gain_control()->parameter().type() == GainAutomation) {
 
                if (_parent_strip) {
                        _parent_strip->revert_to_default_display ();