summaryrefslogtreecommitdiffstats
path: root/src/ui/tool-factory.cpp
diff options
context:
space:
mode:
authorLiam P. White <inkscapebrony@gmail.com>2015-02-25 01:48:17 +0000
committerLiam P. White <inkscapebrony@gmail.com>2015-02-25 01:48:17 +0000
commit9b72cebb7ccb500cf447bf75b66fe77875d9945a (patch)
tree5110bf55e68dee4b60030f2008a7127ff347c065 /src/ui/tool-factory.cpp
parentTranslations. Hungarian translation update. (diff)
parentRestore libinkscape.a (diff)
downloadinkscape-9b72cebb7ccb500cf447bf75b66fe77875d9945a.tar.gz
inkscape-9b72cebb7ccb500cf447bf75b66fe77875d9945a.zip
Restore libinkscape.a .
I have a feeling this will be a controversial commit, and I feel the same way: I liked the way the SPObject factories were set up. However, they placed undue stress on the linker to extract every single symbol from every object file, and this isn't something that it easy for the linker: it continually thrashes my system with 8 GB of RAM for more and more memory, with my system often times running out. This is not the only solution, but for now, it's quite a good one, and the comment in Makefile.am remains true: libinkscape.a does speed up the build. In the future, I'd hope to see proper code modules and an incremental link, which should really help speed up the build. (bzr r13940)
Diffstat (limited to 'src/ui/tool-factory.cpp')
-rw-r--r--src/ui/tool-factory.cpp102
1 files changed, 102 insertions, 0 deletions
diff --git a/src/ui/tool-factory.cpp b/src/ui/tool-factory.cpp
new file mode 100644
index 000000000..700bd40ce
--- /dev/null
+++ b/src/ui/tool-factory.cpp
@@ -0,0 +1,102 @@
+/*
+ * Factory for ToolBase tree
+ *
+ * Authors:
+ * Markus Engel
+ *
+ * Copyright (C) 2013 Authors
+ * Released under GNU GPL, read the file 'COPYING' for more information
+ */
+
+#include "tool-factory.h"
+
+#include "ui/tools/arc-tool.h"
+#include "ui/tools/box3d-tool.h"
+#include "ui/tools/calligraphic-tool.h"
+#include "ui/tools/connector-tool.h"
+#include "ui/tools/dropper-tool.h"
+#include "ui/tools/eraser-tool.h"
+#include "ui/tools/flood-tool.h"
+#include "ui/tools/gradient-tool.h"
+#include "ui/tools/lpe-tool.h"
+#include "ui/tools/measure-tool.h"
+#include "ui/tools/mesh-tool.h"
+#include "ui/tools/node-tool.h"
+#include "ui/tools/pencil-tool.h"
+#include "ui/tools/pen-tool.h"
+#include "ui/tools/rect-tool.h"
+#include "ui/tools/select-tool.h"
+#include "ui/tools/spiral-tool.h"
+#include "ui/tools/spray-tool.h"
+#include "ui/tools/star-tool.h"
+#include "ui/tools/text-tool.h"
+#include "ui/tools/tool-base.h"
+#include "ui/tools/tweak-tool.h"
+#include "ui/tools/zoom-tool.h"
+
+using namespace Inkscape::UI::Tools;
+
+ToolBase *ToolFactory::createObject(std::string const& id)
+{
+ ToolBase *tool = NULL;
+
+ if (id == "/tools/shapes/arc")
+ tool = new ArcTool;
+ else if (id == "/tools/shapes/3dbox")
+ tool = new Box3dTool;
+ else if (id == "/tools/calligraphic")
+ tool = new CalligraphicTool;
+ else if (id == "/tools/connector")
+ tool = new ConnectorTool;
+ else if (id == "/tools/dropper")
+ tool = new DropperTool;
+ else if (id == "/tools/eraser")
+ tool = new EraserTool;
+ else if (id == "/tools/paintbucket")
+ tool = new FloodTool;
+ else if (id == "/tools/gradient")
+ tool = new GradientTool;
+ else if (id == "/tools/lpetool")
+ tool = new LpeTool;
+ else if (id == "/tools/measure")
+ tool = new MeasureTool;
+ else if (id == "/tools/mesh")
+ tool = new MeshTool;
+ else if (id == "/tools/nodes")
+ tool = new NodeTool;
+ else if (id == "/tools/freehand/pencil")
+ tool = new PencilTool;
+ else if (id == "/tools/freehand/pen")
+ tool = new PenTool;
+ else if (id == "/tools/shapes/rect")
+ tool = new RectTool;
+ else if (id == "/tools/select")
+ tool = new SelectTool;
+ else if (id == "/tools/shapes/spiral")
+ tool = new SpiralTool;
+ else if (id == "/tools/spray")
+ tool = new SprayTool;
+ else if (id == "/tools/shapes/star")
+ tool = new StarTool;
+ else if (id == "/tools/text")
+ tool = new TextTool;
+ else if (id == "/tools/tweak")
+ tool = new TweakTool;
+ else if (id == "/tools/zoom")
+ tool = new ZoomTool;
+ else
+ fprintf(stderr, "WARNING: unknown tool: %s", id.c_str());
+
+ return tool;
+}
+
+/*
+ Local Variables:
+ mode:c++
+ c-file-style:"stroustrup"
+ c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
+ indent-tabs-mode:nil
+ fill-column:99
+ End:
+*/
+// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 :