gtk-css-engine r99 - in trunk: . libccd/ccd themes/gtk-css-test/gtk-2.0
- From: robsta svn gnome org
- To: svn-commits-list gnome org
- Subject: gtk-css-engine r99 - in trunk: . libccd/ccd themes/gtk-css-test/gtk-2.0
- Date: Thu, 11 Sep 2008 11:39:06 +0000 (UTC)
Author: robsta
Date: Thu Sep 11 11:39:05 2008
New Revision: 99
URL: http://svn.gnome.org/viewvc/gtk-css-engine?rev=99&view=rev
Log:
* README: update SVN repo address.
* TODO: update roadmap after release.
* libccd/ccd/ccd-border.c: parse single-value border properties like
e.g. `border-left-color'.
* themes/gtk-css-test/gtk-2.0/styles.css: use single-value border
properties.
Added:
trunk/ (props changed)
- copied from r95, /branches/bzr/
Modified:
trunk/ChangeLog
trunk/README
trunk/TODO
trunk/libccd/ccd/ccd-border.c
trunk/themes/gtk-css-test/gtk-2.0/styles.css
Modified: trunk/README
==============================================================================
--- /branches/bzr/README (original)
+++ trunk/README Thu Sep 11 11:39:05 2008
@@ -9,8 +9,8 @@
bzr+ssh://bzr-playground.gnome.org/bzr/robsta/gtk-css-engine
Svn at:
-svn+ssh://robsta svn gnome org/svn/gtk-css-engine/branches/gtk-css-engine-bzr
-This is updated infrequently from bzr.
+ svn.gnome.org/svn/gtk-css-engine/trunk (http or svn+ssh protocols).
+ This is updated frequently from bzr.
Andreas' `Gilouche-CSS' branch is at:
http://bzr-playground.gnome.org/~andreasn/gtk-css-engine/
Modified: trunk/TODO
==============================================================================
--- /branches/bzr/TODO (original)
+++ trunk/TODO Thu Sep 11 11:39:05 2008
@@ -2,14 +2,6 @@
ROADMAP
=======
-0.1 "Infrastructure"
---------------------
-
-* Matching (descendant and child).
-* Background color.
-* Basic border styles, also through the `color' property.
-* Single background image.
-
0.2 "Correctness"
-----------------
@@ -101,3 +93,15 @@
Any volunteers?
* Evaluate alternative SVG renderers as they become available.
+
+RELEASES
+========
+
+0.1 "Infrastructure"
+--------------------
+
+* Matching (descendant and child).
+* Background color.
+* Basic border styles, also through the `color' property.
+* Single background image.
+
Modified: trunk/libccd/ccd/ccd-border.c
==============================================================================
--- /branches/bzr/libccd/ccd/ccd-border.c (original)
+++ trunk/libccd/ccd/ccd-border.c Thu Sep 11 11:39:05 2008
@@ -23,63 +23,63 @@
#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; \
+ !(CCD_BORDER_FLAGS_SPECIFIC_WIDTH & (border_).flags)) { \
+ (border_).width = val_; \
+ (border_).flags |= CCD_BORDER_FLAGS_COMMON_WIDTH; \
} \
if (spec_ != CCD_PROPERTY_SPEC_UNSET) { \
- border_.width_spec = spec_; \
+ (border_).width_spec = spec_; \
}
#define SET_SPECIFIC_WIDTH(spec_, border_, val_) \
if (CCD_PROPERTY_SPEC_SET == spec_) { \
- border_.width = val_; \
- border_.flags |= CCD_BORDER_FLAGS_SPECIFIC_WIDTH; \
+ (border_).width = val_; \
+ (border_).flags |= CCD_BORDER_FLAGS_SPECIFIC_WIDTH; \
} \
if (spec_ != CCD_PROPERTY_SPEC_UNSET) { \
- border_.width_spec = spec_; \
+ (border_).width_spec = spec_; \
}
#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; \
+ !(CCD_BORDER_FLAGS_SPECIFIC_STYLE & (border_).flags)) { \
+ (border_).style = val_; \
+ (border_).flags |= CCD_BORDER_FLAGS_COMMON_STYLE; \
} \
if (spec_ != CCD_PROPERTY_SPEC_UNSET) { \
- border_.style_spec = spec_; \
+ (border_).style_spec = spec_; \
}
#define SET_SPECIFIC_STYLE(spec_, border_, val_) \
if (CCD_PROPERTY_SPEC_SET == spec_) { \
- border_.style = val_; \
- border_.flags |= CCD_BORDER_FLAGS_SPECIFIC_STYLE; \
+ (border_).style = val_; \
+ (border_).flags |= CCD_BORDER_FLAGS_SPECIFIC_STYLE; \
} \
if (spec_ != CCD_PROPERTY_SPEC_UNSET) { \
- border_.style_spec = spec_; \
+ (border_).style_spec = spec_; \
}
#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; \
+ !(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_UNSET) { \
- border_.color_spec = spec_; \
+ (border_).color_spec = spec_; \
}
#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; \
+ (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_UNSET) { \
- border_.color_spec = spec_; \
+ (border_).color_spec = spec_; \
}
/*!
@@ -140,6 +140,98 @@
g_free (self);
}
+static bool
+parse_width (CRTerm const **value,
+ ccd_property_spec_t *spec,
+ double *width)
+{
+ *spec = ccd_property_parse_spec (value);
+ if (CCD_PROPERTY_SPEC_SET == *spec &&
+ *value &&
+ TERM_NUMBER == (*value)->type) {
+
+ *width = (*value)->content.num->val;
+ (*value) = (*value)->next;
+ *spec = CCD_PROPERTY_SPEC_SET;
+ return true;
+ }
+
+ return false;
+}
+
+static bool
+parse_style (CRTerm const **value,
+ ccd_property_spec_t *spec,
+ ccd_border_style_t *style)
+{
+
+ *spec = ccd_property_parse_spec (value);
+ *style = CCD_BORDER_STYLE_SOLID;
+ if (CCD_PROPERTY_SPEC_SET == *spec &&
+ *value &&
+ TERM_IDENT == (*value)->type &&
+ match_style (cr_string_peek_raw_str ((*value)->content.str), style)) {
+
+ (*value) = (*value)->next;
+ *spec = CCD_PROPERTY_SPEC_SET;
+ return true;
+ }
+
+ return false;
+}
+
+static bool
+parse_color (CRTerm const **value,
+ ccd_property_spec_t *spec,
+ ccd_color_t *color)
+{
+ *spec = ccd_property_parse_spec (value);
+ color->red = color->green = color->blue = 0;
+ if (CCD_PROPERTY_SPEC_SET == *spec &&
+ *value &&
+ ccd_color_parse (color, value)) {
+
+ /* iter is advanced by ccd_color_parse() */
+ *spec = CCD_PROPERTY_SPEC_SET;
+ return true;
+ }
+
+ return false;
+}
+
+static bool
+parse_stroke_property (ccd_border_stroke_t *stroke,
+ char const *property,
+ CRTerm const *value)
+{
+ ccd_property_spec_t spec;
+ double width;
+ ccd_border_style_t style;
+ ccd_color_t color;
+
+ if (0 == strcmp ("width", property)) {
+
+ parse_width (&value, &spec, &width);
+ SET_SPECIFIC_WIDTH (spec, *stroke, width);
+
+ } else if (0 == strcmp ("style", property)) {
+
+ parse_style (&value, &spec, &style);
+ SET_SPECIFIC_STYLE (spec, *stroke, style);
+
+ } else if (0 == strcmp ("color", property)) {
+
+ parse_color (&value, &spec, &color);
+ SET_SPECIFIC_COLOR (spec, *stroke, color);
+
+ } else {
+ g_assert_not_reached ();
+ return false;
+ }
+
+ return true;
+}
+
/*
* Parse properties of the form
* - border: ; # only to prevent errors
@@ -163,40 +255,42 @@
ccd_property_spec_t color_spec;
ccd_property_spec_t style_spec;
- iter = values;
+ /* Test for specific properties first. */
+ if (0 == strncmp ("border-left-", property,
+ sizeof ("border-left-") - 1)) {
- width = 0; /* prevent warning */
- width_spec = ccd_property_parse_spec (&iter);
- if (CCD_PROPERTY_SPEC_SET == width_spec &&
- iter &&
- TERM_NUMBER == iter->type) {
- /* width */
- width = iter->content.num->val;
- iter = iter->next;
- width_spec = CCD_PROPERTY_SPEC_SET;
- }
-
- style_spec = ccd_property_parse_spec (&iter);
- style = CCD_BORDER_STYLE_SOLID; /* prevent warning */
- if (CCD_PROPERTY_SPEC_SET == style_spec &&
- iter &&
- TERM_IDENT == iter->type &&
- match_style (cr_string_peek_raw_str (iter->content.str), &style)) {
- /* style */
- iter = iter->next;
- style_spec = CCD_PROPERTY_SPEC_SET;
- }
-
- color_spec = ccd_property_parse_spec (&iter);
- color.red = color.green = color.blue = 0; /* prevent warning */
- if (CCD_PROPERTY_SPEC_SET == color_spec &&
- iter &&
- ccd_color_parse (&color, &iter)) {
- /* color */
- /* iter is advanced by ccd_color_parse() */
- color_spec = CCD_PROPERTY_SPEC_SET;
+ return parse_stroke_property (&self->left,
+ property + sizeof ("border-left-") - 1,
+ values);
+
+ } else if (0 == strncmp ("border-top-", property,
+ sizeof ("border-top-") - 1)) {
+
+ return parse_stroke_property (&self->top,
+ property + sizeof ("border-top-") - 1,
+ values);
+
+ } else if (0 == strncmp ("border-right-", property,
+ sizeof ("border-right-") - 1)) {
+
+ return parse_stroke_property (&self->right,
+ property + sizeof ("border-right-") - 1,
+ values);
+
+ } else if (0 == strncmp ("border-bottom-", property,
+ sizeof ("border-bottom-") - 1)) {
+
+ return parse_stroke_property (&self->bottom,
+ property + sizeof ("border-bottom-") - 1,
+ values);
}
+ /* Now try to parse multi-value properties. */
+ iter = values;
+ parse_width (&iter, &width_spec, &width);
+ parse_style (&iter, &style_spec, &style);
+ parse_color (&iter, &color_spec, &color);
+
if (0 == strcmp ("border", property)) {
SET_COMMON_WIDTH (width_spec, self->left, width);
Modified: trunk/themes/gtk-css-test/gtk-2.0/styles.css
==============================================================================
--- /branches/bzr/themes/gtk-css-test/gtk-2.0/styles.css (original)
+++ trunk/themes/gtk-css-test/gtk-2.0/styles.css Thu Sep 11 11:39:05 2008
@@ -121,3 +121,9 @@
GtkHScale box.trough {
background: yellow;
}
+
+box {
+ border-bottom-color: red;
+ border: 1px solid black;
+ border-bottom: 1px solid blue;
+}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]