attempt to be compliant with gcc 4.6 (assuming that its more compliant with standards...
[ardour.git] / libs / surfaces / mackie / route_signal.cc
index 9a3dd41bf4ce29fa2bec337c1d1d0b8dad955290..4446420cd4f3cb4f395339e516939bc73b747a76 100644 (file)
@@ -19,7 +19,9 @@
 
 #include "ardour/route.h"
 #include "ardour/track.h"
-#include "ardour/panner.h"
+#include "ardour/midi_ui.h"
+#include "ardour/pannable.h"
+#include "ardour/session_object.h" // for Properties::name 
 
 #include "mackie_control_protocol.h"
 
@@ -29,38 +31,40 @@ using namespace ARDOUR;
 using namespace Mackie;
 using namespace std;
 
+#define midi_ui_context() MidiControlUI::instance() /* a UICallback-derived object that specifies the event loop for signal handling */
+#define ui_bind(f, ...) boost::protect (boost::bind (f, __VA_ARGS__))
+
 void RouteSignal::connect()
 {
        if (_strip.has_solo()) {
-               _route->solo_control()->Changed.connect(connections, boost::bind (&MackieControlProtocol::notify_solo_changed, &_mcp, this));
+               _route->solo_control()->Changed.connect(connections, MISSING_INVALIDATOR, ui_bind (&MackieControlProtocol::notify_solo_changed, &_mcp, this), midi_ui_context());
        }
 
        if (_strip.has_mute()) {
-               _route->mute_control()->Changed.connect(connections, boost::bind (&MackieControlProtocol::notify_mute_changed, &_mcp, this));
+               _route->mute_control()->Changed.connect(connections, MISSING_INVALIDATOR, ui_bind (&MackieControlProtocol::notify_mute_changed, &_mcp, this), midi_ui_context());
        }
 
        if (_strip.has_gain()) {
-               _route->gain_control()->Changed.connect(connections, boost::bind (&MackieControlProtocol::notify_gain_changed, &_mcp, this, false));
+               _route->gain_control()->Changed.connect(connections, MISSING_INVALIDATOR, ui_bind (&MackieControlProtocol::notify_gain_changed, &_mcp, this, false), midi_ui_context());
        }
 
-       _route->NameChanged.connect (connections, boost::bind (&MackieControlProtocol::notify_name_changed, &_mcp, this));
+       _route->PropertyChanged.connect (connections, MISSING_INVALIDATOR, ui_bind (&MackieControlProtocol::notify_property_changed, &_mcp, _1, this), midi_ui_context());
        
-       if (_route->panner()) {
-               _route->panner()->Changed.connect(connections, boost::bind (&MackieControlProtocol::notify_panner_changed, &_mcp, this, false));
-               
-               for ( unsigned int i = 0; i < _route->panner()->npanners(); ++i ) {
-                       _route->panner()->streampanner(i).Changed.connect (connections, boost::bind (&MackieControlProtocol::notify_panner_changed, &_mcp, this, false));
-               }
+       if (_route->pannable()) {
+               _route->pannable()->pan_azimuth_control->Changed.connect(connections, MISSING_INVALIDATOR, ui_bind (&MackieControlProtocol::notify_panner_changed, &_mcp, this, false), midi_ui_context());
+               _route->pannable()->pan_width_control->Changed.connect(connections, MISSING_INVALIDATOR, ui_bind (&MackieControlProtocol::notify_panner_changed, &_mcp, this, false), midi_ui_context());
        }
        
        boost::shared_ptr<Track> trk = boost::dynamic_pointer_cast<ARDOUR::Track>(_route);
        if (trk) {
-               trk->rec_enable_control()->Changed .connect(connections, boost::bind (&MackieControlProtocol::notify_record_enable_changed, &_mcp, this));
+               trk->rec_enable_control()->Changed .connect(connections, MISSING_INVALIDATOR, ui_bind (&MackieControlProtocol::notify_record_enable_changed, &_mcp, this), midi_ui_context());
        }
        
        // TODO this works when a currently-banked route is made inactive, but not
        // when a route is activated which should be currently banked.
-       _route->active_changed.connect (connections, boost::bind (&MackieControlProtocol::notify_active_changed, &_mcp, this));
+       _route->active_changed.connect (connections, MISSING_INVALIDATOR, ui_bind (&MackieControlProtocol::notify_active_changed, &_mcp, this), midi_ui_context());
+
+       _route->DropReferences.connect (connections, MISSING_INVALIDATOR, ui_bind (&MackieControlProtocol::refresh_current_bank, &_mcp), midi_ui_context());
        
        // TODO
        // SelectedChanged
@@ -86,7 +90,7 @@ void RouteSignal::notify_all()
        if ( _strip.has_gain() )
                _mcp.notify_gain_changed( this );
        
-       _mcp.notify_name_changed( this );
+       _mcp.notify_property_changed (PBD::PropertyChange (ARDOUR::Properties::name), this );
        
        if ( _strip.has_vpot() )
                _mcp.notify_panner_changed( this );