changeset 790:7555b8b17e6e tonioni

Move play pointer on single-click in pane in navigate mode
author Chris Cannam
date Thu, 12 Jun 2014 13:14:18 +0100
parents 9fd1bdf214dd
children b076cefaf708
files view/Pane.cpp
diffstat 1 files changed, 14 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/view/Pane.cpp	Thu Jun 12 12:48:11 2014 +0100
+++ b/view/Pane.cpp	Thu Jun 12 13:14:18 2014 +0100
@@ -1433,6 +1433,9 @@
         mouseMoveEvent(e);
     }
 
+    int mouseFrame = e ? getFrameForX(e->x()) : 0;
+    if (mouseFrame < 0) mouseFrame == 0;
+
     if (m_navigating || mode == ViewManager::NavigateMode) {
 
         m_navigating = false;
@@ -1451,6 +1454,12 @@
             int y1 = std::max(m_clickPos.y(), m_mousePos.y());
 
             emit regionOutlined(QRect(x0, y0, x1 - x0, y1 - y0));
+
+        } else if (m_manager && m_dragMode == UnresolvedDrag) {
+
+            // Simple click, no drag made: move play head to the mouse
+            // frame location
+            m_manager->setPlaybackFrame(mouseFrame);
         }
 
     } else if (mode == ViewManager::SelectMode) {
@@ -1477,16 +1486,12 @@
             } else {
                 m_manager->addSelection(selection);
             }
-        }
-        else if (m_manager && !m_manager->haveInProgressSelection()) {
+
+        } else if (m_manager && !m_manager->haveInProgressSelection()) {
             
-            //cerr << "JTEST: release without selection" << endl;
-            // Get frame location of mouse
-            int mouseFrame = getFrameForX(e->x());
-            //cerr << "JTEST: frame location of click is " << mouseFrame << endl;
-            // Move play head to that frame location
-            int playbackFrame = fmax(0,mouseFrame);
-            m_manager->setPlaybackFrame(playbackFrame);
+            // Simple click, no selection made: move play head to the
+            // mouse frame location
+            m_manager->setPlaybackFrame(mouseFrame);
         }
     
         update();