Horizon
tool_draw_arc.hpp
1 #pragma once
2 #include "core/tool.hpp"
3 #include "tool_helper_line_width_setting.hpp"
4 
5 namespace horizon {
6 
7 class ToolDrawArc : public ToolHelperLineWidthSetting {
8 public:
9  ToolDrawArc(IDocument *c, ToolID tid);
10  ToolResponse begin(const ToolArgs &args) override;
11  ToolResponse update(const ToolArgs &args) override;
12  bool can_begin() override;
13  void apply_settings() override;
14  std::set<InToolActionID> get_actions() const override
15  {
16  using I = InToolActionID;
17  return {
18  I::LMB, I::CANCEL, I::RMB, I::ENTER_WIDTH, I::FLIP_ARC,
19  };
20  }
21 
22 private:
23  enum class DrawArcState { FROM, TO, CENTER };
24  DrawArcState state = DrawArcState::FROM;
25  class Junction *temp_junc = 0;
26  Junction *from_junc = 0;
27  Junction *to_junc = 0;
28  class Arc *temp_arc = 0;
29  Junction *make_junction(const Coordi &coords);
30  void update_tip();
31 };
32 } // namespace horizon
horizon::ToolDrawArc::begin
ToolResponse begin(const ToolArgs &args) override
Gets called right after the constructor has finished.
horizon::ToolDrawArc::can_begin
bool can_begin() override
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::ToolDrawArc::update
ToolResponse update(const ToolArgs &args) override
Gets called whenever the user generated some sort of input.