diff options
-rw-r--r-- | src/libs/gui/ControlPanel.cpp | 25 | ||||
-rw-r--r-- | src/libs/gui/ControlPanel.hpp | 1 | ||||
-rw-r--r-- | src/libs/gui/NodeControlWindow.cpp | 7 | ||||
-rw-r--r-- | src/libs/gui/WindowFactory.cpp | 2 |
4 files changed, 27 insertions, 8 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 diff --git a/src/libs/gui/ControlPanel.hpp b/src/libs/gui/ControlPanel.hpp index bab865b2..b7a1c4b2 100644 --- a/src/libs/gui/ControlPanel.hpp +++ b/src/libs/gui/ControlPanel.hpp @@ -74,6 +74,7 @@ private: void all_voices_selected(); void specific_voice_selected(); void polyphony_changed(uint32_t poly); + void polyphonic_changed(bool poly); bool _callback_enabled; diff --git a/src/libs/gui/NodeControlWindow.cpp b/src/libs/gui/NodeControlWindow.cpp index 3f3ccc97..c0698230 100644 --- a/src/libs/gui/NodeControlWindow.cpp +++ b/src/libs/gui/NodeControlWindow.cpp @@ -50,11 +50,12 @@ NodeControlWindow::NodeControlWindow(SharedPtr<NodeModel> node, uint32_t poly) Glib::RefPtr<Gnome::Glade::Xml> xml = GladeFactory::new_glade_reference("warehouse_win"); xml->get_widget_derived("control_panel_vbox", _control_panel); - _control_panel->reparent(*this); + show_all_children(); + _control_panel->reparent(*this); _control_panel->init(_node, poly); - - show_all_children(); + _control_panel->show(); + resize(); _callback_enabled = true; diff --git a/src/libs/gui/WindowFactory.cpp b/src/libs/gui/WindowFactory.cpp index a20b8fc9..125a242b 100644 --- a/src/libs/gui/WindowFactory.cpp +++ b/src/libs/gui/WindowFactory.cpp @@ -225,7 +225,7 @@ WindowFactory::new_control_window(SharedPtr<NodeModel> node) { uint32_t poly = 1; if (node->polyphonic() && node->parent()) - poly = ((PatchModel*)node->parent().get())->poly(); + poly = ((PatchModel*)node->parent().get())->internal_polyphony(); NodeControlWindow* win = new NodeControlWindow(node, poly); |