Loading...
Searching...
No Matches
Record.hpp
1#pragma once
2#include <Recording/Commands/RecordingCommandFactory.hpp>
3
4#include <score/command/AggregateCommand.hpp>
5
6#include <ossia/detail/ssize.hpp>
7
8namespace Recording
9{
10class Record final : public score::AggregateCommand
11{
12 SCORE_COMMAND_DECL(RecordingCommandFactoryName(), Record, "Record")
13public:
14 void undo(const score::DocumentContext& ctx) const override
15 {
16 const int N = std::ssize(m_cmds);
17 // Undo 1
18 if(N >= 2)
19 {
20 auto it = m_cmds.begin();
21 std::advance(it, 1);
22 (*it)->undo(ctx);
23 }
24
25 if(N >= 1)
26 {
27 // Undo 0
28 (*m_cmds.begin())->undo(ctx);
29 }
30 }
31};
32}
Definition Record.hpp:11
Allows for grouping of multiple commands in a single one.
Definition AggregateCommand.hpp:15
Definition DocumentContext.hpp:18