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@287
|
36 virtual PropertyList getProperties() const;
|
Chris@287
|
37 virtual QString getPropertyLabel(const PropertyName &) const;
|
Chris@287
|
38 virtual PropertyType getPropertyType(const PropertyName &) const;
|
Chris@287
|
39 virtual QString getPropertyGroupName(const PropertyName &) const;
|
Chris@287
|
40 virtual int getPropertyRangeAndValue(const PropertyName &,
|
Chris@287
|
41 int *min, int *max, int *deflt) const;
|
Chris@287
|
42 virtual QString getPropertyValueLabel(const PropertyName &,
|
Chris@287
|
43 int value) const;
|
Chris@287
|
44 virtual RangeMapper *getNewPropertyRangeMapper(const PropertyName &) const;
|
Chris@287
|
45 virtual void setProperty(const PropertyName &, int value);
|
Chris@287
|
46
|
Chris@287
|
47 virtual QString toXmlString(QString indent = "",
|
Chris@287
|
48 QString extraAttributes = "") const;
|
Chris@287
|
49
|
Chris@287
|
50 virtual void setProperties(const QXmlAttributes &attributes);
|
Chris@287
|
51
|
Chris@287
|
52 virtual void setDefaultColourFor(View *v);
|
Chris@287
|
53
|
Chris@287
|
54 protected:
|
Chris@287
|
55 SingleColourLayer();
|
Chris@287
|
56
|
Chris@287
|
57 virtual QColor getBaseQColor() const;
|
Chris@287
|
58 virtual QColor getBackgroundQColor(View *v) const;
|
Chris@287
|
59 virtual QColor getForegroundQColor(View *v) const;
|
Chris@287
|
60 std::vector<QColor> getPartialShades(View *v) const;
|
Chris@287
|
61
|
Chris@287
|
62 virtual void flagBaseColourChanged() { }
|
Chris@287
|
63 virtual int getDefaultColourHint(bool /* darkBackground */,
|
Chris@287
|
64 bool & /* impose */) { return -1; }
|
Chris@287
|
65
|
Chris@293
|
66 typedef std::map<int, int> ColourRefCount;
|
Chris@293
|
67 static ColourRefCount m_colourRefCount;
|
Chris@287
|
68
|
Chris@287
|
69 int m_colour;
|
Chris@287
|
70 };
|
Chris@287
|
71
|
Chris@287
|
72 #endif
|