Horizon
tool_draw_line_net.hpp
1 #pragma once
2 #include "core/tool.hpp"
3 #include "tool_helper_merge.hpp"
4 #include "tool_helper_draw_net_setting.hpp"
5 
6 namespace horizon {
7 
9 public:
10  ToolDrawLineNet(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  std::set<InToolActionID> get_actions() const override
16  {
17  using I = InToolActionID;
18  return {
19  I::LMB,
20  I::CANCEL,
21  I::RMB,
22  I::PLACE_JUNCTION,
23  I::COMMIT,
24  I::POSTURE,
25  I::ARBITRARY_ANGLE_MODE,
26  I::NET_LABEL_SIZE_INC,
27  I::NET_LABEL_SIZE_DEC,
28  I::ENTER_SIZE,
29  I::ROTATE,
30  I::TOGGLE_NET_LABEL,
31  };
32  }
33 
34 private:
35  class Junction *temp_junc_head = 0;
36  Junction *temp_junc_mid = 0;
37  class LineNet *temp_line_head = 0;
38  class LineNet *temp_line_mid = 0;
39  class NetLabel *net_label = nullptr;
40  enum class BendMode { XY, YX, ARB };
41  BendMode bend_mode = BendMode::XY;
42  void move_temp_junc(const Coordi &c);
43  void update_tip();
44  void restart(const Coordi &c);
45 
46  class Component *component_floating = nullptr;
47  UUIDPath<2> connpath_floating;
48  class SymbolPin *pin_start = nullptr;
49 
50  Junction *make_temp_junc(const Coordi &c);
51  void apply_settings() override;
52  void set_snap_filter();
53 };
54 } // namespace horizon
horizon::IDocument
Definition: idocument.hpp:5
horizon::ToolHelperDrawNetSetting
Definition: tool_helper_draw_net_setting.hpp:6
horizon::LineNet
LineNet is similar to Line, except it denotes electrical connection.
Definition: line_net.hpp:23
horizon::ToolDrawLineNet::begin
ToolResponse begin(const ToolArgs &args) override
Gets called right after the constructor has finished.
Definition: tool_draw_line_net.cpp:20
horizon::Coord< int64_t >
horizon::ToolDrawLineNet::can_begin
bool can_begin() override
Definition: tool_draw_line_net.cpp:15
horizon::Component
A Component is an instanced Entity in a Block.
Definition: component.hpp:39
horizon::NetLabel
Displays the junction's Net name it is attached to.
Definition: net_label.hpp:21
horizon::SymbolPin
Definition: symbol.hpp:19
horizon::UUIDPath< 2 >
horizon::Junction
A Junction is a point in 2D-Space.
Definition: junction.hpp:22
horizon::ToolDrawLineNet::update
ToolResponse update(const ToolArgs &args) override
Gets called whenever the user generated some sort of input.
Definition: tool_draw_line_net.cpp:131
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::ToolDrawLineNet
Definition: tool_draw_line_net.hpp:8
horizon::ToolHelperMerge
Definition: tool_helper_merge.hpp:5