Mercurial > hg > svgui
diff layer/LayerFactory.cpp @ 360:d58701996fae
* Update remaining editable layers to support proper realignment on copy/paste
* Permit pasting when no suitable layer is current: create a new layer on paste
* Add preference for showing the splash screen or not
* Rename spectrogram smoothing prefs (partly following Craig's suggestions)
author | Chris Cannam |
---|---|
date | Wed, 06 Feb 2008 14:15:09 +0000 |
parents | 369a197737c7 |
children | 96e4d7b9e165 |
line wrap: on
line diff
--- a/layer/LayerFactory.cpp Wed Feb 06 12:49:49 2008 +0000 +++ b/layer/LayerFactory.cpp Wed Feb 06 14:15:09 2008 +0000 @@ -28,6 +28,8 @@ #include "SliceLayer.h" #include "SliceableLayer.h" +#include "base/Clipboard.h" + #include "data/model/RangeSummarisableTimeValueModel.h" #include "data/model/DenseTimeValueModel.h" #include "data/model/SparseOneDimensionalModel.h" @@ -482,3 +484,24 @@ settings.endGroup(); } +LayerFactory::LayerType +LayerFactory::getLayerTypeForClipboardContents(const Clipboard &clip) +{ + const Clipboard::PointList &contents = clip.getPoints(); + + bool haveFrame = false; + bool haveValue = false; + bool haveDuration = false; + + for (Clipboard::PointList::const_iterator i = contents.begin(); + i != contents.end(); ++i) { + if (i->haveFrame()) haveFrame = true; + if (i->haveValue()) haveValue = true; + if (i->haveDuration()) haveDuration = true; + } + + if (haveFrame && haveValue && haveDuration) return Notes; + if (haveFrame && haveValue) return TimeValues; + return TimeInstants; +} +