merge (with conflict fixes) with master (even against rgareus' recommendation)
[ardour.git] / gtk2_ardour / processor_box.cc
index b549fd15ac06365536b61ecbbf9b0560e493bed3..05a373e9d8a01a6df91f73b96c7ed057e0a56f91 100644 (file)
 #include <gtkmm2ext/choice.h>
 #include <gtkmm2ext/utils.h>
 #include <gtkmm2ext/doi.h>
+#include <gtkmm2ext/rgb_macros.h>
 
 #include "ardour/amp.h"
 #include "ardour/audio_track.h"
 #include "ardour/audioengine.h"
 #include "ardour/internal_return.h"
 #include "ardour/internal_send.h"
+#include "ardour/panner_shell.h"
 #include "ardour/plugin_insert.h"
+#include "ardour/pannable.h"
 #include "ardour/port_insert.h"
 #include "ardour/profile.h"
 #include "ardour/return.h"
@@ -91,6 +94,9 @@ RefPtr<Action> ProcessorBox::rename_action;
 RefPtr<Action> ProcessorBox::edit_action;
 RefPtr<Action> ProcessorBox::edit_generic_action;
 
+static const uint32_t audio_port_color = 0x4A8A0EFF; // Green
+static const uint32_t midi_port_color = 0x960909FF; //Red
+
 ProcessorEntry::ProcessorEntry (ProcessorBox* parent, boost::shared_ptr<Processor> p, Width w)
        : _button (ArdourButton::led_default_elements)
        , _position (PreFader)
@@ -98,6 +104,8 @@ ProcessorEntry::ProcessorEntry (ProcessorBox* parent, boost::shared_ptr<Processo
        , _processor (p)
        , _width (w)
        , _visual_state (Gtk::STATE_NORMAL)
+       , _input_icon(true)
+       , _output_icon(false)
 {
        _vbox.show ();
        
@@ -109,18 +117,37 @@ ProcessorEntry::ProcessorEntry (ProcessorBox* parent, boost::shared_ptr<Processo
 
        if (_processor) {
 
+               _vbox.pack_start (_routing_icon);
+               _vbox.pack_start (_input_icon);
                _vbox.pack_start (_button, true, true);
+               _vbox.pack_end (_output_icon);
 
                _button.set_active (_processor->active());
+
+               _routing_icon.set_no_show_all(true);
+               _input_icon.set_no_show_all(true);
+
                _button.show ();
+               _routing_icon.set_visible(false);
+               _input_icon.hide();
+               _output_icon.show();
 
                _processor->ActiveChanged.connect (active_connection, invalidator (*this), boost::bind (&ProcessorEntry::processor_active_changed, this), gui_context());
                _processor->PropertyChanged.connect (name_connection, invalidator (*this), boost::bind (&ProcessorEntry::processor_property_changed, this, _1), gui_context());
+               _processor->ConfigurationChanged.connect (config_connection, invalidator (*this), boost::bind (&ProcessorEntry::processor_configuration_changed, this, _1, _2), gui_context());
 
                set<Evoral::Parameter> p = _processor->what_can_be_automated ();
                for (set<Evoral::Parameter>::iterator i = p.begin(); i != p.end(); ++i) {
                        
-                       Control* c = new Control (_processor->automation_control (*i), _processor->describe_parameter (*i));
+                       std::string label = _processor->describe_parameter (*i);
+
+                       if (boost::dynamic_pointer_cast<Send> (_processor)) {
+                               label = _("Send");
+                       } else if (boost::dynamic_pointer_cast<Return> (_processor)) {
+                               label = _("Return");
+                       }
+
+                       Control* c = new Control (_processor->automation_control (*i), label);
                        
                        _controls.push_back (c);
 
@@ -128,13 +155,14 @@ ProcessorEntry::ProcessorEntry (ProcessorBox* parent, boost::shared_ptr<Processo
                                /* Add non-Amp controls to the processor box */
                                _vbox.pack_start (c->box);
                        }
-
-                       if (boost::dynamic_pointer_cast<Send> (_processor)) {
-                               /* Don't label send faders */
-                               c->hide_label ();
-                       }
                }
 
+               _input_icon.set_ports(_processor->input_streams());
+               _output_icon.set_ports(_processor->output_streams());
+
+               _routing_icon.set_sources(_processor->input_streams());
+               _routing_icon.set_sinks(_processor->output_streams());
+
                setup_tooltip ();
                setup_visuals ();
        } else {
@@ -168,9 +196,17 @@ ProcessorEntry::drag_text () const
 }
 
 void
-ProcessorEntry::set_position (Position p)
+ProcessorEntry::set_position (Position p, uint32_t num)
 {
        _position = p;
+       _position_num = num;
+
+       if (_position_num == 0 || _routing_icon.get_visible()) {
+               _input_icon.show();
+       } else {
+               _input_icon.hide();
+       }
+
        setup_visuals ();
 }
 
@@ -245,18 +281,35 @@ ProcessorEntry::processor_property_changed (const PropertyChange& what_changed)
        }
 }
 
+void
+ProcessorEntry::processor_configuration_changed (const ChanCount in, const ChanCount out)
+{
+       _input_icon.set_ports(in);
+       _output_icon.set_ports(out);
+       _routing_icon.set_sources(in);
+       _routing_icon.set_sinks(out);
+       _input_icon.queue_draw();
+       _output_icon.queue_draw();
+       _routing_icon.queue_draw();
+}
+
 void
 ProcessorEntry::setup_tooltip ()
 {
        if (_processor) {
                boost::shared_ptr<PluginInsert> pi = boost::dynamic_pointer_cast<PluginInsert> (_processor);
                if (pi) {
+                       std::string postfix = "";
+                       uint32_t replicated;
+                       if ((replicated = pi->get_count()) > 1) {
+                               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."), name (Wide)));
+                                               string_compose (_("<b>%1</b>\nDouble-click to show GUI.\nAlt+double-click to show generic GUI.%2"), name (Wide), postfix));
                        } else {
                                ARDOUR_UI::instance()->set_tip (_button,
-                                               string_compose (_("<b>%1</b>\nDouble-click to show generic GUI."), name (Wide)));
+                                               string_compose (_("<b>%1</b>\nDouble-click to show generic GUI.%2"), name (Wide), postfix));
                        }
                        return;
                }
@@ -295,6 +348,13 @@ ProcessorEntry::name (Width w) const
                }
 
        } else {
+               boost::shared_ptr<ARDOUR::PluginInsert> pi;
+               uint32_t replicated;
+               if ((pi = boost::dynamic_pointer_cast<ARDOUR::PluginInsert> (_processor)) != 0
+                               && (replicated = pi->get_count()) > 1)
+               {
+                       name_display += string_compose(_("(%1x1) "), replicated);
+               }
 
                switch (w) {
                case Wide:
@@ -382,7 +442,7 @@ ProcessorEntry::build_controls_menu ()
        
        for (list<Control*>::iterator i = _controls.begin(); i != _controls.end(); ++i) {
                items.push_back (CheckMenuElem ((*i)->name ()));
-               CheckMenuItem* c = dynamic_cast<CheckMenuItem*> (&items.back ());
+               Gtk::CheckMenuItem* c = dynamic_cast<Gtk::CheckMenuItem*> (&items.back ());
                c->set_active ((*i)->visible ());
                c->signal_toggled().connect (sigc::bind (sigc::mem_fun (*this, &ProcessorEntry::toggle_control_visibility), *i));
        }
@@ -397,23 +457,52 @@ ProcessorEntry::toggle_control_visibility (Control* c)
        _parent->update_gui_object_state (this);
 }
 
+Menu *
+ProcessorEntry::build_send_options_menu ()
+{
+       using namespace Menu_Helpers;
+       Menu* menu = manage (new Menu);
+       MenuList& items = menu->items ();
+
+       boost::shared_ptr<Send> send = boost::dynamic_pointer_cast<Send> (_processor);
+       if (send) {
+
+               items.push_back (CheckMenuElem (_("Link panner controls")));
+               CheckMenuItem* c = dynamic_cast<CheckMenuItem*> (&items.back ());
+               c->set_active (send->panner_shell()->is_linked_to_route());
+               c->signal_toggled().connect (sigc::mem_fun (*this, &ProcessorEntry::toggle_panner_link));
+
+       }
+       return menu;
+}
+
+void
+ProcessorEntry::toggle_panner_link ()
+{
+       boost::shared_ptr<Send> send = boost::dynamic_pointer_cast<Send> (_processor);
+       if (send) {
+               send->panner_shell()->set_linked_to_route(!send->panner_shell()->is_linked_to_route());
+       }
+}
+
 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, 0, 13, false)
        , _slider_persistant_tooltip (&_slider)
-       , _button (ArdourButton::Element (ArdourButton::Text | ArdourButton::Indicator))
+       , _button (ArdourButton::led_default_elements)
        , _ignore_ui_adjustment (false)
        , _visible (false)
        , _name (n)
 {
        _slider.set_controllable (c);
+       box.set_padding(0, 0, 4, 4);
 
        if (c->toggled()) {
                _button.set_text (_name);
                _button.set_led_left (true);
                _button.set_name ("processor control button");
-               box.pack_start (_button);
+               box.add (_button);
                _button.show ();
 
                _button.signal_clicked.connect (sigc::mem_fun (*this, &Control::button_clicked));
@@ -422,10 +511,10 @@ ProcessorEntry::Control::Control (boost::shared_ptr<AutomationControl> c, string
 
        } else {
                
-               _slider.set_name ("PluginSlider");
+               _slider.set_name ("ProcessorControlSlider");
                _slider.set_text (_name);
 
-               box.pack_start (_slider);
+               box.add (_slider);
                _slider.show ();
 
                double const lo = c->internal_to_interface (c->lower ());
@@ -470,7 +559,6 @@ ProcessorEntry::Control::set_tooltip ()
 
        string sm = Glib::Markup::escape_text (s.str());
        
-       ARDOUR_UI::instance()->set_tip (_label, sm);
        _slider_persistant_tooltip.set_tip (sm);
        ARDOUR_UI::instance()->set_tip (_button, sm);
 }
@@ -505,6 +593,7 @@ ProcessorEntry::Control::button_clicked ()
 
        c->set_value (n ? 0 : 1);
        _button.set_active (!n);
+       set_tooltip ();
 }
 
 void
@@ -578,12 +667,6 @@ ProcessorEntry::Control::hide_things ()
        }
 }
 
-void
-ProcessorEntry::Control::hide_label ()
-{
-       _label.hide ();
-}
-
 string
 ProcessorEntry::Control::state_id () const
 {
@@ -593,35 +676,60 @@ ProcessorEntry::Control::state_id () const
        return string_compose (X_("control %1"), c->id().to_s ());
 }
 
-BlankProcessorEntry::BlankProcessorEntry (ProcessorBox* b, Width w)
-       : ProcessorEntry (b, boost::shared_ptr<Processor>(), w)
-{
-}
-
 PluginInsertProcessorEntry::PluginInsertProcessorEntry (ProcessorBox* b, boost::shared_ptr<ARDOUR::PluginInsert> p, Width w)
        : ProcessorEntry (b, p, w)
        , _plugin_insert (p)
 {
-       p->SplittingChanged.connect (
+       p->PluginIoReConfigure.connect (
                _splitting_connection, invalidator (*this), boost::bind (&PluginInsertProcessorEntry::plugin_insert_splitting_changed, this), gui_context()
                );
 
-       _splitting_icon.set_size_request (-1, 12);
-
-       _vbox.pack_start (_splitting_icon);
-       _vbox.reorder_child (_splitting_icon, 0);
-
        plugin_insert_splitting_changed ();
 }
 
 void
 PluginInsertProcessorEntry::plugin_insert_splitting_changed ()
 {
-       if (_plugin_insert->splitting ()) {
-               _splitting_icon.show ();
+       _output_icon.set_ports(_plugin_insert->output_streams());
+       _routing_icon.set_splitting(_plugin_insert->splitting ());
+
+       ChanCount sources = _plugin_insert->input_streams();
+       ChanCount sinks = _plugin_insert->natural_input_streams();
+
+       /* replicated instances */
+       if (!_plugin_insert->splitting () && _plugin_insert->get_count() > 1) {
+               for (DataType::iterator t = DataType::begin(); t != DataType::end(); ++t) {
+                       sinks.set(*t, sinks.get(*t) * _plugin_insert->get_count());
+               }
+       }
+       /* MIDI bypass */
+       if (_plugin_insert->natural_output_streams().n_midi() == 0 &&
+                       _plugin_insert->output_streams().n_midi() == 1) {
+               sinks.set(DataType::MIDI, 1);
+               sources.set(DataType::MIDI, 1);
+       }
+
+       _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()
+                )
+       {
+               _routing_icon.set_size_request (-1, 7);
+               _routing_icon.set_visible(true);
+               _input_icon.show();
        } else {
-               _splitting_icon.hide ();
+               _routing_icon.set_visible(false);
+               if (_position_num != 0) {
+                       _input_icon.hide();
+               }
        }
+
+       _input_icon.queue_draw();
+       _output_icon.queue_draw();
+       _routing_icon.queue_draw();
 }
 
 void
@@ -631,35 +739,73 @@ PluginInsertProcessorEntry::hide_things ()
        plugin_insert_splitting_changed ();
 }
 
-void
-PluginInsertProcessorEntry::setup_visuals ()
+
+bool
+ProcessorEntry::PortIcon::on_expose_event (GdkEventExpose* ev)
 {
-       switch (_position) {
-       case PreFader:
-               _splitting_icon.set_name ("ProcessorPreFader");
-               break;
+       cairo_t* cr = gdk_cairo_create (get_window()->gobj());
 
-       case Fader:
-               _splitting_icon.set_name ("ProcessorFader");
-               break;
+       cairo_rectangle (cr, ev->area.x, ev->area.y, ev->area.width, ev->area.height);
+       cairo_clip (cr);
 
-       case PostFader:
-               _splitting_icon.set_name ("ProcessorPostFader");
-               break;
+       Gtk::Allocation a = get_allocation();
+       double const width = a.get_width();
+       double const height = a.get_height();
+
+       Gdk::Color const bg = get_style()->get_bg (STATE_NORMAL);
+       cairo_set_source_rgb (cr, bg.get_red_p (), bg.get_green_p (), bg.get_blue_p ());
+
+       cairo_rectangle (cr, 0, 0, width, height);
+       cairo_fill (cr);
+
+       if (_ports.n_total() > 1) {
+               for (uint32_t i = 0; i < _ports.n_total(); ++i) {
+                       if (i < _ports.n_midi()) {
+                               cairo_set_source_rgb (cr,
+                                               UINT_RGBA_R_FLT(midi_port_color),
+                                               UINT_RGBA_G_FLT(midi_port_color),
+                                               UINT_RGBA_B_FLT(midi_port_color));
+                       } else {
+                               cairo_set_source_rgb (cr,
+                                               UINT_RGBA_R_FLT(audio_port_color),
+                                               UINT_RGBA_G_FLT(audio_port_color),
+                                               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_fill(cr);
+               }
+       } else if (_ports.n_total() == 1) {
+               if (_ports.n_midi() == 1) {
+                       cairo_set_source_rgb (cr,
+                                       UINT_RGBA_R_FLT(midi_port_color),
+                                       UINT_RGBA_G_FLT(midi_port_color),
+                                       UINT_RGBA_B_FLT(midi_port_color));
+               } else {
+                       cairo_set_source_rgb (cr,
+                                       UINT_RGBA_R_FLT(audio_port_color),
+                                       UINT_RGBA_G_FLT(audio_port_color),
+                                       UINT_RGBA_B_FLT(audio_port_color));
+               }
+               const float x = rintf(width * .5);
+               cairo_rectangle (cr, x-1, 0, 3, height);
+               cairo_fill(cr);
+               cairo_stroke(cr);
        }
 
-       ProcessorEntry::setup_visuals ();
+       cairo_destroy(cr);
+       return true;
 }
 
 bool
-PluginInsertProcessorEntry::SplittingIcon::on_expose_event (GdkEventExpose* ev)
+ProcessorEntry::RoutingIcon::on_expose_event (GdkEventExpose* ev)
 {
        cairo_t* cr = gdk_cairo_create (get_window()->gobj());
 
        cairo_rectangle (cr, ev->area.x, ev->area.y, ev->area.width, ev->area.height);
        cairo_clip (cr);
 
-       cairo_set_line_width (cr, 1.5);
+       cairo_set_line_width (cr, 1.0);
        cairo_set_line_cap (cr, CAIRO_LINE_CAP_ROUND);
 
        Gtk::Allocation a = get_allocation();
@@ -675,21 +821,64 @@ PluginInsertProcessorEntry::SplittingIcon::on_expose_event (GdkEventExpose* ev)
        Gdk::Color const fg = get_style()->get_fg (STATE_NORMAL);
        cairo_set_source_rgb (cr, fg.get_red_p (), fg.get_green_p (), fg.get_blue_p ());
 
-       const float si_l = rint(width * 0.3) + .5;
-       const float si_c = rint(width * 0.5) + .5;
-       const float si_r = rint(width * 0.7) + .5;
-       const float si_m = rint(height * 0.5) + .5;
-
-       cairo_move_to (cr, si_l, height);
-       cairo_line_to (cr, si_l, si_m);
-       cairo_line_to (cr, si_r, si_m);
-       cairo_line_to (cr, si_r, height);
-
-       cairo_set_line_cap (cr, CAIRO_LINE_CAP_BUTT);
-       cairo_move_to (cr, si_c, si_m);
-       cairo_line_to (cr, si_c, 0);
-       cairo_stroke (cr);
-
+       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();
+
+       cairo_set_source_rgb (cr,
+                       UINT_RGBA_R_FLT(midi_port_color),
+                       UINT_RGBA_G_FLT(midi_port_color),
+                       UINT_RGBA_B_FLT(midi_port_color));
+       if (midi_sources > 0 && midi_sinks > 0 && sinks > 1 && sources > 1) {
+               for (uint32_t i = 0 ; i < midi_sources; ++i) {
+                       const float si_x  = rintf(width * (.2f + .6f * i  / (sinks - 1.f))) + .5f;
+                       const float si_x0 = rintf(width * (.2f + .6f * i / (sources - 1.f))) + .5f;
+                       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 == 1 && midi_sinks == 1 && sinks == 1 && sources == 1) {
+               const float si_x = rintf(width * .5f) + .5f;
+               cairo_move_to (cr, si_x, height);
+               cairo_line_to (cr, si_x, 0);
+               cairo_stroke (cr);
+       }
+
+       /* 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),
+                       UINT_RGBA_B_FLT(audio_port_color));
+
+       if (_splitting) {
+               assert(audio_sinks > 1);
+               const float si_x0 = rintf(width * .5f) + .5f;
+               for (uint32_t i = midi_sinks; i < sinks; ++i) {
+                       const float si_x = rintf(width * (.2f + .6f * i / (sinks - 1.f))) + .5f;
+                       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 (audio_sources > 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;
+                       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 (audio_sources == 1 && audio_sinks == 1) {
+               const float si_x = rintf(width * .5f) + .5f;
+               cairo_move_to (cr, si_x, height);
+               cairo_line_to (cr, si_x, 0);
+               cairo_stroke (cr);
+       }
+       cairo_destroy(cr);
        return true;
 }
 
@@ -719,7 +908,7 @@ ProcessorBox::ProcessorBox (ARDOUR::Session* sess, boost::function<PluginSelecto
        processor_display.set_name ("ProcessorList");
        processor_display.set_data ("processorbox", this);
        processor_display.set_size_request (48, -1);
-       processor_display.set_spacing (2);
+       processor_display.set_spacing (0);
 
        processor_display.signal_enter_notify_event().connect (sigc::mem_fun(*this, &ProcessorBox::enter_notify), false);
        processor_display.signal_leave_notify_event().connect (sigc::mem_fun(*this, &ProcessorBox::leave_notify), false);
@@ -803,10 +992,6 @@ ProcessorBox::object_drop(DnDVBox<ProcessorEntry>* source, ProcessorEntry* posit
                           `dropped on' processor */
                        list<ProcessorEntry*> c = processor_display.children ();
                        list<ProcessorEntry*>::iterator i = c.begin ();
-                       while (dynamic_cast<BlankProcessorEntry*> (*i)) {
-                               assert (i != c.end ());
-                               ++i;
-                       }
 
                        assert (i != c.end ());
                        p = (*i)->processor ();
@@ -936,6 +1121,20 @@ 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) {
+                       Menu* m = single_selection->build_send_options_menu ();
+                       if (m && !m->items().empty()) {
+                               send_menu_item->set_submenu (*m);
+                               send_menu_item->set_sensitive (true);
+                       } else {
+                               gtk_menu_item_set_submenu (send_menu_item->gobj(), 0);
+                               send_menu_item->set_sensitive (false);
+                       }
+               }
+       }
+
        /* Sensitise actions as approprioate */
 
         cut_action->set_sensitive (can_cut());
@@ -1247,7 +1446,8 @@ ProcessorBox::choose_insert ()
 void
 ProcessorBox::choose_send ()
 {
-       boost::shared_ptr<Send> send (new Send (*_session, _route->pannable(), _route->mute_master()));
+       boost::shared_ptr<Pannable> sendpan(new Pannable (*_session));
+       boost::shared_ptr<Send> send (new Send (*_session, sendpan, _route->mute_master()));
 
        /* make an educated guess at the initial number of outputs for the send */
        ChanCount outs = (_session->master_out())
@@ -1385,11 +1585,6 @@ ProcessorBox::redisplay_processors ()
        _route->foreach_processor (sigc::bind (sigc::mem_fun (*this, &ProcessorBox::help_count_visible_prefader_processors), 
                                               &_visible_prefader_processors, &fader_seen));
 
-       if (_visible_prefader_processors == 0) { // fader only
-               BlankProcessorEntry* bpe = new BlankProcessorEntry (this, _width);
-               processor_display.add_child (bpe);
-       }
-
        _route->foreach_processor (sigc::mem_fun (*this, &ProcessorBox::add_processor_to_display));
 
        for (ProcessorWindowProxies::iterator i = _processor_window_info.begin(); i != _processor_window_info.end(); ++i) {
@@ -1570,15 +1765,16 @@ ProcessorBox::setup_entry_positions ()
        list<ProcessorEntry*> children = processor_display.children ();
        bool pre_fader = true;
 
+       uint32_t num = 0;
        for (list<ProcessorEntry*>::iterator i = children.begin(); i != children.end(); ++i) {
                if (boost::dynamic_pointer_cast<Amp>((*i)->processor())) {
                        pre_fader = false;
-                       (*i)->set_position (ProcessorEntry::Fader);
+                       (*i)->set_position (ProcessorEntry::Fader, num++);
                } else {
                        if (pre_fader) {
-                               (*i)->set_position (ProcessorEntry::PreFader);
+                               (*i)->set_position (ProcessorEntry::PreFader, num++);
                        } else {
-                               (*i)->set_position (ProcessorEntry::PostFader);
+                               (*i)->set_position (ProcessorEntry::PostFader, num++);
                        }
                }
        }
@@ -1900,8 +2096,9 @@ ProcessorBox::paste_processor_state (const XMLNodeList& nlist, boost::shared_ptr
                                        continue;
                                }
 
+                               boost::shared_ptr<Pannable> sendpan(new Pannable (*_session));
                                XMLNode n (**niter);
-                                InternalSend* s = new InternalSend (*_session, _route->pannable(), _route->mute_master(),
+                                InternalSend* s = new InternalSend (*_session, sendpan, _route->mute_master(),
                                                                    boost::shared_ptr<Route>(), Delivery::Aux); 
 
                                IOProcessor::prepare_for_reset (n, s->name());
@@ -1915,8 +2112,10 @@ ProcessorBox::paste_processor_state (const XMLNodeList& nlist, boost::shared_ptr
 
                        } else if (type->value() == "send") {
 
+                               boost::shared_ptr<Pannable> sendpan(new Pannable (*_session));
                                XMLNode n (**niter);
-                                Send* s = new Send (*_session, _route->pannable(), _route->mute_master());
+
+                               Send* s = new Send (*_session, _route->pannable(), _route->mute_master());
 
                                IOProcessor::prepare_for_reset (n, s->name());
                                
@@ -2249,6 +2448,7 @@ ProcessorBox::register_actions ()
        ActionManager::register_action (popup_act_grp, X_("newaux"), _("New Aux Send ..."));
 
        ActionManager::register_action (popup_act_grp, X_("controls"), _("Controls"));
+       ActionManager::register_action (popup_act_grp, X_("send_options"), _("Send Options"));
 
        ActionManager::register_action (popup_act_grp, X_("clear"), _("Clear (all)"),
                        sigc::ptr_fun (ProcessorBox::rb_clear));