Mercurial > hg > svgui
comparison view/LayerGeometryProvider.h @ 1030:0be17aafa935 spectrogram-minor-refactor
Start refactoring out the spectrogram image cache
author | Chris Cannam |
---|---|
date | Fri, 29 Jan 2016 15:08:01 +0000 |
parents | a5488775f880 |
children | 55ac6ac1982e |
comparison
equal
deleted
inserted
replaced
1029:fdfd84b022df | 1030:0be17aafa935 |
---|---|
15 #ifndef LAYER_GEOMETRY_PROVIDER_H | 15 #ifndef LAYER_GEOMETRY_PROVIDER_H |
16 #define LAYER_GEOMETRY_PROVIDER_H | 16 #define LAYER_GEOMETRY_PROVIDER_H |
17 | 17 |
18 #include "base/BaseTypes.h" | 18 #include "base/BaseTypes.h" |
19 | 19 |
20 #include <QMutex> | |
21 #include <QMutexLocker> | |
22 | |
20 class ViewManager; | 23 class ViewManager; |
21 class View; | 24 class View; |
22 class Layer; | 25 class Layer; |
23 | 26 |
24 class LayerGeometryProvider | 27 class LayerGeometryProvider |
25 { | 28 { |
26 public: | 29 public: |
30 LayerGeometryProvider() { | |
31 static QMutex idMutex; | |
32 static int nextId = 1; | |
33 QMutexLocker locker(&idMutex); | |
34 m_id = nextId; | |
35 nextId++; | |
36 } | |
37 | |
38 /** | |
39 * Retrieve the id of this object. Each LayerGeometryProvider has | |
40 * a separate id. | |
41 */ | |
42 int getId() const { return m_id; } | |
43 | |
27 /** | 44 /** |
28 * Retrieve the first visible sample frame on the widget. | 45 * Retrieve the first visible sample frame on the widget. |
29 * This is a calculated value based on the centre-frame, widget | 46 * This is a calculated value based on the centre-frame, widget |
30 * width and zoom level. The result may be negative. | 47 * width and zoom level. The result may be negative. |
31 */ | 48 */ |
58 virtual sv_frame_t getFrameForX(int x) const = 0; | 75 virtual sv_frame_t getFrameForX(int x) const = 0; |
59 | 76 |
60 virtual sv_frame_t getModelsStartFrame() const = 0; | 77 virtual sv_frame_t getModelsStartFrame() const = 0; |
61 virtual sv_frame_t getModelsEndFrame() const = 0; | 78 virtual sv_frame_t getModelsEndFrame() const = 0; |
62 | 79 |
80 /** | |
81 * Return the closest pixel x-coordinate corresponding to a given | |
82 * view x-coordinate. | |
83 */ | |
84 virtual int getXForViewX(int viewx) const = 0; | |
85 | |
86 /** | |
87 * Return the closest view x-coordinate corresponding to a given | |
88 * pixel x-coordinate. | |
89 */ | |
90 virtual int getViewXForX(int x) const = 0; | |
91 | |
63 /** | 92 /** |
64 * Return the pixel y-coordinate corresponding to a given | 93 * Return the pixel y-coordinate corresponding to a given |
65 * frequency, if the frequency range is as specified. This does | 94 * frequency, if the frequency range is as specified. This does |
66 * not imply any policy about layer frequency ranges, but it might | 95 * not imply any policy about layer frequency ranges, but it might |
67 * be useful for layers to match theirs up if desired. | 96 * be useful for layers to match theirs up if desired. |
121 QString text, TextStyle style) const = 0; | 150 QString text, TextStyle style) const = 0; |
122 | 151 |
123 virtual void drawMeasurementRect(QPainter &p, const Layer *, | 152 virtual void drawMeasurementRect(QPainter &p, const Layer *, |
124 QRect rect, bool focus) const = 0; | 153 QRect rect, bool focus) const = 0; |
125 | 154 |
155 virtual void updatePaintRect(QRect r) = 0; | |
156 | |
126 virtual View *getView() = 0; | 157 virtual View *getView() = 0; |
127 virtual const View *getView() const = 0; | 158 virtual const View *getView() const = 0; |
159 | |
160 private: | |
161 int m_id; | |
128 }; | 162 }; |
129 | 163 |
130 #endif | 164 #endif |