comparison OrthancStone/Sources/Scene2DViewport/ViewportController.h @ 1606:874e178f34e9

- ViewportController now has weak ptr to Viewport - Measuring tools + related commands and all trackers now store only a weak_ptr to the Viewport and lock() on demand for usage - LayerHolder and FixedPoint aligner store only a weak_ptr to the Viewport, too - Fixed float/double warning in GrayscaleWindowingSceneTracker
author Benjamin Golinvaux <bgo@osimis.io>
date Wed, 28 Oct 2020 20:14:34 +0100
parents 8563ea5d8ae4
children fb62c1522193
comparison
equal deleted inserted replaced
1605:b3c439d96d3e 1606:874e178f34e9
86 public: 86 public:
87 ORTHANC_STONE_DEFINE_ORIGIN_MESSAGE(__FILE__, __LINE__, \ 87 ORTHANC_STONE_DEFINE_ORIGIN_MESSAGE(__FILE__, __LINE__, \
88 SceneTransformChanged, \ 88 SceneTransformChanged, \
89 ViewportController); 89 ViewportController);
90 90
91 explicit ViewportController(boost::shared_ptr<IViewport> viewport); 91 explicit ViewportController(boost::weak_ptr<IViewport> viewport);
92 92
93 ~ViewportController(); 93 ~ViewportController();
94 94
95 /** 95 /**
96 This method returns the list of measure tools containing the supplied point 96 This method returns the list of measure tools containing the supplied point
231 } 231 }
232 232
233 private: 233 private:
234 double GetCanvasToSceneFactor() const; 234 double GetCanvasToSceneFactor() const;
235 235
236 boost::shared_ptr<IViewport> viewport_; 236 boost::weak_ptr<IViewport> viewport_;
237 boost::weak_ptr<UndoStack> undoStackW_; // Global stack, possibly shared by all viewports 237 boost::weak_ptr<UndoStack> undoStackW_; // Global stack, possibly shared by all viewports
238 std::vector<boost::shared_ptr<MeasureTool> > measureTools_; 238 std::vector<boost::shared_ptr<MeasureTool> > measureTools_;
239 boost::shared_ptr<IFlexiblePointerTracker> activeTracker_; // TODO - Couldn't this be a "std::unique_ptr"? 239 boost::shared_ptr<IFlexiblePointerTracker> activeTracker_; // TODO - Couldn't this be a "std::unique_ptr"?
240 240
241 std::unique_ptr<Scene2D> scene_; 241 std::unique_ptr<Scene2D> scene_;