PBD::Signal1<void,ControlProtocolInfo*> ProtocolStatusChange;
void stripable_selection_changed (ARDOUR::StripableNotificationListPtr);
+ static PBD::Signal1<void,ARDOUR::StripableNotificationListPtr> StripableSelectionChanged;
private:
ControlProtocolManager ();
ControlProtocolManager* ControlProtocolManager::_instance = 0;
const string ControlProtocolManager::state_node_name = X_("ControlProtocols");
-
+PBD::Signal1<void,StripableNotificationListPtr> ControlProtocolManager::StripableSelectionChanged;
ControlProtocolInfo::~ControlProtocolInfo ()
{
*/
DEBUG_TRACE (DEBUG::Selection, string_compose ("Surface manager: selection changed, now %1 stripables\n", sp ? sp->size() : -1));
- ControlProtocol::notify_stripable_selection_changed (sp);
+ StripableSelectionChanged (sp); /* EMIT SIGNAL */
/* now give each protocol the chance to respond to the selection change
*/
#include "pbd/convert.h"
#include "pbd/error.h"
+#include "ardour/control_protocol_manager.h"
#include "ardour/gain_control.h"
#include "ardour/session.h"
#include "ardour/record_enable_control.h"
boost::weak_ptr<Stripable> ControlProtocol::_first_selected_stripable;
boost::weak_ptr<Stripable> ControlProtocol::_leftmost_mixer_stripable;
StripableNotificationList ControlProtocol::_last_selected;
+PBD::ScopedConnection ControlProtocol::selection_connection;
+bool ControlProtocol::selection_connected = false;
const std::string ControlProtocol::state_node_name ("Protocol");
, _name (str)
, _active (false)
{
+ if (!selection_connected) {
+ /* this is all static, connect it only once (and early), for all ControlProtocols */
+ ControlProtocolManager::StripableSelectionChanged.connect_same_thread (selection_connection, boost::bind (&ControlProtocol::notify_stripable_selection_changed, _1));
+ selection_connected = true;
+ }
}
ControlProtocol::~ControlProtocol ()
static boost::weak_ptr<ARDOUR::Stripable> _leftmost_mixer_stripable;
static boost::weak_ptr<ARDOUR::Stripable> _first_selected_stripable;
static StripableNotificationList _last_selected;
+ static PBD::ScopedConnection selection_connection;
+ static bool selection_connected;
};
extern "C" {