Mercurial > hg > svgui
comparison layer/Layer.h @ 1266:a34a2a25907c
Untabify
author | Chris Cannam |
---|---|
date | Thu, 01 Mar 2018 18:02:22 +0000 |
parents | e3c7da3d896e |
children | 1d7921b1852f |
comparison
equal
deleted
inserted
replaced
1265:6e724c81f18f | 1266:a34a2a25907c |
---|---|
49 * Model. Layers are expected to be able to draw themselves onto a | 49 * Model. Layers are expected to be able to draw themselves onto a |
50 * View, and may also be editable. | 50 * View, and may also be editable. |
51 */ | 51 */ |
52 | 52 |
53 class Layer : public PropertyContainer, | 53 class Layer : public PropertyContainer, |
54 public XmlExportable | 54 public XmlExportable |
55 { | 55 { |
56 Q_OBJECT | 56 Q_OBJECT |
57 | 57 |
58 public: | 58 public: |
59 Layer(); | 59 Layer(); |
60 virtual ~Layer(); | 60 virtual ~Layer(); |
61 | 61 |
62 virtual const Model *getModel() const = 0; | 62 virtual const Model *getModel() const = 0; |
63 Model *getModel() { | 63 Model *getModel() { |
64 return const_cast<Model *>(const_cast<const Layer *>(this)->getModel()); | 64 return const_cast<Model *>(const_cast<const Layer *>(this)->getModel()); |
65 } | 65 } |
66 | 66 |
67 /** | 67 /** |
68 * Return a zoom constraint object defining the supported zoom | 68 * Return a zoom constraint object defining the supported zoom |
69 * levels for this layer. If this returns zero, the layer will | 69 * levels for this layer. If this returns zero, the layer will |
104 * so may ignore this. | 104 * so may ignore this. |
105 */ | 105 */ |
106 virtual void setSynchronousPainting(bool /* synchronous */) { } | 106 virtual void setSynchronousPainting(bool /* synchronous */) { } |
107 | 107 |
108 enum VerticalPosition { | 108 enum VerticalPosition { |
109 PositionTop, PositionMiddle, PositionBottom | 109 PositionTop, PositionMiddle, PositionBottom |
110 }; | 110 }; |
111 virtual VerticalPosition getPreferredTimeRulerPosition() const { | 111 virtual VerticalPosition getPreferredTimeRulerPosition() const { |
112 return PositionMiddle; | 112 return PositionMiddle; |
113 } | 113 } |
114 virtual VerticalPosition getPreferredFrameCountPosition() const { | 114 virtual VerticalPosition getPreferredFrameCountPosition() const { |
115 return PositionBottom; | 115 return PositionBottom; |
116 } | 116 } |
117 virtual bool hasLightBackground() const { | 117 virtual bool hasLightBackground() const { |
118 return true; | 118 return true; |
119 } | 119 } |
120 | 120 |
121 virtual QString getPropertyContainerIconName() const; | 121 virtual QString getPropertyContainerIconName() const; |
122 | 122 |
123 virtual QString getPropertyContainerName() const { | 123 virtual QString getPropertyContainerName() const { |
124 if (m_presentationName != "") return m_presentationName; | 124 if (m_presentationName != "") return m_presentationName; |
125 else return objectName(); | 125 else return objectName(); |
126 } | 126 } |
127 | 127 |
128 virtual void setPresentationName(QString name); | 128 virtual void setPresentationName(QString name); |
129 | 129 |
130 virtual QString getLayerPresentationName() const; | 130 virtual QString getLayerPresentationName() const; |
147 | 147 |
148 virtual bool nearestMeasurementRectChanged(LayerGeometryProvider *, QPoint prev, | 148 virtual bool nearestMeasurementRectChanged(LayerGeometryProvider *, QPoint prev, |
149 QPoint now) const; | 149 QPoint now) const; |
150 | 150 |
151 virtual QString getFeatureDescription(LayerGeometryProvider *, QPoint &) const { | 151 virtual QString getFeatureDescription(LayerGeometryProvider *, QPoint &) const { |
152 return ""; | 152 return ""; |
153 } | 153 } |
154 | 154 |
155 virtual QString getLabelPreceding(sv_frame_t /* frame */) const { | 155 virtual QString getLabelPreceding(sv_frame_t /* frame */) const { |
156 return ""; | 156 return ""; |
157 } | 157 } |
158 | 158 |
159 enum SnapType { | 159 enum SnapType { |
160 SnapLeft, | 160 SnapLeft, |
161 SnapRight, | 161 SnapRight, |
162 SnapNearest, | 162 SnapNearest, |
163 SnapNeighbouring | 163 SnapNeighbouring |
164 }; | 164 }; |
165 | 165 |
166 /** | 166 /** |
167 * Adjust the given frame to snap to the nearest feature, if | 167 * Adjust the given frame to snap to the nearest feature, if |
168 * possible. | 168 * possible. |
181 * accordingly. Return false if no suitable feature was available | 181 * accordingly. Return false if no suitable feature was available |
182 * (and leave frame unmodified). If returning true, also return | 182 * (and leave frame unmodified). If returning true, also return |
183 * the resolution of the model in this layer in sample frames. | 183 * the resolution of the model in this layer in sample frames. |
184 */ | 184 */ |
185 virtual bool snapToFeatureFrame(LayerGeometryProvider * /* v */, | 185 virtual bool snapToFeatureFrame(LayerGeometryProvider * /* v */, |
186 sv_frame_t & /* frame */, | 186 sv_frame_t & /* frame */, |
187 int &resolution, | 187 int &resolution, |
188 SnapType /* snap */) const { | 188 SnapType /* snap */) const { |
189 resolution = 1; | 189 resolution = 1; |
190 return false; | 190 return false; |
191 } | 191 } |
192 | 192 |
193 /** | 193 /** |
194 * Adjust the given frame to snap to the next feature that has | 194 * Adjust the given frame to snap to the next feature that has |
195 * "effectively" the same value as the feature prior to the given | 195 * "effectively" the same value as the feature prior to the given |
208 */ | 208 */ |
209 virtual bool snapToSimilarFeature(LayerGeometryProvider * /* v */, | 209 virtual bool snapToSimilarFeature(LayerGeometryProvider * /* v */, |
210 sv_frame_t & /* source frame */, | 210 sv_frame_t & /* source frame */, |
211 int &resolution, | 211 int &resolution, |
212 SnapType /* snap */) const { | 212 SnapType /* snap */) const { |
213 resolution = 1; | 213 resolution = 1; |
214 return false; | 214 return false; |
215 } | 215 } |
216 | 216 |
217 // Draw, erase, and edit modes: | 217 // Draw, erase, and edit modes: |
218 // | 218 // |
219 // Layer needs to get actual mouse events, I guess. Draw mode is | 219 // Layer needs to get actual mouse events, I guess. Draw mode is |