comparison view/Pane.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
83 setAcceptDrops(true); 83 setAcceptDrops(true);
84 84
85 updateHeadsUpDisplay(); 85 updateHeadsUpDisplay();
86 86
87 87
88 // std::cerr << "Pane::Pane(" << this << ") returning" << std::endl; 88 // DEBUG << "Pane::Pane(" << this << ") returning" << endl;
89 } 89 }
90 90
91 void 91 void
92 Pane::updateHeadsUpDisplay() 92 Pane::updateHeadsUpDisplay()
93 { 93 {
622 622
623 if (m_scaleWidth > 0 && r.left() < m_scaleWidth) { 623 if (m_scaleWidth > 0 && r.left() < m_scaleWidth) {
624 624
625 // Profiler profiler("Pane::paintEvent - painting vertical scale", true); 625 // Profiler profiler("Pane::paintEvent - painting vertical scale", true);
626 626
627 // std::cerr << "Pane::paintEvent: calling paint.save() in vertical scale block" << std::endl; 627 // DEBUG << "Pane::paintEvent: calling paint.save() in vertical scale block" << endl;
628 paint.save(); 628 paint.save();
629 629
630 paint.setPen(getForeground()); 630 paint.setPen(getForeground());
631 paint.setBrush(getBackground()); 631 paint.setBrush(getBackground());
632 paint.drawRect(0, -1, m_scaleWidth, height()+1); 632 paint.drawRect(0, -1, m_scaleWidth, height()+1);
825 void 825 void
826 Pane::drawWorkTitle(QRect r, QPainter &paint, const Model *model) 826 Pane::drawWorkTitle(QRect r, QPainter &paint, const Model *model)
827 { 827 {
828 QString title = model->getTitle(); 828 QString title = model->getTitle();
829 QString maker = model->getMaker(); 829 QString maker = model->getMaker();
830 //std::cerr << "Pane::drawWorkTitle: title=\"" << title.toStdString() 830 //DEBUG << "Pane::drawWorkTitle: title=\"" << title//<< "\", maker=\"" << maker << "\"" << endl;
831 //<< "\", maker=\"" << maker << "\"" << std::endl;
832 if (title == "") return; 831 if (title == "") return;
833 832
834 QString text = title; 833 QString text = title;
835 if (maker != "") { 834 if (maker != "") {
836 text = tr("%1 - %2").arg(title).arg(maker); 835 text = tr("%1 - %2").arg(title).arg(maker);
1782 } else { 1781 } else {
1783 newCentreFrame = 0; 1782 newCentreFrame = 0;
1784 } 1783 }
1785 1784
1786 #ifdef DEBUG_PANE 1785 #ifdef DEBUG_PANE
1787 std::cerr << "Pane::dragTopLayer: newCentreFrame = " << newCentreFrame << 1786 DEBUG << "Pane::dragTopLayer: newCentreFrame = " << newCentreFrame <<
1788 ", models end frame = " << getModelsEndFrame() << std::endl; 1787 ", models end frame = " << getModelsEndFrame() << endl;
1789 #endif 1788 #endif
1790 1789
1791 if (newCentreFrame >= getModelsEndFrame()) { 1790 if (newCentreFrame >= getModelsEndFrame()) {
1792 newCentreFrame = getModelsEndFrame(); 1791 newCentreFrame = getModelsEndFrame();
1793 if (newCentreFrame > 0) --newCentreFrame; 1792 if (newCentreFrame > 0) --newCentreFrame;
1848 int xdiff = point.x() - origin.x(); 1847 int xdiff = point.x() - origin.x();
1849 int ydiff = point.y() - origin.y(); 1848 int ydiff = point.y() - origin.y();
1850 1849
1851 int smallThreshold = 10, bigThreshold = 80; 1850 int smallThreshold = 10, bigThreshold = 80;
1852 1851
1853 // std::cerr << "Pane::updateDragMode: xdiff = " << xdiff << ", ydiff = " 1852 // DEBUG << "Pane::updateDragMode: xdiff = " << xdiff << ", ydiff = "
1854 // << ydiff << ", canMoveVertical = " << canMoveVertical << ", drag mode = " << m_dragMode << std::endl; 1853 // << ydiff << ", canMoveVertical = " << canMoveVertical << ", drag mode = " << m_dragMode << endl;
1855 1854
1856 if (dragMode == UnresolvedDrag) { 1855 if (dragMode == UnresolvedDrag) {
1857 1856
1858 if (abs(ydiff) > smallThreshold && 1857 if (abs(ydiff) > smallThreshold &&
1859 abs(ydiff) > abs(xdiff) * 2 && 1858 abs(ydiff) > abs(xdiff) * 2 &&
1860 canMoveVertical) { 1859 canMoveVertical) {
1861 // std::cerr << "Pane::updateDragMode: passed vertical threshold" << std::endl; 1860 // DEBUG << "Pane::updateDragMode: passed vertical threshold" << endl;
1862 dragMode = VerticalDrag; 1861 dragMode = VerticalDrag;
1863 } else if (abs(xdiff) > smallThreshold && 1862 } else if (abs(xdiff) > smallThreshold &&
1864 abs(xdiff) > abs(ydiff) * 2 && 1863 abs(xdiff) > abs(ydiff) * 2 &&
1865 canMoveHorizontal) { 1864 canMoveHorizontal) {
1866 // std::cerr << "Pane::updateDragMode: passed horizontal threshold" << std::endl; 1865 // DEBUG << "Pane::updateDragMode: passed horizontal threshold" << endl;
1867 dragMode = HorizontalDrag; 1866 dragMode = HorizontalDrag;
1868 } else if (abs(xdiff) > smallThreshold && 1867 } else if (abs(xdiff) > smallThreshold &&
1869 abs(ydiff) > smallThreshold && 1868 abs(ydiff) > smallThreshold &&
1870 canMoveVertical && 1869 canMoveVertical &&
1871 canMoveHorizontal) { 1870 canMoveHorizontal) {
1872 // std::cerr << "Pane::updateDragMode: passed both thresholds" << std::endl; 1871 // DEBUG << "Pane::updateDragMode: passed both thresholds" << endl;
1873 dragMode = FreeDrag; 1872 dragMode = FreeDrag;
1874 } 1873 }
1875 } 1874 }
1876 1875
1877 if (dragMode == VerticalDrag && canMoveHorizontal) { 1876 if (dragMode == VerticalDrag && canMoveHorizontal) {
2276 e->accept(); 2275 e->accept();
2277 } 2276 }
2278 2277
2279 if (e->provides("text/uri-list")) { 2278 if (e->provides("text/uri-list")) {
2280 2279
2281 std::cerr << "accepting... data is \"" << e->encodedData("text/uri-list").data() << "\"" << std::endl; 2280 DEBUG << "accepting... data is \"" << e->encodedData("text/uri-list").data() << "\"" << endl;
2282 emit dropAccepted(QString::fromLocal8Bit 2281 emit dropAccepted(QString::fromLocal8Bit
2283 (e->encodedData("text/uri-list").data()) 2282 (e->encodedData("text/uri-list").data())
2284 .split(QRegExp("[\\r\\n]+"), 2283 .split(QRegExp("[\\r\\n]+"),
2285 QString::SkipEmptyParts)); 2284 QString::SkipEmptyParts));
2286 } else { 2285 } else {
2371 2370
2372 void 2371 void
2373 Pane::toolModeChanged() 2372 Pane::toolModeChanged()
2374 { 2373 {
2375 ViewManager::ToolMode mode = m_manager->getToolMode(); 2374 ViewManager::ToolMode mode = m_manager->getToolMode();
2376 // std::cerr << "Pane::toolModeChanged(" << mode << ")" << std::endl; 2375 // DEBUG << "Pane::toolModeChanged(" << mode << ")" << endl;
2377 2376
2378 if (mode == ViewManager::MeasureMode && !m_measureCursor1) { 2377 if (mode == ViewManager::MeasureMode && !m_measureCursor1) {
2379 m_measureCursor1 = new QCursor(QBitmap(":/icons/measure1cursor.xbm"), 2378 m_measureCursor1 = new QCursor(QBitmap(":/icons/measure1cursor.xbm"),
2380 QBitmap(":/icons/measure1mask.xbm"), 2379 QBitmap(":/icons/measure1mask.xbm"),
2381 15, 14); 2380 15, 14);