diff layer/WaveformLayer.h @ 287:cd2492c5fe45

* Add SingleColourLayer to manage colours for layers that have a single predominant colour (i.e. most of them).
author Chris Cannam
date Thu, 12 Jul 2007 16:14:59 +0000
parents 9dd432665059
children c0b9eec70639
line wrap: on
line diff
--- a/layer/WaveformLayer.h	Wed Jul 11 20:46:37 2007 +0000
+++ b/layer/WaveformLayer.h	Thu Jul 12 16:14:59 2007 +0000
@@ -17,9 +17,8 @@
 #define _WAVEFORM_LAYER_H_
 
 #include <QRect>
-#include <QColor>
 
-#include "Layer.h"
+#include "SingleColourLayer.h"
 
 #include "data/model/RangeSummarisableTimeValueModel.h"
 
@@ -27,7 +26,7 @@
 class QPainter;
 class QPixmap;
 
-class WaveformLayer : public Layer
+class WaveformLayer : public SingleColourLayer
 {
     Q_OBJECT
 
@@ -43,11 +42,13 @@
 
     virtual QString getFeatureDescription(View *v, QPoint &) const;
 
+    virtual ColourSignificance getLayerColourSignificance() const {
+        return ColourAndBackgroundSignificant;
+    }
+
     virtual int getVerticalScaleWidth(View *v, QPainter &) const;
     virtual void paintVerticalScale(View *v, QPainter &paint, QRect rect) const;
 
-    virtual bool hasLightBackground() const;
-
     void setModel(const RangeSummarisableTimeValueModel *model);
 
     virtual PropertyList getProperties() const;
@@ -76,16 +77,6 @@
     bool getAutoNormalize() const { return m_autoNormalize; }
 
     /**
-     * Set the basic display colour for waveforms.  The parameter is
-     * a ColourDatabase index.
-     *
-     * The default is the first colour in the database.
-     *!!! NB should default to white if the associated View !hasLightBackground()
-     */
-    void setBaseColour(int);
-    int getBaseColour() const;
-
-    /**
      * Set whether to display mean values as a lighter-coloured area
      * beneath the peaks.  Rendering will be slightly faster without
      * but arguably prettier with.
@@ -191,7 +182,7 @@
     virtual QString toXmlString(QString indent = "",
 				QString extraAttributes = "") const;
 
-    void setProperties(const QXmlAttributes &attributes);
+    virtual void setProperties(const QXmlAttributes &attributes);
 
     virtual int getVerticalZoomSteps(int &defaultStep) const;
     virtual int getCurrentVerticalZoomStep() const;
@@ -210,9 +201,10 @@
 
     float getValueForY(const View *v, int y, size_t &channel) const;
 
+    virtual void flagBaseColourChanged() { m_cacheValid = false; }
+
     float        m_gain;
     bool         m_autoNormalize;
-    int          m_colour;
     bool         m_showMeans;
     bool         m_greyscale;
     ChannelMode  m_channelMode;