Inkscape
Vector Graphics Editor
Loading...
Searching...
No Matches
tool-factory.cpp
Go to the documentation of this file.
1// SPDX-License-Identifier: GPL-2.0-or-later
2/*
3 * Factory for ToolBase tree
4 *
5 * Authors:
6 * Markus Engel
7 *
8 * Copyright (C) 2013 Authors
9 * Released under GNU GPL v2+, read the file 'COPYING' for more information.
10 */
11
12#include "tool-factory.h"
13
14#include "ui/tools/arc-tool.h"
15#include "ui/tools/box3d-tool.h"
20#include "ui/tools/flood-tool.h"
22#include "ui/tools/lpe-tool.h"
24#include "ui/tools/mesh-tool.h"
25#include "ui/tools/node-tool.h"
27#include "ui/tools/pages-tool.h"
29#include "ui/tools/rect-tool.h"
34#include "ui/tools/spray-tool.h"
35#include "ui/tools/star-tool.h"
36#include "ui/tools/text-tool.h"
37#include "ui/tools/tweak-tool.h"
38#include "ui/tools/zoom-tool.h"
39
40using namespace Inkscape::UI::Tools;
41
43{
44 ToolBase *tool = nullptr;
45
46 if (id == "/tools/shapes/arc")
47 tool = new ArcTool(desktop);
48 else if (id == "/tools/shapes/3dbox")
49 tool = new Box3dTool(desktop);
50 else if (id == "/tools/calligraphic")
51 tool = new CalligraphicTool(desktop);
52 else if (id == "/tools/connector")
53 tool = new ConnectorTool(desktop);
54 else if (id == "/tools/dropper")
55 tool = new DropperTool(desktop);
56 else if (id == "/tools/eraser")
57 tool = new EraserTool(desktop);
58 else if (id == "/tools/paintbucket")
59 tool = new FloodTool(desktop);
60 else if (id == "/tools/gradient")
61 tool = new GradientTool(desktop);
62 else if (id == "/tools/lpetool")
63 tool = new LpeTool(desktop);
64 else if (id == "/tools/marker")
65 tool = new MarkerTool(desktop);
66 else if (id == "/tools/measure")
67 tool = new MeasureTool(desktop);
68 else if (id == "/tools/mesh")
69 tool = new MeshTool(desktop);
70 else if (id == "/tools/nodes")
71 tool = new NodeTool(desktop);
72 else if (id == "/tools/booleans")
74 else if (id == "/tools/pages")
75 tool = new PagesTool(desktop);
76 else if (id == "/tools/freehand/pencil")
77 tool = new PencilTool(desktop);
78 else if (id == "/tools/freehand/pen")
79 tool = new PenTool(desktop);
80 else if (id == "/tools/shapes/rect")
81 tool = new RectTool(desktop);
82 else if (id == "/tools/select")
83 tool = new SelectTool(desktop);
84 else if (id == "/tools/shapes/spiral")
85 tool = new SpiralTool(desktop);
86 else if (id == "/tools/spray")
87 tool = new SprayTool(desktop);
88 else if (id == "/tools/shapes/star")
89 tool = new StarTool(desktop);
90 else if (id == "/tools/text")
91 tool = new TextTool(desktop);
92 else if (id == "/tools/tweak")
93 tool = new TweakTool(desktop);
94 else if (id == "/tools/zoom")
95 tool = new ZoomTool(desktop);
96 else if (id == "/tools/picker")
97 tool = new ObjectPickerTool(desktop);
98 else {
99 fprintf(stderr, "WARNING: unknown tool: %s", id.c_str());
100 // Backup tool prevents crashes in signals that expect a tool to exist.
101 tool = new SelectTool(desktop);
102 }
103
104 return tool;
105}
106
107/*
108 Local Variables:
109 mode:c++
110 c-file-style:"stroustrup"
111 c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
112 indent-tabs-mode:nil
113 fill-column:99
114 End:
115*/
116// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 :
A tool for building shapes.
PenTool: a context for pen tool events.
Definition pen-tool.h:38
PencilTool: a context for pencil tool events.
Definition pencil-tool.h:42
Base class for Event processors.
Definition tool-base.h:95
To do: update description of desktop.
Definition desktop.h:149
Gradient drawing and editing tool.
LPETool: a generic tool composed of subtools that are given by LPEs.
Marker edit mode - onCanvas marker editing of marker orientation, position, scale.
New node tool with support for multiple path editing.
PencilTool: a context for pencil tool events.
Spiral drawing context.
static Inkscape::UI::Tools::ToolBase * createObject(SPDesktop *desktop, std::string const &id)
SPDesktop * desktop
TextTool.