Mercurial > hg > svgui
comparison layer/TimeValueLayer.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 TimeValueLayer : public Layer | 22 class TimeValueLayer : public Layer |
23 { | 23 { |
24 Q_OBJECT | 24 Q_OBJECT |
25 | 25 |
26 public: | 26 public: |
27 TimeValueLayer(View *w); | 27 TimeValueLayer(); |
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 int getVerticalScaleWidth(QPainter &) const; | 31 virtual int getVerticalScaleWidth(View *v, QPainter &) const; |
32 virtual void paintVerticalScale(QPainter &paint, QRect rect) const; | 32 virtual void paintVerticalScale(View *v, QPainter &paint, QRect rect) const; |
33 | 33 |
34 virtual QString getFeatureDescription(QPoint &) const; | 34 virtual QString getFeatureDescription(View *v, QPoint &) const; |
35 | 35 |
36 virtual bool snapToFeatureFrame(int &frame, | 36 virtual bool snapToFeatureFrame(View *v, int &frame, |
37 size_t &resolution, | 37 size_t &resolution, |
38 SnapType snap) const; | 38 SnapType snap) const; |
39 | 39 |
40 virtual void drawStart(QMouseEvent *); | 40 virtual void drawStart(View *v, QMouseEvent *); |
41 virtual void drawDrag(QMouseEvent *); | 41 virtual void drawDrag(View *v, QMouseEvent *); |
42 virtual void drawEnd(QMouseEvent *); | 42 virtual void drawEnd(View *v, QMouseEvent *); |
43 | 43 |
44 virtual void editStart(QMouseEvent *); | 44 virtual void editStart(View *v, QMouseEvent *); |
45 virtual void editDrag(QMouseEvent *); | 45 virtual void editDrag(View *v, QMouseEvent *); |
46 virtual void editEnd(QMouseEvent *); | 46 virtual void editEnd(View *v, QMouseEvent *); |
47 | 47 |
48 virtual void moveSelection(Selection s, size_t newStartFrame); | 48 virtual void moveSelection(Selection s, size_t newStartFrame); |
49 virtual void resizeSelection(Selection s, Selection newSize); | 49 virtual void resizeSelection(Selection s, Selection newSize); |
50 | 50 |
51 virtual const Model *getModel() const { return m_model; } | 51 virtual const Model *getModel() const { return m_model; } |
72 }; | 72 }; |
73 | 73 |
74 void setPlotStyle(PlotStyle style); | 74 void setPlotStyle(PlotStyle style); |
75 PlotStyle getPlotStyle() const { return m_plotStyle; } | 75 PlotStyle getPlotStyle() const { return m_plotStyle; } |
76 | 76 |
77 virtual bool isLayerScrollable() const; | 77 virtual bool isLayerScrollable(const View *v) const; |
78 | 78 |
79 virtual bool isLayerEditable() const { return true; } | 79 virtual bool isLayerEditable() const { return true; } |
80 | 80 |
81 virtual int getCompletion() const { return m_model->getCompletion(); } | 81 virtual int getCompletion() const { return m_model->getCompletion(); } |
82 | 82 |
84 QString extraAttributes = "") const; | 84 QString extraAttributes = "") const; |
85 | 85 |
86 void setProperties(const QXmlAttributes &attributes); | 86 void setProperties(const QXmlAttributes &attributes); |
87 | 87 |
88 protected: | 88 protected: |
89 int getYForValue(float value) const; | 89 int getYForValue(View *, float value) const; |
90 float getValueForY(int y) const; | 90 float getValueForY(View *, int y) const; |
91 | 91 |
92 SparseTimeValueModel::PointList getLocalPoints(int) const; | 92 SparseTimeValueModel::PointList getLocalPoints(View *v, int) const; |
93 | 93 |
94 SparseTimeValueModel *m_model; | 94 SparseTimeValueModel *m_model; |
95 bool m_editing; | 95 bool m_editing; |
96 SparseTimeValueModel::Point m_originalPoint; | 96 SparseTimeValueModel::Point m_originalPoint; |
97 SparseTimeValueModel::Point m_editingPoint; | 97 SparseTimeValueModel::Point m_editingPoint; |