diff layer/SpectrogramLayer.cpp @ 264:7e9e533f1863

* few more measurement mode bits
author Chris Cannam
date Fri, 15 Jun 2007 12:55:16 +0000
parents 11021509c4eb
children 4ed1446ad604
line wrap: on
line diff
--- a/layer/SpectrogramLayer.cpp	Thu Jun 14 20:57:01 2007 +0000
+++ b/layer/SpectrogramLayer.cpp	Fri Jun 15 12:55:16 2007 +0000
@@ -2500,7 +2500,7 @@
 } 
 
 bool
-SpectrogramLayer::getCrosshairExtents(View *v, QPainter &,
+SpectrogramLayer::getCrosshairExtents(View *v, QPainter &paint,
                                       QPoint cursorPos,
                                       std::vector<QRect> &extents) const
 {
@@ -2510,6 +2510,13 @@
     QRect horizontal(0, cursorPos.y(), cursorPos.x(), 1);
     extents.push_back(horizontal);
 
+    int sw = getVerticalScaleWidth(v, paint);
+
+    QRect label(sw, cursorPos.y() - paint.fontMetrics().ascent() - 2,
+                paint.fontMetrics().width("123456 Hz") + sw + 2,
+                paint.fontMetrics().height());
+    extents.push_back(label);
+
     return true;
 }
 
@@ -2525,6 +2532,9 @@
     
     float fundamental = getFrequencyForY(v, cursorPos.y());
 
+    int sw = getVerticalScaleWidth(v, paint);
+    paint.drawText(sw + 2, cursorPos.y() - 2, QString("%1 Hz").arg(fundamental));
+
     int harmonic = 2;
 
     while (harmonic < 100) {