aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas White <taw@bitwiz.org.uk>2011-11-06 16:54:45 +0100
committerThomas White <taw@bitwiz.org.uk>2011-11-06 16:54:45 +0100
commit3c76fed403bf8b5daeeb9e47fc8989e834b1e71d (patch)
treeb210385b226bb6fb7a3e0c989c43b7d9e9708be2
parent6f29edb7b7ea789bc4bde1ee3237cca96c271202 (diff)
Add stuff which should be filled in during deserialization
-rw-r--r--src/tool_text.c21
1 files changed, 20 insertions, 1 deletions
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;
}