diff options
| author | Liam P. White <inkscapebrony@gmail.com> | 2015-02-25 00:22:08 +0000 |
|---|---|---|
| committer | Liam P. White <inkscapebrony@gmail.com> | 2015-02-25 00:22:08 +0000 |
| commit | df7828a7a8ba0b7e6c2dd892ca5f0a62ef718bf0 (patch) | |
| tree | 8e03cc5b9c89749e73a1281ee997da90b40694fc /src | |
| parent | Translations. Hungarian translation update. (diff) | |
| download | inkscape-df7828a7a8ba0b7e6c2dd892ca5f0a62ef718bf0.tar.gz inkscape-df7828a7a8ba0b7e6c2dd892ca5f0a62ef718bf0.zip | |
create SPObject factory
(bzr r13939.1.1)
Diffstat (limited to 'src')
84 files changed, 361 insertions, 1035 deletions
diff --git a/src/Makefile_insert b/src/Makefile_insert index b07541109..ea4755bb5 100644 --- a/src/Makefile_insert +++ b/src/Makefile_insert @@ -124,7 +124,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/document.cpp b/src/document.cpp index 11971e63d..2a50d00bd 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/factory.h b/src/factory.h index c1288b460..6b448064e 100644 --- a/src/factory.h +++ b/src/factory.h @@ -81,34 +81,6 @@ private: }; -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 /* 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/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/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/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 334570076..8dd695867 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 9cb33a6f3..a70fbd5bb 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 0f76051bc..0c65bbaed 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 371a6c35c..d3cf50fa7 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 1094b88a7..343db435e 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 961ab0f84..987a86fe4 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-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 db6db9909..66cec3637 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) { |
