diff layer/SpectrumLayer.cpp @ 267:4ed1446ad604

* more on measurement tool -- pull out some logic from pane to layer &c still more to do
author Chris Cannam
date Thu, 21 Jun 2007 16:12:00 +0000
parents a3a54632cd4c
children b9380f679f70
line wrap: on
line diff
--- a/layer/SpectrumLayer.cpp	Thu Jun 21 14:05:23 2007 +0000
+++ b/layer/SpectrumLayer.cpp	Thu Jun 21 16:12:00 2007 +0000
@@ -332,10 +332,12 @@
 }
 
 bool
-SpectrumLayer::getXScaleValue(View *v, int x, 
+SpectrumLayer::getXScaleValue(const View *v, int x, 
                               float &value, QString &unit) const
 {
-    value = getFrequencyForX(x - m_xorigins[v], v->width() - m_xorigins[v] - 1);
+    if (m_xorigins.find(v) == m_xorigins.end()) return false;
+    int xorigin = m_xorigins.find(v)->second;
+    value = getFrequencyForX(x - xorigin, v->width() - xorigin - 1);
     unit = "Hz";
     return true;
 }