diff options
author | Thomas White <taw@bitwiz.me.uk> | 2019-05-02 21:29:40 +0200 |
---|---|---|
committer | Thomas White <taw@bitwiz.me.uk> | 2019-05-02 23:02:40 +0200 |
commit | f170c993f12c36df69cd8c4617e87b6f14b58f36 (patch) | |
tree | 82919c30686ed130e2835de0e68322c87778ebd2 /libstorycode | |
parent | 0753d313b8c93a37fd4d3fbbaa24aa7b7aa26161 (diff) |
Implement "revert" button for stylesheet editor
Diffstat (limited to 'libstorycode')
-rw-r--r-- | libstorycode/stylesheet.c | 20 | ||||
-rw-r--r-- | libstorycode/stylesheet.h | 1 |
2 files changed, 21 insertions, 0 deletions
diff --git a/libstorycode/stylesheet.c b/libstorycode/stylesheet.c index 3bbddb3..be4db9b 100644 --- a/libstorycode/stylesheet.c +++ b/libstorycode/stylesheet.c @@ -568,3 +568,23 @@ const char *stylesheet_get_friendly_name(const char *in) if ( strcmp(in, "FOOTER") == 0 ) return "Footer"; return in; } + + +int stylesheet_set_from_storycode(Stylesheet *ss, const char *sc) +{ + Stylesheet *ssnew; + Narrative *n; + + n = storycode_parse_presentation(sc); + if ( n == NULL ) return 1; + + ssnew = narrative_get_stylesheet(n); + if ( ssnew == NULL ) return 1; + + narrative_free(n); + + free_style_contents(&ss->top); + ss->top = ssnew->top; + + return 0; +} diff --git a/libstorycode/stylesheet.h b/libstorycode/stylesheet.h index 0a38477..0b994da 100644 --- a/libstorycode/stylesheet.h +++ b/libstorycode/stylesheet.h @@ -79,6 +79,7 @@ enum gradient extern Stylesheet *stylesheet_new(void); extern void stylesheet_free(Stylesheet *s); +extern int stylesheet_set_from_storycode(Stylesheet *ss, const char *sc); extern int stylesheet_get_slide_default_size(Stylesheet *s, double *w, double *h); |