comparison layer/NoteLayer.h @ 946:36cddc3de023 alignment_view

Merge from default branch
author Chris Cannam
date Mon, 20 Apr 2015 09:19:52 +0100
parents b66fb15de477
children 94e4952a6774
comparison
equal deleted inserted replaced
897:499b637f2a26 946:36cddc3de023
40 virtual int getVerticalScaleWidth(View *v, bool, QPainter &) const; 40 virtual int getVerticalScaleWidth(View *v, bool, QPainter &) const;
41 virtual void paintVerticalScale(View *v, bool, QPainter &paint, QRect rect) const; 41 virtual void paintVerticalScale(View *v, bool, QPainter &paint, QRect rect) const;
42 42
43 virtual QString getFeatureDescription(View *v, QPoint &) const; 43 virtual QString getFeatureDescription(View *v, QPoint &) const;
44 44
45 virtual bool snapToFeatureFrame(View *v, int &frame, 45 virtual bool snapToFeatureFrame(View *v, sv_frame_t &frame,
46 int &resolution, 46 int &resolution,
47 SnapType snap) const; 47 SnapType snap) const;
48 48
49 virtual void drawStart(View *v, QMouseEvent *); 49 virtual void drawStart(View *v, QMouseEvent *);
50 virtual void drawDrag(View *v, QMouseEvent *); 50 virtual void drawDrag(View *v, QMouseEvent *);
58 virtual void editDrag(View *v, QMouseEvent *); 58 virtual void editDrag(View *v, QMouseEvent *);
59 virtual void editEnd(View *v, QMouseEvent *); 59 virtual void editEnd(View *v, QMouseEvent *);
60 60
61 virtual bool editOpen(View *v, QMouseEvent *); 61 virtual bool editOpen(View *v, QMouseEvent *);
62 62
63 virtual void moveSelection(Selection s, int newStartFrame); 63 virtual void moveSelection(Selection s, sv_frame_t newStartFrame);
64 virtual void resizeSelection(Selection s, Selection newSize); 64 virtual void resizeSelection(Selection s, Selection newSize);
65 virtual void deleteSelection(Selection s); 65 virtual void deleteSelection(Selection s);
66 66
67 virtual void copy(View *v, Selection s, Clipboard &to); 67 virtual void copy(View *v, Selection s, Clipboard &to);
68 virtual bool paste(View *v, const Clipboard &from, int frameOffset, 68 virtual bool paste(View *v, const Clipboard &from, sv_frame_t frameOffset,
69 bool interactive); 69 bool interactive);
70 70
71 virtual const Model *getModel() const { return m_model; } 71 virtual const Model *getModel() const { return m_model; }
72 void setModel(NoteModel *model); 72 void setModel(NoteModel *model);
73 73
95 95
96 virtual bool isLayerEditable() const { return true; } 96 virtual bool isLayerEditable() const { return true; }
97 97
98 virtual int getCompletion(View *) const { return m_model->getCompletion(); } 98 virtual int getCompletion(View *) const { return m_model->getCompletion(); }
99 99
100 virtual bool getValueExtents(float &min, float &max, 100 virtual bool getValueExtents(double &min, double &max,
101 bool &log, QString &unit) const; 101 bool &log, QString &unit) const;
102 102
103 virtual bool getDisplayExtents(float &min, float &max) const; 103 virtual bool getDisplayExtents(double &min, double &max) const;
104 virtual bool setDisplayExtents(float min, float max); 104 virtual bool setDisplayExtents(double min, double max);
105 105
106 virtual int getVerticalZoomSteps(int &defaultStep) const; 106 virtual int getVerticalZoomSteps(int &defaultStep) const;
107 virtual int getCurrentVerticalZoomStep() const; 107 virtual int getCurrentVerticalZoomStep() const;
108 virtual void setVerticalZoomStep(int); 108 virtual void setVerticalZoomStep(int);
109 virtual RangeMapper *getNewVerticalZoomRangeMapper() const; 109 virtual RangeMapper *getNewVerticalZoomRangeMapper() const;
111 /** 111 /**
112 * Add a note-on. Used when recording MIDI "live". The note will 112 * Add a note-on. Used when recording MIDI "live". The note will
113 * not be finally added to the layer until the corresponding 113 * not be finally added to the layer until the corresponding
114 * note-off. 114 * note-off.
115 */ 115 */
116 void addNoteOn(int frame, int pitch, int velocity); 116 void addNoteOn(sv_frame_t frame, int pitch, int velocity);
117 117
118 /** 118 /**
119 * Add a note-off. This will cause a note to appear, if and only 119 * Add a note-off. This will cause a note to appear, if and only
120 * if there is a matching pending note-on. 120 * if there is a matching pending note-on.
121 */ 121 */
122 void addNoteOff(int frame, int pitch); 122 void addNoteOff(sv_frame_t frame, int pitch);
123 123
124 /** 124 /**
125 * Abandon all pending note-on events. 125 * Abandon all pending note-on events.
126 */ 126 */
127 void abandonNoteOns(); 127 void abandonNoteOns();
130 QString extraAttributes = "") const; 130 QString extraAttributes = "") const;
131 131
132 void setProperties(const QXmlAttributes &attributes); 132 void setProperties(const QXmlAttributes &attributes);
133 133
134 /// VerticalScaleLayer methods 134 /// VerticalScaleLayer methods
135 virtual int getYForValue(View *v, float value) const; 135 virtual int getYForValue(View *v, double value) const;
136 virtual float getValueForY(View *v, int y) const; 136 virtual double getValueForY(View *v, int y) const;
137 virtual QString getScaleUnits() const; 137 virtual QString getScaleUnits() const;
138 138
139 protected: 139 protected:
140 void getScaleExtents(View *, float &min, float &max, bool &log) const; 140 void getScaleExtents(View *, double &min, double &max, bool &log) const;
141 bool shouldConvertMIDIToHz() const; 141 bool shouldConvertMIDIToHz() const;
142 142
143 virtual int getDefaultColourHint(bool dark, bool &impose); 143 virtual int getDefaultColourHint(bool dark, bool &impose);
144 144
145 NoteModel::PointList getLocalPoints(View *v, int) const; 145 NoteModel::PointList getLocalPoints(View *v, int) const;
158 VerticalScale m_verticalScale; 158 VerticalScale m_verticalScale;
159 159
160 typedef std::set<NoteModel::Point, NoteModel::Point::Comparator> NoteSet; 160 typedef std::set<NoteModel::Point, NoteModel::Point::Comparator> NoteSet;
161 NoteSet m_pendingNoteOns; 161 NoteSet m_pendingNoteOns;
162 162
163 mutable float m_scaleMinimum; 163 mutable double m_scaleMinimum;
164 mutable float m_scaleMaximum; 164 mutable double m_scaleMaximum;
165 165
166 bool shouldAutoAlign() const; 166 bool shouldAutoAlign() const;
167 167
168 void finish(NoteModel::EditCommand *command) { 168 void finish(NoteModel::EditCommand *command) {
169 Command *c = command->finish(); 169 Command *c = command->finish();