Horizon
tool_paste.hpp
1#pragma once
2#include "core/tool.hpp"
3#include "tool_helper_merge.hpp"
4#include "tool_helper_move.hpp"
5#include "nlohmann/json.hpp"
6
7namespace horizon {
8
9class ToolPaste : public ToolHelperMove, public ToolHelperMerge {
10public:
11 ToolPaste(IDocument *c, ToolID tid);
12 ToolResponse begin(const ToolArgs &args) override;
13 ToolResponse update(const ToolArgs &args) override;
14 bool can_begin() override;
15 bool is_specific() override;
16
17 std::set<InToolActionID> get_actions() const override
18 {
19 using I = InToolActionID;
20 return {
21 I::LMB, I::CANCEL, I::RMB, I::ROTATE, I::MIRROR, I::RESTRICT,
22 };
23 }
24
25private:
26 void fix_layer(int &la);
27 void apply_shift(Coordi &c, const Coordi &cursor_pos);
28 Coordi shift;
29 json paste_data;
30 class Picture *pic = nullptr;
31 ToolResponse begin_paste(const json &j, const Coordi &cursor_pos);
32 void update_tip();
33 std::set<UUID> nets;
34 void update_airwires();
35};
36} // namespace horizon
Definition: idocument.hpp:5
Definition: picture.hpp:10
This is what a Tool receives when the user did something.
Definition: tool_pub.hpp:23
Definition: tool_helper_merge.hpp:5
Definition: tool_helper_move.hpp:6
Definition: tool_paste.hpp:9
ToolResponse update(const ToolArgs &args) override
Gets called whenever the user generated some sort of input.
Definition: tool_paste.cpp:590
bool can_begin() override
Definition: tool_paste.cpp:27
bool is_specific() override
Definition: tool_paste.cpp:35
ToolResponse begin(const ToolArgs &args) override
Gets called right after the constructor has finished.
Definition: tool_paste.cpp:537
To signal back to the core what the Tool did, a Tool returns a ToolResponse.
Definition: tool_pub.hpp:40
a class to store JSON values
Definition: json.hpp:177