# HG changeset patch # User Chris Cannam # Date 1178305273 0 # Node ID 3fe622570b3581341928b6ddac8244c87f2ae9bc # Parent e6d0b097d1022d03217379c8ed0a58220a6c037f * Fix #1712589 Reset button for thumbwheels not working properly diff -r e6d0b097d102 -r 3fe622570b35 layer/SpectrogramLayer.cpp --- a/layer/SpectrogramLayer.cpp Mon Apr 30 14:06:45 2007 +0000 +++ b/layer/SpectrogramLayer.cpp Fri May 04 19:01:13 2007 +0000 @@ -2928,10 +2928,13 @@ // int maxStep = mapper.getPositionForValue((float(sr) / m_fftSize) + 0.001); int maxStep = mapper.getPositionForValue(0); int minStep = mapper.getPositionForValue(float(sr) / 2); - - defaultStep = mapper.getPositionForValue(m_initialMaxFrequency) - minStep; - -// std::cerr << "SpectrogramLayer::getVerticalZoomSteps: " << maxStep - minStep << " (" << maxStep <<"-" << minStep << "), default is " << defaultStep << " (from initial max freq " << m_initialMaxFrequency << ")" << std::endl; + + size_t initialMax = m_initialMaxFrequency; + if (initialMax == 0) initialMax = sr / 2; + + defaultStep = mapper.getPositionForValue(initialMax) - minStep; + +// std::cerr << "SpectrogramLayer::getVerticalZoomSteps: " << maxStep - minStep << " (" << maxStep <<"-" << minStep << "), default is " << defaultStep << " (from initial max freq " << initialMax << ")" << std::endl; return maxStep - minStep; }