changeset 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 d2334a77db73
children bd2d0346da0e
files layer/Colour3DPlotLayer.cpp layer/Colour3DPlotLayer.h layer/NoteLayer.cpp layer/NoteLayer.h layer/SliceLayer.cpp layer/SliceLayer.h layer/SpectrogramLayer.cpp layer/SpectrogramLayer.h layer/SpectrumLayer.cpp layer/SpectrumLayer.h layer/TextLayer.cpp layer/TextLayer.h layer/TimeInstantLayer.cpp layer/TimeInstantLayer.h layer/TimeRulerLayer.cpp layer/TimeRulerLayer.h layer/TimeValueLayer.cpp layer/TimeValueLayer.h layer/WaveformLayer.cpp layer/WaveformLayer.h view/View.cpp view/View.h widgets/PropertyBox.cpp widgets/WindowTypeSelector.cpp
diffstat 24 files changed, 241 insertions(+), 181 deletions(-) [+]
line wrap: on
line diff
--- a/layer/Colour3DPlotLayer.cpp	Fri Mar 02 13:01:41 2007 +0000
+++ b/layer/Colour3DPlotLayer.cpp	Fri Mar 02 14:00:12 2007 +0000
@@ -123,41 +123,46 @@
 
 int
 Colour3DPlotLayer::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 == "Colour Scale") {
 
 	*min = 0;
 	*max = 2;
+        *deflt = (int)LinearScale;
 
-	deft = (int)m_colourScale;
+	val = (int)m_colourScale;
 
     } else if (name == "Colour") {
 
 	*min = 0;
 	*max = ColourMapper::getColourMapCount() - 1;
+        *deflt = 0;
 
-	deft = m_colourMap;
+	val = m_colourMap;
 
     } else if (name == "Normalize Columns") {
 	
-	deft = (m_normalizeColumns ? 1 : 0);
+        *deflt = 0;
+	val = (m_normalizeColumns ? 1 : 0);
 
     } else if (name == "Normalize Visible Area") {
 	
-	deft = (m_normalizeVisibleArea ? 1 : 0);
+        *deflt = 0;
+	val = (m_normalizeVisibleArea ? 1 : 0);
 
     } else {
-	deft = Layer::getPropertyRangeAndValue(name, min, max);
+	val = Layer::getPropertyRangeAndValue(name, min, max, deflt);
     }
 
-    return deft;
+    return val;
 }
 
 QString
--- a/layer/Colour3DPlotLayer.h	Fri Mar 02 13:01:41 2007 +0000
+++ b/layer/Colour3DPlotLayer.h	Fri Mar 02 14:00:12 2007 +0000
@@ -75,7 +75,7 @@
     virtual QString getPropertyLabel(const PropertyName &) const;
     virtual QString getPropertyGroupName(const PropertyName &) const;
     virtual int getPropertyRangeAndValue(const PropertyName &,
-                                         int *min, int *max) const;
+                                         int *min, int *max, int *deflt) const;
     virtual QString getPropertyValueLabel(const PropertyName &,
 					  int value) const;
     virtual void setProperty(const PropertyName &, int value);
--- a/layer/NoteLayer.cpp	Fri Mar 02 13:01:41 2007 +0000
+++ b/layer/NoteLayer.cpp	Fri Mar 02 14:00:12 2007 +0000
@@ -103,44 +103,47 @@
 
 int
 NoteLayer::getPropertyRangeAndValue(const PropertyName &name,
-					 int *min, int *max) const
+                                    int *min, int *max, int *deflt) const
 {
     //!!! factor this colour handling stuff out into a colour manager class
 
-    int deft = 0;
+    int val = 0;
 
     if (name == "Colour") {
 
 	if (min) *min = 0;
 	if (max) *max = 5;
+        if (deflt) *deflt = 0;
 
-	if (m_colour == Qt::black) deft = 0;
-	else if (m_colour == Qt::darkRed) deft = 1;
-	else if (m_colour == Qt::darkBlue) deft = 2;
-	else if (m_colour == Qt::darkGreen) deft = 3;
-	else if (m_colour == QColor(200, 50, 255)) deft = 4;
-	else if (m_colour == QColor(255, 150, 50)) deft = 5;
+	if (m_colour == Qt::black) val = 0;
+	else if (m_colour == Qt::darkRed) val = 1;
+	else if (m_colour == Qt::darkBlue) val = 2;
+	else if (m_colour == Qt::darkGreen) val = 3;
+	else if (m_colour == QColor(200, 50, 255)) val = 4;
+	else if (m_colour == QColor(255, 150, 50)) val = 5;
 
     } else if (name == "Vertical Scale") {
 	
 	if (min) *min = 0;
 	if (max) *max = 3;
+        if (deflt) *deflt = int(AutoAlignScale);
 	
-	deft = int(m_verticalScale);
+	val = int(m_verticalScale);
 
     } else if (name == "Scale Units") {
 
+        if (deflt) *deflt = 0;
         if (m_model) {
-            deft = UnitDatabase::getInstance()->getUnitId
+            val = UnitDatabase::getInstance()->getUnitId
                 (m_model->getScaleUnits());
         }
 
     } else {
-	
-	deft = Layer::getPropertyRangeAndValue(name, min, max);
+
+	val = Layer::getPropertyRangeAndValue(name, min, max, deflt);
     }
 
-    return deft;
+    return val;
 }
 
 QString
--- a/layer/NoteLayer.h	Fri Mar 02 13:01:41 2007 +0000
+++ b/layer/NoteLayer.h	Fri Mar 02 14:00:12 2007 +0000
@@ -66,7 +66,7 @@
     virtual PropertyType getPropertyType(const PropertyName &) const;
     virtual QString getPropertyGroupName(const PropertyName &) const;
     virtual int getPropertyRangeAndValue(const PropertyName &,
-					   int *min, int *max) const;
+                                         int *min, int *max, int *deflt) const;
     virtual QString getPropertyValueLabel(const PropertyName &,
 					  int value) const;
     virtual void setProperty(const PropertyName &, int value);
--- a/layer/SliceLayer.cpp	Fri Mar 02 13:01:41 2007 +0000
+++ b/layer/SliceLayer.cpp	Fri Mar 02 14:00:12 2007 +0000
@@ -516,28 +516,31 @@
 
 int
 SliceLayer::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 = &garbage1;
 
     if (name == "Gain") {
 
 	*min = -50;
 	*max = 50;
+        *deflt = 0;
 
         std::cerr << "gain is " << m_gain << ", mode is " << m_samplingMode << std::endl;
 
-	deft = lrint(log10(m_gain) * 20.0);
-	if (deft < *min) deft = *min;
-	if (deft > *max) deft = *max;
+	val = lrint(log10(m_gain) * 20.0);
+	if (val < *min) val = *min;
+	if (val > *max) val = *max;
 
     } else if (name == "Normalize") {
 	
-	deft = (m_normalize ? 1 : 0);
+	val = (m_normalize ? 1 : 0);
+        *deflt = 0;
 
     } else if (name == "Colour") {
 
@@ -545,56 +548,62 @@
             
             *min = 0;
             *max = ColourMapper::getColourMapCount() - 1;
+            *deflt = 0;
 
-            deft = m_colourMap;
+            val = m_colourMap;
 
         } else {
 
             *min = 0;
             *max = 5;
+            *deflt = 0;
 
-            if (m_colour == Qt::black) deft = 0;
-            else if (m_colour == Qt::darkRed) deft = 1;
-            else if (m_colour == Qt::darkBlue) deft = 2;
-            else if (m_colour == Qt::darkGreen) deft = 3;
-            else if (m_colour == QColor(200, 50, 255)) deft = 4;
-            else if (m_colour == QColor(255, 150, 50)) deft = 5;
+            if (m_colour == Qt::black) val = 0;
+            else if (m_colour == Qt::darkRed) val = 1;
+            else if (m_colour == Qt::darkBlue) val = 2;
+            else if (m_colour == Qt::darkGreen) val = 3;
+            else if (m_colour == QColor(200, 50, 255)) val = 4;
+            else if (m_colour == QColor(255, 150, 50)) val = 5;
         }
 
     } else if (name == "Scale") {
 
 	*min = 0;
 	*max = 2;
+        *deflt = (int)dBScale;
 
-	deft = (int)m_energyScale;
+	val = (int)m_energyScale;
 
     } else if (name == "Sampling Mode") {
 
 	*min = 0;
 	*max = 2;
+        *deflt = (int)SampleMean;
         
-	deft = (int)m_samplingMode;
+	val = (int)m_samplingMode;
 
     } else if (name == "Plot Type") {
         
         *min = 0;
         *max = 3;
+        *deflt = (int)PlotSteps;
 
-        deft = (int)m_plotStyle;
+        val = (int)m_plotStyle;
 
     } else if (name == "Bin Scale") {
         
         *min = 0;
         *max = 2;
+        *deflt = (int)LinearBins;
 //        *max = 1; // I don't think we really do want to offer inverted log
 
-        deft = (int)m_binScale;
+        val = (int)m_binScale;
 
     } else {
-	deft = Layer::getPropertyRangeAndValue(name, min, max);
+	val = Layer::getPropertyRangeAndValue(name, min, max, deflt);
     }
 
-    return deft;
+    return val;
 }
 
 QString
--- a/layer/SliceLayer.h	Fri Mar 02 13:01:41 2007 +0000
+++ b/layer/SliceLayer.h	Fri Mar 02 14:00:12 2007 +0000
@@ -51,7 +51,7 @@
     virtual PropertyType getPropertyType(const PropertyName &) const;
     virtual QString getPropertyGroupName(const PropertyName &) const;
     virtual int getPropertyRangeAndValue(const PropertyName &,
-					   int *min, int *max) const;
+                                         int *min, int *max, int *deflt) const;
     virtual QString getPropertyValueLabel(const PropertyName &,
 					  int value) const;
     virtual RangeMapper *getNewPropertyRangeMapper(const PropertyName &) const;
--- a/layer/SpectrogramLayer.cpp	Fri Mar 02 13:01:41 2007 +0000
+++ b/layer/SpectrogramLayer.cpp	Fri Mar 02 14:00:12 2007 +0000
@@ -81,7 +81,6 @@
 	setColourScale(LinearColourScale);
         setColourMap(ColourMapper::Sunset);
         setFrequencyScale(LogFrequencyScale);
-        m_initialGain = 20;
         setGain(20);
     } else if (config == MelodicPeaks) {
 	setWindowSize(4096);
@@ -210,137 +209,158 @@
 
 int
 SpectrogramLayer::getPropertyRangeAndValue(const PropertyName &name,
-					   int *min, int *max) const
+					   int *min, int *max, int *deflt) const
 {
-    int deft = 0;
-
-    int garbage0, garbage1;
+    int val = 0;
+
+    int garbage0, garbage1, garbage2;
     if (!min) min = &garbage0;
     if (!max) max = &garbage1;
+    if (!deflt) deflt = &garbage2;
 
     if (name == "Gain") {
 
 	*min = -50;
 	*max = 50;
 
-	deft = lrintf(log10(m_initialGain) * 20.0);
-	if (deft < *min) deft = *min;
-	if (deft > *max) deft = *max;
+        *deflt = lrintf(log10(m_initialGain) * 20.0);;
+	if (*deflt < *min) *deflt = *min;
+	if (*deflt > *max) *deflt = *max;
+
+	val = lrintf(log10(m_gain) * 20.0);
+	if (val < *min) val = *min;
+	if (val > *max) val = *max;
 
     } else if (name == "Threshold") {
 
 	*min = -50;
 	*max = 0;
 
-	deft = lrintf(AudioLevel::multiplier_to_dB(m_initialThreshold));
-	if (deft < *min) deft = *min;
-	if (deft > *max) deft = *max;
+        *deflt = lrintf(AudioLevel::multiplier_to_dB(m_initialThreshold));
+	if (*deflt < *min) *deflt = *min;
+	if (*deflt > *max) *deflt = *max;
+
+	val = lrintf(AudioLevel::multiplier_to_dB(m_threshold));
+	if (val < *min) val = *min;
+	if (val > *max) val = *max;
 
     } else if (name == "Colour Rotation") {
 
 	*min = 0;
 	*max = 256;
-
-	deft = m_initialRotation;
+        *deflt = m_initialRotation;
+
+	val = m_colourRotation;
 
     } else if (name == "Colour Scale") {
 
 	*min = 0;
 	*max = 4;
-
-	deft = (int)m_colourScale;
+        *deflt = int(dBColourScale);
+
+	val = (int)m_colourScale;
 
     } else if (name == "Colour") {
 
 	*min = 0;
 	*max = ColourMapper::getColourMapCount() - 1;
-
-	deft = m_colourMap;
+        *deflt = 0;
+
+	val = m_colourMap;
 
     } else 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;
-	
-        deft = m_windowHopLevel;
+        *deflt = 2;
+
+        val = m_windowHopLevel;
     
     } else if (name == "Zero Padding") {
 	
 	*min = 0;
 	*max = 1;
+        *deflt = 0;
 	
-        deft = m_zeroPadLevel > 0 ? 1 : 0;
+        val = m_zeroPadLevel > 0 ? 1 : 0;
     
     } else if (name == "Min Frequency") {
 
 	*min = 0;
 	*max = 9;
+        *deflt = 1;
 
 	switch (m_minFrequency) {
-	case 0: default: deft = 0; break;
-	case 10: deft = 1; break;
-	case 20: deft = 2; break;
-	case 40: deft = 3; break;
-	case 100: deft = 4; break;
-	case 250: deft = 5; break;
-	case 500: deft = 6; break;
-	case 1000: deft = 7; break;
-	case 4000: deft = 8; break;
-	case 10000: deft = 9; break;
+	case 0: default: val = 0; break;
+	case 10: val = 1; break;
+	case 20: val = 2; break;
+	case 40: val = 3; break;
+	case 100: val = 4; break;
+	case 250: val = 5; break;
+	case 500: val = 6; break;
+	case 1000: val = 7; break;
+	case 4000: val = 8; break;
+	case 10000: val = 9; break;
 	}
     
     } else if (name == "Max Frequency") {
 
 	*min = 0;
 	*max = 9;
+        *deflt = 6;
 
 	switch (m_maxFrequency) {
-	case 500: deft = 0; break;
-	case 1000: deft = 1; break;
-	case 1500: deft = 2; break;
-	case 2000: deft = 3; break;
-	case 4000: deft = 4; break;
-	case 6000: deft = 5; break;
-	case 8000: deft = 6; break;
-	case 12000: deft = 7; break;
-	case 16000: deft = 8; break;
-	default: deft = 9; break;
+	case 500: val = 0; break;
+	case 1000: val = 1; break;
+	case 1500: val = 2; break;
+	case 2000: val = 3; break;
+	case 4000: val = 4; break;
+	case 6000: val = 5; break;
+	case 8000: val = 6; break;
+	case 12000: val = 7; break;
+	case 16000: val = 8; break;
+	default: val = 9; break;
 	}
 
     } else if (name == "Frequency Scale") {
 
 	*min = 0;
 	*max = 1;
-	deft = (int)m_frequencyScale;
+        *deflt = int(LinearFrequencyScale);
+	val = (int)m_frequencyScale;
 
     } else if (name == "Bin Display") {
 
 	*min = 0;
 	*max = 2;
-	deft = (int)m_binDisplay;
+        *deflt = int(AllBins);
+	val = (int)m_binDisplay;
 
     } else if (name == "Normalize Columns") {
 	
-	deft = (m_normalizeColumns ? 1 : 0);
+        *deflt = 0;
+	val = (m_normalizeColumns ? 1 : 0);
 
     } else if (name == "Normalize Visible Area") {
 	
-	deft = (m_normalizeVisibleArea ? 1 : 0);
+        *deflt = 0;
+	val = (m_normalizeVisibleArea ? 1 : 0);
 
     } else {
-	deft = Layer::getPropertyRangeAndValue(name, min, max);
+	val = Layer::getPropertyRangeAndValue(name, min, max, deflt);
     }
 
-    return deft;
+    return val;
 }
 
 QString
--- a/layer/SpectrogramLayer.h	Fri Mar 02 13:01:41 2007 +0000
+++ b/layer/SpectrogramLayer.h	Fri Mar 02 14:00:12 2007 +0000
@@ -78,7 +78,7 @@
     virtual PropertyType getPropertyType(const PropertyName &) const;
     virtual QString getPropertyGroupName(const PropertyName &) const;
     virtual int getPropertyRangeAndValue(const PropertyName &,
-					   int *min, int *max) const;
+                                         int *min, int *max, int *deflt) const;
     virtual QString getPropertyValueLabel(const PropertyName &,
 					  int value) const;
     virtual RangeMapper *getNewPropertyRangeMapper(const PropertyName &) const;
--- 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
--- a/layer/SpectrumLayer.h	Fri Mar 02 13:01:41 2007 +0000
+++ b/layer/SpectrumLayer.h	Fri Mar 02 14:00:12 2007 +0000
@@ -45,7 +45,7 @@
     virtual PropertyType getPropertyType(const PropertyName &) const;
     virtual QString getPropertyGroupName(const PropertyName &) const;
     virtual int getPropertyRangeAndValue(const PropertyName &,
-					   int *min, int *max) const;
+                                         int *min, int *max, int *deflt) const;
     virtual QString getPropertyValueLabel(const PropertyName &,
 					  int value) const;
     virtual RangeMapper *getNewPropertyRangeMapper(const PropertyName &) const;
--- a/layer/TextLayer.cpp	Fri Mar 02 13:01:41 2007 +0000
+++ b/layer/TextLayer.cpp	Fri Mar 02 14:00:12 2007 +0000
@@ -82,30 +82,31 @@
 
 int
 TextLayer::getPropertyRangeAndValue(const PropertyName &name,
-				    int *min, int *max) const
+				    int *min, int *max, int *deflt) const
 {
     //!!! factor this colour handling stuff out into a colour manager class
 
-    int deft = 0;
+    int val = 0;
 
     if (name == "Colour") {
 
 	if (min) *min = 0;
 	if (max) *max = 5;
+        if (deflt) *deflt = 0;
 
-	if (m_colour == Qt::black) deft = 0;
-	else if (m_colour == Qt::darkRed) deft = 1;
-	else if (m_colour == Qt::darkBlue) deft = 2;
-	else if (m_colour == Qt::darkGreen) deft = 3;
-	else if (m_colour == QColor(200, 50, 255)) deft = 4;
-	else if (m_colour == QColor(255, 150, 50)) deft = 5;
+	if (m_colour == Qt::black) val = 0;
+	else if (m_colour == Qt::darkRed) val = 1;
+	else if (m_colour == Qt::darkBlue) val = 2;
+	else if (m_colour == Qt::darkGreen) val = 3;
+	else if (m_colour == QColor(200, 50, 255)) val = 4;
+	else if (m_colour == QColor(255, 150, 50)) val = 5;
 
     } else {
 	
-	deft = Layer::getPropertyRangeAndValue(name, min, max);
+	val = Layer::getPropertyRangeAndValue(name, min, max, deflt);
     }
 
-    return deft;
+    return val;
 }
 
 QString
--- a/layer/TextLayer.h	Fri Mar 02 13:01:41 2007 +0000
+++ b/layer/TextLayer.h	Fri Mar 02 14:00:12 2007 +0000
@@ -65,7 +65,7 @@
     virtual QString getPropertyLabel(const PropertyName &) const;
     virtual PropertyType getPropertyType(const PropertyName &) const;
     virtual int getPropertyRangeAndValue(const PropertyName &,
-					   int *min, int *max) const;
+                                         int *min, int *max, int *deflt) const;
     virtual QString getPropertyValueLabel(const PropertyName &,
 					  int value) const;
     virtual void setProperty(const PropertyName &, int value);
--- a/layer/TimeInstantLayer.cpp	Fri Mar 02 13:01:41 2007 +0000
+++ b/layer/TimeInstantLayer.cpp	Fri Mar 02 14:00:12 2007 +0000
@@ -86,35 +86,37 @@
 
 int
 TimeInstantLayer::getPropertyRangeAndValue(const PropertyName &name,
-					 int *min, int *max) const
+                                           int *min, int *max, int *deflt) const
 {
-    int deft = 0;
+    int val = 0;
 
     if (name == "Colour") {
 
 	if (min) *min = 0;
 	if (max) *max = 5;
+        if (deflt) *deflt = 0;
 
-	if (m_colour == Qt::black) deft = 0;
-	else if (m_colour == Qt::darkRed) deft = 1;
-	else if (m_colour == Qt::darkBlue) deft = 2;
-	else if (m_colour == Qt::darkGreen) deft = 3;
-	else if (m_colour == QColor(200, 50, 255)) deft = 4;
-	else if (m_colour == QColor(255, 150, 50)) deft = 5;
+	if (m_colour == Qt::black) val = 0;
+	else if (m_colour == Qt::darkRed) val = 1;
+	else if (m_colour == Qt::darkBlue) val = 2;
+	else if (m_colour == Qt::darkGreen) val = 3;
+	else if (m_colour == QColor(200, 50, 255)) val = 4;
+	else if (m_colour == QColor(255, 150, 50)) val = 5;
 
     } else if (name == "Plot Type") {
 	
 	if (min) *min = 0;
 	if (max) *max = 1;
+        if (deflt) *deflt = 0;
 	
-	deft = int(m_plotStyle);
+	val = int(m_plotStyle);
 
     } else {
 	
-	deft = Layer::getPropertyRangeAndValue(name, min, max);
+	val = Layer::getPropertyRangeAndValue(name, min, max, deflt);
     }
 
-    return deft;
+    return val;
 }
 
 QString
--- a/layer/TimeInstantLayer.h	Fri Mar 02 13:01:41 2007 +0000
+++ b/layer/TimeInstantLayer.h	Fri Mar 02 14:00:12 2007 +0000
@@ -65,7 +65,7 @@
     virtual QString getPropertyLabel(const PropertyName &) const;
     virtual PropertyType getPropertyType(const PropertyName &) const;
     virtual int getPropertyRangeAndValue(const PropertyName &,
-					   int *min, int *max) const;
+                                         int *min, int *max, int *deflt) const;
     virtual QString getPropertyValueLabel(const PropertyName &,
 					  int value) const;
     virtual void setProperty(const PropertyName &, int value);
--- a/layer/TimeRulerLayer.cpp	Fri Mar 02 13:01:41 2007 +0000
+++ b/layer/TimeRulerLayer.cpp	Fri Mar 02 14:00:12 2007 +0000
@@ -74,28 +74,29 @@
 
 int
 TimeRulerLayer::getPropertyRangeAndValue(const PropertyName &name,
-					 int *min, int *max) const
+					 int *min, int *max, int *deflt) const
 {
-    int deft = 0;
+    int val = 0;
 
     if (name == "Colour") {
 
 	if (min) *min = 0;
 	if (max) *max = 5;
+        if (deflt) *deflt = 0;
 
-	if (m_colour == Qt::black) deft = 0;
-	else if (m_colour == Qt::darkRed) deft = 1;
-	else if (m_colour == Qt::darkBlue) deft = 2;
-	else if (m_colour == Qt::darkGreen) deft = 3;
-	else if (m_colour == QColor(200, 50, 255)) deft = 4;
-	else if (m_colour == QColor(255, 150, 50)) deft = 5;
+	if (m_colour == Qt::black) val = 0;
+	else if (m_colour == Qt::darkRed) val = 1;
+	else if (m_colour == Qt::darkBlue) val = 2;
+	else if (m_colour == Qt::darkGreen) val = 3;
+	else if (m_colour == QColor(200, 50, 255)) val = 4;
+	else if (m_colour == QColor(255, 150, 50)) val = 5;
 
     } else {
 	
-	deft = Layer::getPropertyRangeAndValue(name, min, max);
+	val = Layer::getPropertyRangeAndValue(name, min, max, deflt);
     }
 
-    return deft;
+    return val;
 }
 
 QString
--- a/layer/TimeRulerLayer.h	Fri Mar 02 13:01:41 2007 +0000
+++ b/layer/TimeRulerLayer.h	Fri Mar 02 14:00:12 2007 +0000
@@ -48,7 +48,7 @@
     virtual QString getPropertyLabel(const PropertyName &) const;
     virtual PropertyType getPropertyType(const PropertyName &) const;
     virtual int getPropertyRangeAndValue(const PropertyName &,
-					   int *min, int *max) const;
+                                         int *min, int *max, int *deflt) const;
     virtual QString getPropertyValueLabel(const PropertyName &,
 					  int value) const;
     virtual void setProperty(const PropertyName &, int value);
--- a/layer/TimeValueLayer.cpp	Fri Mar 02 13:01:41 2007 +0000
+++ b/layer/TimeValueLayer.cpp	Fri Mar 02 14:00:12 2007 +0000
@@ -109,11 +109,11 @@
 
 int
 TimeValueLayer::getPropertyRangeAndValue(const PropertyName &name,
-					 int *min, int *max) const
+					 int *min, int *max, int *deflt) const
 {
     //!!! factor this colour handling stuff out into a colour manager class
 
-    int deft = 0;
+    int val = 0;
 
     if (name == "Colour") {
 
@@ -121,49 +121,54 @@
             
             if (min) *min = 0;
             if (max) *max = ColourMapper::getColourMapCount() - 1;
+            if (deflt) *deflt = 0;
 
-            deft = m_colourMap;
+            val = m_colourMap;
         
         } else {
 
             if (min) *min = 0;
             if (max) *max = 5;
+            if (deflt) *deflt = 0;
 
-            if (m_colour == Qt::black) deft = 0;
-            else if (m_colour == Qt::darkRed) deft = 1;
-            else if (m_colour == Qt::darkBlue) deft = 2;
-            else if (m_colour == Qt::darkGreen) deft = 3;
-            else if (m_colour == QColor(200, 50, 255)) deft = 4;
-            else if (m_colour == QColor(255, 150, 50)) deft = 5;
+            if (m_colour == Qt::black) val = 0;
+            else if (m_colour == Qt::darkRed) val = 1;
+            else if (m_colour == Qt::darkBlue) val = 2;
+            else if (m_colour == Qt::darkGreen) val = 3;
+            else if (m_colour == QColor(200, 50, 255)) val = 4;
+            else if (m_colour == QColor(255, 150, 50)) val = 5;
         }
 
     } else if (name == "Plot Type") {
 	
 	if (min) *min = 0;
 	if (max) *max = 5;
+        if (deflt) *deflt = int(PlotConnectedPoints);
 	
-	deft = int(m_plotStyle);
+	val = int(m_plotStyle);
 
     } else if (name == "Vertical Scale") {
 	
 	if (min) *min = 0;
 	if (max) *max = 3;
+        if (deflt) *deflt = int(AutoAlignScale);
 	
-	deft = int(m_verticalScale);
+	val = int(m_verticalScale);
 
     } else if (name == "Scale Units") {
 
+        if (deflt) *deflt = 0;
         if (m_model) {
-            deft = UnitDatabase::getInstance()->getUnitId
+            val = UnitDatabase::getInstance()->getUnitId
                 (m_model->getScaleUnits());
         }
 
     } else {
 	
-	deft = Layer::getPropertyRangeAndValue(name, min, max);
+	val = Layer::getPropertyRangeAndValue(name, min, max, deflt);
     }
 
-    return deft;
+    return val;
 }
 
 QString
--- a/layer/TimeValueLayer.h	Fri Mar 02 13:01:41 2007 +0000
+++ b/layer/TimeValueLayer.h	Fri Mar 02 14:00:12 2007 +0000
@@ -69,7 +69,7 @@
     virtual PropertyType getPropertyType(const PropertyName &) const;
     virtual QString getPropertyGroupName(const PropertyName &) const;
     virtual int getPropertyRangeAndValue(const PropertyName &,
-					   int *min, int *max) const;
+                                         int *min, int *max, int *deflt) const;
     virtual QString getPropertyValueLabel(const PropertyName &,
 					  int value) const;
     virtual void setProperty(const PropertyName &, int value);
--- a/layer/WaveformLayer.cpp	Fri Mar 02 13:01:41 2007 +0000
+++ b/layer/WaveformLayer.cpp	Fri Mar 02 14:00:12 2007 +0000
@@ -137,60 +137,66 @@
 
 int
 WaveformLayer::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 == "Gain") {
 
 	*min = -50;
 	*max = 50;
+        *deflt = 0;
 
-	deft = lrint(log10(m_gain) * 20.0);
-	if (deft < *min) deft = *min;
-	if (deft > *max) deft = *max;
+	val = lrint(log10(m_gain) * 20.0);
+	if (val < *min) val = *min;
+	if (val > *max) val = *max;
 
     } else if (name == "Normalize Visible Area") {
 
-        deft = (m_autoNormalize ? 1 : 0);
+        val = (m_autoNormalize ? 1 : 0);
+        *deflt = 0;
 
     } else if (name == "Colour") {
 
 	*min = 0;
 	*max = 5;
+        *deflt = 0;
 
-	if (m_colour == Qt::black) deft = 0;
-	else if (m_colour == Qt::darkRed) deft = 1;
+	if (m_colour == Qt::black) val = 0;
+	else if (m_colour == Qt::darkRed) val = 1;
 	else if (m_colour == Qt::darkBlue ||
-                 m_colour == QColor(84, 177, 248)) deft = 2;
-	else if (m_colour == Qt::darkGreen) deft = 3;
-	else if (m_colour == QColor(200, 50, 255)) deft = 4;
-	else if (m_colour == QColor(255, 150, 50)) deft = 5;
+                 m_colour == QColor(84, 177, 248)) val = 2;
+	else if (m_colour == Qt::darkGreen) val = 3;
+	else if (m_colour == QColor(200, 50, 255)) val = 4;
+	else if (m_colour == QColor(255, 150, 50)) val = 5;
 
     } else if (name == "Channels") {
 
         *min = 0;
         *max = 2;
-        if (m_channelMode == MixChannels) deft = 1;
-        else if (m_channelMode == MergeChannels) deft = 2;
-        else deft = 0;
+        *deflt = 0;
+        if (m_channelMode == MixChannels) val = 1;
+        else if (m_channelMode == MergeChannels) val = 2;
+        else val = 0;
 
     } else if (name == "Scale") {
 
 	*min = 0;
 	*max = 2;
+        *deflt = 0;
 
-	deft = (int)m_scale;
+	val = (int)m_scale;
 
     } else {
-	deft = Layer::getPropertyRangeAndValue(name, min, max);
+	val = Layer::getPropertyRangeAndValue(name, min, max, deflt);
     }
 
-    return deft;
+    return val;
 }
 
 QString
--- a/layer/WaveformLayer.h	Fri Mar 02 13:01:41 2007 +0000
+++ b/layer/WaveformLayer.h	Fri Mar 02 14:00:12 2007 +0000
@@ -53,7 +53,7 @@
     virtual PropertyType getPropertyType(const PropertyName &) const;
     virtual QString getPropertyGroupName(const PropertyName &) const;
     virtual int getPropertyRangeAndValue(const PropertyName &,
-					   int *min, int *max) const;
+                                         int *min, int *max, int *deflt) const;
     virtual QString getPropertyValueLabel(const PropertyName &,
 					  int value) const;
     virtual RangeMapper *getNewPropertyRangeMapper(const PropertyName &) const;
--- a/view/View.cpp	Fri Mar 02 13:01:41 2007 +0000
+++ b/view/View.cpp	Fri Mar 02 14:00:12 2007 +0000
@@ -96,17 +96,20 @@
 
 int
 View::getPropertyRangeAndValue(const PropertyContainer::PropertyName &name,
-			       int *min, int *max) const
+			       int *min, int *max, int *deflt) const
 {
+    if (deflt) *deflt = 1;
     if (name == "Global Scroll") return m_followPan;
     if (name == "Global Zoom") return m_followZoom;
     if (name == "Follow Playback") {
 	if (min) *min = 0;
 	if (max) *max = 2;
+        if (deflt) *deflt = int(PlaybackScrollPage);
 	return int(m_followPlay);
     }
     if (min) *min = 0;
     if (max) *max = 0;
+    if (deflt) *deflt = 0;
     return 0;
 }
 
--- a/view/View.h	Fri Mar 02 13:01:41 2007 +0000
+++ b/view/View.h	Fri Mar 02 14:00:12 2007 +0000
@@ -202,7 +202,7 @@
     virtual QString getPropertyLabel(const PropertyName &) const;
     virtual PropertyContainer::PropertyType getPropertyType(const PropertyName &) const;
     virtual int getPropertyRangeAndValue(const PropertyName &,
-					 int *min, int *max) const;
+					 int *min, int *max, int *deflt) const;
     virtual QString getPropertyValueLabel(const PropertyName &,
 					  int value) const;
     virtual void setProperty(const PropertyName &, int value);
@@ -346,8 +346,9 @@
     PropertyType getPropertyType(const PropertyName &n) const {
 	return m_v->getPropertyType(n);
     }
-    int getPropertyRangeAndValue(const PropertyName &n, int *min, int *max) const {
-	return m_v->getPropertyRangeAndValue(n, min, max);
+    int getPropertyRangeAndValue(const PropertyName &n, int *min, int *max,
+                                 int *deflt) const {
+	return m_v->getPropertyRangeAndValue(n, min, max, deflt);
     }
     QString getPropertyValueLabel(const PropertyName &n, int value) const {
 	return m_v->getPropertyValueLabel(n, value);
--- a/widgets/PropertyBox.cpp	Fri Mar 02 13:01:41 2007 +0000
+++ b/widgets/PropertyBox.cpp	Fri Mar 02 14:00:12 2007 +0000
@@ -254,8 +254,8 @@
     PropertyContainer::PropertyType type = m_container->getPropertyType(name);
     int row = m_layout->rowCount();
 
-    int min = 0, max = 0, value = 0;
-    value = m_container->getPropertyRangeAndValue(name, &min, &max);
+    int min = 0, max = 0, value = 0, deflt = 0;
+    value = m_container->getPropertyRangeAndValue(name, &min, &max, &deflt);
 
     bool have = (m_propertyControllers.find(name) !=
 		 m_propertyControllers.end());
@@ -358,7 +358,7 @@
 	    dial->setMaximum(max);
 	    dial->setPageStep(1);
 	    dial->setNotchesVisible((max - min) <= 12);
-	    dial->setDefaultValue(value);
+	    dial->setDefaultValue(deflt);
             dial->setRangeMapper(m_container->getNewPropertyRangeMapper(name));
             dial->setShowToolTip(true);
 	    connect(dial, SIGNAL(valueChanged(int)),
--- a/widgets/WindowTypeSelector.cpp	Fri Mar 02 13:01:41 2007 +0000
+++ b/widgets/WindowTypeSelector.cpp	Fri Mar 02 14:00:12 2007 +0000
@@ -48,10 +48,11 @@
     m_windowShape = new WindowShapePreview;
 
     m_windowCombo = new QComboBox;
-    int min = 0, max = 0, i = 0;
+    int min = 0, max = 0, deflt = 0, i = 0;
     int window = int(defaultType);
     if (window == 999) {
-        window = prefs->getPropertyRangeAndValue("Window Type", &min, &max);
+        window = prefs->getPropertyRangeAndValue("Window Type", &min, &max,
+                                                 &deflt);
     }
     int index = 0;