diff options
author | Thomas White <taw@bitwiz.me.uk> | 2018-10-17 14:50:28 +0200 |
---|---|---|
committer | Thomas White <taw@bitwiz.me.uk> | 2018-10-17 14:50:28 +0200 |
commit | 2b2a139a94c932d50a5ad5a5ab91f997493e5b5a (patch) | |
tree | a80c35594d21c4259284a0db5818e077fc1ec70a /src/presentation.c | |
parent | 8f7480255e76fc27bcab5ab10ef6c15368c5c495 (diff) |
Switch to new Stylesheet type
Diffstat (limited to 'src/presentation.c')
-rw-r--r-- | src/presentation.c | 56 |
1 files changed, 2 insertions, 54 deletions
diff --git a/src/presentation.c b/src/presentation.c index b3676b5..c3f0d07 100644 --- a/src/presentation.c +++ b/src/presentation.c @@ -226,59 +226,6 @@ SCBlock *prev_slide(struct presentation *p, SCBlock *sl) } -int replace_stylesheet(struct presentation *p, SCBlock *ss) -{ - /* Create style sheet from union of old and new, - * preferring items from the new one */ - - /* If there was no stylesheet before, add a dummy one */ - if ( p->stylesheet == NULL ) { - p->stylesheet = sc_block_append_end(p->scblocks, - "stylesheet", NULL, NULL); - } - - /* Cut the old stylesheet out of the presentation, - * and put in the new one */ - sc_block_substitute(&p->scblocks, p->stylesheet, ss); - p->stylesheet = ss; - - return 0; -} - - -SCBlock *find_stylesheet(SCBlock *bl) -{ - while ( bl != NULL ) { - - const char *name = sc_block_name(bl); - - if ( (name != NULL) && (strcmp(name, "stylesheet") == 0) ) { - return bl; - } - - bl = sc_block_next(bl); - - } - - return NULL; -} - - -static void install_stylesheet(struct presentation *p) -{ - if ( p->stylesheet != NULL ) { - fprintf(stderr, _("Duplicate style sheet!\n")); - return; - } - - p->stylesheet = find_stylesheet(p->scblocks); - - if ( p->stylesheet == NULL ) { - fprintf(stderr, _("No style sheet.\n")); - } -} - - static void set_slide_size_from_stylesheet(struct presentation *p) { /* FIXME: From JSON */ @@ -310,7 +257,8 @@ int load_presentation(struct presentation *p, GFile *file) return r; /* Error */ } - install_stylesheet(p); + p->stylesheet = stylesheet_load("stylesheet.json"); /* FIXME: ! */ + set_slide_size_from_stylesheet(p); assert(p->uri == NULL); |