summaryrefslogtreecommitdiff
path: root/src/theme-parser.c
diff options
context:
space:
mode:
authorHavoc Pennington <hp@redhat.com>2002-05-31 22:03:34 +0000
committerHavoc Pennington <hp@src.gnome.org>2002-05-31 22:03:34 +0000
commitc6b34083988a8b8bdeba82853d45963b068f2874 (patch)
treec3fd84c86fd906818159301107639660d3612fe0 /src/theme-parser.c
parentd4b91dc6540e438cf4bda1dac647caa31df7856d (diff)
downloadmetacity-c6b34083988a8b8bdeba82853d45963b068f2874.tar.gz
metacity-c6b34083988a8b8bdeba82853d45963b068f2874.tar.bz2
add MetaImageFillType and implement TILE in addition to the existing SCALE
2002-05-31 Havoc Pennington <hp@redhat.com> * src/theme.c: add MetaImageFillType and implement TILE in addition to the existing SCALE * src/theme.h (struct _MetaDrawOp): remove no-longer-used "alpha" field
Diffstat (limited to 'src/theme-parser.c')
-rw-r--r--src/theme-parser.c39
1 files changed, 37 insertions, 2 deletions
diff --git a/src/theme-parser.c b/src/theme-parser.c
index 0a1ba22..ba686f9 100644
--- a/src/theme-parser.c
+++ b/src/theme-parser.c
@@ -2149,9 +2149,11 @@ parse_draw_op_element (GMarkupParseContext *context,
const char *height;
const char *alpha;
const char *colorize;
+ const char *fill_type;
MetaAlphaGradientSpec *alpha_spec;
GdkPixbuf *pixbuf;
MetaColorSpec *colorize_spec = NULL;
+ MetaImageFillType fill_type_val;
if (!locate_attributes (context, element_name, attribute_names, attribute_values,
error,
@@ -2159,6 +2161,7 @@ parse_draw_op_element (GMarkupParseContext *context,
"width", &width, "height", &height,
"alpha", &alpha, "filename", &filename,
"colorize", &colorize,
+ "fill_type", &fill_type,
NULL))
return;
@@ -2209,6 +2212,19 @@ parse_draw_op_element (GMarkupParseContext *context,
if (!check_expression (height, TRUE, info->theme, context, error))
return;
+ fill_type_val = META_IMAGE_FILL_SCALE;
+ if (fill_type)
+ {
+ fill_type_val = meta_image_fill_type_from_string (fill_type);
+
+ if (((int) fill_type_val) == -1)
+ {
+ set_error (error, context, G_MARKUP_ERROR,
+ G_MARKUP_ERROR_PARSE,
+ _("Did not understand fill type \"%s\" for <%s> element"),
+ fill_type, element_name);
+ }
+ }
/* Check last so we don't have to free it when other
* stuff fails
@@ -2249,7 +2265,8 @@ parse_draw_op_element (GMarkupParseContext *context,
op->data.image.width = optimize_expression (info->theme, width);
op->data.image.height = optimize_expression (info->theme, height);
op->data.image.alpha_spec = alpha_spec;
-
+ op->data.image.fill_type = fill_type_val;
+
g_assert (info->op_list);
meta_draw_op_list_append (info->op_list, op);
@@ -2589,13 +2606,16 @@ parse_draw_op_element (GMarkupParseContext *context,
const char *width;
const char *height;
const char *alpha;
+ const char *fill_type;
MetaAlphaGradientSpec *alpha_spec;
+ MetaImageFillType fill_type_val;
if (!locate_attributes (context, element_name, attribute_names, attribute_values,
error,
"x", &x, "y", &y,
"width", &width, "height", &height,
"alpha", &alpha,
+ "fill_type", &fill_type,
NULL))
return;
@@ -2639,6 +2659,20 @@ parse_draw_op_element (GMarkupParseContext *context,
if (!check_expression (height, FALSE, info->theme, context, error))
return;
+ fill_type_val = META_IMAGE_FILL_SCALE;
+ if (fill_type)
+ {
+ fill_type_val = meta_image_fill_type_from_string (fill_type);
+
+ if (((int) fill_type_val) == -1)
+ {
+ set_error (error, context, G_MARKUP_ERROR,
+ G_MARKUP_ERROR_PARSE,
+ _("Did not understand fill type \"%s\" for <%s> element"),
+ fill_type, element_name);
+ }
+ }
+
alpha_spec = NULL;
if (alpha && !parse_alpha (alpha, &alpha_spec, context, error))
return;
@@ -2650,7 +2684,8 @@ parse_draw_op_element (GMarkupParseContext *context,
op->data.icon.width = optimize_expression (info->theme, width);
op->data.icon.height = optimize_expression (info->theme, height);
op->data.icon.alpha_spec = alpha_spec;
-
+ op->data.icon.fill_type = fill_type_val;
+
g_assert (info->op_list);
meta_draw_op_list_append (info->op_list, op);