Mercurial > hg > svgui
comparison view/Pane.cpp @ 586:1ae54a29e59e
Merge from debug-output branch
author | Chris Cannam |
---|---|
date | Tue, 14 Jun 2011 14:48:29 +0100 |
parents | f4960f8ce798 |
children | 4806715f7a19 |
comparison
equal
deleted
inserted
replaced
583:4c484636d5ec | 586:1ae54a29e59e |
---|---|
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.toStdString() << "\"" << 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); |
873 QStringList texts; | 872 QStringList texts; |
874 std::vector<QPixmap> pixmaps; | 873 std::vector<QPixmap> pixmaps; |
875 for (LayerList::iterator i = m_layers.begin(); i != m_layers.end(); ++i) { | 874 for (LayerList::iterator i = m_layers.begin(); i != m_layers.end(); ++i) { |
876 texts.push_back((*i)->getLayerPresentationName()); | 875 texts.push_back((*i)->getLayerPresentationName()); |
877 // std::cerr << "Pane " << this << ": Layer presentation name for " << *i << ": " | 876 // std::cerr << "Pane " << this << ": Layer presentation name for " << *i << ": " |
878 // << texts[texts.size()-1].toStdString() << std::endl; | 877 // << texts[texts.size()-1] << std::endl; |
879 pixmaps.push_back((*i)->getLayerPresentationPixmap | 878 pixmaps.push_back((*i)->getLayerPresentationPixmap |
880 (QSize(fontAscent, fontAscent))); | 879 (QSize(fontAscent, fontAscent))); |
881 } | 880 } |
882 | 881 |
883 int maxTextWidth = width() / 3; | 882 int maxTextWidth = width() / 3; |
890 | 889 |
891 if (r.x() + r.width() >= llx - fontAscent - 3) { | 890 if (r.x() + r.width() >= llx - fontAscent - 3) { |
892 | 891 |
893 for (size_t i = 0; i < texts.size(); ++i) { | 892 for (size_t i = 0; i < texts.size(); ++i) { |
894 | 893 |
895 // std::cerr << "Pane "<< this << ": text " << i << ": " << texts[i].toStdString() << std::endl; | 894 // std::cerr << "Pane "<< this << ": text " << i << ": " << texts[i] << std::endl; |
896 | 895 |
897 if (i + 1 == texts.size()) { | 896 if (i + 1 == texts.size()) { |
898 paint.setPen(getForeground()); | 897 paint.setPen(getForeground()); |
899 } | 898 } |
900 | 899 |
1722 std::cerr << "min: " << min << ", max: " << max << ", y0: " << y0 << ", y1: " << y1 << ", h: " << height() << ", rmin: " << rmin << ", rmax: " << rmax << std::endl; | 1721 std::cerr << "min: " << min << ", max: " << max << ", y0: " << y0 << ", y1: " << y1 << ", h: " << height() << ", rmin: " << rmin << ", rmax: " << rmax << std::endl; |
1723 if (log) { | 1722 if (log) { |
1724 rmin = powf(10, rmin); | 1723 rmin = powf(10, rmin); |
1725 rmax = powf(10, rmax); | 1724 rmax = powf(10, rmax); |
1726 } | 1725 } |
1727 std::cerr << "finally: rmin: " << rmin << ", rmax: " << rmax << " " << unit.toStdString() << std::endl; | 1726 std::cerr << "finally: rmin: " << rmin << ", rmax: " << rmax << " " << unit << std::endl; |
1728 | 1727 |
1729 layer->setDisplayExtents(rmin, rmax); | 1728 layer->setDisplayExtents(rmin, rmax); |
1730 updateVerticalPanner(); | 1729 updateVerticalPanner(); |
1731 } | 1730 } |
1732 } | 1731 } |
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); |