Horizon
tool_move.hpp
1 #pragma once
2 #include "core/tool.hpp"
3 #include "tool_helper_merge.hpp"
4 #include "tool_helper_move.hpp"
5 
6 namespace horizon {
7 
8 class ToolMove : public ToolHelperMove, public ToolHelperMerge {
9 public:
10  ToolMove(IDocument *c, ToolID tid);
11  ToolResponse begin(const ToolArgs &args) override;
12  ToolResponse update(const ToolArgs &args) override;
13  bool can_begin() override;
14  bool is_specific() override
15  {
16  return true;
17  }
18  std::set<InToolActionID> get_actions() const override
19  {
20  using I = InToolActionID;
21  return {
22  I::LMB,
23  I::LMB_RELEASE,
24  I::CANCEL,
25  I::COMMIT,
26  I::RMB,
27  I::MIRROR,
28  I::MIRROR_CURSOR,
29  I::ROTATE,
30  I::ROTATE_CURSOR,
31  I::RESTRICT,
32  I::MOVE_UP,
33  I::MOVE_DOWN,
34  I::MOVE_LEFT,
35  I::MOVE_RIGHT,
36  I::MOVE_UP_FINE,
37  I::MOVE_DOWN_FINE,
38  I::MOVE_LEFT_FINE,
39  I::MOVE_RIGHT_FINE,
40  };
41  }
42 
43 private:
44  Coordi get_selection_center();
45  void expand_selection();
46  void update_tip();
47  void do_move(const Coordi &c);
48 
49  void collect_nets();
50  std::set<UUID> nets;
51 
52  bool update_airwires = true;
53  void finish();
54  bool is_key = false;
55  Coordi key_delta;
56 
57  std::set<class Plane *> planes;
58 };
59 } // namespace horizon
horizon::ToolMove::begin
ToolResponse begin(const ToolArgs &args) override
Gets called right after the constructor has finished.
horizon::ToolMove::is_specific
bool is_specific() override
Definition: tool_move.hpp:14
horizon::ToolMove::update
ToolResponse update(const ToolArgs &args) override
Gets called whenever the user generated some sort of input.
horizon::ToolMove::can_begin
bool can_begin() override
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