From: acspike Date: Mon, 22 Jan 2007 03:26:44 +0000 (+0000) Subject: continue switching sp_repr_new* over to XML::Document::create* X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=f1244c7e85def8dc339fc92a29c0bd26ffc247d7;p=inkscape.git continue switching sp_repr_new* over to XML::Document::create* --- diff --git a/src/extension/internal/bluredge.cpp b/src/extension/internal/bluredge.cpp index 16c6d0eb9..5d8c9a82d 100644 --- a/src/extension/internal/bluredge.cpp +++ b/src/extension/internal/bluredge.cpp @@ -71,7 +71,8 @@ BlurEdge::effect (Inkscape::Extension::Effect *module, Inkscape::UI::View::View SPItem * spitem = *item; std::vector new_items(steps); - Inkscape::XML::Node * new_group = sp_repr_new("svg:g"); + Inkscape::XML::Document *xml_doc = sp_document_repr_doc(document->doc()); + Inkscape::XML::Node * new_group = xml_doc->createElement("svg:g"); (SP_OBJECT_REPR(spitem)->parent())->appendChild(new_group); double orig_opacity = sp_repr_css_double_property(sp_repr_css_attr(SP_OBJECT_REPR(spitem), "style"), "opacity", 1.0); diff --git a/src/extension/internal/gdkpixbuf-input.cpp b/src/extension/internal/gdkpixbuf-input.cpp index 7f44fb553..b9fde9350 100644 --- a/src/extension/internal/gdkpixbuf-input.cpp +++ b/src/extension/internal/gdkpixbuf-input.cpp @@ -54,9 +54,10 @@ GdkpixbufInput::open(Inkscape::Extension::Input *mod, char const *uri) } } + Inkscape::XML::Document *xml_doc = sp_document_repr_doc(doc); if (prefs_get_int_attribute("options.importbitmapsasimages", "value", 1) == 1) { // import as - repr = sp_repr_new("svg:image"); + repr = xml_doc->createElement("svg:image"); repr->setAttribute("xlink:href", relname); repr->setAttribute("sodipodi:absref", uri); @@ -65,7 +66,7 @@ GdkpixbufInput::open(Inkscape::Extension::Input *mod, char const *uri) } else { // import as pattern-filled rect - Inkscape::XML::Node *pat = sp_repr_new("svg:pattern"); + Inkscape::XML::Node *pat = xml_doc->createElement("svg:pattern"); pat->setAttribute("inkscape:collect", "always"); pat->setAttribute("patternUnits", "userSpaceOnUse"); sp_repr_set_svg_double(pat, "width", width); @@ -74,14 +75,14 @@ GdkpixbufInput::open(Inkscape::Extension::Input *mod, char const *uri) gchar const *pat_id = pat->attribute("id"); SPObject *pat_object = doc->getObjectById(pat_id); - Inkscape::XML::Node *im = sp_repr_new("svg:image"); + Inkscape::XML::Node *im = xml_doc->createElement("svg:image"); im->setAttribute("xlink:href", relname); im->setAttribute("sodipodi:absref", uri); sp_repr_set_svg_double(im, "width", width); sp_repr_set_svg_double(im, "height", height); SP_OBJECT_REPR(pat_object)->addChild(im, NULL); - repr = sp_repr_new("svg:rect"); + repr = xml_doc->createElement("svg:rect"); repr->setAttribute("style", g_strdup_printf("stroke:none;fill:url(#%s)", pat_id)); sp_repr_set_svg_double(repr, "width", width); sp_repr_set_svg_double(repr, "height", height); diff --git a/src/sp-flowregion.cpp b/src/sp-flowregion.cpp index 51bc4c511..3981aa9ba 100644 --- a/src/sp-flowregion.cpp +++ b/src/sp-flowregion.cpp @@ -14,6 +14,7 @@ #include "sp-text.h" #include "sp-use.h" #include "style.h" +#include "document.h" #include "sp-flowregion.h" @@ -233,7 +234,10 @@ static Inkscape::XML::Node * sp_flowregion_write (SPObject *object, Inkscape::XML::Node *repr, guint flags) { if (flags & SP_OBJECT_WRITE_BUILD) { - if ( repr == NULL ) repr = sp_repr_new ("svg:flowRegion"); + if ( repr == NULL ) { + Inkscape::XML::Document *xml_doc = sp_document_repr_doc(SP_OBJECT_DOCUMENT(object)); + repr = xml_doc->createElement("svg:flowRegion"); + } GSList *l = NULL; for ( SPObject *child = sp_object_first_child(object) ; child != NULL; child = SP_OBJECT_NEXT(child) ) { @@ -447,7 +451,10 @@ static Inkscape::XML::Node * sp_flowregionexclude_write (SPObject *object, Inkscape::XML::Node *repr, guint flags) { if (flags & SP_OBJECT_WRITE_BUILD) { - if ( repr == NULL ) repr = sp_repr_new ("svg:flowRegionExclude"); + if ( repr == NULL ) { + Inkscape::XML::Document *xml_doc = sp_document_repr_doc(SP_OBJECT_DOCUMENT(object)); + repr = xml_doc->createElement("svg:flowRegionExclude"); + } GSList *l = NULL; for ( SPObject *child = sp_object_first_child(object) ; child != NULL; child = SP_OBJECT_NEXT(child) ) { diff --git a/src/sp-item-group.cpp b/src/sp-item-group.cpp index 5cbf68fff..bb94425c5 100644 --- a/src/sp-item-group.cpp +++ b/src/sp-item-group.cpp @@ -205,7 +205,10 @@ sp_group_write (SPObject *object, Inkscape::XML::Node *repr, guint flags) if (flags & SP_OBJECT_WRITE_BUILD) { GSList *l; - if (!repr) repr = sp_repr_new ("svg:g"); + if (!repr) { + Inkscape::XML::Document *xml_doc = sp_document_repr_doc(SP_OBJECT_DOCUMENT(object)); + repr = xml_doc->createElement("svg:g"); + } l = NULL; for (child = sp_object_first_child(object); child != NULL; child = SP_OBJECT_NEXT(child) ) { crepr = child->updateRepr(NULL, flags); diff --git a/src/sp-object-group.cpp b/src/sp-object-group.cpp index ec698592f..5674f44b2 100644 --- a/src/sp-object-group.cpp +++ b/src/sp-object-group.cpp @@ -14,6 +14,7 @@ #include "sp-object-group.h" #include "xml/repr.h" +#include "document.h" static void sp_objectgroup_class_init (SPObjectGroupClass *klass); static void sp_objectgroup_init (SPObjectGroup *objectgroup); @@ -107,7 +108,10 @@ sp_objectgroup_write (SPObject *object, Inkscape::XML::Node *repr, guint flags) if (flags & SP_OBJECT_WRITE_BUILD) { GSList *l; - if (!repr) repr = sp_repr_new ("svg:g"); + if (!repr) { + Inkscape::XML::Document *xml_doc = sp_document_repr_doc(SP_OBJECT_DOCUMENT(object)); + repr = xml_doc->createElement("svg:g"); + } l = NULL; for ( child = sp_object_first_child(object) ; child != NULL ; child = SP_OBJECT_NEXT(child) ) { crepr = child->updateRepr(NULL, flags); diff --git a/src/sp-polyline.cpp b/src/sp-polyline.cpp index 54a38ccd1..33f3286f9 100644 --- a/src/sp-polyline.cpp +++ b/src/sp-polyline.cpp @@ -18,6 +18,7 @@ #include "display/curve.h" #include #include "xml/repr.h" +#include "document.h" static void sp_polyline_class_init (SPPolyLineClass *klass); static void sp_polyline_init (SPPolyLine *polyline); @@ -157,7 +158,8 @@ sp_polyline_write (SPObject *object, Inkscape::XML::Node *repr, guint flags) polyline = SP_POLYLINE (object); if ((flags & SP_OBJECT_WRITE_BUILD) && !repr) { - repr = sp_repr_new ("svg:polyline"); + Inkscape::XML::Document *xml_doc = sp_document_repr_doc(SP_OBJECT_DOCUMENT(object)); + repr = xml_doc->createElement("svg:polyline"); } if (repr != SP_OBJECT_REPR (object)) { diff --git a/src/sp-rect.cpp b/src/sp-rect.cpp index edcea21a2..6823f2122 100644 --- a/src/sp-rect.cpp +++ b/src/sp-rect.cpp @@ -22,6 +22,7 @@ #include #include +#include "document.h" #include "attributes.h" #include "style.h" #include "sp-rect.h" @@ -210,7 +211,8 @@ sp_rect_write(SPObject *object, Inkscape::XML::Node *repr, guint flags) SPRect *rect = SP_RECT(object); if ((flags & SP_OBJECT_WRITE_BUILD) && !repr) { - repr = sp_repr_new("svg:rect"); + Inkscape::XML::Document *xml_doc = sp_document_repr_doc(SP_OBJECT_DOCUMENT(object)); + repr = xml_doc->createElement("svg:rect"); } sp_repr_set_svg_double(repr, "width", rect->width.computed); diff --git a/src/sp-star.cpp b/src/sp-star.cpp index 2f3dcd6c1..ea2525054 100644 --- a/src/sp-star.cpp +++ b/src/sp-star.cpp @@ -22,6 +22,7 @@ #include "attributes.h" #include "display/curve.h" #include "xml/repr.h" +#include "document.h" #include "sp-star.h" @@ -126,7 +127,8 @@ sp_star_write (SPObject *object, Inkscape::XML::Node *repr, guint flags) SPStar *star = SP_STAR (object); if ((flags & SP_OBJECT_WRITE_BUILD) && !repr) { - repr = sp_repr_new ("svg:path"); + Inkscape::XML::Document *xml_doc = sp_document_repr_doc(SP_OBJECT_DOCUMENT(object)); + repr = xml_doc->createElement("svg:path"); } if (flags & SP_OBJECT_WRITE_EXT) { diff --git a/src/sp-symbol.cpp b/src/sp-symbol.cpp index a7b0312e9..5dbbe4e41 100644 --- a/src/sp-symbol.cpp +++ b/src/sp-symbol.cpp @@ -20,6 +20,7 @@ #include "attributes.h" #include "print.h" #include "sp-symbol.h" +#include "document.h" static void sp_symbol_class_init (SPSymbolClass *klass); static void sp_symbol_init (SPSymbol *symbol); @@ -383,7 +384,8 @@ sp_symbol_write (SPObject *object, Inkscape::XML::Node *repr, guint flags) symbol = SP_SYMBOL (object); if ((flags & SP_OBJECT_WRITE_BUILD) && !repr) { - repr = sp_repr_new ("svg:symbol"); + Inkscape::XML::Document *xml_doc = sp_document_repr_doc(SP_OBJECT_DOCUMENT(object)); + repr = xml_doc->createElement("svg:symbol"); } repr->setAttribute("viewBox", object->repr->attribute("viewBox")); diff --git a/src/widgets/gradient-selector.cpp b/src/widgets/gradient-selector.cpp index 3177700c3..68d69f3f9 100644 --- a/src/widgets/gradient-selector.cpp +++ b/src/widgets/gradient-selector.cpp @@ -22,6 +22,7 @@ #include #include +#include "document.h" #include "../document-private.h" #include "../gradient-chemistry.h" @@ -312,14 +313,15 @@ sp_gradient_selector_add_vector_clicked (GtkWidget *w, SPGradientSelector *sel) if (gr) { repr = SP_OBJECT_REPR (gr)->duplicate(); } else { + Inkscape::XML::Document *xml_doc = sp_document_repr_doc(doc); Inkscape::XML::Node *stop; - repr = sp_repr_new ("svg:linearGradient"); - stop = sp_repr_new ("svg:stop"); + repr = xml_doc->createElement("svg:linearGradient"); + stop = xml_doc->createElement("svg:stop"); stop->setAttribute("offset", "0"); stop->setAttribute("style", "stop-color:#000;stop-opacity:1;"); repr->appendChild(stop); Inkscape::GC::release(stop); - stop = sp_repr_new ("svg:stop"); + stop = xml_doc->createElement("svg:stop"); stop->setAttribute("offset", "1"); stop->setAttribute("style", "stop-color:#fff;stop-opacity:1;"); repr->appendChild(stop);