annotate layer/SingleColourLayer.h @ 445:4a14499fb184

* Save & reload vertical scale extents from note, time/value & colour 3d plot layers * Fix display of vertical scale in zoomed colour 3d plot layer
author Chris Cannam
date Wed, 12 Nov 2008 15:51:41 +0000
parents 2c59b0cd176b
children 156a120345ae
rev   line source
Chris@287 1 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */
Chris@287 2
Chris@287 3 /*
Chris@287 4 Sonic Visualiser
Chris@287 5 An audio file viewer and annotation editor.
Chris@287 6 Centre for Digital Music, Queen Mary, University of London.
Chris@287 7 This file copyright 2007 QMUL.
Chris@287 8
Chris@287 9 This program is free software; you can redistribute it and/or
Chris@287 10 modify it under the terms of the GNU General Public License as
Chris@287 11 published by the Free Software Foundation; either version 2 of the
Chris@287 12 License, or (at your option) any later version. See the file
Chris@287 13 COPYING included with this distribution for more information.
Chris@287 14 */
Chris@287 15
Chris@287 16 #ifndef _SINGLE_COLOUR_LAYER_H_
Chris@287 17 #define _SINGLE_COLOUR_LAYER_H_
Chris@287 18
Chris@287 19 #include "Layer.h"
Chris@287 20 #include <QColor>
Chris@287 21 #include <vector>
Chris@293 22 #include <map>
Chris@287 23
Chris@287 24 class SingleColourLayer : public Layer
Chris@287 25 {
Chris@397 26 Q_OBJECT
Chris@397 27
Chris@287 28 public:
Chris@287 29 virtual void setBaseColour(int);
Chris@287 30 virtual int getBaseColour() const;
Chris@287 31
Chris@287 32 virtual bool hasLightBackground() const;
Chris@287 33
Chris@287 34 virtual ColourSignificance getLayerColourSignificance() const {
Chris@287 35 return ColourDistinguishes;
Chris@287 36 }
Chris@287 37
Chris@299 38 virtual QPixmap getLayerPresentationPixmap(QSize size) const;
Chris@299 39
Chris@287 40 virtual PropertyList getProperties() const;
Chris@287 41 virtual QString getPropertyLabel(const PropertyName &) const;
Chris@287 42 virtual PropertyType getPropertyType(const PropertyName &) const;
Chris@287 43 virtual QString getPropertyGroupName(const PropertyName &) const;
Chris@287 44 virtual int getPropertyRangeAndValue(const PropertyName &,
Chris@287 45 int *min, int *max, int *deflt) const;
Chris@287 46 virtual QString getPropertyValueLabel(const PropertyName &,
Chris@287 47 int value) const;
Chris@287 48 virtual RangeMapper *getNewPropertyRangeMapper(const PropertyName &) const;
Chris@287 49 virtual void setProperty(const PropertyName &, int value);
Chris@287 50
Chris@316 51 virtual void toXml(QTextStream &stream, QString indent = "",
Chris@316 52 QString extraAttributes = "") const;
Chris@287 53
Chris@287 54 virtual void setProperties(const QXmlAttributes &attributes);
Chris@287 55
Chris@287 56 virtual void setDefaultColourFor(View *v);
Chris@287 57
Chris@287 58 protected:
Chris@287 59 SingleColourLayer();
Chris@287 60
Chris@287 61 virtual QColor getBaseQColor() const;
Chris@287 62 virtual QColor getBackgroundQColor(View *v) const;
Chris@287 63 virtual QColor getForegroundQColor(View *v) const;
Chris@287 64 std::vector<QColor> getPartialShades(View *v) const;
Chris@287 65
Chris@287 66 virtual void flagBaseColourChanged() { }
Chris@287 67 virtual int getDefaultColourHint(bool /* darkBackground */,
Chris@287 68 bool & /* impose */) { return -1; }
Chris@287 69
Chris@293 70 typedef std::map<int, int> ColourRefCount;
Chris@293 71 static ColourRefCount m_colourRefCount;
Chris@287 72
Chris@287 73 int m_colour;
Chris@294 74 bool m_colourExplicitlySet;
Chris@366 75 bool m_defaultColourSet;
Chris@287 76 };
Chris@287 77
Chris@287 78 #endif