comparison layer/FlexiNoteLayer.h @ 1459:42c87368287c

Merge from branch single-point
author Chris Cannam
date Fri, 17 May 2019 10:02:52 +0100
parents f792a5001d80
children 11a150e65ee1
comparison
equal deleted inserted replaced
1441:8d5bf4ab98ef 1459:42c87368287c
14 */ 14 */
15 15
16 #ifndef SV_FLEXINOTE_LAYER_H 16 #ifndef SV_FLEXINOTE_LAYER_H
17 #define SV_FLEXINOTE_LAYER_H 17 #define SV_FLEXINOTE_LAYER_H
18 18
19 #define NOTE_HEIGHT 16
20
21 #include "SingleColourLayer.h" 19 #include "SingleColourLayer.h"
22 #include "VerticalScaleLayer.h" 20 #include "VerticalScaleLayer.h"
23 21
24 #include "data/model/FlexiNoteModel.h" 22 #include "data/model/NoteModel.h"
25 23
26 #include <QObject> 24 #include <QObject>
27 #include <QColor> 25 #include <QColor>
28 26
29 class View; 27 class View;
82 void splitNotesAt(LayerGeometryProvider *v, sv_frame_t frame); 80 void splitNotesAt(LayerGeometryProvider *v, sv_frame_t frame);
83 void snapSelectedNotesToPitchTrack(LayerGeometryProvider *v, Selection s); 81 void snapSelectedNotesToPitchTrack(LayerGeometryProvider *v, Selection s);
84 void mergeNotes(LayerGeometryProvider *v, Selection s, bool inclusive); 82 void mergeNotes(LayerGeometryProvider *v, Selection s, bool inclusive);
85 83
86 const Model *getModel() const override { return m_model; } 84 const Model *getModel() const override { return m_model; }
87 void setModel(FlexiNoteModel *model); 85 void setModel(NoteModel *model);
88 86
89 PropertyList getProperties() const override; 87 PropertyList getProperties() const override;
90 QString getPropertyLabel(const PropertyName &) const override; 88 QString getPropertyLabel(const PropertyName &) const override;
91 PropertyType getPropertyType(const PropertyName &) const override; 89 PropertyType getPropertyType(const PropertyName &) const override;
92 QString getPropertyGroupName(const PropertyName &) const override; 90 QString getPropertyGroupName(const PropertyName &) const override;
171 void getScaleExtents(LayerGeometryProvider *, double &min, double &max, bool &log) const; 169 void getScaleExtents(LayerGeometryProvider *, double &min, double &max, bool &log) const;
172 bool shouldConvertMIDIToHz() const; 170 bool shouldConvertMIDIToHz() const;
173 171
174 int getDefaultColourHint(bool dark, bool &impose) override; 172 int getDefaultColourHint(bool dark, bool &impose) override;
175 173
176 FlexiNoteModel::PointList getLocalPoints(LayerGeometryProvider *v, int) const; 174 EventVector getLocalPoints(LayerGeometryProvider *v, int) const;
177 175
178 bool getPointToDrag(LayerGeometryProvider *v, int x, int y, FlexiNoteModel::Point &) const; 176 bool getPointToDrag(LayerGeometryProvider *v, int x, int y, Event &) const;
179 bool getNoteToEdit(LayerGeometryProvider *v, int x, int y, FlexiNoteModel::Point &) const; 177 bool getNoteToEdit(LayerGeometryProvider *v, int x, int y, Event &) const;
180 void getRelativeMousePosition(LayerGeometryProvider *v, FlexiNoteModel::Point &note, int x, int y, bool &closeToLeft, bool &closeToRight, bool &closeToTop, bool &closeToBottom) const; 178 void getRelativeMousePosition(LayerGeometryProvider *v, Event &note, int x, int y, bool &closeToLeft, bool &closeToRight, bool &closeToTop, bool &closeToBottom) const;
181 SparseTimeValueModel *getAssociatedPitchModel(LayerGeometryProvider *v) const; 179 SparseTimeValueModel *getAssociatedPitchModel(LayerGeometryProvider *v) const;
182 bool updateNoteValueFromPitchCurve(LayerGeometryProvider *v, FlexiNoteModel::Point &note) const; 180 bool updateNoteValueFromPitchCurve(LayerGeometryProvider *v, Event &note) const;
183 void splitNotesAt(LayerGeometryProvider *v, sv_frame_t frame, QMouseEvent *e); 181 void splitNotesAt(LayerGeometryProvider *v, sv_frame_t frame, QMouseEvent *e);
184 182
185 FlexiNoteModel *m_model; 183 NoteModel *m_model;
186 bool m_editing; 184 bool m_editing;
187 bool m_intelligentActions; 185 bool m_intelligentActions;
188 int m_dragPointX; 186 int m_dragPointX;
189 int m_dragPointY; 187 int m_dragPointY;
190 int m_dragStartX; 188 int m_dragStartX;
191 int m_dragStartY; 189 int m_dragStartY;
192 FlexiNoteModel::Point m_originalPoint; 190 Event m_originalPoint;
193 FlexiNoteModel::Point m_editingPoint; 191 Event m_editingPoint;
194 sv_frame_t m_greatestLeftNeighbourFrame; 192 sv_frame_t m_greatestLeftNeighbourFrame;
195 sv_frame_t m_smallestRightNeighbourFrame; 193 sv_frame_t m_smallestRightNeighbourFrame;
196 FlexiNoteModel::EditCommand *m_editingCommand; 194 ChangeEventsCommand *m_editingCommand;
197 VerticalScale m_verticalScale; 195 VerticalScale m_verticalScale;
198 EditMode m_editMode; 196 EditMode m_editMode;
199 197
200 typedef std::set<FlexiNoteModel::Point, FlexiNoteModel::Point::Comparator> FlexiNoteSet; 198 typedef std::set<Event> NoteSet;
201 FlexiNoteSet m_pendingNoteOns; 199 NoteSet m_pendingNoteOns;
202 200
203 mutable double m_scaleMinimum; 201 mutable double m_scaleMinimum;
204 mutable double m_scaleMaximum; 202 mutable double m_scaleMaximum;
205 203
206 bool shouldAutoAlign() const; 204 bool shouldAutoAlign() const;
207 205
208 void finish(FlexiNoteModel::EditCommand *command) { 206 void finish(ChangeEventsCommand *command) {
209 Command *c = command->finish(); 207 Command *c = command->finish();
210 if (c) CommandHistory::getInstance()->addCommand(c, false); 208 if (c) CommandHistory::getInstance()->addCommand(c, false);
211 } 209 }
212 }; 210 };
213 211