aboutsummaryrefslogtreecommitdiff
path: root/src/sc_interp.c
diff options
context:
space:
mode:
authorThomas White <taw@bitwiz.me.uk>2018-10-17 15:28:59 +0200
committerThomas White <taw@bitwiz.me.uk>2018-10-17 15:28:59 +0200
commitd7cf85134ea2559de04fbb094b1308b80e51f336 (patch)
tree0f9c6cb8969f6d9b467e4076d328a1a211c71b33 /src/sc_interp.c
parent51e1d39d8eaaf02f23ed0b83695e0294a23496bb (diff)
Initial style lookup
Diffstat (limited to 'src/sc_interp.c')
-rw-r--r--src/sc_interp.c26
1 files changed, 22 insertions, 4 deletions
diff --git a/src/sc_interp.c b/src/sc_interp.c
index ed49597..b603c61 100644
--- a/src/sc_interp.c
+++ b/src/sc_interp.c
@@ -1085,6 +1085,27 @@ static int check_outputs(SCBlock *bl, SCInterpreter *scin, Stylesheet *ss)
}
+static void apply_style(SCInterpreter *scin, Stylesheet *ss, const char *path)
+{
+ char fullpath[256];
+ size_t len;
+ char *bgcol1;
+
+ len = strlen(path);
+ if ( len > 160 ) {
+ fprintf(stderr, "Can't apply style: path too long.\n");
+ return;
+ }
+
+ strcpy(fullpath, path);
+ strcat(fullpath, ".bggradv");
+ bgcol1 = stylesheet_lookup(ss, fullpath);
+ set_bggrad(scin, bgcol1, GRAD_VERT);
+
+ update_bg(scin);
+}
+
+
int sc_interp_add_block(SCInterpreter *scin, SCBlock *bl, Stylesheet *ss)
{
const char *name = sc_block_name(bl);
@@ -1107,10 +1128,7 @@ int sc_interp_add_block(SCInterpreter *scin, SCBlock *bl, Stylesheet *ss)
} else if ( strcmp(name, "presentation") == 0 ) {
maybe_recurse_before(scin, child);
- set_bgcol(scin, "#ff00ff");
- update_bg(scin);
- printf("pres\n");
- /* FIXME: Apply narrative style */
+ apply_style(scin, ss, "$.narrative");
maybe_recurse_after(scin, child, ss);
} else if ( strcmp(name, "slide") == 0 ) {