# HG changeset patch # User Chris Cannam # Date 1137519955 0 # Node ID 8f5b812baaeec9d46478921714dccf5cb44c8ca3 # Parent 561be41ad0832f7625e8b1b85162d6e7cbdf4e72 * Hook up SV file i/o. You can now save and load sessions. Some problems -- gain is not reloaded correctly for waveforms, reloaded panes are not properly reconnected to the panner, and no doubt plenty of others. diff -r 561be41ad083 -r 8f5b812baaee layer/SpectrogramLayer.cpp --- a/layer/SpectrogramLayer.cpp Mon Jan 16 18:04:09 2006 +0000 +++ b/layer/SpectrogramLayer.cpp Tue Jan 17 17:45:55 2006 +0000 @@ -142,6 +142,10 @@ { int deft = 0; + int throwaway; + if (!min) min = &throwaway; + if (!max) max = &throwaway; + if (name == tr("Gain")) { *min = -50; @@ -552,18 +556,9 @@ // don't need to invalidate main cache here m_pixmapCacheInvalid = true; - int formerColourRotation = m_colourRotation; - m_colourScheme = scheme; setCacheColourmap(); - int distance = formerColourRotation - m_colourRotation; - - if (distance != 0) { - rotateCacheColourmap(-distance); - m_colourRotation = formerColourRotation; - } - m_mutex.unlock(); emit layerParametersChanged(); @@ -685,6 +680,8 @@ { if (m_cacheInvalid || !m_cache) return; + int formerRotation = m_colourRotation; + m_cache->setNumColors(256); m_cache->setColor(0, qRgb(255, 255, 255)); @@ -735,11 +732,15 @@ } m_colourRotation = 0; + rotateCacheColourmap(m_colourRotation - formerRotation); + m_colourRotation = formerRotation; } void SpectrogramLayer::rotateCacheColourmap(int distance) { + if (!m_cache) return; + QRgb newPixels[256]; newPixels[0] = m_cache->color(0); @@ -914,7 +915,7 @@ MUNLOCK((void *)m_layer.m_cache, width * height); m_layer.setCacheColourmap(); - + m_layer.m_cache->fill(0); m_layer.m_mutex.unlock(); @@ -1441,13 +1442,13 @@ } if (divisor > 0.0) { - +/* int pixel = int(total / divisor); if (pixel > 255) pixel = 255; if (pixel < 1) pixel = 1; assert(x <= scaled.width()); scaled.setPixel(x, y, m_cache->color(pixel)); -/* +*/ float pixel = total / divisor; float lq = pixel - int(pixel); float hq = int(pixel) + 1 - pixel; @@ -1459,7 +1460,7 @@ qGreen(low) * lq + qGreen(high) * hq + 0.01, qBlue(low) * lq + qBlue(high) * hq + 0.01); scaled.setPixel(x, y, mixed); -*/ + } else { assert(x <= scaled.width()); scaled.setPixel(x, y, qRgb(0, 0, 0)); diff -r 561be41ad083 -r 8f5b812baaee layer/TimeInstantLayer.cpp --- a/layer/TimeInstantLayer.cpp Mon Jan 16 18:04:09 2006 +0000 +++ b/layer/TimeInstantLayer.cpp Tue Jan 17 17:45:55 2006 +0000 @@ -68,8 +68,8 @@ if (name == tr("Colour")) { - *min = 0; - *max = 5; + if (min) *min = 0; + if (max) *max = 5; if (m_colour == Qt::black) deft = 0; else if (m_colour == Qt::darkRed) deft = 1; diff -r 561be41ad083 -r 8f5b812baaee layer/TimeRulerLayer.cpp --- a/layer/TimeRulerLayer.cpp Mon Jan 16 18:04:09 2006 +0000 +++ b/layer/TimeRulerLayer.cpp Tue Jan 17 17:45:55 2006 +0000 @@ -67,8 +67,8 @@ if (name == tr("Colour")) { - *min = 0; - *max = 5; + if (min) *min = 0; + if (max) *max = 5; if (m_colour == Qt::black) deft = 0; else if (m_colour == Qt::darkRed) deft = 1; diff -r 561be41ad083 -r 8f5b812baaee layer/TimeValueLayer.cpp --- a/layer/TimeValueLayer.cpp Mon Jan 16 18:04:09 2006 +0000 +++ b/layer/TimeValueLayer.cpp Tue Jan 17 17:45:55 2006 +0000 @@ -74,8 +74,8 @@ if (name == tr("Colour")) { - *min = 0; - *max = 5; + if (min) *min = 0; + if (max) *max = 5; if (m_colour == Qt::black) deft = 0; else if (m_colour == Qt::darkRed) deft = 1; @@ -86,8 +86,8 @@ } else if (name == tr("Plot Type")) { - *min = 0; - *max = 4; + if (min) *min = 0; + if (max) *max = 4; deft = int(m_plotStyle); diff -r 561be41ad083 -r 8f5b812baaee layer/WaveformLayer.cpp --- a/layer/WaveformLayer.cpp Mon Jan 16 18:04:09 2006 +0000 +++ b/layer/WaveformLayer.cpp Tue Jan 17 17:45:55 2006 +0000 @@ -98,6 +98,10 @@ { int deft = 0; + int throwaway; + if (!min) min = &throwaway; + if (!max) max = &throwaway; + if (name == tr("Gain")) { *min = -50;