Mercurial > hg > svgui
comparison layer/FlexiNoteLayer.h @ 916:94e4952a6774 osx-retina
Start trying to introduce LayerGeometryProvider as proxyable interface for View methods that the Layer wants to use
author | Chris Cannam |
---|---|
date | Tue, 17 Mar 2015 15:05:25 +0000 |
parents | b66fb15de477 |
children | bb80983c9e61 |
comparison
equal
deleted
inserted
replaced
915:f6d9f28f37cb | 916:94e4952a6774 |
---|---|
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 protected: | 166 protected: |
167 void getScaleExtents(View *, double &min, double &max, bool &log) const; | 167 void getScaleExtents(LayerGeometryProvider *, double &min, double &max, bool &log) const; |
168 bool shouldConvertMIDIToHz() const; | 168 bool shouldConvertMIDIToHz() const; |
169 | 169 |
170 virtual int getDefaultColourHint(bool dark, bool &impose); | 170 virtual int getDefaultColourHint(bool dark, bool &impose); |
171 | 171 |
172 FlexiNoteModel::PointList getLocalPoints(View *v, int) const; | 172 FlexiNoteModel::PointList getLocalPoints(LayerGeometryProvider *v, int) const; |
173 | 173 |
174 bool getPointToDrag(View *v, int x, int y, FlexiNoteModel::Point &) const; | 174 bool getPointToDrag(LayerGeometryProvider *v, int x, int y, FlexiNoteModel::Point &) const; |
175 bool getNoteToEdit(View *v, int x, int y, FlexiNoteModel::Point &) const; | 175 bool getNoteToEdit(LayerGeometryProvider *v, int x, int y, FlexiNoteModel::Point &) const; |
176 void getRelativeMousePosition(View *v, FlexiNoteModel::Point ¬e, int x, int y, bool &closeToLeft, bool &closeToRight, bool &closeToTop, bool &closeToBottom) const; | 176 void getRelativeMousePosition(LayerGeometryProvider *v, FlexiNoteModel::Point ¬e, int x, int y, bool &closeToLeft, bool &closeToRight, bool &closeToTop, bool &closeToBottom) const; |
177 SparseTimeValueModel *getAssociatedPitchModel(View *v) const; | 177 SparseTimeValueModel *getAssociatedPitchModel(LayerGeometryProvider *v) const; |
178 bool updateNoteValue(View *v, FlexiNoteModel::Point ¬e) const; | 178 bool updateNoteValue(LayerGeometryProvider *v, FlexiNoteModel::Point ¬e) const; |
179 void splitNotesAt(View *v, sv_frame_t frame, QMouseEvent *e); | 179 void splitNotesAt(LayerGeometryProvider *v, sv_frame_t frame, QMouseEvent *e); |
180 | 180 |
181 FlexiNoteModel *m_model; | 181 FlexiNoteModel *m_model; |
182 bool m_editing; | 182 bool m_editing; |
183 bool m_intelligentActions; | 183 bool m_intelligentActions; |
184 int m_dragPointX; | 184 int m_dragPointX; |