Context for the "About" label
[inkscape.git] / src / ui / tool-factory.cpp
blobf4d959904f94a19211395a6fd41bf08d3e455dfb
1 // SPDX-License-Identifier: GPL-2.0-or-later
2 /*
3 * Factory for ToolBase tree
5 * Authors:
6 * Markus Engel
8 * Copyright (C) 2013 Authors
9 * Released under GNU GPL v2+, read the file 'COPYING' for more information.
12 #include "tool-factory.h"
14 #include "ui/tools/arc-tool.h"
15 #include "ui/tools/box3d-tool.h"
16 #include "ui/tools/calligraphic-tool.h"
17 #include "ui/tools/connector-tool.h"
18 #include "ui/tools/dropper-tool.h"
19 #include "ui/tools/eraser-tool.h"
20 #include "ui/tools/flood-tool.h"
21 #include "ui/tools/gradient-tool.h"
22 #include "ui/tools/lpe-tool.h"
23 #include "ui/tools/measure-tool.h"
24 #include "ui/tools/mesh-tool.h"
25 #include "ui/tools/node-tool.h"
26 #include "ui/tools/object-picker-tool.h"
27 #include "ui/tools/pages-tool.h"
28 #include "ui/tools/pencil-tool.h"
29 #include "ui/tools/rect-tool.h"
30 #include "ui/tools/marker-tool.h"
31 #include "ui/tools/select-tool.h"
32 #include "ui/tools/booleans-tool.h"
33 #include "ui/tools/spiral-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"
40 using namespace Inkscape::UI::Tools;
42 ToolBase *ToolFactory::createObject(SPDesktop *desktop, std::string const &id)
44 ToolBase *tool = nullptr;
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")
73 tool = new InteractiveBooleansTool(desktop);
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);
104 return tool;
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:
116 // vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 :