Mercurial > hg > svgui
diff layer/TimeValueLayer.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 | 28c8e8e3c537 |
line wrap: on
line diff
--- 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