annotate layer/NoteLayer.h @ 43:78515b1e29eb

* Rejig project file a bit to do pkg-config detection &c and change some HAVE_* symbol names accordingly * Add selection move/resize/delete * First stubs for add layer / pane commands
author Chris Cannam
date Wed, 01 Mar 2006 18:13:01 +0000
parents ea6fe8cfcdd5
children ad214997dddb
rev   line source
Chris@30 1 /* -*- c-basic-offset: 4 -*- vi:set ts=8 sts=4 sw=4: */
Chris@30 2
Chris@30 3 /*
Chris@30 4 A waveform viewer and audio annotation editor.
Chris@30 5 Chris Cannam, Queen Mary University of London, 2005-2006
Chris@30 6
Chris@30 7 This is experimental software. Not for distribution.
Chris@30 8 */
Chris@30 9
Chris@30 10 #ifndef _NOTE_LAYER_H_
Chris@30 11 #define _NOTE_LAYER_H_
Chris@30 12
Chris@30 13 #include "base/Layer.h"
Chris@30 14 #include "model/NoteModel.h"
Chris@30 15
Chris@30 16 #include <QObject>
Chris@30 17 #include <QColor>
Chris@30 18
Chris@30 19 class View;
Chris@30 20 class QPainter;
Chris@30 21
Chris@30 22 class NoteLayer : public Layer
Chris@30 23 {
Chris@30 24 Q_OBJECT
Chris@30 25
Chris@30 26 public:
Chris@30 27 NoteLayer(View *w);
Chris@30 28
Chris@30 29 virtual void paint(QPainter &paint, QRect rect) const;
Chris@30 30
Chris@30 31 virtual QString getFeatureDescription(QPoint &) const;
Chris@30 32
Chris@30 33 virtual bool snapToFeatureFrame(int &frame,
Chris@30 34 size_t &resolution,
Chris@30 35 SnapType snap) const;
Chris@30 36
Chris@30 37 virtual void drawStart(QMouseEvent *);
Chris@30 38 virtual void drawDrag(QMouseEvent *);
Chris@30 39 virtual void drawEnd(QMouseEvent *);
Chris@30 40
Chris@30 41 virtual void editStart(QMouseEvent *);
Chris@30 42 virtual void editDrag(QMouseEvent *);
Chris@30 43 virtual void editEnd(QMouseEvent *);
Chris@30 44
Chris@43 45 virtual void moveSelection(Selection s, size_t newStartFrame);
Chris@43 46 virtual void resizeSelection(Selection s, Selection newSize);
Chris@43 47
Chris@30 48 virtual const Model *getModel() const { return m_model; }
Chris@30 49 void setModel(NoteModel *model);
Chris@30 50
Chris@30 51 virtual PropertyList getProperties() const;
Chris@30 52 virtual PropertyType getPropertyType(const PropertyName &) const;
Chris@30 53 virtual int getPropertyRangeAndValue(const PropertyName &,
Chris@30 54 int *min, int *max) const;
Chris@30 55 virtual QString getPropertyValueLabel(const PropertyName &,
Chris@30 56 int value) const;
Chris@30 57 virtual void setProperty(const PropertyName &, int value);
Chris@30 58
Chris@30 59 void setBaseColour(QColor);
Chris@30 60 QColor getBaseColour() const { return m_colour; }
Chris@30 61
Chris@30 62 enum VerticalScale {
Chris@30 63 MinMaxRangeScale,
Chris@30 64 MIDIRangeScale,
Chris@30 65 FrequencyScale
Chris@30 66 };
Chris@30 67
Chris@30 68 void setVerticalScale(VerticalScale scale);
Chris@30 69 VerticalScale getVerticalScale() const { return m_verticalScale; }
Chris@30 70
Chris@30 71 virtual bool isLayerScrollable() const;
Chris@30 72
Chris@30 73 virtual bool isLayerEditable() const { return true; }
Chris@30 74
Chris@30 75 virtual int getCompletion() const { return m_model->getCompletion(); }
Chris@30 76
Chris@30 77 virtual QString toXmlString(QString indent = "",
Chris@30 78 QString extraAttributes = "") const;
Chris@30 79
Chris@30 80 void setProperties(const QXmlAttributes &attributes);
Chris@30 81
Chris@30 82 protected:
Chris@30 83 int getYForValue(float value) const;
Chris@30 84 float getValueForY(int y) const;
Chris@30 85
Chris@30 86 NoteModel::PointList getLocalPoints(int) const;
Chris@30 87
Chris@30 88 NoteModel *m_model;
Chris@30 89 bool m_editing;
Chris@30 90 NoteModel::Point m_originalPoint;
Chris@30 91 NoteModel::Point m_editingPoint;
Chris@30 92 NoteModel::EditCommand *m_editingCommand;
Chris@30 93 QColor m_colour;
Chris@30 94 VerticalScale m_verticalScale;
Chris@30 95 };
Chris@30 96
Chris@30 97 #endif
Chris@30 98