16 #ifndef _FLEXINOTE_LAYER_H_ 17 #define _FLEXINOTE_LAYER_H_ 19 #define NOTE_HEIGHT 16 24 #include "data/model/FlexiNoteModel.h" 31 class SparseTimeValueModel;
78 virtual void copy(
View *v, Selection s, Clipboard &to);
79 virtual bool paste(
View *v,
const Clipboard &from,
int frameOffset,
87 void setModel(FlexiNoteModel *model);
94 int *min,
int *max,
int *deflt)
const;
97 virtual void setProperty(
const PropertyName &,
int value);
126 bool &log, QString &unit)
const;
141 void addNoteOn(
int frame,
int pitch,
int velocity);
154 virtual void toXml(QTextStream &stream, QString indent =
"",
155 QString extraAttributes =
"")
const;
176 void getRelativeMousePosition(
View *v, FlexiNoteModel::Point ¬e,
int x,
int y,
bool &closeToLeft,
bool &closeToRight,
bool &closeToTop,
bool &closeToBottom)
const;
196 typedef std::set<FlexiNoteModel::Point, FlexiNoteModel::Point::Comparator>
FlexiNoteSet;
204 void finish(FlexiNoteModel::EditCommand *command) {
205 Command *c = command->finish();
virtual QString getScaleUnits() const
virtual QString getPropertyGroupName(const PropertyName &) const
virtual RangeMapper * getNewVerticalZoomRangeMapper() const
Create and return a range mapper for vertical zoom step values.
void setIntelligentActions(bool on)
virtual void setProperty(const PropertyName &, int value)
virtual void toXml(QTextStream &stream, QString indent="", QString extraAttributes="") const
Convert the layer's data (though not those of the model it refers to) into XML for file output.
virtual void drawStart(View *v, QMouseEvent *)
virtual bool getValueExtents(float &min, float &max, bool &log, QString &unit) const
Return the minimum and maximum values for the y axis of the model in this layer, as well as whether t...
VerticalScale getVerticalScale() const
int m_smallestRightNeighbourFrame
virtual QString getPropertyLabel(const PropertyName &) const
virtual int getYForValue(View *v, float value) const
VerticalScaleLayer methods.
virtual QString getPropertyValueLabel(const PropertyName &, int value) const
bool getPointToDrag(View *v, int x, int y, FlexiNoteModel::Point &) const
virtual float getValueForY(View *v, int y) const
virtual void eraseEnd(View *v, QMouseEvent *)
bool shouldConvertMIDIToHz() const
virtual void editEnd(View *v, QMouseEvent *)
virtual void copy(View *v, Selection s, Clipboard &to)
virtual int getCurrentVerticalZoomStep() const
Get the current vertical zoom step.
void addCommand(Command *command)
Add a command to the command history.
virtual bool getDisplayExtents(float &min, float &max) const
Return the minimum and maximum values within the displayed range for the y axis, if only a subset of ...
FlexiNoteModel::Point m_editingPoint
virtual bool editOpen(View *v, QMouseEvent *)
Open an editor on the item under the mouse (e.g.
bool shouldAutoAlign() const
virtual bool isLayerScrollable(const View *v) const
This should return true if the layer can safely be scrolled automatically by a given view (simply cop...
void setVerticalScale(VerticalScale scale)
virtual int getVerticalZoomSteps(int &defaultStep) const
Get the number of vertical zoom steps available for this layer.
virtual void deleteSelectionInclusive(Selection s)
virtual void eraseDrag(View *v, QMouseEvent *)
virtual const Model * getModel() const
virtual void moveSelection(Selection s, int newStartFrame)
virtual QString getFeatureDescription(View *v, QPoint &) const
virtual bool isLayerEditable() const
This should return true if the layer can be edited by the user.
virtual bool setDisplayExtents(float min, float max)
Set the displayed minimum and maximum values for the y axis to the given range, if supported.
void addNoteOff(int frame, int pitch)
Add a note-off.
virtual void splitEnd(View *v, QMouseEvent *)
void setModel(FlexiNoteModel *model)
FlexiNoteModel::Point m_originalPoint
void getRelativeMousePosition(View *v, FlexiNoteModel::Point ¬e, int x, int y, bool &closeToLeft, bool &closeToRight, bool &closeToTop, bool &closeToBottom) const
virtual void deleteSelection(Selection s)
virtual void paint(View *v, QPainter &paint, QRect rect) const
Paint the given rectangle of this layer onto the given view using the given painter,...
std::set< FlexiNoteModel::Point, FlexiNoteModel::Point::Comparator > FlexiNoteSet
virtual void editStart(View *v, QMouseEvent *)
virtual void addNote(View *v, QMouseEvent *e)
FlexiNoteSet m_pendingNoteOns
void mergeNotes(View *v, Selection s, bool inclusive)
virtual void editDrag(View *v, QMouseEvent *)
static CommandHistory * getInstance()
virtual void eraseStart(View *v, QMouseEvent *)
VerticalScale m_verticalScale
virtual bool snapToFeatureFrame(View *v, int &frame, int &resolution, SnapType snap) const
Adjust the given frame to snap to the nearest feature, if possible.
FlexiNoteModel::PointList getLocalPoints(View *v, int) const
void abandonNoteOns()
Abandon all pending note-on events.
void setProperties(const QXmlAttributes &attributes)
Set the particular properties of a layer (those specific to the subclass) from a set of XML attribute...
virtual void setVerticalZoomStep(int)
!! lots of duplication with TimeValueLayer
virtual bool paste(View *v, const Clipboard &from, int frameOffset, bool interactive)
Paste from the given clipboard onto the layer at the given frame offset.
void finish(FlexiNoteModel::EditCommand *command)
bool getNoteToEdit(View *v, int x, int y, FlexiNoteModel::Point &) const
void snapSelectedNotesToPitchTrack(View *v, Selection s)
View is the base class of widgets that display one or more overlaid views of data against a horizonta...
bool updateNoteValue(View *v, FlexiNoteModel::Point ¬e) const
virtual int getCompletion(View *) const
Return the proportion of background work complete in drawing this view, as a percentage – in most cas...
FlexiNoteModel::EditCommand * m_editingCommand
SparseTimeValueModel * getAssociatedPitchModel(View *v) const
virtual void mouseMoveEvent(View *v, QMouseEvent *)
virtual int getDefaultColourHint(bool dark, bool &impose)
virtual void resizeSelection(Selection s, Selection newSize)
virtual int getPropertyRangeAndValue(const PropertyName &, int *min, int *max, int *deflt) const
void setVerticalRangeToNoteRange(View *v)
virtual void drawEnd(View *v, QMouseEvent *)
virtual int getVerticalScaleWidth(View *v, bool, QPainter &) const
void splitNotesAt(View *v, int frame)
virtual PropertyList getProperties() const
virtual void drawDrag(View *v, QMouseEvent *)
virtual void paintVerticalScale(View *v, bool, QPainter &paint, QRect rect) const
virtual PropertyType getPropertyType(const PropertyName &) const
virtual void splitStart(View *v, QMouseEvent *)
bool m_intelligentActions
void getScaleExtents(View *, float &min, float &max, bool &log) const
int m_greatestLeftNeighbourFrame
void addNoteOn(int frame, int pitch, int velocity)
Add a note-on.