diff options
-rw-r--r-- | src/mainwindow.c | 5 | ||||
-rw-r--r-- | src/sc_parse.c | 21 | ||||
-rw-r--r-- | src/sc_parse.h | 3 |
3 files changed, 26 insertions, 3 deletions
diff --git a/src/mainwindow.c b/src/mainwindow.c index 20a35b7..39d19f5 100644 --- a/src/mainwindow.c +++ b/src/mainwindow.c @@ -670,9 +670,8 @@ static gint add_slide_sig(GtkWidget *widget, struct presentation *p) cur_slide_number = slide_number(p, p->cur_edit_slide); new = add_slide(p, cur_slide_number+1); - /* FIXME: position */ - new->scblocks = sc_block_append_inside(p->scblocks, "slide", - NULL, NULL); + new->scblocks = sc_block_insert_after(p->cur_edit_slide->scblocks, + "slide", NULL, NULL); change_edit_slide(p, new); diff --git a/src/sc_parse.c b/src/sc_parse.c index a37775d..0881464 100644 --- a/src/sc_parse.c +++ b/src/sc_parse.c @@ -170,6 +170,27 @@ SCBlock *sc_block_append_inside(SCBlock *parent, } +/* Insert a new block to the chain, just after "afterme". + * "name", "options" and "contents" will not be copied. Returns the block just + * created, or NULL on error. */ +SCBlock *sc_block_insert_after(SCBlock *afterme, + char *name, char *opt, char *contents) +{ + SCBlock *bl; + + bl = sc_block_new(); + if ( bl == NULL ) return NULL; + + bl->name = name; + bl->options = opt; + bl->contents = contents; + bl->child = NULL; + bl->next = afterme->next; + afterme->next = bl; + + return bl; +} + /* Frees "bl" and all its children */ void sc_block_free(SCBlock *bl) diff --git a/src/sc_parse.h b/src/sc_parse.h index 5bd50d8..2fa01be 100644 --- a/src/sc_parse.h +++ b/src/sc_parse.h @@ -48,6 +48,9 @@ extern SCBlock *sc_block_append(SCBlock *bl, extern SCBlock *sc_block_append_inside(SCBlock *bl, char *name, char *opt, char *contents); +extern SCBlock *sc_block_insert_after(SCBlock *afterme, + char *name, char *opt, char *contents); + extern struct frame *sc_block_frame(const SCBlock *bl); extern void sc_block_set_frame(SCBlock *bl, struct frame *fr); |