diff options
author | Thomas White <taw@bitwiz.me.uk> | 2020-01-13 00:06:05 +0100 |
---|---|---|
committer | Thomas White <taw@bitwiz.me.uk> | 2020-01-13 00:17:50 +0100 |
commit | 1f2629403b9d62ecf44420f789b5c679a8ae1c98 (patch) | |
tree | 42f9c50056c089f9d70554dcdae626ffd8f552f1 /libstorycode/narrative.c | |
parent | 7304e278ced9adee5884482bbf3223f8ba1ccfde (diff) |
Add segment start/end markers
Diffstat (limited to 'libstorycode/narrative.c')
-rw-r--r-- | libstorycode/narrative.c | 34 |
1 files changed, 32 insertions, 2 deletions
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); |