summaryrefslogtreecommitdiffstats
path: root/src/sp-object.cpp
diff options
context:
space:
mode:
authorMarkus Engel <markus.engel@tum.de>2013-09-24 22:17:24 +0000
committerMarkus Engel <markus.engel@tum.de>2013-09-24 22:17:24 +0000
commitbcca22a25ae98f70c36fff6292f0a8fe4e578d89 (patch)
treea18d382d32f471b7119b9b7b2782cec04d6da43f /src/sp-object.cpp
parentRefactored SPUse. (diff)
parentFix my email address through codebase (diff)
downloadinkscape-bcca22a25ae98f70c36fff6292f0a8fe4e578d89.tar.gz
inkscape-bcca22a25ae98f70c36fff6292f0a8fe4e578d89.zip
Merged from trunk (r12588).
(bzr r11608.1.129)
Diffstat (limited to 'src/sp-object.cpp')
-rw-r--r--src/sp-object.cpp37
1 files changed, 22 insertions, 15 deletions
diff --git a/src/sp-object.cpp b/src/sp-object.cpp
index 895b36e1c..6fd4de43b 100644
--- a/src/sp-object.cpp
+++ b/src/sp-object.cpp
@@ -61,6 +61,14 @@ 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 = {
@@ -588,9 +596,14 @@ void SPObject::child_added(Inkscape::XML::Node *child, Inkscape::XML::Node *ref)
ochild->invoke_build(object->document, child, object->cloned);
} catch (const FactoryExceptions::TypeNotRegistered& e) {
- if (std::string(e.what()) != "rdf:RDF") { // temporary special case
- g_warning("TypeNotRegistered exception: %s", e.what());
- }
+ std::string node = e.what();
+
+ // special cases
+ if (node.empty()) return; // comments, usually
+ if (node == "rdf:RDF") return; // no SP node yet
+ if (node == "inkscape:clipboard") return; // SP node not necessary
+
+ g_warning("TypeNotRegistered exception: %s", e.what());
}
}
@@ -635,27 +648,21 @@ void SPObject::build(SPDocument *document, Inkscape::XML::Node *repr) {
object->readAttr("inkscape:collect");
for (Inkscape::XML::Node *rchild = repr->firstChild() ; rchild != NULL; rchild = rchild->next()) {
-// GType type = sp_repr_type_lookup(rchild);
-// if (!type) {
-// continue;
-// }
-// SPObject *child = SP_OBJECT(g_object_new(type, 0));
-
-// SPObject* child = SPFactory::instance().createObject(*rchild);
-// if (!child) {
-// continue;
-// }
-
try {
const std::string typeString = NodeTraits::get_type_string(*rchild);
+ // special cases
+ if (typeString.empty()) continue; // comments, usually
+ if (typeString == "rdf:RDF") continue; // no SP node yet
+ if (typeString == "inkscape:clipboard") continue; // SP node not necessary
+
SPObject* child = SPFactory::instance().createObject(typeString);
object->attach(child, object->lastChild());
sp_object_unref(child, NULL);
child->invoke_build(document, rchild, object->cloned);
} catch (const FactoryExceptions::TypeNotRegistered& e) {
- //g_warning("TypeNotRegistered exception: %s", e.what());
+ g_warning("TypeNotRegistered exception: %s", e.what());
}
}
}