comparison view/Overview.cpp @ 586:1ae54a29e59e

Merge from debug-output branch
author Chris Cannam
date Tue, 14 Jun 2011 14:48:29 +0100
parents f4960f8ce798
children 4806715f7a19
comparison
equal deleted inserted replaced
583:4c484636d5ec 586:1ae54a29e59e
128 void 128 void
129 Overview::paintEvent(QPaintEvent *e) 129 Overview::paintEvent(QPaintEvent *e)
130 { 130 {
131 // Recalculate zoom in case the size of the widget has changed. 131 // Recalculate zoom in case the size of the widget has changed.
132 132
133 // std::cerr << "Overview::paintEvent: width is " << width() << ", centre frame " << m_centreFrame << std::endl; 133 // DEBUG << "Overview::paintEvent: width is " << width() << ", centre frame " << m_centreFrame << endl;
134 134
135 size_t startFrame = getModelsStartFrame(); 135 size_t startFrame = getModelsStartFrame();
136 size_t frameCount = getModelsEndFrame() - getModelsStartFrame(); 136 size_t frameCount = getModelsEndFrame() - getModelsStartFrame();
137 int zoomLevel = frameCount / width(); 137 int zoomLevel = frameCount / width();
138 if (zoomLevel < 1) zoomLevel = 1; 138 if (zoomLevel < 1) zoomLevel = 1;
146 size_t centreFrame = startFrame + m_zoomLevel * (width() / 2); 146 size_t centreFrame = startFrame + m_zoomLevel * (width() / 2);
147 if (centreFrame > (startFrame + getModelsEndFrame())/2) { 147 if (centreFrame > (startFrame + getModelsEndFrame())/2) {
148 centreFrame = (startFrame + getModelsEndFrame())/2; 148 centreFrame = (startFrame + getModelsEndFrame())/2;
149 } 149 }
150 if (centreFrame != m_centreFrame) { 150 if (centreFrame != m_centreFrame) {
151 // std::cerr << "Overview::paintEvent: Centre frame changed from " 151 // DEBUG << "Overview::paintEvent: Centre frame changed from "
152 // << m_centreFrame << " to " << centreFrame << " and thus start frame from " << getStartFrame(); 152 // << m_centreFrame << " to " << centreFrame << " and thus start frame from " << getStartFrame();
153 m_centreFrame = centreFrame; 153 m_centreFrame = centreFrame;
154 // std::cerr << " to " << getStartFrame() << std::endl; 154 // DEBUG << " to " << getStartFrame() << endl;
155 emit centreFrameChanged(m_centreFrame, false, PlaybackIgnore); 155 emit centreFrameChanged(m_centreFrame, false, PlaybackIgnore);
156 } 156 }
157 157
158 View::paintEvent(e); 158 View::paintEvent(e);
159 159