diff view/Pane.cpp @ 255:e175ade2d6b0

* double-click in navigate mode relocates the centre frame (closing #1734854)
author Chris Cannam
date Wed, 13 Jun 2007 09:19:33 +0000
parents 28c8e8e3c537
children c492902dba40
line wrap: on
line diff
--- a/view/Pane.cpp	Mon Jun 11 12:14:52 2007 +0000
+++ b/view/Pane.cpp	Wed Jun 13 09:19:33 2007 +0000
@@ -1401,14 +1401,33 @@
     ViewManager::ToolMode mode = ViewManager::NavigateMode;
     if (m_manager) mode = m_manager->getToolMode();
 
+    bool relocate = (mode == ViewManager::NavigateMode ||
+                     (e->buttons() & Qt::MidButton));
+
     if (mode == ViewManager::NavigateMode ||
         mode == ViewManager::EditMode) {
 
 	Layer *layer = getSelectedLayer();
 	if (layer && layer->isLayerEditable()) {
-	    layer->editOpen(this, e);
+	    if (layer->editOpen(this, e)) relocate = false;
 	}
     }
+
+    if (relocate) {
+
+        long f = getFrameForX(e->x());
+
+        setCentreFrame(f);
+
+        m_dragCentreFrame = f;
+        m_dragStartMinValue = 0;
+        m_dragMode = UnresolvedDrag;
+
+        float vmin, vmax, dmin, dmax;
+        if (getTopLayerDisplayExtents(vmin, vmax, dmin, dmax)) {
+            m_dragStartMinValue = dmin;
+        }
+    }
 }
 
 void