Mercurial > hg > svgui
comparison layer/FlexiNoteLayer.h @ 978:64c2b3a4435a 3.0-integration
Merge from branch osx-retina
author | Chris Cannam |
---|---|
date | Fri, 26 Jun 2015 14:10:40 +0100 |
parents | bb80983c9e61 |
children | a18e78b9c78b |
comparison
equal
deleted
inserted
replaced
977:f40ccbf228c2 | 978:64c2b3a4435a |
---|---|
36 Q_OBJECT | 36 Q_OBJECT |
37 | 37 |
38 public: | 38 public: |
39 FlexiNoteLayer(); | 39 FlexiNoteLayer(); |
40 | 40 |
41 virtual void paint(View *v, QPainter &paint, QRect rect) const; | 41 virtual void paint(LayerGeometryProvider *v, QPainter &paint, QRect rect) const; |
42 | 42 |
43 virtual int getVerticalScaleWidth(View *v, bool, QPainter &) const; | 43 virtual int getVerticalScaleWidth(LayerGeometryProvider *v, bool, QPainter &) const; |
44 virtual void paintVerticalScale(View *v, bool, QPainter &paint, QRect rect) const; | 44 virtual void paintVerticalScale(LayerGeometryProvider *v, bool, QPainter &paint, QRect rect) const; |
45 | 45 |
46 virtual QString getFeatureDescription(View *v, QPoint &) const; | 46 virtual QString getFeatureDescription(LayerGeometryProvider *v, QPoint &) const; |
47 | 47 |
48 virtual bool snapToFeatureFrame(View *v, sv_frame_t &frame, | 48 virtual bool snapToFeatureFrame(LayerGeometryProvider *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(LayerGeometryProvider *v, QMouseEvent *); |
53 virtual void drawDrag(View *v, QMouseEvent *); | 53 virtual void drawDrag(LayerGeometryProvider *v, QMouseEvent *); |
54 virtual void drawEnd(View *v, QMouseEvent *); | 54 virtual void drawEnd(LayerGeometryProvider *v, QMouseEvent *); |
55 | 55 |
56 virtual void eraseStart(View *v, QMouseEvent *); | 56 virtual void eraseStart(LayerGeometryProvider *v, QMouseEvent *); |
57 virtual void eraseDrag(View *v, QMouseEvent *); | 57 virtual void eraseDrag(LayerGeometryProvider *v, QMouseEvent *); |
58 virtual void eraseEnd(View *v, QMouseEvent *); | 58 virtual void eraseEnd(LayerGeometryProvider *v, QMouseEvent *); |
59 | 59 |
60 virtual void editStart(View *v, QMouseEvent *); | 60 virtual void editStart(LayerGeometryProvider *v, QMouseEvent *); |
61 virtual void editDrag(View *v, QMouseEvent *); | 61 virtual void editDrag(LayerGeometryProvider *v, QMouseEvent *); |
62 virtual void editEnd(View *v, QMouseEvent *); | 62 virtual void editEnd(LayerGeometryProvider *v, QMouseEvent *); |
63 | 63 |
64 virtual void splitStart(View *v, QMouseEvent *); | 64 virtual void splitStart(LayerGeometryProvider *v, QMouseEvent *); |
65 virtual void splitEnd(View *v, QMouseEvent *); | 65 virtual void splitEnd(LayerGeometryProvider *v, QMouseEvent *); |
66 | 66 |
67 virtual void addNote(View *v, QMouseEvent *e); | 67 virtual void addNote(LayerGeometryProvider *v, QMouseEvent *e); |
68 | 68 |
69 virtual void mouseMoveEvent(View *v, QMouseEvent *); | 69 virtual void mouseMoveEvent(LayerGeometryProvider *v, QMouseEvent *); |
70 | 70 |
71 virtual bool editOpen(View *v, QMouseEvent *); | 71 virtual bool editOpen(LayerGeometryProvider *v, QMouseEvent *); |
72 | 72 |
73 virtual void moveSelection(Selection s, sv_frame_t 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(LayerGeometryProvider *v, Selection s, Clipboard &to); |
79 virtual bool paste(View *v, const Clipboard &from, sv_frame_t frameOffset, | 79 virtual bool paste(LayerGeometryProvider *v, const Clipboard &from, sv_frame_t frameOffset, |
80 bool interactive); | 80 bool interactive); |
81 | 81 |
82 void splitNotesAt(View *v, sv_frame_t frame); | 82 void splitNotesAt(LayerGeometryProvider *v, sv_frame_t frame); |
83 void snapSelectedNotesToPitchTrack(View *v, Selection s); | 83 void snapSelectedNotesToPitchTrack(LayerGeometryProvider *v, Selection s); |
84 void mergeNotes(View *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 virtual const Model *getModel() const { return m_model; } |
87 void setModel(FlexiNoteModel *model); | 87 void setModel(FlexiNoteModel *model); |
88 | 88 |
89 virtual PropertyList getProperties() const; | 89 virtual PropertyList getProperties() const; |
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 View *v) const; | 119 virtual bool isLayerScrollable(const LayerGeometryProvider *v) const; |
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(LayerGeometryProvider *) const { return m_model->getCompletion(); } |
124 | 124 |
125 virtual bool getValueExtents(double &min, double &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(double &min, double &max) const; | 128 virtual bool getDisplayExtents(double &min, double &max) const; |
154 virtual void toXml(QTextStream &stream, QString indent = "", | 154 virtual void toXml(QTextStream &stream, QString indent = "", |
155 QString extraAttributes = "") const; | 155 QString extraAttributes = "") const; |
156 | 156 |
157 void setProperties(const QXmlAttributes &attributes); | 157 void setProperties(const QXmlAttributes &attributes); |
158 | 158 |
159 void setVerticalRangeToNoteRange(View *v); | 159 void setVerticalRangeToNoteRange(LayerGeometryProvider *v); |
160 | 160 |
161 /// VerticalScaleLayer methods | 161 /// VerticalScaleLayer methods |
162 virtual int getYForValue(View *v, double value) const; | 162 virtual int getYForValue(LayerGeometryProvider *v, double value) const; |
163 virtual double getValueForY(View *v, int y) const; | 163 virtual double getValueForY(LayerGeometryProvider *v, int y) const; |
164 virtual QString getScaleUnits() const; | 164 virtual QString getScaleUnits() const; |
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(View *, 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 virtual int getDefaultColourHint(bool dark, bool &impose); |
175 | 175 |
176 FlexiNoteModel::PointList getLocalPoints(View *v, int) const; | 176 FlexiNoteModel::PointList getLocalPoints(LayerGeometryProvider *v, int) const; |
177 | 177 |
178 bool getPointToDrag(View *v, int x, int y, FlexiNoteModel::Point &) const; | 178 bool getPointToDrag(LayerGeometryProvider *v, int x, int y, FlexiNoteModel::Point &) const; |
179 bool getNoteToEdit(View *v, int x, int y, FlexiNoteModel::Point &) const; | 179 bool getNoteToEdit(LayerGeometryProvider *v, int x, int y, FlexiNoteModel::Point &) const; |
180 void getRelativeMousePosition(View *v, FlexiNoteModel::Point ¬e, | 180 void getRelativeMousePosition(LayerGeometryProvider *v, FlexiNoteModel::Point ¬e, int x, int y, bool &closeToLeft, bool &closeToRight, bool &closeToTop, bool &closeToBottom) const; |
181 int x, int y, | 181 SparseTimeValueModel *getAssociatedPitchModel(LayerGeometryProvider *v) const; |
182 bool &closeToLeft, bool &closeToRight, | 182 bool updateNoteValueFromPitchCurve(LayerGeometryProvider *v, FlexiNoteModel::Point ¬e) const; |
183 bool &closeToTop, bool &closeToBottom) const; | 183 void splitNotesAt(LayerGeometryProvider *v, sv_frame_t frame, QMouseEvent *e); |
184 SparseTimeValueModel *getAssociatedPitchModel(View *v) const; | |
185 bool updateNoteValueFromPitchCurve(View *v, | |
186 FlexiNoteModel::Point ¬e) const; | |
187 void splitNotesAt(View *v, sv_frame_t frame, QMouseEvent *e); | |
188 | 184 |
189 FlexiNoteModel *m_model; | 185 FlexiNoteModel *m_model; |
190 bool m_editing; | 186 bool m_editing; |
191 bool m_intelligentActions; | 187 bool m_intelligentActions; |
192 int m_dragPointX; | 188 int m_dragPointX; |