MoveCommentBlock.hpp
1 #pragma once
2 
3 #include <Process/TimeValue.hpp>
4 
5 #include <Scenario/Commands/ScenarioCommandFactory.hpp>
6 
7 #include <score/command/Command.hpp>
8 #include <score/model/Identifier.hpp>
9 #include <score/model/path/Path.hpp>
10 #include <score/tools/Unused.hpp>
11 #include <score/tools/std/Optional.hpp>
12 
13 namespace Scenario
14 {
15 class CommentBlockModel;
16 namespace Command
17 {
18 class MoveCommentBlock final : public score::Command
19 {
20  SCORE_COMMAND_DECL(CommandFactoryName(), MoveCommentBlock, "Move a comment block")
21 public:
23  const ProcessModel& scenarPath, Id<CommentBlockModel> id, TimeVal newDate,
24  double newY);
25 
26  void update(unused_t, unused_t, TimeVal newDate, double newYPos)
27  {
28  m_newDate = std::move(newDate);
29  m_newY = newYPos;
30  }
31  // Command interface
32 
33  void undo(const score::DocumentContext& ctx) const override;
34  void redo(const score::DocumentContext& ctx) const override;
35 
36 protected:
37  void serializeImpl(DataStreamInput&) const override;
38  void deserializeImpl(DataStreamOutput&) override;
39 
40 private:
41  Path<ProcessModel> m_path;
43  TimeVal m_oldDate, m_newDate;
44  double m_oldY{}, m_newY{};
45 };
46 }
47 }
Definition: MoveCommentBlock.hpp:19
The core hierarchical and temporal process of score.
Definition: ScenarioModel.hpp:37
The id_base_t class.
Definition: Identifier.hpp:57
The Command class.
Definition: Command.hpp:34
Main plug-in of score.
Definition: score-plugin-dataflow/Dataflow/PortItem.hpp:14
Definition: DataStreamHelpers.hpp:99
Definition: DataStreamHelpers.hpp:103
Definition: TimeValue.hpp:21
Definition: DocumentContext.hpp:18
Definition: Unused.hpp:3