changeset 1317:c2fa7bb1eca9 import-audio-data

Merge from default branch
author Chris Cannam
date Tue, 04 Sep 2018 13:19:32 +0100
parents fcc1f45f7bd5 (current diff) c0d8356e274f (diff)
children b149b53df365
files
diffstat 7 files changed, 51 insertions(+), 17 deletions(-) [+]
line wrap: on
line diff
--- a/layer/Layer.cpp	Thu Jun 28 14:49:00 2018 +0100
+++ b/layer/Layer.cpp	Tue Sep 04 13:19:32 2018 +0100
@@ -588,6 +588,31 @@
     v->drawMeasurementRect(paint, this, r.pixrect.normalized(), focus);
 }
 
+bool
+Layer::valueExtentsMatchMine(LayerGeometryProvider *v) const
+{
+    double min, min_;
+    double max, max_;
+    bool logarithmic, logarithmic_;
+    QString unit;
+
+    if (!getValueExtents(min_, max_, logarithmic_, unit)) {
+        return false;
+    }
+
+    if (!v->getValueExtents(unit, min, max, logarithmic)) {
+        return false;
+    }
+
+    if (min != min_ ||
+        max != max_ ||
+        logarithmic != logarithmic_) {
+        return false;
+    }
+
+    return true;
+}
+
 void
 Layer::toXml(QTextStream &stream,
              QString indent, QString extraAttributes) const
--- a/layer/Layer.h	Thu Jun 28 14:49:00 2018 +0100
+++ b/layer/Layer.h	Tue Sep 04 13:19:32 2018 +0100
@@ -626,6 +626,8 @@
     void paintMeasurementRect(LayerGeometryProvider *v, QPainter &paint,
                               const MeasureRect &r, bool focus) const;
 
+    bool valueExtentsMatchMine(LayerGeometryProvider *v) const;
+    
     QString m_presentationName;
 
 private:
--- a/layer/NoteLayer.cpp	Thu Jun 28 14:49:00 2018 +0100
+++ b/layer/NoteLayer.cpp	Tue Sep 04 13:19:32 2018 +0100
@@ -61,7 +61,7 @@
     m_scaleMinimum(0),
     m_scaleMaximum(0)
 {
-          SVDEBUG << "constructed NoteLayer" << endl;
+    SVDEBUG << "constructed NoteLayer" << endl;
 }
 
 void
@@ -833,14 +833,18 @@
 int
 NoteLayer::getVerticalScaleWidth(LayerGeometryProvider *v, bool, QPainter &paint) const
 {
-    if (!m_model || shouldAutoAlign()) {
+    if (!m_model) {
         return 0;
-    } else  {
-        if (m_verticalScale == LogScale || m_verticalScale == MIDIRangeScale) {
-            return LogNumericalScale().getWidth(v, paint) + 10; // for piano
-        } else {
-            return LinearNumericalScale().getWidth(v, paint);
-        }
+    }
+
+    if (shouldAutoAlign() && !valueExtentsMatchMine(v)) {
+        return 0;
+    }
+
+    if (m_verticalScale == LogScale || m_verticalScale == MIDIRangeScale) {
+        return LogNumericalScale().getWidth(v, paint) + 10; // for piano
+    } else {
+        return LinearNumericalScale().getWidth(v, paint);
     }
 }
 
--- a/layer/SingleColourLayer.h	Thu Jun 28 14:49:00 2018 +0100
+++ b/layer/SingleColourLayer.h	Tue Sep 04 13:19:32 2018 +0100
@@ -13,8 +13,8 @@
     COPYING included with this distribution for more information.
 */
 
-#ifndef _SINGLE_COLOUR_LAYER_H_
-#define _SINGLE_COLOUR_LAYER_H_
+#ifndef SV_SINGLE_COLOUR_LAYER_H
+#define SV_SINGLE_COLOUR_LAYER_H
 
 #include "Layer.h"
 #include <QColor>
--- a/layer/TimeValueLayer.cpp	Thu Jun 28 14:49:00 2018 +0100
+++ b/layer/TimeValueLayer.cpp	Tue Sep 04 13:19:32 2018 +0100
@@ -1238,7 +1238,9 @@
 int
 TimeValueLayer::getVerticalScaleWidth(LayerGeometryProvider *v, bool, QPainter &paint) const
 {
-    if (!m_model || shouldAutoAlign()) {
+    if (!m_model) {
+        return 0;
+    } else if (shouldAutoAlign() && !valueExtentsMatchMine(v)) {
         return 0;
     } else if (m_plotStyle == PlotSegmentation) {
         if (m_verticalScale == LogScale) {
--- a/view/Pane.cpp	Thu Jun 28 14:49:00 2018 +0100
+++ b/view/Pane.cpp	Tue Sep 04 13:19:32 2018 +0100
@@ -594,8 +594,6 @@
 
     int sw = topLayer->getVerticalScaleWidth
         (this, m_manager->shouldShowVerticalColourScale(), paint);
-
-//    cerr << "sw = " << sw << endl;
     
     if (sw > 0) {
         scaleLayer = topLayer;
@@ -672,10 +670,13 @@
 //      SVDEBUG << "Pane::paintEvent: calling paint.save() in vertical scale block" << endl;
         paint.save();
             
+        paint.setPen(Qt::NoPen);
+        paint.setBrush(getBackground());
+        paint.drawRect(0, 0, m_scaleWidth, height());
+        
         paint.setPen(getForeground());
-        paint.setBrush(getBackground());
-        paint.drawRect(0, -1, m_scaleWidth, height()+1);
-        
+        paint.drawLine(m_scaleWidth, 0, m_scaleWidth, height());
+
         paint.setBrush(Qt::NoBrush);
         scaleLayer->paintVerticalScale
             (this, m_manager->shouldShowVerticalColourScale(),
--- a/view/View.cpp	Thu Jun 28 14:49:00 2018 +0100
+++ b/view/View.cpp	Tue Sep 04 13:19:32 2018 +0100
@@ -511,7 +511,7 @@
         }
     }
 
-    if (int(maxSignificance) >= int(Layer::ColourAndBackgroundSignificant)) {
+    if (int(maxSignificance) >= int(Layer::ColourDistinguishes)) {
         return !mostSignificantHasDarkBackground;
     } else {
         return !darkPalette;