Mercurial > hg > svgui
comparison layer/SpectrogramLayer.h @ 978:64c2b3a4435a 3.0-integration
Merge from branch osx-retina
author | Chris Cannam |
---|---|
date | Fri, 26 Jun 2015 14:10:40 +0100 |
parents | e39d5d2734ed |
children | 98827470ada2 |
comparison
equal
deleted
inserted
replaced
977:f40ccbf228c2 | 978:64c2b3a4435a |
---|---|
55 SpectrogramLayer(Configuration = FullRangeDb); | 55 SpectrogramLayer(Configuration = FullRangeDb); |
56 ~SpectrogramLayer(); | 56 ~SpectrogramLayer(); |
57 | 57 |
58 virtual const ZoomConstraint *getZoomConstraint() const { return this; } | 58 virtual const ZoomConstraint *getZoomConstraint() const { return this; } |
59 virtual const Model *getModel() const { return m_model; } | 59 virtual const Model *getModel() const { return m_model; } |
60 virtual void paint(View *v, QPainter &paint, QRect rect) const; | 60 virtual void paint(LayerGeometryProvider *v, QPainter &paint, QRect rect) const; |
61 virtual void setSynchronousPainting(bool synchronous); | 61 virtual void setSynchronousPainting(bool synchronous); |
62 | 62 |
63 virtual int getVerticalScaleWidth(View *v, bool detailed, QPainter &) const; | 63 virtual int getVerticalScaleWidth(LayerGeometryProvider *v, bool detailed, QPainter &) const; |
64 virtual void paintVerticalScale(View *v, bool detailed, QPainter &paint, QRect rect) const; | 64 virtual void paintVerticalScale(LayerGeometryProvider *v, bool detailed, QPainter &paint, QRect rect) const; |
65 | 65 |
66 virtual bool getCrosshairExtents(View *, QPainter &, QPoint cursorPos, | 66 virtual bool getCrosshairExtents(LayerGeometryProvider *, QPainter &, QPoint cursorPos, |
67 std::vector<QRect> &extents) const; | 67 std::vector<QRect> &extents) const; |
68 virtual void paintCrosshairs(View *, QPainter &, QPoint) const; | 68 virtual void paintCrosshairs(LayerGeometryProvider *, QPainter &, QPoint) const; |
69 | 69 |
70 virtual QString getFeatureDescription(View *v, QPoint &) const; | 70 virtual QString getFeatureDescription(LayerGeometryProvider *v, QPoint &) const; |
71 | 71 |
72 virtual bool snapToFeatureFrame(View *v, sv_frame_t &frame, | 72 virtual bool snapToFeatureFrame(LayerGeometryProvider *v, sv_frame_t &frame, |
73 int &resolution, | 73 int &resolution, |
74 SnapType snap) const; | 74 SnapType snap) const; |
75 | 75 |
76 virtual void measureDoubleClick(View *, QMouseEvent *); | 76 virtual void measureDoubleClick(LayerGeometryProvider *, QMouseEvent *); |
77 | 77 |
78 virtual bool hasLightBackground() const; | 78 virtual bool hasLightBackground() const; |
79 | 79 |
80 void setModel(const DenseTimeValueModel *model); | 80 void setModel(const DenseTimeValueModel *model); |
81 | 81 |
208 | 208 |
209 virtual ColourSignificance getLayerColourSignificance() const { | 209 virtual ColourSignificance getLayerColourSignificance() const { |
210 return ColourHasMeaningfulValue; | 210 return ColourHasMeaningfulValue; |
211 } | 211 } |
212 | 212 |
213 double getYForFrequency(const View *v, double frequency) const; | 213 double getYForFrequency(const LayerGeometryProvider *v, double frequency) const; |
214 double getFrequencyForY(const View *v, int y) const; | 214 double getFrequencyForY(const LayerGeometryProvider *v, int y) const; |
215 | 215 |
216 virtual int getCompletion(View *v) const; | 216 virtual int getCompletion(LayerGeometryProvider *v) const; |
217 virtual QString getError(View *v) const; | 217 virtual QString getError(LayerGeometryProvider *v) const; |
218 | 218 |
219 virtual bool getValueExtents(double &min, double &max, | 219 virtual bool getValueExtents(double &min, double &max, |
220 bool &logarithmic, QString &unit) const; | 220 bool &logarithmic, QString &unit) const; |
221 | 221 |
222 virtual bool getDisplayExtents(double &min, double &max) const; | 222 virtual bool getDisplayExtents(double &min, double &max) const; |
223 | 223 |
224 virtual bool setDisplayExtents(double min, double max); | 224 virtual bool setDisplayExtents(double min, double max); |
225 | 225 |
226 virtual bool getYScaleValue(const View *, int, double &, QString &) const; | 226 virtual bool getYScaleValue(const LayerGeometryProvider *, int, double &, QString &) const; |
227 | 227 |
228 virtual void toXml(QTextStream &stream, QString indent = "", | 228 virtual void toXml(QTextStream &stream, QString indent = "", |
229 QString extraAttributes = "") const; | 229 QString extraAttributes = "") const; |
230 | 230 |
231 void setProperties(const QXmlAttributes &attributes); | 231 void setProperties(const QXmlAttributes &attributes); |
232 | 232 |
233 virtual void setLayerDormant(const View *v, bool dormant); | 233 virtual void setLayerDormant(const LayerGeometryProvider *v, bool dormant); |
234 | 234 |
235 virtual bool isLayerScrollable(const View *) const { return false; } | 235 virtual bool isLayerScrollable(const LayerGeometryProvider *) const { return false; } |
236 | 236 |
237 virtual int getVerticalZoomSteps(int &defaultStep) const; | 237 virtual int getVerticalZoomSteps(int &defaultStep) const; |
238 virtual int getCurrentVerticalZoomStep() const; | 238 virtual int getCurrentVerticalZoomStep() const; |
239 virtual void setVerticalZoomStep(int); | 239 virtual void setVerticalZoomStep(int); |
240 virtual RangeMapper *getNewVerticalZoomRangeMapper() const; | 240 virtual RangeMapper *getNewVerticalZoomRangeMapper() const; |
332 bool m_exiting; | 332 bool m_exiting; |
333 | 333 |
334 void initialisePalette(); | 334 void initialisePalette(); |
335 void rotatePalette(int distance); | 335 void rotatePalette(int distance); |
336 | 336 |
337 unsigned char getDisplayValue(View *v, double input) const; | 337 unsigned char getDisplayValue(LayerGeometryProvider *v, double input) const; |
338 | 338 |
339 int getColourScaleWidth(QPainter &) const; | 339 int getColourScaleWidth(QPainter &) const; |
340 | 340 |
341 void illuminateLocalFeatures(View *v, QPainter &painter) const; | 341 void illuminateLocalFeatures(LayerGeometryProvider *v, QPainter &painter) const; |
342 | 342 |
343 double getEffectiveMinFrequency() const; | 343 double getEffectiveMinFrequency() const; |
344 double getEffectiveMaxFrequency() const; | 344 double getEffectiveMaxFrequency() const; |
345 | 345 |
346 // Note that the getYBin... methods return the nominal bin in the | 346 // Note that the getYBin... methods return the nominal bin in the |
347 // un-smoothed spectrogram. This is not necessarily the same bin | 347 // un-smoothed spectrogram. This is not necessarily the same bin |
348 // as is pulled from the spectrogram and drawn at the given | 348 // as is pulled from the spectrogram and drawn at the given |
349 // position, if the spectrogram has oversampling smoothing. Use | 349 // position, if the spectrogram has oversampling smoothing. Use |
350 // getSmoothedYBinRange to obtain that. | 350 // getSmoothedYBinRange to obtain that. |
351 | 351 |
352 bool getXBinRange(View *v, int x, double &windowMin, double &windowMax) const; | 352 bool getXBinRange(LayerGeometryProvider *v, int x, double &windowMin, double &windowMax) const; |
353 bool getYBinRange(View *v, int y, double &freqBinMin, double &freqBinMax) const; | 353 bool getYBinRange(LayerGeometryProvider *v, int y, double &freqBinMin, double &freqBinMax) const; |
354 bool getSmoothedYBinRange(View *v, int y, double &freqBinMin, double &freqBinMax) const; | 354 bool getSmoothedYBinRange(LayerGeometryProvider *v, int y, double &freqBinMin, double &freqBinMax) const; |
355 | 355 |
356 bool getYBinSourceRange(View *v, int y, double &freqMin, double &freqMax) const; | 356 bool getYBinSourceRange(LayerGeometryProvider *v, int y, double &freqMin, double &freqMax) const; |
357 bool getAdjustedYBinSourceRange(View *v, int x, int y, | 357 bool getAdjustedYBinSourceRange(LayerGeometryProvider *v, int x, int y, |
358 double &freqMin, double &freqMax, | 358 double &freqMin, double &freqMax, |
359 double &adjFreqMin, double &adjFreqMax) const; | 359 double &adjFreqMin, double &adjFreqMax) const; |
360 bool getXBinSourceRange(View *v, int x, RealTime &timeMin, RealTime &timeMax) const; | 360 bool getXBinSourceRange(LayerGeometryProvider *v, int x, RealTime &timeMin, RealTime &timeMax) const; |
361 bool getXYBinSourceRange(View *v, int x, int y, double &min, double &max, | 361 bool getXYBinSourceRange(LayerGeometryProvider *v, int x, int y, double &min, double &max, |
362 double &phaseMin, double &phaseMax) const; | 362 double &phaseMin, double &phaseMax) const; |
363 | 363 |
364 int getWindowIncrement() const { | 364 int getWindowIncrement() const { |
365 if (m_windowHopLevel == 0) return m_windowSize; | 365 if (m_windowHopLevel == 0) return m_windowSize; |
366 else if (m_windowHopLevel == 1) return (m_windowSize * 3) / 4; | 366 else if (m_windowHopLevel == 1) return (m_windowSize * 3) / 4; |
367 else return m_windowSize / (1 << (m_windowHopLevel - 1)); | 367 else return m_windowSize / (1 << (m_windowHopLevel - 1)); |
368 } | 368 } |
369 | 369 |
370 int getZeroPadLevel(const View *v) const; | 370 int getZeroPadLevel(const LayerGeometryProvider *v) const; |
371 int getFFTSize(const View *v) const; | 371 int getFFTSize(const LayerGeometryProvider *v) const; |
372 FFTModel *getFFTModel(const View *v) const; | 372 FFTModel *getFFTModel(const LayerGeometryProvider *v) const; |
373 Dense3DModelPeakCache *getPeakCache(const View *v) const; | 373 Dense3DModelPeakCache *getPeakCache(const LayerGeometryProvider *v) const; |
374 void invalidateFFTModels(); | 374 void invalidateFFTModels(); |
375 | 375 |
376 typedef std::pair<FFTModel *, sv_frame_t> FFTFillPair; // model, last fill | 376 typedef std::pair<FFTModel *, sv_frame_t> FFTFillPair; // model, last fill |
377 typedef std::map<const View *, FFTFillPair> ViewFFTMap; | 377 typedef std::map<const View *, FFTFillPair> ViewFFTMap; |
378 typedef std::map<const View *, Dense3DModelPeakCache *> PeakCacheMap; | 378 typedef std::map<const View *, Dense3DModelPeakCache *> PeakCacheMap; |
420 private: | 420 private: |
421 float m_min; | 421 float m_min; |
422 float m_max; | 422 float m_max; |
423 }; | 423 }; |
424 | 424 |
425 typedef std::map<const View *, MagnitudeRange> ViewMagMap; | 425 typedef std::map<const LayerGeometryProvider *, MagnitudeRange> ViewMagMap; |
426 mutable ViewMagMap m_viewMags; | 426 mutable ViewMagMap m_viewMags; |
427 mutable std::vector<MagnitudeRange> m_columnMags; | 427 mutable std::vector<MagnitudeRange> m_columnMags; |
428 void invalidateMagnitudes(); | 428 void invalidateMagnitudes(); |
429 bool updateViewMagnitudes(View *v) const; | 429 bool updateViewMagnitudes(LayerGeometryProvider *v) const; |
430 bool paintDrawBuffer(View *v, int w, int h, | 430 bool paintDrawBuffer(LayerGeometryProvider *v, int w, int h, |
431 const std::vector<int> &binforx, | 431 const std::vector<int> &binforx, |
432 const std::vector<double> &binfory, | 432 const std::vector<double> &binfory, |
433 bool usePeaksCache, | 433 bool usePeaksCache, |
434 MagnitudeRange &overallMag, | 434 MagnitudeRange &overallMag, |
435 bool &overallMagChanged) const; | 435 bool &overallMagChanged) const; |
436 bool paintDrawBufferPeakFrequencies(View *v, int w, int h, | 436 bool paintDrawBufferPeakFrequencies(LayerGeometryProvider *v, int w, int h, |
437 const std::vector<int> &binforx, | 437 const std::vector<int> &binforx, |
438 int minbin, | 438 int minbin, |
439 int maxbin, | 439 int maxbin, |
440 double displayMinFreq, | 440 double displayMinFreq, |
441 double displayMaxFreq, | 441 double displayMaxFreq, |
442 bool logarithmic, | 442 bool logarithmic, |
443 MagnitudeRange &overallMag, | 443 MagnitudeRange &overallMag, |
444 bool &overallMagChanged) const; | 444 bool &overallMagChanged) const; |
445 | 445 |
446 virtual void updateMeasureRectYCoords(View *v, const MeasureRect &r) const; | 446 virtual void updateMeasureRectYCoords(LayerGeometryProvider *v, const MeasureRect &r) const; |
447 virtual void setMeasureRectYCoord(View *v, MeasureRect &r, bool start, int y) const; | 447 virtual void setMeasureRectYCoord(LayerGeometryProvider *v, MeasureRect &r, bool start, int y) const; |
448 }; | 448 }; |
449 | 449 |
450 #endif | 450 #endif |