MovePoint.hpp
1 #pragma once
2 #include <Curve/Commands/CurveCommandFactory.hpp>
3 #include <Curve/Palette/CurvePoint.hpp>
4 
5 #include <score/command/Command.hpp>
6 #include <score/model/Identifier.hpp>
7 #include <score/model/path/Path.hpp>
8 #include <score/tools/std/Optional.hpp>
9 
10 #include <score_plugin_curve_export.h>
11 struct DataStreamInput;
12 struct DataStreamOutput;
13 
14 namespace Curve
15 {
16 class Model;
17 class PointModel;
18 class SCORE_PLUGIN_CURVE_EXPORT MovePoint final : public score::Command
19 {
20  SCORE_COMMAND_DECL(CommandFactoryName(), MovePoint, "Move a point")
21 public:
22  MovePoint(const Model& curve, const Id<PointModel>& pointId, Curve::Point newPoint);
23 
24  void undo(const score::DocumentContext& ctx) const override;
25  void redo(const score::DocumentContext& ctx) const override;
26 
27  void
28  update(const Model& obj, const Id<PointModel>& pointId, const Curve::Point& newPoint);
29 
30 protected:
31  void serializeImpl(DataStreamInput& s) const override;
32  void deserializeImpl(DataStreamOutput& s) override;
33 
34 private:
35  Path<Model> m_model;
36  Id<PointModel> m_pointId;
37  Curve::Point m_newPoint;
38  Curve::Point m_oldPoint;
39 };
40 }
Definition: CurveModel.hpp:25
Definition: MovePoint.hpp:19
The id_base_t class.
Definition: Identifier.hpp:57
The Command class.
Definition: Command.hpp:34
Utilities and base classes for 1D curves.
Definition: FocusDispatcher.hpp:12
Definition: DataStreamHelpers.hpp:99
Definition: DataStreamHelpers.hpp:103
Definition: DocumentContext.hpp:18