Mercurial > hg > svgui
diff layer/LayerFactory.cpp @ 35:10ba9276a315
* Add TextModel and TextLayer types
* Make View refresh work better when editing a model (previously edits might
not be refreshed if their visible changed area extended beyond the strict
frame range that was being modified in the model)
* Add phase-adjusted instantaneous frequency display to spectrogram layer
(still a work in progress)
* Pull maths aliases out into a separate header in dsp/maths so MathUtilities
can be included without introducing them
author | Chris Cannam |
---|---|
date | Mon, 20 Feb 2006 13:33:36 +0000 |
parents | ea6fe8cfcdd5 |
children | 21d061e66177 |
line wrap: on
line diff
--- a/layer/LayerFactory.cpp Fri Feb 17 18:11:08 2006 +0000 +++ b/layer/LayerFactory.cpp Mon Feb 20 13:33:36 2006 +0000 @@ -15,6 +15,7 @@ #include "TimeInstantLayer.h" #include "TimeValueLayer.h" #include "NoteLayer.h" +#include "TextLayer.h" #include "Colour3DPlotLayer.h" #include "model/RangeSummarisableTimeValueModel.h" @@ -22,6 +23,7 @@ #include "model/SparseOneDimensionalModel.h" #include "model/SparseTimeValueModel.h" #include "model/NoteModel.h" +#include "model/TextModel.h" #include "model/DenseThreeDimensionalModel.h" LayerFactory * @@ -47,6 +49,7 @@ case TimeInstants: return Layer::tr("Time Instants"); case TimeValues: return Layer::tr("Time Values"); case Notes: return Layer::tr("Notes"); + case Text: return Layer::tr("Text"); case Colour3DPlot: return Layer::tr("Colour 3D Plot"); case MelodicRangeSpectrogram: @@ -85,10 +88,14 @@ if (dynamic_cast<SparseTimeValueModel *>(model)) { types.insert(TimeValues); + +} + if (dynamic_cast<NoteModel *>(model)) { + types.insert(Notes); } - if (dynamic_cast<NoteModel *>(model)) { - types.insert(Notes); + if (dynamic_cast<TextModel *>(model)) { + types.insert(Text); } // We don't count TimeRuler here as it doesn't actually display @@ -104,6 +111,7 @@ types.insert(TimeInstants); types.insert(TimeValues); types.insert(Notes); + types.insert(Text); //!!! and in principle Colour3DPlot -- now that's a challenge return types; } @@ -117,6 +125,7 @@ if (dynamic_cast<const TimeInstantLayer *>(layer)) return TimeInstants; if (dynamic_cast<const TimeValueLayer *>(layer)) return TimeValues; if (dynamic_cast<const NoteLayer *>(layer)) return Notes; + if (dynamic_cast<const TextLayer *>(layer)) return Text; if (dynamic_cast<const Colour3DPlotLayer *>(layer)) return Colour3DPlot; return UnknownLayer; } @@ -131,6 +140,7 @@ case TimeInstants: return "instants"; case TimeValues: return "values"; case Notes: return "notes"; + case Text: return "text"; case Colour3DPlot: return "colour3d"; default: return "unknown"; } @@ -146,6 +156,7 @@ case TimeInstants: return "timeinstants"; case TimeValues: return "timevalues"; case Notes: return "notes"; + case Text: return "text"; case Colour3DPlot: return "colour3dplot"; default: return "unknown"; } @@ -160,6 +171,7 @@ if (name == "timeinstants") return TimeInstants; if (name == "timevalues") return TimeValues; if (name == "notes") return Notes; + if (name == "text") return Text; if (name == "colour3dplot") return Colour3DPlot; return UnknownLayer; } @@ -185,6 +197,9 @@ if (trySetModel<NoteLayer, NoteModel>(layer, model)) return; + if (trySetModel<TextLayer, TextModel>(layer, model)) + return; + if (trySetModel<Colour3DPlotLayer, DenseThreeDimensionalModel>(layer, model)) return; @@ -203,6 +218,8 @@ } else if (layerType == Notes) { return new NoteModel(baseModel->getSampleRate(), 1, 0.0, 0.0, true); + } else if (layerType == Text) { + return new TextModel(baseModel->getSampleRate(), 1, true); } else { return 0; } @@ -242,6 +259,10 @@ layer = new NoteLayer(view); break; + case Text: + layer = new TextLayer(view); + break; + case Colour3DPlot: layer = new Colour3DPlotLayer(view); break;