diff layer/Layer.cpp @ 274:b9380f679f70

* Fix centre line position * Fix failure to update overview when generating peaks from wav file * Provide y-coordinate scale values and differences for spectrum measurement mode, and fix values for waveform (inc dB for both) * Add Printer colour scheme (may be futile)
author Chris Cannam
date Mon, 02 Jul 2007 13:04:17 +0000
parents e954c00cbe55
children 3c402c6052f6
line wrap: on
line diff
--- a/layer/Layer.cpp	Fri Jun 29 16:50:59 2007 +0000
+++ b/layer/Layer.cpp	Mon Jul 02 13:04:17 2007 +0000
@@ -123,6 +123,20 @@
 }
 
 bool
+Layer::getYScaleDifference(const View *v, int y0, int y1,
+                           float &diff, QString &unit) const
+{
+    float v0, v1;
+    if (!getYScaleValue(v, y0, v0, unit) ||
+        !getYScaleValue(v, y1, v1, unit)) {
+        diff = 0.f;
+        return false;
+    }
+    diff = fabsf(v1 - v0);
+    return true;
+}
+
+bool
 Layer::MeasureRect::operator<(const MeasureRect &mr) const
 {
     if (haveFrames) {
@@ -236,8 +250,7 @@
     m_draggingRect.pixrect = QRect(m_draggingRect.pixrect.x(),
                                    m_draggingRect.pixrect.y(),
                                    e->x() - m_draggingRect.pixrect.x(),
-                                   e->y() - m_draggingRect.pixrect.y())
-        .normalized();
+                                   e->y() - m_draggingRect.pixrect.y());
 
     setMeasureRectYCoord(v, m_draggingRect, false, e->y());
     
@@ -328,8 +341,6 @@
         i->pixrect = QRect(x0, i->pixrect.y(), x1 - x0, i->pixrect.height());
 
         updateMeasureRectYCoords(v, *i);
-        
-        i->pixrect = i->pixrect.normalized();
     }
 }
 
@@ -396,11 +407,10 @@
         }
         
         QRect pr = QRect(x0, r.pixrect.y(), x1 - x0, r.pixrect.height());
-        
         r.pixrect = pr;
     }
-    
-    v->drawMeasurementRect(paint, this, r.pixrect, focus);
+
+    v->drawMeasurementRect(paint, this, r.pixrect.normalized(), focus);
 }
 
 QString