Mercurial > hg > svgui
diff layer/LayerFactory.cpp @ 771:a964151832a7
Merge from branch tony_integration
author | Chris Cannam |
---|---|
date | Wed, 14 May 2014 09:54:34 +0100 |
parents | 6a8d922f991d |
children | c2291e22bf0c |
line wrap: on
line diff
--- a/layer/LayerFactory.cpp Sat Apr 12 01:07:05 2014 -0700 +++ b/layer/LayerFactory.cpp Wed May 14 09:54:34 2014 +0100 @@ -21,6 +21,7 @@ #include "TimeInstantLayer.h" #include "TimeValueLayer.h" #include "NoteLayer.h" +#include "FlexiNoteLayer.h" #include "RegionLayer.h" #include "TextLayer.h" #include "ImageLayer.h" @@ -36,6 +37,7 @@ #include "data/model/SparseOneDimensionalModel.h" #include "data/model/SparseTimeValueModel.h" #include "data/model/NoteModel.h" +#include "data/model/FlexiNoteModel.h" #include "data/model/RegionModel.h" #include "data/model/TextModel.h" #include "data/model/ImageModel.h" @@ -73,6 +75,7 @@ case TimeInstants: return Layer::tr("Time Instants"); case TimeValues: return Layer::tr("Time Values"); case Notes: return Layer::tr("Notes"); + case FlexiNotes: return Layer::tr("Flexible Notes"); case Regions: return Layer::tr("Regions"); case Text: return Layer::tr("Text"); case Image: return Layer::tr("Images"); @@ -161,6 +164,11 @@ types.insert(Notes); } + // NOTE: GF: types is a set, so order of insertion does not matter + if (dynamic_cast<FlexiNoteModel *>(model)) { + types.insert(FlexiNotes); + } + if (dynamic_cast<RegionModel *>(model)) { types.insert(Regions); } @@ -189,6 +197,7 @@ LayerTypeSet types; types.insert(TimeInstants); types.insert(TimeValues); + types.insert(FlexiNotes); types.insert(Notes); types.insert(Regions); types.insert(Text); @@ -205,6 +214,7 @@ if (dynamic_cast<const TimeRulerLayer *>(layer)) return TimeRuler; if (dynamic_cast<const TimeInstantLayer *>(layer)) return TimeInstants; if (dynamic_cast<const TimeValueLayer *>(layer)) return TimeValues; + if (dynamic_cast<const FlexiNoteLayer *>(layer)) return FlexiNotes; if (dynamic_cast<const NoteLayer *>(layer)) return Notes; if (dynamic_cast<const RegionLayer *>(layer)) return Regions; if (dynamic_cast<const TextLayer *>(layer)) return Text; @@ -225,6 +235,7 @@ case TimeInstants: return "instants"; case TimeValues: return "values"; case Notes: return "notes"; + case FlexiNotes: return "flexinotes"; case Regions: return "regions"; case Text: return "text"; case Image: return "image"; @@ -247,6 +258,7 @@ case TimeInstants: return "timeinstants"; case TimeValues: return "timevalues"; case Notes: return "notes"; + case FlexiNotes: return "flexinotes"; case Regions: return "regions"; case Text: return "text"; case Image: return "image"; @@ -267,7 +279,7 @@ if (name == "timeruler") return TimeRuler; if (name == "timeinstants") return TimeInstants; if (name == "timevalues") return TimeValues; - if (name == "notes") return Notes; + if (name == "flexinotes") return FlexiNotes; if (name == "regions") return Regions; if (name == "text") return Text; if (name == "image") return Image; @@ -282,7 +294,7 @@ { // if (trySetModel<WaveformLayer, RangeSummarisableTimeValueModel>(layer, model)) // return; - + if (trySetModel<WaveformLayer, WaveFileModel>(layer, model)) return; @@ -301,9 +313,13 @@ if (trySetModel<TimeValueLayer, SparseTimeValueModel>(layer, model)) return; - if (trySetModel<NoteLayer, NoteModel>(layer, model)) - return; + if (trySetModel<NoteLayer, NoteModel>(layer, model)) + return; + // GF: added FlexiNoteLayer + if (trySetModel<FlexiNoteLayer, FlexiNoteModel>(layer, model)) + return; + if (trySetModel<RegionLayer, RegionModel>(layer, model)) return; @@ -333,6 +349,8 @@ return new SparseOneDimensionalModel(baseModel->getSampleRate(), 1); } else if (layerType == TimeValues) { return new SparseTimeValueModel(baseModel->getSampleRate(), 1, true); + } else if (layerType == FlexiNotes) { + return new FlexiNoteModel(baseModel->getSampleRate(), 1, true); } else if (layerType == Notes) { return new NoteModel(baseModel->getSampleRate(), 1, true); } else if (layerType == Regions) { @@ -402,6 +420,10 @@ layer = new TimeValueLayer; break; + case FlexiNotes: + layer = new FlexiNoteLayer; + break; + case Notes: layer = new NoteLayer; break;