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@287
|
26 public:
|
Chris@287
|
27 virtual void setBaseColour(int);
|
Chris@287
|
28 virtual int getBaseColour() const;
|
Chris@287
|
29
|
Chris@287
|
30 virtual bool hasLightBackground() const;
|
Chris@287
|
31
|
Chris@287
|
32 virtual ColourSignificance getLayerColourSignificance() const {
|
Chris@287
|
33 return ColourDistinguishes;
|
Chris@287
|
34 }
|
Chris@287
|
35
|
Chris@299
|
36 virtual QPixmap getLayerPresentationPixmap(QSize size) const;
|
Chris@299
|
37
|
Chris@287
|
38 virtual PropertyList getProperties() const;
|
Chris@287
|
39 virtual QString getPropertyLabel(const PropertyName &) const;
|
Chris@287
|
40 virtual PropertyType getPropertyType(const PropertyName &) const;
|
Chris@287
|
41 virtual QString getPropertyGroupName(const PropertyName &) const;
|
Chris@287
|
42 virtual int getPropertyRangeAndValue(const PropertyName &,
|
Chris@287
|
43 int *min, int *max, int *deflt) const;
|
Chris@287
|
44 virtual QString getPropertyValueLabel(const PropertyName &,
|
Chris@287
|
45 int value) const;
|
Chris@287
|
46 virtual RangeMapper *getNewPropertyRangeMapper(const PropertyName &) const;
|
Chris@287
|
47 virtual void setProperty(const PropertyName &, int value);
|
Chris@287
|
48
|
Chris@316
|
49 virtual void toXml(QTextStream &stream, QString indent = "",
|
Chris@316
|
50 QString extraAttributes = "") const;
|
Chris@287
|
51
|
Chris@287
|
52 virtual void setProperties(const QXmlAttributes &attributes);
|
Chris@287
|
53
|
Chris@287
|
54 virtual void setDefaultColourFor(View *v);
|
Chris@287
|
55
|
Chris@287
|
56 protected:
|
Chris@287
|
57 SingleColourLayer();
|
Chris@287
|
58
|
Chris@287
|
59 virtual QColor getBaseQColor() const;
|
Chris@287
|
60 virtual QColor getBackgroundQColor(View *v) const;
|
Chris@287
|
61 virtual QColor getForegroundQColor(View *v) const;
|
Chris@287
|
62 std::vector<QColor> getPartialShades(View *v) const;
|
Chris@287
|
63
|
Chris@287
|
64 virtual void flagBaseColourChanged() { }
|
Chris@287
|
65 virtual int getDefaultColourHint(bool /* darkBackground */,
|
Chris@287
|
66 bool & /* impose */) { return -1; }
|
Chris@287
|
67
|
Chris@293
|
68 typedef std::map<int, int> ColourRefCount;
|
Chris@293
|
69 static ColourRefCount m_colourRefCount;
|
Chris@287
|
70
|
Chris@287
|
71 int m_colour;
|
Chris@294
|
72 bool m_colourExplicitlySet;
|
Chris@374
|
73 bool m_defaultColourSet;
|
Chris@287
|
74 };
|
Chris@287
|
75
|
Chris@287
|
76 #endif
|