changeset 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
files view/Pane.cpp view/Pane.h
diffstat 2 files changed, 13 insertions(+), 3 deletions(-) [+]
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);
--- 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);