diff options
author | David Robillard <d@drobilla.net> | 2008-12-21 02:51:47 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2008-12-21 02:51:47 +0000 |
commit | 038fe000ec5a99c3e6219532c3b0aaed3e319a63 (patch) | |
tree | 6795989bf1fae495fe5ccbdfe53f08a272083362 | |
parent | 2dfc299dc208808cd77617fef3cad2623a2d5b1a (diff) | |
download | ingen-038fe000ec5a99c3e6219532c3b0aaed3e319a63.tar.gz ingen-038fe000ec5a99c3e6219532c3b0aaed3e319a63.tar.bz2 ingen-038fe000ec5a99c3e6219532c3b0aaed3e319a63.zip |
Fix control range stuff (fix ticket #298).
git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@1884 a436a847-0d15-0410-975c-d299462d15a1
-rw-r--r-- | src/gui/Controls.cpp | 11 | ||||
-rw-r--r-- | src/gui/PortPropertiesWindow.cpp | 27 | ||||
-rw-r--r-- | src/gui/PortPropertiesWindow.hpp | 2 |
3 files changed, 24 insertions, 16 deletions
diff --git a/src/gui/Controls.cpp b/src/gui/Controls.cpp index d76f4e17..99335503 100644 --- a/src/gui/Controls.cpp +++ b/src/gui/Controls.cpp @@ -189,18 +189,23 @@ SliderControl::set_value(const Atom& atom) void SliderControl::port_variable_change(const string& key, const Atom& value) { - if ( (key == "lv2:minimum") && value.type() == Atom::FLOAT) + _enable_signal = false; + + if (key == "lv2:minimum" && value.type() == Atom::FLOAT) set_range(value.get_float(), _slider->get_adjustment()->get_upper()); - else if ( (key == "lv2:maximum") && value.type() == Atom::FLOAT) + else if (key == "lv2:maximum" && value.type() == Atom::FLOAT) set_range(_slider->get_adjustment()->get_lower(), value.get_float()); + + _enable_signal = true; } void SliderControl::set_range(float min, float max) { - if (min <= min) + if (max <= min) max = min + 1.0; + _slider->set_range(min, max); //_value_spinner->set_range(min, max); } diff --git a/src/gui/PortPropertiesWindow.cpp b/src/gui/PortPropertiesWindow.cpp index d2a1041c..aa5f8060 100644 --- a/src/gui/PortPropertiesWindow.cpp +++ b/src/gui/PortPropertiesWindow.cpp @@ -32,7 +32,7 @@ namespace GUI { PortPropertiesWindow::PortPropertiesWindow(BaseObjectType* cobject, const Glib::RefPtr<Gnome::Glade::Xml>& xml) : Gtk::Window(cobject) - , _enable_signal(false) + //, _enable_signal(false) { xml->get_widget("port_properties_min_spinner", _min_spinner); xml->get_widget("port_properties_max_spinner", _max_spinner); @@ -83,7 +83,7 @@ PortPropertiesWindow::present(SharedPtr<PortModel> pm) _connections.push_back(pm->signal_variable.connect( sigc::mem_fun(this, &PortPropertiesWindow::variable_change))); - _enable_signal = true; + //_enable_signal = true; Gtk::Window::present(); } @@ -92,14 +92,14 @@ PortPropertiesWindow::present(SharedPtr<PortModel> pm) void PortPropertiesWindow::variable_change(const string& key, const Atom& value) { - _enable_signal = false; + //_enable_signal = false; - if ( (key == "lv2:minimum") && value.type() == Atom::FLOAT) + if (key == "lv2:minimum" && value.type() == Atom::FLOAT) _min_spinner->set_value(value.get_float()); - else if ( (key == "lv2:maximum") && value.type() == Atom::FLOAT) + else if (key == "lv2:maximum" && value.type() == Atom::FLOAT) _max_spinner->set_value(value.get_float()); - _enable_signal = true; + //_enable_signal = true; } @@ -114,8 +114,8 @@ PortPropertiesWindow::min_changed() _max_spinner->set_value(max); } - if (_enable_signal) - App::instance().engine()->set_variable(_port_model->path(), "lv2:minimum", min); + //if (_enable_signal) + // App::instance().engine()->set_variable(_port_model->path(), "lv2:minimum", min); } @@ -130,16 +130,14 @@ PortPropertiesWindow::max_changed() _min_spinner->set_value(min); } - if (_enable_signal) - App::instance().engine()->set_variable(_port_model->path(), "lv2:maximum", max); + //if (_enable_signal) + // App::instance().engine()->set_variable(_port_model->path(), "lv2:maximum", max); } void PortPropertiesWindow::cancel() { - App::instance().engine()->set_variable(_port_model->path(), "lv2:minimum", _initial_min); - App::instance().engine()->set_variable(_port_model->path(), "lv2:maximum", _initial_max); hide(); } @@ -147,6 +145,11 @@ PortPropertiesWindow::cancel() void PortPropertiesWindow::ok() { + const float min = _min_spinner->get_value(); + const float max = _max_spinner->get_value(); + + App::instance().engine()->set_variable(_port_model->path(), "lv2:minimum", min); + App::instance().engine()->set_variable(_port_model->path(), "lv2:maximum", max); hide(); } diff --git a/src/gui/PortPropertiesWindow.hpp b/src/gui/PortPropertiesWindow.hpp index e8037e36..63b27192 100644 --- a/src/gui/PortPropertiesWindow.hpp +++ b/src/gui/PortPropertiesWindow.hpp @@ -49,7 +49,7 @@ private: void ok(); void cancel(); - bool _enable_signal; + //bool _enable_signal; float _initial_min; float _initial_max; |