Horizon
src
common
text.hpp
1
#pragma once
2
#include "util/uuid.hpp"
3
#include "nlohmann/json_fwd.hpp"
4
#include "common.hpp"
5
#include "util/uuid_provider.hpp"
6
#include "util/placement.hpp"
7
#include <vector>
8
#include <map>
9
#include <fstream>
10
11
namespace
horizon
{
12
using
json
=
nlohmann::json
;
13
enum class
TextOrigin { BASELINE, CENTER, BOTTOM };
14
18
class
Text
:
public
UUIDProvider
{
19
public
:
20
Text
(
const
UUID
&uu,
const
json
&j);
21
Text
(
const
UUID
&uu);
22
23
UUID
uuid;
24
25
TextOrigin origin = TextOrigin::CENTER;
26
Placement
placement;
27
std::string text;
28
uint64_t size = 1.5_mm;
29
uint64_t width = 0;
30
int
layer = 0;
31
std::string text_override;
32
37
bool
overridden =
false
;
38
43
bool
from_smash =
false
;
44
45
// not stored
46
bool
temp;
47
48
UUID
get_uuid()
const override
;
49
json
serialize()
const
;
50
};
51
}
// namespace horizon
nlohmann::basic_json
a class to store JSON values
Definition:
json.hpp:161
horizon::Placement
Definition:
placement.hpp:8
horizon::UUIDProvider
Interface for objects that have a UUID.
Definition:
uuid_provider.hpp:9
horizon::Text
Used wherever a user-editable text is needed.
Definition:
text.hpp:18
horizon::UUID
This class encapsulates a UUID and allows it to be uses as a value type.
Definition:
uuid.hpp:16
horizon
Definition:
block.cpp:7
nlohmann::json
basic_json<> json
default JSON class
Definition:
json_fwd.hpp:61
Generated by
1.8.13