Inkscape
Vector Graphics Editor
Loading...
Searching...
No Matches
lpe-tool.h
Go to the documentation of this file.
1// SPDX-License-Identifier: GPL-2.0-or-later
5/* Authors:
6 * Maximilian Albert <maximilian.albert@gmail.com>
7 *
8 * Copyright (C) 1998 The Free Software Foundation
9 * Copyright (C) 1999-2002 authors
10 * Copyright (C) 2001-2002 Ximian, Inc.
11 * Copyright (C) 2008 Maximilian Albert
12 *
13 * Released under GNU GPL v2+, read the file 'COPYING' for more information.
14 */
15
16#ifndef INKSCAPE_UI_TOOLS_LPE_TOOL_H
17#define INKSCAPE_UI_TOOLS_LPE_TOOL_H
18
19#include "ui/tools/pen-tool.h"
20
21// This is the list of subtools from which the toolbar of the LPETool is built automatically.
22extern int const num_subtools;
23
29
30extern SubtoolEntry const lpesubtools[];
31
32class ShapeEditor;
33
34namespace Inkscape {
35class CanvasItemText;
36class CanvasItemRect;
37class Selection;
38} // namespace Inkscape
39
40namespace Inkscape::UI::Tools {
41
42class LpeTool : public PenTool
43{
44public:
46 ~LpeTool() override;
47
53 void show_measuring_info(bool show = true);
54
56
57protected:
58 void set(Preferences::Entry const &val) override;
59 bool root_handler(CanvasEvent const &event) override;
60 bool item_handler(SPItem *item, CanvasEvent const &event) override;
61
62private:
64
65 std::unique_ptr<ShapeEditor> shape_editor;
67
68 std::unordered_map<SPPath*, CanvasItemPtr<CanvasItemText>> measuring_items;
69
70 sigc::scoped_connection sel_changed_connection;
71};
72
76std::pair<Geom::Point, Geom::Point> lpetool_get_limiting_bbox_corners(SPDocument const *document);
77
78} // namespace Inkscape::UI::Tools
79
80inline auto SP_LPETOOL_CONTEXT(Inkscape::UI::Tools::ToolBase *tool) { return dynamic_cast<Inkscape::UI::Tools::LpeTool*>(tool); }
81
82#endif // INKSCAPE_UI_TOOLS_LPE_TOOL_H
83
84/*
85 Local Variables:
86 mode:c++
87 c-file-style:"stroustrup"
88 c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
89 indent-tabs-mode:nil
90 fill-column:99
91 End:
92*/
93// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 :
std::unique_ptr< T, CanvasItemUnlinkDeleter > CanvasItemPtr
Smart pointer used to hold CanvasItems, like std::unique_ptr.
Data type representing a typeless value of a preference.
The set of selected SPObjects for a given document and layer model.
Definition selection.h:80
bool item_handler(SPItem *item, CanvasEvent const &event) override
Handles item specific events.
Definition lpe-tool.cpp:102
void create_measuring_items(Selection *selection=nullptr)
Definition lpe-tool.cpp:286
CanvasItemPtr< CanvasItemRect > canvas_bbox
Definition lpe-tool.h:66
std::unordered_map< SPPath *, CanvasItemPtr< CanvasItemText > > measuring_items
Definition lpe-tool.h:68
LivePathEffect::EffectType mode
Definition lpe-tool.h:55
sigc::scoped_connection sel_changed_connection
Definition lpe-tool.h:70
bool root_handler(CanvasEvent const &event) override
Definition lpe-tool.cpp:127
void selection_changed(Selection *selection)
Callback that processes the "changed" signal on the selection; destroys old and creates new nodepath ...
Definition lpe-tool.cpp:88
void switch_mode(LivePathEffect::EffectType type)
Definition lpe-tool.cpp:216
std::unique_ptr< ShapeEditor > shape_editor
Definition lpe-tool.h:65
void show_measuring_info(bool show=true)
Definition lpe-tool.cpp:361
PenTool: a context for pen tool events.
Definition pen-tool.h:38
Base class for Event processors.
Definition tool-base.h:95
To do: update description of desktop.
Definition desktop.h:149
Typed SVG document implementation.
Definition document.h:101
Base class for visual SVG elements.
Definition sp-item.h:109
SPItem * item
int const num_subtools
Definition lpe-tool.cpp:39
auto SP_LPETOOL_CONTEXT(Inkscape::UI::Tools::ToolBase *tool)
Definition lpe-tool.h:80
SubtoolEntry const lpesubtools[]
Definition lpe-tool.cpp:41
std::pair< Geom::Point, Geom::Point > lpetool_get_limiting_bbox_corners(SPDocument const *document)
Definition lpe-tool.cpp:233
int lpetool_item_has_construction(SPItem *item)
Definition lpe-tool.cpp:184
bool lpetool_try_construction(SPDesktop *desktop, LivePathEffect::EffectType const type)
Definition lpe-tool.cpp:202
int lpetool_mode_to_index(LivePathEffect::EffectType const type)
Definition lpe-tool.cpp:170
Helper class to stream background task notifications as a series of messages.
PenTool: a context for pen tool events.
Abstract base class for events.
char const * icon_name
Definition lpe-tool.h:27
Inkscape::LivePathEffect::EffectType type
Definition lpe-tool.h:26
SPDesktop * desktop