[cairo-commit] cairo-gtk-engine/src cge-draw.c, 1.17,
1.18 cge-style.c, 1.7, 1.8 cge.c, 1.2, 1.3 cge.h, 1.2, 1.3
Carl Worth
commit at pdx.freedesktop.org
Thu Feb 3 12:04:01 PST 2005
Committed by: cworth
Update of /cvs/cairo/cairo-gtk-engine/src
In directory gabe:/tmp/cvs-serv26416/src
Modified Files:
cge-draw.c cge-style.c cge.c cge.h
Log Message:
* src/cge.c:
* src/cge-draw.c:
* src/cge-style.c:
* src/cge.h: Big change to normalize style, (indentation,
whitespace, no C++-style one-line comments, etc.). No intentional
behavioral changes.
Index: cge-draw.c
===================================================================
RCS file: /cvs/cairo/cairo-gtk-engine/src/cge-draw.c,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -d -r1.17 -r1.18
--- cge-draw.c 3 Feb 2005 19:38:44 -0000 1.17
+++ cge-draw.c 3 Feb 2005 20:03:59 -0000 1.18
@@ -20,7 +20,6 @@
#include "cge.h"
-
#define DETAIL(xx) ((detail) && (!strcmp(xx, detail)))
/*#define DEBUG*/
@@ -32,662 +31,694 @@
gdouble w,
gdouble h)
{
[...3820 lines suppressed...]
+ style_class->draw_resize_grip = draw_resize_grip;
+ style_class->draw_shadow_gap = draw_shadow_gap;
- style_class->draw_check = draw_check;
- style_class->draw_option = draw_option;
+ style_class->draw_check = draw_check;
+ style_class->draw_option = draw_option;
- //style_class->draw_polygon = draw_polygon;
- //style_class->draw_diamond = draw_diamond;
- //style_class->draw_layout = draw_layout;
-
- //style_class->set_background=set_background;
+ /*
+ style_class->draw_polygon = draw_polygon;
+ style_class->draw_diamond = draw_diamond;
+ style_class->draw_layout = draw_layout;
+ style_class->set_background=set_background;
+ */
}
Index: cge-style.c
===================================================================
RCS file: /cvs/cairo/cairo-gtk-engine/src/cge-style.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- cge-style.c 3 Feb 2005 19:38:44 -0000 1.7
+++ cge-style.c 3 Feb 2005 20:03:59 -0000 1.8
@@ -20,22 +20,29 @@
#include "cge.h"
-static void cge_rc_style_init (CgeRCStyle * style);
+static void
+cge_rc_style_init (CgeRCStyle * style);
-static void cge_rc_style_class_init (CgeRCStyleClass * klass);
+static void
+cge_rc_style_class_init (CgeRCStyleClass * klass);
-static guint cge_rc_style_parse (GtkRcStyle *rc_style,
- GtkSettings *settings,
- GScanner *scanner);
-static void cge_rc_style_merge (GtkRcStyle * dest, GtkRcStyle * src);
-static GtkStyle *cge_rc_style_create_style (GtkRcStyle * rc_style);
+static guint
+cge_rc_style_parse (GtkRcStyle *rc_style,
+ GtkSettings *settings,
+ GScanner *scanner);
+
+static void
+cge_rc_style_merge (GtkRcStyle * dest, GtkRcStyle * src);
+
+static GtkStyle *
+cge_rc_style_create_style (GtkRcStyle * rc_style);
static GtkRcStyleClass * parent_class;
-GType cge_type_rc_style = 0;
+GType cge_type_rc_style = 0;
enum
- {
+{
TOKEN_STYLE= G_TOKEN_LAST + 1,
TOKEN_DETAIL,
TOKEN_FILL,
@@ -43,37 +50,32 @@
TOKEN_MODE,
TOKEN_ARROW,
-
TOKEN_ROUND_WIDTH,
TOKEN_LINE_WIDTH,
TOKEN_GRADIENT_DIRECTION,
TOKEN_COLOR,
TOKEN_ALPHA,
-
-
- };
-
+};
static struct
- {
+{
gchar *name;
guint token;
- }
-
+}
theme_symbols[] =
{
- { "style", TOKEN_STYLE },
- { "detail", TOKEN_DETAIL },
- { "fill", TOKEN_FILL },
- { "line", TOKEN_LINE },
- { "mode", TOKEN_MODE },
- { "arrow", TOKEN_ARROW },
- { "round_width", TOKEN_ROUND_WIDTH },
- { "line_width", TOKEN_LINE_WIDTH },
- { "gradient_direction", TOKEN_GRADIENT_DIRECTION },
- { "color", TOKEN_COLOR },
- { "alpha", TOKEN_ALPHA },
+ { "style", TOKEN_STYLE },
+ { "detail", TOKEN_DETAIL },
+ { "fill", TOKEN_FILL },
+ { "line", TOKEN_LINE },
+ { "mode", TOKEN_MODE },
+ { "arrow", TOKEN_ARROW },
+ { "round_width", TOKEN_ROUND_WIDTH },
+ { "line_width", TOKEN_LINE_WIDTH },
+ { "gradient_direction", TOKEN_GRADIENT_DIRECTION },
+ { "color", TOKEN_COLOR },
+ { "alpha", TOKEN_ALPHA },
};
static guint n_theme_symbols = sizeof(theme_symbols) / sizeof(theme_symbols[0]);
@@ -81,66 +83,67 @@
static gboolean
TranslateFillStyleMode (gchar * str, gint *retval)
{
-#define is_enum(XX) (g_ascii_strncasecmp(str, XX, strlen(XX))==0)
- if is_enum("solid")
- *retval = CGE_FILL_SOLID;
- else if (is_enum("gradient"))
- *retval = CGE_FILL_GRADIENT;
- else if (is_enum("file"))
- *retval = CGE_FILL_FILE;
- else
- return FALSE;
- return TRUE;
+#define is_enum(XX) (g_ascii_strncasecmp(str, XX, strlen(XX))==0)
+
+ if (is_enum("solid"))
+ *retval = CGE_FILL_SOLID;
+ else if (is_enum("gradient"))
+ *retval = CGE_FILL_GRADIENT;
+ else if (is_enum("file"))
+ *retval = CGE_FILL_FILE;
+ else
+ return FALSE;
+
+ return TRUE;
}
static gboolean
TranslateLineStyleMode (gchar * str, gint *retval)
{
#define is_enum(XX) (g_ascii_strncasecmp(str, XX, strlen(XX))==0)
- if is_enum("solid")
- *retval = CGE_LINE_SOLID;
- else if (is_enum("none"))
- *retval = CGE_LINE_NONE;
- else if (is_enum("dashed"))
- *retval = CGE_LINE_DASHED;
- else if (is_enum("bevel"))
- *retval = CGE_LINE_BEVEL;
- else if (is_enum("file"))
- *retval = CGE_LINE_FILE;
- else
- return FALSE;
- return TRUE;
+ if (is_enum("solid"))
+ *retval = CGE_LINE_SOLID;
+ else if (is_enum("none"))
+ *retval = CGE_LINE_NONE;
+ else if (is_enum("dashed"))
+ *retval = CGE_LINE_DASHED;
+ else if (is_enum("bevel"))
+ *retval = CGE_LINE_BEVEL;
+ else if (is_enum("file"))
+ *retval = CGE_LINE_FILE;
+ else
+ return FALSE;
+ return TRUE;
}
static gboolean
TranslateGradientDirection (gchar * str, gint *retval)
{
#define is_enum(XX) (g_ascii_strncasecmp(str, XX, strlen(XX))==0)
- if is_enum("vertical")
- *retval = CGE_DIRECTION_VERTICAL;
- else if (is_enum("horizontal"))
- *retval = CGE_DIRECTION_HORIZONTAL;
- else
- return FALSE;
- return TRUE;
+ if (is_enum("vertical"))
+ *retval = CGE_DIRECTION_VERTICAL;
+ else if (is_enum("horizontal"))
+ *retval = CGE_DIRECTION_HORIZONTAL;
+ else
+ return FALSE;
+ return TRUE;
}
static gboolean
TranslateArrowStyle (gchar * str, gint *retval)
{
#define is_enum(XX) (g_ascii_strncasecmp(str, XX, strlen(XX))==0)
- if is_enum("normal")
- *retval = CGE_ARROW_NORMAL;
- else if (is_enum("simple"))
- *retval = CGE_ARROW_SIMPLE;
- else if (is_enum("file"))
- *retval = CGE_ARROW_FILE;
- else
- return FALSE;
- return TRUE;
+ if (is_enum("normal"))
+ *retval = CGE_ARROW_NORMAL;
+ else if (is_enum("simple"))
+ *retval = CGE_ARROW_SIMPLE;
+ else if (is_enum("file"))
+ *retval = CGE_ARROW_FILE;
+ else
+ return FALSE;
+ return TRUE;
}
-
static guint
theme_parse_custom_enum (GScanner *scanner,
GTokenType wanted_token,
@@ -148,65 +151,64 @@
guint return_default,
cge_fill_mode *retval)
{
- guint token;
+ guint token;
- token = g_scanner_get_next_token (scanner);
- if (token != wanted_token)
+ token = g_scanner_get_next_token (scanner);
+ if (token != wanted_token)
{
- return wanted_token;
+ return wanted_token;
}
- token = g_scanner_get_next_token (scanner);
- if (token != G_TOKEN_EQUAL_SIGN)
+ token = g_scanner_get_next_token (scanner);
+ if (token != G_TOKEN_EQUAL_SIGN)
{
- return G_TOKEN_EQUAL_SIGN;
+ return G_TOKEN_EQUAL_SIGN;
}
- token = g_scanner_get_next_token (scanner);
+ token = g_scanner_get_next_token (scanner);
- if (token != G_TOKEN_IDENTIFIER)
- *retval = return_default;
- else
- if (!translate_enum(scanner->value.v_identifier, (gint *) retval)) *retval = return_default;
+ if (token != G_TOKEN_IDENTIFIER)
+ *retval = return_default;
+ else
+ if (!translate_enum(scanner->value.v_identifier, (gint *) retval))
+ *retval = return_default;
- return G_TOKEN_NONE;
+ return G_TOKEN_NONE;
}
-
-
static guint
theme_parse_double(GScanner *scanner,
- GTokenType wanted_token,
- gdouble return_default,
- gdouble *retval,
- gdouble lower_limit,
- gdouble upper_limit)
+ GTokenType wanted_token,
+ gdouble return_default,
+ gdouble *retval,
+ gdouble lower_limit,
+ gdouble upper_limit)
{
- guint token;
+ guint token;
- token = g_scanner_get_next_token (scanner);
- if (token != wanted_token)
+ token = g_scanner_get_next_token (scanner);
+ if (token != wanted_token)
{
- return wanted_token;
+ return wanted_token;
}
- token = g_scanner_get_next_token (scanner);
- if (token != G_TOKEN_EQUAL_SIGN)
+ token = g_scanner_get_next_token (scanner);
+ if (token != G_TOKEN_EQUAL_SIGN)
{
- return G_TOKEN_EQUAL_SIGN;
+ return G_TOKEN_EQUAL_SIGN;
}
- token = g_scanner_get_next_token (scanner);
+ token = g_scanner_get_next_token (scanner);
- if (token != G_TOKEN_FLOAT)
- *retval = return_default;
- else
- *retval = scanner->value.v_float;
-
- if (*retval < lower_limit) *retval = lower_limit;
- if ((*retval > upper_limit) && (upper_limit > lower_limit)) *retval = upper_limit;
+ if (token != G_TOKEN_FLOAT)
+ *retval = return_default;
+ else
+ *retval = scanner->value.v_float;
+
+ if (*retval < lower_limit) *retval = lower_limit;
+ if ((*retval > upper_limit) && (upper_limit > lower_limit)) *retval = upper_limit;
- return G_TOKEN_NONE;
+ return G_TOKEN_NONE;
}
static guint
@@ -215,402 +217,414 @@
gchar **retval)
{
- guint token;
+ guint token;
- token = g_scanner_get_next_token (scanner);
- if (token != wanted_token)
+ token = g_scanner_get_next_token (scanner);
+ if (token != wanted_token)
{
- return wanted_token;
+ return wanted_token;
}
- token = g_scanner_get_next_token (scanner);
- if (token != G_TOKEN_EQUAL_SIGN)
+ token = g_scanner_get_next_token (scanner);
+ if (token != G_TOKEN_EQUAL_SIGN)
{
- return G_TOKEN_EQUAL_SIGN;
+ return G_TOKEN_EQUAL_SIGN;
}
- token = g_scanner_get_next_token (scanner);
+ token = g_scanner_get_next_token (scanner);
- //printf("detail : %s\n\n",scanner->value.v_string);
- *retval = g_strdup(scanner->value.v_string);
-
+ /* printf("detail : %s\n\n",scanner->value.v_string); */
+ *retval = g_strdup(scanner->value.v_string);
- return G_TOKEN_NONE;
+ return G_TOKEN_NONE;
}
-static guint theme_parse_fill (GtkSettings *settings, GScanner *scanner, GTokenType wanted_token, cge_fill_style *retval)
+static guint
+theme_parse_fill (GtkSettings *settings,
+ GScanner *scanner,
+ GTokenType wanted_token,
+ cge_fill_style *retval)
{
- guint token;
- GdkColor color[5];
- gint colors_count[5]={0,0,0,0,0};
- gint i;
+ guint token;
+ GdkColor color[5];
+ gint colors_count[5]={0,0,0,0,0};
+ gint i;
- token = g_scanner_get_next_token (scanner);
- if (token != wanted_token)
+ token = g_scanner_get_next_token (scanner);
+ if (token != wanted_token)
{
- return wanted_token;
+ return wanted_token;
}
- token = g_scanner_get_next_token (scanner);
- if (token != G_TOKEN_LEFT_CURLY)
- return G_TOKEN_LEFT_CURLY;
-
- token = g_scanner_peek_next_token (scanner);
- while (token != G_TOKEN_RIGHT_CURLY) {
- switch (token) {
- case TOKEN_MODE:
- token = theme_parse_custom_enum(scanner, TOKEN_MODE, TranslateFillStyleMode, CGE_FILL_SOLID, &retval->fill_mode);
- break;
- case TOKEN_GRADIENT_DIRECTION:
- token = theme_parse_custom_enum(scanner, TOKEN_GRADIENT_DIRECTION, TranslateGradientDirection, CGE_DIRECTION_VERTICAL, &retval->gradient_direction);
- case TOKEN_COLOR:
- {
- GtkStateType state;
-
- token = g_scanner_get_next_token (scanner);
- if (token != TOKEN_COLOR)
- return TOKEN_COLOR;
-
- token = gtk_rc_parse_state (scanner, &state);
- if (token != G_TOKEN_NONE)
- return token;
-
- token = g_scanner_get_next_token (scanner);
- if (token != G_TOKEN_EQUAL_SIGN)
- return G_TOKEN_EQUAL_SIGN;
-
- token = gtk_rc_parse_color (scanner, &color[state]);
-
+ token = g_scanner_get_next_token (scanner);
+ if (token != G_TOKEN_LEFT_CURLY)
+ return G_TOKEN_LEFT_CURLY;
- retval->gradient_colors[state][colors_count[state]]=color[state];
- colors_count[state]++;
+ token = g_scanner_peek_next_token (scanner);
+ while (token != G_TOKEN_RIGHT_CURLY) {
+ switch (token) {
+ case TOKEN_MODE:
+ token = theme_parse_custom_enum(scanner, TOKEN_MODE, TranslateFillStyleMode, CGE_FILL_SOLID, &retval->fill_mode);
+ break;
+ case TOKEN_GRADIENT_DIRECTION:
+ token = theme_parse_custom_enum(scanner, TOKEN_GRADIENT_DIRECTION, TranslateGradientDirection, CGE_DIRECTION_VERTICAL, &retval->gradient_direction);
+ case TOKEN_COLOR:
+ {
+ GtkStateType state;
+
+ token = g_scanner_get_next_token (scanner);
+ if (token != TOKEN_COLOR)
+ return TOKEN_COLOR;
+
+ token = gtk_rc_parse_state (scanner, &state);
+ if (token != G_TOKEN_NONE)
+ return token;
+
+ token = g_scanner_get_next_token (scanner);
+ if (token != G_TOKEN_EQUAL_SIGN)
+ return G_TOKEN_EQUAL_SIGN;
+
+ token = gtk_rc_parse_color (scanner, &color[state]);
- }
+ retval->gradient_colors[state][colors_count[state]]=color[state];
+ colors_count[state]++;
+ }
+ break;
+ case TOKEN_ROUND_WIDTH:
+ token = theme_parse_double (scanner, TOKEN_ROUND_WIDTH, 4.0, &retval->round_width, 0.0, 10.0);
+ break;
+ case TOKEN_ALPHA:
+ token = theme_parse_double (scanner, TOKEN_ALPHA, 1.0, &retval->alpha, 0.0, 1.0);
+ break;
+ default:
+ g_scanner_get_next_token (scanner);
+ token = G_TOKEN_RIGHT_CURLY;
+ break;
+ }
- break;
-
- case TOKEN_ROUND_WIDTH:
- token = theme_parse_double (scanner, TOKEN_ROUND_WIDTH, 4.0, &retval->round_width, 0.0, 10.0);
- break;
- case TOKEN_ALPHA:
- token = theme_parse_double (scanner, TOKEN_ALPHA, 1.0, &retval->alpha, 0.0, 1.0);
- break;
-
- default:
- g_scanner_get_next_token (scanner);
- token = G_TOKEN_RIGHT_CURLY;
- break;
+ token = g_scanner_peek_next_token (scanner);
}
- token = g_scanner_peek_next_token (scanner);
- }
-
- g_scanner_get_next_token (scanner);
- token = G_TOKEN_NONE;
+ g_scanner_get_next_token (scanner);
+ token = G_TOKEN_NONE;
- for(i=0;i<5;i++)
+ for(i=0;i<5;i++)
{
- if (colors_count[i]>0)
+ if (colors_count[i]>0)
{
- retval->gradient_colors_count[i]=colors_count[i];
- retval->gradient_colors_default[i]=FALSE;
-
+ retval->gradient_colors_count[i]=colors_count[i];
+ retval->gradient_colors_default[i]=FALSE;
+
}
}
- return token;
+ return token;
}
-static guint theme_parse_line (GtkSettings *settings, GScanner *scanner, GTokenType wanted_token, cge_line_style *retval)
+static guint
+theme_parse_line (GtkSettings *settings,
+ GScanner *scanner,
+ GTokenType wanted_token,
+ cge_line_style *retval)
{
- guint token;
+ guint token;
- token = g_scanner_get_next_token (scanner);
- if (token != wanted_token)
+ token = g_scanner_get_next_token (scanner);
+ if (token != wanted_token)
{
- return wanted_token;
+ return wanted_token;
}
- token = g_scanner_get_next_token (scanner);
- if (token != G_TOKEN_LEFT_CURLY)
- return G_TOKEN_LEFT_CURLY;
-
- token = g_scanner_peek_next_token (scanner);
- while (token != G_TOKEN_RIGHT_CURLY) {
- switch (token) {
- case TOKEN_MODE:
- token = theme_parse_custom_enum(scanner, TOKEN_MODE, TranslateLineStyleMode, CGE_LINE_SOLID, &retval->line_mode);
- break;
- case TOKEN_LINE_WIDTH:
- token = theme_parse_double (scanner, TOKEN_LINE_WIDTH, 1.0, &retval->line_width, 0.0, 10.0);
- break;
- case TOKEN_COLOR:
- {
- GtkStateType state;
-
- token = g_scanner_get_next_token (scanner);
- if (token != TOKEN_COLOR)
- return TOKEN_COLOR;
-
- token = gtk_rc_parse_state (scanner, &state);
- if (token != G_TOKEN_NONE)
- return token;
-
- token = g_scanner_get_next_token (scanner);
- if (token != G_TOKEN_EQUAL_SIGN)
- return G_TOKEN_EQUAL_SIGN;
-
- token = gtk_rc_parse_color (scanner, &retval->color[state]);
- retval->color_default[state]=FALSE;
- }
- break;
- case TOKEN_ROUND_WIDTH:
- token = theme_parse_double (scanner, TOKEN_ROUND_WIDTH, 4.0, &retval->round_width, 0.0, 10.0);
- break;
- case TOKEN_ALPHA:
- token = theme_parse_double (scanner, TOKEN_ALPHA, 1.0, &retval->alpha, 0.0, 1.0);
- break;
- default:
- g_scanner_get_next_token (scanner);
- token = G_TOKEN_RIGHT_CURLY;
- break;
- }
+ token = g_scanner_get_next_token (scanner);
+ if (token != G_TOKEN_LEFT_CURLY)
+ return G_TOKEN_LEFT_CURLY;
token = g_scanner_peek_next_token (scanner);
- }
+ while (token != G_TOKEN_RIGHT_CURLY) {
+ switch (token) {
+ case TOKEN_MODE:
+ token = theme_parse_custom_enum(scanner, TOKEN_MODE, TranslateLineStyleMode, CGE_LINE_SOLID, &retval->line_mode);
+ break;
+ case TOKEN_LINE_WIDTH:
+ token = theme_parse_double (scanner, TOKEN_LINE_WIDTH, 1.0, &retval->line_width, 0.0, 10.0);
+ break;
+ case TOKEN_COLOR:
+ {
+ GtkStateType state;
+
+ token = g_scanner_get_next_token (scanner);
+ if (token != TOKEN_COLOR)
+ return TOKEN_COLOR;
+
+ token = gtk_rc_parse_state (scanner, &state);
+ if (token != G_TOKEN_NONE)
+ return token;
+
+ token = g_scanner_get_next_token (scanner);
+ if (token != G_TOKEN_EQUAL_SIGN)
+ return G_TOKEN_EQUAL_SIGN;
+
+ token = gtk_rc_parse_color (scanner, &retval->color[state]);
+ retval->color_default[state]=FALSE;
+ }
+ break;
+ case TOKEN_ROUND_WIDTH:
+ token = theme_parse_double (scanner, TOKEN_ROUND_WIDTH, 4.0, &retval->round_width, 0.0, 10.0);
+ break;
+ case TOKEN_ALPHA:
+ token = theme_parse_double (scanner, TOKEN_ALPHA, 1.0, &retval->alpha, 0.0, 1.0);
+ break;
+ default:
+ g_scanner_get_next_token (scanner);
+ token = G_TOKEN_RIGHT_CURLY;
+ break;
+ }
- g_scanner_get_next_token (scanner);
- token = G_TOKEN_NONE;
+ token = g_scanner_peek_next_token (scanner);
+ }
- return token;
+ g_scanner_get_next_token (scanner);
+ token = G_TOKEN_NONE;
+
+ return token;
}
-static guint theme_parse_style (GtkSettings *settings, GScanner *scanner, GTokenType wanted_token, cge_style *retval)
+static guint
+theme_parse_style (GtkSettings *settings,
+ GScanner *scanner,
+ GTokenType wanted_token,
+ cge_style *retval)
{
- guint token;
+ guint token;
- token = g_scanner_get_next_token (scanner);
- if (token != wanted_token)
+ token = g_scanner_get_next_token (scanner);
+ if (token != wanted_token)
{
- return wanted_token;
+ return wanted_token;
}
- token = g_scanner_get_next_token (scanner);
- if (token != G_TOKEN_LEFT_CURLY)
- return G_TOKEN_LEFT_CURLY;
-
- token = g_scanner_peek_next_token (scanner);
- while (token != G_TOKEN_RIGHT_CURLY) {
- switch (token) {
- case TOKEN_DETAIL:
- token = theme_parse_char(scanner, TOKEN_DETAIL, &retval->detail);
- // printf("style %s found\n",retval->detail);
- break;
- case TOKEN_FILL :
- token = theme_parse_fill (settings, scanner, TOKEN_FILL, &retval->fill_style);
- break;
- case TOKEN_LINE:
- token = theme_parse_line (settings, scanner, TOKEN_LINE, &retval->line_style);
- break;
- default:
- g_scanner_get_next_token (scanner);
- token = G_TOKEN_RIGHT_CURLY;
- break;
- }
+ token = g_scanner_get_next_token (scanner);
+ if (token != G_TOKEN_LEFT_CURLY)
+ return G_TOKEN_LEFT_CURLY;
token = g_scanner_peek_next_token (scanner);
- }
+ while (token != G_TOKEN_RIGHT_CURLY) {
+ switch (token) {
+ case TOKEN_DETAIL:
+ token = theme_parse_char(scanner, TOKEN_DETAIL, &retval->detail);
+ /* printf("style %s found\n",retval->detail); */
+ break;
+ case TOKEN_FILL :
+ token = theme_parse_fill (settings, scanner, TOKEN_FILL, &retval->fill_style);
+ break;
+ case TOKEN_LINE:
+ token = theme_parse_line (settings, scanner, TOKEN_LINE, &retval->line_style);
+ break;
+ default:
+ g_scanner_get_next_token (scanner);
+ token = G_TOKEN_RIGHT_CURLY;
+ break;
+ }
- g_scanner_get_next_token (scanner);
- token = G_TOKEN_NONE;
+ token = g_scanner_peek_next_token (scanner);
+ }
- return token;
-}
+ g_scanner_get_next_token (scanner);
+ token = G_TOKEN_NONE;
+ return token;
+}
-void cge_rc_style_register_type (GTypeModule * module) {
+void
+cge_rc_style_register_type (GTypeModule * module)
+{
static const GTypeInfo object_info = {
- sizeof (CgeRCStyleClass),
- (GBaseInitFunc) NULL,
- (GBaseFinalizeFunc) NULL,
- (GClassInitFunc) cge_rc_style_class_init,
- NULL,
- NULL,
- sizeof (CgeRCStyle),
- 0,
- (GInstanceInitFunc) cge_rc_style_init,
-
+ sizeof (CgeRCStyleClass),
+ (GBaseInitFunc) NULL,
+ (GBaseFinalizeFunc) NULL,
+ (GClassInitFunc) cge_rc_style_class_init,
+ NULL,
+ NULL,
+ sizeof (CgeRCStyle),
+ 0,
+ (GInstanceInitFunc) cge_rc_style_init,
};
cge_type_rc_style = g_type_module_register_type (module,
- GTK_TYPE_RC_STYLE,
- "CgeRCStyle",
- &object_info, 0);
+ GTK_TYPE_RC_STYLE,
+ "CgeRCStyle",
+ &object_info, 0);
}
-
-static void cge_rc_init_fill_style(cge_fill_style* fill_style)
+static void
+cge_rc_init_fill_style (cge_fill_style* fill_style)
{
- gint i;
- fill_style->fill_mode=CGE_FILL_SOLID;
- fill_style->round_width=4;
- fill_style->alpha=1;
- fill_style->gradient_direction=CGE_DIRECTION_VERTICAL;
+ gint i;
- for(i=0;i<5;i++)
+ fill_style->fill_mode=CGE_FILL_SOLID;
+ fill_style->round_width=4;
+ fill_style->alpha=1;
+ fill_style->gradient_direction=CGE_DIRECTION_VERTICAL;
+
+ for(i=0;i<5;i++)
{
- fill_style->gradient_colors_count[i]=2;
- fill_style->gradient_colors_default[i]=TRUE;
+ fill_style->gradient_colors_count[i]=2;
+ fill_style->gradient_colors_default[i]=TRUE;
}
}
-static void cge_rc_init_line_style(cge_line_style* line_style)
+static void
+cge_rc_init_line_style (cge_line_style* line_style)
{
- gint i;
- for(i=0;i<5;i++)
+ gint i;
+
+ for(i=0;i<5;i++)
{
- line_style->color_default[i]=TRUE;
+ line_style->color_default[i]=TRUE;
}
- line_style->line_mode=CGE_LINE_SOLID;
- line_style->line_width=1;
- line_style->round_width=4;
- line_style->alpha=1;
+
+ line_style->line_mode=CGE_LINE_SOLID;
+ line_style->line_width=1;
+ line_style->round_width=4;
+ line_style->alpha=1;
}
-static void cge_rc_style_init (CgeRCStyle * style) {
- gint i;
+static void
+cge_rc_style_init (CgeRCStyle * style)
+{
+ gint i;
- for(i=0;i<MAX_STYLES;i++)
+ for(i=0;i<MAX_STYLES;i++)
{
- style->styles[i].detail=NULL;
- cge_rc_init_fill_style(&style->styles[i].fill_style);
- cge_rc_init_line_style(&style->styles[i].line_style);
+ style->styles[i].detail=NULL;
+ cge_rc_init_fill_style(&style->styles[i].fill_style);
+ cge_rc_init_line_style(&style->styles[i].line_style);
}
- style->arrow_style=CGE_ARROW_NORMAL;
+ style->arrow_style=CGE_ARROW_NORMAL;
}
-static void cge_rc_style_class_init (CgeRCStyleClass * klass) {
- GtkRcStyleClass * rc_style_class = GTK_RC_STYLE_CLASS (klass);
+static void
+cge_rc_style_class_init (CgeRCStyleClass * klass)
+{
+ GtkRcStyleClass * rc_style_class = GTK_RC_STYLE_CLASS (klass);
- parent_class = g_type_class_peek_parent (klass);
+ parent_class = g_type_class_peek_parent (klass);
- rc_style_class->parse = cge_rc_style_parse;
- rc_style_class->merge = cge_rc_style_merge;
- rc_style_class->create_style = cge_rc_style_create_style;
+ rc_style_class->parse = cge_rc_style_parse;
+ rc_style_class->merge = cge_rc_style_merge;
+ rc_style_class->create_style = cge_rc_style_create_style;
}
-static guint cge_rc_style_parse (GtkRcStyle *rc_style,
- GtkSettings *settings,
- GScanner *scanner)
+static guint
+cge_rc_style_parse (GtkRcStyle *rc_style,
+ GtkSettings *settings,
+ GScanner *scanner)
{
- static GQuark scope_id = 0;
- CgeRCStyle *cge_style = NEW_THEME_DATA(rc_style);
+ static GQuark scope_id = 0;
+ CgeRCStyle *cge_style = NEW_THEME_DATA(rc_style);
- guint old_scope;
- guint token;
- guint i;
- gint styles_count=1;
+ guint old_scope;
+ guint token;
+ guint i;
+ gint styles_count=1;
- /* Set up a new scope in this scanner */
- if (!scope_id)
+ /* Set up a new scope in this scanner */
+ if (!scope_id)
{
- scope_id = g_quark_from_string ("cge_theme_engine");
+ scope_id = g_quark_from_string ("cge_theme_engine");
}
- /* If we bail out due to errors, we don't reset the scope, so the
- * error messaging code can make sense of our tokens. */
- old_scope = g_scanner_set_scope (scanner, scope_id);
+ /* If we bail out due to errors, we don't reset the scope, so the
+ * error messaging code can make sense of our tokens. */
+ old_scope = g_scanner_set_scope (scanner, scope_id);
- /* Check if we already added our symbols to this scope */
- if (!g_scanner_lookup_symbol (scanner, theme_symbols[0].name))
+ /* Check if we already added our symbols to this scope */
+ if (!g_scanner_lookup_symbol (scanner, theme_symbols[0].name))
{
- for (i = 0; i < n_theme_symbols; i++)
+ for (i = 0; i < n_theme_symbols; i++)
{
- g_scanner_scope_add_symbol (scanner, scope_id, theme_symbols[i].name,
- GINT_TO_POINTER (theme_symbols[i].token));
+ g_scanner_scope_add_symbol (scanner, scope_id, theme_symbols[i].name,
+ GINT_TO_POINTER (theme_symbols[i].token));
}
}
- /* Read to go, now parse the top level */
- token = g_scanner_peek_next_token (scanner);
- while (token != G_TOKEN_RIGHT_CURLY)
+ /* Read to go, now parse the top level */
+ token = g_scanner_peek_next_token (scanner);
+ while (token != G_TOKEN_RIGHT_CURLY)
{
- switch (token)
+ switch (token)
{
case TOKEN_STYLE :
- token = theme_parse_style (settings, scanner, TOKEN_STYLE, &cge_style->styles[styles_count]);
- styles_count++;
- break;
+ token = theme_parse_style (settings, scanner, TOKEN_STYLE, &cge_style->styles[styles_count]);
+ styles_count++;
+ break;
case TOKEN_FILL :
- token = theme_parse_fill (settings, scanner, TOKEN_FILL, &cge_style->styles[0].fill_style);
- break;
+ token = theme_parse_fill (settings, scanner, TOKEN_FILL, &cge_style->styles[0].fill_style);
+ break;
case TOKEN_LINE:
- token = theme_parse_line (settings, scanner, TOKEN_LINE, &cge_style->styles[0].line_style);
- break;
+ token = theme_parse_line (settings, scanner, TOKEN_LINE, &cge_style->styles[0].line_style);
+ break;
case TOKEN_ARROW:
- token = theme_parse_custom_enum(scanner, TOKEN_ARROW, TranslateArrowStyle, CGE_ARROW_NORMAL, &cge_style->arrow_style);
- break;
+ token = theme_parse_custom_enum(scanner, TOKEN_ARROW, TranslateArrowStyle, CGE_ARROW_NORMAL, &cge_style->arrow_style);
+ break;
default:
- g_scanner_get_next_token (scanner);
- token = G_TOKEN_RIGHT_CURLY;
- break;
+ g_scanner_get_next_token (scanner);
+ token = G_TOKEN_RIGHT_CURLY;
+ break;
}
- if (token != G_TOKEN_NONE)
+ if (token != G_TOKEN_NONE)
{
- g_free (cge_style);
- return token;
+ g_free (cge_style);
+ return token;
}
- token = g_scanner_peek_next_token (scanner);
+ token = g_scanner_peek_next_token (scanner);
}
- g_scanner_get_next_token(scanner);
-
- cge_style->styles[0].detail="all";
-
- SET_THEME_DATA(rc_style, cge_style);
+ g_scanner_get_next_token(scanner);
- g_scanner_set_scope (scanner, old_scope);
+ cge_style->styles[0].detail="all";
-
+ SET_THEME_DATA(rc_style, cge_style);
+ g_scanner_set_scope (scanner, old_scope);
- return G_TOKEN_NONE;
+ return G_TOKEN_NONE;
}
+static void
+cge_rc_style_merge (GtkRcStyle * dest, GtkRcStyle * src)
+{
+ gint i;
-static void cge_rc_style_merge (GtkRcStyle * dest, GtkRcStyle * src) {
- gint i;
- parent_class->merge (dest, src);
-
+ parent_class->merge (dest, src);
- if (CGE_IS_RC_STYLE (src))
+ if (CGE_IS_RC_STYLE (src))
{
- CgeRCStyle *src_data = CGE_RC_DATA (src);
- CgeRCStyle *dest_data = CGE_RC_DATA (dest);
+ CgeRCStyle *src_data = CGE_RC_DATA (src);
+ CgeRCStyle *dest_data = CGE_RC_DATA (dest);
- for(i=0;i<MAX_STYLES;i++)
+ for(i=0;i<MAX_STYLES;i++)
{
- dest_data->styles[i]=src_data->styles[i];
+ dest_data->styles[i]=src_data->styles[i];
}
- dest_data->arrow_style=src_data->arrow_style;
- SET_THEME_DATA(dest, dest_data);
-
+ dest_data->arrow_style=src_data->arrow_style;
+ SET_THEME_DATA(dest, dest_data);
}
-
}
-static GtkStyle * cge_rc_style_create_style (GtkRcStyle * rc_style) {
- void * ptr;
-
+static GtkStyle *
+cge_rc_style_create_style (GtkRcStyle * rc_style)
+{
+ void * ptr;
- ptr = g_object_new (CGE_TYPE_STYLE, NULL);
- return (GtkStyle *) ptr;
+ ptr = g_object_new (CGE_TYPE_STYLE, NULL);
+ return (GtkStyle *) ptr;
}
Index: cge.c
===================================================================
RCS file: /cvs/cairo/cairo-gtk-engine/src/cge.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- cge.c 3 Feb 2005 19:38:44 -0000 1.2
+++ cge.c 3 Feb 2005 20:03:59 -0000 1.3
@@ -22,24 +22,30 @@
#include "cge.h"
+G_MODULE_EXPORT void
+theme_init (GTypeModule * module);
-G_MODULE_EXPORT void theme_init (GTypeModule * module);
-
-G_MODULE_EXPORT void theme_exit (GTypeModule * module);
-
-G_MODULE_EXPORT GtkRcStyle * theme_create_rc_style (void);
-
+G_MODULE_EXPORT
+void theme_exit (GTypeModule * module);
+G_MODULE_EXPORT GtkRcStyle *
+theme_create_rc_style (void);
-G_MODULE_EXPORT void theme_init (GTypeModule * module) {
+G_MODULE_EXPORT void
+theme_init (GTypeModule * module)
+{
cge_rc_style_register_type (module);
cge_style_register_type (module);
}
-G_MODULE_EXPORT void theme_exit (GTypeModule * module) {
+G_MODULE_EXPORT void
+theme_exit (GTypeModule * module)
+{
}
-G_MODULE_EXPORT GtkRcStyle * theme_create_rc_style (void) {
+G_MODULE_EXPORT GtkRcStyle *
+theme_create_rc_style (void)
+{
void *ptr;
ptr = GTK_RC_STYLE (g_object_new (CGE_TYPE_RC_STYLE, NULL));
@@ -51,9 +57,12 @@
* version of GTK+ that loads us.
*/
#if 0
-G_MODULE_EXPORT const gchar * g_module_check_init (GModule * module);
+G_MODULE_EXPORT const gchar *
+g_module_check_init (GModule * module);
-const gchar * g_module_check_init (GModule * module) {
+const gchar *
+g_module_check_init (GModule * module)
+{
return gtk_check_version (GTK_MAJOR_VERSION, GTK_MINOR_VERSION,
GTK_MICRO_VERSION - GTK_INTERFACE_AGE);
}
Index: cge.h
===================================================================
RCS file: /cvs/cairo/cairo-gtk-engine/src/cge.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- cge.h 3 Feb 2005 19:38:44 -0000 1.2
+++ cge.h 3 Feb 2005 20:03:59 -0000 1.3
@@ -28,8 +28,6 @@
#include <gdk/gdkx.h>
#include <cairo.h>
-
-
#include "cge-style.h"
#endif
More information about the cairo-commit
mailing list