diff view/Overview.cpp @ 253:1b1e6947c124

* FFT: fix invalid write of normalisation factor in compact mode of disc cache * FFT: fix range problem for normalisation factor in compact mode (it was stored as an unsigned scaled from an assumed float range of 0->1, which is not very plausible and not accurate enough even if true -- use a float instead) * Spectrogram: fix vertical zoom behaviour for log frequency spectrograms: make the thing in the middle of the display remain in the middle after zoom * Overview widget: don't update the detailed waveform if still decoding the audio file (too expensive to do all those redraws)
author Chris Cannam
date Fri, 08 Jun 2007 15:19:50 +0000
parents 28c8e8e3c537
children b9380f679f70
line wrap: on
line diff
--- a/view/Overview.cpp	Fri Jun 01 13:56:35 2007 +0000
+++ b/view/Overview.cpp	Fri Jun 08 15:19:50 2007 +0000
@@ -38,6 +38,28 @@
 void
 Overview::modelChanged(size_t startFrame, size_t endFrame)
 {
+    bool zoomChanged = false;
+
+    size_t frameCount = getModelsEndFrame() - getModelsStartFrame();
+    int zoomLevel = frameCount / width();
+    if (zoomLevel < 1) zoomLevel = 1;
+    zoomLevel = getZoomConstraintBlockSize(zoomLevel,
+					   ZoomConstraint::RoundUp);
+    if (zoomLevel != m_zoomLevel) {
+        zoomChanged = true;
+    }
+
+    if (!zoomChanged) {
+        for (LayerList::const_iterator i = m_layers.begin();
+             i != m_layers.end(); ++i) {
+            if ((*i)->getModel() &&
+                !(*i)->getModel()->isOK() ||
+                !(*i)->getModel()->isReady()) {
+                return;
+            }
+        }
+    }
+
     View::modelChanged(startFrame, endFrame);
 }
 
@@ -112,6 +134,7 @@
 	m_zoomLevel = zoomLevel;
 	emit zoomLevelChanged(m_zoomLevel, m_followZoom);
     }
+
     size_t centreFrame = startFrame + m_zoomLevel * (width() / 2);
     if (centreFrame > (startFrame + getModelsEndFrame())/2) {
 	centreFrame = (startFrame + getModelsEndFrame())/2;