Mercurial > hg > svgui
comparison view/Overview.cpp @ 214:8520b7918104
* Fix overzealous cacheing in waveform layer that was leading to inaccurate
positioning of view rects & playback pointer on overview widget sometimes
author | Chris Cannam |
---|---|
date | Thu, 01 Mar 2007 17:12:50 +0000 |
parents | df791d8c8f58 |
children | cd81066ac7ad |
comparison
equal
deleted
inserted
replaced
213:df791d8c8f58 | 214:8520b7918104 |
---|---|
99 void | 99 void |
100 Overview::paintEvent(QPaintEvent *e) | 100 Overview::paintEvent(QPaintEvent *e) |
101 { | 101 { |
102 // Recalculate zoom in case the size of the widget has changed. | 102 // Recalculate zoom in case the size of the widget has changed. |
103 | 103 |
104 // std::cerr << "Overview::paintEvent: width is " << width() << ", centre frame " << m_centreFrame << std::endl; | |
105 | |
104 size_t startFrame = getModelsStartFrame(); | 106 size_t startFrame = getModelsStartFrame(); |
105 size_t frameCount = getModelsEndFrame() - getModelsStartFrame(); | 107 size_t frameCount = getModelsEndFrame() - getModelsStartFrame(); |
106 int zoomLevel = frameCount / width(); | 108 int zoomLevel = frameCount / width(); |
107 if (zoomLevel < 1) zoomLevel = 1; | 109 if (zoomLevel < 1) zoomLevel = 1; |
108 zoomLevel = getZoomConstraintBlockSize(zoomLevel, | 110 zoomLevel = getZoomConstraintBlockSize(zoomLevel, |
114 size_t centreFrame = startFrame + m_zoomLevel * (width() / 2); | 116 size_t centreFrame = startFrame + m_zoomLevel * (width() / 2); |
115 if (centreFrame > (startFrame + getModelsEndFrame())/2) { | 117 if (centreFrame > (startFrame + getModelsEndFrame())/2) { |
116 centreFrame = (startFrame + getModelsEndFrame())/2; | 118 centreFrame = (startFrame + getModelsEndFrame())/2; |
117 } | 119 } |
118 if (centreFrame != m_centreFrame) { | 120 if (centreFrame != m_centreFrame) { |
121 // std::cerr << "Overview::paintEvent: Centre frame changed from " | |
122 // << m_centreFrame << " to " << centreFrame << " and thus start frame from " << getStartFrame(); | |
119 m_centreFrame = centreFrame; | 123 m_centreFrame = centreFrame; |
124 // std::cerr << " to " << getStartFrame() << std::endl; | |
120 emit centreFrameChanged(m_centreFrame, false, PlaybackIgnore); | 125 emit centreFrameChanged(m_centreFrame, false, PlaybackIgnore); |
121 } | 126 } |
122 | 127 |
123 View::paintEvent(e); | 128 View::paintEvent(e); |
124 | 129 |