comparison 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
comparison
equal deleted inserted replaced
252:8d89f8869cfb 253:1b1e6947c124
36 } 36 }
37 37
38 void 38 void
39 Overview::modelChanged(size_t startFrame, size_t endFrame) 39 Overview::modelChanged(size_t startFrame, size_t endFrame)
40 { 40 {
41 bool zoomChanged = false;
42
43 size_t frameCount = getModelsEndFrame() - getModelsStartFrame();
44 int zoomLevel = frameCount / width();
45 if (zoomLevel < 1) zoomLevel = 1;
46 zoomLevel = getZoomConstraintBlockSize(zoomLevel,
47 ZoomConstraint::RoundUp);
48 if (zoomLevel != m_zoomLevel) {
49 zoomChanged = true;
50 }
51
52 if (!zoomChanged) {
53 for (LayerList::const_iterator i = m_layers.begin();
54 i != m_layers.end(); ++i) {
55 if ((*i)->getModel() &&
56 !(*i)->getModel()->isOK() ||
57 !(*i)->getModel()->isReady()) {
58 return;
59 }
60 }
61 }
62
41 View::modelChanged(startFrame, endFrame); 63 View::modelChanged(startFrame, endFrame);
42 } 64 }
43 65
44 void 66 void
45 Overview::modelReplaced() 67 Overview::modelReplaced()
110 ZoomConstraint::RoundUp); 132 ZoomConstraint::RoundUp);
111 if (zoomLevel != m_zoomLevel) { 133 if (zoomLevel != m_zoomLevel) {
112 m_zoomLevel = zoomLevel; 134 m_zoomLevel = zoomLevel;
113 emit zoomLevelChanged(m_zoomLevel, m_followZoom); 135 emit zoomLevelChanged(m_zoomLevel, m_followZoom);
114 } 136 }
137
115 size_t centreFrame = startFrame + m_zoomLevel * (width() / 2); 138 size_t centreFrame = startFrame + m_zoomLevel * (width() / 2);
116 if (centreFrame > (startFrame + getModelsEndFrame())/2) { 139 if (centreFrame > (startFrame + getModelsEndFrame())/2) {
117 centreFrame = (startFrame + getModelsEndFrame())/2; 140 centreFrame = (startFrame + getModelsEndFrame())/2;
118 } 141 }
119 if (centreFrame != m_centreFrame) { 142 if (centreFrame != m_centreFrame) {