diff options
author | Thomas White <taw@bitwiz.org.uk> | 2014-09-11 22:02:40 +0200 |
---|---|---|
committer | Thomas White <taw@bitwiz.org.uk> | 2014-09-11 22:02:40 +0200 |
commit | 59c8ad0d099c1fdefcf7676458b70ecaf98f5fc9 (patch) | |
tree | 3394970fcb31acfb18145db0e3a899945a1b7aa0 /src | |
parent | 351618c287e0567c28471c0433f5678a37182c1b (diff) |
Get rid of slide and presentation constants
Diffstat (limited to 'src')
-rw-r--r-- | src/presentation.c | 29 | ||||
-rw-r--r-- | src/presentation.h | 16 | ||||
-rw-r--r-- | src/render.c | 12 | ||||
-rw-r--r-- | src/sc_interp.c | 14 |
4 files changed, 4 insertions, 67 deletions
diff --git a/src/presentation.c b/src/presentation.c index 3e079e6..952688b 100644 --- a/src/presentation.c +++ b/src/presentation.c @@ -69,19 +69,6 @@ void free_presentation(struct presentation *p) } -static void renumber_slides(struct presentation *p) -{ - int i; - for ( i=0; i<p->num_slides; i++ ) { - if ( p->slides[i]->constants != NULL ) { - p->slides[i]->constants->slide_number = i+1; - } else { - fprintf(stderr, "Slide %i has no constants.\n", i); - } - } -} - - /* "pos" is the index that the caller would like this slide to have */ int insert_slide(struct presentation *p, struct slide *new, int pos) { @@ -109,8 +96,6 @@ int insert_slide(struct presentation *p, struct slide *new, int pos) new->parent = p; - renumber_slides(p); - return 0; } @@ -126,8 +111,6 @@ static void delete_slide_index(struct presentation *p, int pos) p->num_slides--; /* Don't bother to resize the array */ - - renumber_slides(p); } @@ -154,12 +137,6 @@ 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 */ @@ -263,12 +240,6 @@ struct presentation *new_presentation() 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; diff --git a/src/presentation.h b/src/presentation.h index 7dac81a..591efe9 100644 --- a/src/presentation.h +++ b/src/presentation.h @@ -34,27 +34,11 @@ #include "sc_parse.h" -struct slide_constants -{ - int slide_number; -}; - - -struct presentation_constants -{ - char *title; - char *author; - char *date; -}; - - struct slide { struct presentation *parent; struct slide_template *st; - struct slide_constants *constants; - /* Any of these may be NULL */ cairo_surface_t *rendered_proj; cairo_surface_t *rendered_edit; diff --git a/src/render.c b/src/render.c index ea6e573..68c101e 100644 --- a/src/render.c +++ b/src/render.c @@ -301,9 +301,7 @@ static int recursive_wrap_and_draw(struct frame *fr, cairo_t *cr, static int render_frame(cairo_t *cr, struct frame *fr, ImageStore *is, - enum is_size isz, struct slide_constants *scc, - struct presentation_constants *pcc, - PangoContext *pc, SCBlock *scblocks, + enum is_size isz, PangoContext *pc, SCBlock *scblocks, SCBlock *stylesheet) { SCInterpreter *scin; @@ -425,8 +423,7 @@ cairo_surface_t *render_slide(struct slide *s, int w, double ww, double hh, pc = pango_font_map_create_context(fontmap); pango_cairo_update_context(cr, pc); - render_frame(cr, s->top, is, isz, s->constants, - s->parent->constants, pc, s->parent->scblocks, + render_frame(cr, s->top, is, isz, pc, s->parent->scblocks, s->parent->stylesheet); cairo_font_options_destroy(fopts); @@ -489,9 +486,8 @@ int export_pdf(struct presentation *p, const char *filename) s->top->w = w; s->top->h = w*r; - render_frame(cr, s->top, p->is, ISZ_SLIDESHOW, s->constants, - s->parent->constants, pc, s->parent->scblocks, - s->parent->stylesheet); + render_frame(cr, s->top, p->is, ISZ_SLIDESHOW, pc, + s->parent->scblocks, s->parent->stylesheet); cairo_show_page(cr); diff --git a/src/sc_interp.c b/src/sc_interp.c index 8e5868e..c5f25d1 100644 --- a/src/sc_interp.c +++ b/src/sc_interp.c @@ -559,20 +559,6 @@ static int check_outputs(SCBlock *bl, SCInterpreter *scin) options); } - } else if ( strcmp(name, "slidenumber")==0) { - if ( scin->s_constants != NULL ) { - char *tmp = malloc(64); - if ( tmp != NULL ) { - snprintf(tmp, 63, "%i", - scin->s_constants->slide_number); - split_words(sc_interp_get_frame(scin)->boxes, - scin->pc, bl, tmp, scin->lang, 0, - scin); - } - } else { - printf("No slide constants.\n"); - } - } else if ( strcmp(name, "f")==0 ) { struct frame *fr = sc_block_frame(bl); |