diff options
author | Thomas White <taw@bitwiz.org.uk> | 2012-10-15 00:17:13 +0200 |
---|---|---|
committer | Thomas White <taw@bitwiz.org.uk> | 2012-10-15 00:17:13 +0200 |
commit | 5e3ff44338005f0b9783993e67c6395dcf5c9768 (patch) | |
tree | 85ec06404170adf3c3d9f8fe769a7d0316c46d88 /src/presentation.c | |
parent | 350c51a006edba2a46e7f17bf05098b398a4cb80 (diff) |
Rendering and redraw pipeline
Diffstat (limited to 'src/presentation.c')
-rw-r--r-- | src/presentation.c | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/src/presentation.c b/src/presentation.c index 1b3e00c..74f9c3c 100644 --- a/src/presentation.c +++ b/src/presentation.c @@ -111,6 +111,9 @@ struct slide *new_slide() new->rendered_proj = NULL; new->rendered_thumb = NULL; + new->top = frame_new(); + /* FIXME: Set zero margins etc on top level frame */ + new->notes = strdup(""); return new; @@ -193,6 +196,17 @@ int slide_number(struct presentation *p, struct slide *s) } +static int alloc_selection(struct presentation *p) +{ + struct frame **new_selection; + new_selection = realloc(p->selection, + p->max_selection*sizeof(struct frame *)); + if ( new_selection == NULL ) return 1; + p->selection = new_selection; + return 0; +} + + struct presentation *new_presentation() { struct presentation *new; @@ -228,6 +242,11 @@ struct presentation *new_presentation() new->n_menu_rebuild = 0; new->menu_rebuild_list = NULL; + new->selection = NULL; + new->n_selection = 0; + new->max_selection = 64; + if ( alloc_selection(new) ) return NULL; + return new; } @@ -417,3 +436,29 @@ int load_presentation(struct presentation *p, const char *filename) return 0; } + +void set_edit(struct presentation *p, struct slide *s) +{ + p->cur_edit_slide = s; +} + + +void set_selection(struct presentation *p, struct frame *fr) +{ + p->selection[0] = fr; + p->n_selection = 1; +} + + +void add_selection(struct presentation *p, struct frame *fr) +{ + if ( p->n_selection == p->max_selection ) { + p->max_selection += 64; + if ( alloc_selection(p) ) { + fprintf(stderr, "Not enough memory for selection.\n"); + return; + } + } + + p->selection[p->n_selection++] = fr; +} |