summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorKrzysztof Kosi??ski <tweenk.pl@gmail.com>2010-04-05 00:35:52 +0000
committerKrzysztof KosiƄski <tweenk.pl@gmail.com>2010-04-05 00:35:52 +0000
commit0f80d9cd7596336ef16da1db940c383e4fb163e1 (patch)
tree199829347b9c7f7ae581cb3fd80426c0493d113d /src
parentTranslations. inkscape.pot update (glyph dialog again). (diff)
parentCoords: fix guidelines (diff)
downloadinkscape-0f80d9cd7596336ef16da1db940c383e4fb163e1.tar.gz
inkscape-0f80d9cd7596336ef16da1db940c383e4fb163e1.zip
Second batch of coords fixes (guides, text cursor, zoom)
(bzr r9295)
Diffstat (limited to 'src')
-rw-r--r--src/desktop.cpp4
-rw-r--r--src/document.cpp2
-rw-r--r--src/sp-guide.cpp6
-rw-r--r--src/sp-object-repr.cpp17
-rw-r--r--src/sp-object-repr.h2
-rw-r--r--src/text-context.cpp2
6 files changed, 18 insertions, 15 deletions
diff --git a/src/desktop.cpp b/src/desktop.cpp
index 1953ae2a6..6690e0af1 100644
--- a/src/desktop.cpp
+++ b/src/desktop.cpp
@@ -724,8 +724,8 @@ SPDesktop::point() const
if (p[Geom::X] >= r0[Geom::X] &&
p[Geom::X] <= r1[Geom::X] &&
- p[Geom::Y] >= r1[Geom::Y] &&
- p[Geom::Y] <= r0[Geom::Y])
+ p[Geom::Y] >= r0[Geom::Y] &&
+ p[Geom::Y] <= r1[Geom::Y])
{
return p;
} else {
diff --git a/src/document.cpp b/src/document.cpp
index f137ba60d..aeafaf1f9 100644
--- a/src/document.cpp
+++ b/src/document.cpp
@@ -327,7 +327,7 @@ sp_document_create(Inkscape::XML::Document *rdoc,
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 f5edf7d97..def039937 100644
--- 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 62143e3ab..e32819746 100644
--- a/src/sp-object-repr.cpp
+++ b/src/sp-object-repr.cpp
@@ -91,9 +91,9 @@ static unsigned const N_NAME_TYPES = SODIPODI_TYPE + 1;
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);
@@ -103,13 +103,14 @@ sp_object_repr_build_tree(SPDocument *document, Inkscape::XML::Node *repr)
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 f3a80f83c..43aead41e 100644
--- a/src/sp-object-repr.h
+++ b/src/sp-object-repr.h
@@ -21,7 +21,7 @@ class Node;
}
-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);
diff --git a/src/text-context.cpp b/src/text-context.cpp
index 4f89bd1e1..984876f78 100644
--- a/src/text-context.cpp
+++ b/src/text-context.cpp
@@ -684,7 +684,7 @@ sp_text_context_root_handler(SPEventContext *const event_context, GdkEvent *cons
// Cursor height is defined by the new text object's font size; it needs to be set
// articifically here, for the text object does not exist yet:
double cursor_height = sp_desktop_get_font_size_tool(desktop);
- sp_ctrlline_set_coords(SP_CTRLLINE(tc->cursor), dtp, dtp + Geom::Point(0, cursor_height));
+ sp_ctrlline_set_coords(SP_CTRLLINE(tc->cursor), dtp, dtp - Geom::Point(0, cursor_height));
event_context->_message_context->set(Inkscape::NORMAL_MESSAGE, _("Type text; <b>Enter</b> to start new line.")); // FIXME:: this is a copy of a string from _update_cursor below, do not desync
event_context->within_tolerance = false;