Mercurial > hg > svgui
comparison layer/Layer.h @ 944:78c152e4db95
Merge from branch tonioni
author | Chris Cannam |
---|---|
date | Mon, 20 Apr 2015 09:12:17 +0100 |
parents | 251dd0abc7b7 |
children | 94e4952a6774 e53a87a5efb2 |
comparison
equal
deleted
inserted
replaced
896:78e041e45ff0 | 944:78c152e4db95 |
---|---|
148 | 148 |
149 virtual QString getFeatureDescription(View *, QPoint &) const { | 149 virtual QString getFeatureDescription(View *, QPoint &) const { |
150 return ""; | 150 return ""; |
151 } | 151 } |
152 | 152 |
153 virtual QString getLabelPreceding(int /* frame */) const { | 153 virtual QString getLabelPreceding(sv_frame_t /* frame */) const { |
154 return ""; | 154 return ""; |
155 } | 155 } |
156 | 156 |
157 enum SnapType { | 157 enum SnapType { |
158 SnapLeft, | 158 SnapLeft, |
178 * Return true if a suitable feature was found and frame adjusted | 178 * Return true if a suitable feature was found and frame adjusted |
179 * accordingly. Return false if no suitable feature was available | 179 * accordingly. Return false if no suitable feature was available |
180 * (and leave frame unmodified). If returning true, also return | 180 * (and leave frame unmodified). If returning true, also return |
181 * the resolution of the model in this layer in sample frames. | 181 * the resolution of the model in this layer in sample frames. |
182 */ | 182 */ |
183 virtual bool snapToFeatureFrame(View * /* v */, | 183 virtual bool snapToFeatureFrame(View * /* v */, |
184 int & /* frame */, | 184 sv_frame_t & /* frame */, |
185 int &resolution, | 185 int &resolution, |
186 SnapType /* snap */) const { | 186 SnapType /* snap */) const { |
187 resolution = 1; | 187 resolution = 1; |
188 return false; | 188 return false; |
189 } | 189 } |
202 * Return true if a suitable feature was found and frame adjusted | 202 * Return true if a suitable feature was found and frame adjusted |
203 * accordingly. Return false if no suitable feature was available | 203 * accordingly. Return false if no suitable feature was available |
204 * (and leave frame unmodified). If returning true, also return | 204 * (and leave frame unmodified). If returning true, also return |
205 * the resolution of the model in this layer in sample frames. | 205 * the resolution of the model in this layer in sample frames. |
206 */ | 206 */ |
207 virtual bool snapToSimilarFeature(View * /* v */, | 207 virtual bool snapToSimilarFeature(View * /* v */, |
208 int & /* source frame */, | 208 sv_frame_t & /* source frame */, |
209 int &resolution, | 209 int &resolution, |
210 SnapType /* snap */) const { | 210 SnapType /* snap */) const { |
211 resolution = 1; | 211 resolution = 1; |
212 return false; | 212 return false; |
213 } | 213 } |
252 * double-click). If there is no item or editing is not | 252 * double-click). If there is no item or editing is not |
253 * supported, return false. | 253 * supported, return false. |
254 */ | 254 */ |
255 virtual bool editOpen(View *, QMouseEvent *) { return false; } | 255 virtual bool editOpen(View *, QMouseEvent *) { return false; } |
256 | 256 |
257 virtual void moveSelection(Selection, int /* newStartFrame */) { } | 257 virtual void moveSelection(Selection, sv_frame_t /* newStartFrame */) { } |
258 virtual void resizeSelection(Selection, Selection /* newSize */) { } | 258 virtual void resizeSelection(Selection, Selection /* newSize */) { } |
259 virtual void deleteSelection(Selection) { } | 259 virtual void deleteSelection(Selection) { } |
260 | 260 |
261 virtual void copy(View *, Selection, Clipboard & /* to */) { } | 261 virtual void copy(View *, Selection, Clipboard & /* to */) { } |
262 | 262 |
267 * return false if the user cancelled the paste operation. This | 267 * return false if the user cancelled the paste operation. This |
268 * function should return true if a paste actually occurred. | 268 * function should return true if a paste actually occurred. |
269 */ | 269 */ |
270 virtual bool paste(View *, | 270 virtual bool paste(View *, |
271 const Clipboard & /* from */, | 271 const Clipboard & /* from */, |
272 int /* frameOffset */, | 272 sv_frame_t /* frameOffset */, |
273 bool /* interactive */) { return false; } | 273 bool /* interactive */) { return false; } |
274 | 274 |
275 // Text mode: | 275 // Text mode: |
276 // | 276 // |
277 // Label nearest feature. We need to get the feature coordinates | 277 // Label nearest feature. We need to get the feature coordinates |
421 * these values if known. | 421 * these values if known. |
422 * | 422 * |
423 * This function returns the "normal" extents for the layer, not | 423 * This function returns the "normal" extents for the layer, not |
424 * necessarily the extents actually in use in the display. | 424 * necessarily the extents actually in use in the display. |
425 */ | 425 */ |
426 virtual bool getValueExtents(float &min, float &max, | 426 virtual bool getValueExtents(double &min, double &max, |
427 bool &logarithmic, QString &unit) const = 0; | 427 bool &logarithmic, QString &unit) const = 0; |
428 | 428 |
429 /** | 429 /** |
430 * Return the minimum and maximum values within the displayed | 430 * Return the minimum and maximum values within the displayed |
431 * range for the y axis, if only a subset of the whole range of | 431 * range for the y axis, if only a subset of the whole range of |
432 * the model (returned by getValueExtents) is being displayed. | 432 * the model (returned by getValueExtents) is being displayed. |
433 * Return false if the layer is not imposing a particular display | 433 * Return false if the layer is not imposing a particular display |
434 * extent (using the normal layer extents or deferring to whatever | 434 * extent (using the normal layer extents or deferring to whatever |
435 * is in use for the same units elsewhere in the view). | 435 * is in use for the same units elsewhere in the view). |
436 */ | 436 */ |
437 virtual bool getDisplayExtents(float & /* min */, | 437 virtual bool getDisplayExtents(double & /* min */, |
438 float & /* max */) const { | 438 double & /* max */) const { |
439 return false; | 439 return false; |
440 } | 440 } |
441 | 441 |
442 /** | 442 /** |
443 * Set the displayed minimum and maximum values for the y axis to | 443 * Set the displayed minimum and maximum values for the y axis to |
444 * the given range, if supported. Return false if not supported | 444 * the given range, if supported. Return false if not supported |
445 * on this layer (and set nothing). In most cases, layers that | 445 * on this layer (and set nothing). In most cases, layers that |
446 * return false for getDisplayExtents should also return false for | 446 * return false for getDisplayExtents should also return false for |
447 * this function. | 447 * this function. |
448 */ | 448 */ |
449 virtual bool setDisplayExtents(float /* min */, | 449 virtual bool setDisplayExtents(double /* min */, |
450 float /* max */) { | 450 double /* max */) { |
451 return false; | 451 return false; |
452 } | 452 } |
453 | 453 |
454 /** | 454 /** |
455 * Return the value and unit at the given x coordinate in the | 455 * Return the value and unit at the given x coordinate in the |
456 * given view. This is for descriptive purposes using the | 456 * given view. This is for descriptive purposes using the |
457 * measurement tool. The default implementation works correctly | 457 * measurement tool. The default implementation works correctly |
458 * if the layer hasTimeXAxis(). | 458 * if the layer hasTimeXAxis(). |
459 */ | 459 */ |
460 virtual bool getXScaleValue(const View *v, int x, | 460 virtual bool getXScaleValue(const View *v, int x, |
461 float &value, QString &unit) const; | 461 double &value, QString &unit) const; |
462 | 462 |
463 /** | 463 /** |
464 * Return the value and unit at the given y coordinate in the | 464 * Return the value and unit at the given y coordinate in the |
465 * given view. | 465 * given view. |
466 */ | 466 */ |
467 virtual bool getYScaleValue(const View *, int /* y */, | 467 virtual bool getYScaleValue(const View *, int /* y */, |
468 float &/* value */, QString &/* unit */) const { | 468 double &/* value */, QString &/* unit */) const { |
469 return false; | 469 return false; |
470 } | 470 } |
471 | 471 |
472 /** | 472 /** |
473 * Return the difference between the values at the given y | 473 * Return the difference between the values at the given y |
474 * coordinates in the given view, and the unit of the difference. | 474 * coordinates in the given view, and the unit of the difference. |
475 * The default implementation just calls getYScaleValue twice and | 475 * The default implementation just calls getYScaleValue twice and |
476 * returns the difference, with the same unit. | 476 * returns the difference, with the same unit. |
477 */ | 477 */ |
478 virtual bool getYScaleDifference(const View *v, int y0, int y1, | 478 virtual bool getYScaleDifference(const View *v, int y0, int y1, |
479 float &diff, QString &unit) const; | 479 double &diff, QString &unit) const; |
480 | 480 |
481 /** | 481 /** |
482 * Get the number of vertical zoom steps available for this layer. | 482 * Get the number of vertical zoom steps available for this layer. |
483 * If vertical zooming is not available, return 0. The meaning of | 483 * If vertical zooming is not available, return 0. The meaning of |
484 * "zooming" is entirely up to the layer -- changing the zoom | 484 * "zooming" is entirely up to the layer -- changing the zoom |
523 | 523 |
524 signals: | 524 signals: |
525 void modelChanged(); | 525 void modelChanged(); |
526 void modelCompletionChanged(); | 526 void modelCompletionChanged(); |
527 void modelAlignmentCompletionChanged(); | 527 void modelAlignmentCompletionChanged(); |
528 void modelChangedWithin(int startFrame, int endFrame); | 528 void modelChangedWithin(sv_frame_t startFrame, sv_frame_t endFrame); |
529 void modelReplaced(); | 529 void modelReplaced(); |
530 | 530 |
531 void layerParametersChanged(); | 531 void layerParametersChanged(); |
532 void layerParameterRangesChanged(); | 532 void layerParameterRangesChanged(); |
533 void layerMeasurementRectsChanged(); | 533 void layerMeasurementRectsChanged(); |
536 void verticalZoomChanged(); | 536 void verticalZoomChanged(); |
537 | 537 |
538 protected: | 538 protected: |
539 void connectSignals(const Model *); | 539 void connectSignals(const Model *); |
540 | 540 |
541 virtual int alignToReference(View *v, int frame) const; | 541 virtual sv_frame_t alignToReference(View *v, sv_frame_t frame) const; |
542 virtual int alignFromReference(View *v, int frame) const; | 542 virtual sv_frame_t alignFromReference(View *v, sv_frame_t frame) const; |
543 bool clipboardHasDifferentAlignment(View *v, const Clipboard &clip) const; | 543 bool clipboardHasDifferentAlignment(View *v, const Clipboard &clip) const; |
544 | 544 |
545 struct MeasureRect { | 545 struct MeasureRect { |
546 | 546 |
547 mutable QRect pixrect; | 547 mutable QRect pixrect; |
548 bool haveFrames; | 548 bool haveFrames; |
549 int startFrame; // only valid if haveFrames | 549 sv_frame_t startFrame; // only valid if haveFrames |
550 int endFrame; // ditto | 550 sv_frame_t endFrame; // ditto |
551 double startY; | 551 double startY; |
552 double endY; | 552 double endY; |
553 | 553 |
554 bool operator<(const MeasureRect &mr) const; | 554 bool operator<(const MeasureRect &mr) const; |
555 void toXml(QTextStream &stream, QString indent) const; | 555 void toXml(QTextStream &stream, QString indent) const; |