# HG changeset patch # User Chris Cannam # Date 1160046186 0 # Node ID b32282fefccd04e552ef529035ad2d0471436fa1 # Parent 8c730f49b9b31a72631ed702afeb446527c464a2 * Tidy up inheritance hierarchy of model classes -- remove ZoomConstraint as a base class (make it a member instead) and remove virtual inheritances of QObject (no longer necessary). diff -r 8c730f49b9b3 -r b32282fefccd layer/Colour3DPlotLayer.h --- a/layer/Colour3DPlotLayer.h Wed Oct 04 14:01:28 2006 +0000 +++ b/layer/Colour3DPlotLayer.h Thu Oct 05 11:03:06 2006 +0000 @@ -45,7 +45,9 @@ Colour3DPlotLayer(); ~Colour3DPlotLayer(); - virtual const ZoomConstraint *getZoomConstraint() const { return m_model; } + virtual const ZoomConstraint *getZoomConstraint() const { + return m_model ? m_model->getZoomConstraint() : 0; + } virtual const Model *getModel() const { return m_model; } virtual void paint(View *v, QPainter &paint, QRect rect) const; diff -r 8c730f49b9b3 -r b32282fefccd layer/LayerFactory.cpp --- a/layer/LayerFactory.cpp Wed Oct 04 14:01:28 2006 +0000 +++ b/layer/LayerFactory.cpp Thu Oct 05 11:03:06 2006 +0000 @@ -32,6 +32,8 @@ #include "data/model/NoteModel.h" #include "data/model/TextModel.h" #include "data/model/DenseThreeDimensionalModel.h" +#include "data/model/WaveFileModel.h" +#include "data/model/WritableWaveFileModel.h" LayerFactory * LayerFactory::m_instance = new LayerFactory; @@ -200,7 +202,13 @@ void LayerFactory::setModel(Layer *layer, Model *model) { - if (trySetModel(layer, model)) +// if (trySetModel(layer, model)) +// return; + + if (trySetModel(layer, model)) + return; + + if (trySetModel(layer, model)) return; if (trySetModel(layer, model)) diff -r 8c730f49b9b3 -r b32282fefccd layer/WaveformLayer.h --- a/layer/WaveformLayer.h Wed Oct 04 14:01:28 2006 +0000 +++ b/layer/WaveformLayer.h Thu Oct 05 11:03:06 2006 +0000 @@ -35,7 +35,9 @@ WaveformLayer(); ~WaveformLayer(); - virtual const ZoomConstraint *getZoomConstraint() const { return m_model; } + virtual const ZoomConstraint *getZoomConstraint() const { + return m_model ? m_model->getZoomConstraint() : 0; + } virtual const Model *getModel() const { return m_model; } virtual void paint(View *v, QPainter &paint, QRect rect) const;