comparison layer/Colour3DPlotLayer.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 6969f21da18a
children 9465b5375235
comparison
equal deleted inserted replaced
215:d2334a77db73 216:34bbbcb3c01f
121 return QString(); 121 return QString();
122 } 122 }
123 123
124 int 124 int
125 Colour3DPlotLayer::getPropertyRangeAndValue(const PropertyName &name, 125 Colour3DPlotLayer::getPropertyRangeAndValue(const PropertyName &name,
126 int *min, int *max) const 126 int *min, int *max, int *deflt) const
127 { 127 {
128 int deft = 0; 128 int val = 0;
129 129
130 int garbage0, garbage1; 130 int garbage0, garbage1, garbage2;
131 if (!min) min = &garbage0; 131 if (!min) min = &garbage0;
132 if (!max) max = &garbage1; 132 if (!max) max = &garbage1;
133 if (!deflt) deflt = &garbage2;
133 134
134 if (name == "Colour Scale") { 135 if (name == "Colour Scale") {
135 136
136 *min = 0; 137 *min = 0;
137 *max = 2; 138 *max = 2;
138 139 *deflt = (int)LinearScale;
139 deft = (int)m_colourScale; 140
141 val = (int)m_colourScale;
140 142
141 } else if (name == "Colour") { 143 } else if (name == "Colour") {
142 144
143 *min = 0; 145 *min = 0;
144 *max = ColourMapper::getColourMapCount() - 1; 146 *max = ColourMapper::getColourMapCount() - 1;
145 147 *deflt = 0;
146 deft = m_colourMap; 148
149 val = m_colourMap;
147 150
148 } else if (name == "Normalize Columns") { 151 } else if (name == "Normalize Columns") {
149 152
150 deft = (m_normalizeColumns ? 1 : 0); 153 *deflt = 0;
154 val = (m_normalizeColumns ? 1 : 0);
151 155
152 } else if (name == "Normalize Visible Area") { 156 } else if (name == "Normalize Visible Area") {
153 157
154 deft = (m_normalizeVisibleArea ? 1 : 0); 158 *deflt = 0;
159 val = (m_normalizeVisibleArea ? 1 : 0);
155 160
156 } else { 161 } else {
157 deft = Layer::getPropertyRangeAndValue(name, min, max); 162 val = Layer::getPropertyRangeAndValue(name, min, max, deflt);
158 } 163 }
159 164
160 return deft; 165 return val;
161 } 166 }
162 167
163 QString 168 QString
164 Colour3DPlotLayer::getPropertyValueLabel(const PropertyName &name, 169 Colour3DPlotLayer::getPropertyValueLabel(const PropertyName &name,
165 int value) const 170 int value) const