From fa067527fe00b66b85d71955e152e9ef9215c9cd Mon Sep 17 00:00:00 2001 From: David Robillard Date: Sun, 17 Aug 2008 04:05:30 +0000 Subject: Replace imperative polyphony/polyphonic stuff with properties (kill more API). git-svn-id: http://svn.drobilla.net/lad/ingen@1412 a436a847-0d15-0410-975c-d299462d15a1 --- src/libs/gui/ControlPanel.cpp | 29 +++++++++++++---------------- 1 file changed, 13 insertions(+), 16 deletions(-) (limited to 'src/libs/gui/ControlPanel.cpp') diff --git a/src/libs/gui/ControlPanel.cpp b/src/libs/gui/ControlPanel.cpp index 0f38d5dd..84f1163a 100644 --- a/src/libs/gui/ControlPanel.cpp +++ b/src/libs/gui/ControlPanel.cpp @@ -73,12 +73,12 @@ ControlPanel::init(SharedPtr node, uint32_t poly) add_port(*i); } - node->signal_polyphonic.connect( - sigc::mem_fun(this, &ControlPanel::polyphonic_changed)); + node->signal_property.connect(bind( + sigc::mem_fun(this, &ControlPanel::property_changed), false)); if (node->parent()) { - ((PatchModel*)node->parent().get())->signal_polyphony.connect( - sigc::mem_fun(this, &ControlPanel::polyphony_changed)); + node->signal_property.connect(bind( + sigc::mem_fun(this, &ControlPanel::property_changed), true)); } else { cerr << "[ControlPanel] No parent, polyphonic controls disabled" << endl; } @@ -252,19 +252,16 @@ ControlPanel::specific_voice_selected() void -ControlPanel::polyphony_changed(uint32_t poly) +ControlPanel::property_changed(const std::string& predicate, const Raul::Atom& value, bool parent) { - _voice_spinbutton->set_range(0, poly - 1); -} - - -void -ControlPanel::polyphonic_changed(bool poly) -{ - if (poly) - _voice_control_box->show(); - else - _voice_control_box->hide(); + if (!parent && predicate == "ingen:polyphonic" && value.type() == Atom::BOOL) { + if (value.get_bool()) + _voice_control_box->show(); + else + _voice_control_box->hide(); + } else if (parent && predicate == "ingen:polyphony" && value.type() == Atom::INT) { + _voice_spinbutton->set_range(0, value.get_int32() - 1); + } } -- cgit v1.2.1