diff base/PropertyContainer.cpp @ 245:4cd620bd4c61 sv1-1.0pre1

* Make getPropertyRangeAndValue return the default separately from the current value. Previously some contexts were incorrectly treating the current value as a default.
author Chris Cannam
date Fri, 02 Mar 2007 14:00:12 +0000
parents 91fdc752e540
children 21b9b25bff48
line wrap: on
line diff
--- a/base/PropertyContainer.cpp	Fri Mar 02 13:01:41 2007 +0000
+++ b/base/PropertyContainer.cpp	Fri Mar 02 14:00:12 2007 +0000
@@ -47,10 +47,12 @@
 }
 
 int
-PropertyContainer::getPropertyRangeAndValue(const PropertyName &, int *min, int *max) const
+PropertyContainer::getPropertyRangeAndValue(const PropertyName &,
+                                            int *min, int *max, int *deflt) const
 {
     if (min) *min = 0;
     if (max) *max = 0;
+    if (deflt) *deflt = 0;
     return 0;
 }
 
@@ -75,7 +77,7 @@
 void
 PropertyContainer::setPropertyWithCommand(const PropertyName &name, int value)
 {
-    int currentValue = getPropertyRangeAndValue(name, 0, 0);
+    int currentValue = getPropertyRangeAndValue(name, 0, 0, 0);
     if (value == currentValue) return;
 
     CommandHistory::getInstance()->addCommand
@@ -176,7 +178,7 @@
     case ValueProperty:
     {
         int min, max;
-        getPropertyRangeAndValue(name, &min, &max);
+        getPropertyRangeAndValue(name, &min, &max, 0);
         for (int i = min; i <= max; ++i) {
             if (valueString == getPropertyValueLabel(name, i)) {
                 value = i;
@@ -211,7 +213,7 @@
     if (success) return true;
 
     int min, max;
-    getPropertyRangeAndValue(name, &min, &max);
+    getPropertyRangeAndValue(name, &min, &max, 0);
     
     bool ok = false;
     int i = valueString.toInt(&ok);
@@ -240,7 +242,7 @@
 void
 PropertyContainer::SetPropertyCommand::execute()
 {
-    m_oldValue = m_pc->getPropertyRangeAndValue(m_pn, 0, 0);
+    m_oldValue = m_pc->getPropertyRangeAndValue(m_pn, 0, 0, 0);
     m_pc->setProperty(m_pn, m_value);
 }