summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMarc Jeanmougin <marc@jeanmougin.fr>2015-04-26 09:44:42 +0000
committerMarc Jeanmougin <mc@M0nst3r.bouyguesbox.fr>2015-04-26 09:44:42 +0000
commit1c6d7546699e45643c2ab8e1d41d7b6f4fc52365 (patch)
treea56b6da9bb0f660d5986919ac8d75dc04113cd69 /src
parentmore cast cleanup (diff)
parentRename libgc/ => inkgc/ to reflect difference from Boehm GC (diff)
downloadinkscape-1c6d7546699e45643c2ab8e1d41d7b6f4fc52365.tar.gz
inkscape-1c6d7546699e45643c2ab8e1d41d7b6f4fc52365.zip
merge
(bzr r13922.1.12)
Diffstat (limited to 'src')
-rw-r--r--src/CMakeLists.txt3
-rw-r--r--src/Makefile.am10
-rw-r--r--src/Makefile_insert13
-rw-r--r--src/box3d-side.cpp10
-rw-r--r--src/box3d.cpp10
-rw-r--r--src/color-profile.cpp11
-rw-r--r--src/composite-undo-stack-observer.h2
-rw-r--r--src/debug/demangle.cpp2
-rw-r--r--src/debug/gc-heap.h2
-rw-r--r--src/debug/heap.cpp2
-rw-r--r--src/debug/logger.cpp2
-rw-r--r--src/debug/simple-event.h2
-rw-r--r--src/desktop.cpp2
-rw-r--r--src/display/CMakeLists.txt1
-rw-r--r--src/display/Makefile_insert1
-rw-r--r--src/display/canvas-axonomgrid.cpp2
-rw-r--r--src/display/canvas-grid.cpp4
-rw-r--r--src/display/nr-filter-utils.cpp21
-rw-r--r--src/display/nr-filter.h2
-rw-r--r--src/document-subset.h2
-rw-r--r--src/document.cpp2
-rw-r--r--src/document.h2
-rw-r--r--src/doxygen-main.dox (renamed from src/doxygen-main.cpp)0
-rw-r--r--src/extension/internal/emf-inout.cpp4
-rw-r--r--src/extension/internal/emf-print.cpp4
-rw-r--r--src/extension/internal/text_reassemble.c20
-rw-r--r--src/extension/internal/wmf-inout.cpp4
-rw-r--r--src/factory.h123
-rw-r--r--src/filters/blend.cpp14
-rw-r--r--src/filters/colormatrix.cpp14
-rw-r--r--src/filters/componenttransfer-funcnode.cpp30
-rw-r--r--src/filters/componenttransfer.cpp14
-rw-r--r--src/filters/composite.cpp14
-rw-r--r--src/filters/convolvematrix.cpp14
-rw-r--r--src/filters/diffuselighting.cpp14
-rw-r--r--src/filters/displacementmap.cpp14
-rw-r--r--src/filters/distantlight.cpp15
-rw-r--r--src/filters/flood.cpp14
-rw-r--r--src/filters/gaussian-blur.cpp13
-rw-r--r--src/filters/image.cpp14
-rw-r--r--src/filters/merge.cpp14
-rw-r--r--src/filters/mergenode.cpp14
-rw-r--r--src/filters/morphology.cpp14
-rw-r--r--src/filters/offset.cpp14
-rw-r--r--src/filters/pointlight.cpp14
-rw-r--r--src/filters/specularlighting.cpp14
-rw-r--r--src/filters/spotlight.cpp14
-rw-r--r--src/filters/tile.cpp14
-rw-r--r--src/filters/turbulence.cpp14
-rw-r--r--src/gc-allocator.h0
-rw-r--r--src/gc-anchored.h2
-rw-r--r--src/gc-finalized.h2
-rw-r--r--src/helper/CMakeLists.txt1
-rw-r--r--src/helper/Makefile_insert1
-rw-r--r--src/helper/mathfns.h (renamed from src/util/mathfns.h)3
-rw-r--r--src/inkgc/CMakeLists.txt15
-rw-r--r--src/inkgc/Makefile_insert13
-rw-r--r--src/inkgc/gc-alloc.h (renamed from src/gc-alloc.h)2
-rw-r--r--src/inkgc/gc-core.h (renamed from src/gc-core.h)0
-rw-r--r--src/inkgc/gc-managed.h (renamed from src/gc-managed.h)2
-rw-r--r--src/inkgc/gc-soft-ptr.h (renamed from src/gc-soft-ptr.h)2
-rw-r--r--src/inkgc/gc.cpp (renamed from src/gc.cpp)2
-rw-r--r--src/inkview.cpp2
-rw-r--r--src/layer-manager.cpp2
-rw-r--r--src/layer-manager.h2
-rw-r--r--src/live_effects/lpeobject.cpp10
-rw-r--r--src/main.cpp2
-rw-r--r--src/message-stack.h2
-rw-r--r--src/persp3d.cpp10
-rw-r--r--src/selection.h4
-rw-r--r--src/snap.cpp2
-rw-r--r--src/sp-anchor.cpp14
-rw-r--r--src/sp-clippath.cpp10
-rw-r--r--src/sp-defs.cpp10
-rw-r--r--src/sp-desc.cpp14
-rw-r--r--src/sp-ellipse.cpp29
-rw-r--r--src/sp-factory.cpp337
-rw-r--r--src/sp-factory.h20
-rw-r--r--src/sp-filter.cpp9
-rw-r--r--src/sp-flowdiv.cpp34
-rw-r--r--src/sp-flowregion.cpp14
-rw-r--r--src/sp-flowtext.cpp10
-rw-r--r--src/sp-font-face.cpp10
-rw-r--r--src/sp-font.cpp9
-rw-r--r--src/sp-glyph.cpp9
-rw-r--r--src/sp-guide.cpp10
-rw-r--r--src/sp-hatch-path.cpp17
-rw-r--r--src/sp-hatch.cpp16
-rw-r--r--src/sp-image.cpp9
-rw-r--r--src/sp-item-group.cpp10
-rw-r--r--src/sp-line.cpp13
-rw-r--r--src/sp-linear-gradient.cpp11
-rw-r--r--src/sp-marker.cpp10
-rw-r--r--src/sp-mask.cpp10
-rw-r--r--src/sp-mesh-gradient.cpp11
-rw-r--r--src/sp-mesh-patch.cpp10
-rw-r--r--src/sp-mesh-row.cpp10
-rw-r--r--src/sp-metadata.cpp10
-rw-r--r--src/sp-missing-glyph.cpp10
-rw-r--r--src/sp-namedview.cpp10
-rw-r--r--src/sp-object.cpp12
-rw-r--r--src/sp-offset.cpp10
-rw-r--r--src/sp-path.cpp10
-rw-r--r--src/sp-pattern.cpp10
-rw-r--r--src/sp-polygon.cpp12
-rw-r--r--src/sp-polyline.cpp10
-rw-r--r--src/sp-radial-gradient.cpp12
-rw-r--r--src/sp-rect.cpp10
-rw-r--r--src/sp-root.cpp15
-rw-r--r--src/sp-script.cpp10
-rw-r--r--src/sp-shape.cpp2
-rw-r--r--src/sp-solid-color.cpp9
-rw-r--r--src/sp-spiral.cpp10
-rw-r--r--src/sp-star.cpp10
-rw-r--r--src/sp-stop.cpp10
-rw-r--r--src/sp-string.cpp17
-rw-r--r--src/sp-style-elem.cpp10
-rw-r--r--src/sp-switch.cpp14
-rw-r--r--src/sp-symbol.cpp10
-rw-r--r--src/sp-tag-use-reference.cpp10
-rw-r--r--src/sp-tag-use.cpp13
-rw-r--r--src/sp-tag.cpp12
-rw-r--r--src/sp-text.cpp14
-rw-r--r--src/sp-title.cpp14
-rw-r--r--src/sp-tref.cpp14
-rw-r--r--src/sp-tspan.cpp15
-rw-r--r--src/sp-use.cpp14
-rw-r--r--src/ui/CMakeLists.txt1
-rw-r--r--src/ui/Makefile_insert1
-rw-r--r--src/ui/clipboard.cpp2
-rw-r--r--src/ui/dialog/filedialog.cpp2
-rw-r--r--src/ui/dialog/filedialogimpl-win32.h2
-rw-r--r--src/ui/dialog/memory.cpp2
-rw-r--r--src/ui/dialog/ocaldialogs.cpp2
-rw-r--r--src/ui/tool-factory.cpp102
-rw-r--r--src/ui/tool-factory.h10
-rw-r--r--src/ui/tools/arc-tool.cpp10
-rw-r--r--src/ui/tools/box3d-tool.cpp10
-rw-r--r--src/ui/tools/calligraphic-tool.cpp10
-rw-r--r--src/ui/tools/connector-tool.cpp10
-rw-r--r--src/ui/tools/dropper-tool.cpp10
-rw-r--r--src/ui/tools/eraser-tool.cpp10
-rw-r--r--src/ui/tools/flood-tool.cpp10
-rw-r--r--src/ui/tools/gradient-tool.cpp10
-rw-r--r--src/ui/tools/lpe-tool.cpp11
-rw-r--r--src/ui/tools/measure-tool.cpp10
-rw-r--r--src/ui/tools/mesh-tool.cpp10
-rw-r--r--src/ui/tools/node-tool.cpp10
-rw-r--r--src/ui/tools/pen-tool.cpp9
-rw-r--r--src/ui/tools/pencil-tool.cpp9
-rw-r--r--src/ui/tools/rect-tool.cpp10
-rw-r--r--src/ui/tools/select-tool.cpp9
-rw-r--r--src/ui/tools/spiral-tool.cpp10
-rw-r--r--src/ui/tools/spray-tool.cpp10
-rw-r--r--src/ui/tools/star-tool.cpp10
-rw-r--r--src/ui/tools/text-tool.cpp9
-rw-r--r--src/ui/tools/tweak-tool.cpp10
-rw-r--r--src/ui/tools/zoom-tool.cpp9
-rw-r--r--src/ui/view/view.h2
-rw-r--r--src/undo-stack-observer.h2
-rw-r--r--src/util/CMakeLists.txt5
-rw-r--r--src/util/Makefile_insert12
-rw-r--r--src/util/list.h2
-rw-r--r--src/util/share.h2
-rw-r--r--src/widgets/rect-toolbar.cpp2
-rw-r--r--src/widgets/ruler.cpp42
-rw-r--r--src/xml/attribute-record.h2
-rw-r--r--src/xml/composite-node-observer.h2
-rw-r--r--src/xml/event.h2
-rw-r--r--src/xml/log-builder.h2
-rw-r--r--src/xml/subtree.h2
171 files changed, 616 insertions, 1462 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 617e9dce1..0b1e3931b 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -19,6 +19,7 @@ set(sp_SRC
sp-defs.cpp
sp-desc.cpp
sp-ellipse.cpp
+ sp-factory.cpp
sp-filter-primitive.cpp
sp-filter-reference.cpp
sp-filter.cpp
@@ -194,7 +195,6 @@ set(inkscape_SRC
document-subset.cpp
document-undo.cpp
document.cpp
- doxygen-main.cpp
ege-color-prof-tracker.cpp
event-log.cpp
extract-uri.cpp
@@ -491,6 +491,7 @@ add_subdirectory(2geom)
add_subdirectory(libavoid)
add_subdirectory(libcola)
add_subdirectory(libcroco)
+add_subdirectory(inkgc)
add_subdirectory(libgdl)
add_subdirectory(libuemf)
add_subdirectory(libvpsc)
diff --git a/src/Makefile.am b/src/Makefile.am
index 8fb7e23ef..cfbbd4015 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -23,15 +23,18 @@ endif
noinst_LIBRARIES = \
+ libinkscape.a \
libcroco/libcroco.a \
libavoid/libavoid.a \
$(internal_GDL) \
libuemf/libuemf.a \
libcola/libcola.a \
+ inkgc/libinkgc.a \
libvpsc/libvpsc.a \
livarot/libvarot.a \
2geom/lib2geom.a \
libdepixelize/libdepixelize.a \
+ util/libutil.a \
libinkversion.a
all_libs = \
@@ -114,6 +117,7 @@ include filters/Makefile_insert
include helper/Makefile_insert
include io/Makefile_insert
include libcroco/Makefile_insert
+include inkgc/Makefile_insert
include libgdl/Makefile_insert
include libnrtype/Makefile_insert
include libavoid/Makefile_insert
@@ -194,13 +198,13 @@ DISTCLEANFILES = \
# ################################################
# this should speed up the build
-#libinkscape_a_SOURCES = $(ink_common_sources)
+libinkscape_a_SOURCES = $(ink_common_sources)
-inkscape_SOURCES += main.cpp $(ink_common_sources) $(win32_sources)
+inkscape_SOURCES += main.cpp $(win32_sources)
inkscape_LDADD = $(all_libs)
inkscape_LDFLAGS = $(kdeldflags) $(mwindows)
-inkview_SOURCES += inkview.cpp $(ink_common_sources) $(win32_sources)
+inkview_SOURCES += inkview.cpp $(win32_sources)
inkview_LDADD = $(all_libs)
inkview_LDFLAGS = $(mwindows)
diff --git a/src/Makefile_insert b/src/Makefile_insert
index b07541109..2bd457529 100644
--- a/src/Makefile_insert
+++ b/src/Makefile_insert
@@ -35,23 +35,16 @@ ink_common_sources += \
document.cpp document.h document-private.h \
document-subset.cpp document-subset.h \
document-undo.cpp document-undo.h \
- doxygen-main.cpp \
ege-color-prof-tracker.cpp ege-color-prof-tracker.h \
enums.h \
event-log.cpp event-log.h event.h \
extract-uri.cpp extract-uri.h \
- factory.h \
file.cpp file.h \
fill-or-stroke.h \
filter-chemistry.cpp filter-chemistry.h \
filter-enums.cpp filter-enums.h \
- gc-alloc.h \
- gc-anchored.h gc-anchored.cpp \
- gc-core.h \
- gc.cpp \
- gc-finalized.h gc-finalized.cpp \
- gc-managed.h \
- gc-soft-ptr.h \
+ gc-anchored.cpp gc-anchored.h \
+ gc-finalized.cpp gc-finalized.h \
gradient-chemistry.cpp gradient-chemistry.h \
gradient-drag.cpp gradient-drag.h \
graphlayout.cpp graphlayout.h \
@@ -124,7 +117,7 @@ ink_common_sources += \
sp-defs.cpp sp-defs.h \
sp-desc.cpp sp-desc.h \
sp-ellipse.cpp sp-ellipse.h \
- sp-factory.h \
+ sp-factory.h sp-factory.cpp \
sp-filter.cpp sp-filter.h number-opt-number.h \
sp-filter-primitive.cpp sp-filter-primitive.h \
sp-filter-reference.cpp sp-filter-reference.h \
diff --git a/src/box3d-side.cpp b/src/box3d-side.cpp
index 3058eab2d..93d55232e 100644
--- a/src/box3d-side.cpp
+++ b/src/box3d-side.cpp
@@ -28,16 +28,6 @@
static void box3d_side_compute_corner_ids(Box3DSide *side, unsigned int corners[4]);
-#include "sp-factory.h"
-
-namespace {
- SPObject* createBox3DSide() {
- return new Box3DSide();
- }
-
- bool box3DSideRegistered = SPFactory::instance().registerObject("inkscape:box3dside", createBox3DSide);
-}
-
Box3DSide::Box3DSide() : SPPolygon() {
this->dir1 = Box3D::NONE;
this->dir2 = Box3D::NONE;
diff --git a/src/box3d.cpp b/src/box3d.cpp
index 86f99049b..dc04a2eb6 100644
--- a/src/box3d.cpp
+++ b/src/box3d.cpp
@@ -44,16 +44,6 @@ static void box3d_ref_changed(SPObject *old_ref, SPObject *ref, SPBox3D *box);
static gint counter = 0;
-#include "sp-factory.h"
-
-namespace {
- SPObject* createBox3D() {
- return new SPBox3D();
- }
-
- bool box3DRegistered = SPFactory::instance().registerObject("inkscape:box3d", createBox3D);
-}
-
SPBox3D::SPBox3D() : SPGroup() {
this->my_counter = 0;
this->swapped = Box3D::NONE;
diff --git a/src/color-profile.cpp b/src/color-profile.cpp
index 28550b75d..85a6fa876 100644
--- a/src/color-profile.cpp
+++ b/src/color-profile.cpp
@@ -185,17 +185,6 @@ cmsHPROFILE ColorProfileImpl::getNULLProfile() {
#endif // defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2)
-
-#include "sp-factory.h"
-
-namespace {
- SPObject* createColorProfile() {
- return new Inkscape::ColorProfile();
- }
-
- bool rectRegistered = SPFactory::instance().registerObject("svg:color-profile", createColorProfile);
-}
-
ColorProfile::ColorProfile() : SPObject() {
this->impl = new ColorProfileImpl();
diff --git a/src/composite-undo-stack-observer.h b/src/composite-undo-stack-observer.h
index c93a2338b..33afda48d 100644
--- a/src/composite-undo-stack-observer.h
+++ b/src/composite-undo-stack-observer.h
@@ -10,7 +10,7 @@
#ifndef SEEN_COMPOSITE_UNDO_COMMIT_OBSERVER_H
#define SEEN_COMPOSITE_UNDO_COMMIT_OBSERVER_H
-#include "gc-alloc.h"
+#include "inkgc/gc-alloc.h"
#include "undo-stack-observer.h"
#include <list>
diff --git a/src/debug/demangle.cpp b/src/debug/demangle.cpp
index 2b00fb8e9..1d94f0eb9 100644
--- a/src/debug/demangle.cpp
+++ b/src/debug/demangle.cpp
@@ -14,7 +14,7 @@
#include <map>
#include "debug/demangle.h"
#include "util/format.h"
-#include "gc-alloc.h"
+#include "inkgc/gc-alloc.h"
namespace Inkscape {
diff --git a/src/debug/gc-heap.h b/src/debug/gc-heap.h
index 957f2067a..d120ddba9 100644
--- a/src/debug/gc-heap.h
+++ b/src/debug/gc-heap.h
@@ -12,7 +12,7 @@
#ifndef SEEN_INKSCAPE_DEBUG_GC_HEAP_H
#define SEEN_INKSCAPE_DEBUG_GC_HEAP_H
-#include "gc-core.h"
+#include "inkgc/gc-core.h"
#include "debug/heap.h"
namespace Inkscape {
diff --git a/src/debug/heap.cpp b/src/debug/heap.cpp
index 8e7a920ba..0135a9ceb 100644
--- a/src/debug/heap.cpp
+++ b/src/debug/heap.cpp
@@ -13,7 +13,7 @@
# include "config.h"
#endif
-#include "gc-alloc.h"
+#include "inkgc/gc-alloc.h"
#include "debug/gc-heap.h"
#include "debug/sysv-heap.h"
#include <vector>
diff --git a/src/debug/logger.cpp b/src/debug/logger.cpp
index 485dbc365..2eb81a0ba 100644
--- a/src/debug/logger.cpp
+++ b/src/debug/logger.cpp
@@ -15,7 +15,7 @@
#include "inkscape-version.h"
#include "debug/logger.h"
#include "debug/simple-event.h"
-#include "gc-alloc.h"
+#include "inkgc/gc-alloc.h"
namespace Inkscape {
diff --git a/src/debug/simple-event.h b/src/debug/simple-event.h
index 506ee1b03..03ce5d326 100644
--- a/src/debug/simple-event.h
+++ b/src/debug/simple-event.h
@@ -16,7 +16,7 @@
#include <vector>
#include <glib.h> // g_assert()
-#include "gc-alloc.h"
+#include "inkgc/gc-alloc.h"
#include "debug/event.h"
namespace Inkscape {
diff --git a/src/desktop.cpp b/src/desktop.cpp
index 0cf0a3872..5a1558b0f 100644
--- a/src/desktop.cpp
+++ b/src/desktop.cpp
@@ -687,7 +687,7 @@ void SPDesktop::set_event_context2(const std::string& toolName)
}
}
- Inkscape::UI::Tools::ToolBase* new_tool = ToolFactory::instance().createObject(toolName);
+ Inkscape::UI::Tools::ToolBase* new_tool = ToolFactory::createObject(toolName);
new_tool->desktop = this;
new_tool->message_context = new Inkscape::MessageContext(this->messageStack());
event_context = new_tool;
diff --git a/src/display/CMakeLists.txt b/src/display/CMakeLists.txt
index 800c4d0d4..d4f8c16ff 100644
--- a/src/display/CMakeLists.txt
+++ b/src/display/CMakeLists.txt
@@ -42,7 +42,6 @@ set(display_SRC
nr-filter-tile.cpp
nr-filter-turbulence.cpp
nr-filter-units.cpp
- nr-filter-utils.cpp
nr-filter.cpp
nr-light.cpp
nr-style.cpp
diff --git a/src/display/Makefile_insert b/src/display/Makefile_insert
index 2355c3653..20e498981 100644
--- a/src/display/Makefile_insert
+++ b/src/display/Makefile_insert
@@ -90,7 +90,6 @@ ink_common_sources += \
display/nr-filter-types.h \
display/nr-filter-units.cpp \
display/nr-filter-units.h \
- display/nr-filter-utils.cpp \
display/nr-filter-utils.h \
display/nr-light.cpp \
display/nr-light.h \
diff --git a/src/display/canvas-axonomgrid.cpp b/src/display/canvas-axonomgrid.cpp
index 88c23bf62..a2df86823 100644
--- a/src/display/canvas-axonomgrid.cpp
+++ b/src/display/canvas-axonomgrid.cpp
@@ -50,7 +50,7 @@
#include "svg/svg-color.h"
#include "2geom/line.h"
#include "2geom/angle.h"
-#include "util/mathfns.h"
+#include "helper/mathfns.h"
#include "round.h"
#include "util/units.h"
diff --git a/src/display/canvas-grid.cpp b/src/display/canvas-grid.cpp
index 0f58096ce..9b9f64529 100644
--- a/src/display/canvas-grid.cpp
+++ b/src/display/canvas-grid.cpp
@@ -35,7 +35,7 @@
#include "ui/widget/registered-widget.h"
#include "desktop.h"
#include "sp-canvas-util.h"
-#include "util/mathfns.h"
+#include "helper/mathfns.h"
#include "display/cairo-utils.h"
#include "display/canvas-axonomgrid.h"
@@ -50,7 +50,7 @@
#include "sp-root.h"
#include "svg/svg-color.h"
#include "svg/stringstream.h"
-#include "util/mathfns.h"
+#include "helper/mathfns.h"
#include "xml/node-event-vector.h"
#include "verbs.h"
#include "display/sp-canvas.h"
diff --git a/src/display/nr-filter-utils.cpp b/src/display/nr-filter-utils.cpp
deleted file mode 100644
index 1ba341791..000000000
--- a/src/display/nr-filter-utils.cpp
+++ /dev/null
@@ -1,21 +0,0 @@
-#include "nr-filter-utils.h"
-
-namespace Inkscape {
-namespace Filters {
-
-/* Everything moved to .h, because they were short functions that should
- * get inlined */
-
-} /* namespace Filters */
-} /* namespace Inkscape */
-
-/*
- 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 :
diff --git a/src/display/nr-filter.h b/src/display/nr-filter.h
index 9a30efabd..211d8ddd9 100644
--- a/src/display/nr-filter.h
+++ b/src/display/nr-filter.h
@@ -18,7 +18,7 @@
#include "display/nr-filter-types.h"
#include "svg/svg-length.h"
#include "sp-filter-units.h"
-#include "gc-managed.h"
+#include "inkgc/gc-managed.h"
namespace Inkscape {
class DrawingContext;
diff --git a/src/document-subset.h b/src/document-subset.h
index 298b7872d..2799ff173 100644
--- a/src/document-subset.h
+++ b/src/document-subset.h
@@ -14,7 +14,7 @@
#include <sigc++/connection.h>
#include <sigc++/functors/slot.h>
-#include "gc-managed.h"
+#include "inkgc/gc-managed.h"
#include "gc-anchored.h"
class SPObject;
diff --git a/src/document.cpp b/src/document.cpp
index 0582f1a70..2c301f5f8 100644
--- a/src/document.cpp
+++ b/src/document.cpp
@@ -368,7 +368,7 @@ SPDocument *SPDocument::createDoc(Inkscape::XML::Document *rdoc,
// Create SPRoot element
const std::string typeString = NodeTraits::get_type_string(*rroot);
- SPObject* rootObj = SPFactory::instance().createObject(typeString);
+ SPObject* rootObj = SPFactory::createObject(typeString);
document->root = dynamic_cast<SPRoot*>(rootObj);
if (document->root == 0) {
diff --git a/src/document.h b/src/document.h
index bc5b2745a..cf958f03e 100644
--- a/src/document.h
+++ b/src/document.h
@@ -21,7 +21,7 @@
#include <sigc++/sigc++.h>
#include "libcroco/cr-cascade.h"
#include <2geom/forward.h>
-#include "gc-managed.h"
+#include "inkgc/gc-managed.h"
#include "gc-finalized.h"
#include "gc-anchored.h"
#include <glibmm/ustring.h>
diff --git a/src/doxygen-main.cpp b/src/doxygen-main.dox
index 6a5723bfd..6a5723bfd 100644
--- a/src/doxygen-main.cpp
+++ b/src/doxygen-main.dox
diff --git a/src/extension/internal/emf-inout.cpp b/src/extension/internal/emf-inout.cpp
index 71b6b82f7..31e69706f 100644
--- a/src/extension/internal/emf-inout.cpp
+++ b/src/extension/internal/emf-inout.cpp
@@ -188,7 +188,7 @@ double Emf::current_scale(PEMF_CALLBACK_DATA d){
"matrix(a,b,c,d,e,f)" (WITH the double quotes)
*/
std::string Emf::current_matrix(PEMF_CALLBACK_DATA d, double x, double y, int useoffset){
- std::stringstream cxform;
+ SVGOStringStream cxform;
double scale = current_scale(d);
cxform << "\"matrix(";
cxform << d->dc[d->level].worldTransform.eM11/scale; cxform << ",";
@@ -1058,7 +1058,7 @@ Emf::snap_to_faraway_pair(double *x, double *y)
Since exclude clip can go through here, it calls snap_to_faraway_pair for numerical stability.
*/
std::string Emf::pix_to_xy(PEMF_CALLBACK_DATA d, double x, double y){
- std::stringstream cxform;
+ SVGOStringStream cxform;
double tx = pix_to_x_point(d,x,y);
double ty = pix_to_y_point(d,x,y);
snap_to_faraway_pair(&tx,&ty);
diff --git a/src/extension/internal/emf-print.cpp b/src/extension/internal/emf-print.cpp
index b22dbc0e3..67a9242bc 100644
--- a/src/extension/internal/emf-print.cpp
+++ b/src/extension/internal/emf-print.cpp
@@ -251,7 +251,11 @@ unsigned int PrintEmf::begin(Inkscape::Extension::Print *mod, SPDocument *doc)
g_error("Fatal programming error in PrintEmf::begin at textcomment_set 1");
}
+ char *oldlocale = g_strdup(setlocale(LC_NUMERIC, NULL));
+ setlocale(LC_NUMERIC, "C");
snprintf(buff, sizeof(buff) - 1, "Drawing=%.1lfx%.1lfpx, %.1lfx%.1lfmm", _width, _height, Inkscape::Util::Quantity::convert(dwInchesX, "in", "mm"), Inkscape::Util::Quantity::convert(dwInchesY, "in", "mm"));
+ setlocale(LC_NUMERIC, oldlocale);
+ g_free(oldlocale);
rec = textcomment_set(buff);
if (!rec || emf_append((PU_ENHMETARECORD)rec, et, U_REC_FREE)) {
g_error("Fatal programming error in PrintEmf::begin at textcomment_set 1");
diff --git a/src/extension/internal/text_reassemble.c b/src/extension/internal/text_reassemble.c
index 4dfc49420..d3aafef12 100644
--- a/src/extension/internal/text_reassemble.c
+++ b/src/extension/internal/text_reassemble.c
@@ -67,11 +67,11 @@ Optional compiler switches for development:
File: text_reassemble.c
-Version: 0.0.15
-Date: 24-JUL-2014
+Version: 0.0.16
+Date: 25-FEB-2015
Author: David Mathog, Biology Division, Caltech
email: mathog@caltech.edu
-Copyright: 2014 David Mathog and California Institute of Technology (Caltech)
+Copyright: 2015 David Mathog and California Institute of Technology (Caltech)
*/
#ifdef __cplusplus
@@ -80,6 +80,7 @@ extern "C" {
#include "text_reassemble.h"
#include <libuemf/uemf_utf.h> /* For a couple of text functions. Exact copy from libUEMF. */
+#include <locale.h>
#include <float.h>
/* Code generated by make_ucd_mn_table.c using:
@@ -1936,6 +1937,15 @@ void TR_layout_2_svg(TR_INFO *tri){
double newx,newy,tmpx;
uint32_t utmp;
+ /* copy the current numeric locale, make a copy because setlocale may stomp on
+ the memory it points to. Then change it because SVG needs decimal points,
+ not commas, in floats. Restore on exit from this routine.
+ */
+ char *prev_locale = setlocale(LC_NUMERIC,NULL);
+ char *hold_locale = malloc(sizeof(char) * (strlen(prev_locale) + 1));
+ strcpy(hold_locale,prev_locale);
+ (void) setlocale(LC_NUMERIC,"POSIX");
+
/*
#define DBG_TR_PARA 0
#define DBG_TR_INPUT 1
@@ -2232,6 +2242,10 @@ void TR_layout_2_svg(TR_INFO *tri){
} /* end of j loop */
TRPRINT(tri,"</tspan></text>\n");
} /* end of i loop */
+
+ /* restore locale and free memory. */
+ (void) setlocale(LC_NUMERIC,hold_locale);
+ free(hold_locale);
}
/**
diff --git a/src/extension/internal/wmf-inout.cpp b/src/extension/internal/wmf-inout.cpp
index 8eb03131c..503a93418 100644
--- a/src/extension/internal/wmf-inout.cpp
+++ b/src/extension/internal/wmf-inout.cpp
@@ -176,7 +176,7 @@ double Wmf::current_scale(PWMF_CALLBACK_DATA /*d*/){
/* WMF has no worldTransform, so this always returns an Identity rotation matrix, but the offsets may have values.*/
std::string Wmf::current_matrix(PWMF_CALLBACK_DATA d, double x, double y, int useoffset){
- std::stringstream cxform;
+ SVGOStringStream cxform;
double scale = current_scale(d);
cxform << "\"matrix(";
cxform << 1.0/scale; cxform << ",";
@@ -948,7 +948,7 @@ Wmf::pix_to_abs_size(PWMF_CALLBACK_DATA d, double px)
/* returns "x,y" (without the quotes) in inkscape coordinates for a pair of WMF x,y coordinates
*/
std::string Wmf::pix_to_xy(PWMF_CALLBACK_DATA d, double x, double y){
- std::stringstream cxform;
+ SVGOStringStream cxform;
cxform << pix_to_x_point(d,x,y);
cxform << ",";
cxform << pix_to_y_point(d,x,y);
diff --git a/src/factory.h b/src/factory.h
deleted file mode 100644
index c1288b460..000000000
--- a/src/factory.h
+++ /dev/null
@@ -1,123 +0,0 @@
-/** @file
- * Generic Factory
- *//*
- * Authors:
- * Markus Engel
- *
- * Copyright (C) 2013 Authors
- * Released under GNU GPL, read the file 'COPYING' for more information
- */
-
-#ifndef FACTORY_H_SEEN
-#define FACTORY_H_SEEN
-
-#include <exception>
-#include <map>
-#include <string>
-#include "xml/node.h"
-
-/**
- * A simple singleton implementation.
- */
-template <class T>
-struct Singleton {
- static T &instance() {
- static T inst;
- return inst;
- }
-};
-
-namespace FactoryExceptions {
-class TypeNotRegistered : public std::exception {
-public:
- TypeNotRegistered(std::string const &type)
- : std::exception()
- , _type_string(type) {
- }
-
- virtual ~TypeNotRegistered() throw() {
- }
-
- char const *what() const throw() {
- return _type_string.c_str();
- }
-
-private:
- std::string const _type_string;
-};
-} // namespace FactoryExceptions
-
-/**
- * A Factory for creating objects which can be identified by strings.
- */
-template <class BaseObject>
-class Factory {
-public:
- typedef BaseObject *CreateFunction();
-
- bool registerObject(std::string const &id, CreateFunction *creator) {
- return this->_object_map.insert(std::make_pair(id, creator)).second;
- }
-
- BaseObject *createObject(std::string const &id) const {
- typename std::map<std::string const, CreateFunction *>::const_iterator it = this->_object_map.find(id);
-
- if (it == this->_object_map.end()) {
- //throw FactoryExceptions::TypeNotRegistered(id);
- if (!(id.empty() // comments, usually
- || id == "rdf:RDF" // no SP node yet
- || id == "inkscape:clipboard" // SP node not necessary
- || id == "inkscape:_templateinfo")) {
- g_warning("unknown type: %s", id.c_str());
- }
- return NULL;
- }
-
- return it->second();
- }
-
-private:
- std::map<std::string const, CreateFunction *> _object_map;
-};
-
-
-struct NodeTraits {
- static std::string get_type_string(Inkscape::XML::Node const &node) {
- std::string name;
-
- switch (node.type()) {
- case Inkscape::XML::TEXT_NODE:
- name = "string";
- break;
-
- case Inkscape::XML::ELEMENT_NODE: {
- char const *const sptype = node.attribute("sodipodi:type");
-
- if (sptype) {
- name = sptype;
- } else {
- name = node.name();
- }
- break;
- }
- default:
- name = "";
- break;
- }
-
- return name;
- }
-};
-
-#endif
-
-/*
- 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 :
diff --git a/src/filters/blend.cpp b/src/filters/blend.cpp
index ca1d5bf96..6e92ef50f 100644
--- a/src/filters/blend.cpp
+++ b/src/filters/blend.cpp
@@ -13,10 +13,6 @@
* Released under GNU GPL, read the file 'COPYING' for more information
*/
-#ifdef HAVE_CONFIG_H
-# include "config.h"
-#endif
-
#include <string.h>
#include "sp-filter.h"
@@ -30,16 +26,6 @@
#include "display/nr-filter-blend.h"
#include "display/nr-filter-types.h"
-#include "sp-factory.h"
-
-namespace {
- SPObject* createBlend() {
- return new SPFeBlend();
- }
-
- bool blendRegistered = SPFactory::instance().registerObject("svg:feBlend", createBlend);
-}
-
SPFeBlend::SPFeBlend()
: SPFilterPrimitive(), blend_mode(Inkscape::Filters::BLEND_NORMAL),
in2(Inkscape::Filters::NR_FILTER_SLOT_NOT_SET)
diff --git a/src/filters/colormatrix.cpp b/src/filters/colormatrix.cpp
index 58f601a65..a7f0296c2 100644
--- a/src/filters/colormatrix.cpp
+++ b/src/filters/colormatrix.cpp
@@ -14,10 +14,6 @@
* Released under GNU GPL, read the file 'COPYING' for more information
*/
-#ifdef HAVE_CONFIG_H
-# include "config.h"
-#endif
-
#include <string.h>
#include "attributes.h"
@@ -29,16 +25,6 @@
#include "display/nr-filter.h"
#include "display/nr-filter-colormatrix.h"
-#include "sp-factory.h"
-
-namespace {
- SPObject* createColorMatrix() {
- return new SPFeColorMatrix();
- }
-
- bool colorMatrixRegistered = SPFactory::instance().registerObject("svg:feColorMatrix", createColorMatrix);
-}
-
SPFeColorMatrix::SPFeColorMatrix()
: SPFilterPrimitive(), type(Inkscape::Filters::COLORMATRIX_MATRIX), value(0)
{
diff --git a/src/filters/componenttransfer-funcnode.cpp b/src/filters/componenttransfer-funcnode.cpp
index d8c5b0d49..76e99a648 100644
--- a/src/filters/componenttransfer-funcnode.cpp
+++ b/src/filters/componenttransfer-funcnode.cpp
@@ -13,10 +13,6 @@
* Released under GNU GPL, read the file 'COPYING' for more information
*/
-#ifdef HAVE_CONFIG_H
-# include "config.h"
-#endif
-
#include <glib.h>
#include "attributes.h"
@@ -31,32 +27,6 @@
#include "macros.h"
-#include "sp-factory.h"
-
-namespace {
- SPObject* createFuncR() {
- return new SPFeFuncNode(SPFeFuncNode::R);
- }
-
- SPObject* createFuncG() {
- return new SPFeFuncNode(SPFeFuncNode::G);
- }
-
- SPObject* createFuncB() {
- return new SPFeFuncNode(SPFeFuncNode::B);
- }
-
- SPObject* createFuncA() {
- return new SPFeFuncNode(SPFeFuncNode::A);
- }
-
- bool funcRRegistered = SPFactory::instance().registerObject("svg:feFuncR", createFuncR);
- bool funcGRegistered = SPFactory::instance().registerObject("svg:feFuncG", createFuncG);
- bool funcBRegistered = SPFactory::instance().registerObject("svg:feFuncB", createFuncB);
- bool funcARegistered = SPFactory::instance().registerObject("svg:feFuncA", createFuncA);
-}
-
-
/* FeFuncNode class */
SPFeFuncNode::SPFeFuncNode(SPFeFuncNode::Channel channel)
: SPObject(), type(Inkscape::Filters::COMPONENTTRANSFER_TYPE_IDENTITY),
diff --git a/src/filters/componenttransfer.cpp b/src/filters/componenttransfer.cpp
index 610b3dd02..3d0264390 100644
--- a/src/filters/componenttransfer.cpp
+++ b/src/filters/componenttransfer.cpp
@@ -12,10 +12,6 @@
* Released under GNU GPL, read the file 'COPYING' for more information
*/
-#ifdef HAVE_CONFIG_H
-# include "config.h"
-#endif
-
#include <string.h>
#include "document.h"
@@ -27,16 +23,6 @@
#include "display/nr-filter.h"
#include "display/nr-filter-component-transfer.h"
-#include "sp-factory.h"
-
-namespace {
- SPObject* createComponentTransfer() {
- return new SPFeComponentTransfer();
- }
-
- bool componentTransferRegistered = SPFactory::instance().registerObject("svg:feComponentTransfer", createComponentTransfer);
-}
-
SPFeComponentTransfer::SPFeComponentTransfer()
: SPFilterPrimitive(), renderer(NULL)
{
diff --git a/src/filters/composite.cpp b/src/filters/composite.cpp
index e600b6d20..3e651a778 100644
--- a/src/filters/composite.cpp
+++ b/src/filters/composite.cpp
@@ -12,10 +12,6 @@
* Released under GNU GPL, read the file 'COPYING' for more information
*/
-#ifdef HAVE_CONFIG_H
-# include "config.h"
-#endif
-
#include "attributes.h"
#include "svg/svg.h"
#include "filters/composite.h"
@@ -25,16 +21,6 @@
#include "display/nr-filter-composite.h"
#include "sp-filter.h"
-#include "sp-factory.h"
-
-namespace {
- SPObject* createComposite() {
- return new SPFeComposite();
- }
-
- bool compositeRegistered = SPFactory::instance().registerObject("svg:feComposite", createComposite);
-}
-
SPFeComposite::SPFeComposite()
: SPFilterPrimitive(), composite_operator(COMPOSITE_DEFAULT),
k1(0), k2(0), k3(0), k4(0), in2(Inkscape::Filters::NR_FILTER_SLOT_NOT_SET)
diff --git a/src/filters/convolvematrix.cpp b/src/filters/convolvematrix.cpp
index bd710b116..3a443bebc 100644
--- a/src/filters/convolvematrix.cpp
+++ b/src/filters/convolvematrix.cpp
@@ -13,10 +13,6 @@
* Released under GNU GPL, read the file 'COPYING' for more information
*/
-#ifdef HAVE_CONFIG_H
-# include "config.h"
-#endif
-
#include <string.h>
#include <math.h>
#include <vector>
@@ -28,16 +24,6 @@
#include "display/nr-filter.h"
#include "display/nr-filter-convolve-matrix.h"
-#include "sp-factory.h"
-
-namespace {
- SPObject* createConvolveMatrix() {
- return new SPFeConvolveMatrix();
- }
-
- bool convolveMatrixRegistered = SPFactory::instance().registerObject("svg:feConvolveMatrix", createConvolveMatrix);
-}
-
SPFeConvolveMatrix::SPFeConvolveMatrix() : SPFilterPrimitive() {
this->bias = 0;
this->divisorIsSet = 0;
diff --git a/src/filters/diffuselighting.cpp b/src/filters/diffuselighting.cpp
index 09179a69d..120c058d2 100644
--- a/src/filters/diffuselighting.cpp
+++ b/src/filters/diffuselighting.cpp
@@ -14,10 +14,6 @@
* Released under GNU GPL, read the file 'COPYING' for more information
*/
-#ifdef HAVE_CONFIG_H
-# include "config.h"
-#endif
-
#include "strneq.h"
#include "attributes.h"
@@ -36,16 +32,6 @@
/* FeDiffuseLighting base class */
static void sp_feDiffuseLighting_children_modified(SPFeDiffuseLighting *sp_diffuselighting);
-#include "sp-factory.h"
-
-namespace {
- SPObject* createDiffuseLighting() {
- return new SPFeDiffuseLighting();
- }
-
- bool diffuseLightingRegistered = SPFactory::instance().registerObject("svg:feDiffuseLighting", createDiffuseLighting);
-}
-
SPFeDiffuseLighting::SPFeDiffuseLighting() : SPFilterPrimitive() {
this->surfaceScale = 1;
this->diffuseConstant = 1;
diff --git a/src/filters/displacementmap.cpp b/src/filters/displacementmap.cpp
index 7dedfc031..1dbea67ff 100644
--- a/src/filters/displacementmap.cpp
+++ b/src/filters/displacementmap.cpp
@@ -12,10 +12,6 @@
* Released under GNU GPL, read the file 'COPYING' for more information
*/
-#ifdef HAVE_CONFIG_H
-# include "config.h"
-#endif
-
#include "attributes.h"
#include "svg/svg.h"
#include "filters/displacementmap.h"
@@ -25,16 +21,6 @@
#include "display/nr-filter.h"
#include "display/nr-filter-displacement-map.h"
-#include "sp-factory.h"
-
-namespace {
- SPObject* createDisplacementMap() {
- return new SPFeDisplacementMap();
- }
-
- bool displacementMapRegistered = SPFactory::instance().registerObject("svg:feDisplacementMap", createDisplacementMap);
-}
-
SPFeDisplacementMap::SPFeDisplacementMap() : SPFilterPrimitive() {
this->scale=0;
this->xChannelSelector = DISPLACEMENTMAP_CHANNEL_ALPHA;
diff --git a/src/filters/distantlight.cpp b/src/filters/distantlight.cpp
index bd8bd2797..fb7380174 100644
--- a/src/filters/distantlight.cpp
+++ b/src/filters/distantlight.cpp
@@ -13,10 +13,6 @@
* Released under GNU GPL, read the file 'COPYING' for more information
*/
-#ifdef HAVE_CONFIG_H
-# include "config.h"
-#endif
-
#include <glib.h>
#include "attributes.h"
@@ -30,17 +26,6 @@
#include "macros.h"
-#include "sp-factory.h"
-
-namespace {
- SPObject* createDistantLight() {
- return new SPFeDistantLight();
- }
-
- bool distantLightRegistered = SPFactory::instance().registerObject("svg:feDistantLight", createDistantLight);
-}
-
-
SPFeDistantLight::SPFeDistantLight()
: SPObject(), azimuth(0), azimuth_set(FALSE), elevation(0), elevation_set(FALSE) {
}
diff --git a/src/filters/flood.cpp b/src/filters/flood.cpp
index 134492d34..94ca61b98 100644
--- a/src/filters/flood.cpp
+++ b/src/filters/flood.cpp
@@ -12,10 +12,6 @@
* Released under GNU GPL, read the file 'COPYING' for more information
*/
-#ifdef HAVE_CONFIG_H
-# include "config.h"
-#endif
-
#include "strneq.h"
#include "attributes.h"
@@ -27,16 +23,6 @@
#include "display/nr-filter.h"
#include "display/nr-filter-flood.h"
-#include "sp-factory.h"
-
-namespace {
- SPObject* createFlood() {
- return new SPFeFlood();
- }
-
- bool floodRegistered = SPFactory::instance().registerObject("svg:feFlood", createFlood);
-}
-
SPFeFlood::SPFeFlood() : SPFilterPrimitive() {
this->color = 0;
diff --git a/src/filters/gaussian-blur.cpp b/src/filters/gaussian-blur.cpp
index fc1e65925..43a1f6dfb 100644
--- a/src/filters/gaussian-blur.cpp
+++ b/src/filters/gaussian-blur.cpp
@@ -27,19 +27,6 @@
#include "display/nr-filter-gaussian.h"
#include "display/nr-filter-types.h"
-//#define SP_MACROS_SILENT
-//#include "macros.h"
-
-#include "sp-factory.h"
-
-namespace {
- SPObject* createGaussianBlur() {
- return new SPGaussianBlur();
- }
-
- bool gaussianBlurRegistered = SPFactory::instance().registerObject("svg:feGaussianBlur", createGaussianBlur);
-}
-
SPGaussianBlur::SPGaussianBlur() : SPFilterPrimitive() {
}
diff --git a/src/filters/image.cpp b/src/filters/image.cpp
index 116939e0f..62e8b76b9 100644
--- a/src/filters/image.cpp
+++ b/src/filters/image.cpp
@@ -14,10 +14,6 @@
* Released under GNU GPL, read the file 'COPYING' for more information
*/
-#ifdef HAVE_CONFIG_H
-# include "config.h"
-#endif
-
#include <sigc++/bind.h>
#include "display/nr-filter-image.h"
#include "uri.h"
@@ -31,16 +27,6 @@
#include "display/nr-filter.h"
-#include "sp-factory.h"
-
-namespace {
- SPObject* createImage() {
- return new SPFeImage();
- }
-
- bool imageRegistered = SPFactory::instance().registerObject("svg:feImage", createImage);
-}
-
SPFeImage::SPFeImage() : SPFilterPrimitive() {
this->href = NULL;
this->from_element = 0;
diff --git a/src/filters/merge.cpp b/src/filters/merge.cpp
index 882ab36dd..68f671b11 100644
--- a/src/filters/merge.cpp
+++ b/src/filters/merge.cpp
@@ -11,10 +11,6 @@
* Released under GNU GPL, read the file 'COPYING' for more information
*/
-#ifdef HAVE_CONFIG_H
-# include "config.h"
-#endif
-
#include "attributes.h"
#include "svg/svg.h"
#include "xml/repr.h"
@@ -24,16 +20,6 @@
#include "display/nr-filter.h"
#include "display/nr-filter-merge.h"
-#include "sp-factory.h"
-
-namespace {
- SPObject* createMerge() {
- return new SPFeMerge();
- }
-
- bool mergeRegistered = SPFactory::instance().registerObject("svg:feMerge", createMerge);
-}
-
SPFeMerge::SPFeMerge() : SPFilterPrimitive() {
}
diff --git a/src/filters/mergenode.cpp b/src/filters/mergenode.cpp
index ba237c776..691184eb5 100644
--- a/src/filters/mergenode.cpp
+++ b/src/filters/mergenode.cpp
@@ -13,26 +13,12 @@
* Released under GNU GPL, read the file 'COPYING' for more information
*/
-#ifdef HAVE_CONFIG_H
-# include "config.h"
-#endif
-
#include "attributes.h"
#include "xml/repr.h"
#include "filters/mergenode.h"
#include "filters/merge.h"
#include "display/nr-filter-types.h"
-#include "sp-factory.h"
-
-namespace {
- SPObject* createMergeNode() {
- return new SPFeMergeNode();
- }
-
- bool mergeNodeRegistered = SPFactory::instance().registerObject("svg:feMergeNode", createMergeNode);
-}
-
SPFeMergeNode::SPFeMergeNode()
: SPObject(), input(Inkscape::Filters::NR_FILTER_SLOT_NOT_SET) {
}
diff --git a/src/filters/morphology.cpp b/src/filters/morphology.cpp
index d3611b081..326c9b7a6 100644
--- a/src/filters/morphology.cpp
+++ b/src/filters/morphology.cpp
@@ -13,10 +13,6 @@
* Released under GNU GPL, read the file 'COPYING' for more information
*/
-#ifdef HAVE_CONFIG_H
-# include "config.h"
-#endif
-
#include <string.h>
#include "attributes.h"
@@ -26,16 +22,6 @@
#include "display/nr-filter.h"
#include "display/nr-filter-morphology.h"
-#include "sp-factory.h"
-
-namespace {
- SPObject* createMorphology() {
- return new SPFeMorphology();
- }
-
- bool morphologyRegistered = SPFactory::instance().registerObject("svg:feMorphology", createMorphology);
-}
-
SPFeMorphology::SPFeMorphology() : SPFilterPrimitive() {
this->Operator = Inkscape::Filters::MORPHOLOGY_OPERATOR_ERODE;
diff --git a/src/filters/offset.cpp b/src/filters/offset.cpp
index 234a1a964..c35649dcc 100644
--- a/src/filters/offset.cpp
+++ b/src/filters/offset.cpp
@@ -13,10 +13,6 @@
* Released under GNU GPL, read the file 'COPYING' for more information
*/
-#ifdef HAVE_CONFIG_H
-# include "config.h"
-#endif
-
#include "attributes.h"
#include "svg/svg.h"
#include "filters/offset.h"
@@ -25,16 +21,6 @@
#include "display/nr-filter.h"
#include "display/nr-filter-offset.h"
-#include "sp-factory.h"
-
-namespace {
- SPObject* createOffset() {
- return new SPFeOffset();
- }
-
- bool offsetRegistered = SPFactory::instance().registerObject("svg:feOffset", createOffset);
-}
-
SPFeOffset::SPFeOffset() : SPFilterPrimitive() {
this->dx = 0;
this->dy = 0;
diff --git a/src/filters/pointlight.cpp b/src/filters/pointlight.cpp
index 1c7532b4e..dd3a78f4c 100644
--- a/src/filters/pointlight.cpp
+++ b/src/filters/pointlight.cpp
@@ -13,10 +13,6 @@
* Released under GNU GPL, read the file 'COPYING' for more information
*/
-#ifdef HAVE_CONFIG_H
-# include "config.h"
-#endif
-
#include <glib.h>
#include "attributes.h"
@@ -29,16 +25,6 @@
#define SP_MACROS_SILENT
#include "macros.h"
-#include "sp-factory.h"
-
-namespace {
- SPObject* createPointLight() {
- return new SPFePointLight();
- }
-
- bool pointLightRegistered = SPFactory::instance().registerObject("svg:fePointLight", createPointLight);
-}
-
SPFePointLight::SPFePointLight()
: SPObject(), x(0), x_set(FALSE), y(0), y_set(FALSE), z(0), z_set(FALSE) {
}
diff --git a/src/filters/specularlighting.cpp b/src/filters/specularlighting.cpp
index 6cdd5d9ba..bda1a0f30 100644
--- a/src/filters/specularlighting.cpp
+++ b/src/filters/specularlighting.cpp
@@ -14,10 +14,6 @@
* Released under GNU GPL, read the file 'COPYING' for more information
*/
-#ifdef HAVE_CONFIG_H
-# include "config.h"
-#endif
-
#include "strneq.h"
#include "attributes.h"
@@ -36,16 +32,6 @@
/* FeSpecularLighting base class */
static void sp_feSpecularLighting_children_modified(SPFeSpecularLighting *sp_specularlighting);
-#include "sp-factory.h"
-
-namespace {
- SPObject* createSpecularLighting() {
- return new SPFeSpecularLighting();
- }
-
- bool specularLightingRegistered = SPFactory::instance().registerObject("svg:feSpecularLighting", createSpecularLighting);
-}
-
SPFeSpecularLighting::SPFeSpecularLighting() : SPFilterPrimitive() {
this->surfaceScale = 1;
this->specularConstant = 1;
diff --git a/src/filters/spotlight.cpp b/src/filters/spotlight.cpp
index c0344067c..2e55d39d0 100644
--- a/src/filters/spotlight.cpp
+++ b/src/filters/spotlight.cpp
@@ -13,10 +13,6 @@
* Released under GNU GPL, read the file 'COPYING' for more information
*/
-#ifdef HAVE_CONFIG_H
-# include "config.h"
-#endif
-
#include <glib.h>
#include "attributes.h"
@@ -29,16 +25,6 @@
#define SP_MACROS_SILENT
#include "macros.h"
-#include "sp-factory.h"
-
-namespace {
- SPObject* createSpotLight() {
- return new SPFeSpotLight();
- }
-
- bool spotLightRegistered = SPFactory::instance().registerObject("svg:feSpotLight", createSpotLight);
-}
-
SPFeSpotLight::SPFeSpotLight()
: SPObject(), x(0), x_set(FALSE), y(0), y_set(FALSE), z(0), z_set(FALSE), pointsAtX(0), pointsAtX_set(FALSE),
pointsAtY(0), pointsAtY_set(FALSE), pointsAtZ(0), pointsAtZ_set(FALSE),
diff --git a/src/filters/tile.cpp b/src/filters/tile.cpp
index 19e96f47d..623f3ab37 100644
--- a/src/filters/tile.cpp
+++ b/src/filters/tile.cpp
@@ -11,10 +11,6 @@
* Released under GNU GPL, read the file 'COPYING' for more information
*/
-#ifdef HAVE_CONFIG_H
-# include "config.h"
-#endif
-
#include "attributes.h"
#include "svg/svg.h"
#include "filters/tile.h"
@@ -22,16 +18,6 @@
#include "display/nr-filter.h"
#include "display/nr-filter-tile.h"
-#include "sp-factory.h"
-
-namespace {
- SPObject* createTile() {
- return new SPFeTile();
- }
-
- bool tileRegistered = SPFactory::instance().registerObject("svg:feTile", createTile);
-}
-
SPFeTile::SPFeTile() : SPFilterPrimitive() {
}
diff --git a/src/filters/turbulence.cpp b/src/filters/turbulence.cpp
index d33667a8c..7541175ed 100644
--- a/src/filters/turbulence.cpp
+++ b/src/filters/turbulence.cpp
@@ -14,10 +14,6 @@
* Released under GNU GPL, read the file 'COPYING' for more information
*/
-#ifdef HAVE_CONFIG_H
-# include "config.h"
-#endif
-
#include "attributes.h"
#include "svg/svg.h"
#include "turbulence.h"
@@ -28,16 +24,6 @@
#include "display/nr-filter.h"
#include "display/nr-filter-turbulence.h"
-#include "sp-factory.h"
-
-namespace {
- SPObject* createTurbulence() {
- return new SPFeTurbulence();
- }
-
- bool turbulenceRegistered = SPFactory::instance().registerObject("svg:feTurbulence", createTurbulence);
-}
-
SPFeTurbulence::SPFeTurbulence() : SPFilterPrimitive() {
this->stitchTiles = 0;
this->seed = 0;
diff --git a/src/gc-allocator.h b/src/gc-allocator.h
deleted file mode 100644
index e69de29bb..000000000
--- a/src/gc-allocator.h
+++ /dev/null
diff --git a/src/gc-anchored.h b/src/gc-anchored.h
index 99b78c784..33305df5c 100644
--- a/src/gc-anchored.h
+++ b/src/gc-anchored.h
@@ -9,7 +9,7 @@
#ifndef SEEN_INKSCAPE_GC_ANCHORED_H
#define SEEN_INKSCAPE_GC_ANCHORED_H
-#include "gc-managed.h"
+#include "inkgc/gc-managed.h"
namespace Inkscape {
diff --git a/src/gc-finalized.h b/src/gc-finalized.h
index 814a2af18..d39338643 100644
--- a/src/gc-finalized.h
+++ b/src/gc-finalized.h
@@ -18,7 +18,7 @@
#include <new>
#include <cstddef>
-#include "gc-core.h"
+#include "inkgc/gc-core.h"
namespace Inkscape {
diff --git a/src/helper/CMakeLists.txt b/src/helper/CMakeLists.txt
index b0e473ddd..74ce2c85d 100644
--- a/src/helper/CMakeLists.txt
+++ b/src/helper/CMakeLists.txt
@@ -32,6 +32,7 @@ set(helper_SRC
geom-nodetype.h
geom.h
gnome-utils.h
+ mathfns.h
pixbuf-ops.h
png-write.h
stock-items.h
diff --git a/src/helper/Makefile_insert b/src/helper/Makefile_insert
index 4c6437f13..5cb4cea8d 100644
--- a/src/helper/Makefile_insert
+++ b/src/helper/Makefile_insert
@@ -14,6 +14,7 @@ ink_common_sources += \
helper/geom-nodetype.h \
helper/gnome-utils.cpp \
helper/gnome-utils.h \
+ helper/mathfns.h \
helper/png-write.cpp \
helper/png-write.h \
helper/sp-marshal.cpp \
diff --git a/src/util/mathfns.h b/src/helper/mathfns.h
index 830e159da..8fb88dc26 100644
--- a/src/util/mathfns.h
+++ b/src/helper/mathfns.h
@@ -1,5 +1,5 @@
/*
- * Inkscape::Util::... some mathmatical functions
+ * ... some mathmatical functions
*
* Authors:
* Johan Engelen <goejendaagh@zonnet.nl>
@@ -65,7 +65,6 @@ inline double round_to_upper_multiple_plus(double x, double const c1, double con
return ceil((x - c0) / c1) * c1 + c0;
}
-
}
}
diff --git a/src/inkgc/CMakeLists.txt b/src/inkgc/CMakeLists.txt
new file mode 100644
index 000000000..22dd464e1
--- /dev/null
+++ b/src/inkgc/CMakeLists.txt
@@ -0,0 +1,15 @@
+
+set(libgc_SRC
+ gc.cpp
+
+ # -------
+ # Headers
+ gc-alloc.h
+ gc-anchored.h
+ gc-core.h
+ gc-managed.h
+ gc-soft-ptr.h
+)
+
+add_inkscape_lib(gc_LIB "${libgc_SRC}")
+# add_inkscape_source("${libgc_SRC}")
diff --git a/src/inkgc/Makefile_insert b/src/inkgc/Makefile_insert
new file mode 100644
index 000000000..58aa39bb9
--- /dev/null
+++ b/src/inkgc/Makefile_insert
@@ -0,0 +1,13 @@
+## Makefile.am fragment sourced by src/Makefile.am.
+
+inkgc/all: inkgc/libinkgc.a
+
+inkgc/clean:
+ rm -f inkgc/libinkgc.a $(inkgc_libinkgc_a_OBJECTS)
+
+inkgc_libinkgc_a_SOURCES = \
+ inkgc/gc.cpp \
+ inkgc/gc-alloc.h \
+ inkgc/gc-core.h \
+ inkgc/gc-managed.h \
+ inkgc/gc-soft-ptr.h
diff --git a/src/gc-alloc.h b/src/inkgc/gc-alloc.h
index ba672ae2c..917ee972d 100644
--- a/src/gc-alloc.h
+++ b/src/inkgc/gc-alloc.h
@@ -17,7 +17,7 @@
#include <limits>
#include <cstddef>
-#include "gc-core.h"
+#include "inkgc/gc-core.h"
namespace Inkscape {
diff --git a/src/gc-core.h b/src/inkgc/gc-core.h
index d9d0bf4ff..d9d0bf4ff 100644
--- a/src/gc-core.h
+++ b/src/inkgc/gc-core.h
diff --git a/src/gc-managed.h b/src/inkgc/gc-managed.h
index 74d224c9b..f435d7802 100644
--- a/src/gc-managed.h
+++ b/src/inkgc/gc-managed.h
@@ -14,7 +14,7 @@
#ifndef SEEN_INKSCAPE_GC_MANAGED_H
#define SEEN_INKSCAPE_GC_MANAGED_H
-#include "gc-core.h"
+#include "inkgc/gc-core.h"
namespace Inkscape {
diff --git a/src/gc-soft-ptr.h b/src/inkgc/gc-soft-ptr.h
index 9e7304939..45a3ddcf7 100644
--- a/src/gc-soft-ptr.h
+++ b/src/inkgc/gc-soft-ptr.h
@@ -13,7 +13,7 @@
#ifndef SEEN_INKSCAPE_GC_SOFT_PTR_H
#define SEEN_INKSCAPE_GC_SOFT_PTR_H
-#include "gc-core.h"
+#include "inkgc/gc-core.h"
namespace Inkscape {
diff --git a/src/gc.cpp b/src/inkgc/gc.cpp
index 280a8b1dc..90c02d9c8 100644
--- a/src/gc.cpp
+++ b/src/inkgc/gc.cpp
@@ -9,7 +9,7 @@
* Released under GNU GPL, read the file 'COPYING' for more information
*/
-#include "gc-core.h"
+#include "inkgc/gc-core.h"
#include <stdexcept>
#include <cstring>
#include <string>
diff --git a/src/inkview.cpp b/src/inkview.cpp
index 0b7b4d35c..2c667237e 100644
--- a/src/inkview.cpp
+++ b/src/inkview.cpp
@@ -47,7 +47,7 @@
#include <gdk/gdkkeysyms.h>
#include <gtk/gtk.h>
-#include "gc-core.h"
+#include "inkgc/gc-core.h"
#include "preferences.h"
#include <glibmm/i18n.h>
diff --git a/src/layer-manager.cpp b/src/layer-manager.cpp
index b1e365fe2..3bbc831d5 100644
--- a/src/layer-manager.cpp
+++ b/src/layer-manager.cpp
@@ -11,7 +11,7 @@
#include <set>
#include <sigc++/functors/mem_fun.h>
#include <sigc++/adaptors/hide.h>
-#include "gc-managed.h"
+#include "inkgc/gc-managed.h"
#include "gc-finalized.h"
#include "document.h"
#include "desktop.h"
diff --git a/src/layer-manager.h b/src/layer-manager.h
index 9eea68004..a304929c6 100644
--- a/src/layer-manager.h
+++ b/src/layer-manager.h
@@ -15,7 +15,7 @@
#include "document-subset.h"
#include "gc-finalized.h"
-#include "gc-soft-ptr.h"
+#include "inkgc/gc-soft-ptr.h"
class SPDesktop;
class SPDocument;
diff --git a/src/live_effects/lpeobject.cpp b/src/live_effects/lpeobject.cpp
index d92c94d01..8e5ae568f 100644
--- a/src/live_effects/lpeobject.cpp
+++ b/src/live_effects/lpeobject.cpp
@@ -20,16 +20,6 @@
//#define LIVEPATHEFFECT_VERBOSE
-#include "sp-factory.h"
-
-namespace {
- SPObject* createLivepatheffect() {
- return new LivePathEffectObject();
- }
-
- bool livepatheffectRegistered = SPFactory::instance().registerObject("inkscape:path-effect", createLivepatheffect);
-}
-
static void livepatheffect_on_repr_attr_changed (Inkscape::XML::Node * repr, const gchar *key, const gchar *oldval, const gchar *newval, bool is_interactive, void * data);
static Inkscape::XML::NodeEventVector const livepatheffect_repr_events = {
diff --git a/src/main.cpp b/src/main.cpp
index 062edcb98..66452906b 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -52,7 +52,7 @@
#include <glib-object.h>
#include <gtk/gtk.h>
-#include "gc-core.h"
+#include "inkgc/gc-core.h"
#ifdef AND
#undef AND
diff --git a/src/message-stack.h b/src/message-stack.h
index 42bf4e8a7..ed0315cf5 100644
--- a/src/message-stack.h
+++ b/src/message-stack.h
@@ -22,7 +22,7 @@
#include <glibmm/ustring.h>
#include <sigc++/sigc++.h>
-#include "gc-managed.h"
+#include "inkgc/gc-managed.h"
#include "gc-finalized.h"
#include "gc-anchored.h"
#include "message.h"
diff --git a/src/persp3d.cpp b/src/persp3d.cpp
index c761947ad..dc0975d12 100644
--- a/src/persp3d.cpp
+++ b/src/persp3d.cpp
@@ -34,16 +34,6 @@ static void persp3d_on_repr_attr_changed (Inkscape::XML::Node * repr, const gcha
static int global_counter = 0;
-#include "sp-factory.h"
-
-namespace {
- SPObject* createPersp3D() {
- return new Persp3D();
- }
-
- bool persp3DRegistered = SPFactory::instance().registerObject("inkscape:persp3d", createPersp3D);
-}
-
/* Constructor/destructor for the internal class */
Persp3DImpl::Persp3DImpl() {
diff --git a/src/selection.h b/src/selection.h
index 9eada3eed..7ac0f40f3 100644
--- a/src/selection.h
+++ b/src/selection.h
@@ -20,10 +20,10 @@
#include <stddef.h>
#include <sigc++/sigc++.h>
-#include "gc-managed.h"
+#include "inkgc/gc-managed.h"
#include "gc-finalized.h"
#include "gc-anchored.h"
-#include "gc-soft-ptr.h"
+#include "inkgc/gc-soft-ptr.h"
#include "sp-item.h"
diff --git a/src/snap.cpp b/src/snap.cpp
index 31cafafcd..30441ca0b 100644
--- a/src/snap.cpp
+++ b/src/snap.cpp
@@ -33,7 +33,7 @@
#include "sp-guide.h"
#include "preferences.h"
#include "ui/tools/tool-base.h"
-#include "util/mathfns.h"
+#include "helper/mathfns.h"
using std::vector;
using Inkscape::Util::round_to_upper_multiple_plus;
using Inkscape::Util::round_to_lower_multiple_plus;
diff --git a/src/sp-anchor.cpp b/src/sp-anchor.cpp
index 7b558bf08..78ba10c13 100644
--- a/src/sp-anchor.cpp
+++ b/src/sp-anchor.cpp
@@ -13,10 +13,6 @@
#define noSP_ANCHOR_VERBOSE
-#ifdef HAVE_CONFIG_H
-# include "config.h"
-#endif
-
#include <glibmm/i18n.h>
#include "xml/quote.h"
#include "xml/repr.h"
@@ -25,16 +21,6 @@
#include "ui/view/view.h"
#include "document.h"
-#include "sp-factory.h"
-
-namespace {
- SPObject* createAnchor() {
- return new SPAnchor();
- }
-
- bool anchorRegistered = SPFactory::instance().registerObject("svg:a", createAnchor);
-}
-
SPAnchor::SPAnchor() : SPGroup() {
this->href = NULL;
}
diff --git a/src/sp-clippath.cpp b/src/sp-clippath.cpp
index 5065f25c3..3c6167438 100644
--- a/src/sp-clippath.cpp
+++ b/src/sp-clippath.cpp
@@ -40,16 +40,6 @@ struct SPClipPathView {
static SPClipPathView* sp_clippath_view_new_prepend(SPClipPathView *list, unsigned int key, Inkscape::DrawingItem *arenaitem);
static SPClipPathView* sp_clippath_view_list_remove(SPClipPathView *list, SPClipPathView *view);
-#include "sp-factory.h"
-
-namespace {
- SPObject* createClipPath() {
- return new SPClipPath();
- }
-
- bool clipPathRegistered = SPFactory::instance().registerObject("svg:clipPath", createClipPath);
-}
-
SPClipPath::SPClipPath() : SPObjectGroup() {
this->clipPathUnits_set = FALSE;
this->clipPathUnits = SP_CONTENT_UNITS_USERSPACEONUSE;
diff --git a/src/sp-defs.cpp b/src/sp-defs.cpp
index 74d29a05c..2e341d3c6 100644
--- a/src/sp-defs.cpp
+++ b/src/sp-defs.cpp
@@ -20,16 +20,6 @@
#include "xml/repr.h"
#include "document.h"
-#include "sp-factory.h"
-
-namespace {
- SPObject* createDefs() {
- return new SPDefs();
- }
-
- bool defsRegistered = SPFactory::instance().registerObject("svg:defs", createDefs);
-}
-
SPDefs::SPDefs() : SPObject() {
}
diff --git a/src/sp-desc.cpp b/src/sp-desc.cpp
index 199ae0176..3c75d087a 100644
--- a/src/sp-desc.cpp
+++ b/src/sp-desc.cpp
@@ -9,23 +9,9 @@
* Released under GNU GPL, read the file 'COPYING' for more information
*/
-#ifdef HAVE_CONFIG_H
-# include "config.h"
-#endif
-
#include "sp-desc.h"
#include "xml/repr.h"
-#include "sp-factory.h"
-
-namespace {
- SPObject* createDesc() {
- return new SPDesc();
- }
-
- bool descRegistered = SPFactory::instance().registerObject("svg:desc", createDesc);
-}
-
SPDesc::SPDesc() : SPObject() {
}
diff --git a/src/sp-ellipse.cpp b/src/sp-ellipse.cpp
index a74d4687d..885fedafa 100644
--- a/src/sp-ellipse.cpp
+++ b/src/sp-ellipse.cpp
@@ -34,35 +34,6 @@
#include "svg/path-string.h"
#include "xml/repr.h"
-#include "sp-factory.h"
-
-namespace {
-SPObject *create_ellipse()
-{
- SPGenericEllipse *ellipse = new SPGenericEllipse();
- ellipse->type = SP_GENERIC_ELLIPSE_ELLIPSE;
- return ellipse;
-}
-
-SPObject *create_circle()
-{
- SPGenericEllipse *circle = new SPGenericEllipse();
- circle->type = SP_GENERIC_ELLIPSE_CIRCLE;
- return circle;
-}
-
-SPObject *create_arc()
-{
- SPGenericEllipse *arc = new SPGenericEllipse();
- arc->type = SP_GENERIC_ELLIPSE_ARC;
- return arc;
-}
-
-bool ellipse_registered = SPFactory::instance().registerObject("svg:ellipse", create_ellipse);
-bool circle_registered = SPFactory::instance().registerObject("svg:circle", create_circle);
-bool arc_registered = SPFactory::instance().registerObject("arc", create_arc);
-}
-
#ifndef M_PI
#define M_PI 3.14159265358979323846
diff --git a/src/sp-factory.cpp b/src/sp-factory.cpp
new file mode 100644
index 000000000..9911222e5
--- /dev/null
+++ b/src/sp-factory.cpp
@@ -0,0 +1,337 @@
+/*
+ * Factory for SPObject tree
+ *
+ * Authors:
+ * Markus Engel
+ *
+ * Copyright (C) 2013 Authors
+ * Released under GNU GPL, read the file 'COPYING' for more information
+ */
+
+#include "sp-factory.h"
+
+// primary
+#include "box3d.h"
+#include "box3d-side.h"
+#include "color-profile.h"
+#include "persp3d.h"
+#include "sp-anchor.h"
+#include "sp-clippath.h"
+#include "sp-defs.h"
+#include "sp-desc.h"
+#include "sp-ellipse.h"
+#include "sp-filter.h"
+#include "sp-flowdiv.h"
+#include "sp-flowregion.h"
+#include "sp-flowtext.h"
+#include "sp-font.h"
+#include "sp-font-face.h"
+#include "sp-glyph.h"
+#include "sp-guide.h"
+#include "sp-hatch.h"
+#include "sp-hatch-path.h"
+#include "sp-image.h"
+#include "sp-item-group.h"
+#include "sp-line.h"
+#include "sp-linear-gradient.h"
+#include "sp-marker.h"
+#include "sp-mask.h"
+#include "sp-mesh-gradient.h"
+#include "sp-mesh-patch.h"
+#include "sp-mesh-row.h"
+#include "sp-metadata.h"
+#include "sp-missing-glyph.h"
+#include "sp-namedview.h"
+#include "sp-object.h"
+#include "sp-offset.h"
+#include "sp-path.h"
+#include "sp-pattern.h"
+#include "sp-polygon.h"
+#include "sp-polyline.h"
+#include "sp-radial-gradient.h"
+#include "sp-rect.h"
+#include "sp-root.h"
+#include "sp-script.h"
+#include "sp-solid-color.h"
+#include "sp-spiral.h"
+#include "sp-star.h"
+#include "sp-stop.h"
+#include "sp-string.h"
+#include "sp-style-elem.h"
+#include "sp-switch.h"
+#include "sp-symbol.h"
+#include "sp-tag.h"
+#include "sp-tag-use.h"
+#include "sp-text.h"
+#include "sp-textpath.h"
+#include "sp-title.h"
+#include "sp-tref.h"
+#include "sp-tspan.h"
+#include "sp-use.h"
+#include "live_effects/lpeobject.h"
+
+// filters
+#include "filters/blend.h"
+#include "filters/colormatrix.h"
+#include "filters/componenttransfer.h"
+#include "filters/componenttransfer-funcnode.h"
+#include "filters/composite.h"
+#include "filters/convolvematrix.h"
+#include "filters/diffuselighting.h"
+#include "filters/displacementmap.h"
+#include "filters/distantlight.h"
+#include "filters/flood.h"
+#include "filters/gaussian-blur.h"
+#include "filters/image.h"
+#include "filters/merge.h"
+#include "filters/mergenode.h"
+#include "filters/morphology.h"
+#include "filters/offset.h"
+#include "filters/pointlight.h"
+#include "filters/specularlighting.h"
+#include "filters/spotlight.h"
+#include "filters/tile.h"
+#include "filters/turbulence.h"
+
+SPObject *SPFactory::createObject(std::string const& id)
+{
+ SPObject *ret = NULL;
+
+ if (id == "inkscape:box3d")
+ ret = new SPBox3D;
+ else if (id == "inkscape:box3dside")
+ ret = new Box3DSide;
+ else if (id == "svg:color-profile")
+ ret = new Inkscape::ColorProfile;
+ else if (id == "inkscape:persp3d")
+ ret = new Persp3D;
+ else if (id == "svg:a")
+ ret = new SPAnchor;
+ else if (id == "svg:clipPath")
+ ret = new SPClipPath;
+ else if (id == "svg:defs")
+ ret = new SPDefs;
+ else if (id == "svg:desc")
+ ret = new SPDesc;
+ else if (id == "svg:ellipse") {
+ SPGenericEllipse *e = new SPGenericEllipse;
+ e->type = SP_GENERIC_ELLIPSE_ELLIPSE;
+ ret = e;
+ } else if (id == "svg:circle") {
+ SPGenericEllipse *c = new SPGenericEllipse;
+ c->type = SP_GENERIC_ELLIPSE_CIRCLE;
+ ret = c;
+ } else if (id == "arc") {
+ SPGenericEllipse *a = new SPGenericEllipse;
+ a->type = SP_GENERIC_ELLIPSE_ARC;
+ ret = a;
+ }
+ else if (id == "svg:filter")
+ ret = new SPFilter;
+ else if (id == "svg:flowDiv")
+ ret = new SPFlowdiv;
+ else if (id == "svg:flowSpan")
+ ret = new SPFlowtspan;
+ else if (id == "svg:flowPara")
+ ret = new SPFlowpara;
+ else if (id == "svg:flowLine")
+ ret = new SPFlowline;
+ else if (id == "svg:flowRegionBreak")
+ ret = new SPFlowregionbreak;
+ else if (id == "svg:flowRegion")
+ ret = new SPFlowregion;
+ else if (id == "svg:flowRegionExclude")
+ ret = new SPFlowregionExclude;
+ else if (id == "svg:flowRoot")
+ ret = new SPFlowtext;
+ else if (id == "svg:font")
+ ret = new SPFont;
+ else if (id == "svg:font-face")
+ ret = new SPFontFace;
+ else if (id == "svg:glyph")
+ ret = new SPGlyph;
+ else if (id == "sodipodi:guide")
+ ret = new SPGuide;
+ else if (id == "svg:hatch")
+ ret = new SPHatch;
+ else if (id == "svg:hatchPath")
+ ret = new SPHatchPath;
+ else if (id == "svg:image")
+ ret = new SPImage;
+ else if (id == "svg:g")
+ ret = new SPGroup;
+ else if (id == "svg:line")
+ ret = new SPLine;
+ else if (id == "svg:linearGradient")
+ ret = new SPLinearGradient;
+ else if (id == "svg:marker")
+ ret = new SPMarker;
+ else if (id == "svg:mask")
+ ret = new SPMask;
+ else if (id == "svg:meshGradient")
+ ret = new SPMeshGradient;
+ else if (id == "svg:meshPatch")
+ ret = new SPMeshPatch;
+ else if (id == "svg:meshRow")
+ ret = new SPMeshRow;
+ else if (id == "svg:metadata")
+ ret = new SPMetadata;
+ else if (id == "svg:missing-glyph")
+ ret = new SPMissingGlyph;
+ else if (id == "sodipodi:namedview")
+ ret = new SPNamedView;
+ else if (id == "inkscape:offset")
+ ret = new SPOffset;
+ else if (id == "svg:path")
+ ret = new SPPath;
+ else if (id == "svg:pattern")
+ ret = new SPPattern;
+ else if (id == "svg:polygon")
+ ret = new SPPolygon;
+ else if (id == "svg:polyline")
+ ret = new SPPolyLine;
+ else if (id == "svg:radialGradient")
+ ret = new SPRadialGradient;
+ else if (id == "svg:rect")
+ ret = new SPRect;
+ else if (id == "svg:svg")
+ ret = new SPRoot;
+ else if (id == "svg:script")
+ ret = new SPScript;
+ else if (id == "svg:solidColor")
+ ret = new SPSolidColor;
+ else if (id == "spiral")
+ ret = new SPSpiral;
+ else if (id == "star")
+ ret = new SPStar;
+ else if (id == "svg:stop")
+ ret = new SPStop;
+ else if (id == "string")
+ ret = new SPString;
+ else if (id == "svg:style")
+ ret = new SPStyleElem;
+ else if (id == "svg:switch")
+ ret = new SPSwitch;
+ else if (id == "svg:symbol")
+ ret = new SPSymbol;
+ else if (id == "inkscape:tag")
+ ret = new SPTag;
+ else if (id == "inkscape:tagref")
+ ret = new SPTagUse;
+ else if (id == "svg:text")
+ ret = new SPText;
+ else if (id == "svg:title")
+ ret = new SPTitle;
+ else if (id == "svg:tref")
+ ret = new SPTRef;
+ else if (id == "svg:tspan")
+ ret = new SPTSpan;
+ else if (id == "svg:textPath")
+ ret = new SPTextPath;
+ else if (id == "svg:use")
+ ret = new SPUse;
+ else if (id == "inkscape:path-effect")
+ ret = new LivePathEffectObject;
+
+
+ // filters
+ else if (id == "svg:feBlend")
+ ret = new SPFeBlend;
+ else if (id == "svg:feColorMatrix")
+ ret = new SPFeColorMatrix;
+ else if (id == "svg:feComponentTransfer")
+ ret = new SPFeComponentTransfer;
+ else if (id == "svg:feFuncR")
+ ret = new SPFeFuncNode(SPFeFuncNode::R);
+ else if (id == "svg:feFuncG")
+ ret = new SPFeFuncNode(SPFeFuncNode::G);
+ else if (id == "svg:feFuncB")
+ ret = new SPFeFuncNode(SPFeFuncNode::B);
+ else if (id == "svg:feFuncA")
+ ret = new SPFeFuncNode(SPFeFuncNode::A);
+ else if (id == "svg:feComposite")
+ ret = new SPFeComposite;
+ else if (id == "svg:feConvolveMatrix")
+ ret = new SPFeConvolveMatrix;
+ else if (id == "svg:feDiffuseLighting")
+ ret = new SPFeDiffuseLighting;
+ else if (id == "svg:feDisplacementMap")
+ ret = new SPFeDisplacementMap;
+ else if (id == "svg:feDistantLight")
+ ret = new SPFeDistantLight;
+ else if (id == "svg:feFlood")
+ ret = new SPFeFlood;
+ else if (id == "svg:feGaussianBlur")
+ ret = new SPGaussianBlur;
+ else if (id == "svg:feImage")
+ ret = new SPFeImage;
+ else if (id == "svg:feMerge")
+ ret = new SPFeMerge;
+ else if (id == "svg:feMergeNode")
+ ret = new SPFeMergeNode;
+ else if (id == "svg:feMorphology")
+ ret = new SPFeMorphology;
+ else if (id == "svg:feOffset")
+ ret = new SPFeOffset;
+ else if (id == "svg:fePointLight")
+ ret = new SPFePointLight;
+ else if (id == "svg:feSpecularLighting")
+ ret = new SPFeSpecularLighting;
+ else if (id == "svg:feSpotLight")
+ ret = new SPFeSpotLight;
+ else if (id == "svg:feTile")
+ ret = new SPFeTile;
+ else if (id == "svg:feTurbulence")
+ ret = new SPFeTurbulence;
+ else if (id == "inkscape:grid")
+ ret = new SPObject; // TODO wtf
+ else if (id == "rdf:RDF") // no SP node yet
+ {}
+ else if (id == "inkscape:clipboard") // SP node not necessary
+ {}
+ else if (id.empty()) // comments
+ {}
+ else {
+ fprintf(stderr, "WARNING: unknown type: %s", id.c_str());
+ }
+
+ return ret;
+}
+
+std::string NodeTraits::get_type_string(Inkscape::XML::Node const &node)
+{
+ std::string name;
+
+ switch (node.type()) {
+ case Inkscape::XML::TEXT_NODE:
+ name = "string";
+ break;
+
+ case Inkscape::XML::ELEMENT_NODE: {
+ char const *const sptype = node.attribute("sodipodi:type");
+
+ if (sptype) {
+ name = sptype;
+ } else {
+ name = node.name();
+ }
+ break;
+ }
+ default:
+ name = "";
+ break;
+ }
+
+ return name;
+}
+
+/*
+ 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 :
diff --git a/src/sp-factory.h b/src/sp-factory.h
index 0621f77ba..040fd14ae 100644
--- a/src/sp-factory.h
+++ b/src/sp-factory.h
@@ -1,6 +1,6 @@
-/** @file
+/*
* Factory for SPObject tree
- *//*
+ *
* Authors:
* Markus Engel
*
@@ -11,11 +11,23 @@
#ifndef SP_FACTORY_SEEN
#define SP_FACTORY_SEEN
-#include "factory.h"
+#include <string>
class SPObject;
-typedef Singleton< Factory<SPObject> > SPFactory;
+namespace Inkscape {
+namespace XML {
+class Node;
+}
+}
+
+struct SPFactory {
+ static SPObject *createObject(std::string const& id);
+};
+
+struct NodeTraits {
+ static std::string get_type_string(Inkscape::XML::Node const &node);
+};
#endif
diff --git a/src/sp-filter.cpp b/src/sp-filter.cpp
index 5386a4373..2bf1b11a6 100644
--- a/src/sp-filter.cpp
+++ b/src/sp-filter.cpp
@@ -41,15 +41,6 @@ using std::pair;
static void filter_ref_changed(SPObject *old_ref, SPObject *ref, SPFilter *filter);
static void filter_ref_modified(SPObject *href, guint flags, SPFilter *filter);
-#include "sp-factory.h"
-
-namespace {
- SPObject* createFilter() {
- return new SPFilter();
- }
-
- bool filterRegistered = SPFactory::instance().registerObject("svg:filter", createFilter);
-}
SPFilter::SPFilter()
: SPObject(), filterUnits(SP_FILTER_UNITS_OBJECTBOUNDINGBOX), filterUnits_set(FALSE),
diff --git a/src/sp-flowdiv.cpp b/src/sp-flowdiv.cpp
index 00ba48b06..8d9c51ab8 100644
--- a/src/sp-flowdiv.cpp
+++ b/src/sp-flowdiv.cpp
@@ -1,45 +1,11 @@
/*
*/
-#ifdef HAVE_CONFIG_H
-# include "config.h"
-#endif
-
#include "xml/repr.h"
#include "sp-flowdiv.h"
#include "sp-string.h"
#include "document.h"
-#include "sp-factory.h"
-
-namespace {
- SPObject* createFlowdiv() {
- return new SPFlowdiv();
- }
-
- SPObject* createFlowtspan() {
- return new SPFlowtspan();
- }
-
- SPObject* createFlowpara() {
- return new SPFlowpara();
- }
-
- SPObject* createFlowline() {
- return new SPFlowline();
- }
-
- SPObject* createFlowregionbreak() {
- return new SPFlowregionbreak();
- }
-
- bool flowdivRegistered = SPFactory::instance().registerObject("svg:flowDiv", createFlowdiv);
- bool flowtspanRegistered = SPFactory::instance().registerObject("svg:flowSpan", createFlowtspan);
- bool flowparaRegistered = SPFactory::instance().registerObject("svg:flowPara", createFlowpara);
- bool flowlineRegistered = SPFactory::instance().registerObject("svg:flowLine", createFlowline);
- bool flowregionbreakRegistered = SPFactory::instance().registerObject("svg:flowRegionBreak", createFlowregionbreak);
-}
-
SPFlowdiv::SPFlowdiv() : SPItem() {
}
diff --git a/src/sp-flowregion.cpp b/src/sp-flowregion.cpp
index 580945d74..5715e5eb1 100644
--- a/src/sp-flowregion.cpp
+++ b/src/sp-flowregion.cpp
@@ -23,20 +23,6 @@
#include "livarot/Path.h"
#include "livarot/Shape.h"
-#include "sp-factory.h"
-
-namespace {
- SPObject* createFlowregion() {
- return new SPFlowregion();
- }
-
- SPObject* createFlowregionExclude() {
- return new SPFlowregionExclude();
- }
-
- bool flowregionRegistered = SPFactory::instance().registerObject("svg:flowRegion", createFlowregion);
- bool flowregionExcludeRegistered = SPFactory::instance().registerObject("svg:flowRegionExclude", createFlowregionExclude);
-}
static void GetDest(SPObject* child,Shape **computed);
diff --git a/src/sp-flowtext.cpp b/src/sp-flowtext.cpp
index 6d2385aff..cac3cc61d 100644
--- a/src/sp-flowtext.cpp
+++ b/src/sp-flowtext.cpp
@@ -34,16 +34,6 @@
#include "display/drawing-text.h"
-#include "sp-factory.h"
-
-namespace {
- SPObject* createFlowtext() {
- return new SPFlowtext();
- }
-
- bool flowtextRegistered = SPFactory::instance().registerObject("svg:flowRoot", createFlowtext);
-}
-
SPFlowtext::SPFlowtext() : SPItem() {
this->par_indent = 0;
}
diff --git a/src/sp-font-face.cpp b/src/sp-font-face.cpp
index 9782f0c83..afd2a9dee 100644
--- a/src/sp-font-face.cpp
+++ b/src/sp-font-face.cpp
@@ -259,16 +259,6 @@ static std::vector<FontFaceStretchType> sp_read_fontFaceStretchType(gchar const
return v;
}
-#include "sp-factory.h"
-
-namespace {
- SPObject* createFontFace() {
- return new SPFontFace();
- }
-
- bool fontFaceRegistered = SPFactory::instance().registerObject("svg:font-face", createFontFace);
-}
-
SPFontFace::SPFontFace() : SPObject() {
std::vector<FontFaceStyleType> style;
style.push_back(SP_FONTFACE_STYLE_ALL);
diff --git a/src/sp-font.cpp b/src/sp-font.cpp
index 62cf521d3..341a6159f 100644
--- a/src/sp-font.cpp
+++ b/src/sp-font.cpp
@@ -23,15 +23,6 @@
#include "display/nr-svgfonts.h"
-#include "sp-factory.h"
-
-namespace {
- SPObject* createFont() {
- return new SPFont();
- }
-
- bool fontRegistered = SPFactory::instance().registerObject("svg:font", createFont);
-}
//I think we should have extra stuff here and in the set method in order to set default value as specified at http://www.w3.org/TR/SVG/fonts.html
diff --git a/src/sp-glyph.cpp b/src/sp-glyph.cpp
index eaa69d486..4829aae51 100644
--- a/src/sp-glyph.cpp
+++ b/src/sp-glyph.cpp
@@ -20,15 +20,6 @@
#include "document.h"
#include <cstring>
-#include "sp-factory.h"
-
-namespace {
- SPObject* createGlyph() {
- return new SPGlyph();
- }
- bool glyphRegistered = SPFactory::instance().registerObject("svg:glyph", createGlyph);
-}
-
SPGlyph::SPGlyph()
: SPObject()
//TODO: correct these values:
diff --git a/src/sp-guide.cpp b/src/sp-guide.cpp
index 08b055508..4e1c5913d 100644
--- a/src/sp-guide.cpp
+++ b/src/sp-guide.cpp
@@ -47,16 +47,6 @@
using Inkscape::DocumentUndo;
using std::vector;
-#include "sp-factory.h"
-
-namespace {
- SPObject* createGuide() {
- return new SPGuide();
- }
-
- bool guideRegistered = SPFactory::instance().registerObject("sodipodi:guide", createGuide);
-}
-
SPGuide::SPGuide()
: SPObject()
, label(NULL)
diff --git a/src/sp-hatch-path.cpp b/src/sp-hatch-path.cpp
index bc95c246e..32a514dcb 100644
--- a/src/sp-hatch-path.cpp
+++ b/src/sp-hatch-path.cpp
@@ -12,10 +12,6 @@
* Released under GNU GPL, read the file 'COPYING' for more information
*/
-#ifdef HAVE_CONFIG_H
-# include "config.h"
-#endif
-
#include <cstring>
#include <string>
#include <2geom/path.h>
@@ -37,19 +33,6 @@
#include "svg/css-ostringstream.h"
#include "xml/repr.h"
-#include "sp-factory.h"
-
-namespace {
-
-SPObject* createHatchPath()
-{
- return new SPHatchPath();
-}
-
-bool hatchRegistered = SPFactory::instance().registerObject("svg:hatchPath", createHatchPath);
-
-} // namespace
-
SPHatchPath::SPHatchPath()
: offset(),
_display(),
diff --git a/src/sp-hatch.cpp b/src/sp-hatch.cpp
index dfecb2250..ea4c5865a 100644
--- a/src/sp-hatch.cpp
+++ b/src/sp-hatch.cpp
@@ -12,10 +12,6 @@
* Released under GNU GPL, read the file 'COPYING' for more information
*/
-#ifdef HAVE_CONFIG_H
-# include "config.h"
-#endif
-
#include <cstring>
#include <string>
#include <2geom/transforms.h>
@@ -35,18 +31,6 @@
#include "sp-hatch-path.h"
#include "xml/repr.h"
-#include "sp-factory.h"
-
-namespace {
-
-SPObject* createHatch() {
- return new SPHatch();
-}
-
-bool hatchRegistered = SPFactory::instance().registerObject("svg:hatch", createHatch);
-
-} // namespace
-
SPHatch::SPHatch()
: SPPaintServer(),
href(),
diff --git a/src/sp-image.cpp b/src/sp-image.cpp
index b6177fae6..bf5b9ebcd 100644
--- a/src/sp-image.cpp
+++ b/src/sp-image.cpp
@@ -42,7 +42,6 @@
#include "snap-candidate.h"
#include "preferences.h"
#include "io/sys.h"
-#include "sp-factory.h"
#if defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2)
#include "cms-system.h"
@@ -112,14 +111,6 @@ extern guint update_in_progress;
#define DEBUG_MESSAGE_SCISLAC(key, ...)
#endif // DEBUG_LCMS
-namespace {
-SPObject* createImage() {
- return new SPImage();
-}
-
-bool imageRegistered = SPFactory::instance().registerObject("svg:image", createImage);
-}
-
SPImage::SPImage() : SPItem(), SPViewBox() {
this->x.unset();
diff --git a/src/sp-item-group.cpp b/src/sp-item-group.cpp
index 64ad9ff43..cfa142acd 100644
--- a/src/sp-item-group.cpp
+++ b/src/sp-item-group.cpp
@@ -58,16 +58,6 @@ using Inkscape::DocumentUndo;
static void sp_group_perform_patheffect(SPGroup *group, SPGroup *topgroup, bool write);
-#include "sp-factory.h"
-
-namespace {
- SPObject* createGroup() {
- return new SPGroup();
- }
-
- bool groupRegistered = SPFactory::instance().registerObject("svg:g", createGroup);
-}
-
SPGroup::SPGroup() : SPLPEItem() {
this->_layer_mode = SPGroup::GROUP;
}
diff --git a/src/sp-line.cpp b/src/sp-line.cpp
index 8af95b4ce..cf21be912 100644
--- a/src/sp-line.cpp
+++ b/src/sp-line.cpp
@@ -11,9 +11,6 @@
* Released under GNU GPL, read the file 'COPYING' for more information
*/
-#ifdef HAVE_CONFIG_H
-# include "config.h"
-#endif
#include "attributes.h"
#include "style.h"
#include "sp-line.h"
@@ -24,16 +21,6 @@
#include "document.h"
#include "inkscape.h"
-#include "sp-factory.h"
-
-namespace {
- SPObject* createLine() {
- return new SPLine();
- }
-
- bool lineRegistered = SPFactory::instance().registerObject("svg:line", createLine);
-}
-
SPLine::SPLine() : SPShape() {
this->x1.unset();
this->y1.unset();
diff --git a/src/sp-linear-gradient.cpp b/src/sp-linear-gradient.cpp
index 6e9f5e6dd..29579b617 100644
--- a/src/sp-linear-gradient.cpp
+++ b/src/sp-linear-gradient.cpp
@@ -5,17 +5,6 @@
#include "attributes.h"
#include "xml/repr.h"
-#include "sp-factory.h"
-
-namespace {
- SPObject* createLinearGradient() {
- return new SPLinearGradient();
- }
-
- bool linearGradientRegistered = SPFactory::instance().registerObject("svg:linearGradient", createLinearGradient);
-}
-
-
/*
* Linear Gradient
*/
diff --git a/src/sp-marker.cpp b/src/sp-marker.cpp
index 9618c5484..9334614dc 100644
--- a/src/sp-marker.cpp
+++ b/src/sp-marker.cpp
@@ -43,16 +43,6 @@ public:
std::vector<Inkscape::DrawingItem *> items;
};
-#include "sp-factory.h"
-
-namespace {
- SPObject* createMarker() {
- return new SPMarker();
- }
-
- bool markerRegistered = SPFactory::instance().registerObject("svg:marker", createMarker);
-}
-
SPMarker::SPMarker() : SPGroup(), SPViewBox() {
this->markerUnits = 0;
diff --git a/src/sp-mask.cpp b/src/sp-mask.cpp
index 9707c9d8e..d60473e1d 100644
--- a/src/sp-mask.cpp
+++ b/src/sp-mask.cpp
@@ -37,16 +37,6 @@ struct SPMaskView {
SPMaskView *sp_mask_view_new_prepend (SPMaskView *list, unsigned int key, Inkscape::DrawingItem *arenaitem);
SPMaskView *sp_mask_view_list_remove (SPMaskView *list, SPMaskView *view);
-#include "sp-factory.h"
-
-namespace {
- SPObject* createMask() {
- return new SPMask();
- }
-
- bool maskRegistered = SPFactory::instance().registerObject("svg:mask", createMask);
-}
-
SPMask::SPMask() : SPObjectGroup() {
this->maskUnits_set = FALSE;
this->maskUnits = SP_CONTENT_UNITS_OBJECTBOUNDINGBOX;
diff --git a/src/sp-mesh-gradient.cpp b/src/sp-mesh-gradient.cpp
index 5c6a2f9da..3301d257c 100644
--- a/src/sp-mesh-gradient.cpp
+++ b/src/sp-mesh-gradient.cpp
@@ -6,17 +6,6 @@
#include "sp-mesh-gradient.h"
-#include "sp-factory.h"
-
-namespace {
- SPObject* createMeshGradient() {
- return new SPMeshGradient();
- }
-
- bool meshGradientRegistered = SPFactory::instance().registerObject("svg:meshGradient", createMeshGradient);
-}
-
-
/*
* Mesh Gradient
*/
diff --git a/src/sp-mesh-patch.cpp b/src/sp-mesh-patch.cpp
index 216de8270..e7c7c837d 100644
--- a/src/sp-mesh-patch.cpp
+++ b/src/sp-mesh-patch.cpp
@@ -20,16 +20,6 @@
#include "attributes.h"
#include "xml/repr.h"
-#include "sp-factory.h"
-
-namespace {
- SPObject* createMeshPatch() {
- return new SPMeshPatch();
- }
-
- bool meshPatchRegistered = SPFactory::instance().registerObject("svg:meshPatch", createMeshPatch);
-}
-
SPMeshPatch* SPMeshPatch::getNextMeshPatch()
{
SPMeshPatch *result = 0;
diff --git a/src/sp-mesh-row.cpp b/src/sp-mesh-row.cpp
index 07747f7f5..f95909b63 100644
--- a/src/sp-mesh-row.cpp
+++ b/src/sp-mesh-row.cpp
@@ -19,16 +19,6 @@
#include "xml/repr.h"
-#include "sp-factory.h"
-
-namespace {
- SPObject* createMeshRow() {
- return new SPMeshRow();
- }
-
- bool meshRowRegistered = SPFactory::instance().registerObject("svg:meshRow", createMeshRow);
-}
-
SPMeshRow* SPMeshRow::getNextMeshRow()
{
SPMeshRow *result = 0;
diff --git a/src/sp-metadata.cpp b/src/sp-metadata.cpp
index bf4ce27a1..6bdc2f0b9 100644
--- a/src/sp-metadata.cpp
+++ b/src/sp-metadata.cpp
@@ -33,16 +33,6 @@
/* Metadata base class */
-#include "sp-factory.h"
-
-namespace {
- SPObject* createMetadata() {
- return new SPMetadata();
- }
-
- bool metadataRegistered = SPFactory::instance().registerObject("svg:metadata", createMetadata);
-}
-
SPMetadata::SPMetadata() : SPObject() {
}
diff --git a/src/sp-missing-glyph.cpp b/src/sp-missing-glyph.cpp
index 06b741165..75de55693 100644
--- a/src/sp-missing-glyph.cpp
+++ b/src/sp-missing-glyph.cpp
@@ -19,16 +19,6 @@
#include "sp-missing-glyph.h"
#include "document.h"
-#include "sp-factory.h"
-
-namespace {
- SPObject* createMissingGlyph() {
- return new SPMissingGlyph();
- }
-
- bool missingGlyphRegistered = SPFactory::instance().registerObject("svg:missing-glyph", createMissingGlyph);
-}
-
SPMissingGlyph::SPMissingGlyph() : SPObject() {
//TODO: correct these values:
this->d = NULL;
diff --git a/src/sp-namedview.cpp b/src/sp-namedview.cpp
index dc36e68b9..c26eff39f 100644
--- a/src/sp-namedview.cpp
+++ b/src/sp-namedview.cpp
@@ -56,16 +56,6 @@ static void sp_namedview_show_single_guide(SPGuide* guide, bool show);
static gboolean sp_str_to_bool(const gchar *str);
static gboolean sp_nv_read_opacity(const gchar *str, guint32 *color);
-#include "sp-factory.h"
-
-namespace {
- SPObject* createNamedView() {
- return new SPNamedView();
- }
-
- bool namedViewRegistered = SPFactory::instance().registerObject("sodipodi:namedview", createNamedView);
-}
-
SPNamedView::SPNamedView() : SPObjectGroup(), snap_manager(this) {
this->zoom = 0;
this->guidecolor = 0;
diff --git a/src/sp-object.cpp b/src/sp-object.cpp
index 4b4b05963..d4b8a15c0 100644
--- a/src/sp-object.cpp
+++ b/src/sp-object.cpp
@@ -61,14 +61,6 @@ using std::strstr;
# define debug(f, a...) /* */
#endif
-namespace {
- SPObject* createObject() {
- return new SPObject();
- }
-
- bool gridRegistered = SPFactory::instance().registerObject("inkscape:grid", createObject);
-}
-
guint update_in_progress = 0; // guard against update-during-update
Inkscape::XML::NodeEventVector object_event_vector = {
@@ -629,7 +621,7 @@ void SPObject::child_added(Inkscape::XML::Node *child, Inkscape::XML::Node *ref)
const std::string type_string = NodeTraits::get_type_string(*child);
- SPObject* ochild = SPFactory::instance().createObject(type_string);
+ SPObject* ochild = SPFactory::createObject(type_string);
if (ochild == NULL) {
// Currenty, there are many node types that do not have
// corresponding classes in the SPObject tree.
@@ -688,7 +680,7 @@ void SPObject::build(SPDocument *document, Inkscape::XML::Node *repr) {
for (Inkscape::XML::Node *rchild = repr->firstChild() ; rchild != NULL; rchild = rchild->next()) {
const std::string typeString = NodeTraits::get_type_string(*rchild);
- SPObject* child = SPFactory::instance().createObject(typeString);
+ SPObject* child = SPFactory::createObject(typeString);
if (child == NULL) {
// Currenty, there are many node types that do not have
// corresponding classes in the SPObject tree.
diff --git a/src/sp-offset.cpp b/src/sp-offset.cpp
index 3aa1e4eb6..15d3821c7 100644
--- a/src/sp-offset.cpp
+++ b/src/sp-offset.cpp
@@ -43,16 +43,6 @@
class SPDocument;
-#include "sp-factory.h"
-
-namespace {
- SPObject* createOffset() {
- return new SPOffset();
- }
-
- bool offsetRegistered = SPFactory::instance().registerObject("inkscape:offset", createOffset);
-}
-
#define noOFFSET_VERBOSE
/** \note
diff --git a/src/sp-path.cpp b/src/sp-path.cpp
index 0fef57698..51cc8d6dc 100644
--- a/src/sp-path.cpp
+++ b/src/sp-path.cpp
@@ -51,16 +51,6 @@
#define noPATH_VERBOSE
-#include "sp-factory.h"
-
-namespace {
- SPObject* createPath() {
- return new SPPath();
- }
-
- bool pathRegistered = SPFactory::instance().registerObject("svg:path", createPath);
-}
-
gint SPPath::nodesInPath() const
{
return _curve ? _curve->nodes_in_path() : 0;
diff --git a/src/sp-pattern.cpp b/src/sp-pattern.cpp
index b3aeec7bd..e89ed77ba 100644
--- a/src/sp-pattern.cpp
+++ b/src/sp-pattern.cpp
@@ -45,16 +45,6 @@
static void pattern_ref_changed(SPObject *old_ref, SPObject *ref, SPPattern *pat);
static void pattern_ref_modified (SPObject *ref, guint flags, SPPattern *pattern);
-#include "sp-factory.h"
-
-namespace {
- SPObject* createPattern() {
- return new SPPattern();
- }
-
- bool patternRegistered = SPFactory::instance().registerObject("svg:pattern", createPattern);
-}
-
SPPattern::SPPattern() : SPPaintServer(), SPViewBox() {
this->href = NULL;
diff --git a/src/sp-polygon.cpp b/src/sp-polygon.cpp
index 302905a62..af71280d5 100644
--- a/src/sp-polygon.cpp
+++ b/src/sp-polygon.cpp
@@ -11,8 +11,6 @@
* Released under GNU GPL, read the file 'COPYING' for more information
*/
-#include "config.h"
-
#include "attributes.h"
#include "sp-polygon.h"
#include "display/curve.h"
@@ -25,16 +23,6 @@
#include "xml/repr.h"
#include "document.h"
-#include "sp-factory.h"
-
-namespace {
- SPObject* createPolygon() {
- return new SPPolygon();
- }
-
- bool polygonRegistered = SPFactory::instance().registerObject("svg:polygon", createPolygon);
-}
-
SPPolygon::SPPolygon() : SPShape() {
}
diff --git a/src/sp-polyline.cpp b/src/sp-polyline.cpp
index c80190097..a12f927b5 100644
--- a/src/sp-polyline.cpp
+++ b/src/sp-polyline.cpp
@@ -20,16 +20,6 @@
#include "xml/repr.h"
#include "document.h"
-#include "sp-factory.h"
-
-namespace {
- SPObject* createPolyLine() {
- return new SPPolyLine();
- }
-
- bool polyLineRegistered = SPFactory::instance().registerObject("svg:polyline", createPolyLine);
-}
-
SPPolyLine::SPPolyLine() : SPShape() {
}
diff --git a/src/sp-radial-gradient.cpp b/src/sp-radial-gradient.cpp
index 2c2b17b7d..8fb230ba7 100644
--- a/src/sp-radial-gradient.cpp
+++ b/src/sp-radial-gradient.cpp
@@ -5,17 +5,7 @@
#include "attributes.h"
#include "xml/repr.h"
-#include "2geom/transforms.h"
-
-#include "sp-factory.h"
-
-namespace {
- SPObject* createRadialGradient() {
- return new SPRadialGradient();
- }
-
- bool radialGradientRegistered = SPFactory::instance().registerObject("svg:radialGradient", createRadialGradient);
-}
+#include <2geom/transforms.h>
/*
* Radial Gradient
diff --git a/src/sp-rect.cpp b/src/sp-rect.cpp
index af3e2bfb4..361d3c8c0 100644
--- a/src/sp-rect.cpp
+++ b/src/sp-rect.cpp
@@ -31,16 +31,6 @@
#define noRECT_VERBOSE
-#include "sp-factory.h"
-
-namespace {
- SPObject* createRect() {
- return new SPRect();
- }
-
- bool rectRegistered = SPFactory::instance().registerObject("svg:rect", createRect);
-}
-
SPRect::SPRect() : SPShape() {
}
diff --git a/src/sp-root.cpp b/src/sp-root.cpp
index 3a39a51c1..8bedec0a5 100644
--- a/src/sp-root.cpp
+++ b/src/sp-root.cpp
@@ -13,10 +13,6 @@
* Released under GNU GPL, read the file 'COPYING' for more information
*/
-#ifdef HAVE_CONFIG_H
-# include "config.h"
-#endif
-
#include <string>
#include <2geom/transforms.h>
@@ -32,17 +28,6 @@
#include "xml/repr.h"
#include "util/units.h"
-#include "sp-factory.h"
-
-namespace {
-SPObject *createRoot()
-{
- return new SPRoot();
-}
-
-bool rootRegistered = SPFactory::instance().registerObject("svg:svg", createRoot);
-}
-
SPRoot::SPRoot() : SPGroup(), SPViewBox()
{
this->onload = NULL;
diff --git a/src/sp-script.cpp b/src/sp-script.cpp
index 260b3dcfd..f1ea9c9bd 100644
--- a/src/sp-script.cpp
+++ b/src/sp-script.cpp
@@ -16,16 +16,6 @@
#include <cstring>
#include "document.h"
-#include "sp-factory.h"
-
-namespace {
- SPObject* createScript() {
- return new SPScript();
- }
-
- bool scriptRegistered = SPFactory::instance().registerObject("svg:script", createScript);
-}
-
SPScript::SPScript() : SPObject() {
this->xlinkhref = NULL;
}
diff --git a/src/sp-shape.cpp b/src/sp-shape.cpp
index 16f9ec13b..78135d459 100644
--- a/src/sp-shape.cpp
+++ b/src/sp-shape.cpp
@@ -47,7 +47,7 @@
#include "bad-uri-exception.h"
#include "xml/repr.h"
-#include "util/mathfns.h" // for triangle_area()
+#include "helper/mathfns.h" // for triangle_area()
#include "splivarot.h" // for bounding box calculation
diff --git a/src/sp-solid-color.cpp b/src/sp-solid-color.cpp
index 72569d8c0..f319410b0 100644
--- a/src/sp-solid-color.cpp
+++ b/src/sp-solid-color.cpp
@@ -16,18 +16,9 @@
#include "style.h"
#include "xml/repr.h"
-#include "sp-factory.h"
#include "sp-item.h"
#include "style-internal.h"
-namespace {
- SPObject* createSolidColor() {
- return new SPSolidColor();
- }
-
- bool solidColorRegistered = SPFactory::instance().registerObject("svg:solidColor", createSolidColor);
-}
-
/*
* Solid Color
diff --git a/src/sp-spiral.cpp b/src/sp-spiral.cpp
index 9ef73d56d..5dbd7dfa0 100644
--- a/src/sp-spiral.cpp
+++ b/src/sp-spiral.cpp
@@ -28,16 +28,6 @@
#include "sp-spiral.h"
-#include "sp-factory.h"
-
-namespace {
- SPObject* createSpiral() {
- return new SPSpiral();
- }
-
- bool spiralRegistered = SPFactory::instance().registerObject("spiral", createSpiral);
-}
-
SPSpiral::SPSpiral()
: SPShape()
, cx(0)
diff --git a/src/sp-star.cpp b/src/sp-star.cpp
index 97a690520..51d5e6254 100644
--- a/src/sp-star.cpp
+++ b/src/sp-star.cpp
@@ -32,16 +32,6 @@
#include "sp-star.h"
-#include "sp-factory.h"
-
-namespace {
- SPObject* createStar() {
- return new SPStar();
- }
-
- bool starRegistered = SPFactory::instance().registerObject("star", createStar);
-}
-
SPStar::SPStar() : SPPolygon() {
this->sides = 5;
this->center = Geom::Point(0, 0);
diff --git a/src/sp-stop.cpp b/src/sp-stop.cpp
index 3ee467322..5e8fed86c 100644
--- a/src/sp-stop.cpp
+++ b/src/sp-stop.cpp
@@ -24,16 +24,6 @@
#include "svg/css-ostringstream.h"
#include "xml/repr.h"
-#include "sp-factory.h"
-
-namespace {
- SPObject* createStop() {
- return new SPStop();
- }
-
- bool stopRegistered = SPFactory::instance().registerObject("svg:stop", createStop);
-}
-
SPStop::SPStop() : SPObject() {
this->path_string = NULL;
diff --git a/src/sp-string.cpp b/src/sp-string.cpp
index b561187d0..26bb44006 100644
--- a/src/sp-string.cpp
+++ b/src/sp-string.cpp
@@ -22,30 +22,13 @@
*
*/
-
-
-#ifdef HAVE_CONFIG_H
-# include "config.h"
-#endif
-
-
#include "sp-string.h"
#include "style.h"
#include "xml/repr.h"
-#include "sp-factory.h"
-
#include <iostream>
-namespace {
- SPObject* createString() {
- return new SPString();
- }
-
- bool stringRegistered = SPFactory::instance().registerObject("string", createString);
-}
-
/*#####################################################
# SPSTRING
#####################################################*/
diff --git a/src/sp-style-elem.cpp b/src/sp-style-elem.cpp
index 668780272..80e45677c 100644
--- a/src/sp-style-elem.cpp
+++ b/src/sp-style-elem.cpp
@@ -7,16 +7,6 @@
#include "style.h"
using Inkscape::XML::TEXT_NODE;
-#include "sp-factory.h"
-
-namespace {
- SPObject* createStyle() {
- return new SPStyleElem();
- }
-
- bool styleRegistered = SPFactory::instance().registerObject("svg:style", createStyle);
-}
-
SPStyleElem::SPStyleElem() : SPObject() {
media_set_all(this->media);
this->is_css = false;
diff --git a/src/sp-switch.cpp b/src/sp-switch.cpp
index f252438a4..cfc0e7d8b 100644
--- a/src/sp-switch.cpp
+++ b/src/sp-switch.cpp
@@ -12,10 +12,6 @@
* Released under GNU GPL, read the file 'COPYING' for more information
*/
-#ifdef HAVE_CONFIG_H
-# include "config.h"
-#endif
-
#include <glibmm/i18n.h>
#include "sp-switch.h"
@@ -25,16 +21,6 @@
#include <sigc++/functors/ptr_fun.h>
#include <sigc++/adaptors/bind.h>
-#include "sp-factory.h"
-
-namespace {
- SPObject* createSwitch() {
- return new SPSwitch();
- }
-
- bool switchRegistered = SPFactory::instance().registerObject("svg:switch", createSwitch);
-}
-
SPSwitch::SPSwitch() : SPGroup() {
this->_cached_item = 0;
}
diff --git a/src/sp-symbol.cpp b/src/sp-symbol.cpp
index 3156680b3..62fb232a3 100644
--- a/src/sp-symbol.cpp
+++ b/src/sp-symbol.cpp
@@ -26,16 +26,6 @@
#include "sp-symbol.h"
#include "document.h"
-#include "sp-factory.h"
-
-namespace {
- SPObject* createSymbol() {
- return new SPSymbol();
- }
-
- bool symbolRegistered = SPFactory::instance().registerObject("svg:symbol", createSymbol);
-}
-
SPSymbol::SPSymbol() : SPGroup(), SPViewBox() {
}
diff --git a/src/sp-tag-use-reference.cpp b/src/sp-tag-use-reference.cpp
index 50c011812..220cd16d1 100644
--- a/src/sp-tag-use-reference.cpp
+++ b/src/sp-tag-use-reference.cpp
@@ -20,16 +20,6 @@
#include "sp-text.h"
#include "uri.h"
-#if 0
-namespace {
- SPObject* createTagUseReference() {
- return new SPTag();
- }
- bool tagUseReferencesRegistered = SPFactory::instance().registerObject("inkscape:tag", createTag);
-}
-// this SPObject doesn't need to be registered
-#endif
-
bool SPTagUseReference::_acceptObject(SPObject * const obj) const
{
diff --git a/src/sp-tag-use.cpp b/src/sp-tag-use.cpp
index 5851598f2..935f7429e 100644
--- a/src/sp-tag-use.cpp
+++ b/src/sp-tag-use.cpp
@@ -10,10 +10,6 @@
* Released under GNU GPL, read the file 'COPYING' for more information
*/
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
#include <cstring>
#include <string>
@@ -30,13 +26,6 @@
#include "sp-tag-use.h"
#include "sp-tag-use-reference.h"
-namespace {
- SPObject* createTagUse() {
- return new SPTagUse();
- }
- bool tagUseRegistered = SPFactory::instance().registerObject("inkscape:tagref", createTagUse);
-}
-
SPTagUse::SPTagUse()
{
href = NULL;
@@ -173,7 +162,7 @@ SPTagUse::href_changed(SPObject */*old_ref*/, SPObject */*ref*/)
Inkscape::XML::Node *childrepr = refobj->getRepr();
const std::string typeString = NodeTraits::get_type_string(*childrepr);
- SPObject* child_ = SPFactory::instance().createObject(typeString);
+ SPObject* child_ = SPFactory::createObject(typeString);
if (child_) {
child = child_;
attach(child_, lastChild());
diff --git a/src/sp-tag.cpp b/src/sp-tag.cpp
index c4b40417f..d331e6b18 100644
--- a/src/sp-tag.cpp
+++ b/src/sp-tag.cpp
@@ -10,23 +10,11 @@
* Released under GNU GPL, read the file 'COPYING' for more information
*/
-#ifdef HAVE_CONFIG_H
-# include "config.h"
-#endif
-
#include "attributes.h"
-#include "sp-factory.h"
#include "sp-tag.h"
#include "xml/repr.h"
#include <cstring>
-namespace {
- SPObject* createTag() {
- return new SPTag();
- }
- bool tagsRegistered = SPFactory::instance().registerObject("inkscape:tag", createTag);
-}
-
/*
* Move this SPItem into or after another SPItem in the doc
* \param target - the SPItem to move into or after
diff --git a/src/sp-text.cpp b/src/sp-text.cpp
index e40661824..0dca42bb4 100644
--- a/src/sp-text.cpp
+++ b/src/sp-text.cpp
@@ -23,10 +23,6 @@
*
*/
-#ifdef HAVE_CONFIG_H
-# include "config.h"
-#endif
-
#include <2geom/affine.h>
#include <libnrtype/FontFactory.h>
#include <libnrtype/font-instance.h>
@@ -55,22 +51,12 @@
#include "text-editing.h"
-#include "sp-factory.h"
-
// For SVG 2 text flow
#include "livarot/Path.h"
#include "livarot/Shape.h"
#include "sp-shape.h"
#include "display/curve.h"
-namespace {
- SPObject* createText() {
- return new SPText();
- }
-
- bool textRegistered = SPFactory::instance().registerObject("svg:text", createText);
-}
-
/*#####################################################
# SPTEXT
#####################################################*/
diff --git a/src/sp-title.cpp b/src/sp-title.cpp
index 4ecfcfa8e..ba5ae754a 100644
--- a/src/sp-title.cpp
+++ b/src/sp-title.cpp
@@ -9,23 +9,9 @@
* Released under GNU GPL, read the file 'COPYING' for more information
*/
-#ifdef HAVE_CONFIG_H
-# include "config.h"
-#endif
-
#include "sp-title.h"
#include "xml/repr.h"
-#include "sp-factory.h"
-
-namespace {
- SPObject* createTitle() {
- return new SPTitle();
- }
-
- bool titleRegistered = SPFactory::instance().registerObject("svg:title", createTitle);
-}
-
SPTitle::SPTitle() : SPObject() {
}
diff --git a/src/sp-tref.cpp b/src/sp-tref.cpp
index 6a229e170..aef18462a 100644
--- a/src/sp-tref.cpp
+++ b/src/sp-tref.cpp
@@ -16,10 +16,6 @@
* Released under GNU GPL, read the file 'COPYING' for more information
*/
-#ifdef HAVE_CONFIG_H
-# include "config.h"
-#endif
-
#include <glibmm/i18n.h>
#include "attributes.h"
@@ -35,14 +31,6 @@
#include "xml/node.h"
#include "xml/repr.h"
-namespace {
- SPObject* createTRef() {
- return new SPTRef();
- }
-
- bool trefRegistered = SPFactory::instance().registerObject("svg:tref", createTRef);
-}
-
//#define DEBUG_TREF
#ifdef DEBUG_TREF
# define debug(f, a...) { g_message("%s(%d) %s:", \
@@ -413,7 +401,7 @@ void sp_tref_update_text(SPTRef *tref)
Inkscape::XML::Document *xml_doc = tref->document->getReprDoc();
Inkscape::XML::Node *newStringRepr = xml_doc->createTextNode(charData.c_str());
- tref->stringChild = SPFactory::instance().createObject(NodeTraits::get_type_string(*newStringRepr));
+ tref->stringChild = SPFactory::createObject(NodeTraits::get_type_string(*newStringRepr));
// Add this SPString as a child of the tref
tref->attach(tref->stringChild, tref->lastChild());
diff --git a/src/sp-tspan.cpp b/src/sp-tspan.cpp
index 147efff33..7582cb9e6 100644
--- a/src/sp-tspan.cpp
+++ b/src/sp-tspan.cpp
@@ -44,21 +44,6 @@
#include "document.h"
#include "2geom/transforms.h"
-#include "sp-factory.h"
-
-namespace {
- SPObject* createTSpan() {
- return new SPTSpan();
- }
-
- SPObject* createTextPath() {
- return new SPTextPath();
- }
-
- bool tspanRegistered = SPFactory::instance().registerObject("svg:tspan", createTSpan);
- bool textPathRegistered = SPFactory::instance().registerObject("svg:textPath", createTextPath);
-}
-
/*#####################################################
# SPTSPAN
#####################################################*/
diff --git a/src/sp-use.cpp b/src/sp-use.cpp
index 7e02de3c1..239f487a4 100644
--- a/src/sp-use.cpp
+++ b/src/sp-use.cpp
@@ -13,10 +13,6 @@
* Released under GNU GPL, read the file 'COPYING' for more information
*/
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
#include <cstring>
#include <string>
@@ -42,14 +38,6 @@
#include "sp-text.h"
#include "sp-flowtext.h"
-namespace {
- SPObject* createUse() {
- return new SPUse();
- }
-
- bool useRegistered = SPFactory::instance().registerObject("svg:use", createUse);
-}
-
SPUse::SPUse()
: SPItem(),
child(NULL),
@@ -482,7 +470,7 @@ void SPUse::href_changed() {
if (refobj) {
Inkscape::XML::Node *childrepr = refobj->getRepr();
- SPObject* obj = SPFactory::instance().createObject(NodeTraits::get_type_string(*childrepr));
+ SPObject* obj = SPFactory::createObject(NodeTraits::get_type_string(*childrepr));
SPItem *item = dynamic_cast<SPItem *>(obj);
if (item) {
diff --git a/src/ui/CMakeLists.txt b/src/ui/CMakeLists.txt
index 98a5a224c..674254686 100644
--- a/src/ui/CMakeLists.txt
+++ b/src/ui/CMakeLists.txt
@@ -8,6 +8,7 @@ set(ui_SRC
object-edit.cpp
previewholder.cpp
shape-editor.cpp
+ tool-factory.cpp
tools-switch.cpp
uxmanager.cpp
diff --git a/src/ui/Makefile_insert b/src/ui/Makefile_insert
index 7aeb4a83d..f94cba4e9 100644
--- a/src/ui/Makefile_insert
+++ b/src/ui/Makefile_insert
@@ -21,6 +21,7 @@ ink_common_sources += \
ui/previewholder.h \
ui/shape-editor.cpp \
ui/shape-editor.h \
+ ui/tool-factory.cpp \
ui/tool-factory.h \
ui/tools-switch.cpp \
ui/tools-switch.h \
diff --git a/src/ui/clipboard.cpp b/src/ui/clipboard.cpp
index 3fe935e7d..a3620b754 100644
--- a/src/ui/clipboard.cpp
+++ b/src/ui/clipboard.cpp
@@ -32,7 +32,7 @@
#include <glibmm/ustring.h>
#include <glibmm/i18n.h>
#include <glib/gstdio.h> // for g_file_set_contents etc., used in _onGet and paste
-#include "gc-core.h"
+#include "inkgc/gc-core.h"
#include "xml/repr.h"
#include "inkscape.h"
#include "io/stringstream.h"
diff --git a/src/ui/dialog/filedialog.cpp b/src/ui/dialog/filedialog.cpp
index 00ed09551..4e4b0278a 100644
--- a/src/ui/dialog/filedialog.cpp
+++ b/src/ui/dialog/filedialog.cpp
@@ -19,7 +19,7 @@
#include "filedialogimpl-gtkmm.h"
#include "filedialog.h"
-#include "gc-core.h"
+#include "inkgc/gc-core.h"
#include "ui/dialog-events.h"
#include "extension/output.h"
#include "preferences.h"
diff --git a/src/ui/dialog/filedialogimpl-win32.h b/src/ui/dialog/filedialogimpl-win32.h
index f77249abd..8c3b6bad6 100644
--- a/src/ui/dialog/filedialogimpl-win32.h
+++ b/src/ui/dialog/filedialogimpl-win32.h
@@ -24,7 +24,7 @@
#include "filedialogimpl-gtkmm.h"
-#include "gc-core.h"
+#include "inkgc/gc-core.h"
// define WINVER high enough so we get the correct OPENFILENAMEW size
#ifndef WINVER
#define WINVER 0x0500
diff --git a/src/ui/dialog/memory.cpp b/src/ui/dialog/memory.cpp
index 0008eb284..c0bc884fa 100644
--- a/src/ui/dialog/memory.cpp
+++ b/src/ui/dialog/memory.cpp
@@ -20,7 +20,7 @@
#include <gtkmm/liststore.h>
#include <gtkmm/treeview.h>
-#include "gc-core.h"
+#include "inkgc/gc-core.h"
#include "debug/heap.h"
#include "verbs.h"
diff --git a/src/ui/dialog/ocaldialogs.cpp b/src/ui/dialog/ocaldialogs.cpp
index c4dd9df98..a1c7d41bd 100644
--- a/src/ui/dialog/ocaldialogs.cpp
+++ b/src/ui/dialog/ocaldialogs.cpp
@@ -26,7 +26,7 @@
#include "path-prefix.h"
#include "filedialogimpl-gtkmm.h"
#include "ui/interface.h"
-#include "gc-core.h"
+#include "inkgc/gc-core.h"
#include "ui/dialog-events.h"
#include "io/sys.h"
#include "preferences.h"
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 :
diff --git a/src/ui/tool-factory.h b/src/ui/tool-factory.h
index 726706732..3b041fec5 100644
--- a/src/ui/tool-factory.h
+++ b/src/ui/tool-factory.h
@@ -1,6 +1,6 @@
-/** @file
+/*
* Factory for ToolBase tree
- *//*
+ *
* Authors:
* Markus Engel
*
@@ -11,7 +11,7 @@
#ifndef TOOL_FACTORY_SEEN
#define TOOL_FACTORY_SEEN
-#include "factory.h"
+#include <string>
namespace Inkscape {
namespace UI {
@@ -23,7 +23,9 @@ class ToolBase;
}
}
-typedef Singleton< Factory<Inkscape::UI::Tools::ToolBase> > ToolFactory;
+struct ToolFactory {
+ static Inkscape::UI::Tools::ToolBase *createObject(std::string const& id);
+};
#endif
diff --git a/src/ui/tools/arc-tool.cpp b/src/ui/tools/arc-tool.cpp
index b9206407a..c6a9bb23a 100644
--- a/src/ui/tools/arc-tool.cpp
+++ b/src/ui/tools/arc-tool.cpp
@@ -48,20 +48,10 @@
using Inkscape::DocumentUndo;
-#include "ui/tool-factory.h"
-
namespace Inkscape {
namespace UI {
namespace Tools {
-namespace {
- ToolBase* createArcContext() {
- return new ArcTool();
- }
-
- bool arcContextRegistered = ToolFactory::instance().registerObject("/tools/shapes/arc", createArcContext);
-}
-
const std::string& ArcTool::getPrefsPath() {
return ArcTool::prefsPath;
}
diff --git a/src/ui/tools/box3d-tool.cpp b/src/ui/tools/box3d-tool.cpp
index f8ae685c4..538e0c7e2 100644
--- a/src/ui/tools/box3d-tool.cpp
+++ b/src/ui/tools/box3d-tool.cpp
@@ -52,20 +52,10 @@
using Inkscape::DocumentUndo;
-#include "ui/tool-factory.h"
-
namespace Inkscape {
namespace UI {
namespace Tools {
-namespace {
- ToolBase* createBox3dTool() {
- return new Box3dTool();
- }
-
- bool Box3dToolRegistered = ToolFactory::instance().registerObject("/tools/shapes/3dbox", createBox3dTool);
-}
-
const std::string& Box3dTool::getPrefsPath() {
return Box3dTool::prefsPath;
}
diff --git a/src/ui/tools/calligraphic-tool.cpp b/src/ui/tools/calligraphic-tool.cpp
index 151ab5f89..15e6527a3 100644
--- a/src/ui/tools/calligraphic-tool.cpp
+++ b/src/ui/tools/calligraphic-tool.cpp
@@ -82,22 +82,12 @@ using Inkscape::DocumentUndo;
#define DYNA_MIN_WIDTH 1.0e-6
-#include "ui/tool-factory.h"
-
namespace Inkscape {
namespace UI {
namespace Tools {
static void add_cap(SPCurve *curve, Geom::Point const &from, Geom::Point const &to, double rounding);
-namespace {
- ToolBase* createCalligraphicContext() {
- return new CalligraphicTool();
- }
-
- bool calligraphicContextRegistered = ToolFactory::instance().registerObject("/tools/calligraphic", createCalligraphicContext);
-}
-
const std::string& CalligraphicTool::getPrefsPath() {
return CalligraphicTool::prefsPath;
}
diff --git a/src/ui/tools/connector-tool.cpp b/src/ui/tools/connector-tool.cpp
index f48e572df..19094e3f7 100644
--- a/src/ui/tools/connector-tool.cpp
+++ b/src/ui/tools/connector-tool.cpp
@@ -109,8 +109,6 @@
using Inkscape::DocumentUndo;
-#include "ui/tool-factory.h"
-
namespace Inkscape {
namespace UI {
namespace Tools {
@@ -147,14 +145,6 @@ static Inkscape::XML::NodeEventVector layer_repr_events = {
NULL /* order_changed */
};
-namespace {
- ToolBase* createConnectorContext() {
- return new ConnectorTool();
- }
-
- bool connectorContextRegistered = ToolFactory::instance().registerObject("/tools/connector", createConnectorContext);
-}
-
const std::string& ConnectorTool::getPrefsPath() {
return ConnectorTool::prefsPath;
}
diff --git a/src/ui/tools/dropper-tool.cpp b/src/ui/tools/dropper-tool.cpp
index 9038628ee..bda9d8e8a 100644
--- a/src/ui/tools/dropper-tool.cpp
+++ b/src/ui/tools/dropper-tool.cpp
@@ -52,20 +52,10 @@ using Inkscape::DocumentUndo;
static GdkCursor *cursor_dropper_fill = NULL;
static GdkCursor *cursor_dropper_stroke = NULL;
-#include "ui/tool-factory.h"
-
namespace Inkscape {
namespace UI {
namespace Tools {
-namespace {
- ToolBase* createDropperContext() {
- return new DropperTool();
- }
-
- bool dropperContextRegistered = ToolFactory::instance().registerObject("/tools/dropper", createDropperContext);
-}
-
const std::string& DropperTool::getPrefsPath() {
return DropperTool::prefsPath;
}
diff --git a/src/ui/tools/eraser-tool.cpp b/src/ui/tools/eraser-tool.cpp
index adbbb2bd3..01b75fdb4 100644
--- a/src/ui/tools/eraser-tool.cpp
+++ b/src/ui/tools/eraser-tool.cpp
@@ -84,20 +84,10 @@ using Inkscape::DocumentUndo;
#define DRAG_DEFAULT 1.0
#define DRAG_MAX 1.0
-#include "ui/tool-factory.h"
-
namespace Inkscape {
namespace UI {
namespace Tools {
-namespace {
- ToolBase* createEraserContext() {
- return new EraserTool();
- }
-
- bool eraserContextRegistered = ToolFactory::instance().registerObject("/tools/eraser", createEraserContext);
-}
-
const std::string& EraserTool::getPrefsPath() {
return EraserTool::prefsPath;
}
diff --git a/src/ui/tools/flood-tool.cpp b/src/ui/tools/flood-tool.cpp
index f9b64e4fd..bb8782dfa 100644
--- a/src/ui/tools/flood-tool.cpp
+++ b/src/ui/tools/flood-tool.cpp
@@ -74,20 +74,10 @@ using Inkscape::Display::ExtractARGB32;
using Inkscape::Display::ExtractRGB32;
using Inkscape::Display::AssembleARGB32;
-#include "ui/tool-factory.h"
-
namespace Inkscape {
namespace UI {
namespace Tools {
-namespace {
- ToolBase* createPaintbucketContext() {
- return new FloodTool();
- }
-
- bool paintbucketContextRegistered = ToolFactory::instance().registerObject("/tools/paintbucket", createPaintbucketContext);
-}
-
const std::string& FloodTool::getPrefsPath() {
return FloodTool::prefsPath;
}
diff --git a/src/ui/tools/gradient-tool.cpp b/src/ui/tools/gradient-tool.cpp
index a9e109b5c..cae525bfb 100644
--- a/src/ui/tools/gradient-tool.cpp
+++ b/src/ui/tools/gradient-tool.cpp
@@ -51,22 +51,12 @@
using Inkscape::DocumentUndo;
-#include "ui/tool-factory.h"
-
namespace Inkscape {
namespace UI {
namespace Tools {
static void sp_gradient_drag(GradientTool &rc, Geom::Point const pt, guint state, guint32 etime);
-namespace {
- ToolBase* createGradientContext() {
- return new GradientTool();
- }
-
- bool gradientContextRegistered = ToolFactory::instance().registerObject("/tools/gradient", createGradientContext);
-}
-
const std::string& GradientTool::getPrefsPath() {
return GradientTool::prefsPath;
}
diff --git a/src/ui/tools/lpe-tool.cpp b/src/ui/tools/lpe-tool.cpp
index 290eeef87..13e47f3a6 100644
--- a/src/ui/tools/lpe-tool.cpp
+++ b/src/ui/tools/lpe-tool.cpp
@@ -58,23 +58,12 @@ SubtoolEntry lpesubtools[] = {
{Inkscape::LivePathEffect::MIRROR_SYMMETRY, "draw-geometry-mirror"}
};
-
-#include "ui/tool-factory.h"
-
namespace Inkscape {
namespace UI {
namespace Tools {
void sp_lpetool_context_selection_changed(Inkscape::Selection *selection, gpointer data);
-namespace {
- ToolBase* createLPEToolContext() {
- return new LpeTool();
- }
-
- bool lpetoolContextRegistered = ToolFactory::instance().registerObject("/tools/lpetool", createLPEToolContext);
-}
-
const std::string& LpeTool::getPrefsPath() {
return LpeTool::prefsPath;
}
diff --git a/src/ui/tools/measure-tool.cpp b/src/ui/tools/measure-tool.cpp
index 5295a16c0..570f3e796 100644
--- a/src/ui/tools/measure-tool.cpp
+++ b/src/ui/tools/measure-tool.cpp
@@ -49,22 +49,12 @@ using Inkscape::ControlManager;
using Inkscape::CTLINE_SECONDARY;
using Inkscape::Util::unit_table;
-#include "ui/tool-factory.h"
-
namespace Inkscape {
namespace UI {
namespace Tools {
std::vector<Inkscape::Display::TemporaryItem*> measure_tmp_items;
-namespace {
- ToolBase* createMeasureContext() {
- return new MeasureTool();
- }
-
- bool measureContextRegistered = ToolFactory::instance().registerObject("/tools/measure", createMeasureContext);
-}
-
const std::string& MeasureTool::getPrefsPath() {
return MeasureTool::prefsPath;
}
diff --git a/src/ui/tools/mesh-tool.cpp b/src/ui/tools/mesh-tool.cpp
index 2c817694e..af341a9aa 100644
--- a/src/ui/tools/mesh-tool.cpp
+++ b/src/ui/tools/mesh-tool.cpp
@@ -53,22 +53,12 @@
using Inkscape::DocumentUndo;
-#include "ui/tool-factory.h"
-
namespace Inkscape {
namespace UI {
namespace Tools {
static void sp_mesh_drag(MeshTool &rc, Geom::Point const pt, guint state, guint32 etime);
-namespace {
- ToolBase* createMeshContext() {
- return new MeshTool();
- }
-
- bool meshContextRegistered = ToolFactory::instance().registerObject("/tools/mesh", createMeshContext);
-}
-
const std::string& MeshTool::getPrefsPath() {
return MeshTool::prefsPath;
}
diff --git a/src/ui/tools/node-tool.cpp b/src/ui/tools/node-tool.cpp
index 374386686..40d54af6e 100644
--- a/src/ui/tools/node-tool.cpp
+++ b/src/ui/tools/node-tool.cpp
@@ -107,20 +107,10 @@
using Inkscape::ControlManager;
-#include "ui/tool-factory.h"
-
namespace Inkscape {
namespace UI {
namespace Tools {
-namespace {
- ToolBase* createNodesContext() {
- return new NodeTool();
- }
-
- bool nodesContextRegistered = ToolFactory::instance().registerObject("/tools/nodes", createNodesContext);
-}
-
const std::string& NodeTool::getPrefsPath() {
return NodeTool::prefsPath;
}
diff --git a/src/ui/tools/pen-tool.cpp b/src/ui/tools/pen-tool.cpp
index 5174775c9..d28b7c27a 100644
--- a/src/ui/tools/pen-tool.cpp
+++ b/src/ui/tools/pen-tool.cpp
@@ -73,8 +73,6 @@
#include "live_effects/lpe-bspline.h"
#include <2geom/nearest-point.h>
-#include "ui/tool-factory.h"
-
#include "live_effects/effect.h"
@@ -88,13 +86,6 @@ static Geom::Point pen_drag_origin_w(0, 0);
static bool pen_within_tolerance = false;
static int pen_last_paraxial_dir = 0; // last used direction in horizontal/vertical mode; 0 = horizontal, 1 = vertical
const double handleCubicGap = 0.01;
-namespace {
- ToolBase* createPenContext() {
- return new PenTool();
- }
-
- bool penContextRegistered = ToolFactory::instance().registerObject("/tools/freehand/pen", createPenContext);
-}
const std::string& PenTool::getPrefsPath() {
return PenTool::prefsPath;
diff --git a/src/ui/tools/pencil-tool.cpp b/src/ui/tools/pencil-tool.cpp
index 28fed3a8f..db24c7432 100644
--- a/src/ui/tools/pencil-tool.cpp
+++ b/src/ui/tools/pencil-tool.cpp
@@ -43,7 +43,6 @@
#include "display/sp-canvas.h"
#include "display/curve.h"
#include "livarot/Path.h"
-#include "ui/tool-factory.h"
#include "ui/tool/event-utils.h"
namespace Inkscape {
@@ -55,14 +54,6 @@ static bool pencil_within_tolerance = false;
static bool in_svg_plane(Geom::Point const &p) { return Geom::LInfty(p) < 1e18; }
-namespace {
- ToolBase* createPencilContext() {
- return new PencilTool();
- }
-
- bool pencilContextRegistered = ToolFactory::instance().registerObject("/tools/freehand/pencil", createPencilContext);
-}
-
const std::string& PencilTool::getPrefsPath() {
return PencilTool::prefsPath;
}
diff --git a/src/ui/tools/rect-tool.cpp b/src/ui/tools/rect-tool.cpp
index 9476ff624..62a9006ea 100644
--- a/src/ui/tools/rect-tool.cpp
+++ b/src/ui/tools/rect-tool.cpp
@@ -46,20 +46,10 @@
using Inkscape::DocumentUndo;
-#include "ui/tool-factory.h"
-
namespace Inkscape {
namespace UI {
namespace Tools {
-namespace {
- ToolBase* createRectContext() {
- return new RectTool();
- }
-
- bool rectContextRegistered = ToolFactory::instance().registerObject("/tools/shapes/rect", createRectContext);
-}
-
const std::string& RectTool::getPrefsPath() {
return RectTool::prefsPath;
}
diff --git a/src/ui/tools/select-tool.cpp b/src/ui/tools/select-tool.cpp
index fbc1a9e6c..f8375a1bb 100644
--- a/src/ui/tools/select-tool.cpp
+++ b/src/ui/tools/select-tool.cpp
@@ -49,7 +49,6 @@
#include "display/sp-canvas.h"
#include "display/sp-canvas-item.h"
#include "display/drawing-item.h"
-#include "ui/tool-factory.h"
using Inkscape::DocumentUndo;
@@ -65,14 +64,6 @@ static GdkCursor *CursorSelectDragging = NULL;
static gint rb_escaped = 0; // if non-zero, rubberband was canceled by esc, so the next button release should not deselect
static gint drag_escaped = 0; // if non-zero, drag was canceled by esc
-namespace {
- ToolBase* createSelectContext() {
- return new SelectTool();
- }
-
- bool selectContextRegistered = ToolFactory::instance().registerObject("/tools/select", createSelectContext);
-}
-
const std::string& SelectTool::getPrefsPath() {
return SelectTool::prefsPath;
}
diff --git a/src/ui/tools/spiral-tool.cpp b/src/ui/tools/spiral-tool.cpp
index f208e1c43..833fef18d 100644
--- a/src/ui/tools/spiral-tool.cpp
+++ b/src/ui/tools/spiral-tool.cpp
@@ -45,20 +45,10 @@
using Inkscape::DocumentUndo;
-#include "ui/tool-factory.h"
-
namespace Inkscape {
namespace UI {
namespace Tools {
-namespace {
- ToolBase* createSpiralContext() {
- return new SpiralTool();
- }
-
- bool spiralContextRegistered = ToolFactory::instance().registerObject("/tools/shapes/spiral", createSpiralContext);
-}
-
const std::string& SpiralTool::getPrefsPath() {
return SpiralTool::prefsPath;
}
diff --git a/src/ui/tools/spray-tool.cpp b/src/ui/tools/spray-tool.cpp
index d92d326e0..39321ff21 100644
--- a/src/ui/tools/spray-tool.cpp
+++ b/src/ui/tools/spray-tool.cpp
@@ -84,20 +84,10 @@ using namespace std;
// Please enable again when working on 1.0
#define ENABLE_SPRAY_MODE_SINGLE_PATH
-#include "ui/tool-factory.h"
-
namespace Inkscape {
namespace UI {
namespace Tools {
-namespace {
- ToolBase* createSprayContext() {
- return new SprayTool();
- }
-
- bool sprayContextRegistered = ToolFactory::instance().registerObject("/tools/spray", createSprayContext);
-}
-
const std::string& SprayTool::getPrefsPath() {
return SprayTool::prefsPath;
}
diff --git a/src/ui/tools/star-tool.cpp b/src/ui/tools/star-tool.cpp
index df311f2d8..9190ae57b 100644
--- a/src/ui/tools/star-tool.cpp
+++ b/src/ui/tools/star-tool.cpp
@@ -49,20 +49,10 @@
using Inkscape::DocumentUndo;
-#include "ui/tool-factory.h"
-
namespace Inkscape {
namespace UI {
namespace Tools {
-namespace {
- ToolBase* createStarContext() {
- return new StarTool();
- }
-
- bool starContextRegistered = ToolFactory::instance().registerObject("/tools/shapes/star", createStarContext);
-}
-
const std::string& StarTool::getPrefsPath() {
return StarTool::prefsPath;
}
diff --git a/src/ui/tools/text-tool.cpp b/src/ui/tools/text-tool.cpp
index 48c109688..1888551cf 100644
--- a/src/ui/tools/text-tool.cpp
+++ b/src/ui/tools/text-tool.cpp
@@ -52,7 +52,6 @@
#include "xml/node-event-vector.h"
#include "xml/repr.h"
#include <gtk/gtk.h>
-#include "ui/tool-factory.h"
using Inkscape::ControlManager;
using Inkscape::DocumentUndo;
@@ -71,14 +70,6 @@ static gint sptc_focus_in(GtkWidget *widget, GdkEventFocus *event, TextTool *tc)
static gint sptc_focus_out(GtkWidget *widget, GdkEventFocus *event, TextTool *tc);
static void sptc_commit(GtkIMContext *imc, gchar *string, TextTool *tc);
-namespace {
- ToolBase* createTextContext() {
- return new TextTool();
- }
-
- bool textContextRegistered = ToolFactory::instance().registerObject("/tools/text", createTextContext);
-}
-
const std::string& TextTool::getPrefsPath() {
return TextTool::prefsPath;
}
diff --git a/src/ui/tools/tweak-tool.cpp b/src/ui/tools/tweak-tool.cpp
index 8c5e4215e..76c748ae0 100644
--- a/src/ui/tools/tweak-tool.cpp
+++ b/src/ui/tools/tweak-tool.cpp
@@ -91,20 +91,10 @@ using Inkscape::DocumentUndo;
#define DYNA_MIN_WIDTH 1.0e-6
-#include "ui/tool-factory.h"
-
namespace Inkscape {
namespace UI {
namespace Tools {
-namespace {
- ToolBase* createTweakContext() {
- return new TweakTool();
- }
-
- bool tweakContextRegistered = ToolFactory::instance().registerObject("/tools/tweak", createTweakContext);
-}
-
const std::string& TweakTool::getPrefsPath() {
return TweakTool::prefsPath;
}
diff --git a/src/ui/tools/zoom-tool.cpp b/src/ui/tools/zoom-tool.cpp
index b3fb78c8f..6a4d4dbbd 100644
--- a/src/ui/tools/zoom-tool.cpp
+++ b/src/ui/tools/zoom-tool.cpp
@@ -25,20 +25,11 @@
#include "selection-chemistry.h"
#include "ui/tools/zoom-tool.h"
-#include "ui/tool-factory.h"
namespace Inkscape {
namespace UI {
namespace Tools {
-namespace {
- ToolBase* createZoomContext() {
- return new ZoomTool();
- }
-
- bool zoomContextRegistered = ToolFactory::instance().registerObject("/tools/zoom", createZoomContext);
-}
-
const std::string& ZoomTool::getPrefsPath() {
return ZoomTool::prefsPath;
}
diff --git a/src/ui/view/view.h b/src/ui/view/view.h
index 48f4d2549..21a5d0dfc 100644
--- a/src/ui/view/view.h
+++ b/src/ui/view/view.h
@@ -15,7 +15,7 @@
#include <stddef.h>
#include <sigc++/connection.h>
#include "message.h"
-#include "gc-managed.h"
+#include "inkgc/gc-managed.h"
#include "gc-finalized.h"
#include "gc-anchored.h"
#include <2geom/forward.h>
diff --git a/src/undo-stack-observer.h b/src/undo-stack-observer.h
index 1057ace8f..dadb4764e 100644
--- a/src/undo-stack-observer.h
+++ b/src/undo-stack-observer.h
@@ -10,7 +10,7 @@
#ifndef SEEN_UNDO_COMMIT_OBSERVER_H
#define SEEN_UNDO_COMMIT_OBSERVER_H
-#include "gc-managed.h"
+#include "inkgc/gc-managed.h"
namespace Inkscape {
diff --git a/src/util/CMakeLists.txt b/src/util/CMakeLists.txt
index 732e01b0c..8fd8c8c66 100644
--- a/src/util/CMakeLists.txt
+++ b/src/util/CMakeLists.txt
@@ -31,7 +31,6 @@ set(util_SRC
list.h
longest-common-suffix.h
map-list.h
- mathfns.h
reference.h
reverse-list.h
share.h
@@ -43,5 +42,5 @@ set(util_SRC
ziptool.h
)
-# add_inkscape_lib(util_LIB "${util_SRC}")
-add_inkscape_source("${util_SRC}")
+add_inkscape_lib(util_LIB "${util_SRC}")
+# add_inkscape_source("${util_SRC}")
diff --git a/src/util/Makefile_insert b/src/util/Makefile_insert
index 6d2e63278..c23dffbca 100644
--- a/src/util/Makefile_insert
+++ b/src/util/Makefile_insert
@@ -1,8 +1,13 @@
## Makefile.am fragment sourced by src/Makefile.am.
-ink_common_sources += \
- util/ziptool.h \
- util/ziptool.cpp \
+util/all: util/libutil.a
+
+util/clean:
+ rm -f util/libutil.a $(util_libutil_a_OBJECTS)
+
+util_libutil_a_SOURCES = \
+ util/ziptool.h \
+ util/ziptool.cpp \
util/accumulators.h \
util/compose.hpp \
util/copy.h \
@@ -26,7 +31,6 @@ ink_common_sources += \
util/list-copy.h \
util/longest-common-suffix.h \
util/map-list.h \
- util/mathfns.h \
util/reference.h \
util/reverse-list.h \
util/share.h \
diff --git a/src/util/list.h b/src/util/list.h
index de5a458e9..563b6091c 100644
--- a/src/util/list.h
+++ b/src/util/list.h
@@ -12,7 +12,7 @@
#include <cstddef>
#include <iterator>
-#include "gc-managed.h"
+#include "inkgc/gc-managed.h"
#include "util/reference.h"
namespace Inkscape {
diff --git a/src/util/share.h b/src/util/share.h
index 6b5e6a4ef..8f1e7045a 100644
--- a/src/util/share.h
+++ b/src/util/share.h
@@ -12,7 +12,7 @@
#ifndef SEEN_INKSCAPE_UTIL_SHARE_H
#define SEEN_INKSCAPE_UTIL_SHARE_H
-#include "gc-core.h"
+#include "inkgc/gc-core.h"
#include <cstring>
#include <cstddef>
diff --git a/src/widgets/rect-toolbar.cpp b/src/widgets/rect-toolbar.cpp
index 37ffd7553..018ebbcdf 100644
--- a/src/widgets/rect-toolbar.cpp
+++ b/src/widgets/rect-toolbar.cpp
@@ -307,7 +307,7 @@ void sp_rect_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions, GObje
UnitTracker* tracker = new UnitTracker(Inkscape::Util::UNIT_TYPE_LINEAR);
//tracker->addUnit( SP_UNIT_PERCENT, 0 );
// fixme: add % meaning per cent of the width/height
- tracker->setActiveUnit( desktop->getNamedView()->display_units );
+ tracker->setActiveUnit(unit_table.getUnit("px"));
g_object_set_data( holder, "tracker", tracker );
/* W */
diff --git a/src/widgets/ruler.cpp b/src/widgets/ruler.cpp
index 8e818843d..ab486eeeb 100644
--- a/src/widgets/ruler.cpp
+++ b/src/widgets/ruler.cpp
@@ -144,7 +144,8 @@ static gboolean sp_ruler_expose (GtkWidget *widget,
GdkEventExpose *event);
#endif
static void sp_ruler_draw_ticks (SPRuler *ruler);
-static void sp_ruler_draw_pos (SPRuler *ruler);
+static void sp_ruler_draw_pos (SPRuler *ruler,
+ cairo_t *cr);
static void sp_ruler_make_pixmap (SPRuler *ruler);
static PangoLayout * sp_ruler_get_layout (GtkWidget *widget,
@@ -710,7 +711,7 @@ sp_ruler_draw (GtkWidget *widget,
cairo_set_source_surface(cr, priv->backing_store, 0, 0);
cairo_paint(cr);
- sp_ruler_draw_pos (ruler);
+ sp_ruler_draw_pos (ruler, cr);
return FALSE;
}
@@ -735,7 +736,8 @@ sp_ruler_make_pixmap (SPRuler *ruler)
}
static void
-sp_ruler_draw_pos (SPRuler *ruler)
+sp_ruler_draw_pos (SPRuler *ruler,
+ cairo_t *cr)
{
GtkWidget *widget = GTK_WIDGET (ruler);
@@ -797,25 +799,31 @@ sp_ruler_draw_pos (SPRuler *ruler)
if ((bs_width > 0) && (bs_height > 0))
{
- cairo_t *cr = gdk_cairo_create (gtk_widget_get_window (widget));
gdouble lower;
gdouble upper;
gdouble position;
gdouble increment;
- cairo_rectangle (cr,
- allocation.x, allocation.y,
- allocation.width, allocation.height);
- cairo_clip (cr);
-
- cairo_translate (cr, allocation.x, allocation.y);
-
- /* If a backing store exists, restore the ruler */
- if (priv->backing_store)
+ if (! cr)
+ {
+ cr = gdk_cairo_create (gtk_widget_get_window (widget));
+ cairo_translate (cr, allocation.x, allocation.y);
+ cairo_rectangle (cr, allocation.x, allocation.y, allocation.width, allocation.height);
+ cairo_clip (cr);
+
+ cairo_translate (cr, allocation.x, allocation.y);
+
+ /* If a backing store exists, restore the ruler */
+ if (priv->backing_store)
+ {
+ cairo_set_source_surface (cr, priv->backing_store, 0, 0);
+ cairo_rectangle (cr, priv->xsrc, priv->ysrc, bs_width, bs_height);
+ cairo_fill (cr);
+ }
+ }
+ else
{
- cairo_set_source_surface (cr, priv->backing_store, 0, 0);
- cairo_rectangle (cr, priv->xsrc, priv->ysrc, bs_width, bs_height);
- cairo_fill (cr);
+ cairo_reference (cr);
}
position = sp_ruler_get_position (ruler);
@@ -1126,7 +1134,7 @@ sp_ruler_set_position (SPRuler *ruler,
priv->position = position;
g_object_notify (G_OBJECT (ruler), "position");
- sp_ruler_draw_pos (ruler);
+ sp_ruler_draw_pos (ruler, NULL);
}
}
diff --git a/src/xml/attribute-record.h b/src/xml/attribute-record.h
index a61329b83..7caeab6b6 100644
--- a/src/xml/attribute-record.h
+++ b/src/xml/attribute-record.h
@@ -6,7 +6,7 @@
#define SEEN_XML_SP_REPR_ATTR_H
#include <glib.h>
-#include "gc-managed.h"
+#include "inkgc/gc-managed.h"
#include "util/share.h"
#define SP_REPR_ATTRIBUTE_KEY(a) g_quark_to_string((a)->key)
diff --git a/src/xml/composite-node-observer.h b/src/xml/composite-node-observer.h
index 3e4b1673a..6e93a57da 100644
--- a/src/xml/composite-node-observer.h
+++ b/src/xml/composite-node-observer.h
@@ -15,7 +15,7 @@
#ifndef SEEN_INKSCAPE_XML_COMPOSITE_NODE_OBSERVER_H
#define SEEN_INKSCAPE_XML_COMPOSITE_NODE_OBSERVER_H
-#include "gc-managed.h"
+#include "inkgc/gc-managed.h"
#include "xml/node-observer.h"
#include "util/list-container.h"
diff --git a/src/xml/event.h b/src/xml/event.h
index d25ea0e07..73e68daeb 100644
--- a/src/xml/event.h
+++ b/src/xml/event.h
@@ -24,7 +24,7 @@ typedef unsigned int GQuark;
#include <iterator>
#include "util/share.h"
#include "util/forward-pointer-iterator.h"
-#include "gc-managed.h"
+#include "inkgc/gc-managed.h"
#include "xml/node.h"
namespace Inkscape {
diff --git a/src/xml/log-builder.h b/src/xml/log-builder.h
index aa8f2c1c6..e94dd1daa 100644
--- a/src/xml/log-builder.h
+++ b/src/xml/log-builder.h
@@ -14,7 +14,7 @@
#ifndef SEEN_INKSCAPE_XML_LOG_BUILDER_H
#define SEEN_INKSCAPE_XML_LOG_BUILDER_H
-#include "gc-managed.h"
+#include "inkgc/gc-managed.h"
#include "xml/node-observer.h"
namespace Inkscape {
diff --git a/src/xml/subtree.h b/src/xml/subtree.h
index 11bf515f1..bc6ae913a 100644
--- a/src/xml/subtree.h
+++ b/src/xml/subtree.h
@@ -15,7 +15,7 @@
#ifndef SEEN_INKSCAPE_XML_SUBTREE_H
#define SEEN_INKSCAPE_XML_SUBTREE_H
-#include "gc-managed.h"
+#include "inkgc/gc-managed.h"
#include "xml/composite-node-observer.h"
namespace Inkscape {