murrine r103 - in trunk: . src



Author: acimitan
Date: Sun Dec 28 15:37:15 2008
New Revision: 103
URL: http://svn.gnome.org/viewvc/murrine?rev=103&view=rev

Log:
2008-12-28  Andrea Cimitan  <andrea cimitan gmail com>

	* src/cairo-support.c (murrine_draw_glow), (murrine_draw_glaze):
	* src/murrine_rc_style.c (murrine_rc_style_init),
	(murrine_rc_style_parse), (murrine_rc_style_merge):
	* src/murrine_rc_style.h:
	* src/murrine_style.c (murrine_set_widget_parameters),
	(murrine_style_init_from_rc), (murrine_style_copy):
	* src/murrine_style.h:
	* src/murrine_types.h:
	Added a initial test of glow_ratio option.
	It is in *testing*.


Modified:
   trunk/ChangeLog
   trunk/src/cairo-support.c
   trunk/src/murrine_rc_style.c
   trunk/src/murrine_rc_style.h
   trunk/src/murrine_style.c
   trunk/src/murrine_style.h
   trunk/src/murrine_types.h

Modified: trunk/src/cairo-support.c
==============================================================================
--- trunk/src/cairo-support.c	(original)
+++ trunk/src/cairo-support.c	Sun Dec 28 15:37:15 2008
@@ -529,23 +529,23 @@
 
 static void
 murrine_draw_glow (cairo_t *cr,
-                   const MurrineRGB *fill,
+                   const MurrineRGB *glow,
                    int x, int y, int width, int height)
 {
 	cairo_pattern_t *pat;
-	MurrineRGB       glow_c;
-	int              glow_r = 200; /* draw a big cirle */
-
-	murrine_shade (fill, 1.24, &glow_c);
+	double           scaling_factor = (double)1.2*width/height;
 
+	cairo_save (cr);
 	cairo_rectangle (cr, x, y, width, height);
-	pat = cairo_pattern_create_radial (x+width/2, y-width-glow_r, width+glow_r,
-	                                   x+width/2, y-width-glow_r, width+height+glow_r);
-	cairo_pattern_add_color_stop_rgba (pat, 0.0, glow_c.r, glow_c.g, glow_c.b, 0.6);
-	cairo_pattern_add_color_stop_rgba (pat, 1.0, glow_c.r, glow_c.g, glow_c.b, 0.0);
+	cairo_scale (cr, scaling_factor, 1);
+	pat = cairo_pattern_create_radial ((x+width/2.0)/scaling_factor, y, y,
+	                                   (x+width/2.0)/scaling_factor, y, y+height/2);
+	murrine_pattern_add_color_stop_rgba (pat, 0.0, glow, 0.6);
+	murrine_pattern_add_color_stop_rgba (pat, 1.0, glow, 0.0);
 	cairo_set_source (cr, pat);
-	cairo_fill (cr);
 	cairo_pattern_destroy (pat);
+	cairo_fill (cr);
+	cairo_restore (cr);
 }
 
 static void
@@ -617,6 +617,7 @@
                     int radius, uint8 corners, boolean horizontal)
 {
 	MurrineRGB highlight;
+	double glow_ratio = widget->glow_ratio;
 	murrine_shade (fill, highlight_ratio, &highlight);
 
 	murrine_set_gradient (cr, fill, mrn_gradient, x, y, 0, height, mrn_gradient.gradients, FALSE);
@@ -649,6 +650,14 @@
 	murrine_set_gradient (cr, &highlight, mrn_gradient, x, y, 0, height, mrn_gradient.gradients, TRUE);
 	cairo_fill (cr);
 
+	if (glow_ratio != 1.0)
+	{
+		MurrineRGB glow;
+		murrine_shade (fill, glow_ratio, &glow);
+
+		murrine_draw_glow (cr, &glow, x, y, width, height);
+	}
+
 	if (widget->glazestyle == 4)
 	{
 		MurrineRGB shadow;

Modified: trunk/src/murrine_rc_style.c
==============================================================================
--- trunk/src/murrine_rc_style.c	(original)
+++ trunk/src/murrine_rc_style.c	Sun Dec 28 15:37:15 2008
@@ -39,6 +39,7 @@
 	TOKEN_COLORIZE_SCROLLBAR,
 	TOKEN_CONTRAST,
 	TOKEN_GLAZESTYLE,
+	TOKEN_GLOW_RATIO,
 	TOKEN_GRADIENT_SHADES,
 	TOKEN_GRADIENTS,
 	TOKEN_HIGHLIGHT_RATIO,
@@ -86,6 +87,7 @@
 	{ "colorize_scrollbar",  TOKEN_COLORIZE_SCROLLBAR },
 	{ "contrast",            TOKEN_CONTRAST },
 	{ "glazestyle",          TOKEN_GLAZESTYLE },
+	{ "glow_ratio",          TOKEN_GLOW_RATIO },
 	{ "gradient_shades",     TOKEN_GRADIENT_SHADES },
 	{ "gradients",           TOKEN_GRADIENTS },
 	{ "highlight_ratio",     TOKEN_HIGHLIGHT_RATIO },
@@ -139,6 +141,7 @@
 	murrine_rc->colorize_scrollbar = TRUE;
 	murrine_rc->contrast = 1.0;
 	murrine_rc->glazestyle = 1;
+	murrine_rc->glow_ratio = 1.0;
 	murrine_rc->gradient_shades[0] = 1.1;
 	murrine_rc->gradient_shades[1] = 1.0;
 	murrine_rc->gradient_shades[2] = 1.0;
@@ -467,6 +470,10 @@
 				token = theme_parse_int (settings, scanner, &murrine_style->glazestyle);
 				murrine_style->flags |= MRN_FLAG_GLAZESTYLE;
 				break;
+			case TOKEN_GLOW_RATIO:
+				token = theme_parse_ratio (settings, scanner, &murrine_style->glow_ratio);
+				murrine_style->flags |= MRN_FLAG_GLOW_RATIO;
+				break;
 			case TOKEN_GRADIENT_SHADES:
 				token = theme_parse_gradient (settings, scanner, murrine_style->gradient_shades);
 				murrine_style->flags |= MRN_FLAG_GRADIENT_SHADES;
@@ -609,6 +616,8 @@
 		dest_w->contrast = src_w->contrast;
 	if (flags & MRN_FLAG_GLAZESTYLE)
 		dest_w->glazestyle = src_w->glazestyle;
+	if (flags & MRN_FLAG_GLOW_RATIO)
+		dest_w->glow_ratio = src_w->glow_ratio;
 	if (flags & MRN_FLAG_GRADIENT_SHADES)
 	{
 		dest_w->gradient_shades[0] = src_w->gradient_shades[0];

Modified: trunk/src/murrine_rc_style.h
==============================================================================
--- trunk/src/murrine_rc_style.h	(original)
+++ trunk/src/murrine_rc_style.h	Sun Dec 28 15:37:15 2008
@@ -39,27 +39,28 @@
 	MRN_FLAG_COLORIZE_SCROLLBAR = 1 << 1,
 	MRN_FLAG_CONTRAST = 1 << 2,
 	MRN_FLAG_GLAZESTYLE = 1 << 3,
-	MRN_FLAG_GRADIENT_SHADES = 1 << 4,
-	MRN_FLAG_GRADIENTS = 1 << 5,
-	MRN_FLAG_HIGHLIGHT_RATIO = 1 << 6,
-	MRN_FLAG_LIGHTBORDER_RATIO = 1 << 7,
-	MRN_FLAG_LIGHTBORDERSTYLE= 1 << 8,
-	MRN_FLAG_LISTVIEWHEADERSTYLE = 1 << 9,
-	MRN_FLAG_LISTVIEWSTYLE = 1 << 10,
-	MRN_FLAG_MENUBARITEMSTYLE = 1 << 11,
-	MRN_FLAG_MENUBARSTYLE = 1 << 12,
-	MRN_FLAG_MENUITEMSTYLE = 1 << 13,
-	MRN_FLAG_MENUSTYLE = 1 << 14,
-	MRN_FLAG_PROFILE = 1 << 15,
-	MRN_FLAG_PROGRESSBARSTYLE = 1 << 16,
-	MRN_FLAG_RELIEFSTYLE = 1 << 17,
-	MRN_FLAG_RGBA = 1 << 18,
-	MRN_FLAG_ROUNDNESS = 1 << 19,
-	MRN_FLAG_SCROLLBAR_COLOR = 1 << 20,
-	MRN_FLAG_SCROLLBARSTYLE = 1 << 21,
-	MRN_FLAG_SLIDERSTYLE = 1 << 22,
-	MRN_FLAG_STEPPERSTYLE = 1 << 23,
-	MRN_FLAG_TOOLBARSTYLE = 1 << 24
+	MRN_FLAG_GLOW_RATIO = 1 << 4,
+	MRN_FLAG_GRADIENT_SHADES = 1 << 5,
+	MRN_FLAG_GRADIENTS = 1 << 6,
+	MRN_FLAG_HIGHLIGHT_RATIO = 1 << 7,
+	MRN_FLAG_LIGHTBORDER_RATIO = 1 << 8,
+	MRN_FLAG_LIGHTBORDERSTYLE= 1 << 9,
+	MRN_FLAG_LISTVIEWHEADERSTYLE = 1 << 10,
+	MRN_FLAG_LISTVIEWSTYLE = 1 << 11,
+	MRN_FLAG_MENUBARITEMSTYLE = 1 << 12,
+	MRN_FLAG_MENUBARSTYLE = 1 << 13,
+	MRN_FLAG_MENUITEMSTYLE = 1 << 14,
+	MRN_FLAG_MENUSTYLE = 1 << 15,
+	MRN_FLAG_PROFILE = 1 << 16,
+	MRN_FLAG_PROGRESSBARSTYLE = 1 << 17,
+	MRN_FLAG_RELIEFSTYLE = 1 << 18,
+	MRN_FLAG_RGBA = 1 << 19,
+	MRN_FLAG_ROUNDNESS = 1 << 20,
+	MRN_FLAG_SCROLLBAR_COLOR = 1 << 21,
+	MRN_FLAG_SCROLLBARSTYLE = 1 << 22,
+	MRN_FLAG_SLIDERSTYLE = 1 << 23,
+	MRN_FLAG_STEPPERSTYLE = 1 << 24,
+	MRN_FLAG_TOOLBARSTYLE = 1 << 25
 } MurrineRcFlags;
 
 struct _MurrineRcStyle
@@ -69,6 +70,7 @@
 	MurrineRcFlags flags;
 
 	double   contrast;
+	double   glow_ratio;
 	double   gradient_shades[4];
 	double   highlight_ratio;
 	double   lightborder_ratio;

Modified: trunk/src/murrine_style.c
==============================================================================
--- trunk/src/murrine_style.c	(original)
+++ trunk/src/murrine_style.c	Sun Dec 28 15:37:15 2008
@@ -136,12 +136,13 @@
 	params->xthickness = style->xthickness;
 	params->ythickness = style->ythickness;
 
+	params->glazestyle        = murrine_style->glazestyle;
+	params->glow_ratio        = murrine_style->glow_ratio;
+	params->highlight_ratio   = murrine_style->highlight_ratio;
 	params->lightborder_ratio = murrine_style->lightborder_ratio;
 	params->lightborderstyle  = murrine_style->lightborderstyle;
-	params->glazestyle        = murrine_style->glazestyle;
 	params->reliefstyle       = murrine_style->reliefstyle;
 	params->roundness         = murrine_style->roundness;
-	params->highlight_ratio   = murrine_style->highlight_ratio;
 
 	MurrineGradients mrn_gradient;
 	if (murrine_style->gradients)
@@ -1677,6 +1678,7 @@
 	GTK_STYLE_CLASS (murrine_style_parent_class)->init_from_rc (style, rc_style);
 
 	/* Shades/Colors/Ratio */
+	murrine_style->glow_ratio         = MURRINE_RC_STYLE (rc_style)->glow_ratio;
 	murrine_style->highlight_ratio    = MURRINE_RC_STYLE (rc_style)->highlight_ratio;
 	murrine_style->gradient_shades[0] = MURRINE_RC_STYLE (rc_style)->gradient_shades[0];
 	murrine_style->gradient_shades[1] = MURRINE_RC_STYLE (rc_style)->gradient_shades[1];
@@ -1957,6 +1959,7 @@
 	mrn_style->colorize_scrollbar  = mrn_src->colorize_scrollbar;
 	mrn_style->colors              = mrn_src->colors;
 	mrn_style->glazestyle          = mrn_src->glazestyle;
+	mrn_style->glow_ratio          = mrn_src->glow_ratio;
 	mrn_style->gradient_shades[0]  = mrn_src->gradient_shades[0];
 	mrn_style->gradient_shades[1]  = mrn_src->gradient_shades[1];
 	mrn_style->gradient_shades[2]  = mrn_src->gradient_shades[2];

Modified: trunk/src/murrine_style.h
==============================================================================
--- trunk/src/murrine_style.h	(original)
+++ trunk/src/murrine_style.h	Sun Dec 28 15:37:15 2008
@@ -45,6 +45,7 @@
 	MurrineProfiles profile;
 
 	double   contrast;
+	double   glow_ratio;
 	double   gradient_shades[4];
 	double   highlight_ratio;
 	double   lightborder_ratio;

Modified: trunk/src/murrine_types.h
==============================================================================
--- trunk/src/murrine_types.h	(original)
+++ trunk/src/murrine_types.h	Sun Dec 28 15:37:15 2008
@@ -200,6 +200,7 @@
 	int lightborderstyle;
 	int reliefstyle;
 	int roundness;
+	double glow_ratio;
 	double highlight_ratio;
 	double lightborder_ratio;
 	MurrineGradients mrn_gradient;



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