comparison base/Layer.h @ 39:e1a0cf2dcc79

* Fix a crash in PortAudio output for mono data * Don't construct a chromagram in TonalChangeDetect plugin ctor * Update layer show/hide/dormancy for multi-view-capable layers -- the dormancy concept doesn't really work with these constraints any more
author Chris Cannam
date Fri, 03 Mar 2006 17:52:21 +0000
parents 935a2419a77c
children b2d1a61ab916
comparison
equal deleted inserted replaced
38:a6b2128eed56 39:e1a0cf2dcc79
16 #include "Selection.h" 16 #include "Selection.h"
17 17
18 #include <QObject> 18 #include <QObject>
19 #include <QRect> 19 #include <QRect>
20 #include <QXmlAttributes> 20 #include <QXmlAttributes>
21
22 #include <map>
21 23
22 class ZoomConstraint; 24 class ZoomConstraint;
23 class Model; 25 class Model;
24 class QPainter; 26 class QPainter;
25 class View; 27 class View;
173 virtual int getCompletion() const { return 100; } 175 virtual int getCompletion() const { return 100; }
174 176
175 virtual void setObjectName(const QString &name); 177 virtual void setObjectName(const QString &name);
176 178
177 /** 179 /**
178 * Return the pixel x-coordinate corresponding to a given sample
179 * frame (which may be negative).
180 */
181 // int getXForFrame(long frame) const;
182
183 /**
184 * Return the closest frame to the given pixel x-coordinate.
185 */
186 // long getFrameForX(int x) const;
187
188 /**
189 * Convert the layer's data (though not those of the model it 180 * Convert the layer's data (though not those of the model it
190 * refers to) into an XML string for file output. This class 181 * refers to) into an XML string for file output. This class
191 * implements the basic name/type/model-id output; subclasses will 182 * implements the basic name/type/model-id output; subclasses will
192 * typically call this superclass implementation with extra 183 * typically call this superclass implementation with extra
193 * attributes describing their particular properties. 184 * attributes describing their particular properties.
201 * inverse of the toXmlString method. 192 * inverse of the toXmlString method.
202 */ 193 */
203 virtual void setProperties(const QXmlAttributes &) = 0; 194 virtual void setProperties(const QXmlAttributes &) = 0;
204 195
205 /** 196 /**
206 * Indicate that a layer is not currently visible and is not 197 * Indicate that a layer is not currently visible in the given
207 * expected to become visible in the near future (for example 198 * view and is not expected to become visible in the near future
208 * because the user has explicitly removed or hidden it). The 199 * (for example because the user has explicitly removed or hidden
209 * layer may respond by (for example) freeing any cache memory it 200 * it). The layer may respond by (for example) freeing any cache
210 * is using, until next time its paint method is called. It does 201 * memory it is using, until next time its paint method is called.
211 * not need to remember not to draw itself; the view will handle 202 * It does not need to remember not to draw itself; the view will
212 * that. 203 * handle that.
213 */ 204 */
214 //!!! update for multiview 205 virtual void setLayerDormant(const View *v, bool dormant) {
215 virtual void setLayerDormant(const View *, bool dormant) { m_dormant = dormant; } 206 m_dormancy[v] = dormant;
216 207 }
217 /** 208
218 * Return whether the layer is dormant (i.e. hidden). 209 /**
219 */ 210 * Return whether the layer is dormant (i.e. hidden) in the given
220 //!!! update for multiview 211 * view.
221 virtual bool isLayerDormant(const View *) const { return m_dormant; } 212 */
213 virtual bool isLayerDormant(const View *v) const {
214 if (m_dormancy.find(v) == m_dormancy.end()) return false;
215 return m_dormancy.find(v)->second;
216 }
222 217
223 virtual PlayParameters *getPlayParameters(); 218 virtual PlayParameters *getPlayParameters();
224 219
225 public slots: 220 public slots:
226 //!!! update for multiview
227 void showLayer(View *, bool show); 221 void showLayer(View *, bool show);
228 222
229 signals: 223 signals:
230 void modelChanged(); 224 void modelChanged();
231 void modelCompletionChanged(); 225 void modelCompletionChanged();
234 228
235 void layerParametersChanged(); 229 void layerParametersChanged();
236 void layerNameChanged(); 230 void layerNameChanged();
237 231
238 protected: 232 protected:
239 // View *m_view; 233 std::map<const void *, bool> m_dormancy;
240 bool m_dormant;
241 }; 234 };
242 235
243 #endif 236 #endif
244 237