Mercurial > hg > svgui
diff 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 |
line wrap: on
line diff
--- a/view/Pane.cpp Tue Mar 04 15:28:32 2014 +0000 +++ b/view/Pane.cpp Tue Mar 04 16:45:39 2014 +0000 @@ -90,6 +90,9 @@ updateHeadsUpDisplay(); + connect(this, SIGNAL(regionOutlined(QRect)), + this, SLOT(zoomToRegion(QRect))); + cerr << "Pane::Pane(" << this << ") returning" << endl; } @@ -1439,7 +1442,7 @@ int y0 = std::min(m_clickPos.y(), m_mousePos.y()); int y1 = std::max(m_clickPos.y(), m_mousePos.y()); - zoomToRegion(x0, y0, x1, y1); + emit regionOutlined(QRect(x0, y0, x1 - x0, y1 - y0)); } } else if (mode == ViewManager::SelectMode) { @@ -1802,8 +1805,13 @@ } void -Pane::zoomToRegion(int x0, int y0, int x1, int y1) +Pane::zoomToRegion(QRect r) { + int x0 = r.x(); + int y0 = r.y(); + int x1 = r.x() + r.width(); + int y1 = r.y() + r.height(); + int w = x1 - x0; long newStartFrame = getFrameForX(x0);