Mercurial > hg > svgui
changeset 29:9f55af9676b4
* Add ffwd/rewind
* Abstract out MultiSelection
author | Chris Cannam |
---|---|
date | Wed, 08 Feb 2006 17:59:16 +0000 |
parents | 202d1dca67d2 |
children | ea6fe8cfcdd5 |
files | layer/SpectrogramLayer.cpp layer/SpectrogramLayer.h |
diffstat | 2 files changed, 25 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- 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
--- 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();