diff layer/SpectrumLayer.cpp @ 216:34bbbcb3c01f 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 45e995ed84d9
children 8dc50f57d480
line wrap: on
line diff
--- a/layer/SpectrumLayer.cpp	Fri Mar 02 13:01:41 2007 +0000
+++ b/layer/SpectrumLayer.cpp	Fri Mar 02 14:00:12 2007 +0000
@@ -131,36 +131,39 @@
 
 int
 SpectrumLayer::getPropertyRangeAndValue(const PropertyName &name,
-                                        int *min, int *max) const
+                                        int *min, int *max, int *deflt) const
 {
-    int deft = 0;
+    int val = 0;
 
-    int garbage0, garbage1;
+    int garbage0, garbage1, garbage2;
     if (!min) min = &garbage0;
     if (!max) max = &garbage1;
+    if (!deflt) deflt = &garbage2;
 
     if (name == "Window Size") {
 
 	*min = 0;
 	*max = 10;
+        *deflt = 5;
 	
-	deft = 0;
+	val = 0;
 	int ws = m_windowSize;
-	while (ws > 32) { ws >>= 1; deft ++; }
+	while (ws > 32) { ws >>= 1; val ++; }
 
     } else if (name == "Window Increment") {
 	
 	*min = 0;
 	*max = 5;
+        *deflt = 2;
 	
-        deft = m_windowHopLevel;
+        val = m_windowHopLevel;
     
     } else {
 
-        deft = SliceLayer::getPropertyRangeAndValue(name, min, max);
+        val = SliceLayer::getPropertyRangeAndValue(name, min, max, deflt);
     }
 
-    return deft;
+    return val;
 }
 
 QString