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 
8 class ToolDrawLineNet : public ToolHelperMerge, public ToolHelperDrawNetSetting {
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::ToolDrawLineNet::begin
ToolResponse begin(const ToolArgs &args) override
Gets called right after the constructor has finished.
horizon::ToolDrawLineNet::can_begin
bool can_begin() override
horizon::ToolDrawLineNet::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::ToolArgs
This is what a Tool receives when the user did something.
Definition: tool.hpp:23