Inkscape
Vector Graphics Editor
Loading...
Searching...
No Matches
booleans-tool.h
Go to the documentation of this file.
1// SPDX-License-Identifier: GPL-2.0-or-later
6/* Authors:
7 * Martin Owens
8 *
9 * Copyright (C) 2022 Authors
10 * Released under GNU GPL v2+, read the file 'COPYING' for more information.
11 */
12
13#ifndef INKSCAPE_UI_TOOLS_BOOLEANS_TOOL_H
14#define INKSCAPE_UI_TOOLS_BOOLEANS_TOOL_H
15
16#include "ui/tools/tool-base.h"
17
18class SPDesktop;
19
20namespace Inkscape {
21class BooleanBuilder;
22struct ButtonPressEvent;
23struct ButtonReleaseEvent;
24struct MotionEvent;
25struct KeyPressEvent;
26
27namespace UI {
28namespace Tools {
29
31{
32public:
34 ~InteractiveBooleansTool() override;
35
36 void switching_away(std::string const &new_tool) override;
37
38 // Preferences set
39 void set(Preferences::Entry const &val) override;
40
41 // Catch empty selections
42 bool is_ready() const override;
43
44 // Event functions
45 bool root_handler(CanvasEvent const &event) override;
46
47 void shape_commit();
48 void shape_cancel();
49 void set_opacity(double opacity = 1.0);
50private:
51 void update_status();
52 void hide_selected_objects(bool hide = true);
53 bool should_add(unsigned state) const;
54
57 bool event_motion_handler(MotionEvent const &event);
58 bool event_key_press_handler(KeyPressEvent const &event);
59
60 std::unique_ptr<BooleanBuilder> boolean_builder;
61
62 sigc::scoped_connection _sel_modified;
63 sigc::scoped_connection _sel_changed;
64
65 bool to_commit = false;
66 std::optional<Geom::Point> last_cursor_position;
67};
68
69} // namespace Tools
70} // namespace UI
71} // namespace Inkscape
72
73#endif // INKSCAPE_UI_TOOLS_BOOLEANS_TOOL_H
Data type representing a typeless value of a preference.
bool event_motion_handler(MotionEvent const &event)
void set_opacity(double opacity=1.0)
Set the variable transparency of the rest of the canvas.
bool event_button_press_handler(ButtonPressEvent const &event)
bool should_add(unsigned state) const
Returns true if the shape builder should add items, false if shape builder should delete items.
bool event_key_press_handler(KeyPressEvent const &event)
void hide_selected_objects(bool hide=true)
Hide all selected items, because they are going to be re-drawn as a fractured pattern and we don't wa...
bool root_handler(CanvasEvent const &event) override
std::optional< Geom::Point > last_cursor_position
void switching_away(std::string const &new_tool) override
bool event_button_release_handler(ButtonReleaseEvent const &event)
std::unique_ptr< BooleanBuilder > boolean_builder
Base class for Event processors.
Definition tool-base.h:95
To do: update description of desktop.
Definition desktop.h:149
Helper class to stream background task notifications as a series of messages.
A mouse button (left/right/middle) is pressed.
A mouse button (left/right/middle) is released.
Abstract base class for events.
A key has been pressed.
Movement of the mouse pointer.
SPDesktop * desktop