Mercurial > hg > svgui
diff layer/SliceLayer.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/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