comparison 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
comparison
equal deleted inserted replaced
266:aee39d8c0b83 267:4ed1446ad604
330 330
331 return x; 331 return x;
332 } 332 }
333 333
334 bool 334 bool
335 SpectrumLayer::getXScaleValue(View *v, int x, 335 SpectrumLayer::getXScaleValue(const View *v, int x,
336 float &value, QString &unit) const 336 float &value, QString &unit) const
337 { 337 {
338 value = getFrequencyForX(x - m_xorigins[v], v->width() - m_xorigins[v] - 1); 338 if (m_xorigins.find(v) == m_xorigins.end()) return false;
339 int xorigin = m_xorigins.find(v)->second;
340 value = getFrequencyForX(x - xorigin, v->width() - xorigin - 1);
339 unit = "Hz"; 341 unit = "Hz";
340 return true; 342 return true;
341 } 343 }
342 344
343 bool 345 bool