# HG changeset patch # User Chris Cannam # Date 1393951539 0 # Node ID 711ae36a53a2730780bc59cb75b2d1c0d39026d0 # Parent 596414d20ef0526efd32027ed5ea953fe206fe8d Signal-slot separation between region outlining and default zoom action diff -r 596414d20ef0 -r 711ae36a53a2 view/Pane.cpp --- 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); diff -r 596414d20ef0 -r 711ae36a53a2 view/Pane.h --- a/view/Pane.h Tue Mar 04 15:28:32 2014 +0000 +++ b/view/Pane.h Tue Mar 04 16:45:39 2014 +0000 @@ -68,6 +68,7 @@ void dropAccepted(QStringList uriList); void dropAccepted(QString text); void doubleClickSelectInvoked(size_t frame); + void regionOutlined(QRect rect); public slots: virtual void toolModeChanged(); @@ -85,6 +86,8 @@ virtual void propertyContainerSelected(View *, PropertyContainer *pc); + void zoomToRegion(QRect r); + void mouseEnteredWidget(); void mouseLeftWidget(); @@ -130,7 +133,6 @@ void dragTopLayer(QMouseEvent *e); void dragExtendSelection(QMouseEvent *e); - void zoomToRegion(int x0, int y0, int x1, int y1); void updateContextHelp(const QPoint *pos); void edgeScrollMaybe(int x);