changeset 840:d843e6275d0f

Use getInteractionLayer for immediate interactions, rather than getSelectedLayer (which may be invisible)
author Chris Cannam
date Tue, 02 Sep 2014 16:14:22 +0100
parents 757b7baac614
children 532302d04571
files view/Pane.cpp
diffstat 1 files changed, 19 insertions(+), 19 deletions(-) [+]
line wrap: on
line diff
--- a/view/Pane.cpp	Tue Sep 02 16:12:40 2014 +0100
+++ b/view/Pane.cpp	Tue Sep 02 16:14:22 2014 +0100
@@ -347,7 +347,7 @@
         return false;
     }
 
-    if (layer == getSelectedLayer() &&
+    if (layer == getInteractionLayer() &&
         !shouldIlluminateLocalSelection(discard, b0, b1)) {
 
         pos = m_identifyPoint;
@@ -372,7 +372,7 @@
                                    closeToLeft, closeToRight));
 
         if (!s.isEmpty()) {
-            if (getSelectedLayer() && getSelectedLayer()->isLayerEditable()) {
+            if (getInteractionLayer() && getInteractionLayer()->isLayerEditable()) {
             
                 pos = m_identifyPoint;
                 return true;
@@ -1367,7 +1367,7 @@
             int resolution = 1;
             int snapFrame = mouseFrame;
     
-            Layer *layer = getSelectedLayer();
+            Layer *layer = getInteractionLayer();
             if (layer && !m_shiftPressed) {
                 layer->snapToFeatureFrame(this, snapFrame,
                                           resolution, Layer::SnapLeft);
@@ -1397,14 +1397,14 @@
 
     } else if (mode == ViewManager::DrawMode) {
 
-        Layer *layer = getSelectedLayer();
+        Layer *layer = getInteractionLayer();
         if (layer && layer->isLayerEditable()) {
             layer->drawStart(this, e);
         }
 
     } else if (mode == ViewManager::EraseMode) {
 
-        Layer *layer = getSelectedLayer();
+        Layer *layer = getInteractionLayer();
         if (layer && layer->isLayerEditable()) {
             layer->eraseStart(this, e);
         }
@@ -1522,7 +1522,7 @@
 
     } else if (mode == ViewManager::DrawMode) {
 
-        Layer *layer = getSelectedLayer();
+        Layer *layer = getInteractionLayer();
         if (layer && layer->isLayerEditable()) {
             layer->drawEnd(this, e);
             update();
@@ -1530,7 +1530,7 @@
 
     } else if (mode == ViewManager::EraseMode) {
 
-        Layer *layer = getSelectedLayer();
+        Layer *layer = getInteractionLayer();
         if (layer && layer->isLayerEditable()) {
             layer->eraseEnd(this, e);
             update();
@@ -1557,7 +1557,7 @@
         
         if (m_editing) {
             if (!editSelectionEnd(e)) {
-                Layer *layer = getSelectedLayer();
+                Layer *layer = getInteractionLayer();
                 if (layer && layer->isLayerEditable()) {
                     layer->editEnd(this, e);
                     update();
@@ -1638,7 +1638,7 @@
 
             bool updating = false;
 
-            if (getSelectedLayer() &&
+            if (getInteractionLayer() &&
                 m_manager->shouldIlluminateLocalFeatures()) {
 
                 bool previouslyIdentifying = m_identifyFeatures;
@@ -1685,14 +1685,14 @@
 
     } else if (mode == ViewManager::DrawMode) {
 
-        Layer *layer = getSelectedLayer();
+        Layer *layer = getInteractionLayer();
         if (layer && layer->isLayerEditable()) {
             layer->drawDrag(this, e);
         }
 
     } else if (mode == ViewManager::EraseMode) {
 
-        Layer *layer = getSelectedLayer();
+        Layer *layer = getInteractionLayer();
         if (layer && layer->isLayerEditable()) {
             layer->eraseDrag(this, e);
         }
@@ -1742,7 +1742,7 @@
 
             if (!editSelectionDrag(e)) {
 
-                Layer *layer = getSelectedLayer();
+                Layer *layer = getInteractionLayer();
 
                 if (layer && layer->isLayerEditable()) {
 
@@ -1797,7 +1797,7 @@
                                        e->modifiers());
 
                 if (!editSelectionStart(&clickEvent)) {
-                    Layer *layer = getSelectedLayer();
+                    Layer *layer = getInteractionLayer();
                     if (layer && layer->isLayerEditable()) {
                         layer->editStart(this, &clickEvent);
                     }
@@ -1808,7 +1808,7 @@
 
             if (!editSelectionDrag(e)) {
 
-                Layer *layer = getSelectedLayer();
+                Layer *layer = getInteractionLayer();
 
                 if (layer && layer->isLayerEditable()) {
 
@@ -2079,7 +2079,7 @@
     int snapFrameLeft = mouseFrame;
     int snapFrameRight = mouseFrame;
     
-    Layer *layer = getSelectedLayer();
+    Layer *layer = getInteractionLayer();
     if (layer && !m_shiftPressed) {
         layer->snapToFeatureFrame(this, snapFrameLeft,
                                   resolution, Layer::SnapLeft);
@@ -2181,7 +2181,7 @@
     if (mode == ViewManager::NavigateMode ||
         mode == ViewManager::EditMode) {
 
-        Layer *layer = getSelectedLayer();
+        Layer *layer = getInteractionLayer();
         if (layer && layer->isLayerEditable()) {
             if (layer->editOpen(this, e)) relocate = false;
         }
@@ -2211,7 +2211,7 @@
     
     if (mode == ViewManager::NoteEditMode) {
         std::cerr << "double click in note edit mode" << std::endl;
-        Layer *layer = getSelectedLayer();
+        Layer *layer = getInteractionLayer();
         if (layer && layer->isLayerEditable()) {
             layer->addNote(this, e); 
         }
@@ -2583,7 +2583,7 @@
     if (m_editingSelection.isEmpty()) return false;
 
     int offset = m_mousePos.x() - m_clickPos.x();
-    Layer *layer = getSelectedLayer();
+    Layer *layer = getInteractionLayer();
 
     if (offset == 0 || !layer) {
         m_editingSelection = Selection();
@@ -2765,7 +2765,7 @@
     if (m_manager) mode = m_manager->getToolModeFor(this);
 
     bool editable = false;
-    Layer *layer = getSelectedLayer();
+    Layer *layer = getInteractionLayer();
     if (layer && layer->isLayerEditable()) {
         editable = true;
     }