Fixed bug where embedded sources did not correctly obey the BWF time stamp and would...
[ardour.git] / gtk2_ardour / send_ui.cc
index 071adf8627b80c6ddf20ce262d606da3028dca38..7cf8228ffe551a8bbc4ab0ee9bbf621c45d6b577 100644 (file)
 #include "ardour_ui.h"
 #include "gui_thread.h"
 
+#include "i18n.h"
+
 using namespace std;
 using namespace ARDOUR;
 using namespace PBD;
 
-SendUI::SendUI (Gtk::Window* parent, boost::shared_ptr<Send> s, Session& se)
+SendUI::SendUI (Gtk::Window* parent, boost::shared_ptr<Send> s, Session* session)
        : _send (s)
-       , _session (se)
-       , _gpm (se, 250)
-       , _panners (se)
+       , _gpm (session, 250)
+       , _panners (session)
 {
-       _panners.set_panner (s->panner());
+       assert (_send);
+
+       _panners.set_panner (s->panner_shell(), s->panner());
        _gpm.set_controls (boost::shared_ptr<Route>(), s->meter(), s->amp());
 
        _hbox.pack_start (_gpm, true, true);
@@ -52,18 +55,21 @@ SendUI::SendUI (Gtk::Window* parent, boost::shared_ptr<Send> s, Session& se)
        _vbox.pack_start (_hbox, false, false, false);
        _vbox.pack_start (_panners, false, false);
 
-       io = manage (new IOSelector (parent, &se, s->output()));
+       io = manage (new IOSelector (parent, session, s->output()));
 
        pack_start (_vbox, false, false);
 
        pack_start (*io, true, true);
 
-       show_all ();
+       io->show ();
+       _gpm.show_all ();
+       _panners.show_all ();
+       _vbox.show ();
+       _hbox.show ();
 
        _send->set_metering (true);
 
-       _send->input()->changed.connect (mem_fun (*this, &SendUI::ins_changed));
-       _send->output()->changed.connect (mem_fun (*this, &SendUI::outs_changed));
+       _send->output()->changed.connect (connections, invalidator (*this), ui_bind (&SendUI::outs_changed, this, _1, _2), gui_context());
 
        _panners.set_width (Wide);
        _panners.setup_pan ();
@@ -72,9 +78,9 @@ SendUI::SendUI (Gtk::Window* parent, boost::shared_ptr<Send> s, Session& se)
        _gpm.set_fader_name ("SendUIFrame");
 
        // screen_update_connection = ARDOUR_UI::instance()->RapidScreenUpdate.connect (
-       //              mem_fun (*this, &SendUI::update));
+       //              sigc::mem_fun (*this, &SendUI::update));
        fast_screen_update_connection = ARDOUR_UI::instance()->SuperRapidScreenUpdate.connect (
-                       mem_fun (*this, &SendUI::fast_update));
+                       sigc::mem_fun (*this, &SendUI::fast_update));
 }
 
 SendUI::~SendUI ()
@@ -88,19 +94,10 @@ SendUI::~SendUI ()
 }
 
 void
-SendUI::ins_changed (IOChange change, void* ignored)
+SendUI::outs_changed (IOChange change, void* /*ignored*/)
 {
-       ENSURE_GUI_THREAD(bind (mem_fun (*this, &SendUI::ins_changed), change, ignored));
-       if (change & ConfigurationChanged) {
-               _panners.setup_pan ();
-       }
-}
-
-void
-SendUI::outs_changed (IOChange change, void* ignored)
-{
-       ENSURE_GUI_THREAD(bind (mem_fun (*this, &SendUI::outs_changed), change, ignored));
-       if (change & ConfigurationChanged) {
+       ENSURE_GUI_THREAD (*this, &SendUI::outs_changed, change, ignored)
+       if (change.type & IOChange::ConfigurationChanged) {
                _panners.setup_pan ();
                _gpm.setup_meters ();
        }
@@ -119,10 +116,10 @@ SendUI::fast_update ()
        }
 }
 
-SendUIWindow::SendUIWindow (boost::shared_ptr<Send> s, Session& ss)
-       : ArdourDialog (string("Ardour: send ") + s->name())
+SendUIWindow::SendUIWindow (boost::shared_ptr<Send> s, Session* session)
+       : ArdourDialog (string (_("Send ")) + s->name())
 {
-       ui = new SendUI (this, s, ss);
+       ui = new SendUI (this, s, session);
 
        hpacker.pack_start (*ui, true, true);
 
@@ -131,10 +128,12 @@ SendUIWindow::SendUIWindow (boost::shared_ptr<Send> s, Session& ss)
 
        set_name ("SendUIWindow");
 
-       going_away_connection = s->GoingAway.connect (
-                       mem_fun (*this, &SendUIWindow::send_going_away));
+       ui->show ();
+       hpacker.show ();
+
+       s->DropReferences.connect (going_away_connection, invalidator (*this), boost::bind (&SendUIWindow::send_going_away, this), gui_context());
 
-       signal_delete_event().connect (bind (
+       signal_delete_event().connect (sigc::bind (
                                               sigc::ptr_fun (just_hide_it),
                                               reinterpret_cast<Window *> (this)));
 }
@@ -147,8 +146,8 @@ SendUIWindow::~SendUIWindow ()
 void
 SendUIWindow::send_going_away ()
 {
-       ENSURE_GUI_THREAD (mem_fun (*this, &SendUIWindow::send_going_away));
-       delete_when_idle (this);
+       ENSURE_GUI_THREAD (*this, &SendUIWindow::send_going_away)
        going_away_connection.disconnect ();
+       delete_when_idle (this);
 }