diff options
author | Paul Davis <paul@linuxaudiosystems.com> | 2013-12-21 15:26:35 -0500 |
---|---|---|
committer | Paul Davis <paul@linuxaudiosystems.com> | 2013-12-21 15:31:28 -0500 |
commit | 0cf8b9d3ea1ab2db7d1871f8ac971a13780d2a61 (patch) | |
tree | 2e38322339d5e28d465a09e53eea50ddfc61445b /gtk2_ardour/rc_option_editor.cc | |
parent | 62d84d47b9e262c2431caa5104bfcbf200d3d7a3 (diff) |
new ControlProtocolManager API, and proper handling of view/model changes in the RC options (prefs) editor
Diffstat (limited to 'gtk2_ardour/rc_option_editor.cc')
-rw-r--r-- | gtk2_ardour/rc_option_editor.cc | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/gtk2_ardour/rc_option_editor.cc b/gtk2_ardour/rc_option_editor.cc index 43fd163d2c..b514a75a80 100644 --- a/gtk2_ardour/rc_option_editor.cc +++ b/gtk2_ardour/rc_option_editor.cc @@ -648,6 +648,7 @@ class ControlSurfacesOptions : public OptionEditorBox public: ControlSurfacesOptions (Gtk::Window& parent) : _parent (parent) + , _ignore_view_change (0) { _store = ListStore::create (_model); _view.set_model (_store); @@ -700,9 +701,14 @@ private: 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) { + string n = ((*x)[_model.name]); + if ((*x)[_model.protocol_info] == cpi) { + _ignore_view_change++; (*x)[_model.enabled] = (cpi->protocol || cpi->requested); + _ignore_view_change--; break; } } @@ -712,6 +718,10 @@ private: { TreeModel::Row r = *i; + if (_ignore_view_change) { + return; + } + ControlProtocolInfo* cpi = r[_model.protocol_info]; if (!cpi) { return; @@ -720,22 +730,23 @@ private: bool const was_enabled = (cpi->protocol != 0); bool const is_enabled = r[_model.enabled]; + if (was_enabled != is_enabled) { + if (!was_enabled) { - ControlProtocolManager::instance().instantiate (*cpi); + ControlProtocolManager::instance().activate (*cpi); } else { Gtk::Window* win = r[_model.editor]; if (win) { win->hide (); } - ControlProtocolManager::instance().teardown (*cpi); + ControlProtocolManager::instance().deactivate (*cpi); if (win) { delete win; + r[_model.editor] = 0; } - r[_model.editor] = 0; - cpi->requested = false; } } @@ -805,6 +816,7 @@ private: TreeView _view; Gtk::Window& _parent; PBD::ScopedConnection protocol_status_connection; + uint32_t _ignore_view_change; }; class VideoTimelineOptions : public OptionEditorBox |