comparison layer/TimeValueLayer.h @ 1216:dc2af6616c83

Merge from branch 3.0-integration
author Chris Cannam
date Fri, 13 Jan 2017 10:29:50 +0000
parents 42217d9c5920
children a8e126fe6a53
comparison
equal deleted inserted replaced
1048:e8102ff5573b 1216:dc2af6616c83
35 Q_OBJECT 35 Q_OBJECT
36 36
37 public: 37 public:
38 TimeValueLayer(); 38 TimeValueLayer();
39 39
40 virtual void paint(View *v, QPainter &paint, QRect rect) const; 40 virtual void paint(LayerGeometryProvider *v, QPainter &paint, QRect rect) const;
41 41
42 virtual int getVerticalScaleWidth(View *v, bool, QPainter &) const; 42 virtual int getVerticalScaleWidth(LayerGeometryProvider *v, bool, QPainter &) const;
43 virtual void paintVerticalScale(View *v, bool, QPainter &paint, QRect rect) const; 43 virtual void paintVerticalScale(LayerGeometryProvider *v, bool, QPainter &paint, QRect rect) const;
44 44
45 virtual QString getFeatureDescription(View *v, QPoint &) const; 45 virtual QString getFeatureDescription(LayerGeometryProvider *v, QPoint &) const;
46 virtual QString getLabelPreceding(sv_frame_t) const; 46 virtual QString getLabelPreceding(sv_frame_t) const;
47 47
48 virtual bool snapToFeatureFrame(View *v, sv_frame_t &frame, 48 virtual bool snapToFeatureFrame(LayerGeometryProvider *v, sv_frame_t &frame,
49 int &resolution, 49 int &resolution,
50 SnapType snap) const; 50 SnapType snap) const;
51 virtual bool snapToSimilarFeature(View *v, sv_frame_t &frame, 51 virtual bool snapToSimilarFeature(LayerGeometryProvider *v, sv_frame_t &frame,
52 int &resolution, 52 int &resolution,
53 SnapType snap) const; 53 SnapType snap) const;
54 54
55 virtual void drawStart(View *v, QMouseEvent *); 55 virtual void drawStart(LayerGeometryProvider *v, QMouseEvent *);
56 virtual void drawDrag(View *v, QMouseEvent *); 56 virtual void drawDrag(LayerGeometryProvider *v, QMouseEvent *);
57 virtual void drawEnd(View *v, QMouseEvent *); 57 virtual void drawEnd(LayerGeometryProvider *v, QMouseEvent *);
58 58
59 virtual void eraseStart(View *v, QMouseEvent *); 59 virtual void eraseStart(LayerGeometryProvider *v, QMouseEvent *);
60 virtual void eraseDrag(View *v, QMouseEvent *); 60 virtual void eraseDrag(LayerGeometryProvider *v, QMouseEvent *);
61 virtual void eraseEnd(View *v, QMouseEvent *); 61 virtual void eraseEnd(LayerGeometryProvider *v, QMouseEvent *);
62 62
63 virtual void editStart(View *v, QMouseEvent *); 63 virtual void editStart(LayerGeometryProvider *v, QMouseEvent *);
64 virtual void editDrag(View *v, QMouseEvent *); 64 virtual void editDrag(LayerGeometryProvider *v, QMouseEvent *);
65 virtual void editEnd(View *v, QMouseEvent *); 65 virtual void editEnd(LayerGeometryProvider *v, QMouseEvent *);
66 66
67 virtual bool editOpen(View *v, QMouseEvent *); 67 virtual bool editOpen(LayerGeometryProvider *v, QMouseEvent *);
68 68
69 virtual void moveSelection(Selection s, sv_frame_t newStartFrame); 69 virtual void moveSelection(Selection s, sv_frame_t newStartFrame);
70 virtual void resizeSelection(Selection s, Selection newSize); 70 virtual void resizeSelection(Selection s, Selection newSize);
71 virtual void deleteSelection(Selection s); 71 virtual void deleteSelection(Selection s);
72 72
73 virtual void copy(View *v, Selection s, Clipboard &to); 73 virtual void copy(LayerGeometryProvider *v, Selection s, Clipboard &to);
74 virtual bool paste(View *v, const Clipboard &from, sv_frame_t frameOffset, 74 virtual bool paste(LayerGeometryProvider *v, const Clipboard &from, sv_frame_t frameOffset,
75 bool interactive); 75 bool interactive);
76 76
77 virtual const Model *getModel() const { return m_model; } 77 virtual const Model *getModel() const { return m_model; }
78 void setModel(SparseTimeValueModel *model); 78 void setModel(SparseTimeValueModel *model);
79 79
118 bool getDrawSegmentDivisions() const { return m_drawSegmentDivisions; } 118 bool getDrawSegmentDivisions() const { return m_drawSegmentDivisions; }
119 119
120 void setShowDerivative(bool); 120 void setShowDerivative(bool);
121 bool getShowDerivative() const { return m_derivative; } 121 bool getShowDerivative() const { return m_derivative; }
122 122
123 virtual bool isLayerScrollable(const View *v) const; 123 virtual bool isLayerScrollable(const LayerGeometryProvider *v) const;
124 124
125 virtual bool isLayerEditable() const { return true; } 125 virtual bool isLayerEditable() const { return true; }
126 126
127 virtual int getCompletion(View *) const { return m_model->getCompletion(); } 127 virtual int getCompletion(LayerGeometryProvider *) const { return m_model->getCompletion(); }
128 128
129 virtual bool needsTextLabelHeight() const { 129 virtual bool needsTextLabelHeight() const {
130 return m_plotStyle == PlotSegmentation && m_model->hasTextLabels(); 130 return m_plotStyle == PlotSegmentation && m_model->hasTextLabels();
131 } 131 }
132 132
144 virtual void toXml(QTextStream &stream, QString indent = "", 144 virtual void toXml(QTextStream &stream, QString indent = "",
145 QString extraAttributes = "") const; 145 QString extraAttributes = "") const;
146 146
147 void setProperties(const QXmlAttributes &attributes); 147 void setProperties(const QXmlAttributes &attributes);
148 148
149 /// Override from SingleColourLayer
149 virtual ColourSignificance getLayerColourSignificance() const { 150 virtual ColourSignificance getLayerColourSignificance() const {
150 if (m_plotStyle == PlotSegmentation) { 151 if (m_plotStyle == PlotSegmentation) {
151 return ColourHasMeaningfulValue; 152 return ColourHasMeaningfulValue;
152 } else { 153 } else {
153 return ColourDistinguishes; 154 return ColourDistinguishes;
154 } 155 }
155 } 156 }
156 157
158 /// Override from SingleColourLayer
159 virtual bool hasLightBackground() const {
160 if (m_plotStyle == PlotSegmentation) {
161 return true;
162 } else {
163 return SingleColourLayer::hasLightBackground();
164 }
165 }
166
157 /// VerticalScaleLayer and ColourScaleLayer methods 167 /// VerticalScaleLayer and ColourScaleLayer methods
158 virtual int getYForValue(View *, double value) const; 168 virtual int getYForValue(LayerGeometryProvider *, double value) const;
159 virtual double getValueForY(View *, int y) const; 169 virtual double getValueForY(LayerGeometryProvider *, int y) const;
160 virtual QString getScaleUnits() const; 170 virtual QString getScaleUnits() const;
161 virtual QColor getColourForValue(View *v, double value) const; 171 virtual QColor getColourForValue(LayerGeometryProvider *v, double value) const;
162 172
163 protected: 173 protected:
164 void getScaleExtents(View *, double &min, double &max, bool &log) const; 174 void getScaleExtents(LayerGeometryProvider *, double &min, double &max, bool &log) const;
165 bool shouldAutoAlign() const; 175 bool shouldAutoAlign() const;
166 176
167 SparseTimeValueModel::PointList getLocalPoints(View *v, int) const; 177 SparseTimeValueModel::PointList getLocalPoints(LayerGeometryProvider *v, int) const;
168 178
169 virtual int getDefaultColourHint(bool dark, bool &impose); 179 virtual int getDefaultColourHint(bool dark, bool &impose);
170 180
171 SparseTimeValueModel *m_model; 181 SparseTimeValueModel *m_model;
172 bool m_editing; 182 bool m_editing;