Horizon
tool_add_part.hpp
1 #pragma once
2 #include "core/tool.hpp"
3 #include "tool_helper_map_symbol.hpp"
4 #include "tool_helper_move.hpp"
5 
6 namespace horizon {
8 public:
9  ToolAddPart(IDocument *c, ToolID tid);
10  ToolResponse begin(const ToolArgs &args) override;
11  ToolResponse update(const ToolArgs &args) override;
12  bool can_begin() override;
13  std::set<InToolActionID> get_actions() const override
14  {
15  using I = InToolActionID;
16  return {
17  I::LMB, I::CANCEL, I::RMB, I::ROTATE, I::MIRROR,
18  };
19  }
20 
21 
22  class ToolDataAddPart : public ToolData {
23  public:
24  ToolDataAddPart(const UUID &uu) : part_uuid(uu)
25  {
26  }
27  const UUID part_uuid;
28  };
29 
30 private:
31  unsigned int current_gate = 0;
32  class SchematicSymbol *sym_current = nullptr;
33  std::vector<const class Gate *> gates;
34  class Component *comp = nullptr;
35  void update_tip();
36  UUID create_tag();
37 };
38 } // namespace horizon
A Component is an instanced Entity in a Block.
Definition: component.hpp:39
Definition: idocument.hpp:5
Definition: schematic_symbol.hpp:17
Definition: tool_add_part.hpp:22
Definition: tool_add_part.hpp:7
ToolResponse begin(const ToolArgs &args) override
Gets called right after the constructor has finished.
Definition: tool_add_part.cpp:32
bool can_begin() override
Definition: tool_add_part.cpp:19
ToolResponse update(const ToolArgs &args) override
Gets called whenever the user generated some sort of input.
Definition: tool_add_part.cpp:105
This is what a Tool receives when the user did something.
Definition: tool.hpp:23
Definition: tool_data.hpp:4
Definition: tool_helper_map_symbol.hpp:5
Definition: tool_helper_move.hpp:6
To signal back to the core what the Tool did, a Tool returns a ToolResponse.
Definition: tool.hpp:42
This class encapsulates a UUID and allows it to be uses as a value type.
Definition: uuid.hpp:16