Mercurial > hg > svgui
changeset 53:68869408f5c7
* Restore proper channel selection support for new layers
* Use binary mode for SV file I/O on Windows
* Commands for selection
author | Chris Cannam |
---|---|
date | Wed, 15 Mar 2006 18:11:23 +0000 |
parents | f2fe98a7c57e |
children | 8dae7f6732c1 |
files | layer/LayerFactory.cpp layer/LayerFactory.h |
diffstat | 2 files changed, 30 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/layer/LayerFactory.cpp Mon Mar 13 17:55:19 2006 +0000 +++ b/layer/LayerFactory.cpp Wed Mar 15 18:11:23 2006 +0000 @@ -230,8 +230,33 @@ } } +int +LayerFactory::getChannel(Layer *layer) +{ + if (dynamic_cast<WaveformLayer *>(layer)) { + return dynamic_cast<WaveformLayer *>(layer)->getChannel(); + } + if (dynamic_cast<SpectrogramLayer *>(layer)) { + return dynamic_cast<SpectrogramLayer *>(layer)->getChannel(); + } + return -1; +} + +void +LayerFactory::setChannel(Layer *layer, int channel) +{ + if (dynamic_cast<WaveformLayer *>(layer)) { + dynamic_cast<WaveformLayer *>(layer)->setChannel(channel); + return; + } + if (dynamic_cast<SpectrogramLayer *>(layer)) { + dynamic_cast<SpectrogramLayer *>(layer)->setChannel(channel); + return; + } +} + Layer * -LayerFactory::createLayer(LayerType type, int channel) +LayerFactory::createLayer(LayerType type) { Layer *layer = 0; @@ -239,12 +264,10 @@ case Waveform: layer = new WaveformLayer; - static_cast<WaveformLayer *>(layer)->setChannel(channel); break; case Spectrogram: layer = new SpectrogramLayer; - static_cast<SpectrogramLayer *>(layer)->setChannel(channel); break; case TimeRuler: @@ -273,12 +296,10 @@ case MelodicRangeSpectrogram: layer = new SpectrogramLayer(SpectrogramLayer::MelodicRange); - static_cast<SpectrogramLayer *>(layer)->setChannel(channel); break; case PeakFrequencySpectrogram: layer = new SpectrogramLayer(SpectrogramLayer::MelodicPeaks); - static_cast<SpectrogramLayer *>(layer)->setChannel(channel); break; default: break;
--- a/layer/LayerFactory.h Mon Mar 13 17:55:19 2006 +0000 +++ b/layer/LayerFactory.h Wed Mar 15 18:11:23 2006 +0000 @@ -49,13 +49,16 @@ LayerType getLayerType(const Layer *); - Layer *createLayer(LayerType type, int channel = -1); + Layer *createLayer(LayerType type); QString getLayerPresentationName(LayerType type); void setModel(Layer *layer, Model *model); Model *createEmptyModel(LayerType type, Model *baseModel); + int getChannel(Layer *layer); + void setChannel(Layer *layer, int channel); + QString getLayerIconName(LayerType); QString getLayerTypeName(LayerType); LayerType getLayerTypeForName(QString);