aboutsummaryrefslogtreecommitdiff
path: root/src/narrative_window.c
diff options
context:
space:
mode:
authorThomas White <taw@bitwiz.org.uk>2016-04-23 22:05:53 +0200
committerThomas White <taw@bitwiz.org.uk>2016-04-23 22:05:53 +0200
commit94f0073b1c4fb1a6f19106c3c29400975b295f5e (patch)
tree9e4e40d545958192b4cbfd7b1bf8b6d5c5b99373 /src/narrative_window.c
parent890e5ac7b89f5cccf120d966dc488f9ddd516a3d (diff)
parent75df2646fe370bf2c29b965fc8330bdff7329484 (diff)
Merge branch 'pangolayout'
Diffstat (limited to 'src/narrative_window.c')
-rw-r--r--src/narrative_window.c39
1 files changed, 17 insertions, 22 deletions
diff --git a/src/narrative_window.c b/src/narrative_window.c
index 6e09d71..5a352f7 100644
--- a/src/narrative_window.c
+++ b/src/narrative_window.c
@@ -139,41 +139,36 @@ static void exportpdf_sig(GSimpleAction *action, GVariant *parameter,
}
-static void open_slidesorter_sig(GSimpleAction *action, GVariant *parameter, gpointer vp)
+static void open_slidesorter_sig(GSimpleAction *action, GVariant *parameter,
+ gpointer vp)
{
}
-static void delete_frame_sig(GSimpleAction *action, GVariant *parameter, gpointer vp)
+static void delete_frame_sig(GSimpleAction *action, GVariant *parameter,
+ gpointer vp)
{
}
-static void add_slide_sig(GSimpleAction *action, GVariant *parameter, gpointer vp)
+static void add_slide_sig(GSimpleAction *action, GVariant *parameter,
+ gpointer vp)
{
- int n_slides;
- SCBlock *block;
SCBlock *nsblock;
NarrativeWindow *nw = vp;
- /* Link it into the SC structure */
- nsblock = sc_parse("\\slide{}");
- insert_scblock(nsblock, nw->sceditor);
-
- /* Iterate over blocks of presentation, counting \slides, until
- * we reach the block we just added */
- block = nw->p->scblocks;
- n_slides = 0;
- while ( block != NULL ) {
- const char *n = sc_block_name(block);
- if ( n == NULL ) goto next;
- if ( strcmp(n, "slide") == 0 ) {
- if ( block == nsblock ) break;
- n_slides++;
- }
-next:
- block = sc_block_next(block);
+ /* Split the current paragraph */
+ nsblock = split_paragraph_at_cursor(nw->sceditor);
+
+ /* Link the new SCBlock in */
+ if ( nsblock != NULL ) {
+ sc_block_append(nsblock, "slide", NULL, NULL, NULL);
+ } else {
+ fprintf(stderr, "Failed to split paragraph\n");
}
+
+ sc_editor_set_scblock(nw->sceditor,
+ sc_editor_get_scblock(nw->sceditor));
}