comparison layer/TimeInstantLayer.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 TimeInstantLayer : public Layer 22 class TimeInstantLayer : public Layer
23 { 23 {
24 Q_OBJECT 24 Q_OBJECT
25 25
26 public: 26 public:
27 TimeInstantLayer(View *w); 27 TimeInstantLayer();
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 virtual void deleteSelection(Selection s); 47 virtual void deleteSelection(Selection s);
48 48
66 }; 66 };
67 67
68 void setPlotStyle(PlotStyle style); 68 void setPlotStyle(PlotStyle style);
69 PlotStyle getPlotStyle() const { return m_plotStyle; } 69 PlotStyle getPlotStyle() const { return m_plotStyle; }
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 SparseOneDimensionalModel::PointList getLocalPoints(int) const; 83 SparseOneDimensionalModel::PointList getLocalPoints(View *v, int) const;
84 84
85 SparseOneDimensionalModel *m_model; 85 SparseOneDimensionalModel *m_model;
86 bool m_editing; 86 bool m_editing;
87 SparseOneDimensionalModel::Point m_editingPoint; 87 SparseOneDimensionalModel::Point m_editingPoint;
88 SparseOneDimensionalModel::EditCommand *m_editingCommand; 88 SparseOneDimensionalModel::EditCommand *m_editingCommand;