# HG changeset patch # User Chris Cannam # Date 1429524048 -3600 # Node ID e3c7da3d896e722b0ade45a422a97971de68558b # Parent 8bf05426d950651fec612b3297632395171648c7# Parent e53a87a5efb2fcf90ca9d97cfe0592b53226d002 Merge from default branch diff -r 8bf05426d950 -r e3c7da3d896e layer/Layer.h --- a/layer/Layer.h Mon Apr 20 11:00:39 2015 +0100 +++ b/layer/Layer.h Mon Apr 20 11:00:48 2015 +0100 @@ -63,7 +63,7 @@ Model *getModel() { return const_cast(const_cast(this)->getModel()); } - + /** * Return a zoom constraint object defining the supported zoom * levels for this layer. If this returns zero, the layer will @@ -520,6 +520,13 @@ */ virtual RangeMapper *getNewVerticalZoomRangeMapper() const { return 0; } + /** + * Return true if this layer type can function without a model + * being set. If false (the default), the layer will not be loaded + * from a session if its model cannot be found. + */ + virtual bool canExistWithoutModel() const { return false; } + public slots: void showLayer(LayerGeometryProvider *, bool show); diff -r 8bf05426d950 -r e3c7da3d896e layer/TimeRulerLayer.h --- a/layer/TimeRulerLayer.h Mon Apr 20 11:00:39 2015 +0100 +++ b/layer/TimeRulerLayer.h Mon Apr 20 11:00:48 2015 +0100 @@ -60,6 +60,8 @@ void setProperties(const QXmlAttributes &attributes); + virtual bool canExistWithoutModel() const { return true; } + protected: Model *m_model; LabelHeight m_labelHeight; diff -r 8bf05426d950 -r e3c7da3d896e layer/WaveformLayer.h --- a/layer/WaveformLayer.h Mon Apr 20 11:00:39 2015 +0100 +++ b/layer/WaveformLayer.h Mon Apr 20 11:00:48 2015 +0100 @@ -202,6 +202,8 @@ virtual int getCurrentVerticalZoomStep() const; virtual void setVerticalZoomStep(int); + virtual bool canExistWithoutModel() const { return true; } + protected: int dBscale(double sample, int m) const;