Horizon
src
core
tools
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
7
namespace
horizon {
8
9
class
ToolPaste :
public
ToolHelperMove,
public
ToolHelperMerge {
10
public
:
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
25
private
:
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
};
34
}
// namespace horizon
horizon::ToolPaste::update
ToolResponse update(const ToolArgs &args) override
Gets called whenever the user generated some sort of input.
horizon::ToolPaste::is_specific
bool is_specific() override
horizon::ToolPaste::begin
ToolResponse begin(const ToolArgs &args) override
Gets called right after the constructor has finished.
horizon::ToolPaste::can_begin
bool can_begin() override
nlohmann::basic_json
a class to store JSON values
Definition:
json.hpp:166
horizon::ToolResponse
To signal back to the core what the Tool did, a Tool returns a ToolResponse.
Definition:
tool.hpp:42
horizon::ToolArgs
This is what a Tool receives when the user did something.
Definition:
tool.hpp:23
Generated by
1.8.20