From bb9f8aabc4c11e39ae2f748f7ab6881e443afdb2 Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Wed, 17 Oct 2012 22:01:02 +0000 Subject: [PATCH] second half of forward-port of recent a2/mb control protocol changes, this time enabling the GUI to track protocol-active changes git-svn-id: svn://localhost/ardour2/branches/3.0@13303 d708f5d6-7413-0410-9779-e7cbd77b26cf --- gtk2_ardour/rc_option_editor.cc | 20 +++++++++++++++++-- libs/ardour/ardour/control_protocol_manager.h | 2 +- 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/gtk2_ardour/rc_option_editor.cc b/gtk2_ardour/rc_option_editor.cc index 52ef644339..fed8041be9 100644 --- a/gtk2_ardour/rc_option_editor.cc +++ b/gtk2_ardour/rc_option_editor.cc @@ -670,7 +670,11 @@ public: _box->pack_start (*label, false, false); label->show (); - _store->signal_row_changed().connect (sigc::mem_fun (*this, &ControlSurfacesOptions::model_changed)); + ControlProtocolManager& m = ControlProtocolManager::instance (); + m.ProtocolStatusChange.connect (protocol_status_connection, MISSING_INVALIDATOR, + boost::bind (&ControlSurfacesOptions::protocol_status_changed, this, _1), gui_context()); + + _store->signal_row_changed().connect (sigc::mem_fun (*this, &ControlSurfacesOptions::view_changed)); _view.signal_button_press_event().connect_notify (sigc::mem_fun(*this, &ControlSurfacesOptions::edit_clicked)); } @@ -698,7 +702,18 @@ public: private: - void model_changed (TreeModel::Path const &, TreeModel::iterator const & i) + void protocol_status_changed (ControlProtocolInfo* cpi) { + /* find the row */ + TreeModel::Children rows = _store->children(); + for (TreeModel::Children::iterator x = rows.begin(); x != rows.end(); ++x) { + if ((*x)[_model.protocol_info] == cpi) { + (*x)[_model.enabled] = (cpi->protocol || cpi->requested); + break; + } + } + } + + void view_changed (TreeModel::Path const &, TreeModel::iterator const & i) { TreeModel::Row r = *i; @@ -794,6 +809,7 @@ private: ControlSurfacesModelColumns _model; TreeView _view; Gtk::Window& _parent; + PBD::ScopedConnection protocol_status_connection; }; /** A class which allows control of visibility of some editor components usign diff --git a/libs/ardour/ardour/control_protocol_manager.h b/libs/ardour/ardour/control_protocol_manager.h index 94fd0df2b4..519c762eee 100644 --- a/libs/ardour/ardour/control_protocol_manager.h +++ b/libs/ardour/ardour/control_protocol_manager.h @@ -75,7 +75,7 @@ class ControlProtocolManager : public PBD::Stateful, public ARDOUR::SessionHandl int set_state (const XMLNode&, int version); XMLNode& get_state (void); - sigc::signal ProtocolStatusChange; + PBD::Signal1 ProtocolStatusChange; private: ControlProtocolManager (); -- 2.30.2