diff options
Diffstat (limited to 'src/libs/gui/ControlGroups.cpp')
-rw-r--r-- | src/libs/gui/ControlGroups.cpp | 36 |
1 files changed, 4 insertions, 32 deletions
diff --git a/src/libs/gui/ControlGroups.cpp b/src/libs/gui/ControlGroups.cpp index b22f0a2d..b6c62435 100644 --- a/src/libs/gui/ControlGroups.cpp +++ b/src/libs/gui/ControlGroups.cpp @@ -115,39 +115,11 @@ SliderControlGroup::init(ControlPanel* panel, SharedPtr<PortModel> pm) _value_spinner->signal_value_changed().connect( sigc::mem_fun(*this, &SliderControlGroup::update_value_from_spinner)); - // FIXME: code duplication w/ PortPropertiesWindow.cpp - float min = 0.0f; - float max = 1.0f; - - const Atom& min_atom = pm->get_metadata("ingen:minimum"); - const Atom& max_atom = pm->get_metadata("ingen:maximum"); - if (min_atom.type() == Atom::FLOAT && max_atom.type() == Atom::FLOAT) { - min = min_atom.get_float(); - max = max_atom.get_float(); - } + float min = 0.0f, max = 1.0f; - const SharedPtr<NodeModel> parent = PtrCast<NodeModel>(pm->parent()); -#ifdef HAVE_SLV2 - if (parent && parent->plugin() && parent->plugin()->type() == PluginModel::LV2) { - min = slv2_port_get_minimum_value( - parent->plugin()->slv2_plugin(), - slv2_plugin_get_port_by_symbol(parent->plugin()->slv2_plugin(), - pm->path().name().c_str())); - max = slv2_port_get_maximum_value( - parent->plugin()->slv2_plugin(), - slv2_plugin_get_port_by_symbol(parent->plugin()->slv2_plugin(), - pm->path().name().c_str())); - } -#endif - - if (min > pm->value()) - min = pm->value(); - - if (max < pm->value()) - max = pm->value(); - - if (max <= min) - max = min + 1.0f; + boost::shared_ptr<NodeModel> parent = PtrCast<NodeModel>(_port_model->parent()); + if (parent) + parent->port_value_range(_port_model->path().name(), min, max); if (pm->is_integer() || pm->is_toggle()) { _slider->set_increments(1, 10); |