Mercurial > hg > svgui
comparison layer/ImageLayer.h @ 997:296ccd36f626 tony-2.0-integration
Merge through to branch for Tony 2.0
author | Chris Cannam |
---|---|
date | Thu, 20 Aug 2015 14:54:21 +0100 |
parents | 4fe7a09be0fe |
children | a34a2a25907c |
comparison
equal
deleted
inserted
replaced
943:788b7623bfca | 997:296ccd36f626 |
---|---|
36 | 36 |
37 public: | 37 public: |
38 ImageLayer(); | 38 ImageLayer(); |
39 virtual ~ImageLayer(); | 39 virtual ~ImageLayer(); |
40 | 40 |
41 virtual void paint(View *v, QPainter &paint, QRect rect) const; | 41 virtual void paint(LayerGeometryProvider *v, QPainter &paint, QRect rect) const; |
42 | 42 |
43 virtual QString getFeatureDescription(View *v, QPoint &) const; | 43 virtual QString getFeatureDescription(LayerGeometryProvider *v, QPoint &) const; |
44 | 44 |
45 virtual bool snapToFeatureFrame(View *v, sv_frame_t &frame, | 45 virtual bool snapToFeatureFrame(LayerGeometryProvider *v, sv_frame_t &frame, |
46 int &resolution, | 46 int &resolution, |
47 SnapType snap) const; | 47 SnapType snap) const; |
48 | 48 |
49 virtual void drawStart(View *v, QMouseEvent *); | 49 virtual void drawStart(LayerGeometryProvider *v, QMouseEvent *); |
50 virtual void drawDrag(View *v, QMouseEvent *); | 50 virtual void drawDrag(LayerGeometryProvider *v, QMouseEvent *); |
51 virtual void drawEnd(View *v, QMouseEvent *); | 51 virtual void drawEnd(LayerGeometryProvider *v, QMouseEvent *); |
52 | 52 |
53 virtual void editStart(View *v, QMouseEvent *); | 53 virtual void editStart(LayerGeometryProvider *v, QMouseEvent *); |
54 virtual void editDrag(View *v, QMouseEvent *); | 54 virtual void editDrag(LayerGeometryProvider *v, QMouseEvent *); |
55 virtual void editEnd(View *v, QMouseEvent *); | 55 virtual void editEnd(LayerGeometryProvider *v, QMouseEvent *); |
56 | 56 |
57 virtual void moveSelection(Selection s, sv_frame_t newStartFrame); | 57 virtual void moveSelection(Selection s, sv_frame_t newStartFrame); |
58 virtual void resizeSelection(Selection s, Selection newSize); | 58 virtual void resizeSelection(Selection s, Selection newSize); |
59 virtual void deleteSelection(Selection s); | 59 virtual void deleteSelection(Selection s); |
60 | 60 |
61 virtual void copy(View *v, Selection s, Clipboard &to); | 61 virtual void copy(LayerGeometryProvider *v, Selection s, Clipboard &to); |
62 virtual bool paste(View *v, const Clipboard &from, sv_frame_t frameOffset, | 62 virtual bool paste(LayerGeometryProvider *v, const Clipboard &from, sv_frame_t frameOffset, |
63 bool interactive); | 63 bool interactive); |
64 | 64 |
65 virtual bool editOpen(View *, QMouseEvent *); // on double-click | 65 virtual bool editOpen(LayerGeometryProvider *, QMouseEvent *); // on double-click |
66 | 66 |
67 virtual const Model *getModel() const { return m_model; } | 67 virtual const Model *getModel() const { return m_model; } |
68 void setModel(ImageModel *model); | 68 void setModel(ImageModel *model); |
69 | 69 |
70 virtual PropertyList getProperties() const; | 70 virtual PropertyList getProperties() const; |
78 | 78 |
79 virtual ColourSignificance getLayerColourSignificance() const { | 79 virtual ColourSignificance getLayerColourSignificance() const { |
80 return ColourAbsent; | 80 return ColourAbsent; |
81 } | 81 } |
82 | 82 |
83 virtual bool isLayerScrollable(const View *v) const; | 83 virtual bool isLayerScrollable(const LayerGeometryProvider *v) const; |
84 | 84 |
85 virtual bool isLayerEditable() const { return true; } | 85 virtual bool isLayerEditable() const { return true; } |
86 | 86 |
87 virtual int getCompletion(View *) const { return m_model->getCompletion(); } | 87 virtual int getCompletion(LayerGeometryProvider *) const { return m_model->getCompletion(); } |
88 | 88 |
89 virtual bool getValueExtents(double &min, double &max, | 89 virtual bool getValueExtents(double &min, double &max, |
90 bool &logarithmic, QString &unit) const; | 90 bool &logarithmic, QString &unit) const; |
91 | 91 |
92 virtual void toXml(QTextStream &stream, QString indent = "", | 92 virtual void toXml(QTextStream &stream, QString indent = "", |
93 QString extraAttributes = "") const; | 93 QString extraAttributes = "") const; |
94 | 94 |
95 virtual int getVerticalScaleWidth(View *, bool, QPainter &) const { return 0; } | 95 virtual int getVerticalScaleWidth(LayerGeometryProvider *, bool, QPainter &) const { return 0; } |
96 | 96 |
97 virtual void setLayerDormant(const View *v, bool dormant); | 97 virtual void setLayerDormant(const LayerGeometryProvider *v, bool dormant); |
98 | 98 |
99 void setProperties(const QXmlAttributes &attributes); | 99 void setProperties(const QXmlAttributes &attributes); |
100 | 100 |
101 virtual bool addImage(sv_frame_t frame, QString url); // using a command | 101 virtual bool addImage(sv_frame_t frame, QString url); // using a command |
102 | 102 |
103 protected slots: | 103 protected slots: |
104 void checkAddSources(); | 104 void checkAddSources(); |
105 void fileSourceReady(); | 105 void fileSourceReady(); |
106 | 106 |
107 protected: | 107 protected: |
108 ImageModel::PointList getLocalPoints(View *v, int x, int y) const; | 108 ImageModel::PointList getLocalPoints(LayerGeometryProvider *v, int x, int y) const; |
109 | 109 |
110 bool getImageOriginalSize(QString name, QSize &size) const; | 110 bool getImageOriginalSize(QString name, QSize &size) const; |
111 QImage getImage(View *v, QString name, QSize maxSize) const; | 111 QImage getImage(LayerGeometryProvider *v, QString name, QSize maxSize) const; |
112 | 112 |
113 void drawImage(View *v, QPainter &paint, const ImageModel::Point &p, | 113 void drawImage(LayerGeometryProvider *v, QPainter &paint, const ImageModel::Point &p, |
114 int x, int nx) const; | 114 int x, int nx) const; |
115 | 115 |
116 //!!! how to reap no-longer-used images? | 116 //!!! how to reap no-longer-used images? |
117 | 117 |
118 typedef std::map<QString, QImage> ImageMap; | 118 typedef std::map<QString, QImage> ImageMap; |
119 typedef std::map<const View *, ImageMap> ViewImageMap; | 119 typedef std::map<const LayerGeometryProvider *, ImageMap> ViewImageMap; |
120 typedef std::map<QString, FileSource *> FileSourceMap; | 120 typedef std::map<QString, FileSource *> FileSourceMap; |
121 | 121 |
122 static ImageMap m_images; | 122 static ImageMap m_images; |
123 static QMutex m_imageMapMutex; | 123 static QMutex m_imageMapMutex; |
124 mutable ViewImageMap m_scaled; | 124 mutable ViewImageMap m_scaled; |