summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 12d4aaf)
raw | patch | inline | side by side (parent: 12d4aaf)
author | mental <mental@users.sourceforge.net> | |
Sun, 21 Jan 2007 19:03:03 +0000 (19:03 +0000) | ||
committer | mental <mental@users.sourceforge.net> | |
Sun, 21 Jan 2007 19:03:03 +0000 (19:03 +0000) |
51 files changed:
diff --git a/src/color-profile.cpp b/src/color-profile.cpp
index 7423f93a1e8d17ebeb631c46c9e579d82525e5b5..059d476f102571718de6e48622f569db9b43ffb6 100644 (file)
--- a/src/color-profile.cpp
+++ b/src/color-profile.cpp
@@ -288,7 +288,8 @@ static Inkscape::XML::Node* Inkscape::colorprofile_write( SPObject *object, Inks
ColorProfile *cprof = COLORPROFILE(object);
if ((flags & SP_OBJECT_WRITE_BUILD) && !repr) {
- repr = sp_repr_new("svg:color-profile");
+ Inkscape::XML::Document *xml_doc = sp_document_repr_doc(SP_OBJECT_DOCUMENT(object));
+ repr = xml_doc->createElement("svg:color-profile");
}
if ( (flags & SP_OBJECT_WRITE_ALL) || cprof->href ) {
index 9de0458370242b8c304763a0bfc231894ee8ae1a..9d15ce10a3a4367821580c977640f674c27e8a19 100644 (file)
SPDesktop *desktop = SP_EVENT_CONTEXT_DESKTOP(cc);
SPDocument *doc = sp_desktop_document(desktop);
+ Inkscape::XML::Document *xml_doc = sp_document_repr_doc(doc);
if ( c && !sp_curve_empty(c) ) {
/* We actually have something to write */
- Inkscape::XML::Node *repr = sp_repr_new("svg:path");
+ Inkscape::XML::Node *repr = xml_doc->createElement("svg:path");
/* Set style */
sp_desktop_apply_style_tool(desktop, repr, "tools.connector", false);
diff --git a/src/desktop-events.cpp b/src/desktop-events.cpp
index 9a13bab735a7dd9a311b9cb2b86006fdd842abda..a1026481199609c52e32905a33a19b5f95684e8b 100644 (file)
--- a/src/desktop-events.cpp
+++ b/src/desktop-events.cpp
: wx )
>= 0 )
{
- Inkscape::XML::Node *repr = sp_repr_new("sodipodi:guide");
+ Inkscape::XML::Document *xml_doc = sp_document_repr_doc(desktop->doc());
+ Inkscape::XML::Node *repr = xml_doc->createElement("sodipodi:guide");
repr->setAttribute("orientation", (horiz) ? "horizontal" : "vertical");
double const guide_pos_dt = event_dt[ horiz
? NR::Y
index c0acea533a91be2e021f5b4f78e3833e95673cb4..cffbf52e1a4a154b37e3ba5316fca501fbea4dfd 100644 (file)
}
// Create the clone
- Inkscape::XML::Node *clone = sp_repr_new("svg:use");
+ Inkscape::XML::Node *clone = obj_repr->document()->createElement("svg:use");
clone->setAttribute("x", "0");
clone->setAttribute("y", "0");
clone->setAttribute("inkscape:tiled-clone-of", id_href);
diff --git a/src/dialogs/input.cpp b/src/dialogs/input.cpp
index 8d6ff399d27c5f52b4d97d66f7f9586538cb3c4b..21a6ea4a7d40a7c519c33f314c59cd0abc3b6b45 100644 (file)
--- a/src/dialogs/input.cpp
+++ b/src/dialogs/input.cpp
repr = sp_repr_lookup_child(devices, "id", device->name);
if (repr == NULL) {
- repr = sp_repr_new("group");
+ repr = devices->document()->createElement("group");
repr->setAttribute("id", device->name);
devices->appendChild(repr);
Inkscape::GC::release(repr);
index 3402e72b5cc0a0b147a55c794b1734771d26f14f..9ad3c0586b4ed1ceb708646ac83f344635b89d0c 100644 (file)
--- a/src/dialogs/xml-tree.cpp
+++ b/src/dialogs/xml-tree.cpp
g_assert(selected_repr != NULL);
if (name.text) {
+ Inkscape::XML::Document *xml_doc = sp_document_repr_doc(current_document);
Inkscape::XML::Node *new_repr;
- new_repr = sp_repr_new(name.text);
+ new_repr = xml_doc->createElement(name.text);
g_free(name.text);
selected_repr->appendChild(new_repr);
set_tree_select(new_repr);
{
g_assert(selected_repr != NULL);
- Inkscape::XML::Node *text = sp_repr_new_text("");
+ Inkscape::XML::Document *xml_doc = sp_document_repr_doc(current_document);
+ Inkscape::XML::Node *text = xml_doc->createTextNode("");
selected_repr->appendChild(text);
sp_document_done(current_document, SP_VERB_DIALOG_XML_EDITOR,
diff --git a/src/document.cpp b/src/document.cpp
index 8731ee71c798919a1fe9be694837a17b18629d46..9fc6dc4dae13491a348cbecf999dbe60164a39e8 100644 (file)
--- a/src/document.cpp
+++ b/src/document.cpp
// see if there's a template with id="base" in the preferences
if (!r) {
// if there's none, create an empty element
- rnew = sp_repr_new("sodipodi:namedview");
+ rnew = rdoc->createElement("sodipodi:namedview");
rnew->setAttribute("id", "base");
} else {
// otherwise, take from preferences
/* Defs */
if (!SP_ROOT(document->root)->defs) {
Inkscape::XML::Node *r;
- r = sp_repr_new("svg:defs");
+ r = rdoc->createElement("svg:defs");
rroot->addChild(r, NULL);
Inkscape::GC::release(r);
g_assert(SP_ROOT(document->root)->defs);
diff --git a/src/draw-context.cpp b/src/draw-context.cpp
index 38820326e6a3f99c93c4d6b06a6fa2a4ef936e4f..028d889d9ad503f56a3b44dcdf11a01f27b68656 100644 (file)
--- a/src/draw-context.cpp
+++ b/src/draw-context.cpp
SPDesktop *desktop = SP_EVENT_CONTEXT_DESKTOP(dc);
SPDocument *doc = sp_desktop_document(desktop);
+ Inkscape::XML::Document *xml_doc = sp_document_repr_doc(doc);
if ( c && !sp_curve_empty(c) ) {
/* We actually have something to write */
if (dc->white_item) {
repr = SP_OBJECT_REPR(dc->white_item);
} else {
- repr = sp_repr_new("svg:path");
+ repr = xml_doc->createElement("svg:path");
/* Set style */
sp_desktop_apply_style_tool(desktop, repr, tool_name(dc), false);
}
diff --git a/src/event-context.h b/src/event-context.h
index ae7ec61da315bbdc2dd0466a913e9da60dcc6cda..7e3c125fb7cb37a9f608bade9218d7c5dc339e0e 100644 (file)
--- a/src/event-context.h
+++ b/src/event-context.h
};
#define SP_EVENT_CONTEXT_DESKTOP(e) (SP_EVENT_CONTEXT(e)->desktop)
+#define SP_EVENT_CONTEXT_DOCUMENT(e) ((SP_EVENT_CONTEXT_DESKTOP(e))->doc())
#define SP_EVENT_CONTEXT_STATIC 0
index 7dba1b507552ca12a3eeca0e877994c2c6b31b88..7183b977811b9d6668ae3c56ef9c0b9631072e7a 100644 (file)
Parameter::new_child (Inkscape::XML::Node * parent)
{
Inkscape::XML::Node * retval;
- retval = sp_repr_new("inkscape:extension-param");
+ retval = parent->document()->createElement("inkscape:extension-param");
retval->setAttribute("name", _name);
parent->appendChild(retval);
Inkscape::XML::Node *
Parameter::document_param_node (SPDocument * doc)
{
+ Inkscape::XML::Document *xml_doc = sp_document_repr_doc(doc);
Inkscape::XML::Node * defs = SP_OBJECT_REPR(SP_DOCUMENT_DEFS(doc));
Inkscape::XML::Node * params = NULL;
}
if (params == NULL) {
- params = sp_repr_new("inkscape:extension-param");
+ params = xml_doc->createElement("inkscape:extension-param");
params->setAttribute("extension", extension->get_id());
defs->appendChild(params);
}
diff --git a/src/file.cpp b/src/file.cpp
index 491588f1e69d4b8c25355e73091fcc7750386bc4..521579d69f73775c628135e9911e4422e478d5fb 100644 (file)
--- a/src/file.cpp
+++ b/src/file.cpp
if ((style && style->firstChild()) || items_count > 1) {
// create group
- Inkscape::XML::Node *newgroup = sp_repr_new("svg:g");
+ Inkscape::XML::Document *xml_doc = sp_document_repr_doc(in_doc);
+ Inkscape::XML::Node *newgroup = xml_doc->createElement("svg:g");
sp_repr_css_set (newgroup, style, "style");
for (SPObject *child = sp_object_first_child(SP_DOCUMENT_ROOT(doc)); child != NULL; child = SP_OBJECT_NEXT(child) ) {
index 2c0a3636f5691b774d1e84fc3685c0350d3294e4..b5c6bdc69114e77dcb3c5277e9c257a333ff285f 100644 (file)
--- a/src/filter-chemistry.cpp
+++ b/src/filter-chemistry.cpp
SPDefs *defs = (SPDefs *) SP_DOCUMENT_DEFS(document);
+ Inkscape::XML::Document *xml_doc = sp_document_repr_doc(document);
+
// create a new filter
Inkscape::XML::Node *repr;
- repr = sp_repr_new("svg:filter");
+ repr = xml_doc->createElement("svg:filter");
repr->setAttribute("inkscape:collect", "always");
double rx = radius * (expansionY != 0? (expansion / expansionY) : 1);
//create feGaussianBlur node
Inkscape::XML::Node *b_repr;
- b_repr = sp_repr_new("svg:feGaussianBlur");
+ b_repr = xml_doc->createElement("svg:feGaussianBlur");
b_repr->setAttribute("inkscape:collect", "always");
double stdDeviation = radius;
index 0da9896e1f3f0f96b034577e9f1b38095ae359e9..bd7ecaf4c8eb69e9caeb93aab26e0146c5a511f7 100644 (file)
@@ -93,12 +93,13 @@ sp_gradient_get_private_normalized(SPDocument *document, SPGradient *vector, SPG
SPDefs *defs = (SPDefs *) SP_DOCUMENT_DEFS(document);
+ Inkscape::XML::Document *xml_doc = sp_document_repr_doc(document);
// create a new private gradient of the requested type
Inkscape::XML::Node *repr;
if (type == SP_GRADIENT_TYPE_LINEAR) {
- repr = sp_repr_new("svg:linearGradient");
+ repr = xml_doc->createElement("svg:linearGradient");
} else {
- repr = sp_repr_new("svg:radialGradient");
+ repr = xml_doc->createElement("svg:radialGradient");
}
// privates are garbage-collectable
sp_document_default_gradient_vector(SPDocument *document, guint32 color)
{
SPDefs *defs = (SPDefs *) SP_DOCUMENT_DEFS(document);
+ Inkscape::XML::Document *xml_doc = sp_document_repr_doc(document);
- Inkscape::XML::Node *repr = sp_repr_new("svg:linearGradient");
+ Inkscape::XML::Node *repr = xml_doc->createElement("svg:linearGradient");
repr->setAttribute("inkscape:collect", "always");
// set here, but removed when it's edited in the gradient editor
// (1) here, search gradients by color and return what is found without duplication
// (2) in fill & stroke, show only one copy of each gradient in list
- Inkscape::XML::Node *stop = sp_repr_new("svg:stop");
+ Inkscape::XML::Node *stop = xml_doc->createElement("svg:stop");
gchar b[64];
sp_svg_write_color(b, 64, color);
repr->appendChild(stop);
Inkscape::GC::release(stop);
- stop = sp_repr_new("svg:stop");
+ stop = xml_doc->createElement("svg:stop");
{
gchar *t = g_strdup_printf("stop-color:%s;stop-opacity:0;", b);
diff --git a/src/interface.cpp b/src/interface.cpp
index da734e671a059c8dacd20521a3ef28d65aba410a..bf9b481ee2174d94987f826d7b828f7b7e557821 100644 (file)
--- a/src/interface.cpp
+++ b/src/interface.cpp
Inkscape::XML::Node *repr = sp_repr_document_root(rnewdoc);
gchar const *style = repr->attribute("style");
- Inkscape::XML::Node *newgroup = sp_repr_new("svg:g");
+ Inkscape::XML::Node *newgroup = rnewdoc->createElement("svg:g");
newgroup->setAttribute("style", style);
for (Inkscape::XML::Node *child = repr->firstChild(); child != NULL; child = child->next()) {
b64out.setColumnWidth(0);
SPDocument *doc = SP_ACTIVE_DOCUMENT;
+ Inkscape::XML::Document *xml_doc = sp_document_repr_doc(doc);
- Inkscape::XML::Node *newImage = sp_repr_new("svg:image");
+ Inkscape::XML::Node *newImage = xml_doc->createElement("svg:image");
for ( int i = 0; i < data->length; i++ ) {
b64out.put( data->data[i] );
diff --git a/src/jabber_whiteboard/inkboard-document.cpp b/src/jabber_whiteboard/inkboard-document.cpp
index c2178b78d2adf38fc29c7288eff466a14acfe2af..0bb0783f0027188a1db6e8857ec4b45fcaddd088 100644 (file)
}
XML::Node*
-InkboardDocument::createElementNode(char const* name)
+InkboardDocument::createElement(char const* name)
{
return new XML::ElementNode(g_quark_from_string(name));
}
}
XML::Node*
-InkboardDocument::createCommentNode(char const* content)
+InkboardDocument::createComment(char const* content)
{
return new XML::CommentNode(Util::share_string(content));
}
index fba6691aa876bb2e404ba02cfe4f343780039b46..16ee1b7ffc21ae29faf774e9f0267b3018e3add1 100644 (file)
XML::Event* commitUndoable();
- XML::Node* createElementNode(char const* name);
+ XML::Node* createElement(char const* name);
XML::Node* createTextNode(char const* content);
- XML::Node* createCommentNode(char const* content);
+ XML::Node* createComment(char const* content);
//
// XML::NodeObserver methods
index a5f2e25887be6a70648a2f366fedfdfaf1faca97..a04ab05f00e39fa1f424141140e37e0e72260670 100644 (file)
@@ -358,11 +358,11 @@ makeInkboardDocument(int code, gchar const* rootname, State::SessionType type, G
InkboardDocument* rdoc = new InkboardDocument(g_quark_from_static_string("xml"), type, to);
rdoc->setAttribute("version", "1.0");
rdoc->setAttribute("standalone", "no");
- XML::Node *comment = sp_repr_new_comment(" Created with Inkscape (http://www.inkscape.org/) ");
+ XML::Node *comment = rdoc->createComment(" Created with Inkscape (http://www.inkscape.org/) ");
rdoc->appendChild(comment);
GC::release(comment);
- XML::Node* root = sp_repr_new(rootname);
+ XML::Node* root = rdoc->createElement(rootname);
rdoc->appendChild(root);
GC::release(root);
diff --git a/src/marker.cpp b/src/marker.cpp
index 65ed3789fde1126979e36ee93135494a70bba660..1fb7584623320724c76b0c964349b8347e55d10d 100644 (file)
--- a/src/marker.cpp
+++ b/src/marker.cpp
#include "xml/repr.h"
#include "attributes.h"
#include "marker.h"
+#include "document.h"
struct SPMarkerView {
SPMarkerView *next;
marker = SP_MARKER (object);
if ((flags & SP_OBJECT_WRITE_BUILD) && !repr) {
- repr = sp_repr_new ("svg:marker");
+ Inkscape::XML::Document *xml_doc = sp_document_repr_doc(SP_OBJECT_DOCUMENT(object));
+ repr = xml_doc->createElement("svg:marker");
}
if (marker->markerUnits_set) {
diff --git a/src/path-chemistry.cpp b/src/path-chemistry.cpp
index 99d22edc745ee4b68b9e09e771ebe1c93c2b7412..9a8eb3e9237b16ed1318d8aa5cca929b9ce2270b 100644 (file)
--- a/src/path-chemistry.cpp
+++ b/src/path-chemistry.cpp
#include "text-editing.h"
#include "style.h"
#include "inkscape.h"
+#include "desktop.h"
#include "document.h"
#include "message-stack.h"
#include "selection.h"
g_slist_free(items);
- Inkscape::XML::Node *repr = sp_repr_new("svg:path");
+ Inkscape::XML::Document *xml_doc = sp_document_repr_doc(desktop->doc());
+ Inkscape::XML::Node *repr = xml_doc->createElement("svg:path");
// restore id
repr->setAttribute("id", id);
for (GSList *l = list; l != NULL; l = l->next) {
curve = (SPCurve *) l->data;
- Inkscape::XML::Node *repr = sp_repr_new("svg:path");
+ Inkscape::XML::Node *repr = parent->document()->createElement("svg:path");
repr->setAttribute("style", style);
gchar *str = sp_svg_write_path(SP_CURVE_BPATH(curve));
if (!curve)
return NULL;
- Inkscape::XML::Node *repr = sp_repr_new("svg:path");
+ Inkscape::XML::Document *xml_doc = SP_OBJECT_REPR(item)->document();
+ Inkscape::XML::Node *repr = xml_doc->createElement("svg:path");
/* Transformation */
repr->setAttribute("transform", SP_OBJECT_REPR(item)->attribute("transform"));
/* Style */
diff --git a/src/prefs-utils.cpp b/src/prefs-utils.cpp
index e365966bd31e3a003f944dab5e0d7046ffa0b7f1..14a37ee4b90d2d7d4f6a6a2983a1f478401ae7c3 100644 (file)
--- a/src/prefs-utils.cpp
+++ b/src/prefs-utils.cpp
if (child) {
recent->changeOrder(child, NULL);
} else {
- child = sp_repr_new("document");
+ child = recent->document()->createElement("document");
child->setAttribute("uri", uri);
recent->addChild(child, NULL);
}
diff --git a/src/rect-context.cpp b/src/rect-context.cpp
index fd3d05a30ba45875f811cb5e130c1f4fdd195fe3..82eef51e7de99930be87134e91cb632044778df6 100644 (file)
--- a/src/rect-context.cpp
+++ b/src/rect-context.cpp
}
/* Create object */
- Inkscape::XML::Node *repr = sp_repr_new("svg:rect");
+ Inkscape::XML::Document *xml_doc = sp_document_repr_doc(SP_EVENT_CONTEXT_DOCUMENT(&rc));
+ Inkscape::XML::Node *repr = xml_doc->createElement("svg:rect");
/* Set style */
sp_desktop_apply_style_tool (desktop, repr, "tools.shapes.rect", false);
index 61d6b92846b4c5cc7adadbfd7ed3dd55d5e1203f..fbf5d52df65480ba9115765a714078e6ed281387 100644 (file)
return;
SPDocument *document = sp_desktop_document (desktop);
+ Inkscape::XML::Document *xml_doc = sp_document_repr_doc(document);
Inkscape::Selection *selection = sp_desktop_selection(desktop);
gint topmost = ((Inkscape::XML::Node *) g_slist_last(p)->data)->position();
Inkscape::XML::Node *topmost_parent = ((Inkscape::XML::Node *) g_slist_last(p)->data)->parent();
- Inkscape::XML::Node *group = sp_repr_new("svg:g");
+ Inkscape::XML::Node *group = xml_doc->createElement("svg:g");
while (p) {
Inkscape::XML::Node *current = (Inkscape::XML::Node *) p->data;
Inkscape::Selection *selection = sp_desktop_selection(desktop);
+ Inkscape::XML::Document *xml_doc = sp_document_repr_doc(desktop->doc());
+
// check if something is selected
if (selection->isEmpty()) {
desktop->messageStack()->flash(Inkscape::WARNING_MESSAGE, _("Select an <b>object</b> to clone."));
Inkscape::XML::Node *sel_repr = (Inkscape::XML::Node *) reprs->data;
Inkscape::XML::Node *parent = sp_repr_parent(sel_repr);
- Inkscape::XML::Node *clone = sp_repr_new("svg:use");
+ Inkscape::XML::Node *clone = xml_doc->createElement("svg:use");
sp_repr_set_attr(clone, "x", "0");
sp_repr_set_attr(clone, "y", "0");
sp_repr_set_attr(clone, "xlink:href", g_strdup_printf("#%s", sel_repr->attribute("id")));
return;
SPDocument *document = sp_desktop_document(desktop);
+ Inkscape::XML::Document *xml_doc = sp_document_repr_doc(document);
Inkscape::Selection *selection = sp_desktop_selection(desktop);
prefs_set_int_attribute("options.clonecompensation", "value", saved_compensation);
if (apply) {
- Inkscape::XML::Node *rect = sp_repr_new ("svg:rect");
+ Inkscape::XML::Node *rect = xml_doc->createElement("svg:rect");
rect->setAttribute("style", g_strdup_printf("stroke:none;fill:url(#%s)", pat_id));
NR::Point min = bounds.min() * parent_transform.inverse();
return;
SPDocument *document = sp_desktop_document(desktop);
+ Inkscape::XML::Document *xml_doc = sp_document_repr_doc(document);
Inkscape::Selection *selection = sp_desktop_selection(desktop);
GdkPixbuf *pb = gdk_pixbuf_new_from_file (filepath, NULL);
if (pb) {
// Create the repr for the image
- Inkscape::XML::Node * repr = sp_repr_new ("svg:image");
+ Inkscape::XML::Node * repr = xml_doc->createElement("svg:image");
repr->setAttribute("xlink:href", filename);
repr->setAttribute("sodipodi:absref", filepath);
if (res == PX_PER_IN) { // for default 90 dpi, snap it to pixel grid
diff --git a/src/sp-clippath.cpp b/src/sp-clippath.cpp
index 501b5fcfd91caf5aea8d870a1d55e5f69bad4153..a1927f337c052ad9d554221b267339e438e05121 100644 (file)
--- a/src/sp-clippath.cpp
+++ b/src/sp-clippath.cpp
sp_clippath_write(SPObject *object, Inkscape::XML::Node *repr, guint flags)
{
if ((flags & SP_OBJECT_WRITE_BUILD) && !repr) {
- repr = sp_repr_new("svg:clipPath");
+ Inkscape::XML::Document *xml_doc = sp_document_repr_doc(SP_OBJECT_DOCUMENT(object));
+ repr = xml_doc->createElement("svg:clipPath");
}
if (((SPObjectClass *) (parent_class))->write)
@@ -387,7 +388,8 @@ sp_clippath_create (GSList *reprs, SPDocument *document, NR::Matrix const* apply
{
Inkscape::XML::Node *defsrepr = SP_OBJECT_REPR (SP_DOCUMENT_DEFS (document));
- Inkscape::XML::Node *repr = sp_repr_new ("svg:clipPath");
+ Inkscape::XML::Document *xml_doc = sp_document_repr_doc(document);
+ Inkscape::XML::Node *repr = xml_doc->createElement("svg:clipPath");
repr->setAttribute("clipPathUnits", "userSpaceOnUse");
defsrepr->appendChild(repr);
diff --git a/src/sp-defs.cpp b/src/sp-defs.cpp
index cf9f5a28f75ff89264448a38691f510e18b5d6c3..5a8dce6df7f8640729edec44eeb6b44bfe47af98 100644 (file)
--- a/src/sp-defs.cpp
+++ b/src/sp-defs.cpp
#include "sp-defs.h"
#include "xml/repr.h"
+#include "document.h"
static void sp_defs_class_init(SPDefsClass *dc);
static void sp_defs_init(SPDefs *defs);
if (flags & SP_OBJECT_WRITE_BUILD) {
if (!repr) {
- repr = sp_repr_new("svg:defs");
+ Inkscape::XML::Document *xml_doc = sp_document_repr_doc(SP_OBJECT_DOCUMENT(object));
+ repr = xml_doc->createElement("svg:defs");
}
GSList *l = NULL;
diff --git a/src/sp-ellipse.cpp b/src/sp-ellipse.cpp
index b2b0f7b0565dd7fbe467fe8e15043272725d3b7d..819aed99766dc6f070387eb1bc7c50adcf91f228 100644 (file)
--- a/src/sp-ellipse.cpp
+++ b/src/sp-ellipse.cpp
#include "display/curve.h"
#include <glibmm/i18n.h>
+#include "document.h"
#include "sp-ellipse.h"
#include "prefs-utils.h"
@@ -284,7 +285,8 @@ static Inkscape::XML::Node *sp_genericellipse_write(SPObject *object, Inkscape::
if (flags & SP_OBJECT_WRITE_EXT) {
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");
}
sp_repr_set_svg_double(repr, "sodipodi:cx", ellipse->cx.computed);
ellipse = SP_GENERICELLIPSE(object);
if ((flags & SP_OBJECT_WRITE_BUILD) && !repr) {
- repr = sp_repr_new("svg:ellipse");
+ Inkscape::XML::Document *xml_doc = sp_document_repr_doc(SP_OBJECT_DOCUMENT(object));
+ repr = xml_doc->createElement("svg:ellipse");
}
sp_repr_set_svg_double(repr, "cx", ellipse->cx.computed);
ellipse = SP_GENERICELLIPSE(object);
if ((flags & SP_OBJECT_WRITE_BUILD) && !repr) {
- repr = sp_repr_new("svg:circle");
+ Inkscape::XML::Document *xml_doc = sp_document_repr_doc(SP_OBJECT_DOCUMENT(object));
+ repr = xml_doc->createElement("svg:circle");
}
sp_repr_set_svg_double(repr, "cx", ellipse->cx.computed);
SPArc *arc = SP_ARC(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-flowdiv.cpp b/src/sp-flowdiv.cpp
index cc04055410ad8b2f3baf167618fb104b5fc14602..8c84d6128d278edb7242b0785ba9908aec7f0ae6 100644 (file)
--- a/src/sp-flowdiv.cpp
+++ b/src/sp-flowdiv.cpp
#include "sp-flowdiv.h"
#include "sp-string.h"
+#include "document.h"
static void sp_flowdiv_class_init (SPFlowdivClass *klass);
static void sp_flowdiv_init (SPFlowdiv *group);
// SPFlowdiv *group = SP_FLOWDIV (object);
if ( flags&SP_OBJECT_WRITE_BUILD ) {
- if ( repr == NULL ) repr = sp_repr_new ("svg:flowDiv");
+ Inkscape::XML::Document *xml_doc = sp_document_repr_doc(SP_OBJECT_DOCUMENT(object));
+ if ( repr == NULL ) repr = xml_doc->createElement("svg:flowDiv");
GSList *l = NULL;
for (SPObject* child = sp_object_first_child(object) ; child != NULL ; child = SP_OBJECT_NEXT(child) ) {
Inkscape::XML::Node* c_repr=NULL;
} else if ( SP_IS_FLOWPARA(child) ) {
c_repr = child->updateRepr(NULL, flags);
} else if ( SP_IS_STRING(child) ) {
- c_repr = sp_repr_new_text(SP_STRING(child)->string.c_str());
+ c_repr = xml_doc->createTextNode(SP_STRING(child)->string.c_str());
}
if ( c_repr ) l = g_slist_prepend (l, c_repr);
}
sp_flowtspan_write (SPObject *object, Inkscape::XML::Node *repr, guint flags)
{
if ( flags&SP_OBJECT_WRITE_BUILD ) {
- if ( repr == NULL ) repr = sp_repr_new ("svg:flowSpan");
+ Inkscape::XML::Document *xml_doc = sp_document_repr_doc(SP_OBJECT_DOCUMENT(object));
+ if ( repr == NULL ) repr = xml_doc->createElement("svg:flowSpan");
GSList *l = NULL;
for (SPObject* child = sp_object_first_child(object) ; child != NULL ; child = SP_OBJECT_NEXT(child) ) {
Inkscape::XML::Node* c_repr=NULL;
} else if ( SP_IS_FLOWPARA (child) ) {
c_repr = child->updateRepr(NULL, flags);
} else if ( SP_IS_STRING(child) ) {
- c_repr = sp_repr_new_text(SP_STRING(child)->string.c_str());
+ c_repr = xml_doc->createTextNode(SP_STRING(child)->string.c_str());
}
if ( c_repr ) l = g_slist_prepend (l, c_repr);
}
// SPFlowpara *group = SP_FLOWPARA (object);
if ( flags&SP_OBJECT_WRITE_BUILD ) {
- if ( repr == NULL ) repr = sp_repr_new ("svg:flowPara");
+ Inkscape::XML::Document *xml_doc = sp_document_repr_doc(SP_OBJECT_DOCUMENT(object));
+ if ( repr == NULL ) repr = xml_doc->createElement("svg:flowPara");
GSList *l = NULL;
for (SPObject* child = sp_object_first_child(object) ; child != NULL ; child = SP_OBJECT_NEXT(child) ) {
Inkscape::XML::Node* c_repr=NULL;
} else if ( SP_IS_FLOWPARA (child) ) {
c_repr = child->updateRepr(NULL, flags);
} else if ( SP_IS_STRING(child) ) {
- c_repr = sp_repr_new_text(SP_STRING(child)->string.c_str());
+ c_repr = xml_doc->createTextNode(SP_STRING(child)->string.c_str());
}
if ( c_repr ) l = g_slist_prepend (l, c_repr);
}
sp_flowline_write (SPObject *object, Inkscape::XML::Node *repr, guint flags)
{
if ( flags&SP_OBJECT_WRITE_BUILD ) {
- if ( repr == NULL ) repr = sp_repr_new ("svg:flowLine");
+ Inkscape::XML::Document *xml_doc = sp_document_repr_doc(SP_OBJECT_DOCUMENT(object));
+ if ( repr == NULL ) repr = xml_doc->createElement("svg:flowLine");
} else {
}
sp_flowregionbreak_write (SPObject *object, Inkscape::XML::Node *repr, guint flags)
{
if ( flags&SP_OBJECT_WRITE_BUILD ) {
- if ( repr == NULL ) repr = sp_repr_new ("svg:flowLine");
+ Inkscape::XML::Document *xml_doc = sp_document_repr_doc(SP_OBJECT_DOCUMENT(object));
+ if ( repr == NULL ) repr = xml_doc->createElement("svg:flowLine");
} else {
}
diff --git a/src/sp-flowtext.cpp b/src/sp-flowtext.cpp
index ec6fd04279c1d82555f0a7b59d36705e6c405321..b589bb64d6dc298255e35351470bfd009faee566 100644 (file)
--- a/src/sp-flowtext.cpp
+++ b/src/sp-flowtext.cpp
sp_flowtext_write(SPObject *object, Inkscape::XML::Node *repr, guint flags)
{
if ( flags & SP_OBJECT_WRITE_BUILD ) {
- if ( repr == NULL ) repr = sp_repr_new("svg:flowRoot");
+ Inkscape::XML::Document *xml_doc = sp_document_repr_doc(SP_OBJECT_DOCUMENT(object));
+ if ( repr == NULL ) repr = xml_doc->createElement("svg:flowRoot");
GSList *l = NULL;
for (SPObject *child = sp_object_first_child(object) ; child != NULL ; child = SP_OBJECT_NEXT(child) ) {
Inkscape::XML::Node *c_repr = NULL;
SPItem *item = SP_ITEM(this);
- Inkscape::XML::Node *repr = sp_repr_new("svg:text");
+ Inkscape::XML::Document *xml_doc = sp_document_repr_doc(SP_OBJECT_DOCUMENT(this));
+ Inkscape::XML::Node *repr = xml_doc->createElement("svg:text");
repr->setAttribute("xml:space", "preserve");
repr->setAttribute("style", SP_OBJECT_REPR(this)->attribute("style"));
NR::Point anchor_point = this->layout.characterAnchorPoint(this->layout.begin());
sp_repr_set_svg_double(repr, "y", anchor_point[NR::Y]);
for (Inkscape::Text::Layout::iterator it = this->layout.begin() ; it != this->layout.end() ; ) {
- Inkscape::XML::Node *line_tspan = sp_repr_new("svg:tspan");
+ Inkscape::XML::Node *line_tspan = xml_doc->createElement("svg:tspan");
line_tspan->setAttribute("sodipodi:role", "line");
Inkscape::Text::Layout::iterator it_line_end = it;
while (it != it_line_end) {
- Inkscape::XML::Node *span_tspan = sp_repr_new("svg:tspan");
+ Inkscape::XML::Node *span_tspan = xml_doc->createElement("svg:tspan");
NR::Point anchor_point = this->layout.characterAnchorPoint(it);
// use kerning to simulate justification and whatnot
Inkscape::Text::Layout::iterator it_span_end = it;
Glib::ustring new_string;
while (span_text_start_iter != span_text_end_iter)
new_string += *span_text_start_iter++; // grr. no substr() with iterators
- Inkscape::XML::Node *new_text = sp_repr_new_text(new_string.c_str());
+ Inkscape::XML::Node *new_text = xml_doc->createTextNode(new_string.c_str());
span_tspan->appendChild(new_text);
Inkscape::GC::release(new_text);
}
@@ -665,18 +667,19 @@ SPItem *create_flowtext_with_internal_frame (SPDesktop *desktop, NR::Point p0, N
{
SPDocument *doc = sp_desktop_document (desktop);
- Inkscape::XML::Node *root_repr = sp_repr_new("svg:flowRoot");
+ Inkscape::XML::Document *xml_doc = sp_document_repr_doc(doc);
+ Inkscape::XML::Node *root_repr = xml_doc->createElement("svg:flowRoot");
root_repr->setAttribute("xml:space", "preserve"); // we preserve spaces in the text objects we create
SPItem *ft_item = SP_ITEM(desktop->currentLayer()->appendChildRepr(root_repr));
SPObject *root_object = doc->getObjectByRepr(root_repr);
g_assert(SP_IS_FLOWTEXT(root_object));
- Inkscape::XML::Node *region_repr = sp_repr_new("svg:flowRegion");
+ Inkscape::XML::Node *region_repr = xml_doc->createElement("svg:flowRegion");
root_repr->appendChild(region_repr);
SPObject *region_object = doc->getObjectByRepr(region_repr);
g_assert(SP_IS_FLOWREGION(region_object));
- Inkscape::XML::Node *rect_repr = sp_repr_new("svg:rect"); // FIXME: use path!!! after rects are converted to use path
+ Inkscape::XML::Node *rect_repr = xml_doc->createElement("svg:rect"); // FIXME: use path!!! after rects are converted to use path
region_repr->appendChild(rect_repr);
SPObject *rect = doc->getObjectByRepr(rect_repr);
@@ -695,12 +698,12 @@ SPItem *create_flowtext_with_internal_frame (SPDesktop *desktop, NR::Point p0, N
sp_rect_position_set(SP_RECT(rect), x0, y0, w, h);
SP_OBJECT(rect)->updateRepr();
- Inkscape::XML::Node *para_repr = sp_repr_new("svg:flowPara");
+ Inkscape::XML::Node *para_repr = xml_doc->createElement("svg:flowPara");
root_repr->appendChild(para_repr);
SPObject *para_object = doc->getObjectByRepr(para_repr);
g_assert(SP_IS_FLOWPARA(para_object));
- Inkscape::XML::Node *text = sp_repr_new_text("");
+ Inkscape::XML::Node *text = xml_doc->createTextNode("");
para_repr->appendChild(text);
Inkscape::GC::release(root_repr);
diff --git a/src/sp-gradient-test.h b/src/sp-gradient-test.h
index 7906a3d484f854fe915b361ea0ab090dd72acfce..b8645155ee4de2d73c4719572f196bcf6d34524a 100644 (file)
--- a/src/sp-gradient-test.h
+++ b/src/sp-gradient-test.h
SP_OBJECT(gr)->document = _doc;
sp_object_set(SP_OBJECT(gr), SP_ATTR_GRADIENTTRANSFORM, "matrix(0, 1, -1, 0, 0, 0)");
- Inkscape::XML::Node *repr = sp_repr_new("svg:radialGradient");
+ Inkscape::XML::Document *xml_doc = sp_document_repr_doc(_doc);
+ Inkscape::XML::Node *repr = xml_doc->createElement("svg:radialGradient");
SP_OBJECT(gr)->updateRepr(repr, SP_OBJECT_WRITE_ALL);
{
gchar const *tr = repr->attribute("gradientTransform");
diff --git a/src/sp-gradient.cpp b/src/sp-gradient.cpp
index d28f631ded7aab5513232452c8e0259811236d9a..71dc0e20e3f9e70ccdd7d26938628a243a499acb 100644 (file)
--- a/src/sp-gradient.cpp
+++ b/src/sp-gradient.cpp
SPStop *stop = SP_STOP(object);
if ((flags & SP_OBJECT_WRITE_BUILD) && !repr) {
- repr = sp_repr_new("svg:stop");
+ Inkscape::XML::Document *xml_doc = sp_document_repr_doc(SP_OBJECT_DOCUMENT(object));
+ repr = xml_doc->createElement("svg:stop");
}
g_return_if_fail(gr != NULL);
g_return_if_fail(SP_IS_GRADIENT(gr));
+ Inkscape::XML::Document *xml_doc = sp_document_repr_doc(SP_OBJECT_DOCUMENT(gr));
Inkscape::XML::Node *repr = SP_OBJECT_REPR(gr);
/* We have to be careful, as vector may be our own, so construct repr list at first */
for (guint i = 0; i < gr->vector.stops.size(); i++) {
Inkscape::CSSOStringStream os;
- Inkscape::XML::Node *child = sp_repr_new("svg:stop");
+ Inkscape::XML::Node *child = xml_doc->createElement("svg:stop");
sp_repr_set_css_double(child, "offset", gr->vector.stops[i].offset);
/* strictly speaking, offset an SVG <number> rather than a CSS one, but exponents make no
* sense for offset proportions. */
@@ -1391,7 +1393,8 @@ sp_lineargradient_write(SPObject *object, Inkscape::XML::Node *repr, guint flags
SPLinearGradient *lg = SP_LINEARGRADIENT(object);
if ((flags & SP_OBJECT_WRITE_BUILD) && !repr) {
- repr = sp_repr_new("svg:linearGradient");
+ Inkscape::XML::Document *xml_doc = sp_document_repr_doc(SP_OBJECT_DOCUMENT(object));
+ repr = xml_doc->createElement("svg:linearGradient");
}
if ((flags & SP_OBJECT_WRITE_ALL) || lg->x1._set)
@@ -1692,7 +1695,8 @@ sp_radialgradient_write(SPObject *object, Inkscape::XML::Node *repr, guint flags
SPRadialGradient *rg = SP_RADIALGRADIENT(object);
if ((flags & SP_OBJECT_WRITE_BUILD) && !repr) {
- repr = sp_repr_new("svg:radialGradient");
+ Inkscape::XML::Document *xml_doc = sp_document_repr_doc(SP_OBJECT_DOCUMENT(object));
+ repr = xml_doc->createElement("svg:radialGradient");
}
if ((flags & SP_OBJECT_WRITE_ALL) || rg->cx._set) sp_repr_set_svg_double(repr, "cx", rg->cx.computed);
diff --git a/src/sp-image.cpp b/src/sp-image.cpp
index 973bb9f87651e418c3c8b7ed431c684efb9f7027..06371f232e53705d0cdf12214a79eabb03b0ac05 100644 (file)
--- a/src/sp-image.cpp
+++ b/src/sp-image.cpp
image = SP_IMAGE (object);
if ((flags & SP_OBJECT_WRITE_BUILD) && !repr) {
- repr = sp_repr_new ("svg:image");
+ Inkscape::XML::Document *xml_doc = sp_document_repr_doc(SP_OBJECT_DOCUMENT(object));
+ repr = xml_doc->createElement("svg:image");
}
repr->setAttribute("xlink:href", image->href);
diff --git a/src/sp-mask.cpp b/src/sp-mask.cpp
index 6ad8a487121ca02a9b0edec5506593795a51a0c6..9c8b0ba3251128f3e436b3dbbfd3249623c484c3 100644 (file)
--- a/src/sp-mask.cpp
+++ b/src/sp-mask.cpp
sp_mask_write (SPObject *object, Inkscape::XML::Node *repr, guint flags)
{
if ((flags & SP_OBJECT_WRITE_BUILD) && !repr) {
- repr = sp_repr_new ("svg:mask");
+ Inkscape::XML::Document *xml_doc = sp_document_repr_doc(SP_OBJECT_DOCUMENT(object));
+ repr = xml_doc->createElement("svg:mask");
}
if (((SPObjectClass *) (parent_class))->write)
@@ -273,7 +274,8 @@ sp_mask_create (GSList *reprs, SPDocument *document, NR::Matrix const* applyTran
{
Inkscape::XML::Node *defsrepr = SP_OBJECT_REPR (SP_DOCUMENT_DEFS (document));
- Inkscape::XML::Node *repr = sp_repr_new ("svg:mask");
+ Inkscape::XML::Document *xml_doc = sp_document_repr_doc(document);
+ Inkscape::XML::Node *repr = xml_doc->createElement("svg:mask");
repr->setAttribute("maskUnits", "userSpaceOnUse");
defsrepr->appendChild(repr);
diff --git a/src/sp-offset.cpp b/src/sp-offset.cpp
index 2253bf1e1170dd7b869304d8aa30da7b09667ebe..74382b7681ba9f1409b63489fbb9c7f94976c005 100644 (file)
--- a/src/sp-offset.cpp
+++ b/src/sp-offset.cpp
SPOffset *offset = SP_OFFSET (object);
if ((flags & SP_OBJECT_WRITE_BUILD) && !repr) {
- repr = sp_repr_new ("svg:path");
+ Inkscape::XML::Document *xml_doc = SP_OBJECT_REPR(object)->document();
+ repr = xml_doc->createElement("svg:path");
}
if (flags & SP_OBJECT_WRITE_EXT) {
diff --git a/src/sp-path.cpp b/src/sp-path.cpp
index 2e8cc2f7534c4f46a72f51453cb5a5676888b902..3b455e50532a74cff05f14107cf666db144df300 100644 (file)
--- a/src/sp-path.cpp
+++ b/src/sp-path.cpp
#include "sp-path.h"
+#include "document.h"
+
#define noPATH_VERBOSE
static void sp_path_class_init(SPPathClass *klass);
SPShape *shape = (SPShape *) 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 ( shape->curve != NULL ) {
diff --git a/src/sp-pattern.cpp b/src/sp-pattern.cpp
index 89eeacec4f5d008679b3c8a356ddae8e2d71576a..8de8ac77b1a3e1a3beffbe7af6b0d3d8c76f6dcc 100644 (file)
--- a/src/sp-pattern.cpp
+++ b/src/sp-pattern.cpp
pattern_chain (SPPattern *pattern)
{
SPDocument *document = SP_OBJECT_DOCUMENT (pattern);
+ Inkscape::XML::Document *xml_doc = sp_document_repr_doc(document);
Inkscape::XML::Node *defsrepr = SP_OBJECT_REPR (SP_DOCUMENT_DEFS (document));
- Inkscape::XML::Node *repr = sp_repr_new ("svg:pattern");
+ Inkscape::XML::Node *repr = xml_doc->createElement("svg:pattern");
repr->setAttribute("inkscape:collect", "always");
gchar *parent_ref = g_strconcat ("#", SP_OBJECT_REPR(pattern)->attribute("id"), NULL);
repr->setAttribute("xlink:href", parent_ref);
@@ -494,9 +495,10 @@ sp_pattern_transform_multiply (SPPattern *pattern, NR::Matrix postmul, bool set)
const gchar *
pattern_tile (GSList *reprs, NR::Rect bounds, SPDocument *document, NR::Matrix transform, NR::Matrix move)
{
+ Inkscape::XML::Document *xml_doc = sp_document_repr_doc(document);
Inkscape::XML::Node *defsrepr = SP_OBJECT_REPR (SP_DOCUMENT_DEFS (document));
- Inkscape::XML::Node *repr = sp_repr_new ("svg:pattern");
+ Inkscape::XML::Node *repr = xml_doc->createElement("svg:pattern");
repr->setAttribute("patternUnits", "userSpaceOnUse");
sp_repr_set_svg_double(repr, "width", bounds.extent(NR::X));
sp_repr_set_svg_double(repr, "height", bounds.extent(NR::Y));
diff --git a/src/sp-polygon.cpp b/src/sp-polygon.cpp
index 56cbfefdebe3d6582717c3ed65d223e001f4d9cf..a2b1c59724572f0ee8ba17e6e8b6664f3d22bae2 100644 (file)
--- a/src/sp-polygon.cpp
+++ b/src/sp-polygon.cpp
#include "libnr/n-art-bpath.h"
#include "svg/stringstream.h"
#include "xml/repr.h"
+#include "document.h"
static void sp_polygon_class_init(SPPolygonClass *pc);
static void sp_polygon_init(SPPolygon *polygon);
@@ -120,7 +121,8 @@ static Inkscape::XML::Node *sp_polygon_write(SPObject *object, Inkscape::XML::No
sp_shape_set_shape(shape);
if ((flags & SP_OBJECT_WRITE_BUILD) && !repr) {
- repr = sp_repr_new("svg:polygon");
+ Inkscape::XML::Document *xml_doc = sp_document_repr_doc(SP_OBJECT_DOCUMENT(object));
+ repr = xml_doc->createElement("svg:polygon");
}
/* We can safely write points here, because all subclasses require it too (Lauris) */
diff --git a/src/sp-root.cpp b/src/sp-root.cpp
index b3946cfee9bf90d3b640db5db4d71e3ca6a73f60..d6e423edcabf53582627a1fdbc18fdaa5bae5552 100644 (file)
--- a/src/sp-root.cpp
+++ b/src/sp-root.cpp
SPRoot *root = SP_ROOT(object);
if ((flags & SP_OBJECT_WRITE_BUILD) && !repr) {
- repr = sp_repr_new("svg:svg");
+ Inkscape::XML::Document *xml_doc = sp_document_repr_doc(SP_OBJECT_DOCUMENT(object));
+ repr = xml_doc->createElement("svg:svg");
}
if (flags & SP_OBJECT_WRITE_EXT) {
diff --git a/src/sp-spiral.cpp b/src/sp-spiral.cpp
index ab65ba4ddd65484920199888d7480031784bcf86..a2449fb9a334a8d6edfa9db187251acf4a6cd297 100644 (file)
--- a/src/sp-spiral.cpp
+++ b/src/sp-spiral.cpp
#include "display/curve.h"
#include <glibmm/i18n.h>
#include "xml/repr.h"
+#include "document.h"
#include "sp-spiral.h"
SPSpiral *spiral = SP_SPIRAL (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-style-elem.cpp b/src/sp-style-elem.cpp
index ff27f3de0e77508a416b15e3ee7d9718ce7187e8..4408f7ce86f200b0bec6decb435c609c21095ab4 100644 (file)
--- a/src/sp-style-elem.cpp
+++ b/src/sp-style-elem.cpp
sp_style_elem_write(SPObject *const object, Inkscape::XML::Node *repr, guint const flags)
{
if ((flags & SP_OBJECT_WRITE_BUILD) && !repr) {
- repr = sp_repr_new("svg:style");
+ Inkscape::XML::Document *xml_doc = sp_document_repr_doc(SP_OBJECT_DOCUMENT(object));
+ repr = xml_doc->createElement("svg:style");
}
g_return_val_if_fail(object, repr);
diff --git a/src/sp-text.cpp b/src/sp-text.cpp
index 3059cf22d9aaf16b599360e16eff94ccf7d19ef1..5c2c5412c3bd8e606876b70d6c8e6d3cd2dab666 100644 (file)
--- a/src/sp-text.cpp
+++ b/src/sp-text.cpp
SPText *text = SP_TEXT (object);
if (flags & SP_OBJECT_WRITE_BUILD) {
+ Inkscape::XML::Document *xml_doc = sp_document_repr_doc(SP_OBJECT_DOCUMENT(object));
if (!repr)
- repr = sp_repr_new ("svg:text");
+ repr = xml_doc->createElement("svg:text");
GSList *l = NULL;
for (SPObject *child = sp_object_first_child(object) ; child != NULL ; child = SP_OBJECT_NEXT(child) ) {
Inkscape::XML::Node *crepr = NULL;
if (SP_IS_STRING(child)) {
- crepr = sp_repr_new_text(SP_STRING(child)->string.c_str());
+ crepr = xml_doc->createTextNode(SP_STRING(child)->string.c_str());
} else {
crepr = child->updateRepr(NULL, flags);
}
diff --git a/src/sp-use.cpp b/src/sp-use.cpp
index ae4e9f61a2c451e21f7413115cc073ecdd0cabfd..5b2ed9e239c81d23eb41de9247120753bcffb97a 100644 (file)
--- a/src/sp-use.cpp
+++ b/src/sp-use.cpp
SPUse *use = SP_USE(object);
if ((flags & SP_OBJECT_WRITE_BUILD) && !repr) {
- repr = sp_repr_new("svg:use");
+ Inkscape::XML::Document *xml_doc = sp_document_repr_doc(SP_OBJECT_DOCUMENT(object));
+ repr = xml_doc->createElement("svg:use");
}
if (((SPObjectClass *) (parent_class))->write) {
Inkscape::XML::Node *parent = sp_repr_parent(repr);
SPDocument *document = SP_OBJECT(use)->document;
+ Inkscape::XML::Document *xml_doc = sp_document_repr_doc(document);
// Track the ultimate source of a chain of uses.
SPItem *orig = sp_use_root(use);
Inkscape::XML::Node *copy = NULL;
if (SP_IS_SYMBOL(orig)) { // make a group, copy children
- copy = sp_repr_new("svg:g");
+ copy = xml_doc->createElement("svg:g");
for (Inkscape::XML::Node *child = SP_OBJECT_REPR(orig)->firstChild() ; child != NULL; child = child->next()) {
Inkscape::XML::Node *newchild = child->duplicate();
copy->appendChild(newchild);
diff --git a/src/spiral-context.cpp b/src/spiral-context.cpp
index 6ce05dbd979d9485f7382657e4b145c0f87d59ba..2e4214f066308759ed214b89a44e9c85b3d2a2e1 100644 (file)
--- a/src/spiral-context.cpp
+++ b/src/spiral-context.cpp
}
/* Create object */
- Inkscape::XML::Node *repr = sp_repr_new("svg:path");
+ Inkscape::XML::Document *xml_doc = sp_document_repr_doc(SP_EVENT_CONTEXT_DOCUMENT(sc));
+ Inkscape::XML::Node *repr = xml_doc->createElement("svg:path");
repr->setAttribute("sodipodi:type", "spiral");
/* Set style */
diff --git a/src/star-context.cpp b/src/star-context.cpp
index 2c39eafa0ab2f55a102eb6d9d00dabb4fac2ce18..03954e939924d439d3984ee9cc05e6c27528d6e3 100644 (file)
--- a/src/star-context.cpp
+++ b/src/star-context.cpp
}
/* Create object */
- Inkscape::XML::Node *repr = sp_repr_new("svg:path");
+ Inkscape::XML::Document *xml_doc = sp_document_repr_doc(SP_EVENT_CONTEXT_DOCUMENT(sc));
+ Inkscape::XML::Node *repr = xml_doc->createElement("svg:path");
repr->setAttribute("sodipodi:type", "star");
/* Set style */
diff --git a/src/text-chemistry.cpp b/src/text-chemistry.cpp
index 91c263584cf7d1a70f062753b9fd28503180124a..0a655fdcb5e3620daeee1e69ff04dba10bc86871 100644 (file)
--- a/src/text-chemistry.cpp
+++ b/src/text-chemistry.cpp
#include "sp-rect.h"
#include "sp-textpath.h"
#include "inkscape.h"
+#include "desktop.h"
#include "document.h"
#include "message-stack.h"
#include "selection.h"
SPItem *text = text_or_flowtext_in_selection(selection);
SPItem *shape = shape_in_selection(selection);
+ Inkscape::XML::Document *xml_doc = sp_document_repr_doc(desktop->doc());
+
if (!text || !shape || g_slist_length((GSList *) selection->itemList()) != 2) {
sp_desktop_message_stack(desktop)->flash(Inkscape::WARNING_MESSAGE, _("Select <b>a text and a path</b> to put text on path."));
return;
}
// create textPath and put it into the text
- Inkscape::XML::Node *textpath = sp_repr_new("svg:textPath");
+ Inkscape::XML::Node *textpath = xml_doc->createElement("svg:textPath");
// reference the shape
textpath->setAttribute("xlink:href", g_strdup_printf("#%s", SP_OBJECT_REPR(shape)->attribute("id")));
if (text_alignment == Inkscape::Text::Layout::RIGHT)
return;
SPDocument *doc = sp_desktop_document (desktop);
+ Inkscape::XML::Document *xml_doc = sp_document_repr_doc(doc);
Inkscape::Selection *selection = sp_desktop_selection(desktop);
SP_OBJECT_REPR(text)->setAttribute("transform", NULL);
}
- Inkscape::XML::Node *root_repr = sp_repr_new("svg:flowRoot");
+ Inkscape::XML::Node *root_repr = xml_doc->createElement("svg:flowRoot");
root_repr->setAttribute("xml:space", "preserve"); // we preserve spaces in the text objects we create
root_repr->setAttribute("style", SP_OBJECT_REPR(text)->attribute("style")); // fixme: transfer style attrs too
SP_OBJECT_REPR(SP_OBJECT_PARENT(shape))->appendChild(root_repr);
SPObject *root_object = doc->getObjectByRepr(root_repr);
g_return_if_fail(SP_IS_FLOWTEXT(root_object));
- Inkscape::XML::Node *region_repr = sp_repr_new("svg:flowRegion");
+ Inkscape::XML::Node *region_repr = xml_doc->createElement("svg:flowRegion");
root_repr->appendChild(region_repr);
SPObject *object = doc->getObjectByRepr(region_repr);
g_return_if_fail(SP_IS_FLOWREGION(object));
items = items->next) {
SPItem *item = SP_ITEM(items->data);
if (SP_IS_SHAPE(item)){
- Inkscape::XML::Node *clone = sp_repr_new("svg:use");
+ Inkscape::XML::Node *clone = xml_doc->createElement("svg:use");
clone->setAttribute("x", "0");
clone->setAttribute("y", "0");
clone->setAttribute("xlink:href", g_strdup_printf("#%s", SP_OBJECT_REPR(item)->attribute("id")));
}
if (SP_IS_TEXT(text)) { // flow from text, as string
- Inkscape::XML::Node *para_repr = sp_repr_new("svg:flowPara");
+ Inkscape::XML::Node *para_repr = xml_doc->createElement("svg:flowPara");
root_repr->appendChild(para_repr);
object = doc->getObjectByRepr(para_repr);
g_return_if_fail(SP_IS_FLOWPARA(object));
Inkscape::Text::Layout const *layout = te_get_layout(text);
Glib::ustring text_ustring = sp_te_get_string_multiline(text, layout->begin(), layout->end());
- Inkscape::XML::Node *text_repr = sp_repr_new_text(text_ustring.c_str()); // FIXME: transfer all formatting! and convert newlines into flowParas!
+ Inkscape::XML::Node *text_repr = xml_doc->createTextNode(text_ustring.c_str()); // FIXME: transfer all formatting! and convert newlines into flowParas!
para_repr->appendChild(text_repr);
Inkscape::GC::release(para_repr);
return;
SPDocument *doc = sp_desktop_document (desktop);
+ Inkscape::XML::Document *xml_doc = sp_document_repr_doc(doc);
Inkscape::Selection *selection = sp_desktop_selection(desktop);
SPItem *flowtext = SP_ITEM(items->data);
/* Create <text> */
- Inkscape::XML::Node *rtext = sp_repr_new("svg:text");
+ Inkscape::XML::Node *rtext = xml_doc->createElement("svg:text");
rtext->setAttribute("xml:space", "preserve"); // we preserve spaces in the text objects we create
/* Set style */
}
/* Create <tspan> */
- Inkscape::XML::Node *rtspan = sp_repr_new("svg:tspan");
+ Inkscape::XML::Node *rtspan = xml_doc->createElement("svg:tspan");
rtspan->setAttribute("sodipodi:role", "line"); // otherwise, why bother creating the tspan?
rtext->addChild(rtspan, NULL);
gchar *text_string = sp_te_get_string_multiline(flowtext);
- Inkscape::XML::Node *text_repr = sp_repr_new_text(text_string); // FIXME: transfer all formatting!!!
+ Inkscape::XML::Node *text_repr = xml_doc->createTextNode(text_string); // FIXME: transfer all formatting!!!
free(text_string);
rtspan->appendChild(text_repr);
diff --git a/src/text-context.cpp b/src/text-context.cpp
index e969ffbfc74529a5158948c6a3fbf3cf5e452e49..b65bcf19fa55a3cba768f4a977a5e83e532a536c 100644 (file)
--- a/src/text-context.cpp
+++ b/src/text-context.cpp
SPEventContext *ec = SP_EVENT_CONTEXT(tc);
/* Create <text> */
- Inkscape::XML::Node *rtext = sp_repr_new("svg:text");
+ Inkscape::XML::Document *xml_doc = sp_document_repr_doc(SP_EVENT_CONTEXT_DESKTOP(ec)->doc());
+ Inkscape::XML::Node *rtext = xml_doc->createElement("svg:text");
rtext->setAttribute("xml:space", "preserve"); // we preserve spaces in the text objects we create
/* Set style */
sp_repr_set_svg_double(rtext, "y", tc->pdoc[NR::Y]);
/* Create <tspan> */
- Inkscape::XML::Node *rtspan = sp_repr_new("svg:tspan");
+ Inkscape::XML::Node *rtspan = xml_doc->createElement("svg:tspan");
rtspan->setAttribute("sodipodi:role", "line"); // otherwise, why bother creating the tspan?
rtext->addChild(rtspan, NULL);
Inkscape::GC::release(rtspan);
/* Create TEXT */
- Inkscape::XML::Node *rstring = sp_repr_new_text("");
+ Inkscape::XML::Node *rstring = xml_doc->createTextNode("");
rtspan->addChild(rstring, NULL);
Inkscape::GC::release(rstring);
SPItem *text_item = SP_ITEM(ec->desktop->currentLayer()->appendChildRepr(rtext));
diff --git a/src/trace/trace.cpp b/src/trace/trace.cpp
index a02d410a19cb5b04f21c71d1695ad3079d7c13cb..925e4e195de41aa2068d7f20fc56645ab0197563 100644 (file)
--- a/src/trace/trace.cpp
+++ b/src/trace/trace.cpp
//#OK. Now let's start making new nodes
+ Inkscape::XML::Document *xml_doc = sp_document_repr_doc(desktop->doc());
Inkscape::XML::Node *groupRepr = NULL;
//# if more than 1, make a <g>roup of <path>s
if (nrPaths > 1)
{
- groupRepr = sp_repr_new("svg:g");
+ groupRepr = xml_doc->createElement("svg:g");
par->addChild(groupRepr, imgRepr);
}
TracingEngineResult result = results[i];
totalNodeCount += result.getNodeCount();
- Inkscape::XML::Node *pathRepr = sp_repr_new("svg:path");
+ Inkscape::XML::Node *pathRepr = xml_doc->createElement("svg:path");
pathRepr->setAttribute("style", result.getStyle().c_str());
pathRepr->setAttribute("d", result.getPathData().c_str());
index a96e1589d0c5f836244f50bda9be6a3a7c42da97..b701adc2b3183fd9ccd1a66167c0634880a506e1 100644 (file)
--- a/src/ui/context-menu.cpp
+++ b/src/ui/context-menu.cpp
#include "context-menu.h"
#include "../xml/repr.h"
+#include "desktop.h"
+#include "document.h"
static void sp_object_type_menu(GType type, SPObject *object, SPDesktop *desktop, GtkMenu *menu);
SPDesktop *desktop = (SPDesktop*)gtk_object_get_data(GTK_OBJECT(menuitem), "desktop");
g_return_if_fail(desktop != NULL);
- Inkscape::XML::Node *repr = sp_repr_new("svg:a");
+ Inkscape::XML::Document *xml_doc = sp_document_repr_doc(desktop->doc());
+ Inkscape::XML::Node *repr = xml_doc->createElement("svg:a");
SP_OBJECT_REPR(SP_OBJECT_PARENT(item))->addChild(repr, SP_OBJECT_REPR(item));
SPObject *object = SP_OBJECT_DOCUMENT(item)->getObjectByRepr(repr);
g_return_if_fail(SP_IS_ANCHOR(object));
index 30a1761bd5f9c6dcb434875f4989fd8f7465d542..681b1dbbc3bc7a4bec9cb67f8fe7bf17a0339ed7 100644 (file)
--- a/src/ui/widget/ruler.cpp
+++ b/src/ui/widget/ruler.cpp
_dragging = false;
if ( (_horiz_f ? wy : wx ) >= 0 ) {
- Inkscape::XML::Node *repr = sp_repr_new("sodipodi:guide");
+ Inkscape::XML::Document *xml_doc = sp_document_repr_doc(_dt->doc());
+ Inkscape::XML::Node *repr = xml_doc->createElement("sodipodi:guide");
repr->setAttribute("orientation", _horiz_f ? "horizontal" : "vertical");
double const guide_pos_dt = event_dt[ _horiz_f ? NR::Y : NR::X ];
sp_repr_set_svg_double(repr, "position", guide_pos_dt);
diff --git a/src/xml/document.h b/src/xml/document.h
index eeb16e74f78d58bfba1c254289b549906f388063..de9164aa2a738dd505513397866d6bf64771b646 100644 (file)
--- a/src/xml/document.h
+++ b/src/xml/document.h
virtual void commit()=0;
virtual Inkscape::XML::Event *commitUndoable()=0;
- virtual Node *createElementNode(char const *name)=0;
+ virtual Node *createElement(char const *name)=0;
virtual Node *createTextNode(char const *content)=0;
- virtual Node *createCommentNode(char const *content)=0;
+ virtual Node *createComment(char const *content)=0;
};
}
index 7f5f27f2d809bff0f6fd5d71ce453a77cc6e1ad9..7ab857f4600de5e258da690fe93f43bff8cbe4a0 100644 (file)
utest_start("XML Transactions");
- a = sp_repr_new("a");
- b = sp_repr_new("b");
- c = sp_repr_new("c");
+ a = document->createElement("a");
+ b = document->createElement("b");
+ c = document->createElement("c");
UTEST_TEST("rollback of node addition") {
sp_repr_begin_transaction(document);
index e8c652b2deaa45eeb2098e6443bfa96ed1fc273b..4063abde4be867cb0cdc662a362ecddec4273601 100644 (file)
return _log_builder.detach();
}
-Node *SimpleDocument::createElementNode(char const *name) {
+Node *SimpleDocument::createElement(char const *name) {
return new ElementNode(g_quark_from_string(name));
}
return new TextNode(Util::share_string(content));
}
-Node *SimpleDocument::createCommentNode(char const *content) {
+Node *SimpleDocument::createComment(char const *content) {
return new CommentNode(Util::share_string(content));
}
index ca130e62bcf80bdd2fa61ae87b57a2efde5c6edf..c8ee4d9b4812befa5904d5944d1289097c702723 100644 (file)
void commit();
Inkscape::XML::Event *commitUndoable();
- Node *createElementNode(char const *name);
+ Node *createElement(char const *name);
Node *createTextNode(char const *content);
- Node *createCommentNode(char const *content);
+ Node *createComment(char const *content);
void notifyChildAdded(Node &parent, Node &child, Node *prev);