diff layer/TimeValueLayer.cpp @ 296:ea37c229a578

* Fix #1757772 tempo, dynamic related plug-ins bug -- make auto-align only auto-align if there is a unit involved * Fix #1755366 text layer bug in retrieved session * Fix input model selection in plugin parameter dialog (was being ignored) * Use lighter background than the standard widget one for panes (assuming the widget background is light but not white) -- similarly darker if dark * Fix colour reference counting in loaded session in SingleColourLayer * Reset overview pane colour when switching dark background on or off
author Chris Cannam
date Tue, 14 Aug 2007 13:58:53 +0000
parents e27f546f83ad
children f4458c8bffa6
line wrap: on
line diff
--- a/layer/TimeValueLayer.cpp	Mon Aug 13 14:53:28 2007 +0000
+++ b/layer/TimeValueLayer.cpp	Tue Aug 14 13:58:53 2007 +0000
@@ -259,7 +259,7 @@
 bool
 TimeValueLayer::getDisplayExtents(float &min, float &max) const
 {
-    if (!m_model || m_verticalScale == AutoAlignScale) return false;
+    if (!m_model || shouldAutoAlign()) return false;
 
     min = m_model->getValueMinimum();
     max = m_model->getValueMaximum();
@@ -431,7 +431,7 @@
     max = 0.0;
     log = false;
 
-    if (m_verticalScale == AutoAlignScale) {
+    if (shouldAutoAlign()) {
 
         if (!v->getValueExtents(m_model->getScaleUnits(), min, max, log)) {
             min = m_model->getValueMinimum();
@@ -496,6 +496,14 @@
     return val;
 }
 
+bool
+TimeValueLayer::shouldAutoAlign() const
+{
+    if (!m_model) return false;
+    QString unit = m_model->getScaleUnits();
+    return (m_verticalScale == AutoAlignScale && unit != "");
+}
+
 QColor
 TimeValueLayer::getColourForValue(View *v, float val) const
 {
@@ -566,7 +574,7 @@
     if (v->shouldIlluminateLocalFeatures(this, localPos)) {
 	SparseTimeValueModel::PointList localPoints =
 	    getLocalPoints(v, localPos.x());
-        std::cerr << "TimeValueLayer: " << localPoints.size() << " local points" << std::endl;
+//        std::cerr << "TimeValueLayer: " << localPoints.size() << " local points" << std::endl;
 	if (!localPoints.empty()) illuminateFrame = localPoints.begin()->frame;
     }