# HG changeset patch # User Chris Cannam # Date 1142446283 0 # Node ID 68869408f5c7ea9c231fc50c56e203283404758a # Parent f2fe98a7c57e601808e95d546f752ee1f156efc8 * Restore proper channel selection support for new layers * Use binary mode for SV file I/O on Windows * Commands for selection diff -r f2fe98a7c57e -r 68869408f5c7 layer/LayerFactory.cpp --- 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(layer)) { + return dynamic_cast(layer)->getChannel(); + } + if (dynamic_cast(layer)) { + return dynamic_cast(layer)->getChannel(); + } + return -1; +} + +void +LayerFactory::setChannel(Layer *layer, int channel) +{ + if (dynamic_cast(layer)) { + dynamic_cast(layer)->setChannel(channel); + return; + } + if (dynamic_cast(layer)) { + dynamic_cast(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(layer)->setChannel(channel); break; case Spectrogram: layer = new SpectrogramLayer; - static_cast(layer)->setChannel(channel); break; case TimeRuler: @@ -273,12 +296,10 @@ case MelodicRangeSpectrogram: layer = new SpectrogramLayer(SpectrogramLayer::MelodicRange); - static_cast(layer)->setChannel(channel); break; case PeakFrequencySpectrogram: layer = new SpectrogramLayer(SpectrogramLayer::MelodicPeaks); - static_cast(layer)->setChannel(channel); break; default: break; diff -r f2fe98a7c57e -r 68869408f5c7 layer/LayerFactory.h --- 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);