Mercurial > hg > svgui
comparison layer/FlexiNoteLayer.h @ 922:26da827e8fb5 tonioni
Merge from cxx11 branch
author | Chris Cannam |
---|---|
date | Mon, 23 Mar 2015 11:26:28 +0000 |
parents | b62c2785ed83 b66fb15de477 |
children | bb80983c9e61 |
comparison
equal
deleted
inserted
replaced
921:4968bbaf1ed8 | 922:26da827e8fb5 |
---|---|
43 virtual int getVerticalScaleWidth(View *v, bool, QPainter &) const; | 43 virtual int getVerticalScaleWidth(View *v, bool, QPainter &) const; |
44 virtual void paintVerticalScale(View *v, bool, QPainter &paint, QRect rect) const; | 44 virtual void paintVerticalScale(View *v, bool, QPainter &paint, QRect rect) const; |
45 | 45 |
46 virtual QString getFeatureDescription(View *v, QPoint &) const; | 46 virtual QString getFeatureDescription(View *v, QPoint &) const; |
47 | 47 |
48 virtual bool snapToFeatureFrame(View *v, int &frame, | 48 virtual bool snapToFeatureFrame(View *v, sv_frame_t &frame, |
49 int &resolution, | 49 int &resolution, |
50 SnapType snap) const; | 50 SnapType snap) const; |
51 | 51 |
52 virtual void drawStart(View *v, QMouseEvent *); | 52 virtual void drawStart(View *v, QMouseEvent *); |
53 virtual void drawDrag(View *v, QMouseEvent *); | 53 virtual void drawDrag(View *v, QMouseEvent *); |
68 | 68 |
69 virtual void mouseMoveEvent(View *v, QMouseEvent *); | 69 virtual void mouseMoveEvent(View *v, QMouseEvent *); |
70 | 70 |
71 virtual bool editOpen(View *v, QMouseEvent *); | 71 virtual bool editOpen(View *v, QMouseEvent *); |
72 | 72 |
73 virtual void moveSelection(Selection s, int newStartFrame); | 73 virtual void moveSelection(Selection s, sv_frame_t newStartFrame); |
74 virtual void resizeSelection(Selection s, Selection newSize); | 74 virtual void resizeSelection(Selection s, Selection newSize); |
75 virtual void deleteSelection(Selection s); | 75 virtual void deleteSelection(Selection s); |
76 virtual void deleteSelectionInclusive(Selection s); | 76 virtual void deleteSelectionInclusive(Selection s); |
77 | 77 |
78 virtual void copy(View *v, Selection s, Clipboard &to); | 78 virtual void copy(View *v, Selection s, Clipboard &to); |
79 virtual bool paste(View *v, const Clipboard &from, int frameOffset, | 79 virtual bool paste(View *v, const Clipboard &from, sv_frame_t frameOffset, |
80 bool interactive); | 80 bool interactive); |
81 | 81 |
82 void splitNotesAt(View *v, int frame); | 82 void splitNotesAt(View *v, sv_frame_t frame); |
83 void snapSelectedNotesToPitchTrack(View *v, Selection s); | 83 void snapSelectedNotesToPitchTrack(View *v, Selection s); |
84 void mergeNotes(View *v, Selection s, bool inclusive); | 84 void mergeNotes(View *v, Selection s, bool inclusive); |
85 | 85 |
86 virtual const Model *getModel() const { return m_model; } | 86 virtual const Model *getModel() const { return m_model; } |
87 void setModel(FlexiNoteModel *model); | 87 void setModel(FlexiNoteModel *model); |
120 | 120 |
121 virtual bool isLayerEditable() const { return true; } | 121 virtual bool isLayerEditable() const { return true; } |
122 | 122 |
123 virtual int getCompletion(View *) const { return m_model->getCompletion(); } | 123 virtual int getCompletion(View *) const { return m_model->getCompletion(); } |
124 | 124 |
125 virtual bool getValueExtents(float &min, float &max, | 125 virtual bool getValueExtents(double &min, double &max, |
126 bool &log, QString &unit) const; | 126 bool &log, QString &unit) const; |
127 | 127 |
128 virtual bool getDisplayExtents(float &min, float &max) const; | 128 virtual bool getDisplayExtents(double &min, double &max) const; |
129 virtual bool setDisplayExtents(float min, float max); | 129 virtual bool setDisplayExtents(double min, double max); |
130 | 130 |
131 virtual int getVerticalZoomSteps(int &defaultStep) const; | 131 virtual int getVerticalZoomSteps(int &defaultStep) const; |
132 virtual int getCurrentVerticalZoomStep() const; | 132 virtual int getCurrentVerticalZoomStep() const; |
133 virtual void setVerticalZoomStep(int); | 133 virtual void setVerticalZoomStep(int); |
134 virtual RangeMapper *getNewVerticalZoomRangeMapper() const; | 134 virtual RangeMapper *getNewVerticalZoomRangeMapper() const; |
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. |
140 */ | 140 */ |
141 void addNoteOn(int frame, int pitch, int velocity); | 141 void addNoteOn(sv_frame_t frame, int pitch, int velocity); |
142 | 142 |
143 /** | 143 /** |
144 * Add a note-off. This will cause a note to appear, if and only | 144 * Add a note-off. This will cause a note to appear, if and only |
145 * if there is a matching pending note-on. | 145 * if there is a matching pending note-on. |
146 */ | 146 */ |
147 void addNoteOff(int frame, int pitch); | 147 void addNoteOff(sv_frame_t frame, int pitch); |
148 | 148 |
149 /** | 149 /** |
150 * Abandon all pending note-on events. | 150 * Abandon all pending note-on events. |
151 */ | 151 */ |
152 void abandonNoteOns(); | 152 void abandonNoteOns(); |
157 void setProperties(const QXmlAttributes &attributes); | 157 void setProperties(const QXmlAttributes &attributes); |
158 | 158 |
159 void setVerticalRangeToNoteRange(View *v); | 159 void setVerticalRangeToNoteRange(View *v); |
160 | 160 |
161 /// VerticalScaleLayer methods | 161 /// VerticalScaleLayer methods |
162 virtual int getYForValue(View *v, float value) const; | 162 virtual int getYForValue(View *v, double value) const; |
163 virtual float getValueForY(View *v, int y) const; | 163 virtual double getValueForY(View *v, int y) const; |
164 virtual QString getScaleUnits() const; | 164 virtual QString getScaleUnits() const; |
165 | 165 |
166 signals: | 166 signals: |
167 void reAnalyseRegion(int, int, 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(View *, float &min, float &max, bool &log) const; | 171 void getScaleExtents(View *, 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 virtual int getDefaultColourHint(bool dark, bool &impose); |
175 | 175 |
176 FlexiNoteModel::PointList getLocalPoints(View *v, int) const; | 176 FlexiNoteModel::PointList getLocalPoints(View *v, int) const; |
182 bool &closeToLeft, bool &closeToRight, | 182 bool &closeToLeft, bool &closeToRight, |
183 bool &closeToTop, bool &closeToBottom) const; | 183 bool &closeToTop, bool &closeToBottom) const; |
184 SparseTimeValueModel *getAssociatedPitchModel(View *v) const; | 184 SparseTimeValueModel *getAssociatedPitchModel(View *v) const; |
185 bool updateNoteValueFromPitchCurve(View *v, | 185 bool updateNoteValueFromPitchCurve(View *v, |
186 FlexiNoteModel::Point ¬e) const; | 186 FlexiNoteModel::Point ¬e) const; |
187 void splitNotesAt(View *v, int frame, QMouseEvent *e); | 187 void splitNotesAt(View *v, sv_frame_t frame, QMouseEvent *e); |
188 | 188 |
189 FlexiNoteModel *m_model; | 189 FlexiNoteModel *m_model; |
190 bool m_editing; | 190 bool m_editing; |
191 bool m_intelligentActions; | 191 bool m_intelligentActions; |
192 int m_dragPointX; | 192 int m_dragPointX; |
193 int m_dragPointY; | 193 int m_dragPointY; |
194 int m_dragStartX; | 194 int m_dragStartX; |
195 int m_dragStartY; | 195 int m_dragStartY; |
196 FlexiNoteModel::Point m_originalPoint; | 196 FlexiNoteModel::Point m_originalPoint; |
197 FlexiNoteModel::Point m_editingPoint; | 197 FlexiNoteModel::Point m_editingPoint; |
198 int m_greatestLeftNeighbourFrame; | 198 sv_frame_t m_greatestLeftNeighbourFrame; |
199 int m_smallestRightNeighbourFrame; | 199 sv_frame_t m_smallestRightNeighbourFrame; |
200 FlexiNoteModel::EditCommand *m_editingCommand; | 200 FlexiNoteModel::EditCommand *m_editingCommand; |
201 VerticalScale m_verticalScale; | 201 VerticalScale m_verticalScale; |
202 EditMode m_editMode; | 202 EditMode m_editMode; |
203 | 203 |
204 typedef std::set<FlexiNoteModel::Point, FlexiNoteModel::Point::Comparator> FlexiNoteSet; | 204 typedef std::set<FlexiNoteModel::Point, FlexiNoteModel::Point::Comparator> FlexiNoteSet; |
205 FlexiNoteSet m_pendingNoteOns; | 205 FlexiNoteSet m_pendingNoteOns; |
206 | 206 |
207 mutable float m_scaleMinimum; | 207 mutable double m_scaleMinimum; |
208 mutable float m_scaleMaximum; | 208 mutable double m_scaleMaximum; |
209 | 209 |
210 bool shouldAutoAlign() const; | 210 bool shouldAutoAlign() const; |
211 | 211 |
212 void finish(FlexiNoteModel::EditCommand *command) { | 212 void finish(FlexiNoteModel::EditCommand *command) { |
213 Command *c = command->finish(); | 213 Command *c = command->finish(); |