Horizon
tool_map_symbol.hpp
1 #pragma once
2 #include "core/tool.hpp"
3 #include "tool_helper_map_symbol.hpp"
4 #include "tool_helper_move.hpp"
5 #include <list>
6 
7 namespace horizon {
8 class ToolMapSymbol : public ToolHelperMapSymbol, public ToolHelperMove {
9 public:
10  ToolMapSymbol(IDocument *c, ToolID tid);
11  ToolResponse begin(const ToolArgs &args) override;
12  ToolResponse update(const ToolArgs &args) override;
13  bool can_begin() override;
14 
15  class ToolDataMapSymbol : public ToolData {
16  public:
17  ToolDataMapSymbol(const std::vector<UUIDPath<2>> &g) : gates(g)
18  {
19  }
20  const std::vector<UUIDPath<2>> gates;
21  };
22 
23  std::set<InToolActionID> get_actions() const override
24  {
25  using I = InToolActionID;
26  return {
27  I::LMB, I::CANCEL, I::RMB, I::ROTATE, I::MIRROR,
28  };
29  }
30 
31 private:
32  std::map<UUIDPath<2>, std::string> gates_out;
33  class SchematicSymbol *sym_current = nullptr;
34  std::list<UUIDPath<2>> gates_from_data;
35  bool data_mode = false;
36 };
37 } // namespace horizon
horizon::ToolData
Definition: tool_data.hpp:4
horizon::ToolMapSymbol::ToolDataMapSymbol
Definition: tool_map_symbol.hpp:15
horizon::UUIDPath< 2 >
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
horizon::ToolMapSymbol::begin
ToolResponse begin(const ToolArgs &args) override
Gets called right after the constructor has finished.
horizon::ToolMapSymbol::can_begin
bool can_begin() override
horizon::ToolMapSymbol::update
ToolResponse update(const ToolArgs &args) override
Gets called whenever the user generated some sort of input.