aboutsummaryrefslogtreecommitdiff
path: root/src/stylesheet.c
diff options
context:
space:
mode:
authorThomas White <taw@bitwiz.org.uk>2011-11-04 21:01:57 +0100
committerThomas White <taw@bitwiz.org.uk>2011-11-04 21:01:57 +0100
commitdbff61bb3053e4fe30397b48a32ec415119bcf66 (patch)
tree1eacc5147554b47cf6b536c123340a2d7d487925 /src/stylesheet.c
parentd6c04212c403a817c5f98f8ee3e453422a02cc91 (diff)
Load stylesheet from presentation file
Diffstat (limited to 'src/stylesheet.c')
-rw-r--r--src/stylesheet.c39
1 files changed, 36 insertions, 3 deletions
diff --git a/src/stylesheet.c b/src/stylesheet.c
index 61b37fe..323b3a4 100644
--- a/src/stylesheet.c
+++ b/src/stylesheet.c
@@ -409,7 +409,7 @@ static gint destroy_stylesheet_sig(GtkWidget *w, struct _stylesheetwindow *s)
}
-static struct style *new_style(StyleSheet *ss, const char *name)
+struct style *new_style(StyleSheet *ss, const char *name)
{
struct style *sty;
int n;
@@ -435,7 +435,21 @@ static struct style *new_style(StyleSheet *ss, const char *name)
}
-static void default_stylesheet(StyleSheet *ss)
+void free_stylesheet(StyleSheet *ss)
+{
+ int i;
+
+ for ( i=0; i<ss->n_styles; i++ ) {
+ free(ss->styles[i]->name);
+ free(ss->styles[i]);
+ }
+
+ free(ss->styles);
+ free(ss);
+}
+
+
+void default_stylesheet(StyleSheet *ss)
{
struct style *sty;
@@ -568,7 +582,6 @@ StyleSheet *new_stylesheet()
ss->n_styles = 0;
ss->styles = NULL;
- default_stylesheet(ss);
return ss;
}
@@ -668,6 +681,16 @@ static const char *str_halign(enum justify halign)
}
+enum justify str_to_halign(char *halign)
+{
+ if ( strcmp(halign, "left") == 0 ) return J_LEFT;
+ if ( strcmp(halign, "right") == 0 ) return J_RIGHT;
+ if ( strcmp(halign, "center") == 0 ) return J_CENTER;
+
+ return J_LEFT;
+}
+
+
static const char *str_valign(enum vert_pos valign)
{
switch ( valign ) {
@@ -679,6 +702,16 @@ static const char *str_valign(enum vert_pos valign)
}
+enum vert_pos str_to_valign(char *valign)
+{
+ if ( strcmp(valign, "top") == 0 ) return V_TOP;
+ if ( strcmp(valign, "bottom") == 0 ) return V_BOTTOM;
+ if ( strcmp(valign, "center") == 0 ) return V_CENTER;
+
+ return J_LEFT;
+}
+
+
void write_stylesheet(StyleSheet *ss, struct serializer *ser)
{
int i;