comparison base/Preferences.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 d7eeffbb8aaf
comparison
equal deleted inserted replaced
244:85bf384db35f 245:4cd620bd4c61
111 return InvalidProperty; 111 return InvalidProperty;
112 } 112 }
113 113
114 int 114 int
115 Preferences::getPropertyRangeAndValue(const PropertyName &name, 115 Preferences::getPropertyRangeAndValue(const PropertyName &name,
116 int *min, int *max) const 116 int *min, int *max, int *deflt) const
117 { 117 {
118 if (name == "Smooth Spectrogram") { 118 if (name == "Smooth Spectrogram") {
119 if (min) *min = 0; 119 if (min) *min = 0;
120 if (max) *max = 1; 120 if (max) *max = 1;
121 if (deflt) *deflt = 1;
121 return m_smoothSpectrogram ? 1 : 0; 122 return m_smoothSpectrogram ? 1 : 0;
122 } 123 }
123 124
124 //!!! freq mapping 125 //!!! freq mapping
125 126
126 if (name == "Property Box Layout") { 127 if (name == "Property Box Layout") {
127 if (min) *min = 0; 128 if (min) *min = 0;
128 if (max) *max = 1; 129 if (max) *max = 1;
130 if (deflt) *deflt = 0;
129 return m_propertyBoxLayout == Layered ? 1 : 0; 131 return m_propertyBoxLayout == Layered ? 1 : 0;
130 } 132 }
131 133
132 if (name == "Window Type") { 134 if (name == "Window Type") {
133 if (min) *min = int(RectangularWindow); 135 if (min) *min = int(RectangularWindow);
134 if (max) *max = int(BlackmanHarrisWindow); 136 if (max) *max = int(BlackmanHarrisWindow);
137 if (deflt) *deflt = int(HanningWindow);
135 return int(m_windowType); 138 return int(m_windowType);
136 } 139 }
137 140
138 if (name == "Resample Quality") { 141 if (name == "Resample Quality") {
139 if (min) *min = 0; 142 if (min) *min = 0;
140 if (max) *max = 2; 143 if (max) *max = 2;
144 if (deflt) *deflt = 1;
141 return m_resampleQuality; 145 return m_resampleQuality;
142 } 146 }
143 147
144 return 0; 148 return 0;
145 } 149 }