first compilable version of tabbable design.
[ardour.git] / gtk2_ardour / processor_box.cc
index 092cd5e8301358777df8a31199975b26724c36f5..4271f313fd127bc948a3bd5cd7e3a1869679cc42 100644 (file)
 #include "gtk2ardour-config.h"
 #endif
 
-#ifdef COMPILER_MSVC
-#define rintf(x) round((x) + 0.5)
-#endif
-
 #include <cmath>
 #include <iostream>
 #include <set>
@@ -49,6 +45,7 @@
 #include "ardour/audioengine.h"
 #include "ardour/internal_return.h"
 #include "ardour/internal_send.h"
+#include "ardour/meter.h"
 #include "ardour/panner_shell.h"
 #include "ardour/plugin_insert.h"
 #include "ardour/pannable.h"
@@ -77,6 +74,8 @@
 #include "route_processor_selection.h"
 #include "send_ui.h"
 #include "timers.h"
+#include "tooltips.h"
+#include "new_plugin_preset_dialog.h"
 
 #include "i18n.h"
 
 class AUPluginUI;
 #endif
 
+#ifndef NDEBUG
+bool ProcessorBox::show_all_processors = false;
+#endif
+
 using namespace std;
 using namespace ARDOUR;
 using namespace PBD;
@@ -94,7 +97,9 @@ using namespace Gtkmm2ext;
 ProcessorBox* ProcessorBox::_current_processor_box = 0;
 RefPtr<Action> ProcessorBox::paste_action;
 RefPtr<Action> ProcessorBox::cut_action;
+RefPtr<Action> ProcessorBox::copy_action;
 RefPtr<Action> ProcessorBox::rename_action;
+RefPtr<Action> ProcessorBox::delete_action;
 RefPtr<Action> ProcessorBox::edit_action;
 RefPtr<Action> ProcessorBox::edit_generic_action;
 
@@ -106,6 +111,7 @@ ProcessorEntry::ProcessorEntry (ProcessorBox* parent, boost::shared_ptr<Processo
        , _position (PreFader)
        , _position_num(0)
        , _selectable(true)
+       , _unknown_processor(false)
        , _parent (parent)
        , _processor (p)
        , _width (w)
@@ -113,13 +119,26 @@ ProcessorEntry::ProcessorEntry (ProcessorBox* parent, boost::shared_ptr<Processo
        , _output_icon(false)
 {
        _vbox.show ();
-       
+
        _button.set_distinct_led_click (true);
        _button.set_fallthrough_to_parent(true);
        _button.set_led_left (true);
        _button.signal_led_clicked.connect (sigc::mem_fun (*this, &ProcessorEntry::led_clicked));
        _button.set_text (name (_width));
 
+       if (boost::dynamic_pointer_cast<PeakMeter> (_processor)) {
+               _button.set_elements(ArdourButton::Element(_button.elements() & ~ArdourButton::Indicator));
+       }
+       if (boost::dynamic_pointer_cast<UnknownProcessor> (_processor)) {
+               _button.set_elements(ArdourButton::Element(_button.elements() & ~ArdourButton::Indicator));
+               _unknown_processor = true;
+       }
+       {
+               boost::shared_ptr<PluginInsert> pi = boost::dynamic_pointer_cast<PluginInsert> (_processor);
+               if (pi && pi->plugin()) {
+                       _plugin_preset_pointer = PluginPresetPtr (new PluginPreset (pi->plugin()->get_info()));
+               }
+       }
        if (_processor) {
 
                _vbox.pack_start (_routing_icon);
@@ -143,7 +162,7 @@ ProcessorEntry::ProcessorEntry (ProcessorBox* parent, boost::shared_ptr<Processo
 
                set<Evoral::Parameter> p = _processor->what_can_be_automated ();
                for (set<Evoral::Parameter>::iterator i = p.begin(); i != p.end(); ++i) {
-                       
+
                        std::string label = _processor->describe_parameter (*i);
 
                        if (boost::dynamic_pointer_cast<Send> (_processor)) {
@@ -153,11 +172,11 @@ ProcessorEntry::ProcessorEntry (ProcessorBox* parent, boost::shared_ptr<Processo
                        }
 
                        Control* c = new Control (_processor->automation_control (*i), label);
-                       
+
                        _controls.push_back (c);
 
                        if (boost::dynamic_pointer_cast<Amp> (_processor) == 0) {
-                               /* Add non-Amp controls to the processor box */
+                               /* Add non-Amp (Fader & Trim) controls to the processor box */
                                _vbox.pack_start (c->box);
                        }
                }
@@ -199,6 +218,60 @@ ProcessorEntry::drag_text () const
 {
        return name (Wide);
 }
+bool
+ProcessorEntry::drag_data_get (Glib::RefPtr<Gdk::DragContext> const, Gtk::SelectionData &data)
+{
+       if (data.get_target() == "PluginPresetPtr") {
+               boost::shared_ptr<PluginInsert> pi = boost::dynamic_pointer_cast<PluginInsert> (_processor);
+
+               if (!_plugin_preset_pointer || !pi) {
+                       data.set (data.get_target(), 8, NULL, 0);
+                       return true;
+               }
+
+               boost::shared_ptr<ARDOUR::Plugin> plugin = pi->plugin();
+               assert (plugin);
+
+               PluginManager& manager (PluginManager::instance());
+               bool fav = manager.get_status (_plugin_preset_pointer->_pip) == PluginManager::Favorite;
+
+               NewPluginPresetDialog d (plugin,
+                               string_compose(_("New Favorite Preset for \"%1\""),_plugin_preset_pointer->_pip->name), !fav);
+
+               _plugin_preset_pointer->_preset.valid = false;
+
+               switch (d.run ()) {
+                       case Gtk::RESPONSE_CANCEL:
+                               data.set (data.get_target(), 8, NULL, 0);
+                               return true;
+                               break;
+
+                       case Gtk::RESPONSE_NO:
+                               break;
+
+                       case Gtk::RESPONSE_ACCEPT:
+                               if (d.name().empty()) {
+                                       break;
+                               }
+
+                               if (d.replace ()) {
+                                       plugin->remove_preset (d.name ());
+                               }
+
+                               Plugin::PresetRecord const r = plugin->save_preset (d.name());
+
+                               if (!r.uri.empty ()) {
+                                       _plugin_preset_pointer->_preset.uri   = r.uri;
+                                       _plugin_preset_pointer->_preset.label = r.label;
+                                       _plugin_preset_pointer->_preset.user  = r.user;
+                                       _plugin_preset_pointer->_preset.valid = r.valid;
+                               }
+               }
+               data.set (data.get_target(), 8, (const guchar *) &_plugin_preset_pointer, sizeof (PluginPresetPtr));
+               return true;
+       }
+       return false;
+}
 
 void
 ProcessorEntry::set_position (Position p, uint32_t num)
@@ -228,6 +301,11 @@ ProcessorEntry::set_visual_state (Gtkmm2ext::VisualState s, bool yn)
 void
 ProcessorEntry::setup_visuals ()
 {
+       if (_unknown_processor) {
+               _button.set_name ("processor stub");
+               return;
+       }
+
        switch (_position) {
        case PreFader:
                _button.set_name ("processor prefader");
@@ -258,13 +336,39 @@ ProcessorEntry::set_enum_width (Width w)
 }
 
 void
-ProcessorEntry::led_clicked()
+ProcessorEntry::led_clicked(GdkEventButton *ev)
 {
+       bool ctrl_shift_pressed = false;
+       Keyboard::ModifierMask ctrl_shift_mask = Keyboard::ModifierMask (Keyboard::PrimaryModifier|Keyboard::TertiaryModifier);
+
+       if (Keyboard::modifier_state_equals (ev->state, ctrl_shift_mask)) {
+               ctrl_shift_pressed = true;
+       }
+
        if (_processor) {
                if (_button.get_active ()) {
-                       _processor->deactivate ();
+                       if (ctrl_shift_pressed) {
+                               _parent->all_visible_processors_active(false);
+
+                               if (_position == Fader) {
+                                       _processor->deactivate ();
+                               }
+                       }
+                       else {
+                               _processor->deactivate ();
+                       }
+
                } else {
-                       _processor->activate ();
+                       if (ctrl_shift_pressed) {
+                               _parent->all_visible_processors_active(true);
+
+                               if (_position == Fader) {
+                                       _processor->activate ();
+                               }
+                       }
+                       else {
+                               _processor->activate ();
+                       }
                }
        }
 }
@@ -310,16 +414,21 @@ ProcessorEntry::setup_tooltip ()
                                postfix = string_compose(_("\nThis mono plugin has been replicated %1 times."), replicated);
                        }
                        if (pi->plugin()->has_editor()) {
-                               ARDOUR_UI::instance()->set_tip (_button,
-                                               string_compose (_("<b>%1</b>\nDouble-click to show GUI.\nAlt+double-click to show generic GUI.%2"), name (Wide), postfix));
+                               ARDOUR_UI_UTILS::set_tooltip (_button,
+                                               string_compose (_("<b>%1</b>\nDouble-click to show GUI.\n%2+double-click to show generic GUI.%3"), name (Wide), Keyboard::primary_modifier_name (), postfix));
                        } else {
-                               ARDOUR_UI::instance()->set_tip (_button,
+                               ARDOUR_UI_UTILS::set_tooltip (_button,
                                                string_compose (_("<b>%1</b>\nDouble-click to show generic GUI.%2"), name (Wide), postfix));
                        }
                        return;
                }
+               if(boost::dynamic_pointer_cast<UnknownProcessor> (_processor)) {
+                       ARDOUR_UI::instance()->set_tip (_button,
+                                       string_compose (_("<b>%1</b>\nThe Plugin is not available on this system\nand has been replaced by a stub."), name (Wide)));
+                       return;
+               }
        }
-       ARDOUR_UI::instance()->set_tip (_button, string_compose ("<b>%1</b>", name (Wide)));
+       ARDOUR_UI_UTILS::set_tooltip (_button, string_compose ("<b>%1</b>", name (Wide)));
 }
 
 string
@@ -436,7 +545,7 @@ ProcessorEntry::build_controls_menu ()
        items.push_back (
                MenuElem (_("Show All Controls"), sigc::mem_fun (*this, &ProcessorEntry::show_all_controls))
                );
-               
+
        items.push_back (
                MenuElem (_("Hide All Controls"), sigc::mem_fun (*this, &ProcessorEntry::hide_all_controls))
                );
@@ -444,7 +553,7 @@ ProcessorEntry::build_controls_menu ()
        if (!_controls.empty ()) {
                items.push_back (SeparatorElem ());
        }
-       
+
        for (list<Control*>::iterator i = _controls.begin(); i != _controls.end(); ++i) {
                items.push_back (CheckMenuElem ((*i)->name ()));
                Gtk::CheckMenuItem* c = dynamic_cast<Gtk::CheckMenuItem*> (&items.back ());
@@ -493,7 +602,7 @@ ProcessorEntry::toggle_panner_link ()
 ProcessorEntry::Control::Control (boost::shared_ptr<AutomationControl> c, string const & n)
        : _control (c)
        , _adjustment (gain_to_slider_position_with_max (1.0, Config->get_max_gain()), 0, 1, 0.01, 0.1)
-       , _slider (&_adjustment, boost::shared_ptr<PBD::Controllable>(), 0, 13)
+       , _slider (&_adjustment, boost::shared_ptr<PBD::Controllable>(), 0, max(13.f, rintf(13.f * UIConfiguration::instance().get_ui_scale())))
        , _slider_persistant_tooltip (&_slider)
        , _button (ArdourButton::led_default_elements)
        , _ignore_ui_adjustment (false)
@@ -511,11 +620,12 @@ ProcessorEntry::Control::Control (boost::shared_ptr<AutomationControl> c, string
                _button.show ();
 
                _button.signal_clicked.connect (sigc::mem_fun (*this, &Control::button_clicked));
-               _button.signal_led_clicked.connect (sigc::mem_fun (*this, &Control::button_clicked));
-               c->Changed.connect (_connection, MISSING_INVALIDATOR, boost::bind (&Control::control_changed, this), gui_context ());
+               _button.signal_led_clicked.connect (sigc::mem_fun (*this, &Control::button_clicked_event));
+               // dup. currently timers are used :(
+               //c->Changed.connect (_connection, MISSING_INVALIDATOR, boost::bind (&Control::control_changed, this), gui_context ());
 
        } else {
-               
+
                _slider.set_name ("ProcessorControlSlider");
                _slider.set_text (_name);
 
@@ -546,13 +656,16 @@ ProcessorEntry::Control::Control (boost::shared_ptr<AutomationControl> c, string
                _adjustment.set_step_increment (smallstep);
                _adjustment.set_page_increment (largestep);
                _slider.set_default_value (normal);
-               
+
                _adjustment.signal_value_changed().connect (sigc::mem_fun (*this, &Control::slider_adjusted));
-               c->Changed.connect (_connection, MISSING_INVALIDATOR, boost::bind (&Control::control_changed, this), gui_context ());
+               // dup. currently timers are used :(
+               //c->Changed.connect (_connection, MISSING_INVALIDATOR, boost::bind (&Control::control_changed, this), gui_context ());
        }
 
-       Timers::rapid_connect (sigc::mem_fun (*this, &Control::control_changed));
-       
+       // yuck, do we really need to do this?
+       // according to c404374 this is only needed for send automation
+       timer_connection = Timers::rapid_connect (sigc::mem_fun (*this, &Control::control_changed));
+
        control_changed ();
        set_tooltip ();
 
@@ -560,6 +673,11 @@ ProcessorEntry::Control::Control (boost::shared_ptr<AutomationControl> c, string
        set_no_tooltip_whatsoever (_slider);
 }
 
+ProcessorEntry::Control::~Control ()
+{
+       timer_connection.disconnect ();
+}
+
 void
 ProcessorEntry::Control::set_tooltip ()
 {
@@ -568,20 +686,16 @@ ProcessorEntry::Control::set_tooltip ()
        if (!c) {
                return;
        }
-       
-       stringstream s;
-       s << _name << ": ";
+       char tmp[256];
        if (c->toggled ()) {
-               s << (c->get_value() > 0.5 ? _("on") : _("off"));
+               snprintf (tmp, sizeof(tmp), "%s: %s", _name.c_str(), c->get_value() > 0.5 ? _("on") : _("off"));
        } else {
-               s << setprecision(2) << fixed;
-               s << c->internal_to_user (c->get_value ());
+               snprintf (tmp, sizeof(tmp), "%s: %.2f", _name.c_str(), c->internal_to_user (c->get_value ()));
        }
 
-       string sm = Glib::Markup::escape_text (s.str());
-       
+       string sm = Gtkmm2ext::markup_escape_text (tmp);
        _slider_persistant_tooltip.set_tip (sm);
-       ARDOUR_UI::instance()->set_tip (_button, sm);
+       ARDOUR_UI_UTILS::set_tooltip (_button, sm);
 }
 
 void
@@ -590,14 +704,14 @@ ProcessorEntry::Control::slider_adjusted ()
        if (_ignore_ui_adjustment) {
                return;
        }
-       
+
        boost::shared_ptr<AutomationControl> c = _control.lock ();
 
        if (!c) {
                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 ();
 }
 
@@ -612,11 +726,19 @@ 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 ();
 }
 
+void
+ProcessorEntry::Control::button_clicked_event (GdkEventButton *ev)
+{
+       (void) ev;
+
+       button_clicked ();
+}
+
 void
 ProcessorEntry::Control::control_changed ()
 {
@@ -630,13 +752,17 @@ ProcessorEntry::Control::control_changed ()
        if (c->toggled ()) {
 
                _button.set_active (c->get_value() > 0.5);
-               
-       } else {
 
-               _adjustment.set_value (c->internal_to_interface(c->get_value ()));
-               set_tooltip ();
+       } else {
+               // as long as rapid timers are used, only update the tooltip
+               // if the value has changed.
+               const double nval = c->internal_to_interface (c->get_value ());
+               if (_adjustment.get_value() != nval) {
+                       _adjustment.set_value (nval);
+                       set_tooltip ();
+               }
        }
-       
+
        _ignore_ui_adjustment = false;
 }
 
@@ -669,7 +795,7 @@ ProcessorEntry::Control::set_visible (bool v)
        } else {
                box.hide ();
        }
-       
+
        _visible = v;
 }
 
@@ -707,14 +833,13 @@ PluginInsertProcessorEntry::PluginInsertProcessorEntry (ProcessorBox* b, boost::
 void
 PluginInsertProcessorEntry::plugin_insert_splitting_changed ()
 {
-       _output_icon.set_ports(_plugin_insert->output_streams());
-       _routing_icon.set_splitting(_plugin_insert->splitting ());
+       ChanCount in, out; // actual configured i/o
+       _plugin_insert->configured_io (in, out);
 
-       ChanCount sources = _plugin_insert->input_streams();
+       /* get number of input ports */
        ChanCount sinks = _plugin_insert->natural_input_streams();
-
-       /* replicated instances */
        if (!_plugin_insert->splitting () && _plugin_insert->get_count() > 1) {
+               /* replicated instances */
                for (DataType::iterator t = DataType::begin(); t != DataType::end(); ++t) {
                        sinks.set(*t, sinks.get(*t) * _plugin_insert->get_count());
                }
@@ -722,19 +847,52 @@ PluginInsertProcessorEntry::plugin_insert_splitting_changed ()
        /* MIDI bypass */
        if (_plugin_insert->natural_output_streams().n_midi() == 0 &&
                        _plugin_insert->output_streams().n_midi() == 1) {
+               in.set(DataType::MIDI, 1);
+               out.set(DataType::MIDI, 1);
                sinks.set(DataType::MIDI, 1);
-               sources.set(DataType::MIDI, 1);
        }
 
+       /* the Input streams available (*valid* outputs from prev. plugin)
+        * this will be <= sinks. Some input-ports of this processor
+        * may be unconnected.
+        */
+       _routing_icon.set_sources(in);
+
+       /* the actual input ports of this processor */
        _input_icon.set_ports(sinks);
        _routing_icon.set_sinks(sinks);
-       _routing_icon.set_sources(sources);
 
-       if (_plugin_insert->splitting () ||
-                       _plugin_insert->input_streams().n_audio() < _plugin_insert->natural_input_streams().n_audio()
-                )
+       /* set/override plugin-output ports to actual outputs-streams.
+        *
+        * This plugin may have unconnected output-ports (currently only in Mixbus,
+        * e.g channelstrip-EQ at the top of a MIDI-channel before the synth).
+        *
+        * The *next* processor below this one will only see the
+        * actual available streams (it cannot know the real outputs
+        * of this plugin).
+        *
+        * There is currently no API to query the ports of the previous (or next)
+        * processor.
+        *
+        * (normally - iff configuration succeeds - this is set during
+        * ProcessorEntry::processor_configuration_changed() and should
+        * equal _plugin_insert->output_streams())
+        */
+       _output_icon.set_ports(out);
+#ifndef NDEBUG
+       if (out != _plugin_insert->output_streams()) {
+               std::cerr << "Processor Wiring: " <<  processor()->name()
+                       << " out-ports: " << _plugin_insert->output_streams() // NB. does not include midi-bypass
+                       << " out-connections: " << out
+                       << endmsg;
+       }
+#endif
+
+       _routing_icon.set_splitting(_plugin_insert->splitting ());
+
+       if (_plugin_insert->splitting () ||  in != sinks)
        {
-               _routing_icon.set_size_request (-1, 7);
+               _routing_icon.set_size_request (-1, std::max (7.f, rintf(7.f * UIConfiguration::instance().get_ui_scale())));
                _routing_icon.set_visible(true);
                _input_icon.show();
        } else {
@@ -756,6 +914,11 @@ PluginInsertProcessorEntry::hide_things ()
        plugin_insert_splitting_changed ();
 }
 
+ProcessorEntry::PortIcon::PortIcon(bool input) {
+       _input = input;
+       _ports = ARDOUR::ChanCount(ARDOUR::DataType::AUDIO, 1);
+       set_size_request (-1, std::max (2.f, rintf(2.f * UIConfiguration::instance().get_ui_scale())));
+}
 
 bool
 ProcessorEntry::PortIcon::on_expose_event (GdkEventExpose* ev)
@@ -775,6 +938,7 @@ ProcessorEntry::PortIcon::on_expose_event (GdkEventExpose* ev)
        cairo_rectangle (cr, 0, 0, width, height);
        cairo_fill (cr);
 
+       const double dx = rint(max(2., 2. * UIConfiguration::instance().get_ui_scale()));
        if (_ports.n_total() > 1) {
                for (uint32_t i = 0; i < _ports.n_total(); ++i) {
                        if (i < _ports.n_midi()) {
@@ -789,7 +953,7 @@ ProcessorEntry::PortIcon::on_expose_event (GdkEventExpose* ev)
                                                UINT_RGBA_B_FLT(audio_port_color));
                        }
                        const float x = rintf(width * (.2f + .6f * i / (_ports.n_total() - 1.f)));
-                       cairo_rectangle (cr, x-1, 0, 3, height);
+                       cairo_rectangle (cr, x-dx * .5, 0, 1+dx, height);
                        cairo_fill(cr);
                }
        } else if (_ports.n_total() == 1) {
@@ -805,7 +969,7 @@ ProcessorEntry::PortIcon::on_expose_event (GdkEventExpose* ev)
                                        UINT_RGBA_B_FLT(audio_port_color));
                }
                const float x = rintf(width * .5);
-               cairo_rectangle (cr, x-1, 0, 3, height);
+               cairo_rectangle (cr, x-dx * .5, 0, 1+dx, height);
                cairo_fill(cr);
                cairo_stroke(cr);
        }
@@ -822,7 +986,7 @@ ProcessorEntry::RoutingIcon::on_expose_event (GdkEventExpose* ev)
        cairo_rectangle (cr, ev->area.x, ev->area.y, ev->area.width, ev->area.height);
        cairo_clip (cr);
 
-       cairo_set_line_width (cr, 1.0);
+       cairo_set_line_width (cr, max (1.f, UIConfiguration::instance().get_ui_scale()));
        cairo_set_line_cap (cr, CAIRO_LINE_CAP_ROUND);
 
        Gtk::Allocation a = get_allocation();
@@ -841,10 +1005,12 @@ ProcessorEntry::RoutingIcon::on_expose_event (GdkEventExpose* ev)
        const uint32_t sources = _sources.n_total();
        const uint32_t sinks = _sinks.n_total();
 
-       /* MIDI */
        const uint32_t midi_sources = _sources.n_midi();
        const uint32_t midi_sinks = _sinks.n_midi();
+       const uint32_t audio_sources = _sources.n_audio();
+       const uint32_t audio_sinks = _sinks.n_audio();
 
+       /* MIDI */
        cairo_set_source_rgb (cr,
                        UINT_RGBA_R_FLT(midi_port_color),
                        UINT_RGBA_G_FLT(midi_port_color),
@@ -869,11 +1035,24 @@ ProcessorEntry::RoutingIcon::on_expose_event (GdkEventExpose* ev)
                cairo_move_to (cr, si_x, height);
                cairo_curve_to (cr, si_x, 0, si_x0, height, si_x0, 0);
                cairo_stroke (cr);
+       } else if (midi_sources == 0 && midi_sinks == 1) {
+               const double dx = 1 + rint(max(2., 2. * UIConfiguration::instance().get_ui_scale()));
+               // draw "T"
+               //  TODO connect back to track-input of last midi-out if any, otherwise draw "X"
+               const float si_x  = rintf(width * .2f) + .5f;
+               cairo_move_to (cr, si_x, height);
+               cairo_line_to (cr, si_x, height * .66);
+               cairo_move_to (cr, si_x - dx, height * .66);
+               cairo_line_to (cr, si_x + dx, height * .66);
+               cairo_stroke (cr);
+#ifndef NDEBUG
+       } else if (midi_sources != 0 && midi_sinks != 0) {
+               PBD::warning << string_compose("Programming error: midi routing display: A %1 -> %2 | M %3 -> %4 | T %5 -> %6",
+                               audio_sources, audio_sinks, midi_sources, midi_sinks, sources, sinks) << endmsg;
+#endif
        }
 
        /* AUDIO */
-       const uint32_t audio_sources = _sources.n_audio();
-       const uint32_t audio_sinks = _sinks.n_audio();
        cairo_set_source_rgb (cr,
                        UINT_RGBA_R_FLT(audio_port_color),
                        UINT_RGBA_G_FLT(audio_port_color),
@@ -890,7 +1069,7 @@ ProcessorEntry::RoutingIcon::on_expose_event (GdkEventExpose* ev)
                        cairo_curve_to (cr, si_x, 0, si_x0, height, si_x0, 0);
                        cairo_stroke (cr);
                }
-       } else if (audio_sources > 1) {
+       } else if (audio_sources > 1 && sinks > 1) {
                for (uint32_t i = 0 ; i < audio_sources; ++i) {
                        const float si_x = rintf(width * (.2f + .6f * (i + midi_sinks) / (sinks - 1.f))) + .5f;
                        const float si_x0 = rintf(width * (.2f + .6f * (i + midi_sources) / (sources - 1.f))) + .5f;
@@ -898,16 +1077,55 @@ ProcessorEntry::RoutingIcon::on_expose_event (GdkEventExpose* ev)
                        cairo_curve_to (cr, si_x, 0, si_x0, height, si_x0, 0);
                        cairo_stroke (cr);
                }
-       } else if (audio_sources == 1 && audio_sinks == 1) {
-               const float si_x = rintf(width * .5f) + .5f;
+       } else if (audio_sources == 1 && audio_sinks > 0) {
+               float si_x, si_x0;
+               if (sinks == 1) {
+                       si_x = rintf(width * .5f) + .5f;
+               } else {
+                       si_x = rintf(width * (.2f + .6f * midi_sinks / (sinks - 1.f))) + .5f;
+               }
+               if (sources == 1) {
+                       si_x0 = rintf(width * .5f) + .5f;
+               } else {
+                       si_x0 = rintf(width * (.2f + .6f * midi_sources / (sources - 1.f))) + .5f;
+               }
                cairo_move_to (cr, si_x, height);
-               cairo_line_to (cr, si_x, 0);
+               cairo_curve_to (cr, si_x, 0, si_x0, height, si_x0, 0);
                cairo_stroke (cr);
+#ifndef NDEBUG
+       } else if (audio_sources != 0 && audio_sinks != 0) {
+               PBD::warning << string_compose("Programming error: audio routing display: A %1 -> %2 | M %3 -> %4 | T %5 -> %6",
+                               audio_sources, audio_sinks, midi_sources, midi_sinks, sources, sinks) << endmsg;
+#endif
        }
        cairo_destroy(cr);
        return true;
 }
 
+static std::list<Gtk::TargetEntry> drop_targets()
+{
+       std::list<Gtk::TargetEntry> tmp;
+       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> drag_targets()
+{
+       std::list<Gtk::TargetEntry> tmp;
+       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;
+}
+
 ProcessorBox::ProcessorBox (ARDOUR::Session* sess, boost::function<PluginSelector*()> get_plugin_selector,
                            RouteProcessorSelection& rsel, MixerStrip* parent, bool owner_is_mixer)
        : _parent_strip (parent)
@@ -917,6 +1135,7 @@ ProcessorBox::ProcessorBox (ARDOUR::Session* sess, boost::function<PluginSelecto
        , _placement (-1)
        , _visible_prefader_processors (0)
        , _rr_selection(rsel)
+       , processor_display (drop_targets())
        , _redisplay_pending (false)
 
 {
@@ -944,6 +1163,7 @@ ProcessorBox::ProcessorBox (ARDOUR::Session* sess, boost::function<PluginSelecto
 
        processor_display.Reordered.connect (sigc::mem_fun (*this, &ProcessorBox::reordered));
        processor_display.DropFromAnotherBox.connect (sigc::mem_fun (*this, &ProcessorBox::object_drop));
+       processor_display.DropFromExternal.connect (sigc::mem_fun (*this, &ProcessorBox::plugin_drop));
 
        processor_scroller.show ();
        processor_display.show ();
@@ -954,7 +1174,7 @@ ProcessorBox::ProcessorBox (ARDOUR::Session* sess, boost::function<PluginSelecto
                        );
        }
 
-       ARDOUR_UI::instance()->set_tip (processor_display, _("Right-click to add/remove/edit\nplugins,inserts,sends and more"));
+       ARDOUR_UI_UTILS::set_tooltip (processor_display, _("Right-click to add/remove/edit\nplugins,inserts,sends and more"));
 }
 
 ProcessorBox::~ProcessorBox ()
@@ -1006,16 +1226,16 @@ ProcessorBox::route_going_away ()
        _route.reset ();
 }
 
-void
-ProcessorBox::object_drop(DnDVBox<ProcessorEntry>* source, ProcessorEntry* position, Glib::RefPtr<Gdk::DragContext> const & context)
+boost::shared_ptr<Processor>
+ProcessorBox::find_drop_position (ProcessorEntry* position)
 {
        boost::shared_ptr<Processor> p;
        if (position) {
                p = position->processor ();
                if (!p) {
                        /* dropped on the blank entry (which will be before the
-                          fader), so use the first non-blank child as our
-                          `dropped on' processor */
+                                fader), so use the first non-blank child as our
+                                `dropped on' processor */
                        list<ProcessorEntry*> c = processor_display.children ();
                        list<ProcessorEntry*>::iterator i = c.begin ();
 
@@ -1024,11 +1244,105 @@ ProcessorBox::object_drop(DnDVBox<ProcessorEntry>* source, ProcessorEntry* posit
                        assert (p);
                }
        }
+       return p;
+}
+
+void
+ProcessorBox::_drop_plugin_preset (Gtk::SelectionData const &data, Route::ProcessorList &pl)
+{
+               const void * d = data.get_data();
+               const Gtkmm2ext::DnDTreeView<ARDOUR::PluginPresetPtr>* tv = reinterpret_cast<const Gtkmm2ext::DnDTreeView<ARDOUR::PluginPresetPtr>*>(d);
+
+               PluginPresetList nfos;
+               TreeView* source;
+               tv->get_object_drag_data (nfos, &source);
+
+               for (list<PluginPresetPtr>::const_iterator i = nfos.begin(); i != nfos.end(); ++i) {
+                       PluginPresetPtr ppp = (*i);
+                       PluginInfoPtr pip = ppp->_pip;
+                       PluginPtr p = pip->load (*_session);
+                       if (!p) {
+                               continue;
+                       }
+
+                       if (ppp->_preset.valid) {
+                               p->load_preset (ppp->_preset);
+                       }
+
+                       boost::shared_ptr<Processor> processor (new PluginInsert (*_session, p));
+                       if (Config->get_new_plugins_active ()) {
+                               processor->activate ();
+                       }
+                       pl.push_back (processor);
+               }
+}
+
+void
+ProcessorBox::_drop_plugin (Gtk::SelectionData const &data, Route::ProcessorList &pl)
+{
+               const void * d = data.get_data();
+               const Gtkmm2ext::DnDTreeView<ARDOUR::PluginInfoPtr>* tv = reinterpret_cast<const Gtkmm2ext::DnDTreeView<ARDOUR::PluginInfoPtr>*>(d);
+               PluginInfoList nfos;
+
+               TreeView* source;
+               tv->get_object_drag_data (nfos, &source);
+
+               for (list<PluginInfoPtr>::const_iterator i = nfos.begin(); i != nfos.end(); ++i) {
+                       PluginPtr p = (*i)->load (*_session);
+                       if (!p) {
+                               continue;
+                       }
+                       boost::shared_ptr<Processor> processor (new PluginInsert (*_session, p));
+                       if (Config->get_new_plugins_active ()) {
+                               processor->activate ();
+                       }
+                       pl.push_back (processor);
+               }
+}
+
+void
+ProcessorBox::plugin_drop (Gtk::SelectionData const &data, ProcessorEntry* position, Glib::RefPtr<Gdk::DragContext> const & context)
+{
+       if (!_session) {
+               return;
+       }
+
+       boost::shared_ptr<Processor> p = find_drop_position (position);
+       Route::ProcessorList pl;
+
+       if (data.get_target() == "PluginInfoPtr") {
+               _drop_plugin (data, pl);
+       }
+       else if (data.get_target() == "PluginPresetPtr") {
+               _drop_plugin_preset (data, pl);
+       }
+       else {
+               return;
+       }
+
+       Route::ProcessorStreams err;
+       if (_route->add_processors (pl, p, &err)) {
+               string msg = _(
+                               "Processor Drag/Drop failed. Probably because\n\
+the I/O configuration of the plugins could\n\
+not match the configuration of this track.");
+               MessageDialog am (msg);
+               am.run ();
+       }
+}
+
+void
+ProcessorBox::object_drop (DnDVBox<ProcessorEntry>* source, ProcessorEntry* position, Glib::RefPtr<Gdk::DragContext> const & context)
+{
+       boost::shared_ptr<Processor> p = find_drop_position (position);
 
        list<ProcessorEntry*> children = source->selection ();
        list<boost::shared_ptr<Processor> > procs;
        for (list<ProcessorEntry*>::const_iterator i = children.begin(); i != children.end(); ++i) {
                if ((*i)->processor ()) {
+                       if (boost::dynamic_pointer_cast<UnknownProcessor> ((*i)->processor())) {
+                               continue;
+                       }
                        procs.push_back ((*i)->processor ());
                }
        }
@@ -1080,6 +1394,10 @@ ProcessorBox::build_possible_aux_menu ()
                return 0;
        }
 
+       if (_route->is_monitor ()) {
+               return 0;
+       }
+
        using namespace Menu_Helpers;
        Menu* menu = manage (new Menu);
        MenuList& items = menu->items();
@@ -1125,6 +1443,9 @@ ProcessorBox::show_processor_menu (int arg)
                }
        }
 
+       ActionManager::get_action (X_("ProcessorMenu"), "newinsert")->set_sensitive (!_route->is_monitor ());
+       ActionManager::get_action (X_("ProcessorMenu"), "newsend")->set_sensitive (!_route->is_monitor ());
+
        ProcessorEntry* single_selection = 0;
        if (processor_display.selection().size() == 1) {
                single_selection = processor_display.selection().front();
@@ -1151,7 +1472,7 @@ ProcessorBox::show_processor_menu (int arg)
 
        Gtk::MenuItem* send_menu_item = dynamic_cast<Gtk::MenuItem*>(ActionManager::get_widget("/ProcessorMenu/send_options"));
        if (send_menu_item) {
-               if (single_selection) {
+               if (single_selection && !_route->is_monitor()) {
                        Menu* m = single_selection->build_send_options_menu ();
                        if (m && !m->items().empty()) {
                                send_menu_item->set_submenu (*m);
@@ -1167,11 +1488,14 @@ ProcessorBox::show_processor_menu (int arg)
 
        /* Sensitise actions as approprioate */
 
-        cut_action->set_sensitive (can_cut());
+
+       const bool sensitive = !processor_display.selection().empty() && ! stub_processor_selected ();
+
        paste_action->set_sensitive (!_rr_selection.processors.empty());
+       cut_action->set_sensitive (sensitive && can_cut ());
+       copy_action->set_sensitive (sensitive);
+       delete_action->set_sensitive (sensitive || stub_processor_selected ());
 
-       const bool sensitive = !processor_display.selection().empty();
-       ActionManager::set_sensitive (ActionManager::plugin_selection_sensitive_actions, sensitive);
        edit_action->set_sensitive (one_processor_can_be_edited ());
        edit_generic_action->set_sensitive (one_processor_can_be_edited ());
 
@@ -1184,7 +1508,10 @@ ProcessorBox::show_processor_menu (int arg)
        edit_action->set_sensitive (pi && pi->plugin()->has_editor ());
 
        /* disallow rename for multiple selections, for plugin inserts and for the fader */
-       rename_action->set_sensitive (single_selection && !pi && !boost::dynamic_pointer_cast<Amp> (single_selection->processor ()));
+       rename_action->set_sensitive (single_selection
+                       && !pi
+                       && !boost::dynamic_pointer_cast<Amp> (single_selection->processor ())
+                       && !boost::dynamic_pointer_cast<UnknownProcessor> (single_selection->processor ()));
 
        processor_menu->popup (1, arg);
 
@@ -1214,7 +1541,7 @@ ProcessorBox::leave_notify (GdkEventCrossing*)
 }
 
 bool
-ProcessorBox::processor_operation (ProcessorOperation op) 
+ProcessorBox::processor_operation (ProcessorOperation op)
 {
        ProcSelection targets;
 
@@ -1235,7 +1562,7 @@ ProcessorBox::processor_operation (ProcessorOperation op)
 
        if ( (op == ProcessorsDelete) && targets.empty() )
                return false;  //nothing to delete.  return false so the editor-mixer, because the user was probably intending to delete something in the editor
-       
+
        switch (op) {
        case ProcessorsSelectAll:
                processor_display.select_all ();
@@ -1254,6 +1581,14 @@ ProcessorBox::processor_operation (ProcessorOperation op)
                break;
 
        case ProcessorsPaste:
+               // some processors are not selectable (e.g fader, meter), target is empty.
+               if (targets.empty() && _placement >= 0) {
+                       assert (_route);
+                       boost::shared_ptr<Processor> proc = _route->before_processor_for_index (_placement);
+                       if (proc) {
+                               targets.push_back (proc);
+                       }
+               }
                if (targets.empty()) {
                        paste_processors ();
                } else {
@@ -1282,11 +1617,11 @@ ProcessorBox::processor_operation (ProcessorOperation op)
        default:
                break;
        }
-       
+
        return true;
 }
 
-ProcessorWindowProxy* 
+ProcessorWindowProxy*
 ProcessorBox::find_window_proxy (boost::shared_ptr<Processor> processor) const
 {
        return  processor->window_proxy();
@@ -1325,7 +1660,7 @@ ProcessorBox::processor_button_press_event (GdkEventButton *ev, ProcessorEntry*
        } else if (Keyboard::is_context_menu_event (ev)) {
 
                show_processor_menu (ev->time);
-               
+
                ret = true;
 
        } else if (processor && ev->button == 1 && selected) {
@@ -1414,10 +1749,13 @@ ProcessorBox::use_plugins (const SelectedPlugins& plugins)
                        weird_plugin_dialog (**p, err_streams);
                        return true;
                        // XXX SHAREDPTR delete plugin here .. do we even need to care?
-               } else {
-
-                       if (Profile->get_sae()) {
-                               processor->activate ();
+               } else if (plugins.size() == 1 && Config->get_open_gui_after_adding_plugin()) {
+                       if (_session->engine().connected () && processor_can_be_edited (processor)) {
+                               if ((*p)->has_editor ()) {
+                                       edit_processor (processor);
+                               } else {
+                                       generic_edit_processor (processor);
+                               }
                        }
                }
        }
@@ -1617,7 +1955,7 @@ ProcessorBox::redisplay_processors ()
        _visible_prefader_processors = 0;
        fader_seen = false;
 
-       _route->foreach_processor (sigc::bind (sigc::mem_fun (*this, &ProcessorBox::help_count_visible_prefader_processors), 
+       _route->foreach_processor (sigc::bind (sigc::mem_fun (*this, &ProcessorBox::help_count_visible_prefader_processors),
                                               &_visible_prefader_processors, &fader_seen));
 
        _route->foreach_processor (sigc::mem_fun (*this, &ProcessorBox::add_processor_to_display));
@@ -1664,9 +2002,9 @@ ProcessorBox::maybe_add_processor_to_ui_list (boost::weak_ptr<Processor> w)
        const XMLNode* ui_xml = _session->extra_xml (X_("UI"));
 
        if (ui_xml) {
-               wp->set_state (*ui_xml);
+               wp->set_state (*ui_xml, 0);
        }
-       
+
         void* existing_ui = p->get_ui ();
 
         if (existing_ui) {
@@ -1682,9 +2020,15 @@ ProcessorBox::help_count_visible_prefader_processors (boost::weak_ptr<Processor>
 {
        boost::shared_ptr<Processor> processor (p.lock ());
 
-       if (processor && processor->display_to_user()) {
+       if (processor && ( processor->display_to_user()
+#ifndef NDEBUG
+                           || show_all_processors
+#endif
+                        )
+          ) {
 
-               if (boost::dynamic_pointer_cast<Amp>(processor)) {
+               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) {
@@ -1699,12 +2043,17 @@ ProcessorBox::add_processor_to_display (boost::weak_ptr<Processor> p)
 {
        boost::shared_ptr<Processor> processor (p.lock ());
 
-       if (!processor || !processor->display_to_user()) {
+       if (!processor || ( !processor->display_to_user()
+#ifndef NDEBUG
+                           && !show_all_processors
+#endif
+                         )
+          ) {
                return;
        }
 
        boost::shared_ptr<PluginInsert> plugin_insert = boost::dynamic_pointer_cast<PluginInsert> (processor);
-       
+
        ProcessorEntry* e = 0;
        if (plugin_insert) {
                e = new PluginInsertProcessorEntry (this, plugin_insert, _width);
@@ -1714,9 +2063,10 @@ ProcessorBox::add_processor_to_display (boost::weak_ptr<Processor> p)
 
        boost::shared_ptr<Send> send = boost::dynamic_pointer_cast<Send> (processor);
        boost::shared_ptr<PortInsert> ext = boost::dynamic_pointer_cast<PortInsert> (processor);
-       
+       boost::shared_ptr<UnknownProcessor> stub = boost::dynamic_pointer_cast<UnknownProcessor> (processor);
+
        //faders and meters are not deletable, copy/paste-able, so they shouldn't be selectable
-       if (!send && !plugin_insert && !ext)
+       if (!send && !plugin_insert && !ext && !stub)
                e->set_selectable(false);
 
        bool mark_send_visible = false;
@@ -1741,7 +2091,16 @@ ProcessorBox::add_processor_to_display (boost::weak_ptr<Processor> p)
                e->show_all_controls ();
        }
 
-       processor_display.add_child (e);
+       if (plugin_insert
+#ifdef MIXBUS
+                       && !plugin_insert->plugin(0)->is_channelstrip()
+#endif
+                )
+       {
+               processor_display.add_child (e, drag_targets());
+       } else {
+               processor_display.add_child (e, drag_targets_noplugin());
+       }
 }
 
 void
@@ -1759,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())) {
+               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 {
@@ -1841,22 +2201,38 @@ ProcessorBox::rename_processors ()
 bool
 ProcessorBox::can_cut () const
 {
-        vector<boost::shared_ptr<Processor> > sel;
+       vector<boost::shared_ptr<Processor> > sel;
 
-        get_selected_processors (sel);
+       get_selected_processors (sel);
 
-        /* cut_processors () does not cut inserts */
+       /* cut_processors () does not cut inserts */
 
-        for (vector<boost::shared_ptr<Processor> >::const_iterator i = sel.begin (); i != sel.end (); ++i) {
+       for (vector<boost::shared_ptr<Processor> >::const_iterator i = sel.begin (); i != sel.end (); ++i) {
 
                if (boost::dynamic_pointer_cast<PluginInsert>((*i)) != 0 ||
                    (boost::dynamic_pointer_cast<Send>((*i)) != 0) ||
                    (boost::dynamic_pointer_cast<Return>((*i)) != 0)) {
-                        return true;
-                }
-        }
+                       return true;
+               }
+       }
 
-        return false;
+       return false;
+}
+
+bool
+ProcessorBox::stub_processor_selected () const
+{
+       vector<boost::shared_ptr<Processor> > sel;
+
+       get_selected_processors (sel);
+
+       for (vector<boost::shared_ptr<Processor> >::const_iterator i = sel.begin (); i != sel.end (); ++i) {
+               if (boost::dynamic_pointer_cast<UnknownProcessor>((*i)) != 0) {
+                       return true;
+               }
+       }
+
+       return false;
 }
 
 void
@@ -2077,11 +2453,11 @@ ProcessorBox::paste_processor_state (const XMLNodeList& nlist, boost::shared_ptr
                                continue;
 
                        } else if (type->value() == "intsend") {
-                               
+
                                /* aux sends are OK, but those used for
                                 * other purposes, are not.
                                 */
-                               
+
                                assert (role);
 
                                if (role->value() != "Aux") {
@@ -2110,7 +2486,7 @@ ProcessorBox::paste_processor_state (const XMLNodeList& nlist, boost::shared_ptr
                                Send* s = new Send (*_session, _route->pannable(), _route->mute_master());
 
                                IOProcessor::prepare_for_reset (n, s->name());
-                               
+
                                 if (s->set_state (n, Stateful::loading_state_version)) {
                                         delete s;
                                         return;
@@ -2136,22 +2512,23 @@ ProcessorBox::paste_processor_state (const XMLNodeList& nlist, boost::shared_ptr
 
                                XMLNode n (**niter);
                                PortInsert* pi = new PortInsert (*_session, _route->pannable (), _route->mute_master ());
-                               
+
                                IOProcessor::prepare_for_reset (n, pi->name());
-                               
+
                                if (pi->set_state (n, Stateful::loading_state_version)) {
                                        return;
                                }
-                               
+
                                p.reset (pi);
 
                        } else {
                                /* XXX its a bit limiting to assume that everything else
                                   is a plugin.
                                */
-
                                p.reset (new PluginInsert (*_session));
-                                p->set_state (**niter, Stateful::current_state_version);
+                               PBD::ID id = p->id();
+                               p->set_state (**niter, Stateful::current_state_version);
+                               boost::dynamic_pointer_cast<PluginInsert>(p)->update_id (id);
                        }
 
                        copies.push_back (p);
@@ -2303,7 +2680,7 @@ ProcessorBox::get_editor_window (boost::shared_ptr<Processor> processor, bool us
         * will be forced back into a model where the fader controls the main gain.
         * If the processor is a send, then we map the send controls onto the
         * strip.
-        * 
+        *
         * Plugins and others will return a window for control.
         */
 
@@ -2314,7 +2691,7 @@ ProcessorBox::get_editor_window (boost::shared_ptr<Processor> processor, bool us
                }
        }
 
-       if (boost::dynamic_pointer_cast<Amp> (processor)) {
+       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 ();
@@ -2452,14 +2829,10 @@ ProcessorBox::register_actions ()
        /* standard editing stuff */
        cut_action = ActionManager::register_action (popup_act_grp, X_("cut"), _("Cut"),
                                                      sigc::ptr_fun (ProcessorBox::rb_cut));
-       ActionManager::plugin_selection_sensitive_actions.push_back(cut_action);
-       act = ActionManager::register_action (popup_act_grp, X_("copy"), _("Copy"),
+       copy_action = ActionManager::register_action (popup_act_grp, X_("copy"), _("Copy"),
                        sigc::ptr_fun (ProcessorBox::rb_copy));
-       ActionManager::plugin_selection_sensitive_actions.push_back(act);
-
-       act = ActionManager::register_action (popup_act_grp, X_("delete"), _("Delete"),
+       delete_action = ActionManager::register_action (popup_act_grp, X_("delete"), _("Delete"),
                        sigc::ptr_fun (ProcessorBox::rb_delete));
-       ActionManager::plugin_selection_sensitive_actions.push_back(act); // ??
 
        paste_action = ActionManager::register_action (popup_act_grp, X_("paste"), _("Paste"),
                        sigc::ptr_fun (ProcessorBox::rb_paste));
@@ -2864,7 +3237,7 @@ ProcessorBox::entry_gui_object_state (ProcessorEntry* entry)
        }
 
        GUIObjectState& st = _parent_strip->gui_object_state ();
-       
+
        XMLNode* strip = st.get_or_add_node (_parent_strip->state_id ());
        assert (strip);
        return st.get_or_add_node (strip, entry->state_id());
@@ -2925,14 +3298,14 @@ ProcessorWindowProxy::processor_going_away ()
 }
 
 ARDOUR::SessionHandlePtr*
-ProcessorWindowProxy::session_handle() 
+ProcessorWindowProxy::session_handle()
 {
        /* we don't care */
        return 0;
 }
 
 XMLNode&
-ProcessorWindowProxy::get_state () const
+ProcessorWindowProxy::get_state ()
 {
        XMLNode *node;
        node = &ProxyBase::get_state();
@@ -2940,8 +3313,8 @@ ProcessorWindowProxy::get_state () const
        return *node;
 }
 
-void
-ProcessorWindowProxy::set_state (const XMLNode& node)
+int
+ProcessorWindowProxy::set_state (const XMLNode& node, int /*version*/)
 {
        XMLNodeList children = node.children ();
        XMLNodeList::const_iterator i = children.begin ();
@@ -2960,7 +3333,7 @@ ProcessorWindowProxy::set_state (const XMLNode& node)
                }
        }
 
-       ProxyBase::set_state(node);
+       return ProxyBase::set_state (node, 0);
 }
 
 Gtk::Window*
@@ -2980,7 +3353,7 @@ ProcessorWindowProxy::get (bool create)
                if (!create) {
                        return 0;
                }
-               
+
                is_custom = want_custom;
                _window = _processor_box->get_editor_window (p, is_custom);