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"
14enum class ToolEventType { NONE, MOVE, ACTION, LAYER_CHANGE, DATA };
17enum class InToolActionID;
25 ToolEventType type = ToolEventType::NONE;
27 std::set<SelectableRef> selection;
28 bool keep_selection =
false;
29 InToolActionID action;
33 std::unique_ptr<ToolData> data =
nullptr;
43 std::unique_ptr<ToolData> data =
nullptr;
44 enum class Result { NOP, END, COMMIT, REVERT };
45 Result result = Result::NOP;
60 static ToolResponse revert()
62 return ToolResponse(Result::REVERT);
68 static ToolResponse next(Result res, ToolID t, std::unique_ptr<ToolData> data =
nullptr)
72 r.data = std::move(data);
84 virtual void load_from_json(
const json &j) = 0;
85 virtual json serialize()
const = 0;
100 virtual void apply_settings()
104 virtual std::map<ToolID, ToolSettings *> get_all_settings()
106 if (
auto s = get_settings())
107 return {{tool_id, s}};
112 virtual std::set<InToolActionID> get_actions()
const
146 std::set<SelectableRef> selection;
153 virtual ToolSettings *get_settings()
159 class ImpInterface *imp =
nullptr;
160 const ToolID tool_id;
161 bool is_transient =
false;
Definition idocument.hpp:5
Definition imp_interface.hpp:12
a class to store JSON values
Definition json.hpp:177
basic_json<> json
default JSON class
Definition json_fwd.hpp:62