Horizon
tool_draw_line.hpp
1 #pragma once
2 #include "core/tool.hpp"
3 #include "tool_helper_line_width_setting.hpp"
4 #include "tool_helper_restrict.hpp"
5 
6 namespace horizon {
7 
9 public:
10  using ToolHelperLineWidthSetting::ToolHelperLineWidthSetting;
11  ToolResponse begin(const ToolArgs &args) override;
12  ToolResponse update(const ToolArgs &args) override;
13  bool can_begin() override;
14  std::set<InToolActionID> get_actions() const override
15  {
16  using I = InToolActionID;
17  return {
18  I::LMB, I::CANCEL, I::RMB, I::RESTRICT, I::TOGGLE_DEG45_RESTRICT, I::ENTER_WIDTH,
19  };
20  }
21 
22  void apply_settings() override;
23 
24 private:
25  class Junction *temp_junc = 0;
26  class Line *temp_line = 0;
27  void update_tip();
28  bool first_line = true;
29  std::set<const Junction *> junctions_created;
30  void do_move(const Coordi &c);
31 };
32 } // namespace horizon
A Junction is a point in 2D-Space.
Definition: junction.hpp:20
Graphical line.
Definition: line.hpp:19
This is what a Tool receives when the user did something.
Definition: tool_pub.hpp:23
Definition: tool_draw_line.hpp:8
bool can_begin() override
Definition: tool_draw_line.cpp:10
ToolResponse update(const ToolArgs &args) override
Gets called whenever the user generated some sort of input.
Definition: tool_draw_line.cpp:64
ToolResponse begin(const ToolArgs &args) override
Gets called right after the constructor has finished.
Definition: tool_draw_line.cpp:21
Definition: tool_helper_line_width_setting.hpp:6
Definition: tool_helper_restrict.hpp:6
To signal back to the core what the Tool did, a Tool returns a ToolResponse.
Definition: tool_pub.hpp:40