changeset 691:5674950ed82a

Add piano to time-value layer too
author Chris Cannam
date Tue, 03 Dec 2013 17:48:46 +0000
parents 8072264dc61f
children 4dcf10bd2863
files layer/TimeValueLayer.cpp
diffstat 1 files changed, 16 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/layer/TimeValueLayer.cpp	Tue Dec 03 17:32:25 2013 +0000
+++ b/layer/TimeValueLayer.cpp	Tue Dec 03 17:48:46 2013 +0000
@@ -30,6 +30,7 @@
 #include "widgets/ListInputDialog.h"
 
 #include "ColourMapper.h"
+#include "PianoScale.h"
 
 #include <QPainter>
 #include <QPainterPath>
@@ -1179,9 +1180,11 @@
         ++pointCount;
     }
 
-    if ((m_plotStyle == PlotCurve || m_plotStyle == PlotDiscreteCurves ||
-         m_plotStyle == PlotLines)
-        && !path.isEmpty()) {
+    if (m_plotStyle == PlotDiscreteCurves) {
+        paint.setRenderHint(QPainter::Antialiasing, true);
+	paint.drawPath(path);
+    } else if ((m_plotStyle == PlotCurve || m_plotStyle == PlotLines)
+               && !path.isEmpty()) {
 	paint.setRenderHint(QPainter::Antialiasing, pointCount <= v->width());
 	paint.drawPath(path);
     }
@@ -1336,6 +1339,16 @@
         paint.drawText(5, 5 + paint.fontMetrics().ascent(),
                        m_model->getScaleUnits());
     }
+
+    if (logarithmic &&
+        (m_model->getScaleUnits() == "Hz") &&
+        (m_plotStyle != PlotSegmentation)) {
+        float fmin, fmax;
+        getDisplayExtents(fmin, fmax);
+        PianoScale().paintPianoVertical
+            (v, paint, QRect(w, 0, 10, h), fmin, fmax);
+        paint.drawLine(w + 10, 0, w + 10, h);
+    }
 }
 
 void