diff layer/LayerFactory.cpp @ 133:9e6b3e239b9d

* Add zoom thumbwheels to Pane. Implement horizontal thumbwheel, and vertical depending on layer type (supported for waveform and spectrogram, though wrong for log-scale spectrogram at the moment). * Add bare bones of a spectrum layer. * Add window icon * Add shortcut for "insert time instant" on laptops without keypad enter (";") * Delete FFT processing thread when it exits (at least, next time we're asked for something interesting) * Get audio file extensions from the file readers, and thus from libsndfile for the wave file reader -- leads to rather a wide combo box in file dialog though * Better refresh order for spectrogram (redraw centre section first)
author Chris Cannam
date Fri, 04 Aug 2006 17:01:37 +0000
parents 33929e0c3c6b
children b32282fefccd
line wrap: on
line diff
--- a/layer/LayerFactory.cpp	Thu Aug 03 15:40:11 2006 +0000
+++ b/layer/LayerFactory.cpp	Fri Aug 04 17:01:37 2006 +0000
@@ -23,6 +23,7 @@
 #include "NoteLayer.h"
 #include "TextLayer.h"
 #include "Colour3DPlotLayer.h"
+#include "SpectrumLayer.h"
 
 #include "data/model/RangeSummarisableTimeValueModel.h"
 #include "data/model/DenseTimeValueModel.h"
@@ -57,6 +58,7 @@
     case Notes:        return Layer::tr("Notes");
     case Text:         return Layer::tr("Text");
     case Colour3DPlot: return Layer::tr("Colour 3D Plot");
+    case Spectrum:     return Layer::tr("Spectrum");
 
     case MelodicRangeSpectrogram:
 	// The user can change all the parameters of this after the
@@ -109,6 +111,10 @@
 	types.insert(Text);
     }
 
+    if (dynamic_cast<DenseTimeValueModel *>(model)) {
+        types.insert(Spectrum);
+    }
+
     // We don't count TimeRuler here as it doesn't actually display
     // the data, although it can be backed by any model
 
@@ -138,6 +144,7 @@
     if (dynamic_cast<const NoteLayer *>(layer)) return Notes;
     if (dynamic_cast<const TextLayer *>(layer)) return Text;
     if (dynamic_cast<const Colour3DPlotLayer *>(layer)) return Colour3DPlot;
+    if (dynamic_cast<const SpectrumLayer *>(layer)) return Spectrum;
     return UnknownLayer;
 }
 
@@ -153,6 +160,7 @@
     case Notes: return "notes";
     case Text: return "text";
     case Colour3DPlot: return "colour3d";
+    case Spectrum: return "spectrum";
     default: return "unknown";
     }
 }
@@ -169,6 +177,7 @@
     case Notes: return "notes";
     case Text: return "text";
     case Colour3DPlot: return "colour3dplot";
+    case Spectrum: return "spectrum";
     default: return "unknown";
     }
 }
@@ -184,6 +193,7 @@
     if (name == "notes") return Notes;
     if (name == "text") return Text;
     if (name == "colour3dplot") return Colour3DPlot;
+    if (name == "spectrum") return Spectrum;
     return UnknownLayer;
 }
 
@@ -216,6 +226,9 @@
 
     if (trySetModel<SpectrogramLayer, DenseTimeValueModel>(layer, model))
 	return;
+
+    if (trySetModel<SpectrumLayer, DenseTimeValueModel>(layer, model)) 
+        return;
 }
 
 Model *
@@ -300,6 +313,10 @@
 	layer = new Colour3DPlotLayer;
 	break;
 
+    case Spectrum:
+        layer = new SpectrumLayer;
+        break;
+
     case MelodicRangeSpectrogram: 
 	layer = new SpectrogramLayer(SpectrogramLayer::MelodicRange);
 	break;