Horizon
Loading...
Searching...
No Matches
tool_move.hpp
1#pragma once
2#include "core/tool.hpp"
3#include "tool_helper_merge.hpp"
4#include "tool_helper_move.hpp"
5#include "tool_helper_collect_nets.hpp"
6
7namespace horizon {
8
10public:
11 ToolMove(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 return true;
18 }
19 std::set<InToolActionID> get_actions() const override
20 {
21 using I = InToolActionID;
22 return {
23 I::LMB,
24 I::LMB_RELEASE,
25 I::CANCEL,
26 I::COMMIT,
27 I::RMB,
28 I::MIRROR,
29 I::MIRROR_CURSOR,
30 I::ROTATE,
31 I::ROTATE_CURSOR,
32 I::RESTRICT,
33 I::MOVE_UP,
34 I::MOVE_DOWN,
35 I::MOVE_LEFT,
36 I::MOVE_RIGHT,
37 I::MOVE_UP_FINE,
38 I::MOVE_DOWN_FINE,
39 I::MOVE_LEFT_FINE,
40 I::MOVE_RIGHT_FINE,
41 };
42 }
43
44private:
45 Coordi get_selection_center();
46 void expand_selection();
47 void update_tip();
48 void do_move(const Coordi &c);
49
50 std::set<UUID> nets;
51
52 void update_airwires();
53 [[nodiscard]] bool finish();
54 bool is_key = false;
55 Coordi key_delta;
56
57 enum class Axis { NONE = 0, X = 1, Y = 2 };
58 friend Axis &operator|=(Axis &a, const Axis &b);
59 friend Axis operator|(Axis a, Axis b);
60 friend Axis operator&(Axis a, Axis b);
61 std::map<UUID, Axis> extra_junctions;
62 void add_extra_junction(const UUID &uu, Axis ax);
63 void move_extra_junctions(const Coordi &delta);
64
65 std::set<class Plane *> planes;
66};
67} // namespace horizon
Definition idocument.hpp:5
This is what a Tool receives when the user did something.
Definition tool_pub.hpp:23
Definition tool_helper_collect_nets.hpp:7
Definition tool_helper_merge.hpp:5
Definition tool_helper_move.hpp:6
Definition tool_move.hpp:9
bool can_begin() override
Definition tool_move.cpp:434
bool is_specific() override
Definition tool_move.hpp:15
ToolResponse begin(const ToolArgs &args) override
Gets called right after the constructor has finished.
Definition tool_move.cpp:322
ToolResponse update(const ToolArgs &args) override
Gets called whenever the user generated some sort of input.
Definition tool_move.cpp:497
To signal back to the core what the Tool did, a Tool returns a ToolResponse.
Definition tool_pub.hpp:40