comparison layer/Layer.h @ 131:eaae73b6bd28

* Suspend/resume fft data server write activity while reading from a server to repaint the spectrogram display. Makes a significant improvement to the otherwise dreadful responsiveness of spectrogram display.
author Chris Cannam
date Thu, 03 Aug 2006 12:42:15 +0000
parents 33929e0c3c6b
children 9e6b3e239b9d
comparison
equal deleted inserted replaced
130:10eec0da9efe 131:eaae73b6bd28
22 #include "base/Selection.h" 22 #include "base/Selection.h"
23 23
24 #include <QObject> 24 #include <QObject>
25 #include <QRect> 25 #include <QRect>
26 #include <QXmlAttributes> 26 #include <QXmlAttributes>
27 #include <QMutex>
27 28
28 #include <map> 29 #include <map>
29 30
30 class ZoomConstraint; 31 class ZoomConstraint;
31 class Model; 32 class Model;
224 * view and is not expected to become visible in the near future 225 * view and is not expected to become visible in the near future
225 * (for example because the user has explicitly removed or hidden 226 * (for example because the user has explicitly removed or hidden
226 * it). The layer may respond by (for example) freeing any cache 227 * it). The layer may respond by (for example) freeing any cache
227 * memory it is using, until next time its paint method is called, 228 * memory it is using, until next time its paint method is called,
228 * when it should set itself un-dormant again. 229 * when it should set itself un-dormant again.
229 */ 230 *
230 virtual void setLayerDormant(const View *v, bool dormant) { 231 * A layer class that overrides this function must also call this
231 m_dormancy[v] = dormant; 232 * class's implementation.
232 } 233 */
234 virtual void setLayerDormant(const View *v, bool dormant);
233 235
234 /** 236 /**
235 * Return whether the layer is dormant (i.e. hidden) in the given 237 * Return whether the layer is dormant (i.e. hidden) in the given
236 * view. 238 * view.
237 */ 239 */
238 virtual bool isLayerDormant(const View *v) const { 240 virtual bool isLayerDormant(const View *v) const;
239 if (m_dormancy.find(v) == m_dormancy.end()) return false;
240 return m_dormancy.find(v)->second;
241 }
242 241
243 virtual PlayParameters *getPlayParameters(); 242 virtual PlayParameters *getPlayParameters();
244 243
245 virtual bool needsTextLabelHeight() const { return false; } 244 virtual bool needsTextLabelHeight() const { return false; }
246 245
291 void modelReplaced(); 290 void modelReplaced();
292 291
293 void layerParametersChanged(); 292 void layerParametersChanged();
294 void layerNameChanged(); 293 void layerNameChanged();
295 294
296 protected: 295 private:
296 mutable QMutex m_dormancyMutex;
297 mutable std::map<const void *, bool> m_dormancy; 297 mutable std::map<const void *, bool> m_dormancy;
298 }; 298 };
299 299
300 #endif 300 #endif
301 301