diff options
author | Thomas White <taw@bitwiz.me.uk> | 2019-03-30 17:32:24 +0100 |
---|---|---|
committer | Thomas White <taw@bitwiz.me.uk> | 2019-03-30 17:32:24 +0100 |
commit | 5a1e588c3fbdce549e0b3c487e2671c679890675 (patch) | |
tree | ce7f29799aa02cec088d2ec676069ae4ac9cac8d /src/pdfstorycode.c | |
parent | 96c903e0756e8a85649c1f7d8d6aa1b146b8c038 (diff) |
Get rid of Presentation structure
It doesn't have any reason to exist. A Narrative defines the top-level
object already. This is, after all, a narrative-based presentation
system.
This removes a lot of faff surrounding retrieving the Narrative from the
Presentation. It also removes a gigantic place for bugs to hide in
keeping the Presentation's view of the slides in sync with the
Narrative's opinion.
What was that quote? "Code is terrible, and we want as little of it as
possible in our program."
Diffstat (limited to 'src/pdfstorycode.c')
-rw-r--r-- | src/pdfstorycode.c | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/src/pdfstorycode.c b/src/pdfstorycode.c index 421839d..d09fb47 100644 --- a/src/pdfstorycode.c +++ b/src/pdfstorycode.c @@ -35,7 +35,7 @@ #include <pango/pangocairo.h> #include "storycode.h" -#include "presentation.h" +#include "narrative.h" #include "slide.h" #include "imagestore.h" #include "slide_render_cairo.h" @@ -44,7 +44,7 @@ #define _(x) gettext(x) -static int render_slides_to_pdf(Presentation *p, ImageStore *is, const char *filename) +static int render_slides_to_pdf(Narrative *n, ImageStore *is, const char *filename) { double w = 2048.0; cairo_surface_t *surf; @@ -64,20 +64,20 @@ static int render_slides_to_pdf(Presentation *p, ImageStore *is, const char *fil sel.para = 0; sel.pos = 0; sel.trail = 0; - for ( i=0; i<presentation_get_num_slides(p); i++ ) + for ( i=0; i<narrative_get_num_slides(n); i++ ) { Slide *s; double log_w, log_h; - s = presentation_get_slide_by_number(p, i); - slide_get_logical_size(s, presentation_get_stylesheet(p), + s = narrative_get_slide_by_number(n, i); + slide_get_logical_size(s, narrative_get_stylesheet(n), &log_w, &log_h); cairo_pdf_surface_set_size(surf, w, w*(log_h/log_w)); cairo_save(cr); cairo_scale(cr, w/log_w, w/log_w); - slide_render_cairo(s, cr, is, presentation_get_stylesheet(p), + slide_render_cairo(s, cr, is, narrative_get_stylesheet(n), i, pango_language_get_default(), pc, NULL, sel, sel); cairo_show_page(cr); @@ -98,20 +98,20 @@ int main(int argc, char *argv[]) GBytes *bytes; const char *text; size_t len; - Presentation *p; + Narrative *n; ImageStore *is; file = g_file_new_for_commandline_arg(argv[1]); bytes = g_file_load_bytes(file, NULL, NULL, NULL); text = g_bytes_get_data(bytes, &len); - p = storycode_parse_presentation(text); + n = storycode_parse_presentation(text); g_bytes_unref(bytes); is = imagestore_new("."); imagestore_set_parent(is, g_file_get_parent(file)); /* Render each slide to PDF */ - render_slides_to_pdf(p, is, "slides.pdf"); + render_slides_to_pdf(n, is, "slides.pdf"); return 0; } |