diff options
author | Thomas White <taw@bitwiz.org.uk> | 2013-09-08 12:00:23 +0200 |
---|---|---|
committer | Thomas White <taw@bitwiz.org.uk> | 2013-09-08 12:00:23 +0200 |
commit | ef54e09be04a5717ba269e0feea774777820d0ac (patch) | |
tree | a42d0a9a38966828e721c61d0ba4bf4923a897ea /src/presentation.c | |
parent | d132ff94753dcfe37a740f7ff1e822261fdef7ee (diff) |
Add \slidenumber
Diffstat (limited to 'src/presentation.c')
-rw-r--r-- | src/presentation.c | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/src/presentation.c b/src/presentation.c index ccd3c18..d88352f 100644 --- a/src/presentation.c +++ b/src/presentation.c @@ -65,6 +65,15 @@ void free_presentation(struct presentation *p) } +static void renumber_slides(struct presentation *p) +{ + int i; + for ( i=0; i<p->num_slides; i++ ) { + p->slides[i]->constants->slide_number = i+1; + } +} + + int insert_slide(struct presentation *p, struct slide *new, int pos) { struct slide **try; @@ -99,6 +108,8 @@ int insert_slide(struct presentation *p, struct slide *new, int pos) new->parent = p; p->num_slides++; + renumber_slides(p); + return 0; } @@ -114,6 +125,12 @@ struct slide *new_slide() new->rendered_proj = NULL; new->rendered_thumb = NULL; + new->constants = calloc(1, sizeof(struct slide_constants)); + if ( new->constants == NULL ) { + free(new); + return NULL; + } + new->top = frame_new(); /* FIXME: Set zero margins etc on top level frame */ @@ -215,6 +232,13 @@ struct presentation *new_presentation() struct presentation *new; new = calloc(1, sizeof(struct presentation)); + if ( new == NULL ) return NULL; + + new->constants = calloc(1, sizeof(struct presentation_constants)); + if ( new->constants == NULL ) { + free(new); + return NULL; + } num_presentations++; new->num_presentations = &num_presentations; |