From 3c76fed403bf8b5daeeb9e47fc8989e834b1e71d Mon Sep 17 00:00:00 2001 From: Thomas White Date: Sun, 6 Nov 2011 16:54:45 +0100 Subject: Add stuff which should be filled in during deserialization --- src/tool_text.c | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/tool_text.c b/src/tool_text.c index 320ffbf..6a57c07 100644 --- a/src/tool_text.c +++ b/src/tool_text.c @@ -689,7 +689,7 @@ static struct object *deserialize(struct presentation *p, struct ds_node *root, char *style; char *text; struct style *sty; - double x, y; + double x, y, w, h; struct text_toolinfo *ti = (struct text_toolinfo *)tip; if ( get_field_s(root, "style", &style) ) { @@ -721,16 +721,32 @@ static struct object *deserialize(struct presentation *p, struct ds_node *root, root->key); return NULL; } + if ( get_field_f(root, "w", &w) ) { + fprintf(stderr, + "Couldn't find width for object '%s'\n", + root->key); + return NULL; + } + if ( get_field_f(root, "h", &h) ) { + fprintf(stderr, + "Couldn't find height for object '%s'\n", + root->key); + return NULL; + } } else { /* Furniture */ x = 0.0; y = 0.0; + w = 0.0; + h = 0.0; } o = new_text_object(x, y, sty, ti); + o->bb_width = w; + o->bb_height = h; /* Apply the correct text */ if ( get_field_s(root, "text", &text) ) { @@ -741,6 +757,7 @@ static struct object *deserialize(struct presentation *p, struct ds_node *root, to = (struct text_object *)o; free(to->text); to->text = text; + to->text_len = strlen(text); o->parent = s; o->empty = 0; update_text(to); @@ -769,5 +786,7 @@ struct toolinfo *initialise_text_tool(GtkWidget *w) ti->base.realise = realise; ti->base.deserialize = deserialize; + ti->drag_reason = DRAG_REASON_NONE; + return (struct toolinfo *)ti; } -- cgit v1.2.3