# HG changeset patch # User Chris Cannam # Date 1139421556 0 # Node ID 9f55af9676b4dc3854e3a941d4e90900b737151c # Parent 202d1dca67d2f47ef3cb190ea75c26dfd1949daf * Add ffwd/rewind * Abstract out MultiSelection diff -r 202d1dca67d2 -r 9f55af9676b4 layer/SpectrogramLayer.cpp --- a/layer/SpectrogramLayer.cpp Mon Feb 06 17:24:52 2006 +0000 +++ b/layer/SpectrogramLayer.cpp Wed Feb 08 17:59:16 2006 +0000 @@ -49,6 +49,7 @@ m_fillThread(0), m_updateTimer(0), m_lastFillExtent(0), + m_dormant(false), m_exiting(false) { if (config == MelodicRange) { @@ -594,6 +595,19 @@ } void +SpectrogramLayer::setLayerDormant() +{ + m_mutex.lock(); + m_dormant = true; + delete m_cache; + m_cache = 0; + m_pixmapCacheInvalid = true; + delete m_pixmapCache; + m_pixmapCache = 0; + m_mutex.unlock(); +} + +void SpectrogramLayer::cacheInvalid() { m_cacheInvalid = true; @@ -866,7 +880,7 @@ // std::cerr << "SpectrogramLayer::CacheFillThread::run in loop" << std::endl; - if (m_layer.m_model && m_layer.m_cacheInvalid) { + if (m_layer.m_model && m_layer.m_cacheInvalid && !m_layer.m_dormant) { // std::cerr << "SpectrogramLayer::CacheFillThread::run: something to do" << std::endl; @@ -1222,6 +1236,13 @@ return; } + if (m_dormant) { + std::cerr << "SpectrogramLayer::paint(): Layer is dormant, de-hibernating" << std::endl; + m_dormant = false; + ((SpectrogramLayer *)this)->fillCache(); + return; + } + #ifdef DEBUG_SPECTROGRAM_REPAINT std::cerr << "SpectrogramLayer::paint(): About to lock" << std::endl; #endif diff -r 202d1dca67d2 -r 9f55af9676b4 layer/SpectrogramLayer.h --- a/layer/SpectrogramLayer.h Mon Feb 06 17:24:52 2006 +0000 +++ b/layer/SpectrogramLayer.h Wed Feb 08 17:59:16 2006 +0000 @@ -140,6 +140,8 @@ void setProperties(const QXmlAttributes &attributes); + void setLayerDormant(); + protected slots: void cacheInvalid(); void cacheInvalid(size_t startFrame, size_t endFrame); @@ -193,6 +195,7 @@ QTimer *m_updateTimer; size_t m_lastFillExtent; bool m_cachedInitialVisibleArea; + mutable bool m_dormant; bool m_exiting; void setCacheColourmap();