From: mental Date: Tue, 27 Feb 2007 15:20:01 +0000 (+0000) Subject: get rid of sp_repr_document_root and (commented) sp_repr_duplicate X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=89949341e299d2857fc2435d5a8758845947dc0a;p=inkscape.git get rid of sp_repr_document_root and (commented) sp_repr_duplicate --- diff --git a/src/document.cpp b/src/document.cpp index 9fc6dc4da..3579c4c91 100644 --- a/src/document.cpp +++ b/src/document.cpp @@ -220,7 +220,7 @@ sp_document_create(Inkscape::XML::Document *rdoc, Inkscape::XML::Node *rroot; Inkscape::Version sodipodi_version; - rroot = sp_repr_document_root(rdoc); + rroot = rdoc->root(); document = new SPDocument(); @@ -341,7 +341,7 @@ sp_document_new(gchar const *uri, unsigned int keepalive, bool make_new) rdoc = sp_repr_read_file(uri, SP_SVG_NS_URI); /* If file cannot be loaded, return NULL without warning */ if (rdoc == NULL) return NULL; - rroot = sp_repr_document_root(rdoc); + rroot = rdoc->root(); /* If xml file is not svg, return NULL without warning */ /* fixme: destroy document */ if (strcmp(rroot->name(), "svg:svg") != 0) return NULL; @@ -390,7 +390,7 @@ sp_document_new_from_mem(gchar const *buffer, gint length, unsigned int keepaliv /* If it cannot be loaded, return NULL without warning */ if (rdoc == NULL) return NULL; - rroot = sp_repr_document_root(rdoc); + rroot = rdoc->root(); /* If xml file is not svg, return NULL without warning */ /* fixme: destroy document */ if (strcmp(rroot->name(), "svg:svg") != 0) return NULL; diff --git a/src/extension/internal/svg.cpp b/src/extension/internal/svg.cpp index 5539e0358..9a097bd6e 100644 --- a/src/extension/internal/svg.cpp +++ b/src/extension/internal/svg.cpp @@ -208,7 +208,7 @@ Svg::save (Inkscape::Extension::Output *mod, SPDocument *doc, const gchar *uri) repr = sp_document_repr_root (doc); } else { rdoc = sp_repr_document_new ("svg:svg"); - repr = sp_repr_document_root (rdoc); + repr = rdoc->root(); repr = sp_document_root (doc)->updateRepr(repr, SP_OBJECT_WRITE_BUILD); } diff --git a/src/extension/system.cpp b/src/extension/system.cpp index 3eb9cf809..0372e4aa0 100644 --- a/src/extension/system.cpp +++ b/src/extension/system.cpp @@ -393,7 +393,7 @@ build_from_reprdoc(Inkscape::XML::Document *doc, Implementation::Implementation g_return_val_if_fail(doc != NULL, NULL); - Inkscape::XML::Node *repr = sp_repr_document_root(doc); + Inkscape::XML::Node *repr = doc->root(); /* sp_repr_print(repr); */ diff --git a/src/inkscape.cpp b/src/inkscape.cpp index 016384274..be3ff1e7d 100644 --- a/src/inkscape.cpp +++ b/src/inkscape.cpp @@ -658,7 +658,7 @@ inkscape_load_config (const gchar *filename, Inkscape::XML::Document *config, co return false; } - Inkscape::XML::Node *root = sp_repr_document_root (doc); + Inkscape::XML::Node *root = doc->root(); if (strcmp (root->name(), "inkscape")) { gchar *safeFn = Inkscape::IO::sanitizeString(fn); GtkWidget *w = gtk_message_dialog_new (NULL, GTK_DIALOG_MODAL, GTK_MESSAGE_WARNING, GTK_BUTTONS_OK, e_notsp, safeFn, warn); @@ -725,7 +725,7 @@ inkscape_get_repr (Inkscape::Application *inkscape, const gchar *key) return NULL; } - Inkscape::XML::Node *repr = sp_repr_document_root (Inkscape::Preferences::get()); + Inkscape::XML::Node *repr = Inkscape::Preferences::get()->root(); if (!repr) return NULL; g_assert (!(strcmp (repr->name(), "inkscape"))); @@ -1410,7 +1410,7 @@ profile_path(const char *filename) Inkscape::XML::Node * inkscape_get_menus (Inkscape::Application * inkscape) { - Inkscape::XML::Node *repr = sp_repr_document_root (inkscape->menus); + Inkscape::XML::Node *repr = inkscape->menus->root(); g_assert (!(strcmp (repr->name(), "inkscape"))); return repr->firstChild(); } diff --git a/src/interface.cpp b/src/interface.cpp index bf9b481ee..83f4ac3c8 100644 --- a/src/interface.cpp +++ b/src/interface.cpp @@ -1102,7 +1102,7 @@ sp_ui_drag_data_received(GtkWidget *widget, return; } - Inkscape::XML::Node *repr = sp_repr_document_root(rnewdoc); + Inkscape::XML::Node *repr = rnewdoc->root(); gchar const *style = repr->attribute("style"); Inkscape::XML::Node *newgroup = rnewdoc->createElement("svg:g"); diff --git a/src/sp-image.cpp b/src/sp-image.cpp index 0e92a1bcc..c5ed9117b 100644 --- a/src/sp-image.cpp +++ b/src/sp-image.cpp @@ -1053,7 +1053,7 @@ sp_image_repr_read_image (Inkscape::XML::Node * repr) if (pixbuf != NULL) return pixbuf; } else if (!g_path_is_absolute (filename)) { /* try to load from relative pos */ - docbase = sp_repr_document_root (repr->document())->attribute("sodipodi:docbase"); + docbase = repr->document()->root()->attribute("sodipodi:docbase"); if (!docbase) docbase = "."; fullname = g_build_filename(docbase, filename, NULL); pixbuf = Inkscape::IO::pixbuf_new_from_file( fullname, NULL ); diff --git a/src/xml/repr-action-test.cpp b/src/xml/repr-action-test.cpp index 7ab857f46..0e3d8d4a4 100644 --- a/src/xml/repr-action-test.cpp +++ b/src/xml/repr-action-test.cpp @@ -12,7 +12,7 @@ int main(int argc, char *argv[]) { Inkscape::GC::init(); document = sp_repr_document_new("test"); - root = sp_repr_document_root(document); + root = document->root(); utest_start("XML Transactions"); diff --git a/src/xml/repr.h b/src/xml/repr.h index 1f7f68bf1..89221656a 100644 --- a/src/xml/repr.h +++ b/src/xml/repr.h @@ -130,19 +130,8 @@ char const *sp_xml_ns_uri_prefix(gchar const *uri, gchar const *suggested); char const *sp_xml_ns_prefix_uri(gchar const *prefix); - -/*inline Inkscape::XML::Node *sp_repr_duplicate(Inkscape::XML::Node const *repr) { - return repr->duplicate(); -}*/ - Inkscape::XML::Document *sp_repr_document_new(gchar const *rootname); -/// Returns root node of document. -inline Inkscape::XML::Node *sp_repr_document_root(Inkscape::XML::Document const *doc) { - if (!doc) return NULL; - return const_cast(doc->root()); -} - /* Contents */ /// Sets the node's \a key attribute to \a value. inline unsigned sp_repr_set_attr(Inkscape::XML::Node *repr, gchar const *key, gchar const *value,