first pass on track mode switch; fixes to dangling region refs after capture; destroy...
[ardour.git] / gtk2_ardour / send_ui.cc
index 0869490c0c3c278a7dfe70185ad958f9110c3c55..c4656834a66919f2c67bf2e7cc7afa86e53d79e1 100644 (file)
@@ -28,8 +28,9 @@
 #include "gui_thread.h"
 
 using namespace ARDOUR;
+using namespace PBD;
 
-SendUI::SendUI (Send& s, Session& se)
+SendUI::SendUI (boost::shared_ptr<Send> s, Session& se)
        : _send (s),
          _session (se),
          gpm (s, se),
@@ -52,10 +53,10 @@ SendUI::SendUI (Send& s, Session& se)
 
        show_all ();
 
-       _send.set_metering (true);
+       _send->set_metering (true);
 
-       _send.output_changed.connect (mem_fun (*this, &SendUI::ins_changed));
-       _send.output_changed.connect (mem_fun (*this, &SendUI::outs_changed));
+       _send->output_changed.connect (mem_fun (*this, &SendUI::ins_changed));
+       _send->output_changed.connect (mem_fun (*this, &SendUI::outs_changed));
        
        panners.set_width (Wide);
        panners.setup_pan ();
@@ -63,13 +64,13 @@ SendUI::SendUI (Send& s, Session& se)
        gpm.setup_meters ();
        gpm.set_fader_name ("SendUIFrame");
 
-       screen_update_connection = ARDOUR_UI::instance()->RapidScreenUpdate.connect (mem_fun (*this, &SendUI::update));
+       // screen_update_connection = ARDOUR_UI::instance()->RapidScreenUpdate.connect (mem_fun (*this, &SendUI::update));
        fast_screen_update_connection = ARDOUR_UI::instance()->SuperRapidScreenUpdate.connect (mem_fun (*this, &SendUI::fast_update));
 }
 
 SendUI::~SendUI ()
 {
-       _send.set_metering (false);
+       _send->set_metering (false);
        
        /* XXX not clear that we need to do this */
 
@@ -96,29 +97,20 @@ SendUI::outs_changed (IOChange change, void* ignored)
        }
 }
 
-void
-SendUI::send_going_away (Redirect *ignored)
-{
-       ENSURE_GUI_THREAD (bind (mem_fun (*this, &SendUI::send_going_away), ignored));
-
-       delete this;
-}
-
 void
 SendUI::update ()
 {
-       gpm.update_meters ();
 }
 
 void
 SendUI::fast_update ()
 {
-       if (_session.meter_falloff() > 0.0f) {
-               gpm.update_meters_falloff ();
+       if (Config->get_meter_falloff() > 0.0f) {
+               gpm.update_meters ();
        }
 }
        
-SendUIWindow::SendUIWindow (Send& s, Session& ss)
+SendUIWindow::SendUIWindow (boost::shared_ptr<Send> s, Session& ss)
 {
        ui = new SendUI (s, ss);
 
@@ -131,7 +123,7 @@ SendUIWindow::SendUIWindow (Send& s, Session& ss)
        add (vpacker);
        set_name ("SendUIWindow");
 
-       s.GoingAway.connect (mem_fun (*this, &SendUIWindow::send_going_away));
+       s->GoingAway.connect (mem_fun (*this, &SendUIWindow::send_going_away));
 
        signal_delete_event().connect (bind (ptr_fun (just_hide_it), reinterpret_cast<Window *> (this)));
 
@@ -143,10 +135,9 @@ SendUIWindow::~SendUIWindow ()
 }
 
 void
-SendUIWindow::send_going_away (Redirect *ignored)
+SendUIWindow::send_going_away ()
 {
-       ENSURE_GUI_THREAD(bind (mem_fun (*this, &SendUIWindow::send_going_away), ignored));
-       
-       delete this;
+       ENSURE_GUI_THREAD (mem_fun (*this, &SendUIWindow::send_going_away));
+       delete_when_idle (this);
 }