summaryrefslogtreecommitdiffstats
path: root/src/gui
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2008-12-21 17:31:15 +0000
committerDavid Robillard <d@drobilla.net>2008-12-21 17:31:15 +0000
commit1c97ea40ba7b2affbb14fe2b6a4ab6bffb2ae67d (patch)
tree6a4da1b2eefaf1b598fe5a4ab1df6b86f116d2bd /src/gui
parent62ad851a3614c64207961dcc26ddce052ae9f573 (diff)
downloadingen-1c97ea40ba7b2affbb14fe2b6a4ab6bffb2ae67d.tar.gz
ingen-1c97ea40ba7b2affbb14fe2b6a4ab6bffb2ae67d.tar.bz2
ingen-1c97ea40ba7b2affbb14fe2b6a4ab6bffb2ae67d.zip
Don't allow setting port range to values that don't include the current port value (fix #298. again.)
git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@1888 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/PortPropertiesWindow.cpp20
1 files changed, 16 insertions, 4 deletions
diff --git a/src/gui/PortPropertiesWindow.cpp b/src/gui/PortPropertiesWindow.cpp
index aa5f8060..89d17154 100644
--- a/src/gui/PortPropertiesWindow.cpp
+++ b/src/gui/PortPropertiesWindow.cpp
@@ -106,9 +106,15 @@ PortPropertiesWindow::variable_change(const string& key, const Atom& value)
void
PortPropertiesWindow::min_changed()
{
- const float min = _min_spinner->get_value();
- float max = _max_spinner->get_value();
+ const float val = _port_model->value().get_float();
+ float min = _min_spinner->get_value();
+ float max = _max_spinner->get_value();
+ if (min > val) {
+ _min_spinner->set_value(val);
+ return; // avoid recursion
+ }
+
if (max <= min) {
max = min + 1.0;
_max_spinner->set_value(max);
@@ -122,9 +128,15 @@ PortPropertiesWindow::min_changed()
void
PortPropertiesWindow::max_changed()
{
- float min = _min_spinner->get_value();
- const float max = _max_spinner->get_value();
+ const float val = _port_model->value().get_float();
+ float min = _min_spinner->get_value();
+ float max = _max_spinner->get_value();
+ if (max < val) {
+ _max_spinner->set_value(val);
+ return; // avoid recursion
+ }
+
if (min >= max) {
min = max - 1.0;
_min_spinner->set_value(min);