MoveInterval.hpp
1 #pragma once
2 #include <Process/TimeValue.hpp>
3 
4 #include <Scenario/Commands/ScenarioCommandFactory.hpp>
5 
6 #include <score/command/Command.hpp>
7 #include <score/model/Identifier.hpp>
8 #include <score/model/path/Path.hpp>
9 #include <score/tools/Unused.hpp>
10 #include <score/tools/std/Optional.hpp>
11 
12 struct DataStreamInput;
13 struct DataStreamOutput;
14 
15 /*
16  * Command for vertical move so it doesn't have to resize anything on time axis
17  * */
18 namespace Scenario
19 {
20 class IntervalModel;
21 class ProcessModel;
22 namespace Command
23 {
24 class MoveInterval final : public score::Command
25 {
26  SCORE_COMMAND_DECL(CommandFactoryName(), MoveInterval, "Move a interval")
27 public:
28  MoveInterval(const Scenario::ProcessModel& scenar, Id<IntervalModel> id, double y);
29 
30  void update(unused_t, unused_t, double height) { m_newHeight = height; }
31 
32  void undo(const score::DocumentContext& ctx) const override;
33  void redo(const score::DocumentContext& ctx) const override;
34 
35 protected:
36  void serializeImpl(DataStreamInput&) const override;
37  void deserializeImpl(DataStreamOutput&) override;
38 
39 private:
41  Id<IntervalModel> m_interval;
42  double m_oldHeight{};
43  double m_newHeight{};
44 
45  std::vector<std::pair<Id<IntervalModel>, double>> m_selectedIntervals;
46 };
47 }
48 }
Definition: MoveInterval.hpp:25
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: DocumentContext.hpp:18
Definition: Unused.hpp:3