comparison view/Pane.cpp @ 730:711ae36a53a2 tonioni

Signal-slot separation between region outlining and default zoom action
author Chris Cannam
date Tue, 04 Mar 2014 16:45:39 +0000
parents 596414d20ef0
children f831ca41d4a5
comparison
equal deleted inserted replaced
728:596414d20ef0 730:711ae36a53a2
88 setMouseTracking(true); 88 setMouseTracking(true);
89 setAcceptDrops(true); 89 setAcceptDrops(true);
90 90
91 updateHeadsUpDisplay(); 91 updateHeadsUpDisplay();
92 92
93 connect(this, SIGNAL(regionOutlined(QRect)),
94 this, SLOT(zoomToRegion(QRect)));
95
93 cerr << "Pane::Pane(" << this << ") returning" << endl; 96 cerr << "Pane::Pane(" << this << ") returning" << endl;
94 } 97 }
95 98
96 void 99 void
97 Pane::updateHeadsUpDisplay() 100 Pane::updateHeadsUpDisplay()
1437 int x1 = std::max(m_clickPos.x(), m_mousePos.x()); 1440 int x1 = std::max(m_clickPos.x(), m_mousePos.x());
1438 1441
1439 int y0 = std::min(m_clickPos.y(), m_mousePos.y()); 1442 int y0 = std::min(m_clickPos.y(), m_mousePos.y());
1440 int y1 = std::max(m_clickPos.y(), m_mousePos.y()); 1443 int y1 = std::max(m_clickPos.y(), m_mousePos.y());
1441 1444
1442 zoomToRegion(x0, y0, x1, y1); 1445 emit regionOutlined(QRect(x0, y0, x1 - x0, y1 - y0));
1443 } 1446 }
1444 1447
1445 } else if (mode == ViewManager::SelectMode) { 1448 } else if (mode == ViewManager::SelectMode) {
1446 1449
1447 if (!hasTopLayerTimeXAxis()) { 1450 if (!hasTopLayerTimeXAxis()) {
1800 update(); 1803 update();
1801 } 1804 }
1802 } 1805 }
1803 1806
1804 void 1807 void
1805 Pane::zoomToRegion(int x0, int y0, int x1, int y1) 1808 Pane::zoomToRegion(QRect r)
1806 { 1809 {
1810 int x0 = r.x();
1811 int y0 = r.y();
1812 int x1 = r.x() + r.width();
1813 int y1 = r.y() + r.height();
1814
1807 int w = x1 - x0; 1815 int w = x1 - x0;
1808 1816
1809 long newStartFrame = getFrameForX(x0); 1817 long newStartFrame = getFrameForX(x0);
1810 1818
1811 long visibleFrames = getEndFrame() - getStartFrame(); 1819 long visibleFrames = getEndFrame() - getStartFrame();