Loading...
Searching...
No Matches
LoadPreset.hpp
1#pragma once
2#include <State/Value.hpp>
3#include <State/ValueSerialization.hpp>
4
5#include <Process/Commands/ProcessCommandFactory.hpp>
6#include <Process/Dataflow/Port.hpp>
7#include <Process/Process.hpp>
8
9#include <score/model/path/PathSerialization.hpp>
10namespace Process
11{
12class ProcessModel;
13class SCORE_LIB_PROCESS_EXPORT LoadPreset final : public score::Command
14{
15 SCORE_COMMAND_DECL(Process::CommandFactoryName(), LoadPreset, "Set a control")
16
17public:
19 : m_path{obj}
20 , m_old{obj.savePreset()}
21 , m_new{std::move(newval)}
22 {
23 }
24
25 virtual ~LoadPreset() { }
26
27private:
28 void undo(const score::DocumentContext& ctx) const final override
29 {
30 m_path.find(ctx).loadPreset(m_old);
31 }
32
33 void redo(const score::DocumentContext& ctx) const final override
34 {
35 m_path.find(ctx).loadPreset(m_new);
36 }
37
38 void serializeImpl(DataStreamInput& stream) const final override
39 {
40 stream << m_path << m_old << m_new;
41 }
42 void deserializeImpl(DataStreamOutput& stream) final override
43 {
44 stream >> m_path >> m_old >> m_new;
45 }
46
48 Process::Preset m_old;
49 Process::Preset m_new;
50};
51}
The Path class is a typesafe wrapper around ObjectPath.
Definition Path.hpp:52
Definition LoadPreset.hpp:14
The Process class.
Definition score-lib-process/Process/Process.hpp:61
The Command class.
Definition Command.hpp:34
Base classes and tools to implement processes and layers.
Definition JSONVisitor.hpp:1324
Definition DataStreamHelpers.hpp:99
Definition DataStreamHelpers.hpp:103
Definition Preset.hpp:32
Definition DocumentContext.hpp:18