Mercurial > hg > svgui
comparison layer/NoteLayer.h @ 706:97ea68f62c1f imaf_enc
Merge from default branch
author | Chris Cannam |
---|---|
date | Thu, 05 Dec 2013 09:47:02 +0000 |
parents | 084f65094203 |
children | 1d526ba11a24 |
comparison
equal
deleted
inserted
replaced
678:26c5f7fd4807 | 706:97ea68f62c1f |
---|---|
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(); |
34 | 37 |
35 virtual void paint(View *v, QPainter &paint, QRect rect) const; | 38 virtual void paint(View *v, QPainter &paint, QRect rect) const; |
39 | |
40 virtual int getVerticalScaleWidth(View *v, bool, QPainter &) const; | |
41 virtual void paintVerticalScale(View *v, bool, QPainter &paint, QRect rect) const; | |
36 | 42 |
37 virtual QString getFeatureDescription(View *v, QPoint &) const; | 43 virtual QString getFeatureDescription(View *v, QPoint &) const; |
38 | 44 |
39 virtual bool snapToFeatureFrame(View *v, int &frame, | 45 virtual bool snapToFeatureFrame(View *v, int &frame, |
40 size_t &resolution, | 46 size_t &resolution, |
100 virtual int getVerticalZoomSteps(int &defaultStep) const; | 106 virtual int getVerticalZoomSteps(int &defaultStep) const; |
101 virtual int getCurrentVerticalZoomStep() const; | 107 virtual int getCurrentVerticalZoomStep() const; |
102 virtual void setVerticalZoomStep(int); | 108 virtual void setVerticalZoomStep(int); |
103 virtual RangeMapper *getNewVerticalZoomRangeMapper() const; | 109 virtual RangeMapper *getNewVerticalZoomRangeMapper() const; |
104 | 110 |
105 virtual int getVerticalScaleWidth(View *, bool, QPainter &) const { return 0; } | |
106 | |
107 /** | 111 /** |
108 * Add a note-on. Used when recording MIDI "live". The note will | 112 * Add a note-on. Used when recording MIDI "live". The note will |
109 * not be finally added to the layer until the corresponding | 113 * not be finally added to the layer until the corresponding |
110 * note-off. | 114 * note-off. |
111 */ | 115 */ |
125 virtual void toXml(QTextStream &stream, QString indent = "", | 129 virtual void toXml(QTextStream &stream, QString indent = "", |
126 QString extraAttributes = "") const; | 130 QString extraAttributes = "") const; |
127 | 131 |
128 void setProperties(const QXmlAttributes &attributes); | 132 void setProperties(const QXmlAttributes &attributes); |
129 | 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 | |
130 protected: | 139 protected: |
131 void getScaleExtents(View *, float &min, float &max, bool &log) const; | 140 void getScaleExtents(View *, float &min, float &max, bool &log) const; |
132 int getYForValue(View *v, float value) const; | |
133 float getValueForY(View *v, int y) const; | |
134 bool shouldConvertMIDIToHz() const; | 141 bool shouldConvertMIDIToHz() const; |
135 | 142 |
136 virtual int getDefaultColourHint(bool dark, bool &impose); | 143 virtual int getDefaultColourHint(bool dark, bool &impose); |
137 | 144 |
138 NoteModel::PointList getLocalPoints(View *v, int) const; | 145 NoteModel::PointList getLocalPoints(View *v, int) const; |