diff view/Pane.cpp @ 646:ba76130ed7e5 tonioni

added context sensitive mouse pointers in note edit tool mode
author gyorgyf
date Sat, 15 Jun 2013 17:04:03 +0100
parents c8f45afb83d5
children 2ad082c5a090 12d570c27d85
line wrap: on
line diff
--- a/view/Pane.cpp	Sat Jun 15 16:16:24 2013 +0100
+++ b/view/Pane.cpp	Sat Jun 15 17:04:03 2013 +0100
@@ -25,6 +25,11 @@
 #include "base/Preferences.h"
 #include "layer/WaveformLayer.h"
 
+// GF: added so we can propagate the mouse move event to the note layer for context handling.
+#include "layer/LayerFactory.h"
+#include "layer/FlexiNoteLayer.h"
+
+
 //!!! ugh
 #include "data/model/WaveFileModel.h"
 
@@ -1559,15 +1564,23 @@
 
     if (!m_clickedInRange) {
     
-    if (mode == ViewManager::SelectMode && hasTopLayerTimeXAxis()) {
-        bool closeToLeft = false, closeToRight = false;
-        getSelectionAt(e->x(), closeToLeft, closeToRight);
-        if ((closeToLeft || closeToRight) && !(closeToLeft && closeToRight)) {
-        setCursor(Qt::SizeHorCursor);
-        } else {
-        setCursor(Qt::ArrowCursor);
+        // GF: handle mouse move for context sensitive cursor switching in NoteEditMode.
+        // GF: Propagate the event to FlexiNoteLayer. I somehow feel it's best handeled there rather than here, but perhaps not if this will be needed elsewhere too.
+        if (mode == ViewManager::NoteEditMode && LayerFactory::getInstance()->getLayerType(getTopLayer()) == LayerFactory::FlexiNotes) {
+        
+            dynamic_cast<FlexiNoteLayer *>(getTopLayer())->mouseMoveEvent(this, e);
+
+        }   
+    
+        if (mode == ViewManager::SelectMode && hasTopLayerTimeXAxis()) {
+            bool closeToLeft = false, closeToRight = false;
+            getSelectionAt(e->x(), closeToLeft, closeToRight);
+            if ((closeToLeft || closeToRight) && !(closeToLeft && closeToRight)) {
+                setCursor(Qt::SizeHorCursor);
+            } else {
+                setCursor(Qt::ArrowCursor);
+            }
         }
-    }
 
         if (!m_manager->isPlaying()) {