ScenarioPasteElements.hpp
1 #pragma once
2 #include <Process/Dataflow/Cable.hpp>
3 
4 #include <Scenario/Application/Menus/ScenarioCopy.hpp>
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/selection/Selection.hpp>
11 #include <score/tools/std/Optional.hpp>
12 
13 #include <ossia/detail/flat_map.hpp>
14 #include <ossia/detail/json.hpp>
15 
16 namespace Scenario
17 {
18 struct Point;
19 class EventModel;
20 class StateModel;
21 class TimeSyncModel;
22 class IntervalModel;
23 namespace Command
24 {
25 class SCORE_PLUGIN_SCENARIO_EXPORT ScenarioPasteElements final : public score::Command
26 {
27  SCORE_COMMAND_DECL(
28  CommandFactoryName(), ScenarioPasteElements, "Paste elements in scenario")
29 public:
31  const Scenario::ProcessModel& path, const rapidjson::Value& obj,
32  const Scenario::Point& pt);
33 
34  void undo(const score::DocumentContext& ctx) const override;
35  void redo(const score::DocumentContext& ctx) const override;
36 
37 protected:
38  void serializeImpl(DataStreamInput&) const override;
39  void deserializeImpl(DataStreamOutput&) override;
40 
41 private:
43 
44  std::vector<Id<TimeSyncModel>> m_ids_timesyncs;
45  std::vector<Id<IntervalModel>> m_ids_intervals;
46  std::vector<Id<EventModel>> m_ids_events;
47  std::vector<Id<StateModel>> m_ids_states;
48 
49  std::vector<QByteArray> m_json_timesyncs;
50  std::vector<QByteArray> m_json_intervals;
51  std::vector<QByteArray> m_json_events;
52  std::vector<QByteArray> m_json_states;
53 
54  CopiedCables m_cables;
55 };
56 }
57 }
Definition: ScenarioPasteElements.hpp:26
The core hierarchical and temporal process of score.
Definition: ScenarioModel.hpp:37
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: ScenarioCopy.hpp:87
Definition: ScenarioPoint.hpp:13
Definition: DocumentContext.hpp:18