Horizon
src
core
tools
tool_place_text.hpp
1
#pragma once
2
#include "core/tool.hpp"
3
#include "tool_helper_move.hpp"
4
#include <forward_list>
5
#include <map>
6
7
namespace
horizon {
8
9
class
ToolPlaceText
:
public
ToolHelperMove
{
10
public
:
11
ToolPlaceText
(
IDocument
*c, ToolID tid);
12
ToolResponse
begin
(
const
ToolArgs
&args)
override
;
13
ToolResponse
update
(
const
ToolArgs
&args)
override
;
14
bool
can_begin
()
override
;
15
16
class
Settings
:
public
ToolSettings
{
17
public
:
18
json
serialize()
const override
;
19
void
load_from_json(
const
json
&j)
override
;
20
class
LayerSettings
{
21
public
:
22
LayerSettings
()
23
{
24
}
25
LayerSettings
(
const
json
&j);
26
uint64_t
width = 0;
27
uint64_t
size = 1.5_mm;
28
json
serialize()
const
;
29
};
30
const
LayerSettings
&get_layer(
int
l)
const
;
31
std::map<int, LayerSettings> layers;
32
};
33
34
const
ToolSettings
*get_settings_const()
const override
35
{
36
return
&settings;
37
}
38
39
void
apply_settings()
override
;
40
41
std::set<InToolActionID> get_actions()
const override
42
{
43
using
I = InToolActionID;
44
return
{
45
I::LMB, I::CANCEL, I::RMB, I::EDIT, I::ROTATE, I::MIRROR, I::ENTER_SIZE, I::ENTER_WIDTH,
46
};
47
}
48
49
protected
:
50
ToolSettings *get_settings()
override
51
{
52
return
&settings;
53
}
54
55
private
:
56
class
Text *temp = 0;
57
std::forward_list<Text *> texts_placed;
58
Settings settings;
59
};
60
}
// namespace horizon
horizon::ToolSettings
Definition:
tool.hpp:84
horizon::IDocument
Definition:
idocument.hpp:5
horizon::ToolPlaceText::begin
ToolResponse begin(const ToolArgs &args) override
Gets called right after the constructor has finished.
Definition:
tool_place_text.cpp:73
libzip::uint64_t
zip_uint64_t uint64_t
zip_uint64_t_t typedef.
Definition:
zip.hpp:108
horizon::ToolHelperMove
Definition:
tool_helper_move.hpp:6
horizon::ToolPlaceText::update
ToolResponse update(const ToolArgs &args) override
Gets called whenever the user generated some sort of input.
Definition:
tool_place_text.cpp:103
horizon::ToolPlaceText
Definition:
tool_place_text.hpp:9
horizon::ToolPlaceText::Settings::LayerSettings
Definition:
tool_place_text.hpp:20
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
horizon::ToolPlaceText::can_begin
bool can_begin() override
Definition:
tool_place_text.cpp:59
horizon::ToolPlaceText::Settings
Definition:
tool_place_text.hpp:16
Generated by
1.8.20