comparison view/Pane.cpp @ 587:4806715f7a19

Seems to be a bad idea to use plain DEBUG symbol on OS/X (system wants it)
author Chris Cannam
date Tue, 14 Jun 2011 15:27:05 +0100
parents f4960f8ce798
children 7ebd5a21d74f 2f087d950621
comparison
equal deleted inserted replaced
586:1ae54a29e59e 587:4806715f7a19
83 setAcceptDrops(true); 83 setAcceptDrops(true);
84 84
85 updateHeadsUpDisplay(); 85 updateHeadsUpDisplay();
86 86
87 87
88 // DEBUG << "Pane::Pane(" << this << ") returning" << endl; 88 // SVDEBUG << "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 // DEBUG << "Pane::paintEvent: calling paint.save() in vertical scale block" << endl; 627 // SVDEBUG << "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 //DEBUG << "Pane::drawWorkTitle: title=\"" << title//<< "\", maker=\"" << maker << "\"" << endl; 830 //SVDEBUG << "Pane::drawWorkTitle: title=\"" << title//<< "\", maker=\"" << maker << "\"" << endl;
831 if (title == "") return; 831 if (title == "") return;
832 832
833 QString text = title; 833 QString text = title;
834 if (maker != "") { 834 if (maker != "") {
835 text = tr("%1 - %2").arg(title).arg(maker); 835 text = tr("%1 - %2").arg(title).arg(maker);
1781 } else { 1781 } else {
1782 newCentreFrame = 0; 1782 newCentreFrame = 0;
1783 } 1783 }
1784 1784
1785 #ifdef DEBUG_PANE 1785 #ifdef DEBUG_PANE
1786 DEBUG << "Pane::dragTopLayer: newCentreFrame = " << newCentreFrame << 1786 SVDEBUG << "Pane::dragTopLayer: newCentreFrame = " << newCentreFrame <<
1787 ", models end frame = " << getModelsEndFrame() << endl; 1787 ", models end frame = " << getModelsEndFrame() << endl;
1788 #endif 1788 #endif
1789 1789
1790 if (newCentreFrame >= getModelsEndFrame()) { 1790 if (newCentreFrame >= getModelsEndFrame()) {
1791 newCentreFrame = getModelsEndFrame(); 1791 newCentreFrame = getModelsEndFrame();
1847 int xdiff = point.x() - origin.x(); 1847 int xdiff = point.x() - origin.x();
1848 int ydiff = point.y() - origin.y(); 1848 int ydiff = point.y() - origin.y();
1849 1849
1850 int smallThreshold = 10, bigThreshold = 80; 1850 int smallThreshold = 10, bigThreshold = 80;
1851 1851
1852 // DEBUG << "Pane::updateDragMode: xdiff = " << xdiff << ", ydiff = " 1852 // SVDEBUG << "Pane::updateDragMode: xdiff = " << xdiff << ", ydiff = "
1853 // << ydiff << ", canMoveVertical = " << canMoveVertical << ", drag mode = " << m_dragMode << endl; 1853 // << ydiff << ", canMoveVertical = " << canMoveVertical << ", drag mode = " << m_dragMode << endl;
1854 1854
1855 if (dragMode == UnresolvedDrag) { 1855 if (dragMode == UnresolvedDrag) {
1856 1856
1857 if (abs(ydiff) > smallThreshold && 1857 if (abs(ydiff) > smallThreshold &&
1858 abs(ydiff) > abs(xdiff) * 2 && 1858 abs(ydiff) > abs(xdiff) * 2 &&
1859 canMoveVertical) { 1859 canMoveVertical) {
1860 // DEBUG << "Pane::updateDragMode: passed vertical threshold" << endl; 1860 // SVDEBUG << "Pane::updateDragMode: passed vertical threshold" << endl;
1861 dragMode = VerticalDrag; 1861 dragMode = VerticalDrag;
1862 } else if (abs(xdiff) > smallThreshold && 1862 } else if (abs(xdiff) > smallThreshold &&
1863 abs(xdiff) > abs(ydiff) * 2 && 1863 abs(xdiff) > abs(ydiff) * 2 &&
1864 canMoveHorizontal) { 1864 canMoveHorizontal) {
1865 // DEBUG << "Pane::updateDragMode: passed horizontal threshold" << endl; 1865 // SVDEBUG << "Pane::updateDragMode: passed horizontal threshold" << endl;
1866 dragMode = HorizontalDrag; 1866 dragMode = HorizontalDrag;
1867 } else if (abs(xdiff) > smallThreshold && 1867 } else if (abs(xdiff) > smallThreshold &&
1868 abs(ydiff) > smallThreshold && 1868 abs(ydiff) > smallThreshold &&
1869 canMoveVertical && 1869 canMoveVertical &&
1870 canMoveHorizontal) { 1870 canMoveHorizontal) {
1871 // DEBUG << "Pane::updateDragMode: passed both thresholds" << endl; 1871 // SVDEBUG << "Pane::updateDragMode: passed both thresholds" << endl;
1872 dragMode = FreeDrag; 1872 dragMode = FreeDrag;
1873 } 1873 }
1874 } 1874 }
1875 1875
1876 if (dragMode == VerticalDrag && canMoveHorizontal) { 1876 if (dragMode == VerticalDrag && canMoveHorizontal) {
2275 e->accept(); 2275 e->accept();
2276 } 2276 }
2277 2277
2278 if (e->provides("text/uri-list")) { 2278 if (e->provides("text/uri-list")) {
2279 2279
2280 DEBUG << "accepting... data is \"" << e->encodedData("text/uri-list").data() << "\"" << endl; 2280 SVDEBUG << "accepting... data is \"" << e->encodedData("text/uri-list").data() << "\"" << endl;
2281 emit dropAccepted(QString::fromLocal8Bit 2281 emit dropAccepted(QString::fromLocal8Bit
2282 (e->encodedData("text/uri-list").data()) 2282 (e->encodedData("text/uri-list").data())
2283 .split(QRegExp("[\\r\\n]+"), 2283 .split(QRegExp("[\\r\\n]+"),
2284 QString::SkipEmptyParts)); 2284 QString::SkipEmptyParts));
2285 } else { 2285 } else {
2370 2370
2371 void 2371 void
2372 Pane::toolModeChanged() 2372 Pane::toolModeChanged()
2373 { 2373 {
2374 ViewManager::ToolMode mode = m_manager->getToolMode(); 2374 ViewManager::ToolMode mode = m_manager->getToolMode();
2375 // DEBUG << "Pane::toolModeChanged(" << mode << ")" << endl; 2375 // SVDEBUG << "Pane::toolModeChanged(" << mode << ")" << endl;
2376 2376
2377 if (mode == ViewManager::MeasureMode && !m_measureCursor1) { 2377 if (mode == ViewManager::MeasureMode && !m_measureCursor1) {
2378 m_measureCursor1 = new QCursor(QBitmap(":/icons/measure1cursor.xbm"), 2378 m_measureCursor1 = new QCursor(QBitmap(":/icons/measure1cursor.xbm"),
2379 QBitmap(":/icons/measure1mask.xbm"), 2379 QBitmap(":/icons/measure1mask.xbm"),
2380 15, 14); 2380 15, 14);