comparison layer/NoteLayer.h @ 701:084f65094203

Extend numerical and colour scales (and piano where applicable) to note and region layers
author Chris Cannam
date Wed, 04 Dec 2013 13:39:41 +0000
parents 4dcf10bd2863
children 1d526ba11a24
comparison
equal deleted inserted replaced
700:7846175403f1 701:084f65094203
15 15
16 #ifndef _NOTE_LAYER_H_ 16 #ifndef _NOTE_LAYER_H_
17 #define _NOTE_LAYER_H_ 17 #define _NOTE_LAYER_H_
18 18
19 #include "SingleColourLayer.h" 19 #include "SingleColourLayer.h"
20 #include "VerticalScaleLayer.h"
21
20 #include "data/model/NoteModel.h" 22 #include "data/model/NoteModel.h"
21 23
22 #include <QObject> 24 #include <QObject>
23 #include <QColor> 25 #include <QColor>
24 26
25 class View; 27 class View;
26 class QPainter; 28 class QPainter;
27 29
28 class NoteLayer : public SingleColourLayer 30 class NoteLayer : public SingleColourLayer,
31 public VerticalScaleLayer
29 { 32 {
30 Q_OBJECT 33 Q_OBJECT
31 34
32 public: 35 public:
33 NoteLayer(); 36 NoteLayer();
126 virtual void toXml(QTextStream &stream, QString indent = "", 129 virtual void toXml(QTextStream &stream, QString indent = "",
127 QString extraAttributes = "") const; 130 QString extraAttributes = "") const;
128 131
129 void setProperties(const QXmlAttributes &attributes); 132 void setProperties(const QXmlAttributes &attributes);
130 133
134 /// VerticalScaleLayer methods
135 virtual int getYForValue(View *v, float value) const;
136 virtual float getValueForY(View *v, int y) const;
137 virtual QString getScaleUnits() const;
138
131 protected: 139 protected:
132 void getScaleExtents(View *, float &min, float &max, bool &log) const; 140 void getScaleExtents(View *, float &min, float &max, bool &log) const;
133 int getYForValue(View *v, float value) const;
134 float getValueForY(View *v, int y) const;
135 bool shouldConvertMIDIToHz() const; 141 bool shouldConvertMIDIToHz() const;
136 142
137 virtual int getDefaultColourHint(bool dark, bool &impose); 143 virtual int getDefaultColourHint(bool dark, bool &impose);
138 144
139 NoteModel::PointList getLocalPoints(View *v, int) const; 145 NoteModel::PointList getLocalPoints(View *v, int) const;