summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 205a481)
raw | patch | inline | side by side (parent: 205a481)
author | Krzysztof Kosiński <tweenk.pl@gmail.com> | |
Sun, 4 Apr 2010 23:26:13 +0000 (01:26 +0200) | ||
committer | Krzysztof Kosiński <tweenk.pl@gmail.com> | |
Sun, 4 Apr 2010 23:26:13 +0000 (01:26 +0200) |
src/document.cpp | patch | blob | history | |
src/sp-guide.cpp | patch | blob | history | |
src/sp-object-repr.cpp | patch | blob | history | |
src/sp-object-repr.h | patch | blob | history |
diff --git a/src/document.cpp b/src/document.cpp
index f137ba60dab668fc43d0dd725db569fb2786a3f7..aeafaf1f95c637f52e26117046c497337ff8be61 100644 (file)
--- a/src/document.cpp
+++ b/src/document.cpp
document->base = NULL;
document->name = g_strdup(name);
- document->root = sp_object_repr_build_tree(document, rroot);
+ sp_object_repr_build_tree(document, rroot);
/* fixme: Not sure about this, but lets assume ::build updates */
rroot->setAttribute("inkscape:version", Inkscape::version_string);
diff --git a/src/sp-guide.cpp b/src/sp-guide.cpp
index f5edf7d97cf3a63baf9820d97bf57822ae640f1b..def0399373126139b20ec18cb58bf5295f6edab8 100644 (file)
--- a/src/sp-guide.cpp
+++ b/src/sp-guide.cpp
@@ -217,12 +217,14 @@ static void sp_guide_set(SPObject *object, unsigned int key, const gchar *value)
success += sp_svg_number_read_d(strarray[1], &newy);
g_strfreev (strarray);
if (success == 2) {
- guide->point_on_line = Geom::Point(newx, newy);
+ // Desktop coords fix
+ guide->point_on_line = Geom::Point(newx, sp_document_height(guide->document) - newy);
} else if (success == 1) {
// before 0.46 style guideline definition.
const gchar *attr = SP_OBJECT_REPR(object)->attribute("orientation");
if (attr && !strcmp(attr, "horizontal")) {
- guide->point_on_line = Geom::Point(0, newx);
+ // Desktop coords fix
+ guide->point_on_line = Geom::Point(0, sp_document_height(guide->document) - newx);
} else {
guide->point_on_line = Geom::Point(newx, 0);
}
diff --git a/src/sp-object-repr.cpp b/src/sp-object-repr.cpp
index 62143e3ab047d458d07f611047ff00cf4935a75b..e32819746f52cdb54dee18d6a1d6a0884151e8ff 100644 (file)
--- a/src/sp-object-repr.cpp
+++ b/src/sp-object-repr.cpp
static GType name_to_gtype(NameType name_type, gchar const *name);
/**
- * Construct an SPRoot and all its descendents from the given repr.
+ * Construct an SPRoot and all its descendents from the given XML representation.
*/
-SPObject *
+void
sp_object_repr_build_tree(SPDocument *document, Inkscape::XML::Node *repr)
{
g_assert(document != NULL);
g_assert(name != NULL);
GType const type = name_to_gtype(REPR_NAME, name);
g_assert(g_type_is_a(type, SP_TYPE_ROOT));
- gpointer newobj = g_object_new(type, 0);
- g_assert(newobj != NULL);
- SPObject *const object = SP_OBJECT(newobj);
- g_assert(object != NULL);
- sp_object_invoke_build(object, document, repr, FALSE);
- return object;
+ // create and assign root
+ SPObject *root = SP_OBJECT(g_object_new(type, 0));
+ g_assert(root != NULL);
+ document->root = root;
+
+ // recursively create SP tree elements
+ sp_object_invoke_build(root, document, repr, FALSE);
}
GType
diff --git a/src/sp-object-repr.h b/src/sp-object-repr.h
index f3a80f83c77a1259279d1f3b99dfd85b08a3828c..43aead41e886be8f9f1d9406f6cbcbf76e1f69a0 100644 (file)
--- a/src/sp-object-repr.h
+++ b/src/sp-object-repr.h
}
-SPObject *sp_object_repr_build_tree (SPDocument *document, Inkscape::XML::Node *repr);
+void sp_object_repr_build_tree (SPDocument *document, Inkscape::XML::Node *repr);
GType sp_repr_type_lookup (Inkscape::XML::Node *repr);