changeset 697:26b1ffe412f9

Ensure new piano scales only appear when not auto-aligning
author Chris Cannam
date Wed, 04 Dec 2013 12:17:44 +0000
parents 81c4c44ecc10
children ad7623c39396
files layer/NoteLayer.cpp layer/TimeValueLayer.cpp
diffstat 2 files changed, 17 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/layer/NoteLayer.cpp	Tue Dec 03 17:56:38 2013 +0000
+++ b/layer/NoteLayer.cpp	Wed Dec 04 12:17:44 2013 +0000
@@ -817,17 +817,27 @@
 int
 NoteLayer::getVerticalScaleWidth(View *, bool, QPainter &paint) const
 {
-    return 10;
+    if (!m_model || shouldAutoAlign()) {
+        return 0;
+    } else if (m_verticalScale == LogScale || 
+               m_verticalScale == MIDIRangeScale) {
+        return 10;
+    } else {
+        return 0;
+    }
 }
 
 void
 NoteLayer::paintVerticalScale(View *v, bool, QPainter &paint, QRect) const
 {
-    float fmin, fmax;
-    getDisplayExtents(fmin, fmax);
-    PianoScale().paintPianoVertical
-        (v, paint, QRect(0, 0, 10, v->height()), fmin, fmax);
-    paint.drawLine(10, 0, 10, v->height());
+    if (m_verticalScale == LogScale ||
+        m_verticalScale == MIDIRangeScale) {
+        float fmin, fmax;
+        getDisplayExtents(fmin, fmax);
+        PianoScale().paintPianoVertical
+            (v, paint, QRect(0, 0, 10, v->height()), fmin, fmax);
+        paint.drawLine(10, 0, 10, v->height());
+    }
 }
 
 void
--- a/layer/TimeValueLayer.cpp	Tue Dec 03 17:56:38 2013 +0000
+++ b/layer/TimeValueLayer.cpp	Wed Dec 04 12:17:44 2013 +0000
@@ -1198,6 +1198,7 @@
 int
 TimeValueLayer::getVerticalScaleWidth(View *, bool, QPainter &paint) const
 {
+    if (!m_model || shouldAutoAlign()) return 0;
     int w = paint.fontMetrics().width("-000.000");
     if (m_plotStyle == PlotSegmentation) return w + 20;
     else return w + 10;