2 #include "common/common.hpp"
3 #include "canvas/selectables.hpp"
4 #include "canvas/target.hpp"
5 #include "tool_data.hpp"
6 #include "nlohmann/json_fwd.hpp"
7 #include "document/documents.hpp"
14 enum class ToolEventType { NONE, MOVE, CLICK, CLICK_RELEASE, KEY, LAYER_CHANGE, DATA };
24 ToolEventType type = ToolEventType::NONE;
26 std::set<SelectableRef> selection;
27 bool keep_selection =
false;
28 unsigned int button = 0;
39 std::unique_ptr<ToolData> data =
nullptr;
51 std::unique_ptr<ToolData> data =
nullptr;
52 enum class Result { NOP, END, COMMIT, REVERT };
53 Result result = Result::NOP;
54 bool fast_draw =
false;
70 static ToolResponse revert()
72 return ToolResponse(Result::REVERT);
75 static ToolResponse fast()
85 static ToolResponse next(Result res, ToolID t, std::unique_ptr<ToolData> data =
nullptr)
89 r.data = std::move(data);
101 virtual void load_from_json(
const json &j) = 0;
102 virtual json serialize()
const = 0;
140 void set_transient();
141 virtual ToolID get_tool_id_for_settings()
const
153 virtual void apply_settings()
195 std::set<SelectableRef> selection;
203 class ImpInterface *imp =
nullptr;
205 bool is_transient =
false;
206 virtual ToolSettings *get_settings()