diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-13 11:50:49 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-13 11:50:49 +0000 |
commit | c853ffb5b2f75f5a889ed2e3ef89b818a736e87a (patch) | |
tree | 7d13a0883bb7936b84d6ecdd7bc332b41ed04bee /src/ui/tools/booleans-tool.h | |
parent | Initial commit. (diff) | |
download | inkscape-c853ffb5b2f75f5a889ed2e3ef89b818a736e87a.tar.xz inkscape-c853ffb5b2f75f5a889ed2e3ef89b818a736e87a.zip |
Adding upstream version 1.3+ds.upstream/1.3+dsupstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/ui/tools/booleans-tool.h')
-rw-r--r-- | src/ui/tools/booleans-tool.h | 70 |
1 files changed, 70 insertions, 0 deletions
diff --git a/src/ui/tools/booleans-tool.h b/src/ui/tools/booleans-tool.h new file mode 100644 index 0000000..9eafb88 --- /dev/null +++ b/src/ui/tools/booleans-tool.h @@ -0,0 +1,70 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/** + * @file + * A tool for building shapes. + */ +/* Authors: + * Martin Owens + * + * Copyright (C) 2022 Authors + * Released under GNU GPL v2+, read the file 'COPYING' for more information. + */ + +#ifndef INKSCAPE_UI_TOOLS_BOOLEANS_TOOL +#define INKSCAPE_UI_TOOLS_BOOLEANS_TOOL + +#include "ui/tools/tool-base.h" + +class SPDesktop; + +namespace Inkscape { +class BooleanBuilder; + +namespace UI { +namespace Tools { + +class InteractiveBooleansTool : public ToolBase { +public: + + InteractiveBooleansTool(SPDesktop *desktop); + ~InteractiveBooleansTool() override; + + void switching_away(const std::string &new_tool) override; + + // Preferences set + void set(const Inkscape::Preferences::Entry& val) override; + + // Undo/redo catching + bool catch_undo(bool redo) override; + + // Catch empty selections + bool is_ready() const override; + + // Event functions + bool root_handler(GdkEvent* event) override; + + void shape_commit(); + void shape_cancel(); +private: + void update_status(); + void change_mode(bool setup); + bool should_add(int state) const; + + bool event_button_press_handler(GdkEvent* event); + bool event_button_release_handler(GdkEvent* event); + bool event_motion_handler(GdkEvent* event, bool add); + bool event_key_press_handler(GdkEvent* event); + + std::unique_ptr<BooleanBuilder> boolean_builder; + + sigc::connection _sel_modified; + sigc::connection _sel_changed; + + bool to_commit = false; +}; + +} // namespace Tools +} // namespace UI +} // namespace Inkscape + +#endif // INKSCAPE_UI_TOOLS_BOOLEANS_TOOL |