aboutsummaryrefslogtreecommitdiff
path: root/src/stylesheet.c
diff options
context:
space:
mode:
authorThomas White <taw@bitwiz.org.uk>2013-05-23 23:28:49 +0200
committerThomas White <taw@bitwiz.org.uk>2013-05-23 23:28:49 +0200
commitc11f7f9735c0573b3ff5a073e8ae6014933660cd (patch)
treeba808115b8c68cfdb9a3ba7feea38ba66202c5da /src/stylesheet.c
parent050c29036e59a340f27de7bb80ce7dd2aacb212e (diff)
Default stylesheet stuff
Diffstat (limited to 'src/stylesheet.c')
-rw-r--r--src/stylesheet.c104
1 files changed, 21 insertions, 83 deletions
diff --git a/src/stylesheet.c b/src/stylesheet.c
index f736d91..d48ed85 100644
--- a/src/stylesheet.c
+++ b/src/stylesheet.c
@@ -92,90 +92,28 @@ void free_stylesheet(StyleSheet *ss)
}
-void default_stylesheet(StyleSheet *ss)
+extern const char *_binary_src_default_stylesheet_sty_start;
+extern const char *_binary_src_default_stylesheet_sty_size;
+
+StyleSheet *default_stylesheet()
{
- struct style *sty;
- struct slide_template *titlepage;
- struct slide_template *slide;
- struct slide_template *acknowledgements;
-
- titlepage = new_template(ss, "Title page");
- slide = new_template(ss, "Slide");
- acknowledgements = new_template(ss, "Acknowledgements");
-
- sty = new_style(ss, "Presentation title");
- sty->lop.margin_l = 0.0;
- sty->lop.margin_r = 0.0;
- sty->lop.margin_t = 0.0;
- sty->lop.margin_b = 0.0;
- sty->lop.pad_l = 0.0;
- sty->lop.pad_r = 0.0;
- sty->lop.pad_t = 0.0;
- sty->lop.pad_b = 0.0;
- sty->lop.w = 1.0;
- sty->lop.w_units = UNITS_FRAC;
- sty->lop.h = 100.0;
- sty->lop.h_units = UNITS_SLIDE;
- sty->lop.x = 0.0;
- sty->lop.y = 300.0;
- sty->sc_prologue = strdup("\\font[Sorts Mill Goudy 64]");
- add_to_template(titlepage, sty);
-
- sty = new_style(ss, "Slide title");
- sty->lop.margin_l = 0.0;
- sty->lop.margin_r = 0.0;
- sty->lop.margin_t = 0.0;
- sty->lop.margin_b = 0.0;
- sty->lop.pad_l = 20.0;
- sty->lop.pad_r = 20.0;
- sty->lop.pad_t = 20.0;
- sty->lop.pad_b = 20.0;
- sty->lop.w = 1.0;
- sty->lop.w_units = UNITS_FRAC;
- sty->lop.h = 100.0;
- sty->lop.h_units = UNITS_SLIDE;
- sty->lop.x = 0.0;
- sty->lop.y = 0.0;
- sty->sc_prologue = strdup("\\bgcol{#00a6eb}\\fgcol{#ffffff}"
- "\\font[Sans 40]");
- add_to_template(slide, sty);
-
- sty = new_style(ss, "Slide title");
- sty->lop.margin_r = 0.0;
- sty->lop.margin_t = 0.0;
- sty->lop.margin_b = 0.0;
- sty->lop.pad_l = 20.0;
- sty->lop.pad_r = 20.0;
- sty->lop.pad_t = 20.0;
- sty->lop.pad_b = 20.0;
- sty->lop.w = 1.0;
- sty->lop.w_units = UNITS_FRAC;
- sty->lop.h = 100.0;
- sty->lop.h_units = UNITS_SLIDE;
- sty->lop.x = 0.0;
- sty->lop.y = 0.0;
- sty->sc_prologue = strdup("\\bgcol{#00a6eb}\\fgcol{#ffffff}"
- "\\font[Sans 40]Acknowledgements");
- add_to_template(acknowledgements, sty);
-
- sty = new_style(ss, "Content");
- sty->lop.margin_l = 10.0;
- sty->lop.margin_r = 10.0;
- sty->lop.margin_t = 120.0;
- sty->lop.margin_b = 10.0;
- sty->lop.pad_l = 20.0;
- sty->lop.pad_r = 20.0;
- sty->lop.pad_t = 20.0;
- sty->lop.pad_b = 20.0;
- sty->lop.w = 1.0;
- sty->lop.w_units = UNITS_FRAC;
- sty->lop.h = 1.0;
- sty->lop.h_units = UNITS_FRAC;
- sty->lop.x = 0.0;
- sty->lop.y = 0.0;
- sty->sc_prologue = strdup("\\bgcol{#dddddd}\\fgcol{#ffffff}"
- "\\font[Sans 24]");
- add_to_template(acknowledgements, sty);
+ char *v;
+ struct ds_node *root;
+ StyleSheet *ss;
+ size_t len;
+
+ len = (size_t)&_binary_src_default_stylesheet_sty_size;
+ v = malloc(len+1);
+ if ( v == NULL ) return NULL;
+
+ memcpy(v, &_binary_src_default_stylesheet_sty_start, len);
+ v[len] = '\0';
+
+ root = new_ds_node("root");
+ deserialize_memory(v, root);
+ ss = tree_to_stylesheet(root);
+ free(v);
+ return ss;
}