comparison layer/LayerFactory.cpp @ 373:0895517bb2d1 1.2-stable

* merge from trunk (1.2 ended up being tracked from trunk, but we may want this branch for fixes later)
author Chris Cannam
date Wed, 27 Feb 2008 10:32:45 +0000
parents 4a542ba875c2
children
comparison
equal deleted inserted replaced
337:813170c57b13 373:0895517bb2d1
25 #include "ImageLayer.h" 25 #include "ImageLayer.h"
26 #include "Colour3DPlotLayer.h" 26 #include "Colour3DPlotLayer.h"
27 #include "SpectrumLayer.h" 27 #include "SpectrumLayer.h"
28 #include "SliceLayer.h" 28 #include "SliceLayer.h"
29 #include "SliceableLayer.h" 29 #include "SliceableLayer.h"
30
31 #include "base/Clipboard.h"
30 32
31 #include "data/model/RangeSummarisableTimeValueModel.h" 33 #include "data/model/RangeSummarisableTimeValueModel.h"
32 #include "data/model/DenseTimeValueModel.h" 34 #include "data/model/DenseTimeValueModel.h"
33 #include "data/model/SparseOneDimensionalModel.h" 35 #include "data/model/SparseOneDimensionalModel.h"
34 #include "data/model/SparseTimeValueModel.h" 36 #include "data/model/SparseTimeValueModel.h"
346 dynamic_cast<WaveformLayer *>(layer)->setChannel(channel); 348 dynamic_cast<WaveformLayer *>(layer)->setChannel(channel);
347 return; 349 return;
348 } 350 }
349 if (dynamic_cast<SpectrogramLayer *>(layer)) { 351 if (dynamic_cast<SpectrogramLayer *>(layer)) {
350 dynamic_cast<SpectrogramLayer *>(layer)->setChannel(channel); 352 dynamic_cast<SpectrogramLayer *>(layer)->setChannel(channel);
353 return;
354 }
355 if (dynamic_cast<SpectrumLayer *>(layer)) {
356 dynamic_cast<SpectrumLayer *>(layer)->setChannel(channel);
351 return; 357 return;
352 } 358 }
353 } 359 }
354 360
355 Layer * 361 Layer *
476 } 482 }
477 483
478 settings.endGroup(); 484 settings.endGroup();
479 } 485 }
480 486
487 LayerFactory::LayerType
488 LayerFactory::getLayerTypeForClipboardContents(const Clipboard &clip)
489 {
490 const Clipboard::PointList &contents = clip.getPoints();
491
492 bool haveFrame = false;
493 bool haveValue = false;
494 bool haveDuration = false;
495
496 for (Clipboard::PointList::const_iterator i = contents.begin();
497 i != contents.end(); ++i) {
498 if (i->haveFrame()) haveFrame = true;
499 if (i->haveValue()) haveValue = true;
500 if (i->haveDuration()) haveDuration = true;
501 }
502
503 if (haveFrame && haveValue && haveDuration) return Notes;
504 if (haveFrame && haveValue) return TimeValues;
505 return TimeInstants;
506 }
507