Mercurial > hg > svgui
comparison 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 |
comparison
equal
deleted
inserted
replaced
1138:998e31e92dbe | 1139:2976f57164ac |
---|---|
26 #include "base/ColumnOp.h" | 26 #include "base/ColumnOp.h" |
27 #include "widgets/CommandHistory.h" | 27 #include "widgets/CommandHistory.h" |
28 #include "data/model/Dense3DModelPeakCache.h" | 28 #include "data/model/Dense3DModelPeakCache.h" |
29 | 29 |
30 #include "ColourMapper.h" | 30 #include "ColourMapper.h" |
31 #include "ImageRegionFinder.h" | |
32 #include "PianoScale.h" | 31 #include "PianoScale.h" |
33 #include "PaintAssistant.h" | 32 #include "PaintAssistant.h" |
34 #include "Colour3DPlotRenderer.h" | 33 #include "Colour3DPlotRenderer.h" |
35 | 34 |
36 #include <QPainter> | 35 #include <QPainter> |
1725 | 1724 |
1726 return true; | 1725 return true; |
1727 } | 1726 } |
1728 | 1727 |
1729 void | 1728 void |
1730 SpectrogramLayer::measureDoubleClick(LayerGeometryProvider *, QMouseEvent *) | 1729 SpectrogramLayer::measureDoubleClick(LayerGeometryProvider *v, QMouseEvent *e) |
1731 { | 1730 { |
1732 /*!!! replace this | 1731 const Colour3DPlotRenderer *renderer = getRenderer(v); |
1733 const View *view = v->getView(); | 1732 if (!renderer) return; |
1734 | 1733 |
1735 ScrollableImageCache &cache = getImageCacheReference(view); | 1734 QRect rect = renderer->findSimilarRegionExtents(e->pos()); |
1736 | |
1737 cerr << "cache width: " << cache.getSize().width() << ", height: " | |
1738 << cache.getSize().height() << endl; | |
1739 | |
1740 QImage image = cache.getImage(); | |
1741 | |
1742 ImageRegionFinder finder; | |
1743 QRect rect = finder.findRegionExtents(&image, e->pos()); | |
1744 if (rect.isValid()) { | 1735 if (rect.isValid()) { |
1745 MeasureRect mr; | 1736 MeasureRect mr; |
1746 setMeasureRectFromPixrect(v, mr, rect); | 1737 setMeasureRectFromPixrect(v, mr, rect); |
1747 CommandHistory::getInstance()->addCommand | 1738 CommandHistory::getInstance()->addCommand |
1748 (new AddMeasurementRectCommand(this, mr)); | 1739 (new AddMeasurementRectCommand(this, mr)); |
1749 } | 1740 } |
1750 */ | |
1751 } | 1741 } |
1752 | 1742 |
1753 bool | 1743 bool |
1754 SpectrogramLayer::getCrosshairExtents(LayerGeometryProvider *v, QPainter &paint, | 1744 SpectrogramLayer::getCrosshairExtents(LayerGeometryProvider *v, QPainter &paint, |
1755 QPoint cursorPos, | 1745 QPoint cursorPos, |