Loading...
Searching...
No Matches
PasteAnchors.hpp
1#pragma once
2#include <Scenario/Commands/ScenarioCommandFactory.hpp>
3
4#include <score/command/Command.hpp>
5#include <score/model/path/ObjectPath.hpp>
6
7#include <score/serialization/JSONVisitor.hpp>
8
9#include <score_plugin_scenario_export.h>
10
11#include <utility>
12#include <vector>
13
14class QObject;
15namespace score
16{
17struct DocumentContext;
18}
19
20namespace Scenario
21{
24{
25 std::vector<std::pair<ObjectPath, ObjectPath>> moved;
26 bool sameDocument{};
27};
28
30SCORE_PLUGIN_SCENARIO_EXPORT
31bool copiedFromHere(const rapidjson::Value& copy, const score::DocumentContext& ctx);
32
33SCORE_PLUGIN_SCENARIO_EXPORT
34bool hasAnchors(const rapidjson::Value& copy);
35
38SCORE_PLUGIN_SCENARIO_EXPORT
39void remapCopiedAnchors(QObject& root, const CopiedPaths& paths);
40
42SCORE_PLUGIN_SCENARIO_EXPORT
43void followPasted(const score::DocumentContext& ctx, const std::vector<QObject*>& pasted);
44
45namespace Command
46{
48class SCORE_PLUGIN_SCENARIO_EXPORT FollowPasted final : public score::Command
49{
50 SCORE_COMMAND_DECL(CommandFactoryName(), FollowPasted, "Follow pasted objects")
51public:
52 explicit FollowPasted(std::vector<ObjectPath> pasted);
53
54 void undo(const score::DocumentContext& ctx) const override;
55 void redo(const score::DocumentContext& ctx) const override;
56
57protected:
58 void serializeImpl(DataStreamInput&) const override;
59 void deserializeImpl(DataStreamOutput&) override;
60
61private:
62 std::vector<ObjectPath> m_pasted;
63};
64}
65}
Goes last in a paste macro, once all the pasted objects exist.
Definition PasteAnchors.hpp:49
The Command class.
Definition Command.hpp:34
Main plug-in of score.
Definition score-plugin-dataflow/Dataflow/PortItem.hpp:13
void followPasted(const score::DocumentContext &ctx, const std::vector< QObject * > &pasted)
The copies are published under their own names.
Definition PasteAnchors.cpp:150
bool copiedFromHere(const rapidjson::Value &copy, const score::DocumentContext &ctx)
Compares the copy's "OriginDocument" key with score::IDocument::copyOrigin()
Definition PasteAnchors.cpp:26
void remapCopiedAnchors(QObject &root, const CopiedPaths &paths)
Definition PasteAnchors.cpp:84
Base toolkit upon which the software is built.
Definition Application.cpp:108
Definition DataStreamHelpers.hpp:99
Definition DataStreamHelpers.hpp:103
Paths of the copied objects and of their copies.
Definition PasteAnchors.hpp:24
Definition DocumentContext.hpp:18