diff layer/NoteLayer.cpp @ 667:2727bc3aab59

Avoid reloading the default 0->0 scale extents for a note layer as 0->1
author Chris Cannam
date Tue, 16 Jul 2013 17:51:37 +0100
parents ab9fefdaa103
children 47735c9518e7 1a0dfcbffaf1
line wrap: on
line diff
--- a/layer/NoteLayer.cpp	Tue Jul 16 13:43:01 2013 +0100
+++ b/layer/NoteLayer.cpp	Tue Jul 16 17:51:37 2013 +0100
@@ -236,6 +236,10 @@
         max = Pitch::getFrequencyForPitch(lrintf(max + 1));
     }
 
+#ifdef DEBUG_NOTE_LAYER
+    std::cerr << "NoteLayer::getDisplayExtents: min = " << min << ", max = " << max << " (m_scaleMinimum = " << m_scaleMinimum << ", m_scaleMaximum = " << m_scaleMaximum << ")" << std::endl;
+#endif
+
     return true;
 }
 
@@ -255,7 +259,9 @@
     m_scaleMinimum = min;
     m_scaleMaximum = max;
 
-//    SVDEBUG << "NoteLayer::setDisplayExtents: min = " << min << ", max = " << max << endl;
+#ifdef DEBUG_NOTE_LAYER
+    std::cerr << "NoteLayer::setDisplayExtents: min = " << min << ", max = " << max << std::endl;
+#endif
     
     emit layerParametersChanged();
     return true;
@@ -336,7 +342,9 @@
         newmax = max;
     }
     
-    SVDEBUG << "NoteLayer::setVerticalZoomStep: " << step << ": " << newmin << " -> " << newmax << " (range " << newdist << ")" << endl;
+#ifdef DEBUG_NOTE_LAYER
+    std::cerr << "NoteLayer::setVerticalZoomStep: " << step << ": " << newmin << " -> " << newmax << " (range " << newdist << ")" << std::endl;
+#endif
 
     setDisplayExtents(newmin, newmax);
 }
@@ -1278,7 +1286,7 @@
 
     float min = attributes.value("scaleMinimum").toFloat(&ok);
     float max = attributes.value("scaleMaximum").toFloat(&alsoOk);
-    if (ok && alsoOk) setDisplayExtents(min, max);
+    if (ok && alsoOk && min != max) setDisplayExtents(min, max);
 }