Mercurial > hg > svgui
comparison layer/FlexiNoteLayer.h @ 1414:fa986b91d77f
Merge from branch fix-static-analysis
author | Chris Cannam |
---|---|
date | Wed, 09 Jan 2019 15:24:51 +0000 |
parents | 05d614f6e46d |
children | e1a08da75427 |
comparison
equal
deleted
inserted
replaced
1413:0930a27ebea2 | 1414:fa986b91d77f |
---|---|
11 published by the Free Software Foundation; either version 2 of the | 11 published by the Free Software Foundation; either version 2 of the |
12 License, or (at your option) any later version. See the file | 12 License, or (at your option) any later version. See the file |
13 COPYING included with this distribution for more information. | 13 COPYING included with this distribution for more information. |
14 */ | 14 */ |
15 | 15 |
16 #ifndef _FLEXINOTE_LAYER_H_ | 16 #ifndef SV_FLEXINOTE_LAYER_H |
17 #define _FLEXINOTE_LAYER_H_ | 17 #define SV_FLEXINOTE_LAYER_H |
18 | 18 |
19 #define NOTE_HEIGHT 16 | 19 #define NOTE_HEIGHT 16 |
20 | 20 |
21 #include "SingleColourLayer.h" | 21 #include "SingleColourLayer.h" |
22 #include "VerticalScaleLayer.h" | 22 #include "VerticalScaleLayer.h" |
36 Q_OBJECT | 36 Q_OBJECT |
37 | 37 |
38 public: | 38 public: |
39 FlexiNoteLayer(); | 39 FlexiNoteLayer(); |
40 | 40 |
41 virtual void paint(LayerGeometryProvider *v, QPainter &paint, QRect rect) const; | 41 void paint(LayerGeometryProvider *v, QPainter &paint, QRect rect) const override; |
42 | 42 |
43 virtual int getVerticalScaleWidth(LayerGeometryProvider *v, bool, QPainter &) const; | 43 int getVerticalScaleWidth(LayerGeometryProvider *v, bool, QPainter &) const override; |
44 virtual void paintVerticalScale(LayerGeometryProvider *v, bool, QPainter &paint, QRect rect) const; | 44 void paintVerticalScale(LayerGeometryProvider *v, bool, QPainter &paint, QRect rect) const override; |
45 | 45 |
46 virtual QString getFeatureDescription(LayerGeometryProvider *v, QPoint &) const; | 46 QString getFeatureDescription(LayerGeometryProvider *v, QPoint &) const override; |
47 | 47 |
48 virtual bool snapToFeatureFrame(LayerGeometryProvider *v, sv_frame_t &frame, | 48 bool snapToFeatureFrame(LayerGeometryProvider *v, sv_frame_t &frame, |
49 int &resolution, | 49 int &resolution, |
50 SnapType snap) const; | 50 SnapType snap) const override; |
51 | 51 |
52 virtual void drawStart(LayerGeometryProvider *v, QMouseEvent *); | 52 void drawStart(LayerGeometryProvider *v, QMouseEvent *) override; |
53 virtual void drawDrag(LayerGeometryProvider *v, QMouseEvent *); | 53 void drawDrag(LayerGeometryProvider *v, QMouseEvent *) override; |
54 virtual void drawEnd(LayerGeometryProvider *v, QMouseEvent *); | 54 void drawEnd(LayerGeometryProvider *v, QMouseEvent *) override; |
55 | 55 |
56 virtual void eraseStart(LayerGeometryProvider *v, QMouseEvent *); | 56 void eraseStart(LayerGeometryProvider *v, QMouseEvent *) override; |
57 virtual void eraseDrag(LayerGeometryProvider *v, QMouseEvent *); | 57 void eraseDrag(LayerGeometryProvider *v, QMouseEvent *) override; |
58 virtual void eraseEnd(LayerGeometryProvider *v, QMouseEvent *); | 58 void eraseEnd(LayerGeometryProvider *v, QMouseEvent *) override; |
59 | 59 |
60 virtual void editStart(LayerGeometryProvider *v, QMouseEvent *); | 60 void editStart(LayerGeometryProvider *v, QMouseEvent *) override; |
61 virtual void editDrag(LayerGeometryProvider *v, QMouseEvent *); | 61 void editDrag(LayerGeometryProvider *v, QMouseEvent *) override; |
62 virtual void editEnd(LayerGeometryProvider *v, QMouseEvent *); | 62 void editEnd(LayerGeometryProvider *v, QMouseEvent *) override; |
63 | 63 |
64 virtual void splitStart(LayerGeometryProvider *v, QMouseEvent *); | 64 void splitStart(LayerGeometryProvider *v, QMouseEvent *) override; |
65 virtual void splitEnd(LayerGeometryProvider *v, QMouseEvent *); | 65 void splitEnd(LayerGeometryProvider *v, QMouseEvent *) override; |
66 | 66 |
67 virtual void addNote(LayerGeometryProvider *v, QMouseEvent *e); | 67 void addNote(LayerGeometryProvider *v, QMouseEvent *e) override; |
68 | 68 |
69 virtual void mouseMoveEvent(LayerGeometryProvider *v, QMouseEvent *); | 69 virtual void mouseMoveEvent(LayerGeometryProvider *v, QMouseEvent *); |
70 | 70 |
71 virtual bool editOpen(LayerGeometryProvider *v, QMouseEvent *); | 71 bool editOpen(LayerGeometryProvider *v, QMouseEvent *) override; |
72 | 72 |
73 virtual void moveSelection(Selection s, sv_frame_t newStartFrame); | 73 void moveSelection(Selection s, sv_frame_t newStartFrame) override; |
74 virtual void resizeSelection(Selection s, Selection newSize); | 74 void resizeSelection(Selection s, Selection newSize) override; |
75 virtual void deleteSelection(Selection s); | 75 void deleteSelection(Selection s) override; |
76 virtual void deleteSelectionInclusive(Selection s); | 76 virtual void deleteSelectionInclusive(Selection s); |
77 | 77 |
78 virtual void copy(LayerGeometryProvider *v, Selection s, Clipboard &to); | 78 void copy(LayerGeometryProvider *v, Selection s, Clipboard &to) override; |
79 virtual bool paste(LayerGeometryProvider *v, const Clipboard &from, sv_frame_t frameOffset, | 79 bool paste(LayerGeometryProvider *v, const Clipboard &from, sv_frame_t frameOffset, |
80 bool interactive); | 80 bool interactive) override; |
81 | 81 |
82 void splitNotesAt(LayerGeometryProvider *v, sv_frame_t frame); | 82 void splitNotesAt(LayerGeometryProvider *v, sv_frame_t frame); |
83 void snapSelectedNotesToPitchTrack(LayerGeometryProvider *v, Selection s); | 83 void snapSelectedNotesToPitchTrack(LayerGeometryProvider *v, Selection s); |
84 void mergeNotes(LayerGeometryProvider *v, Selection s, bool inclusive); | 84 void mergeNotes(LayerGeometryProvider *v, Selection s, bool inclusive); |
85 | 85 |
86 virtual const Model *getModel() const { return m_model; } | 86 const Model *getModel() const override { return m_model; } |
87 void setModel(FlexiNoteModel *model); | 87 void setModel(FlexiNoteModel *model); |
88 | 88 |
89 virtual PropertyList getProperties() const; | 89 PropertyList getProperties() const override; |
90 virtual QString getPropertyLabel(const PropertyName &) const; | 90 QString getPropertyLabel(const PropertyName &) const override; |
91 virtual PropertyType getPropertyType(const PropertyName &) const; | 91 PropertyType getPropertyType(const PropertyName &) const override; |
92 virtual QString getPropertyGroupName(const PropertyName &) const; | 92 QString getPropertyGroupName(const PropertyName &) const override; |
93 virtual int getPropertyRangeAndValue(const PropertyName &, | 93 int getPropertyRangeAndValue(const PropertyName &, |
94 int *min, int *max, int *deflt) const; | 94 int *min, int *max, int *deflt) const override; |
95 virtual QString getPropertyValueLabel(const PropertyName &, | 95 QString getPropertyValueLabel(const PropertyName &, |
96 int value) const; | 96 int value) const override; |
97 virtual void setProperty(const PropertyName &, int value); | 97 void setProperty(const PropertyName &, int value) override; |
98 | 98 |
99 enum VerticalScale { | 99 enum VerticalScale { |
100 AutoAlignScale, | 100 AutoAlignScale, |
101 LinearScale, | 101 LinearScale, |
102 LogScale, | 102 LogScale, |
114 void setIntelligentActions(bool on) { m_intelligentActions=on; } | 114 void setIntelligentActions(bool on) { m_intelligentActions=on; } |
115 | 115 |
116 void setVerticalScale(VerticalScale scale); | 116 void setVerticalScale(VerticalScale scale); |
117 VerticalScale getVerticalScale() const { return m_verticalScale; } | 117 VerticalScale getVerticalScale() const { return m_verticalScale; } |
118 | 118 |
119 virtual bool isLayerScrollable(const LayerGeometryProvider *v) const; | 119 bool isLayerScrollable(const LayerGeometryProvider *v) const override; |
120 | 120 |
121 virtual bool isLayerEditable() const { return true; } | 121 bool isLayerEditable() const override { return true; } |
122 | 122 |
123 virtual int getCompletion(LayerGeometryProvider *) const { return m_model->getCompletion(); } | 123 int getCompletion(LayerGeometryProvider *) const override { return m_model->getCompletion(); } |
124 | 124 |
125 virtual bool getValueExtents(double &min, double &max, | 125 bool getValueExtents(double &min, double &max, |
126 bool &log, QString &unit) const; | 126 bool &log, QString &unit) const override; |
127 | 127 |
128 virtual bool getDisplayExtents(double &min, double &max) const; | 128 bool getDisplayExtents(double &min, double &max) const override; |
129 virtual bool setDisplayExtents(double min, double max); | 129 bool setDisplayExtents(double min, double max) override; |
130 | 130 |
131 virtual int getVerticalZoomSteps(int &defaultStep) const; | 131 int getVerticalZoomSteps(int &defaultStep) const override; |
132 virtual int getCurrentVerticalZoomStep() const; | 132 int getCurrentVerticalZoomStep() const override; |
133 virtual void setVerticalZoomStep(int); | 133 void setVerticalZoomStep(int) override; |
134 virtual RangeMapper *getNewVerticalZoomRangeMapper() const; | 134 RangeMapper *getNewVerticalZoomRangeMapper() const override; |
135 | 135 |
136 /** | 136 /** |
137 * Add a note-on. Used when recording MIDI "live". The note will | 137 * Add a note-on. Used when recording MIDI "live". The note will |
138 * not be finally added to the layer until the corresponding | 138 * not be finally added to the layer until the corresponding |
139 * note-off. | 139 * note-off. |
149 /** | 149 /** |
150 * Abandon all pending note-on events. | 150 * Abandon all pending note-on events. |
151 */ | 151 */ |
152 void abandonNoteOns(); | 152 void abandonNoteOns(); |
153 | 153 |
154 virtual void toXml(QTextStream &stream, QString indent = "", | 154 void toXml(QTextStream &stream, QString indent = "", |
155 QString extraAttributes = "") const; | 155 QString extraAttributes = "") const override; |
156 | 156 |
157 void setProperties(const QXmlAttributes &attributes); | 157 void setProperties(const QXmlAttributes &attributes) override; |
158 | 158 |
159 void setVerticalRangeToNoteRange(LayerGeometryProvider *v); | 159 void setVerticalRangeToNoteRange(LayerGeometryProvider *v); |
160 | 160 |
161 /// VerticalScaleLayer methods | 161 /// VerticalScaleLayer methods |
162 virtual int getYForValue(LayerGeometryProvider *v, double value) const; | 162 int getYForValue(LayerGeometryProvider *v, double value) const override; |
163 virtual double getValueForY(LayerGeometryProvider *v, int y) const; | 163 double getValueForY(LayerGeometryProvider *v, int y) const override; |
164 virtual QString getScaleUnits() const; | 164 QString getScaleUnits() const override; |
165 | 165 |
166 signals: | 166 signals: |
167 void reAnalyseRegion(sv_frame_t, sv_frame_t, float, float); | 167 void reAnalyseRegion(sv_frame_t, sv_frame_t, float, float); |
168 void materialiseReAnalysis(); | 168 void materialiseReAnalysis(); |
169 | 169 |
170 protected: | 170 protected: |
171 void getScaleExtents(LayerGeometryProvider *, double &min, double &max, bool &log) const; | 171 void getScaleExtents(LayerGeometryProvider *, double &min, double &max, bool &log) const; |
172 bool shouldConvertMIDIToHz() const; | 172 bool shouldConvertMIDIToHz() const; |
173 | 173 |
174 virtual int getDefaultColourHint(bool dark, bool &impose); | 174 int getDefaultColourHint(bool dark, bool &impose) override; |
175 | 175 |
176 FlexiNoteModel::PointList getLocalPoints(LayerGeometryProvider *v, int) const; | 176 FlexiNoteModel::PointList getLocalPoints(LayerGeometryProvider *v, int) const; |
177 | 177 |
178 bool getPointToDrag(LayerGeometryProvider *v, int x, int y, FlexiNoteModel::Point &) const; | 178 bool getPointToDrag(LayerGeometryProvider *v, int x, int y, FlexiNoteModel::Point &) const; |
179 bool getNoteToEdit(LayerGeometryProvider *v, int x, int y, FlexiNoteModel::Point &) const; | 179 bool getNoteToEdit(LayerGeometryProvider *v, int x, int y, FlexiNoteModel::Point &) const; |