Mercurial > hg > svgui
comparison layer/Layer.h @ 267:4ed1446ad604
* more on measurement tool -- pull out some logic from pane to layer &c
still more to do
author | Chris Cannam |
---|---|
date | Thu, 21 Jun 2007 16:12:00 +0000 |
parents | 6d113226bb4c |
children | 70537b0434c4 |
comparison
equal
deleted
inserted
replaced
266:aee39d8c0b83 | 267:4ed1446ad604 |
---|---|
102 virtual bool getCrosshairExtents(View *, QPainter &, QPoint /* cursorPos */, | 102 virtual bool getCrosshairExtents(View *, QPainter &, QPoint /* cursorPos */, |
103 std::vector<QRect> &) const { | 103 std::vector<QRect> &) const { |
104 return false; | 104 return false; |
105 } | 105 } |
106 virtual void paintCrosshairs(View *, QPainter &, QPoint) const { } | 106 virtual void paintCrosshairs(View *, QPainter &, QPoint) const { } |
107 | |
108 virtual void paintMeasurementRects(View *, QPainter &) const; | |
107 | 109 |
108 virtual QString getFeatureDescription(View *, QPoint &) const { | 110 virtual QString getFeatureDescription(View *, QPoint &) const { |
109 return ""; | 111 return ""; |
110 } | 112 } |
111 | 113 |
154 | 156 |
155 virtual void editStart(View *, QMouseEvent *) { } | 157 virtual void editStart(View *, QMouseEvent *) { } |
156 virtual void editDrag(View *, QMouseEvent *) { } | 158 virtual void editDrag(View *, QMouseEvent *) { } |
157 virtual void editEnd(View *, QMouseEvent *) { } | 159 virtual void editEnd(View *, QMouseEvent *) { } |
158 | 160 |
161 // Measurement rectangle (or equivalent). Unlike draw and edit, | |
162 // the base Layer class can provide working implementations of | |
163 // these for most situations. | |
164 // | |
165 virtual void measureStart(View *, QMouseEvent *); | |
166 virtual void measureDrag(View *, QMouseEvent *); | |
167 virtual void measureEnd(View *, QMouseEvent *); | |
168 | |
159 /** | 169 /** |
160 * Open an editor on the item under the mouse (e.g. on | 170 * Open an editor on the item under the mouse (e.g. on |
161 * double-click). If there is no item or editing is not | 171 * double-click). If there is no item or editing is not |
162 * supported, return false. | 172 * supported, return false. |
163 */ | 173 */ |
321 * Return the value and unit at the given x coordinate in the | 331 * Return the value and unit at the given x coordinate in the |
322 * given view. This is for descriptive purposes using the | 332 * given view. This is for descriptive purposes using the |
323 * measurement tool. The default implementation works correctly | 333 * measurement tool. The default implementation works correctly |
324 * if the layer hasTimeXAxis(). | 334 * if the layer hasTimeXAxis(). |
325 */ | 335 */ |
326 virtual bool getXScaleValue(View *v, int x, | 336 virtual bool getXScaleValue(const View *v, int x, |
327 float &value, QString &unit) const; | 337 float &value, QString &unit) const; |
328 | 338 |
329 /** | 339 /** |
330 * Return the value and unit at the given y coordinate in the | 340 * Return the value and unit at the given y coordinate in the |
331 * given view. | 341 * given view. |
332 */ | 342 */ |
333 virtual bool getYScaleValue(View *, int /* y */, | 343 virtual bool getYScaleValue(const View *, int /* y */, |
334 float &/* value */, QString &/* unit */) const { | 344 float &/* value */, QString &/* unit */) const { |
335 return false; | 345 return false; |
336 } | 346 } |
337 | 347 |
338 /** | 348 /** |
388 void layerParameterRangesChanged(); | 398 void layerParameterRangesChanged(); |
389 void layerNameChanged(); | 399 void layerNameChanged(); |
390 | 400 |
391 void verticalZoomChanged(); | 401 void verticalZoomChanged(); |
392 | 402 |
403 protected: | |
404 struct MeasureRect { | |
405 mutable QRect pixrect; | |
406 long startFrame; // only valid for a layer that hasTimeXAxis | |
407 long endFrame; // ditto | |
408 }; | |
409 | |
410 typedef std::vector<MeasureRect> MeasureRectList; // should be x-ordered | |
411 MeasureRectList m_measureRectList; | |
412 MeasureRect m_draggingRect; | |
413 bool m_haveDraggingRect; | |
414 | |
393 private: | 415 private: |
394 mutable QMutex m_dormancyMutex; | 416 mutable QMutex m_dormancyMutex; |
395 mutable std::map<const void *, bool> m_dormancy; | 417 mutable std::map<const void *, bool> m_dormancy; |
396 }; | 418 }; |
397 | 419 |