diff layer/SpectrogramLayer.cpp @ 1139:2976f57164ac spectrogram-minor-refactor

Reconnect double-click region select in spectrogram
author Chris Cannam
date Thu, 04 Aug 2016 17:29:33 +0100
parents 4e7ed3252d80
children ca910d8070c8
line wrap: on
line diff
--- a/layer/SpectrogramLayer.cpp	Thu Aug 04 14:02:56 2016 +0100
+++ b/layer/SpectrogramLayer.cpp	Thu Aug 04 17:29:33 2016 +0100
@@ -28,7 +28,6 @@
 #include "data/model/Dense3DModelPeakCache.h"
 
 #include "ColourMapper.h"
-#include "ImageRegionFinder.h"
 #include "PianoScale.h"
 #include "PaintAssistant.h"
 #include "Colour3DPlotRenderer.h"
@@ -1727,27 +1726,18 @@
 } 
 
 void
-SpectrogramLayer::measureDoubleClick(LayerGeometryProvider *, QMouseEvent *)
+SpectrogramLayer::measureDoubleClick(LayerGeometryProvider *v, QMouseEvent *e)
 {
-/*!!! replace this
-    const View *view = v->getView();
-
-    ScrollableImageCache &cache = getImageCacheReference(view);
-
-    cerr << "cache width: " << cache.getSize().width() << ", height: "
-         << cache.getSize().height() << endl;
-
-    QImage image = cache.getImage();
-
-    ImageRegionFinder finder;
-    QRect rect = finder.findRegionExtents(&image, e->pos());
+    const Colour3DPlotRenderer *renderer = getRenderer(v);
+    if (!renderer) return;
+
+    QRect rect = renderer->findSimilarRegionExtents(e->pos());
     if (rect.isValid()) {
         MeasureRect mr;
         setMeasureRectFromPixrect(v, mr, rect);
         CommandHistory::getInstance()->addCommand
             (new AddMeasurementRectCommand(this, mr));
     }
-*/
 }
 
 bool