summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 681b284)
raw | patch | inline | side by side (parent: 681b284)
author | sasilver <sasilver@users.sourceforge.net> | |
Mon, 30 Jun 2008 12:22:10 +0000 (12:22 +0000) | ||
committer | sasilver <sasilver@users.sourceforge.net> | |
Mon, 30 Jun 2008 12:22:10 +0000 (12:22 +0000) |
src/sp-item-group.cpp | patch | blob | history | |
src/xml/repr-util.cpp | patch | blob | history | |
src/xml/repr.h | patch | blob | history |
diff --git a/src/sp-item-group.cpp b/src/sp-item-group.cpp
index 556a349ed836a40557d4ecd78790222cada043d9..9e6333f97dcc14c42bbd9e6caa845c75341008b4 100644 (file)
--- a/src/sp-item-group.cpp
+++ b/src/sp-item-group.cpp
if (objects) {
Inkscape::XML::Node *last_def = SP_OBJECT_REPR(defs)->lastChild();
while (objects) {
- SP_OBJECT_REPR(defs)->addChild((Inkscape::XML::Node *) objects->data, last_def);
- Inkscape::GC::release((Inkscape::XML::Node *) objects->data);
+ Inkscape::XML::Node *repr = (Inkscape::XML::Node *) objects->data;
+ if (!sp_repr_is_meta_element(repr))
+ SP_OBJECT_REPR(defs)->addChild(repr, last_def);
+ Inkscape::GC::release(repr);
objects = g_slist_remove (objects, objects->data);
}
}
diff --git a/src/xml/repr-util.cpp b/src/xml/repr-util.cpp
index 97676bebe27dd4d919d2129ef4839957ff93257e..193c1125c631015dd60069127199405cadece0ad 100644 (file)
--- a/src/xml/repr-util.cpp
+++ b/src/xml/repr-util.cpp
@@ -445,6 +445,22 @@ sp_repr_lookup_name( Inkscape::XML::Node *repr, gchar const *name, gint maxdepth
return found;
}
+/**
+ * Determine if the node is a 'title', 'desc' or 'metadata' element.
+ */
+bool
+sp_repr_is_meta_element(const Inkscape::XML::Node *node)
+{
+ if (node == NULL) return false;
+ if (node->type() != Inkscape::XML::ELEMENT_NODE) return false;
+ gchar const *name = node->name();
+ if (name == NULL) return false;
+ if (!std::strcmp(name, "svg:title")) return true;
+ if (!std::strcmp(name, "svg:desc")) return true;
+ if (!std::strcmp(name, "svg:metadata")) return true;
+ return false;
+}
+
/**
* Parses the boolean value of an attribute "key" in repr and sets val accordingly, or to FALSE if
* the attr is not set.
diff --git a/src/xml/repr.h b/src/xml/repr.h
index 162451a0fb304f61c22238a7b7a4c1f831e846be..f0a1dbeb61a8c5fae564f2d5d470683a2482817d 100644 (file)
--- a/src/xml/repr.h
+++ b/src/xml/repr.h
}
}
+bool sp_repr_is_meta_element(const Inkscape::XML::Node *node);
+
/* Convenience */
unsigned sp_repr_get_boolean(Inkscape::XML::Node *repr, gchar const *key, unsigned *val);
unsigned sp_repr_get_int(Inkscape::XML::Node *repr, gchar const *key, int *val);