From d6823fa9b29bcff74ca180e6d389d8a21cf88d1f Mon Sep 17 00:00:00 2001 From: David Robillard Date: Sun, 17 Aug 2008 03:10:58 +0000 Subject: There! Loader uses only CommonInterface and is now able to parse into a client or engine. Proper OSC serialisation of boolean atoms. Remove patch_enabled and patch_disabled calls/signals/etc in favour of new generic "property" mechanism (courtesy of which much more killed API is to come). git-svn-id: http://svn.drobilla.net/lad/ingen@1410 a436a847-0d15-0410-975c-d299462d15a1 --- src/libs/gui/PatchView.cpp | 31 ++++++++++--------------------- 1 file changed, 10 insertions(+), 21 deletions(-) (limited to 'src/libs/gui/PatchView.cpp') diff --git a/src/libs/gui/PatchView.cpp b/src/libs/gui/PatchView.cpp index 2ba05070..8b720db4 100644 --- a/src/libs/gui/PatchView.cpp +++ b/src/libs/gui/PatchView.cpp @@ -79,11 +79,13 @@ PatchView::set_patch(SharedPtr patch) _poly_spin->set_value(patch->poly()); _destroy_but->set_sensitive(patch->path() != "/"); - patch->enabled() ? enable() : disable(); + + for (GraphObject::Variables::const_iterator i = patch->properties().begin(); + i != patch->properties().end(); ++i) + property_changed(i->first, i->second); // Connect model signals to track state - patch->signal_enabled.connect(sigc::mem_fun(this, &PatchView::enable)); - patch->signal_disabled.connect(sigc::mem_fun(this, &PatchView::disable)); + patch->signal_property.connect(sigc::mem_fun(this, &PatchView::property_changed)); // Connect widget signals to do things _process_but->signal_toggled().connect(sigc::mem_fun(this, &PatchView::process_toggled)); @@ -151,13 +153,8 @@ PatchView::process_toggled() if (!_enable_signal) return; - if (_process_but->get_active()) { - App::instance().engine()->enable_patch(_patch->path()); - App::instance().patch_tree()->patch_enabled(_patch->path()); - } else { - App::instance().engine()->disable_patch(_patch->path()); - App::instance().patch_tree()->patch_disabled(_patch->path()); - } + App::instance().engine()->set_property(_patch->path(), "ingen:enabled", + (bool)_process_but->get_active()); } @@ -183,19 +180,11 @@ PatchView::refresh_clicked() void -PatchView::enable() -{ - _enable_signal = false; - _process_but->set_active(true); - _enable_signal = true; -} - - -void -PatchView::disable() +PatchView::property_changed(const std::string& predicate, const Raul::Atom& value) { _enable_signal = false; - _process_but->set_active(false); + if (predicate == "ingen:enabled" && value.type() == Atom::BOOL) + _process_but->set_active(value.get_bool()); _enable_signal = true; } -- cgit v1.2.1