gtk-css-engine r6 - in bzr-playground: . libccd/ccd libccd/doc/tmpl themes/gtk-css-test/gtk-2.0
- From: robsta svn gnome org
- To: svn-commits-list gnome org
- Subject: gtk-css-engine r6 - in bzr-playground: . libccd/ccd libccd/doc/tmpl themes/gtk-css-test/gtk-2.0
- Date: Mon, 18 Aug 2008 13:50:40 +0000 (UTC)
Author: robsta
Date: Mon Aug 18 13:50:39 2008
New Revision: 6
URL: http://svn.gnome.org/viewvc/gtk-css-engine?rev=6&view=rev
Log:
Infrastructure for parsing `none' and `inherit' properties.
Modified:
bzr-playground/ (props changed)
bzr-playground/README
bzr-playground/libccd/ccd/ccd-background.c
bzr-playground/libccd/ccd/ccd-background.h
bzr-playground/libccd/ccd/ccd-border.c
bzr-playground/libccd/ccd/ccd-border.h
bzr-playground/libccd/ccd/ccd-color.c
bzr-playground/libccd/ccd/ccd-image.c
bzr-playground/libccd/ccd/ccd-property.c
bzr-playground/libccd/ccd/ccd-property.h
bzr-playground/libccd/ccd/ccd-selector.c
bzr-playground/libccd/doc/tmpl/ccd.sgml
bzr-playground/libccd/doc/tmpl/ccd_gtk_style_functions.sgml
bzr-playground/libccd/doc/tmpl/node.sgml
bzr-playground/libccd/doc/tmpl/selector_group.sgml
bzr-playground/libccd/doc/tmpl/style.sgml
bzr-playground/libccd/doc/tmpl/stylesheet.sgml
bzr-playground/themes/gtk-css-test/gtk-2.0/styles.css
Modified: bzr-playground/README
==============================================================================
--- bzr-playground/README (original)
+++ bzr-playground/README Mon Aug 18 13:50:39 2008
@@ -8,9 +8,6 @@
http://www.gnome.org/~robsta/bzr/gtk-css-engine/
bzr+ssh://bzr-playground.gnome.org/bzr/robsta/gtk-css-engine
-Previously available from:
- sftp://robsta window gnome org/home/users/robsta/public_html/bzr/gtk-css-engine/
-
Primitives
----------
Modified: bzr-playground/libccd/ccd/ccd-background.c
==============================================================================
--- bzr-playground/libccd/ccd/ccd-background.c (original)
+++ bzr-playground/libccd/ccd/ccd-background.c Mon Aug 18 13:50:39 2008
@@ -37,18 +37,18 @@
char const *property,
CRTerm const *values)
{
- ccd_property_spec_t type;
+ ccd_property_spec_t spec;
- type = CCD_PROPERTY_SPEC_UNKNOWN;
+ spec = CCD_PROPERTY_SPEC_UNKNOWN;
if (0 == strcmp ("background-color", property)) {
- type = ccd_color_parse (&self->color, values);
- g_return_val_if_fail (type != CCD_PROPERTY_SPEC_UNKNOWN, false);
- self->color_type = type;
+ spec = ccd_color_parse (&self->color, values);
+ g_return_val_if_fail (spec != CCD_PROPERTY_SPEC_UNKNOWN, false);
+ self->color_spec = spec;
return true;
} else if (0 == strcmp ("background-image", property)) {
- type = ccd_image_parse (&self->image, values);
- g_return_val_if_fail (type != CCD_PROPERTY_SPEC_UNKNOWN, false);
- self->image_type = type;
+ spec = ccd_image_parse (&self->image, values);
+ g_return_val_if_fail (spec != CCD_PROPERTY_SPEC_UNKNOWN, false);
+ self->image_spec = spec;
return true;
}
@@ -65,7 +65,7 @@
{
g_assert (self);
- if (self->color_type != CCD_PROPERTY_SPEC_UNKNOWN) {
+ if (self->color_spec != CCD_PROPERTY_SPEC_UNKNOWN) {
cairo_rectangle (cr, x, y, width, height);
cairo_set_source_rgb (cr, self->color.red, self->color.green, self->color.blue);
cairo_fill (cr);
@@ -76,14 +76,14 @@
ccd_background_dump (ccd_background_t const *self)
{
printf (" background-color: ");
- switch (self->color_type) {
+ switch (self->color_spec) {
case CCD_PROPERTY_SPEC_NONE:
printf ("none");
break;
case CCD_PROPERTY_SPEC_INHERIT:
printf ("inherit");
break;
- case CCD_PROPERTY_SPEC_SPECIFIC:
+ case CCD_PROPERTY_SPEC_SET:
ccd_color_dump (&self->color);
break;
case CCD_PROPERTY_SPEC_UNKNOWN:
Modified: bzr-playground/libccd/ccd/ccd-background.h
==============================================================================
--- bzr-playground/libccd/ccd/ccd-background.h (original)
+++ bzr-playground/libccd/ccd/ccd-background.h Mon Aug 18 13:50:39 2008
@@ -33,9 +33,9 @@
typedef struct {
ccd_color_t color;
- ccd_property_spec_t color_type;
+ ccd_property_spec_t color_spec;
ccd_image_t image;
- ccd_property_spec_t image_type;
+ ccd_property_spec_t image_spec;
} ccd_background_t;
ccd_background_t * ccd_background_new (void);
Modified: bzr-playground/libccd/ccd/ccd-border.c
==============================================================================
--- bzr-playground/libccd/ccd/ccd-border.c (original)
+++ bzr-playground/libccd/ccd/ccd-border.c Mon Aug 18 13:50:39 2008
@@ -22,44 +22,65 @@
#include "ccd-border.h"
#include "ccd-utils.h"
-#define SET_COMMON_WIDTH(cond_, border_, val_) \
-if (cond_ && !(CCD_BORDER_FLAGS_SPECIFIC_WIDTH & border_.flags)) { \
+#define SET_COMMON_WIDTH(spec_, border_, val_) \
+if (CCD_PROPERTY_SPEC_SET == spec_ && \
+ !(CCD_BORDER_FLAGS_SPECIFIC_WIDTH & border_.flags)) { \
border_.width = val_; \
border_.flags |= CCD_BORDER_FLAGS_COMMON_WIDTH; \
+} \
+if (spec_ != CCD_PROPERTY_SPEC_UNKNOWN) { \
+ border_.width_spec = spec_; \
}
-#define SET_SPECIFIC_WIDTH(cond_, border_, val_) \
-if (cond_) { \
+#define SET_SPECIFIC_WIDTH(spec_, border_, val_) \
+if (CCD_PROPERTY_SPEC_SET == spec_) { \
border_.width = val_; \
border_.flags |= CCD_BORDER_FLAGS_SPECIFIC_WIDTH; \
+} \
+if (spec_ != CCD_PROPERTY_SPEC_UNKNOWN) { \
+ border_.width_spec = spec_; \
}
-#define SET_COMMON_STYLE(cond_, border_, val_) \
-if (cond_ && !(CCD_BORDER_FLAGS_SPECIFIC_STYLE & border_.flags)) { \
+#define SET_COMMON_STYLE(spec_, border_, val_) \
+if (CCD_PROPERTY_SPEC_SET == spec_ && \
+ !(CCD_BORDER_FLAGS_SPECIFIC_STYLE & border_.flags)) { \
border_.style = val_; \
border_.flags |= CCD_BORDER_FLAGS_COMMON_STYLE; \
+} \
+if (spec_ != CCD_PROPERTY_SPEC_UNKNOWN) { \
+ border_.style_spec = spec_; \
}
-#define SET_SPECIFIC_STYLE(cond_, border_, val_) \
-if (cond_) { \
+#define SET_SPECIFIC_STYLE(spec_, border_, val_) \
+if (CCD_PROPERTY_SPEC_SET == spec_) { \
border_.style = val_; \
border_.flags |= CCD_BORDER_FLAGS_SPECIFIC_STYLE; \
+} \
+if (spec_ != CCD_PROPERTY_SPEC_UNKNOWN) { \
+ border_.style_spec = spec_; \
}
-#define SET_COMMON_COLOR(cond_, border_, val_) \
-if (cond_ && !(CCD_BORDER_FLAGS_SPECIFIC_COLOR & border_.flags)) { \
+#define SET_COMMON_COLOR(spec_, border_, val_) \
+if (CCD_PROPERTY_SPEC_SET == spec_ && \
+ !(CCD_BORDER_FLAGS_SPECIFIC_COLOR & border_.flags)) { \
border_.color.red = val_.red; \
border_.color.green = val_.green; \
border_.color.blue = val_.blue; \
border_.flags |= CCD_BORDER_FLAGS_COMMON_COLOR; \
+} \
+if (spec_ != CCD_PROPERTY_SPEC_UNKNOWN) { \
+ border_.color_spec = spec_; \
}
-#define SET_SPECIFIC_COLOR(cond_, border_, val_) \
-if (cond_) { \
+#define SET_SPECIFIC_COLOR(spec_, border_, val_) \
+if (CCD_PROPERTY_SPEC_SET == spec_) { \
border_.color.red = val_.red; \
border_.color.green = val_.green; \
border_.color.blue = val_.blue; \
border_.flags |= CCD_BORDER_FLAGS_SPECIFIC_COLOR; \
+} \
+if (spec_ != CCD_PROPERTY_SPEC_UNKNOWN) { \
+ border_.color_spec = spec_; \
}
/*!
@@ -139,91 +160,84 @@
double width;
ccd_border_style_t style;
ccd_color_t color;
- ccd_property_spec_t type;
- bool have_width;
- bool have_color;
- bool have_style;
-
-/* TODO set per stroke or for whole border
- type = ccd_property_parse_type (values);
- if (CCD_PROPERTY_SPEC_NONE == type ||
- CCD_PROPERTY_SPEC_INHERIT == type) {
- self->type = type;
- return true;
- }
-*/
+ ccd_property_spec_t width_spec;
+ ccd_property_spec_t color_spec;
+ ccd_property_spec_t style_spec;
iter = values;
- have_width = false;
width = 0; /* prevent warning */
- if (iter &&
+ width_spec = ccd_property_parse_spec (iter);
+ if (CCD_PROPERTY_SPEC_UNKNOWN == width_spec &&
+ iter &&
TERM_NUMBER == iter->type) {
/* width */
width = iter->content.num->val;
iter = iter->next;
- have_width = true;
+ width_spec = CCD_PROPERTY_SPEC_SET;
}
- have_style = false;
+ style_spec = ccd_property_parse_spec (iter);
style = CCD_BORDER_STYLE_SOLID; /* prevent warning */
- if (iter &&
+ if (CCD_PROPERTY_SPEC_UNKNOWN == style_spec &&
+ iter &&
TERM_IDENT == iter->type &&
match_style (cr_string_peek_raw_str (iter->content.str), &style)) {
/* style */
iter = iter->next;
- have_style = true;
+ style_spec = CCD_PROPERTY_SPEC_SET;
}
- have_color = false;
+ color_spec = ccd_property_parse_spec (iter);
color.red = color.green = color.blue = 0; /* prevent warning */
- if (iter &&
+ if (CCD_PROPERTY_SPEC_UNKNOWN == color_spec &&
+ iter &&
ccd_color_parse (&color, iter)) {
/* color */
iter = iter->next;
- have_color = true;
+ color_spec = CCD_PROPERTY_SPEC_SET;
}
if (0 == strcmp ("border", property)) {
- SET_COMMON_WIDTH (have_width, self->left, width);
- SET_COMMON_WIDTH (have_width, self->top, width);
- SET_COMMON_WIDTH (have_width, self->right, width);
- SET_COMMON_WIDTH (have_width, self->bottom, width);
-
- SET_COMMON_STYLE (have_style, self->left, style);
- SET_COMMON_STYLE (have_style, self->top, style);
- SET_COMMON_STYLE (have_style, self->right, style);
- SET_COMMON_STYLE (have_style, self->bottom, style);
+ SET_COMMON_WIDTH (width_spec, self->left, width);
+ SET_COMMON_WIDTH (width_spec, self->top, width);
+ SET_COMMON_WIDTH (width_spec, self->right, width);
+ SET_COMMON_WIDTH (width_spec, self->bottom, width);
+
+ SET_COMMON_STYLE (style_spec, self->left, style);
+ SET_COMMON_STYLE (style_spec, self->top, style);
+ SET_COMMON_STYLE (style_spec, self->right, style);
+ SET_COMMON_STYLE (style_spec, self->bottom, style);
- SET_COMMON_COLOR (have_color, self->left, color);
- SET_COMMON_COLOR (have_color, self->top, color);
- SET_COMMON_COLOR (have_color, self->right, color);
- SET_COMMON_COLOR (have_color, self->bottom, color);
+ SET_COMMON_COLOR (color_spec, self->left, color);
+ SET_COMMON_COLOR (color_spec, self->top, color);
+ SET_COMMON_COLOR (color_spec, self->right, color);
+ SET_COMMON_COLOR (color_spec, self->bottom, color);
} else if (0 == strcmp ("border-left", property)) {
- SET_SPECIFIC_WIDTH (have_width, self->left, width);
- SET_SPECIFIC_STYLE (have_style, self->left, style);
- SET_SPECIFIC_COLOR (have_color, self->left, color);
+ SET_SPECIFIC_WIDTH (width_spec, self->left, width);
+ SET_SPECIFIC_STYLE (style_spec, self->left, style);
+ SET_SPECIFIC_COLOR (color_spec, self->left, color);
} else if (0 == strcmp ("border-top", property)) {
- SET_SPECIFIC_WIDTH (have_width, self->top, width);
- SET_SPECIFIC_STYLE (have_style, self->top, style);
- SET_SPECIFIC_COLOR (have_color, self->top, color);
+ SET_SPECIFIC_WIDTH (width_spec, self->top, width);
+ SET_SPECIFIC_STYLE (style_spec, self->top, style);
+ SET_SPECIFIC_COLOR (color_spec, self->top, color);
} else if (0 == strcmp ("border-right", property)) {
- SET_SPECIFIC_WIDTH (have_width, self->right, width);
- SET_SPECIFIC_STYLE (have_style, self->right, style);
- SET_SPECIFIC_COLOR (have_color, self->right, color);
+ SET_SPECIFIC_WIDTH (width_spec, self->right, width);
+ SET_SPECIFIC_STYLE (style_spec, self->right, style);
+ SET_SPECIFIC_COLOR (color_spec, self->right, color);
} else if (0 == strcmp ("border-bottom", property)) {
- SET_SPECIFIC_WIDTH (have_width, self->bottom, width);
- SET_SPECIFIC_STYLE (have_style, self->bottom, style);
- SET_SPECIFIC_COLOR (have_color, self->bottom, color);
+ SET_SPECIFIC_WIDTH (width_spec, self->bottom, width);
+ SET_SPECIFIC_STYLE (style_spec, self->bottom, style);
+ SET_SPECIFIC_COLOR (color_spec, self->bottom, color);
} else {
return false;
@@ -318,7 +332,7 @@
static draw_f
get_draw_func (ccd_border_stroke_t const *stroke)
{
- if (CCD_PROPERTY_SPEC_NONE == stroke->type) {
+ if (CCD_PROPERTY_SPEC_NONE == stroke->style_spec) {
return draw_none;
}
Modified: bzr-playground/libccd/ccd/ccd-border.h
==============================================================================
--- bzr-playground/libccd/ccd/ccd-border.h (original)
+++ bzr-playground/libccd/ccd/ccd-border.h Mon Aug 18 13:50:39 2008
@@ -62,9 +62,11 @@
typedef struct {
double width;
+ ccd_property_spec_t width_spec;
ccd_border_style_t style;
+ ccd_property_spec_t style_spec;
ccd_color_t color;
- ccd_property_spec_t type;
+ ccd_property_spec_t color_spec;
int flags;
} ccd_border_stroke_t;
Modified: bzr-playground/libccd/ccd/ccd-color.c
==============================================================================
--- bzr-playground/libccd/ccd/ccd-color.c (original)
+++ bzr-playground/libccd/ccd/ccd-color.c Mon Aug 18 13:50:39 2008
@@ -263,28 +263,28 @@
switch (value->type) {
case TERM_IDENT:
- type = ccd_property_parse_type (value);
+ type = ccd_property_parse_spec (value);
if (type != CCD_PROPERTY_SPEC_UNKNOWN) {
return type;
}
ret = ccd_color_parse_name (
cr_string_peek_raw_str (value->content.str), self);
if (ret)
- return CCD_PROPERTY_SPEC_SPECIFIC;
+ return CCD_PROPERTY_SPEC_SET;
else
return CCD_PROPERTY_SPEC_UNKNOWN;
case TERM_HASH:
ret = ccd_color_parse_hex (
cr_string_peek_raw_str (value->content.str), self);
if (ret)
- return CCD_PROPERTY_SPEC_SPECIFIC;
+ return CCD_PROPERTY_SPEC_SET;
else
return CCD_PROPERTY_SPEC_UNKNOWN;
case TERM_RGB:
self->red = value->content.rgb->red;
self->green = value->content.rgb->green;
self->blue = value->content.rgb->blue;
- return CCD_PROPERTY_SPEC_SPECIFIC;
+ return CCD_PROPERTY_SPEC_SET;
/* fall thru for all other enum values to prevent compiler warnings */
case TERM_NO_TYPE:
case TERM_NUMBER:
Modified: bzr-playground/libccd/ccd/ccd-image.c
==============================================================================
--- bzr-playground/libccd/ccd/ccd-image.c (original)
+++ bzr-playground/libccd/ccd/ccd-image.c Mon Aug 18 13:50:39 2008
@@ -72,7 +72,7 @@
self->uri = g_strdup (cr_string_peek_raw_str (value->content.str));
ret = load_image (self, self->uri);
if (ret)
- return CCD_PROPERTY_SPEC_SPECIFIC;
+ return CCD_PROPERTY_SPEC_SET;
else
return CCD_PROPERTY_SPEC_UNKNOWN;
break;
Modified: bzr-playground/libccd/ccd/ccd-property.c
==============================================================================
--- bzr-playground/libccd/ccd/ccd-property.c (original)
+++ bzr-playground/libccd/ccd/ccd-property.c Mon Aug 18 13:50:39 2008
@@ -21,15 +21,17 @@
#include "ccd-property.h"
ccd_property_spec_t
-ccd_property_parse_type (CRTerm const *value)
+ccd_property_parse_spec (CRTerm const *value)
{
char const *str;
- if (TERM_IDENT == value->type) {
+ if (value &&
+ TERM_IDENT == value->type) {
str = cr_string_peek_raw_str (value->content.str);
if (0 == strcmp ("none", str)) {
return CCD_PROPERTY_SPEC_NONE;
} else if (0 == strcmp ("inherit", str)) {
+ g_warning ("Property `inherit' not supported yet.");
return CCD_PROPERTY_SPEC_INHERIT;
}
}
Modified: bzr-playground/libccd/ccd/ccd-property.h
==============================================================================
--- bzr-playground/libccd/ccd/ccd-property.h (original)
+++ bzr-playground/libccd/ccd/ccd-property.h Mon Aug 18 13:50:39 2008
@@ -29,11 +29,11 @@
typedef enum {
CCD_PROPERTY_SPEC_UNKNOWN = 0,
CCD_PROPERTY_SPEC_NONE,
- CCD_PROPERTY_SPEC_INHERIT, /* not implemented yet */
- CCD_PROPERTY_SPEC_SPECIFIC
+ CCD_PROPERTY_SPEC_INHERIT,
+ CCD_PROPERTY_SPEC_SET
} ccd_property_spec_t;
-ccd_property_spec_t ccd_property_parse_type (CRTerm const *value);
+ccd_property_spec_t ccd_property_parse_spec (CRTerm const *value);
G_END_DECLS
Modified: bzr-playground/libccd/ccd/ccd-selector.c
==============================================================================
--- bzr-playground/libccd/ccd/ccd-selector.c (original)
+++ bzr-playground/libccd/ccd/ccd-selector.c Mon Aug 18 13:50:39 2008
@@ -825,7 +825,7 @@
{
g_return_val_if_fail (self && self->block && style, false);
- switch (self->block->background.color_type) {
+ switch (self->block->background.color_spec) {
case CCD_PROPERTY_SPEC_UNKNOWN:
/* do nothing */
break;
@@ -837,7 +837,7 @@
/* not implemented */
g_assert_not_reached ();
break;
- case CCD_PROPERTY_SPEC_SPECIFIC:
+ case CCD_PROPERTY_SPEC_SET:
/* use */
style->background = &self->block->background;
break;
Modified: bzr-playground/libccd/doc/tmpl/ccd.sgml
==============================================================================
--- bzr-playground/libccd/doc/tmpl/ccd.sgml (original)
+++ bzr-playground/libccd/doc/tmpl/ccd.sgml Mon Aug 18 13:50:39 2008
@@ -9,13 +9,11 @@
</para>
-
<!-- ##### SECTION See_Also ##### -->
<para>
</para>
-
<!-- ##### SECTION Stability_Level ##### -->
Modified: bzr-playground/libccd/doc/tmpl/ccd_gtk_style_functions.sgml
==============================================================================
--- bzr-playground/libccd/doc/tmpl/ccd_gtk_style_functions.sgml (original)
+++ bzr-playground/libccd/doc/tmpl/ccd_gtk_style_functions.sgml Mon Aug 18 13:50:39 2008
@@ -9,13 +9,11 @@
</para>
-
<!-- ##### SECTION See_Also ##### -->
<para>
</para>
-
<!-- ##### SECTION Stability_Level ##### -->
Modified: bzr-playground/libccd/doc/tmpl/node.sgml
==============================================================================
--- bzr-playground/libccd/doc/tmpl/node.sgml (original)
+++ bzr-playground/libccd/doc/tmpl/node.sgml Mon Aug 18 13:50:39 2008
@@ -9,13 +9,11 @@
</para>
-
<!-- ##### SECTION See_Also ##### -->
<para>
</para>
-
<!-- ##### SECTION Stability_Level ##### -->
Modified: bzr-playground/libccd/doc/tmpl/selector_group.sgml
==============================================================================
--- bzr-playground/libccd/doc/tmpl/selector_group.sgml (original)
+++ bzr-playground/libccd/doc/tmpl/selector_group.sgml Mon Aug 18 13:50:39 2008
@@ -9,13 +9,11 @@
</para>
-
<!-- ##### SECTION See_Also ##### -->
<para>
</para>
-
<!-- ##### SECTION Stability_Level ##### -->
Modified: bzr-playground/libccd/doc/tmpl/style.sgml
==============================================================================
--- bzr-playground/libccd/doc/tmpl/style.sgml (original)
+++ bzr-playground/libccd/doc/tmpl/style.sgml Mon Aug 18 13:50:39 2008
@@ -9,13 +9,11 @@
</para>
-
<!-- ##### SECTION See_Also ##### -->
<para>
</para>
-
<!-- ##### SECTION Stability_Level ##### -->
Modified: bzr-playground/libccd/doc/tmpl/stylesheet.sgml
==============================================================================
--- bzr-playground/libccd/doc/tmpl/stylesheet.sgml (original)
+++ bzr-playground/libccd/doc/tmpl/stylesheet.sgml Mon Aug 18 13:50:39 2008
@@ -9,13 +9,11 @@
</para>
-
<!-- ##### SECTION See_Also ##### -->
<para>
</para>
-
<!-- ##### SECTION Stability_Level ##### -->
Modified: bzr-playground/themes/gtk-css-test/gtk-2.0/styles.css
==============================================================================
--- bzr-playground/themes/gtk-css-test/gtk-2.0/styles.css (original)
+++ bzr-playground/themes/gtk-css-test/gtk-2.0/styles.css Mon Aug 18 13:50:39 2008
@@ -128,3 +128,4 @@
GtkProgressBar:prelight {
background-color: yellow;
}
+
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]