aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas White <taw@bitwiz.org.uk>2014-09-08 20:57:24 +0200
committerThomas White <taw@bitwiz.org.uk>2014-09-08 20:57:24 +0200
commitcba13eb85af0714aa7ffa605773215baf5833612 (patch)
tree4295d49db28d642de9c17c0f4a209a11a87b39e5
parentcf20a05e3f18d11ded94a74b072c963b3174e168 (diff)
Insert furniture
-rw-r--r--src/mainwindow.c4
-rw-r--r--src/sc_parse.c30
-rw-r--r--src/sc_parse.h3
3 files changed, 35 insertions, 2 deletions
diff --git a/src/mainwindow.c b/src/mainwindow.c
index b3f2d4b..c203736 100644
--- a/src/mainwindow.c
+++ b/src/mainwindow.c
@@ -195,8 +195,8 @@ struct menu_pl
static gint add_furniture(GtkWidget *widget, struct menu_pl *pl)
{
- /* FIXME: Add it */
- printf("Adding '%s'\n", pl->style_name);
+ sc_block_append_end(pl->p->cur_edit_slide->scblocks,
+ strdup(pl->style_name), NULL, NULL);
do_slide_update(pl->p, pl->p->pc);
diff --git a/src/sc_parse.c b/src/sc_parse.c
index 7218ec9..f30d6b0 100644
--- a/src/sc_parse.c
+++ b/src/sc_parse.c
@@ -132,6 +132,36 @@ SCBlock *sc_block_append(SCBlock *bl, char *name, char *opt, char *contents,
}
+/* Insert a new block at the end of the chain starting 'bl'.
+ * "name", "options" and "contents" will not be copied. Returns the block just
+ * created, or NULL on error. */
+SCBlock *sc_block_append_end(SCBlock *bl, char *name, char *opt, char *contents)
+{
+ SCBlock *bln = sc_block_new();
+
+ if ( bln == NULL ) return NULL;
+
+ while ( bl->next != NULL ) {
+ bl = bl->next;
+ };
+
+ bln->name = name;
+ bln->options = opt;
+ bln->contents = contents;
+ bln->child = NULL;
+ bln->next = NULL;
+
+ if ( bl == NULL ) {
+ bln->prev = NULL;
+ } else {
+ bl->next = bln;
+ bln->prev = bl;
+ }
+
+ return bln;
+}
+
+
/* Append a new block to the chain inside "parent".
* "name", "options" and "contents" will not be copied. Returns the block just
* created, or NULL on error. */
diff --git a/src/sc_parse.h b/src/sc_parse.h
index 1e3cbe9..a5c1514 100644
--- a/src/sc_parse.h
+++ b/src/sc_parse.h
@@ -45,6 +45,9 @@ extern SCBlock *sc_block_append(SCBlock *bl,
char *name, char *opt, char *contents,
SCBlock **blfp);
+extern SCBlock *sc_block_append_end(SCBlock *bl,
+ char *name, char *opt, char *contents);
+
extern SCBlock *sc_block_append_inside(SCBlock *parent,
char *name, char *opt, char *contents);