comparison view/View.cpp @ 830:8bb9320f78a4

Debug output stuff
author Chris Cannam
date Fri, 25 Jul 2014 17:02:29 +0100
parents 09026c875301
children 9ad718fdc369
comparison
equal deleted inserted replaced
829:5acfb11e8aef 830:8bb9320f78a4
42 #include <cassert> 42 #include <cassert>
43 #include <cmath> 43 #include <cmath>
44 44
45 #include <unistd.h> 45 #include <unistd.h>
46 46
47 //#define DEBUG_VIEW 1
47 //#define DEBUG_VIEW_WIDGET_PAINT 1 48 //#define DEBUG_VIEW_WIDGET_PAINT 1
48
49
50 49
51 50
52 View::View(QWidget *w, bool showProgress) : 51 View::View(QWidget *w, bool showProgress) :
53 QFrame(w), 52 QFrame(w),
54 m_centreFrame(0), 53 m_centreFrame(0),
340 changeVisible = true; 339 changeVisible = true;
341 } 340 }
342 341
343 if (e) { 342 if (e) {
344 int rf = alignToReference(f); 343 int rf = alignToReference(f);
345 #ifdef DEBUG_VIEW_WIDGET_PAINT 344 #ifdef DEBUG_VIEW
346 cerr << "View[" << this << "]::setCentreFrame(" << f 345 cerr << "View[" << this << "]::setCentreFrame(" << f
347 << "): emitting centreFrameChanged(" 346 << "): emitting centreFrameChanged("
348 << rf << ")" << endl; 347 << rf << ")" << endl;
349 #endif 348 #endif
350 emit centreFrameChanged(rf, m_followPan, m_followPlay); 349 emit centreFrameChanged(rf, m_followPan, m_followPlay);
968 void 967 void
969 View::globalCentreFrameChanged(int rf) 968 View::globalCentreFrameChanged(int rf)
970 { 969 {
971 if (m_followPan) { 970 if (m_followPan) {
972 int f = alignFromReference(rf); 971 int f = alignFromReference(rf);
973 #ifdef DEBUG_VIEW_WIDGET_PAINT 972 #ifdef DEBUG_VIEW
974 cerr << "View[" << this << "]::globalCentreFrameChanged(" << rf 973 cerr << "View[" << this << "]::globalCentreFrameChanged(" << rf
975 << "): setting centre frame to " << f << endl; 974 << "): setting centre frame to " << f << endl;
976 #endif 975 #endif
977 setCentreFrame(f, false); 976 setCentreFrame(f, false);
978 } 977 }
989 { 988 {
990 if (m_manager) { 989 if (m_manager) {
991 if (sender() != m_manager) return; 990 if (sender() != m_manager) return;
992 } 991 }
993 992
993 #ifdef DEBUG_VIEW
994 cerr << "View::viewManagerPlaybackFrameChanged(" << f << ")" << endl;
995 #endif
996
994 f = getAlignedPlaybackFrame(); 997 f = getAlignedPlaybackFrame();
995 998
999 #ifdef DEBUG_VIEW
1000 cerr << " -> aligned frame = " << af << endl;
1001 #endif
1002
996 movePlayPointer(f); 1003 movePlayPointer(f);
997 } 1004 }
998 1005
999 void 1006 void
1000 View::movePlayPointer(int newFrame) 1007 View::movePlayPointer(int newFrame)
1001 { 1008 {
1009 #ifdef DEBUG_VIEW
1010 cerr << "View(" << this << ")::movePlayPointer(" << newFrame << ")" << endl;
1011 #endif
1012
1002 if (m_playPointerFrame == newFrame) return; 1013 if (m_playPointerFrame == newFrame) return;
1003 bool visibleChange = 1014 bool visibleChange =
1004 (getXForFrame(m_playPointerFrame) != getXForFrame(newFrame)); 1015 (getXForFrame(m_playPointerFrame) != getXForFrame(newFrame));
1005 int oldPlayPointerFrame = m_playPointerFrame; 1016 int oldPlayPointerFrame = m_playPointerFrame;
1006 m_playPointerFrame = newFrame; 1017 m_playPointerFrame = newFrame;
1292 int pf = m_manager->getPlaybackFrame(); 1303 int pf = m_manager->getPlaybackFrame();
1293 if (!m_manager->getAlignMode()) return pf; 1304 if (!m_manager->getAlignMode()) return pf;
1294 1305
1295 Model *aligningModel = getAligningModel(); 1306 Model *aligningModel = getAligningModel();
1296 if (!aligningModel) return pf; 1307 if (!aligningModel) return pf;
1297 /* 1308
1298 Model *pm = m_manager->getPlaybackModel();
1299
1300 // cerr << "View[" << this << "]::getAlignedPlaybackFrame: pf = " << pf;
1301
1302 if (pm) {
1303 pf = pm->alignToReference(pf);
1304 // cerr << " -> " << pf;
1305 }
1306 */
1307 int af = aligningModel->alignFromReference(pf); 1309 int af = aligningModel->alignFromReference(pf);
1308 1310
1309 // cerr << ", aligned = " << af << endl;
1310 return af; 1311 return af;
1311 } 1312 }
1312 1313
1313 bool 1314 bool
1314 View::areLayersScrollable() const 1315 View::areLayersScrollable() const