diff options
author | Thomas White <taw@bitwiz.org.uk> | 2017-01-08 21:52:33 +0100 |
---|---|---|
committer | Thomas White <taw@bitwiz.org.uk> | 2017-01-08 21:52:33 +0100 |
commit | 97266236e846fedb021a37c3a418d5b79ffed6bc (patch) | |
tree | 2bfef9545b9e43cdc62e943064572244bd1106f9 | |
parent | 8587b378bf7f46f248ea600ab2b789901c3348e6 (diff) |
Allow bits of macros to be editable
-rw-r--r-- | data/demo.sc | 2 | ||||
-rw-r--r-- | src/sc_interp.c | 15 |
2 files changed, 16 insertions, 1 deletions
diff --git a/data/demo.sc b/data/demo.sc index a9aacc1..bf87b7c 100644 --- a/data/demo.sc +++ b/data/demo.sc @@ -6,7 +6,7 @@ \ss[prestitle]{\f[1fx140u+0+0]\pad[20,20,20,20]\fontsize[64]\fgcol[#eeeeee]\contents} \ss[slidetitle]{\f[1fx90u+0+0]\pad[20,20,20,20]\fontsize[36]\fgcol[#eeeeee]\contents} - \ss[footer]{\f[600ux30u+500+740]{\fontsize[11]\bold{T. A. White } | A demonstration talk | 25th September 2013 | \bold{Slide \slidenumber}}} + \ss[footer]{\f[600ux30u+500+740]{\editable{\fontsize[11]\bold{T. A. White} | \editable{A demonstration talk | 25th September 2013} | \bold{Slide} \slidenumber}}} \ss[credit]{\f[600ux30u+700+700]{\fontsize[11]\contents}} \ss[bp]{➤ } diff --git a/src/sc_interp.c b/src/sc_interp.c index 86617de..92bf10f 100644 --- a/src/sc_interp.c +++ b/src/sc_interp.c @@ -1046,6 +1046,18 @@ static void run_macro_contents(SCInterpreter *scin) SCBlock *contents = st->macro_contents; sc_interp_save(scin); + scin->state[scin->j].macro_real_block = NULL; + sc_interp_add_blocks(scin, contents); + sc_interp_restore(scin); +} + + +static void run_editable(SCInterpreter *scin, SCBlock *contents) +{ + struct sc_state *st = &scin->state[scin->j]; + + sc_interp_save(scin); + scin->state[scin->j].macro_real_block = NULL; sc_interp_add_blocks(scin, contents); sc_interp_restore(scin); } @@ -1108,6 +1120,9 @@ int sc_interp_add_blocks(SCInterpreter *scin, SCBlock *bl) } else if ( strcmp(name, "contents") == 0 ) { run_macro_contents(scin); + } else if ( strcmp(name, "editable") == 0 ) { + run_editable(scin, child); + } else if ( strcmp(name, "pad") == 0 ) { maybe_recurse_before(scin, child); set_padding(sc_interp_get_frame(scin), options); |