murrine r82 - in trunk: . src



Author: acimitan
Date: Mon Sep 29 16:46:52 2008
New Revision: 82
URL: http://svn.gnome.org/viewvc/murrine?rev=82&view=rev

Log:
2008-09-29  Andrea Cimitan  <andrea cimitan gmail com>

	* src/cairo-support.c:
	* src/murrine_draw.c (murrine_draw_button):
	* src/murrine_draw_rgba.c (murrine_rgba_draw_button):
	Button's code simplified


Modified:
   trunk/ChangeLog
   trunk/src/cairo-support.c
   trunk/src/murrine_draw.c
   trunk/src/murrine_draw_rgba.c

Modified: trunk/src/cairo-support.c
==============================================================================
--- trunk/src/cairo-support.c	(original)
+++ trunk/src/cairo-support.c	Mon Sep 29 16:46:52 2008
@@ -541,40 +541,6 @@
 	}
 }
 
-/* Old one */
-/*
-static void
-murrine_draw_glaze (cairo_t *cr,
-                    const WidgetParameters *widget,
-                    int x, int y, int width, int height)
-{
-	switch (widget->glazestyle)
-	{
-		default:
-		case 0:
-			cairo_fill (cr);
-			murrine_draw_flat_highlight (cr, x, y, width, height);
-			break;
-		case 1:
-			cairo_set_fill_rule (cr, CAIRO_FILL_RULE_EVEN_ODD);
-			cairo_fill (cr);
-			murrine_draw_curved_highlight (cr, x, y, width, height);
-			break;
-		case 2:
-			cairo_set_fill_rule (cr, CAIRO_FILL_RULE_EVEN_ODD);
-			cairo_fill_preserve (cr);
-			murrine_draw_curved_highlight (cr, x, y, width, height);
-			break;
-		case 3:
-		case 4:
-			cairo_set_fill_rule (cr, CAIRO_FILL_RULE_EVEN_ODD);
-			cairo_fill (cr);
-			murrine_draw_curved_highlight_top (cr, x, y, width, height);
-			break;
-	}
-}
-*/
-
 void
 murrine_draw_lightborder (cairo_t *cr,
                           const MurrineRGB *highlight_color,

Modified: trunk/src/murrine_draw.c
==============================================================================
--- trunk/src/murrine_draw.c	(original)
+++ trunk/src/murrine_draw.c	Mon Sep 29 16:46:52 2008
@@ -149,11 +149,9 @@
 {
 	double xos = widget->xthickness > 2 ? 1 : 0;
 	double yos = widget->ythickness > 2 ? 1 : 0;
-	MurrineRGB fill = colors->bg[widget->state_type];
-	MurrineRGB border_disabled = colors->shade[5];
-	MurrineRGB border_normal;
-
 	double custom_highlight_ratio = widget->highlight_ratio;
+	MurrineRGB fill = colors->bg[widget->state_type];
+	MurrineRGB border = colors->shade[!widget->disabled ? 6 : 5];
 	MurrineGradients mrn_gradient_custom = widget->mrn_gradient;
 
 	if (widget->disabled)
@@ -165,7 +163,8 @@
 	if (widget->is_default && !widget->disabled)
 		murrine_mix_color (&fill, &colors->spot[1], 0.2, &fill);
 
-	murrine_shade (&colors->shade[6], 0.95, &border_normal);
+	if (!widget->disabled)
+		murrine_shade (&colors->shade[6], 0.95, &border);
 
 	if (!horizontal)
 		murrine_exchange_axis (cr, &x, &y, &width, &height);
@@ -177,7 +176,7 @@
 	if (!widget->active && !widget->disabled && widget->reliefstyle > 1)
 	{
 		murrine_rounded_rectangle (cr, xos, yos, width-(xos*2), height-(yos*2), widget->roundness, widget->corners);
-		murrine_set_color_rgba (cr, widget->disabled ? &border_disabled : &border_normal, 0.18);
+		murrine_set_color_rgba (cr, &border, 0.18);
 		cairo_stroke (cr);
 	}
 	else if (widget->reliefstyle != 0)
@@ -185,12 +184,11 @@
 		                    width-(xos*2)+1, height-(yos*2)+1,
 		                    widget->roundness+1, widget->corners);
 
-	murrine_mix_color (widget->disabled ? &border_disabled : &border_normal , &fill, 0.4,
-	                   widget->disabled ? &border_disabled : &border_normal);
+	murrine_mix_color (&border, &fill, 0.4, &border);
 
 	/* Default button */
-	if (widget->is_default)
-		murrine_shade (&border_normal, 0.8, &border_normal);
+	if (widget->is_default && !widget->disabled)
+		murrine_shade (&border, 0.8, &border);
 
 	/* Draw the bg */
 	murrine_rounded_rectangle_closed (cr, xos+1, yos+1, width-(xos*2)-2, height-(yos*2)-2, widget->roundness, widget->corners);
@@ -265,7 +263,7 @@
 	}
 
 	/* Draw the border */
-	murrine_set_color_rgb (cr, widget->disabled ? &border_disabled : &border_normal);
+	murrine_set_color_rgb (cr, &border);
 	murrine_rounded_rectangle (cr, xos+0.5, yos+0.5, width-(xos*2)-1, height-(yos*2)-1, widget->roundness, widget->corners);
 	cairo_stroke (cr);
 }

Modified: trunk/src/murrine_draw_rgba.c
==============================================================================
--- trunk/src/murrine_draw_rgba.c	(original)
+++ trunk/src/murrine_draw_rgba.c	Mon Sep 29 16:46:52 2008
@@ -147,11 +147,9 @@
 {
 	double xos = widget->xthickness > 2 ? 1 : 0;
 	double yos = widget->ythickness > 2 ? 1 : 0;
-	MurrineRGB fill = colors->bg[widget->state_type];
-	MurrineRGB border_disabled = colors->shade[6];
-	MurrineRGB border_normal;
-	MurrineRGB highlight;
 	double custom_highlight_ratio = widget->highlight_ratio;
+	MurrineRGB fill = colors->bg[widget->state_type];
+	MurrineRGB border = colors->shade[!widget->disabled ? 8 : 6];
 	MurrineGradients mrn_gradient_custom = widget->mrn_gradient;
 
 	if (widget->disabled)
@@ -163,8 +161,8 @@
 	if (widget->is_default && !widget->disabled)
 		murrine_mix_color (&fill, &colors->spot[1], 0.2, &fill);
 
-	murrine_shade (&colors->shade[8], 0.95, &border_normal);
-	murrine_shade (&fill, custom_highlight_ratio, &highlight);
+	if (!widget->disabled)
+		murrine_shade (&colors->shade[8], 0.95, &border);
 
 	if (!horizontal)
 		murrine_exchange_axis (cr, &x, &y, &width, &height);
@@ -175,7 +173,7 @@
 	if (!widget->active && !widget->disabled && widget->reliefstyle > 1)
 	{
 		murrine_rounded_rectangle (cr, xos, yos, width-(xos*2), height-(yos*2), widget->roundness, widget->corners);
-		murrine_set_color_rgba (cr, widget->disabled ? &border_disabled : &border_normal, 0.16);
+		murrine_set_color_rgba (cr, &border, 0.16);
 		cairo_stroke (cr);
 	}
 	else if (widget->reliefstyle != 0)
@@ -183,15 +181,12 @@
 		                    width-(xos*2)+1, height-(yos*2)+1,
 		                    widget->roundness+1, widget->corners);
 
-	murrine_mix_color (widget->disabled ? &border_disabled : &border_normal , &widget->parentbg, 0.2,
-	                   widget->disabled ? &border_disabled : &border_normal);
-
-	murrine_mix_color (widget->disabled ? &border_disabled : &border_normal , &fill, 0.25,
-	                   widget->disabled ? &border_disabled : &border_normal);
+	murrine_mix_color (&border, &widget->parentbg, 0.2, &border);
+	murrine_mix_color (&border, &fill, 0.25, &border);
 
 	/* Default button */
 	if (widget->is_default)
-		murrine_shade (&border_normal, 0.8, &border_normal);
+		murrine_shade (&border, 0.8, &border);
 
 	/* Draw the bg */
 	murrine_rounded_rectangle_closed (cr, xos+1, yos+1, width-(xos*2)-2, height-(yos*2)-2, widget->roundness, widget->corners);
@@ -209,7 +204,11 @@
 	/* Draw the white inner border */
 	if (widget->glazestyle != 4 && !widget->active)
 	{
+		MurrineRGB highlight;
+
+		murrine_shade (&fill, custom_highlight_ratio, &highlight);
 		murrine_shade (&fill, widget->lightborder_ratio*custom_highlight_ratio, &highlight);
+
 		if (horizontal)
 		{
 			murrine_draw_lightborder (cr, &highlight, &fill, mrn_gradient_custom,
@@ -267,7 +266,7 @@
 	}
 
 	/* Draw the border */
-	murrine_set_color_rgb (cr, widget->disabled ? &border_disabled : &border_normal);
+	murrine_set_color_rgb (cr, &border);
 	murrine_rounded_rectangle (cr, xos+0.5, yos+0.5, width-(xos*2)-1, height-(yos*2)-1, widget->roundness, widget->corners);
 	cairo_stroke (cr);
 }



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