changeset 716:67b167bb60ab tonioni

Propagate double-click in select mode -- the application might do something meaningful with this
author Chris Cannam
date Fri, 10 Jan 2014 14:17:50 +0000
parents 7169d08e9467
children 137d3ff48f73
files view/Pane.cpp view/Pane.h view/PaneStack.cpp view/PaneStack.h
diffstat 4 files changed, 23 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/view/Pane.cpp	Fri Jan 10 14:17:10 2014 +0000
+++ b/view/Pane.cpp	Fri Jan 10 14:17:50 2014 +0000
@@ -2105,6 +2105,13 @@
     bool relocate = (mode == ViewManager::NavigateMode ||
                      (e->buttons() & Qt::MidButton));
 
+    if (mode == ViewManager::SelectMode) {
+        m_clickedInRange = false;
+        m_manager->clearInProgressSelection();
+        emit doubleClickSelectInvoked(getFrameForX(e->x()));
+        return;
+    }
+
     if (mode == ViewManager::NavigateMode ||
         mode == ViewManager::EditMode) {
 
@@ -2453,8 +2460,8 @@
     Layer *layer = getSelectedLayer();
 
     if (offset == 0 || !layer) {
-    m_editingSelection = Selection();
-    return true;
+        m_editingSelection = Selection();
+        return true;
     }
 
     int p0 = getXForFrame(m_editingSelection.getStartFrame()) + offset;
@@ -2470,21 +2477,21 @@
         CommandHistory::getInstance()->startCompoundOperation
             (tr("Drag Selection"), true);
 
-    layer->moveSelection(m_editingSelection, f0);
+        layer->moveSelection(m_editingSelection, f0);
     
     } else {
     
         CommandHistory::getInstance()->startCompoundOperation
             (tr("Resize Selection"), true);
 
-    if (m_editingSelectionEdge < 0) {
-        f1 = m_editingSelection.getEndFrame();
-    } else {
-        f0 = m_editingSelection.getStartFrame();
-    }
-
-    newSelection = Selection(f0, f1);
-    layer->resizeSelection(m_editingSelection, newSelection);
+        if (m_editingSelectionEdge < 0) {
+            f1 = m_editingSelection.getEndFrame();
+        } else {
+            f0 = m_editingSelection.getStartFrame();
+        }
+
+        newSelection = Selection(f0, f1);
+        layer->resizeSelection(m_editingSelection, newSelection);
     }
     
     m_manager->removeSelection(m_editingSelection);
--- a/view/Pane.h	Fri Jan 10 14:17:10 2014 +0000
+++ b/view/Pane.h	Fri Jan 10 14:17:50 2014 +0000
@@ -67,6 +67,7 @@
     void rightButtonMenuRequested(QPoint position);
     void dropAccepted(QStringList uriList);
     void dropAccepted(QString text);
+    void doubleClickSelectInvoked(size_t frame);
 
 public slots:
     virtual void toolModeChanged();
--- a/view/PaneStack.cpp	Fri Jan 10 14:17:10 2014 +0000
+++ b/view/PaneStack.cpp	Fri Jan 10 14:17:50 2014 +0000
@@ -158,6 +158,8 @@
             this, SLOT(paneDropAccepted(QStringList)));
     connect(pane, SIGNAL(dropAccepted(QString)),
             this, SLOT(paneDropAccepted(QString)));
+    connect(pane, SIGNAL(doubleClickSelectInvoked(size_t)),
+            this, SIGNAL(doubleClickSelectInvoked(size_t)));
 
     emit paneAdded(pane);
     emit paneAdded();
--- a/view/PaneStack.h	Fri Jan 10 14:17:10 2014 +0000
+++ b/view/PaneStack.h	Fri Jan 10 14:17:50 2014 +0000
@@ -93,6 +93,8 @@
 
     void paneDeleteButtonClicked(Pane *pane);
 
+    void doubleClickSelectInvoked(size_t frame);
+
 public slots:
     void propertyContainerAdded(PropertyContainer *);
     void propertyContainerRemoved(PropertyContainer *);