comparison layer/Layer.h @ 1486:ac0a8addabcf

Merge from branch by-id
author Chris Cannam
date Wed, 17 Jul 2019 14:25:16 +0100
parents e540aa5d89cd
children b402121d8f5f
comparison
equal deleted inserted replaced
1468:de41a11cabc2 1486:ac0a8addabcf
18 18
19 #include "base/PropertyContainer.h" 19 #include "base/PropertyContainer.h"
20 #include "base/XmlExportable.h" 20 #include "base/XmlExportable.h"
21 #include "base/Selection.h" 21 #include "base/Selection.h"
22 22
23 #include "data/model/Model.h"
24
23 #include "widgets/CommandHistory.h" 25 #include "widgets/CommandHistory.h"
24 26
25 #include "system/System.h" 27 #include "system/System.h"
26 28
27 #include <QObject> 29 #include <QObject>
34 #include <set> 36 #include <set>
35 37
36 #include <iostream> 38 #include <iostream>
37 39
38 class ZoomConstraint; 40 class ZoomConstraint;
39 class Model;
40 class QPainter; 41 class QPainter;
41 class View; 42 class View;
42 class LayerGeometryProvider; 43 class LayerGeometryProvider;
43 class QMouseEvent; 44 class QMouseEvent;
44 class Clipboard; 45 class Clipboard;
57 58
58 public: 59 public:
59 Layer(); 60 Layer();
60 virtual ~Layer(); 61 virtual ~Layer();
61 62
62 virtual const Model *getModel() const = 0; 63 /**
63 Model *getModel() { 64 * Return the ID of the model represented in this layer.
64 return const_cast<Model *>(const_cast<const Layer *>(this)->getModel()); 65 */
65 } 66 virtual ModelId getModel() const = 0;
66 67
67 /** 68 /**
68 * Return a zoom constraint object defining the supported zoom 69 * Return a zoom constraint object defining the supported zoom
69 * levels for this layer. If this returns zero, the layer will 70 * levels for this layer. If this returns zero, the layer will
70 * support any integer zoom level. 71 * support any integer zoom level.
408 * Return whether the layer is dormant (i.e. hidden) in the given 409 * Return whether the layer is dormant (i.e. hidden) in the given
409 * view. 410 * view.
410 */ 411 */
411 virtual bool isLayerDormant(const LayerGeometryProvider *v) const; 412 virtual bool isLayerDormant(const LayerGeometryProvider *v) const;
412 413
413 PlayParameters *getPlayParameters() override; 414 /**
415 * Return the play parameters for this layer, if any. The return
416 * value is a shared_ptr that can be passed to (e.g.)
417 * PlayParameterRepository::EditCommand to change the parameters.
418 */
419 std::shared_ptr<PlayParameters> getPlayParameters() override;
414 420
415 /** 421 /**
416 * True if this layer will need to place text labels when it is 422 * True if this layer will need to place text labels when it is
417 * painted. The view will take into account how many layers are 423 * painted. The view will take into account how many layers are
418 * requesting this, and will provide a distinct y-coord to each 424 * requesting this, and will provide a distinct y-coord to each
554 * given view. 560 * given view.
555 */ 561 */
556 void showLayer(LayerGeometryProvider *, bool show); 562 void showLayer(LayerGeometryProvider *, bool show);
557 563
558 signals: 564 signals:
559 void modelChanged(); 565 void modelChanged(ModelId);
560 void modelCompletionChanged(); 566 void modelCompletionChanged(ModelId);
561 void modelAlignmentCompletionChanged(); 567 void modelAlignmentCompletionChanged(ModelId);
562 void modelChangedWithin(sv_frame_t startFrame, sv_frame_t endFrame); 568 void modelChangedWithin(ModelId, sv_frame_t startFrame, sv_frame_t endFrame);
563 void modelReplaced(); 569 void modelReplaced();
564 570
565 void layerParametersChanged(); 571 void layerParametersChanged();
566 void layerParameterRangesChanged(); 572 void layerParameterRangesChanged();
567 void layerMeasurementRectsChanged(); 573 void layerMeasurementRectsChanged();
568 void layerNameChanged(); 574 void layerNameChanged();
569 575
570 void verticalZoomChanged(); 576 void verticalZoomChanged();
571 577
572 protected: 578 protected:
573 void connectSignals(const Model *); 579 void connectSignals(ModelId);
574 580
575 virtual sv_frame_t alignToReference(LayerGeometryProvider *v, sv_frame_t frame) const; 581 virtual sv_frame_t alignToReference(LayerGeometryProvider *v, sv_frame_t frame) const;
576 virtual sv_frame_t alignFromReference(LayerGeometryProvider *v, sv_frame_t frame) const; 582 virtual sv_frame_t alignFromReference(LayerGeometryProvider *v, sv_frame_t frame) const;
577 bool clipboardHasDifferentAlignment(LayerGeometryProvider *v, const Clipboard &clip) const; 583 bool clipboardHasDifferentAlignment(LayerGeometryProvider *v, const Clipboard &clip) const;
578 584