comparison layer/SpectrogramLayer.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 7e9e533f1863
children e954c00cbe55
comparison
equal deleted inserted replaced
266:aee39d8c0b83 267:4ed1446ad604
2379 paint.drawRect(x0, y1, x1 - x0 + 1, y0 - y1 + 1); 2379 paint.drawRect(x0, y1, x1 - x0 + 1, y0 - y1 + 1);
2380 } 2380 }
2381 } 2381 }
2382 2382
2383 float 2383 float
2384 SpectrogramLayer::getYForFrequency(View *v, float frequency) const 2384 SpectrogramLayer::getYForFrequency(const View *v, float frequency) const
2385 { 2385 {
2386 return v->getYForFrequency(frequency, 2386 return v->getYForFrequency(frequency,
2387 getEffectiveMinFrequency(), 2387 getEffectiveMinFrequency(),
2388 getEffectiveMaxFrequency(), 2388 getEffectiveMaxFrequency(),
2389 m_frequencyScale == LogFrequencyScale); 2389 m_frequencyScale == LogFrequencyScale);
2390 } 2390 }
2391 2391
2392 float 2392 float
2393 SpectrogramLayer::getFrequencyForY(View *v, int y) const 2393 SpectrogramLayer::getFrequencyForY(const View *v, int y) const
2394 { 2394 {
2395 return v->getFrequencyForY(y, 2395 return v->getFrequencyForY(y,
2396 getEffectiveMinFrequency(), 2396 getEffectiveMinFrequency(),
2397 getEffectiveMaxFrequency(), 2397 getEffectiveMaxFrequency(),
2398 m_frequencyScale == LogFrequencyScale); 2398 m_frequencyScale == LogFrequencyScale);
2467 2467
2468 return true; 2468 return true;
2469 } 2469 }
2470 2470
2471 bool 2471 bool
2472 SpectrogramLayer::getYScaleValue(View *v, int y, 2472 SpectrogramLayer::getYScaleValue(const View *v, int y,
2473 float &value, QString &unit) const 2473 float &value, QString &unit) const
2474 { 2474 {
2475 value = getFrequencyForY(v, y); 2475 value = getFrequencyForY(v, y);
2476 unit = "Hz"; 2476 unit = "Hz";
2477 return true; 2477 return true;