From 1f2629403b9d62ecf44420f789b5c679a8ae1c98 Mon Sep 17 00:00:00 2001 From: Thomas White Date: Mon, 13 Jan 2020 00:06:05 +0100 Subject: Add segment start/end markers --- libstorycode/narrative.c | 34 ++++++++++++++++++++++++++++++++-- 1 file changed, 32 insertions(+), 2 deletions(-) (limited to 'libstorycode/narrative.c') diff --git a/libstorycode/narrative.c b/libstorycode/narrative.c index f61e0f8..25c01c5 100644 --- a/libstorycode/narrative.c +++ b/libstorycode/narrative.c @@ -186,8 +186,15 @@ int narrative_get_unsaved(Narrative *n) int narrative_item_is_text(Narrative *n, int item) { - if ( n->items[item].type == NARRATIVE_ITEM_SLIDE ) return 0; - if ( n->items[item].type == NARRATIVE_ITEM_EOP ) return 0; + switch ( n->items[item].type ) { + case NARRATIVE_ITEM_SLIDE : return 0; + case NARRATIVE_ITEM_EOP : return 0; + case NARRATIVE_ITEM_TEXT : return 1; + case NARRATIVE_ITEM_BP : return 1; + case NARRATIVE_ITEM_PRESTITLE : return 1; + case NARRATIVE_ITEM_SEGSTART : return 1; + case NARRATIVE_ITEM_SEGEND : return 0; + } return 1; } @@ -292,6 +299,20 @@ void narrative_add_bp(Narrative *n, struct text_run *runs, int n_runs) } +void narrative_add_segstart(Narrative *n, struct text_run *runs, int n_runs) +{ + add_text_item(n, runs, n_runs, NARRATIVE_ITEM_SEGSTART); +} + + +void narrative_add_segend(Narrative *n) +{ + struct narrative_item * item = add_item(n); + if ( item == NULL ) return; + item->type = NARRATIVE_ITEM_SEGEND; +} + + void narrative_add_slide(Narrative *n, Slide *slide) { struct narrative_item *item; @@ -754,6 +775,15 @@ void narrative_debug(Narrative *n) printf("(EOP marker)\n"); break; + case NARRATIVE_ITEM_SEGSTART : + printf("(start of segment):\n"); + debug_runs(item); + break; + + case NARRATIVE_ITEM_SEGEND : + printf("(end of segment)\n"); + break; + case NARRATIVE_ITEM_SLIDE : printf("Slide:\n"); describe_slide(item->slide); -- cgit v1.2.3