gtk-engines r1027 - in trunk: . engines/clearlooks/src



Author: acimitan
Date: Wed Jan 23 11:01:27 2008
New Revision: 1027
URL: http://svn.gnome.org/viewvc/gtk-engines?rev=1027&view=rev

Log:
2008-01-23  Andrea Cimitan  <andrea cimitan gmail com>

	* engines/clearlooks/src/clearlooks_draw_glossy.c:
	(clearlooks_glossy_draw_button):
	* engines/clearlooks/src/clearlooks_draw_gummy.c:
	(clearlooks_gummy_draw_button):
	* engines/clearlooks/src/clearlooks_rc_style.c:
	(clearlooks_rc_style_init), (clearlooks_gtk2_rc_parse_int),
	(clearlooks_rc_style_parse), (clearlooks_rc_style_merge):
	* engines/clearlooks/src/clearlooks_rc_style.h:
	* engines/clearlooks/src/clearlooks_style.c:
	(clearlooks_set_widget_parameters), (clearlooks_style_draw_box),
	(clearlooks_style_init_from_rc), (clearlooks_style_copy):
	* engines/clearlooks/src/clearlooks_style.h:
	* engines/clearlooks/src/clearlooks_types.h:
	New option: int reliefstyle to enable/disable shadows on buttons.
	Default is 1 (enable shadows on Gummy and prelight on Glossy)


Modified:
   trunk/ChangeLog
   trunk/engines/clearlooks/src/clearlooks_draw_glossy.c
   trunk/engines/clearlooks/src/clearlooks_draw_gummy.c
   trunk/engines/clearlooks/src/clearlooks_rc_style.c
   trunk/engines/clearlooks/src/clearlooks_rc_style.h
   trunk/engines/clearlooks/src/clearlooks_style.c
   trunk/engines/clearlooks/src/clearlooks_style.h
   trunk/engines/clearlooks/src/clearlooks_types.h

Modified: trunk/engines/clearlooks/src/clearlooks_draw_glossy.c
==============================================================================
--- trunk/engines/clearlooks/src/clearlooks_draw_glossy.c	(original)
+++ trunk/engines/clearlooks/src/clearlooks_draw_glossy.c	Wed Jan 23 11:01:27 2008
@@ -257,7 +257,7 @@
 	cairo_translate (cr, x, y);
 	cairo_set_line_width (cr, 1.0);
 
-	/* Shadows and Glow */
+	/* Shadows and shadow */
 	if (params->xthickness == 3 || params->ythickness == 3)
 	{
 		if (params->xthickness == 3)
@@ -272,27 +272,27 @@
 	{
 		cairo_translate (cr, 0.5, 0.5);
 
-		/* if (params->enable_glow && !params->active && !params->disabled) */
-		if (params->prelight && params->enable_glow && !params->active)
+		/* if (params->enable_shadow && !params->active && !params->disabled) */
+		if (params->prelight && params->enable_shadow && !params->active)
 		{
-			/* Glow becomes a shadow to have 3d prelight buttons :) */
-			CairoColor glow;
+			/* shadow becomes a shadow to have 3d prelight buttons :) */
+			CairoColor shadow;
 
 			radius = MIN (params->radius, MIN ((width - 2.0 - 2*xoffset) / 2.0 - 1.0, (height - 2.0 - 2*yoffset) / 2.0 - 1.0));
 
 			ge_cairo_rounded_rectangle (cr, 0, 0, width-1, height-1, radius+1, params->corners);
-			ge_shade_color (&params->parentbg, 0.96, &glow);
-			ge_cairo_set_color (cr, &glow);
+			ge_shade_color (&params->parentbg, 0.96, &shadow);
+			ge_cairo_set_color (cr, &shadow);
 			cairo_stroke (cr);
 
 			ge_cairo_rounded_rectangle (cr, 1, 1, width-2, height-2, radius+1, params->corners);
-			ge_shade_color (&params->parentbg, 0.92, &glow);
-			ge_cairo_set_color (cr, &glow);
+			ge_shade_color (&params->parentbg, 0.92, &shadow);
+			ge_cairo_set_color (cr, &shadow);
 			cairo_stroke (cr);
 		}
 		
-		/* if (!(params->enable_glow && !params->active && !params->disabled)) */
-		if (!(params->prelight && params->enable_glow && !params->active))
+		/* if (!(params->enable_shadow && !params->active && !params->disabled)) */
+		if (!(params->prelight && params->enable_shadow && !params->active))
 		{
 			if (!(params->disabled))
 				params->style_functions->draw_inset (cr, &params->parentbg, 0, 0, width-1, height-1, params->radius+1, params->corners);
@@ -342,30 +342,30 @@
 	/* Default button highlight */
 	if (params->is_default && !params->active && !params->disabled)
 	{
-		const CairoColor *glow = &colors->spot[0];
+		const CairoColor *shadow = &colors->spot[0];
 		double hh = (height-5)/2.0 + 1;
 		
 		cairo_rectangle (cr, 3.5, 3.5, width-7, height-7);
-		ge_cairo_set_color (cr, glow);
+		ge_cairo_set_color (cr, shadow);
 		cairo_stroke (cr);
 
-		glow = &colors->spot[0];
+		shadow = &colors->spot[0];
 		cairo_move_to (cr, 2.5, 2.5+hh); cairo_rel_line_to (cr, 0, -hh);
 		cairo_rel_line_to (cr, width-5, 0); cairo_rel_line_to (cr, 0, hh);
-		ge_cairo_set_color (cr, glow);
+		ge_cairo_set_color (cr, shadow);
 		cairo_stroke (cr);
 		
 		hh--;
 
-		glow = &colors->spot[1];
+		shadow = &colors->spot[1];
 		cairo_move_to (cr, 2.5, 2.5+hh); cairo_rel_line_to (cr, 0, hh);
 		cairo_rel_line_to (cr, width-5, 0); cairo_rel_line_to (cr, 0, -hh);
-		ge_cairo_set_color (cr, glow);
+		ge_cairo_set_color (cr, shadow);
 		cairo_stroke (cr);
 	}
 	
 	/* Border */
-	if (params->is_default || (params->prelight && params->enable_glow))
+	if (params->is_default || (params->prelight && params->enable_shadow))
 		border_normal = colors->spot[2];
 		/* ge_mix_color (&border_normal, &colors->spot[2], 0.5, &border_normal); */
 	if (params->disabled)

Modified: trunk/engines/clearlooks/src/clearlooks_draw_gummy.c
==============================================================================
--- trunk/engines/clearlooks/src/clearlooks_draw_gummy.c	(original)
+++ trunk/engines/clearlooks/src/clearlooks_draw_gummy.c	Wed Jan 23 11:01:27 2008
@@ -192,7 +192,7 @@
 	{
 		cairo_translate (cr, 0.5, 0.5);
 
-		if (params->enable_glow && !params->active && !params->disabled && !params->is_default)
+		if (params->enable_shadow && !params->active && !params->disabled && !params->is_default)
 		{
 			CairoColor shadow;
 
@@ -220,7 +220,7 @@
 			cairo_stroke (cr);
 		}
 
-		if (!(params->enable_glow && !params->active && !params->disabled))
+		if (!(params->enable_shadow && !params->active && !params->disabled))
 			params->style_functions->draw_inset (cr, &params->parentbg, 0, 0, width-1, height-1, params->radius+1, params->corners);
 		cairo_translate (cr, -0.5, -0.5);
 	}
@@ -262,7 +262,7 @@
 	}
 
 	/* Border */
-	if (params->is_default) /* || (params->prelight && params->enable_glow)) */
+	if (params->is_default) /* || (params->prelight && params->enable_shadow)) */
 		border_normal = colors->spot[2];
 	if (params->disabled)
 		ge_cairo_set_color (cr, &border_disabled);

Modified: trunk/engines/clearlooks/src/clearlooks_rc_style.c
==============================================================================
--- trunk/engines/clearlooks/src/clearlooks_rc_style.c	(original)
+++ trunk/engines/clearlooks/src/clearlooks_rc_style.c	Wed Jan 23 11:01:27 2008
@@ -56,6 +56,7 @@
 	TOKEN_CONTRAST,
 	TOKEN_SUNKENMENU,
 	TOKEN_PROGRESSBARSTYLE,
+	TOKEN_RELIEFSTYLE,
 	TOKEN_MENUBARSTYLE,
 	TOKEN_TOOLBARSTYLE,
 	TOKEN_MENUITEMSTYLE,
@@ -83,6 +84,7 @@
 	"contrast\0"
 	"sunkenmenubar\0"
 	"progressbarstyle\0"
+	"reliefstyle\0"
 	"menubarstyle\0"
 	"toolbarstyle\0"
 	"menuitemstyle\0"
@@ -131,6 +133,7 @@
 	clearlooks_rc->flags = 0;
 
 	clearlooks_rc->contrast = 1.0;
+	clearlooks_rc->reliefstyle = 1;
 	clearlooks_rc->menubarstyle = 0;
 	clearlooks_rc->toolbarstyle = 0;
 	clearlooks_rc->animation = FALSE;
@@ -242,7 +245,7 @@
 {
 	guint token;
 
-	/* Skip 'sunkenmenubar' */
+	/* Skip option name */
 	token = g_scanner_get_next_token(scanner);
 
 	token = g_scanner_get_next_token(scanner);
@@ -383,6 +386,10 @@
 				token = clearlooks_gtk2_rc_parse_double (settings, scanner, &clearlooks_style->contrast);
 				clearlooks_style->flags |= CL_FLAG_CONTRAST;
 				break;
+			case TOKEN_RELIEFSTYLE:
+				token = clearlooks_gtk2_rc_parse_int (settings, scanner, &clearlooks_style->reliefstyle);
+				clearlooks_style->flags |= CL_FLAG_RELIEFSTYLE;
+				break;
 			case TOKEN_MENUBARSTYLE:
 				token = clearlooks_gtk2_rc_parse_int (settings, scanner, &clearlooks_style->menubarstyle);
 				clearlooks_style->flags |= CL_FLAG_MENUBARSTYLE;
@@ -462,6 +469,8 @@
 		dest_w->style = src_w->style;
 	if (flags & CL_FLAG_CONTRAST)
 		dest_w->contrast = src_w->contrast;
+	if (flags & CL_FLAG_RELIEFSTYLE)
+		dest_w->reliefstyle = src_w->reliefstyle;
 	if (flags & CL_FLAG_MENUBARSTYLE)
 		dest_w->menubarstyle = src_w->menubarstyle;
 	if (flags & CL_FLAG_TOOLBARSTYLE)

Modified: trunk/engines/clearlooks/src/clearlooks_rc_style.h
==============================================================================
--- trunk/engines/clearlooks/src/clearlooks_rc_style.h	(original)
+++ trunk/engines/clearlooks/src/clearlooks_rc_style.h	Wed Jan 23 11:01:27 2008
@@ -46,11 +46,12 @@
 	CL_FLAG_SCROLLBAR_COLOR    = 1 <<  2,
 	CL_FLAG_COLORIZE_SCROLLBAR = 1 <<  3,
 	CL_FLAG_CONTRAST           = 1 <<  4,
-	CL_FLAG_MENUBARSTYLE       = 1 <<  5,
-	CL_FLAG_TOOLBARSTYLE       = 1 <<  6,
-	CL_FLAG_ANIMATION          = 1 <<  7,
-	CL_FLAG_RADIUS             = 1 <<  8,
-	CL_FLAG_HINT               = 1 <<  9
+	CL_FLAG_RELIEFSTYLE        = 1 <<  5,
+	CL_FLAG_MENUBARSTYLE       = 1 <<  6,
+	CL_FLAG_TOOLBARSTYLE       = 1 <<  7,
+	CL_FLAG_ANIMATION          = 1 <<  8,
+	CL_FLAG_RADIUS             = 1 <<  9,
+	CL_FLAG_HINT               = 1 <<  10
 } ClearlooksRcFlags;
 
 
@@ -66,6 +67,7 @@
 	GdkColor scrollbar_color;
 	gboolean colorize_scrollbar;
 	double contrast;
+	guint8 reliefstyle;
 	guint8 menubarstyle;
 	guint8 toolbarstyle;
 	gboolean animation;

Modified: trunk/engines/clearlooks/src/clearlooks_style.c
==============================================================================
--- trunk/engines/clearlooks/src/clearlooks_style.c	(original)
+++ trunk/engines/clearlooks/src/clearlooks_style.c	Wed Jan 23 11:01:27 2008
@@ -65,19 +65,19 @@
 {
 	params->style_functions = &(clearlooks_style_class->style_functions[CLEARLOOKS_STYLE (style)->style]);
 
-	params->active      = (state_type == GTK_STATE_ACTIVE);
-	params->prelight    = (state_type == GTK_STATE_PRELIGHT);
-	params->disabled    = (state_type == GTK_STATE_INSENSITIVE);
-	params->state_type  = (ClearlooksStateType)state_type;
-	params->corners     = CR_CORNER_ALL;
-	params->ltr         = ge_widget_is_ltr ((GtkWidget*)widget);
-	params->focus       = widget && GTK_WIDGET_HAS_FOCUS (widget);
-	params->is_default  = widget && GE_WIDGET_HAS_DEFAULT (widget);
-	params->enable_glow = FALSE;
-	params->radius      = CLEARLOOKS_STYLE (style)->radius;
+	params->active        = (state_type == GTK_STATE_ACTIVE);
+	params->prelight      = (state_type == GTK_STATE_PRELIGHT);
+	params->disabled      = (state_type == GTK_STATE_INSENSITIVE);
+	params->state_type    = (ClearlooksStateType)state_type;
+	params->corners       = CR_CORNER_ALL;
+	params->ltr           = ge_widget_is_ltr ((GtkWidget*)widget);
+	params->focus         = widget && GTK_WIDGET_HAS_FOCUS (widget);
+	params->is_default    = widget && GE_WIDGET_HAS_DEFAULT (widget);
+	params->enable_shadow = FALSE;
+	params->radius        = CLEARLOOKS_STYLE (style)->radius;
 
-	params->xthickness = style->xthickness;
-	params->ythickness = style->ythickness;
+	params->xthickness    = style->xthickness;
+	params->ythickness    = style->ythickness;
 
 	/* This is used in GtkEntry to fake transparency. The reason to do this
 	 * is that the entry has it's entire background filled with base[STATE].
@@ -531,7 +531,8 @@
 		else
 		{
 			params.corners = CR_CORNER_ALL;
-			params.enable_glow = TRUE;
+			if (clearlooks_style->reliefstyle != 0)
+				params.enable_shadow = TRUE;
 		}
 
 		STYLE_FUNCTION(draw_button) (cr, &clearlooks_style->colors, &params,
@@ -752,7 +753,8 @@
 
 		clearlooks_set_widget_parameters (widget, style, state_type, &params);
 
-		params.enable_glow = TRUE;
+		if (clearlooks_style->reliefstyle != 0)
+			params.enable_shadow = TRUE;
 
 		ge_option_menu_get_props (widget, &indicator_size, &indicator_spacing);
 
@@ -1223,6 +1225,7 @@
 	g_assert ((CLEARLOOKS_RC_STYLE (rc_style)->style >= 0) && (CLEARLOOKS_RC_STYLE (rc_style)->style < CL_NUM_STYLES));
 	clearlooks_style->style               = CLEARLOOKS_RC_STYLE (rc_style)->style;
 
+	clearlooks_style->reliefstyle         = CLEARLOOKS_RC_STYLE (rc_style)->reliefstyle;
 	clearlooks_style->menubarstyle        = CLEARLOOKS_RC_STYLE (rc_style)->menubarstyle;
 	clearlooks_style->toolbarstyle        = CLEARLOOKS_RC_STYLE (rc_style)->toolbarstyle;
 	clearlooks_style->has_focus_color     = CLEARLOOKS_RC_STYLE (rc_style)->flags & CL_FLAG_FOCUS_COLOR;
@@ -1441,6 +1444,7 @@
 	ClearlooksStyle * cl_src = CLEARLOOKS_STYLE (src);
 
 	cl_style->colors              = cl_src->colors;
+	cl_style->reliefstyle         = cl_src->reliefstyle;
 	cl_style->menubarstyle        = cl_src->menubarstyle;
 	cl_style->toolbarstyle        = cl_src->toolbarstyle;
 	cl_style->focus_color         = cl_src->focus_color;

Modified: trunk/engines/clearlooks/src/clearlooks_style.h
==============================================================================
--- trunk/engines/clearlooks/src/clearlooks_style.h	(original)
+++ trunk/engines/clearlooks/src/clearlooks_style.h	Wed Jan 23 11:01:27 2008
@@ -51,6 +51,7 @@
 
 	ClearlooksStyles style;
 
+	guint8   reliefstyle;
 	guint8   menubarstyle;
 	guint8   toolbarstyle;
 	GdkColor focus_color;

Modified: trunk/engines/clearlooks/src/clearlooks_types.h
==============================================================================
--- trunk/engines/clearlooks/src/clearlooks_types.h	(original)
+++ trunk/engines/clearlooks/src/clearlooks_types.h	Wed Jan 23 11:01:27 2008
@@ -161,7 +161,7 @@
 	boolean focus;
 	boolean is_default;
 	boolean ltr;
-	boolean enable_glow;
+	boolean enable_shadow;
 
 	gfloat  radius;
 	



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]