diff view/Pane.cpp @ 590:241929c5d57c sonification

Check the scale width in the View (which has access to it); ask the layer to do something when the user clicks in the scale regardless of the edit mode, and continue with normal processing if the layer has nothing interesting to do
author Chris Cannam
date Fri, 24 Jun 2011 14:27:32 +0100
parents 7ebd5a21d74f
children a13aa5320221
line wrap: on
line diff
--- a/view/Pane.cpp	Wed Jun 22 00:04:21 2011 +0100
+++ b/view/Pane.cpp	Fri Jun 24 14:27:32 2011 +0100
@@ -1290,6 +1290,20 @@
     m_resizing = false;
     m_editing = false;
     m_releasing = false;
+    
+    if (e->x() < getVerticalScaleWidth()) {
+        // Click occurred over the layer's scale area.  Ask the layer
+        // to do something with it: if it does so (i.e. returns true),
+        // we've nothing else to do
+        Layer *layer = getTopLayer();
+        if (layer) {
+            if (layer->scaleClicked(this, e)) {
+                m_clickedInRange = false;
+                emit paneInteractedWith();
+                return;
+            }
+        }
+    }
 
     if (mode == ViewManager::NavigateMode ||
         (e->buttons() & Qt::MidButton) ||
@@ -1309,24 +1323,6 @@
             m_dragStartMinValue = dmin;
         }
 
-    //to process the mouse event when a left click is made in the layer and the tool mode is Select
-    //(to handle e.g. the audio feedback of the piano keyboard notes)
-    //does not work with the Navigate tool mode: (mode == ViewManager::NavigateMode) ||
-    //which could be also interesting
-    } else if ((mode == ViewManager::SelectMode) &&
-                   (e->buttons() & Qt::LeftButton)) {
-
-            Layer *layer = getTopLayer();
-            LayerFactory::LayerType type = LayerFactory::getInstance()->getLayerType(layer);
-
-            //if (type==(LayerFactory::LayerType) MelodicRangeSpectrogram) layer->checkMouseClick(this, e);
-
-            //std::cerr << "Vertical scale width: " << getVerticalScaleWidth() << std::endl;
-
-            //should call processMouseEvent only when a LogFrequencyScale is used but this is handled by
-            //overidding the function only in the relevant layer types
-            layer->processMouseEvent(this, e, getVerticalScaleWidth());
-
     } else if (mode == ViewManager::SelectMode) {
 
         if (!hasTopLayerTimeXAxis()) return;