Mercurial > hg > svgui
comparison layer/LayerFactory.cpp @ 44:ad214997dddb
* Refactor Layer classes so as no longer to store a single View pointer;
instead they need to be able to draw themselves on any View on demand.
Layers with caches (e.g. spectrogram) will need to be further refactored
so as to maintain a per-View cache
* Begin refactoring MainWindow by pulling out the document stuff (set of
layers, models etc) into a Document class. Not yet in use.
This revision is fairly unstable.
author | Chris Cannam |
---|---|
date | Thu, 02 Mar 2006 16:58:49 +0000 |
parents | 21d061e66177 |
children | f2fe98a7c57e |
comparison
equal
deleted
inserted
replaced
43:78515b1e29eb | 44:ad214997dddb |
---|---|
229 return 0; | 229 return 0; |
230 } | 230 } |
231 } | 231 } |
232 | 232 |
233 Layer * | 233 Layer * |
234 LayerFactory::createLayer(LayerType type, View *view, | 234 LayerFactory::createLayer(LayerType type, Model *model, int channel) |
235 Model *model, int channel) | |
236 { | 235 { |
237 Layer *layer = 0; | 236 Layer *layer = 0; |
238 | 237 |
239 switch (type) { | 238 switch (type) { |
240 | 239 |
241 case Waveform: | 240 case Waveform: |
242 layer = new WaveformLayer(view); | 241 layer = new WaveformLayer; |
243 static_cast<WaveformLayer *>(layer)->setChannel(channel); | 242 static_cast<WaveformLayer *>(layer)->setChannel(channel); |
244 break; | 243 break; |
245 | 244 |
246 case Spectrogram: | 245 case Spectrogram: |
247 layer = new SpectrogramLayer(view); | 246 layer = new SpectrogramLayer; |
248 static_cast<SpectrogramLayer *>(layer)->setChannel(channel); | 247 static_cast<SpectrogramLayer *>(layer)->setChannel(channel); |
249 break; | 248 break; |
250 | 249 |
251 case TimeRuler: | 250 case TimeRuler: |
252 layer = new TimeRulerLayer(view); | 251 layer = new TimeRulerLayer; |
253 break; | 252 break; |
254 | 253 |
255 case TimeInstants: | 254 case TimeInstants: |
256 layer = new TimeInstantLayer(view); | 255 layer = new TimeInstantLayer; |
257 break; | 256 break; |
258 | 257 |
259 case TimeValues: | 258 case TimeValues: |
260 layer = new TimeValueLayer(view); | 259 layer = new TimeValueLayer; |
261 break; | 260 break; |
262 | 261 |
263 case Notes: | 262 case Notes: |
264 layer = new NoteLayer(view); | 263 layer = new NoteLayer; |
265 break; | 264 break; |
266 | 265 |
267 case Text: | 266 case Text: |
268 layer = new TextLayer(view); | 267 layer = new TextLayer; |
269 break; | 268 break; |
270 | 269 |
271 case Colour3DPlot: | 270 case Colour3DPlot: |
272 layer = new Colour3DPlotLayer(view); | 271 layer = new Colour3DPlotLayer; |
273 break; | 272 break; |
274 | 273 |
275 case MelodicRangeSpectrogram: | 274 case MelodicRangeSpectrogram: |
276 layer = new SpectrogramLayer(view, SpectrogramLayer::MelodicRange); | 275 layer = new SpectrogramLayer(SpectrogramLayer::MelodicRange); |
277 static_cast<SpectrogramLayer *>(layer)->setChannel(channel); | 276 static_cast<SpectrogramLayer *>(layer)->setChannel(channel); |
278 break; | 277 break; |
279 | 278 |
280 case PeakFrequencySpectrogram: | 279 case PeakFrequencySpectrogram: |
281 layer = new SpectrogramLayer(view, SpectrogramLayer::MelodicPeaks); | 280 layer = new SpectrogramLayer(SpectrogramLayer::MelodicPeaks); |
282 static_cast<SpectrogramLayer *>(layer)->setChannel(channel); | 281 static_cast<SpectrogramLayer *>(layer)->setChannel(channel); |
283 break; | 282 break; |
284 | 283 |
285 default: break; | 284 default: break; |
286 } | 285 } |