Loading...
Searching...
No Matches
SwapSlots.hpp
1#pragma once
2#include <Scenario/Commands/ScenarioCommandFactory.hpp>
3#include <Scenario/Document/Interval/Slot.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
10struct DataStreamInput;
11struct DataStreamOutput;
12
13namespace Scenario
14{
15class IntervalModel;
16namespace Command
17{
19{
20 SCORE_COMMAND_DECL(CommandFactoryName(), ChangeSlotPosition, "Change slot position")
21public:
22 ChangeSlotPosition(Path<IntervalModel>&& rack, Slot::RackView, int pos1, int pos2);
23
24 void undo(const score::DocumentContext& ctx) const override;
25 void redo(const score::DocumentContext& ctx) const override;
26
27protected:
28 void serializeImpl(DataStreamInput&) const override;
29 void deserializeImpl(DataStreamOutput&) override;
30
31private:
33 Slot::RackView m_view{};
34 int m_first{}, m_second{};
35};
36
38{
39public:
40 SlotCommand() = default;
41 SlotCommand(const IntervalModel& c);
42 void undo(const score::DocumentContext& ctx) const override;
43 void redo(const score::DocumentContext& ctx) const override;
44
45protected:
46 void serializeImpl(DataStreamInput&) const override;
47 void deserializeImpl(DataStreamOutput&) override;
48
50 Scenario::Rack m_old{};
51 Scenario::Rack m_new{};
52};
53
54class MoveLayerInNewSlot final : public SlotCommand
55{
56 SCORE_COMMAND_DECL(CommandFactoryName(), MoveLayerInNewSlot, "Move layer in new slot")
57public:
58 MoveLayerInNewSlot(const IntervalModel&, int pos1, int pos2);
59};
60
61class MergeSlots final : public SlotCommand
62{
63 SCORE_COMMAND_DECL(CommandFactoryName(), MergeSlots, "Merge slots")
64
65public:
66 MergeSlots(const IntervalModel&, int pos1, int pos2);
67};
68
69class MergeLayerInSlot final : public SlotCommand
70{
71 SCORE_COMMAND_DECL(CommandFactoryName(), MergeLayerInSlot, "Merge layer")
72
73public:
74 MergeLayerInSlot(const IntervalModel&, int pos1, int pos2);
75};
76}
77}
The Path class is a typesafe wrapper around ObjectPath.
Definition Path.hpp:52
Definition SwapSlots.hpp:19
Definition SwapSlots.hpp:70
Definition SwapSlots.hpp:62
Definition SwapSlots.hpp:55
Definition SwapSlots.hpp:38
Definition IntervalModel.hpp:50
The Command class.
Definition Command.hpp:34
Main plug-in of score.
Definition score-plugin-dataflow/Dataflow/PortItem.hpp:13
Definition DataStreamHelpers.hpp:99
Definition DataStreamHelpers.hpp:103
Definition DocumentContext.hpp:18