Mercurial > hg > svgui
comparison layer/TextLayer.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 TextLayer : public Layer | 22 class TextLayer : public Layer |
23 { | 23 { |
24 Q_OBJECT | 24 Q_OBJECT |
25 | 25 |
26 public: | 26 public: |
27 TextLayer(View *w); | 27 TextLayer(); |
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 void editOpen(QMouseEvent *); // on double-click | 48 virtual void editOpen(View *, QMouseEvent *); // on double-click |
49 | 49 |
50 virtual const Model *getModel() const { return m_model; } | 50 virtual const Model *getModel() const { return m_model; } |
51 void setModel(TextModel *model); | 51 void setModel(TextModel *model); |
52 | 52 |
53 virtual PropertyList getProperties() const; | 53 virtual PropertyList getProperties() const; |
59 virtual void setProperty(const PropertyName &, int value); | 59 virtual void setProperty(const PropertyName &, int value); |
60 | 60 |
61 void setBaseColour(QColor); | 61 void setBaseColour(QColor); |
62 QColor getBaseColour() const { return m_colour; } | 62 QColor getBaseColour() const { return m_colour; } |
63 | 63 |
64 virtual bool isLayerScrollable() const; | 64 virtual bool isLayerScrollable(const View *v) const; |
65 | 65 |
66 virtual bool isLayerEditable() const { return true; } | 66 virtual bool isLayerEditable() const { return true; } |
67 | 67 |
68 virtual int getCompletion() const { return m_model->getCompletion(); } | 68 virtual int getCompletion() const { return m_model->getCompletion(); } |
69 | 69 |
71 QString extraAttributes = "") const; | 71 QString extraAttributes = "") const; |
72 | 72 |
73 void setProperties(const QXmlAttributes &attributes); | 73 void setProperties(const QXmlAttributes &attributes); |
74 | 74 |
75 protected: | 75 protected: |
76 int getYForHeight(float height) const; | 76 int getYForHeight(View *v, float height) const; |
77 float getHeightForY(int y) const; | 77 float getHeightForY(View *v, int y) const; |
78 | 78 |
79 TextModel::PointList getLocalPoints(int x, int y) const; | 79 TextModel::PointList getLocalPoints(View *v, int x, int y) const; |
80 | 80 |
81 TextModel *m_model; | 81 TextModel *m_model; |
82 bool m_editing; | 82 bool m_editing; |
83 QPoint m_editOrigin; | 83 QPoint m_editOrigin; |
84 TextModel::Point m_originalPoint; | 84 TextModel::Point m_originalPoint; |