comparison view/View.cpp @ 585:f4960f8ce798 debug-output

Convert many cerrs to DEBUGs
author Chris Cannam
date Mon, 16 May 2011 17:19:25 +0100
parents 1fe7951a61e8
children 4806715f7a19
comparison
equal deleted inserted replaced
584:1fe7951a61e8 585:f4960f8ce798
62 m_deleting(false), 62 m_deleting(false),
63 m_haveSelectedLayer(false), 63 m_haveSelectedLayer(false),
64 m_manager(0), 64 m_manager(0),
65 m_propertyContainer(new ViewPropertyContainer(this)) 65 m_propertyContainer(new ViewPropertyContainer(this))
66 { 66 {
67 std::cerr << "View::View(" << this << ")" << std::endl; 67 DEBUG << "View::View(" << this << ")" << endl;
68 } 68 }
69 69
70 View::~View() 70 View::~View()
71 { 71 {
72 // std::cerr << "View::~View(" << this << ")" << std::endl; 72 // DEBUG << "View::~View(" << this << ")" << endl;
73 73
74 m_deleting = true; 74 m_deleting = true;
75 delete m_propertyContainer; 75 delete m_propertyContainer;
76 } 76 }
77 77
272 } 272 }
273 273
274 void 274 void
275 View::toolModeChanged() 275 View::toolModeChanged()
276 { 276 {
277 // std::cerr << "View::toolModeChanged(" << m_manager->getToolMode() << ")" << std::endl; 277 // DEBUG << "View::toolModeChanged(" << m_manager->getToolMode() << ")" << endl;
278 } 278 }
279 279
280 void 280 void
281 View::overlayModeChanged() 281 View::overlayModeChanged()
282 { 282 {
357 { 357 {
358 long z = (long)m_zoomLevel; 358 long z = (long)m_zoomLevel;
359 long frame = m_centreFrame - (width()/2) * z; 359 long frame = m_centreFrame - (width()/2) * z;
360 360
361 #ifdef DEBUG_VIEW_WIDGET_PAINT 361 #ifdef DEBUG_VIEW_WIDGET_PAINT
362 std::cerr << "View::getFrameForX(" << x << "): z = " << z << ", m_centreFrame = " << m_centreFrame << ", width() = " << width() << ", frame = " << frame << std::endl; 362 DEBUG << "View::getFrameForX(" << x << "): z = " << z << ", m_centreFrame = " << m_centreFrame << ", width() = " << width() << ", frame = " << frame << endl;
363 #endif 363 #endif
364 364
365 frame = (frame / z) * z; // this is start frame 365 frame = (frame / z) * z; // this is start frame
366 return frame + x * z; 366 return frame + x * z;
367 } 367 }
686 m_manager, SLOT(viewZoomLevelChanged(unsigned long, bool))); 686 m_manager, SLOT(viewZoomLevelChanged(unsigned long, bool)));
687 687
688 // setCentreFrame(m_manager->getViewInitialCentreFrame()); 688 // setCentreFrame(m_manager->getViewInitialCentreFrame());
689 689
690 if (m_followPlay == PlaybackScrollPage) { 690 if (m_followPlay == PlaybackScrollPage) {
691 // std::cerr << "View::setViewManager: setting centre frame to global centre frame: " << m_manager->getGlobalCentreFrame() << std::endl; 691 // DEBUG << "View::setViewManager: setting centre frame to global centre frame: " << m_manager->getGlobalCentreFrame() << endl;
692 setCentreFrame(m_manager->getGlobalCentreFrame(), false); 692 setCentreFrame(m_manager->getGlobalCentreFrame(), false);
693 } else if (m_followPlay == PlaybackScrollContinuous) { 693 } else if (m_followPlay == PlaybackScrollContinuous) {
694 // std::cerr << "View::setViewManager: setting centre frame to playback frame: " << m_manager->getPlaybackFrame() << std::endl; 694 // DEBUG << "View::setViewManager: setting centre frame to playback frame: " << m_manager->getPlaybackFrame() << endl;
695 setCentreFrame(m_manager->getPlaybackFrame(), false); 695 setCentreFrame(m_manager->getPlaybackFrame(), false);
696 } else if (m_followPan) { 696 } else if (m_followPan) {
697 // std::cerr << "View::setViewManager: (follow pan) setting centre frame to global centre frame: " << m_manager->getGlobalCentreFrame() << std::endl; 697 // DEBUG << "View::setViewManager: (follow pan) setting centre frame to global centre frame: " << m_manager->getGlobalCentreFrame() << endl;
698 setCentreFrame(m_manager->getGlobalCentreFrame(), false); 698 setCentreFrame(m_manager->getGlobalCentreFrame(), false);
699 } 699 }
700 700
701 if (m_followZoom) setZoomLevel(m_manager->getGlobalZoom()); 701 if (m_followZoom) setZoomLevel(m_manager->getGlobalZoom());
702 702
895 View::layerParametersChanged() 895 View::layerParametersChanged()
896 { 896 {
897 Layer *layer = dynamic_cast<Layer *>(sender()); 897 Layer *layer = dynamic_cast<Layer *>(sender());
898 898
899 #ifdef DEBUG_VIEW_WIDGET_PAINT 899 #ifdef DEBUG_VIEW_WIDGET_PAINT
900 std::cerr << "View::layerParametersChanged()" << std::endl; 900 DEBUG << "View::layerParametersChanged()" << endl;
901 #endif 901 #endif
902 902
903 delete m_cache; 903 delete m_cache;
904 m_cache = 0; 904 m_cache = 0;
905 update(); 905 update();
1269 1269
1270 LayerList scrollables; 1270 LayerList scrollables;
1271 bool metUnscrollable = false; 1271 bool metUnscrollable = false;
1272 1272
1273 for (LayerList::const_iterator i = m_layers.begin(); i != m_layers.end(); ++i) { 1273 for (LayerList::const_iterator i = m_layers.begin(); i != m_layers.end(); ++i) {
1274 // std::cerr << "View::getScrollableBackLayers: calling isLayerDormant on layer " << *i << std::endl; 1274 // DEBUG << "View::getScrollableBackLayers: calling isLayerDormant on layer " << *i << endl;
1275 // std::cerr << "(name is " << (*i)->objectName() << ")" 1275 // std::cerr << "(name is " << (*i)->objectName() << ")"
1276 // << std::endl; 1276 // << std::endl;
1277 // std::cerr << "View::getScrollableBackLayers: I am " << this << std::endl; 1277 // DEBUG << "View::getScrollableBackLayers: I am " << this << endl;
1278 if ((*i)->isLayerDormant(this)) continue; 1278 if ((*i)->isLayerDormant(this)) continue;
1279 if ((*i)->isLayerOpaque()) { 1279 if ((*i)->isLayerOpaque()) {
1280 // You can't see anything behind an opaque layer! 1280 // You can't see anything behind an opaque layer!
1281 scrollables.clear(); 1281 scrollables.clear();
1282 if (metUnscrollable) break; 1282 if (metUnscrollable) break;
1457 //!!! 1457 //!!!
1458 if (wfm || 1458 if (wfm ||
1459 (wfm = dynamic_cast<RangeSummarisableTimeValueModel *> 1459 (wfm = dynamic_cast<RangeSummarisableTimeValueModel *>
1460 (model->getSourceModel()))) { 1460 (model->getSourceModel()))) {
1461 completion = wfm->getAlignmentCompletion(); 1461 completion = wfm->getAlignmentCompletion();
1462 // std::cerr << "View::checkProgress: Alignment completion = " << completion << std::endl; 1462 // DEBUG << "View::checkProgress: Alignment completion = " << completion << endl;
1463 if (completion < 100) { 1463 if (completion < 100) {
1464 text = tr("Alignment"); 1464 text = tr("Alignment");
1465 } 1465 }
1466 } 1466 }
1467 1467
1542 1542
1543 void 1543 void
1544 View::paintEvent(QPaintEvent *e) 1544 View::paintEvent(QPaintEvent *e)
1545 { 1545 {
1546 // Profiler prof("View::paintEvent", false); 1546 // Profiler prof("View::paintEvent", false);
1547 // std::cerr << "View::paintEvent: centre frame is " << m_centreFrame << std::endl; 1547 // DEBUG << "View::paintEvent: centre frame is " << m_centreFrame << endl;
1548 1548
1549 if (m_layers.empty()) { 1549 if (m_layers.empty()) {
1550 QFrame::paintEvent(e); 1550 QFrame::paintEvent(e);
1551 return; 1551 return;
1552 } 1552 }
1874 int p1 = getXForFrame(alignFromReference(i->getEndFrame())); 1874 int p1 = getXForFrame(alignFromReference(i->getEndFrame()));
1875 1875
1876 if (p1 < 0 || p0 > width()) continue; 1876 if (p1 < 0 || p0 > width()) continue;
1877 1877
1878 #ifdef DEBUG_VIEW_WIDGET_PAINT 1878 #ifdef DEBUG_VIEW_WIDGET_PAINT
1879 std::cerr << "View::drawSelections: " << p0 << ",-1 [" << (p1-p0) << "x" << (height()+1) << "]" << std::endl; 1879 DEBUG << "View::drawSelections: " << p0 << ",-1 [" << (p1-p0) << "x" << (height()+1) << "]" << endl;
1880 #endif 1880 #endif
1881 1881
1882 bool illuminateThis = 1882 bool illuminateThis =
1883 (illuminateFrame >= 0 && i->contains(illuminateFrame)); 1883 (illuminateFrame >= 0 && i->contains(illuminateFrame));
1884 1884
1976 1976
1977 void 1977 void
1978 View::drawMeasurementRect(QPainter &paint, const Layer *topLayer, QRect r, 1978 View::drawMeasurementRect(QPainter &paint, const Layer *topLayer, QRect r,
1979 bool focus) const 1979 bool focus) const
1980 { 1980 {
1981 // std::cerr << "View::drawMeasurementRect(" << r.x() << "," << r.y() << " " 1981 // DEBUG << "View::drawMeasurementRect(" << r.x() << "," << r.y() << " "
1982 // << r.width() << "x" << r.height() << ")" << std::endl; 1982 // << r.width() << "x" << r.height() << ")" << endl;
1983 1983
1984 if (r.x() + r.width() < 0 || r.x() >= width()) return; 1984 if (r.x() + r.width() < 0 || r.x() >= width()) return;
1985 1985
1986 if (r.width() != 0 || r.height() != 0) { 1986 if (r.width() != 0 || r.height() != 0) {
1987 paint.save(); 1987 paint.save();