comparison layer/NoteLayer.h @ 44:ad214997dddb

* Refactor Layer classes so as no longer to store a single View pointer; instead they need to be able to draw themselves on any View on demand. Layers with caches (e.g. spectrogram) will need to be further refactored so as to maintain a per-View cache * Begin refactoring MainWindow by pulling out the document stuff (set of layers, models etc) into a Document class. Not yet in use. This revision is fairly unstable.
author Chris Cannam
date Thu, 02 Mar 2006 16:58:49 +0000
parents 78515b1e29eb
children 01ab51f72e84
comparison
equal deleted inserted replaced
43:78515b1e29eb 44:ad214997dddb
22 class NoteLayer : public Layer 22 class NoteLayer : public Layer
23 { 23 {
24 Q_OBJECT 24 Q_OBJECT
25 25
26 public: 26 public:
27 NoteLayer(View *w); 27 NoteLayer();
28 28
29 virtual void paint(QPainter &paint, QRect rect) const; 29 virtual void paint(View *v, QPainter &paint, QRect rect) const;
30 30
31 virtual QString getFeatureDescription(QPoint &) const; 31 virtual QString getFeatureDescription(View *v, QPoint &) const;
32 32
33 virtual bool snapToFeatureFrame(int &frame, 33 virtual bool snapToFeatureFrame(View *v, int &frame,
34 size_t &resolution, 34 size_t &resolution,
35 SnapType snap) const; 35 SnapType snap) const;
36 36
37 virtual void drawStart(QMouseEvent *); 37 virtual void drawStart(View *v, QMouseEvent *);
38 virtual void drawDrag(QMouseEvent *); 38 virtual void drawDrag(View *v, QMouseEvent *);
39 virtual void drawEnd(QMouseEvent *); 39 virtual void drawEnd(View *v, QMouseEvent *);
40 40
41 virtual void editStart(QMouseEvent *); 41 virtual void editStart(View *v, QMouseEvent *);
42 virtual void editDrag(QMouseEvent *); 42 virtual void editDrag(View *v, QMouseEvent *);
43 virtual void editEnd(QMouseEvent *); 43 virtual void editEnd(View *v, QMouseEvent *);
44 44
45 virtual void moveSelection(Selection s, size_t newStartFrame); 45 virtual void moveSelection(Selection s, size_t newStartFrame);
46 virtual void resizeSelection(Selection s, Selection newSize); 46 virtual void resizeSelection(Selection s, Selection newSize);
47 47
48 virtual const Model *getModel() const { return m_model; } 48 virtual const Model *getModel() const { return m_model; }
66 }; 66 };
67 67
68 void setVerticalScale(VerticalScale scale); 68 void setVerticalScale(VerticalScale scale);
69 VerticalScale getVerticalScale() const { return m_verticalScale; } 69 VerticalScale getVerticalScale() const { return m_verticalScale; }
70 70
71 virtual bool isLayerScrollable() const; 71 virtual bool isLayerScrollable(const View *v) const;
72 72
73 virtual bool isLayerEditable() const { return true; } 73 virtual bool isLayerEditable() const { return true; }
74 74
75 virtual int getCompletion() const { return m_model->getCompletion(); } 75 virtual int getCompletion() const { return m_model->getCompletion(); }
76 76
78 QString extraAttributes = "") const; 78 QString extraAttributes = "") const;
79 79
80 void setProperties(const QXmlAttributes &attributes); 80 void setProperties(const QXmlAttributes &attributes);
81 81
82 protected: 82 protected:
83 int getYForValue(float value) const; 83 int getYForValue(View *v, float value) const;
84 float getValueForY(int y) const; 84 float getValueForY(View *v, int y) const;
85 85
86 NoteModel::PointList getLocalPoints(int) const; 86 NoteModel::PointList getLocalPoints(View *v, int) const;
87 87
88 NoteModel *m_model; 88 NoteModel *m_model;
89 bool m_editing; 89 bool m_editing;
90 NoteModel::Point m_originalPoint; 90 NoteModel::Point m_originalPoint;
91 NoteModel::Point m_editingPoint; 91 NoteModel::Point m_editingPoint;