comparison view/Overview.cpp @ 682:1a0dfcbffaf1

Drop std:: from cout, cerr, endl -- pull these in through Debug.h
author Chris Cannam
date Tue, 26 Nov 2013 14:06:40 +0000
parents 77fa3fdbfc7e
children cf1e8a1abb7b 4c8ca536b54f
comparison
equal deleted inserted replaced
681:eaf4446a1bef 682:1a0dfcbffaf1
22 #include <QPainter> 22 #include <QPainter>
23 #include <iostream> 23 #include <iostream>
24 24
25 //#define DEBUG_OVERVIEW 1 25 //#define DEBUG_OVERVIEW 1
26 26
27 using std::cerr; 27
28 using std::endl; 28
29 29
30 Overview::Overview(QWidget *w) : 30 Overview::Overview(QWidget *w) :
31 View(w, false), 31 View(w, false),
32 m_clickedInRange(false) 32 m_clickedInRange(false)
33 { 33 {
93 93
94 void 94 void
95 Overview::globalCentreFrameChanged(unsigned long f) 95 Overview::globalCentreFrameChanged(unsigned long f)
96 { 96 {
97 #ifdef DEBUG_OVERVIEW 97 #ifdef DEBUG_OVERVIEW
98 std::cerr << "Overview::globalCentreFrameChanged: " << f << std::endl; 98 cerr << "Overview::globalCentreFrameChanged: " << f << endl;
99 #endif 99 #endif
100 update(); 100 update();
101 } 101 }
102 102
103 void 103 void
104 Overview::viewCentreFrameChanged(View *v, unsigned long f) 104 Overview::viewCentreFrameChanged(View *v, unsigned long f)
105 { 105 {
106 #ifdef DEBUG_OVERVIEW 106 #ifdef DEBUG_OVERVIEW
107 std::cerr << "Overview[" << this << "]::viewCentreFrameChanged(" << v << "): " << f << std::endl; 107 cerr << "Overview[" << this << "]::viewCentreFrameChanged(" << v << "): " << f << endl;
108 #endif 108 #endif
109 if (m_views.find(v) != m_views.end()) { 109 if (m_views.find(v) != m_views.end()) {
110 update(); 110 update();
111 } 111 }
112 } 112 }
122 122
123 void 123 void
124 Overview::viewManagerPlaybackFrameChanged(unsigned long f) 124 Overview::viewManagerPlaybackFrameChanged(unsigned long f)
125 { 125 {
126 #ifdef DEBUG_OVERVIEW 126 #ifdef DEBUG_OVERVIEW
127 std::cerr << "Overview[" << this << "]::viewManagerPlaybackFrameChanged(" << f << "): " << f << std::endl; 127 cerr << "Overview[" << this << "]::viewManagerPlaybackFrameChanged(" << f << "): " << f << endl;
128 #endif 128 #endif
129 129
130 bool changed = false; 130 bool changed = false;
131 131
132 f = getAlignedPlaybackFrame(); 132 f = getAlignedPlaybackFrame();
141 Overview::paintEvent(QPaintEvent *e) 141 Overview::paintEvent(QPaintEvent *e)
142 { 142 {
143 // Recalculate zoom in case the size of the widget has changed. 143 // Recalculate zoom in case the size of the widget has changed.
144 144
145 #ifdef DEBUG_OVERVIEW 145 #ifdef DEBUG_OVERVIEW
146 std::cerr << "Overview::paintEvent: width is " << width() << ", centre frame " << m_centreFrame << std::endl; 146 cerr << "Overview::paintEvent: width is " << width() << ", centre frame " << m_centreFrame << endl;
147 #endif 147 #endif
148 148
149 size_t startFrame = getModelsStartFrame(); 149 size_t startFrame = getModelsStartFrame();
150 size_t frameCount = getModelsEndFrame() - getModelsStartFrame(); 150 size_t frameCount = getModelsEndFrame() - getModelsStartFrame();
151 int zoomLevel = frameCount / width(); 151 int zoomLevel = frameCount / width();
161 if (centreFrame > (startFrame + getModelsEndFrame())/2) { 161 if (centreFrame > (startFrame + getModelsEndFrame())/2) {
162 centreFrame = (startFrame + getModelsEndFrame())/2; 162 centreFrame = (startFrame + getModelsEndFrame())/2;
163 } 163 }
164 if (centreFrame != m_centreFrame) { 164 if (centreFrame != m_centreFrame) {
165 #ifdef DEBUG_OVERVIEW 165 #ifdef DEBUG_OVERVIEW
166 std::cerr << "Overview::paintEvent: Centre frame changed from " 166 cerr << "Overview::paintEvent: Centre frame changed from "
167 << m_centreFrame << " to " << centreFrame << " and thus start frame from " << getStartFrame(); 167 << m_centreFrame << " to " << centreFrame << " and thus start frame from " << getStartFrame();
168 #endif 168 #endif
169 m_centreFrame = centreFrame; 169 m_centreFrame = centreFrame;
170 #ifdef DEBUG_OVERVIEW 170 #ifdef DEBUG_OVERVIEW
171 std::cerr << " to " << getStartFrame() << std::endl; 171 cerr << " to " << getStartFrame() << endl;
172 #endif 172 #endif
173 emit centreFrameChanged(m_centreFrame, false, PlaybackIgnore); 173 emit centreFrameChanged(m_centreFrame, false, PlaybackIgnore);
174 } 174 }
175 175
176 View::paintEvent(e); 176 View::paintEvent(e);
276 276
277 if (std::max(m_centreFrame, newCentreFrame) - 277 if (std::max(m_centreFrame, newCentreFrame) -
278 std::min(m_centreFrame, newCentreFrame) > size_t(m_zoomLevel)) { 278 std::min(m_centreFrame, newCentreFrame) > size_t(m_zoomLevel)) {
279 size_t rf = alignToReference(newCentreFrame); 279 size_t rf = alignToReference(newCentreFrame);
280 #ifdef DEBUG_OVERVIEW 280 #ifdef DEBUG_OVERVIEW
281 std::cerr << "Overview::mouseMoveEvent: x " << e->x() << " and click x " << m_clickPos.x() << " -> frame " << newCentreFrame << " -> rf " << rf << std::endl; 281 cerr << "Overview::mouseMoveEvent: x " << e->x() << " and click x " << m_clickPos.x() << " -> frame " << newCentreFrame << " -> rf " << rf << endl;
282 #endif 282 #endif
283 emit centreFrameChanged(rf, true, PlaybackScrollContinuous); 283 emit centreFrameChanged(rf, true, PlaybackScrollContinuous);
284 } 284 }
285 } 285 }
286 286
289 { 289 {
290 long frame = getFrameForX(e->x()); 290 long frame = getFrameForX(e->x());
291 size_t rf = 0; 291 size_t rf = 0;
292 if (frame > 0) rf = alignToReference(frame); 292 if (frame > 0) rf = alignToReference(frame);
293 #ifdef DEBUG_OVERVIEW 293 #ifdef DEBUG_OVERVIEW
294 std::cerr << "Overview::mouseDoubleClickEvent: frame " << frame << " -> rf " << rf << std::endl; 294 cerr << "Overview::mouseDoubleClickEvent: frame " << frame << " -> rf " << rf << endl;
295 #endif 295 #endif
296 m_clickedInRange = false; // we're not starting a drag with the second click 296 m_clickedInRange = false; // we're not starting a drag with the second click
297 emit centreFrameChanged(rf, true, PlaybackScrollContinuous); 297 emit centreFrameChanged(rf, true, PlaybackScrollContinuous);
298 } 298 }
299 299