changeset 61:0387f53242b2

fix the 2ed color bug in the layer list. Now color in layer list is ok.
author benoitrigolleau
date Tue, 29 May 2007 09:26:15 +0000
parents 32b4949086a5
children 3a99e1897d18
files layer/IntervalLayer.h layer/Layer.h layer/NoteLayer.h layer/SliceLayer.h layer/TextLayer.h layer/TimeInstantLayer.h layer/TimeRulerLayer.h layer/TimeValueLayer.cpp layer/TimeValueLayer.h layer/WaveformLayer.h widgets/ItemLayerList.cpp
diffstat 11 files changed, 29 insertions(+), 27 deletions(-) [+]
line wrap: on
line diff
--- a/layer/IntervalLayer.h	Tue May 29 08:42:49 2007 +0000
+++ b/layer/IntervalLayer.h	Tue May 29 09:26:15 2007 +0000
@@ -58,8 +58,8 @@
 
 	virtual QString getPropertyLabel(const PropertyName &) const;
 
-    void setBaseColour(QColor);
-    QColor getBaseColour() const { return m_colour; }
+    virtual void setBaseColour(QColor);
+    virtual QColor getBaseColour() const { return m_colour; }
 
     virtual bool getValueExtents(float &min, float &max,
                                  bool &log, QString &unit) const;
--- a/layer/Layer.h	Tue May 29 08:42:49 2007 +0000
+++ b/layer/Layer.h	Tue May 29 09:26:15 2007 +0000
@@ -26,6 +26,7 @@
 #include <QXmlAttributes>
 #include <QMutex>
 
+
 #include <map>
 
 class ZoomConstraint;
@@ -361,6 +362,13 @@
      */
     virtual RangeMapper *getNewVerticalZoomRangeMapper() const { return 0; }
 
+	 /**
+     * Set the basic display colour for waveforms.
+     *
+     */
+	virtual void setBaseColour(QColor){};
+	virtual QColor getBaseColour() const {return -1;};
+
 public slots:
     void showLayer(View *, bool show);
 
--- a/layer/NoteLayer.h	Tue May 29 08:42:49 2007 +0000
+++ b/layer/NoteLayer.h	Tue May 29 09:26:15 2007 +0000
@@ -71,8 +71,8 @@
 					  int value) const;
     virtual void setProperty(const PropertyName &, int value);
 
-    void setBaseColour(QColor);
-    QColor getBaseColour() const { return m_colour; }
+    virtual void setBaseColour(QColor);
+    virtual QColor getBaseColour() const { return m_colour; }
 
     enum VerticalScale {
         AutoAlignScale,
--- a/layer/SliceLayer.h	Tue May 29 08:42:49 2007 +0000
+++ b/layer/SliceLayer.h	Tue May 29 09:26:15 2007 +0000
@@ -73,8 +73,8 @@
 
     enum BinScale { LinearBins, LogBins, InvertedLogBins };
 
-    void setBaseColour(QColor);
-    QColor getBaseColour() const { return m_colour; }
+    virtual void setBaseColour(QColor);
+    virtual QColor getBaseColour() const { return m_colour; }
 
     void setFillColourMap(int);
     int getFillColourMap() const { return m_colourMap; }
--- a/layer/TextLayer.h	Tue May 29 08:42:49 2007 +0000
+++ b/layer/TextLayer.h	Tue May 29 09:26:15 2007 +0000
@@ -70,8 +70,8 @@
 					  int value) const;
     virtual void setProperty(const PropertyName &, int value);
 
-    void setBaseColour(QColor);
-    QColor getBaseColour() const { return m_colour; }
+    virtual void setBaseColour(QColor);
+    virtual QColor getBaseColour() const { return m_colour; }
 
     virtual bool isLayerScrollable(const View *v) const;
 
--- a/layer/TimeInstantLayer.h	Tue May 29 08:42:49 2007 +0000
+++ b/layer/TimeInstantLayer.h	Tue May 29 09:26:15 2007 +0000
@@ -70,8 +70,8 @@
 					  int value) const;
     virtual void setProperty(const PropertyName &, int value);
 
-    void setBaseColour(QColor);
-    QColor getBaseColour() const { return m_colour; }
+    virtual void setBaseColour(QColor);
+    virtual QColor getBaseColour() const { return m_colour; }
 
     enum PlotStyle {
 	PlotInstants,
--- a/layer/TimeRulerLayer.h	Tue May 29 08:42:49 2007 +0000
+++ b/layer/TimeRulerLayer.h	Tue May 29 09:26:15 2007 +0000
@@ -37,8 +37,8 @@
     void setModel(Model *);
     virtual const Model *getModel() const { return m_model; }
 
-    void setBaseColour(QColor);
-    QColor getBaseColour() const { return m_colour; }
+    virtual void setBaseColour(QColor);
+    virtual QColor getBaseColour() const { return m_colour; }
 
     enum LabelHeight { LabelTop, LabelMiddle, LabelBottom };
     void setLabelHeight(LabelHeight h) { m_labelHeight = h; }
--- a/layer/TimeValueLayer.cpp	Tue May 29 08:42:49 2007 +0000
+++ b/layer/TimeValueLayer.cpp	Tue May 29 09:26:15 2007 +0000
@@ -242,7 +242,7 @@
     }
 }
 
-void
+ void
 TimeValueLayer::setBaseColour(QColor colour)
 {
     if (m_colour == colour) return;
--- a/layer/TimeValueLayer.h	Tue May 29 08:42:49 2007 +0000
+++ b/layer/TimeValueLayer.h	Tue May 29 09:26:15 2007 +0000
@@ -74,8 +74,8 @@
 					  int value) const;
     virtual void setProperty(const PropertyName &, int value);
 
-    void setBaseColour(QColor);
-    QColor getBaseColour() const { return m_colour; }
+     virtual void setBaseColour(QColor);
+	 virtual QColor getBaseColour() const {return m_colour; }
 
     void setFillColourMap(int);
     int getFillColourMap() const { return m_colourMap; }
@@ -130,7 +130,7 @@
     int getYForValue(View *, float value) const;
     float getValueForY(View *, int y) const;
     QColor getColourForValue(View *v, float value) const;
-
+	QColor m_colour;
     SparseTimeValueModel::PointList getLocalPoints(View *v, int) const;
 
     SparseTimeValueModel *m_model;
@@ -138,7 +138,6 @@
     SparseTimeValueModel::Point m_originalPoint;
     SparseTimeValueModel::Point m_editingPoint;
     SparseTimeValueModel::EditCommand *m_editingCommand;
-    QColor m_colour;
     int m_colourMap;
     PlotStyle m_plotStyle;
     VerticalScale m_verticalScale;
--- a/layer/WaveformLayer.h	Tue May 29 08:42:49 2007 +0000
+++ b/layer/WaveformLayer.h	Tue May 29 09:26:15 2007 +0000
@@ -73,14 +73,8 @@
     void setAutoNormalize(bool);
     bool getAutoNormalize() const { return m_autoNormalize; }
 
-    /**
-     * Set the basic display colour for waveforms.
-     *
-     * The default is black.
-     *!!! NB should default to white if the associated View !hasLightBackground()
-     */
-    void setBaseColour(QColor);
-    QColor getBaseColour() const { return m_colour; }
+     virtual void setBaseColour(QColor);
+	 virtual QColor getBaseColour() const {return m_colour; }
 
     /**
      * Set whether to display mean values as a lighter-coloured area
@@ -205,13 +199,13 @@
 
     float        m_gain;
     bool         m_autoNormalize;
-    QColor       m_colour;
     bool         m_showMeans;
     bool         m_greyscale;
     ChannelMode  m_channelMode;
     int          m_channel;
     Scale        m_scale;
     bool         m_aggressive;
+	QColor       m_colour;
 
     mutable std::vector<float> m_effectiveGains;
 
--- a/widgets/ItemLayerList.cpp	Tue May 29 08:42:49 2007 +0000
+++ b/widgets/ItemLayerList.cpp	Tue May 29 09:26:15 2007 +0000
@@ -102,6 +102,7 @@
 
 		
 		updateCheckboxs();
+		updateColor();
 		connect(m_checkBoxShow,SIGNAL(stateChanged(int)),m_propertyBox,SLOT(layerVisibilityChanged(int)));
 		connect(m_propertyBox, SIGNAL(showLayer(bool)), this, SLOT(showLayer(bool)));
 	}
@@ -163,7 +164,7 @@
 	Layer *layer = dynamic_cast<Layer *>(m_container);
 	if (layer) {
 		QPalette palette;
-		palette.setColor(QPalette::Button,QColor ( 100, 60, 20));
+		palette.setColor(QPalette::Button,layer->getBaseColour());
 		m_checkBoxShow->setPalette(palette);
 	}
 }