diff options
author | David Robillard <d@drobilla.net> | 2008-08-14 03:31:38 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2008-08-14 03:31:38 +0000 |
commit | 2ad7b1dab1cbbc9a35fe84ce784179d78fba3a29 (patch) | |
tree | 5ffaaad3a2e860a11bdc725deae75f26a24a88d8 /src/libs/gui/ControlPanel.cpp | |
parent | 13c6e78272e025503feb14dc30e9d4550144bfd8 (diff) | |
download | ingen-2ad7b1dab1cbbc9a35fe84ce784179d78fba3a29.tar.gz ingen-2ad7b1dab1cbbc9a35fe84ce784179d78fba3a29.tar.bz2 ingen-2ad7b1dab1cbbc9a35fe84ce784179d78fba3a29.zip |
Clamp range of voice selector in node control window.
Only show voice controls for polyphonic nodes (and dynamically show/hide).
git-svn-id: http://svn.drobilla.net/lad/ingen@1366 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/libs/gui/ControlPanel.cpp')
-rw-r--r-- | src/libs/gui/ControlPanel.cpp | 25 |
1 files changed, 21 insertions, 4 deletions
diff --git a/src/libs/gui/ControlPanel.cpp b/src/libs/gui/ControlPanel.cpp index 7e82c7dc..3bd7cb2d 100644 --- a/src/libs/gui/ControlPanel.cpp +++ b/src/libs/gui/ControlPanel.cpp @@ -62,10 +62,14 @@ ControlPanel::init(SharedPtr<NodeModel> node, uint32_t poly) assert(node != NULL); assert(poly > 0); + cout << "CONTROL PANEL " << poly << endl; + if (node->polyphonic()) { + cout << "POLY" << endl; _voice_spinbutton->set_range(0, poly - 1); _voice_control_box->show(); } else { + cout << "NO POLY" << endl; //remove(*_voice_control_box); _voice_control_box->hide(); } @@ -73,12 +77,16 @@ ControlPanel::init(SharedPtr<NodeModel> node, uint32_t poly) for (PortModelList::const_iterator i = node->ports().begin(); i != node->ports().end(); ++i) { add_port(*i); } + + node->signal_polyphonic.connect( + sigc::mem_fun(this, &ControlPanel::polyphonic_changed)); - if (node->parent()) + if (node->parent()) { ((PatchModel*)node->parent().get())->signal_polyphony.connect( sigc::mem_fun(this, &ControlPanel::polyphony_changed)); - else + } else { cerr << "[ControlPanel] No parent, polyphonic controls disabled" << endl; + } _callback_enabled = true; } @@ -237,7 +245,7 @@ ControlPanel::value_changed(SharedPtr<PortModel> port, float val) sizeof(float), &val); port->value(val); } else { - int voice = _voice_spinbutton->get_value_as_int(); + int voice = _voice_spinbutton->get_value_as_int() - 1; App::instance().engine()->set_port_value_immediate(port->path(), "ingen:Float", voice, sizeof(float), &val); port->value(val); @@ -263,10 +271,19 @@ ControlPanel::specific_voice_selected() void ControlPanel::polyphony_changed(uint32_t poly) { - cerr << "POLY CHANGED" << endl; _voice_spinbutton->set_range(0, poly - 1); } + +void +ControlPanel::polyphonic_changed(bool poly) +{ + if (poly) + _voice_control_box->show(); + else + _voice_control_box->hide(); +} + } // namespace GUI } // namespace Ingen |