Chris@287: /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */ Chris@287: Chris@287: /* Chris@287: Sonic Visualiser Chris@287: An audio file viewer and annotation editor. Chris@287: Centre for Digital Music, Queen Mary, University of London. Chris@287: This file copyright 2007 QMUL. Chris@287: Chris@287: This program is free software; you can redistribute it and/or Chris@287: modify it under the terms of the GNU General Public License as Chris@287: published by the Free Software Foundation; either version 2 of the Chris@287: License, or (at your option) any later version. See the file Chris@287: COPYING included with this distribution for more information. Chris@287: */ Chris@287: Chris@287: #ifndef _SINGLE_COLOUR_LAYER_H_ Chris@287: #define _SINGLE_COLOUR_LAYER_H_ Chris@287: Chris@287: #include "Layer.h" Chris@287: #include Chris@287: #include Chris@293: #include Chris@287: Chris@287: class SingleColourLayer : public Layer Chris@287: { Chris@287: public: Chris@287: virtual void setBaseColour(int); Chris@287: virtual int getBaseColour() const; Chris@287: Chris@287: virtual bool hasLightBackground() const; Chris@287: Chris@287: virtual ColourSignificance getLayerColourSignificance() const { Chris@287: return ColourDistinguishes; Chris@287: } Chris@287: Chris@299: virtual QPixmap getLayerPresentationPixmap(QSize size) const; Chris@299: Chris@287: virtual PropertyList getProperties() const; Chris@287: virtual QString getPropertyLabel(const PropertyName &) const; Chris@287: virtual PropertyType getPropertyType(const PropertyName &) const; Chris@287: virtual QString getPropertyGroupName(const PropertyName &) const; Chris@287: virtual int getPropertyRangeAndValue(const PropertyName &, Chris@287: int *min, int *max, int *deflt) const; Chris@287: virtual QString getPropertyValueLabel(const PropertyName &, Chris@287: int value) const; Chris@287: virtual RangeMapper *getNewPropertyRangeMapper(const PropertyName &) const; Chris@287: virtual void setProperty(const PropertyName &, int value); Chris@287: Chris@316: virtual void toXml(QTextStream &stream, QString indent = "", Chris@316: QString extraAttributes = "") const; Chris@287: Chris@287: virtual void setProperties(const QXmlAttributes &attributes); Chris@287: Chris@287: virtual void setDefaultColourFor(View *v); Chris@287: Chris@287: protected: Chris@287: SingleColourLayer(); Chris@287: Chris@287: virtual QColor getBaseQColor() const; Chris@287: virtual QColor getBackgroundQColor(View *v) const; Chris@287: virtual QColor getForegroundQColor(View *v) const; Chris@287: std::vector getPartialShades(View *v) const; Chris@287: Chris@287: virtual void flagBaseColourChanged() { } Chris@287: virtual int getDefaultColourHint(bool /* darkBackground */, Chris@287: bool & /* impose */) { return -1; } Chris@287: Chris@293: typedef std::map ColourRefCount; Chris@293: static ColourRefCount m_colourRefCount; Chris@287: Chris@287: int m_colour; Chris@294: bool m_colourExplicitlySet; Chris@287: }; Chris@287: Chris@287: #endif