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 {
7 class ToolAddPart : public ToolHelperMapSymbol, public ToolHelperMove {
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
horizon::ToolAddPart::begin
ToolResponse begin(const ToolArgs &args) override
Gets called right after the constructor has finished.
horizon::ToolAddPart::update
ToolResponse update(const ToolArgs &args) override
Gets called whenever the user generated some sort of input.
horizon::ToolResponse
To signal back to the core what the Tool did, a Tool returns a ToolResponse.
Definition: tool.hpp:42
horizon::ToolAddPart::can_begin
bool can_begin() override
horizon::ToolArgs
This is what a Tool receives when the user did something.
Definition: tool.hpp:23