murrine r87 - in trunk: . src



Author: acimitan
Date: Tue Sep 30 00:03:52 2008
New Revision: 87
URL: http://svn.gnome.org/viewvc/murrine?rev=87&view=rev

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

	* TODO:
	* src/cairo-support.c (murrine_draw_glaze),
	(murrine_draw_lightborder):
	* src/murrine_draw.c (murrine_draw_button),
	(murrine_draw_scale_trough), (murrine_draw_slider_handle),
	(murrine_draw_progressbar_fill), (murrine_draw_tab),
	(murrine_draw_handle):
	* src/murrine_draw_rgba.c (murrine_rgba_draw_button),
	(murrine_rgba_draw_scale_trough),
	(murrine_rgba_draw_progressbar_fill), (murrine_rgba_draw_tab):
	Updated TODO, trying to use a new algorithm for vertical lightborder



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

Modified: trunk/TODO
==============================================================================
--- trunk/TODO	(original)
+++ trunk/TODO	Tue Sep 30 00:03:52 2008
@@ -6,3 +6,9 @@
 
 Focus:
 - draw focus
+
+Menu:
+- fix menustyle = 1 with rtl
+
+Scrollbars:
+- try to use spot[2] for handles and border when colorize_scrollbar is enabled

Modified: trunk/src/cairo-support.c
==============================================================================
--- trunk/src/cairo-support.c	(original)
+++ trunk/src/cairo-support.c	Tue Sep 30 00:03:52 2008
@@ -526,7 +526,6 @@
 			murrine_draw_curved_highlight_top (cr, x, y, width, height);
 			break;
 	}
-
 	murrine_set_gradient (cr, &highlight, mrn_gradient, x, y, 0, height, mrn_gradient.gradients, TRUE);
 	cairo_fill (cr);
 
@@ -546,24 +545,11 @@
 		if (mrn_gradient.use_rgba)
 			cairo_set_operator (cr, CAIRO_OPERATOR_OVER);
 
-		if (horizontal)
-		{
-			murrine_draw_lightborder (cr, &highlight, fill, mrn_gradient,
-			                          x+0.5, y+0.5, width-1, height-1,
-			                          mrn_gradient.gradients, horizontal,
-			                          widget->glazestyle, widget->lightborderstyle,
-			                          radius, corners);
-		}
-		else
-		{
-			murrine_exchange_axis (cr, &x, &y, &width, &height);
-			murrine_draw_lightborder (cr, &highlight, fill, mrn_gradient,
-			                          x+0.5, y+0.5, width-1, height-1,
-			                          mrn_gradient.gradients, horizontal,
-			                          widget->glazestyle, widget->lightborderstyle,
-			                          radius, corners);
-			murrine_exchange_axis (cr, &x, &y, &width, &height);
-		}
+		murrine_draw_lightborder (cr, &highlight, fill, mrn_gradient,
+		                          x+0.5, y+0.5, width-1, height-1,
+		                          mrn_gradient.gradients, horizontal,
+		                          widget->glazestyle, widget->lightborderstyle,
+		                          radius, corners);
 	}
 }
 
@@ -579,21 +565,22 @@
 {
 	cairo_pattern_t *pattern;
 	MurrineRGB shade1, shade2, shade3, shade4;
-	double alpha_value = 1.0;
-	if (mrn_gradient.use_rgba)
-	{
-		alpha_value = mrn_gradient.rgba_opacity;
-	}
+	double alpha_value = mrn_gradient.use_rgba ? mrn_gradient.rgba_opacity : 1.0;
 
 	murrine_shade (highlight_color, mrn_gradient.gradient_shades[0], &shade1);
 	murrine_shade (highlight_color, mrn_gradient.gradient_shades[1], &shade2);
 	murrine_shade (highlight_color, mrn_gradient.gradient_shades[2], &shade3);
 	murrine_shade (highlight_color, mrn_gradient.gradient_shades[3], &shade4);
 
-	double fill_pos = 1.0-(1.0/(!horizontal ? (double)(width) : (double)(height)));
+	cairo_save (cr);
+
+	if (!horizontal)
+		murrine_exchange_axis (cr, (int*)&x, (int*)&y, &width, &height);
+
+	double fill_pos = 1.0-1.0/(!horizontal ? (double)width : (double)height);
 	if (corners == MRN_CORNER_ALL && radius > 2)
-		fill_pos = 1.0-((((double)radius-1.0)/2.0)/
-		                 (!horizontal ? (double)(width) : (double)(height)));
+		fill_pos = 1.0-(((double)radius-1.0)/2.0)/
+		                 (!horizontal ? (double)width : (double)height);
 
 	radius < 2 ? cairo_rectangle (cr, x, y, width, height) :
 	             clearlooks_rounded_rectangle (cr, x, y, width, height, radius-1, corners);
@@ -620,6 +607,8 @@
 		cairo_line_to (cr, x-0.5, height+y);
 		cairo_stroke (cr);
 	}
+
+	cairo_restore (cr);
 }
 
 void

Modified: trunk/src/murrine_draw.c
==============================================================================
--- trunk/src/murrine_draw.c	(original)
+++ trunk/src/murrine_draw.c	Tue Sep 30 00:03:52 2008
@@ -74,7 +74,7 @@
 		cairo_line_to (cr, x, y);
 
 	if (corners & MRN_CORNER_TOPRIGHT)
-	    cairo_arc (cr, x + w - radius, y + radius, radius, M_PI * 1.5, M_PI * 1.75);
+		cairo_arc (cr, x + w - radius, y + radius, radius, M_PI * 1.5, M_PI * 1.75);
 	else
 		cairo_line_to (cr, x + w, y);
 
@@ -149,7 +149,7 @@
 {
 	double xos = widget->xthickness > 2 ? 1 : 0;
 	double yos = widget->ythickness > 2 ? 1 : 0;
-	double custom_highlight_ratio = widget->highlight_ratio;
+	double highlight_ratio_custom = 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;
@@ -157,7 +157,7 @@
 	if (widget->disabled)
 	{
 		mrn_gradient_custom = get_decreased_gradient_shades (widget->mrn_gradient, 3.0);
-		custom_highlight_ratio = get_decreased_ratio (widget->highlight_ratio, 2.0);
+		highlight_ratio_custom = get_decreased_ratio (widget->highlight_ratio, 2.0);
 	}
 	else
 		murrine_shade (&colors->shade[6], 0.95, &border);
@@ -196,8 +196,7 @@
 	if (widget->roundness > 1)
 		cairo_clip_preserve (cr);
 
-	murrine_draw_glaze (cr, &fill, custom_highlight_ratio,
-	                    !widget->active ? widget->lightborder_ratio : 1.0,
+	murrine_draw_glaze (cr, &fill, highlight_ratio_custom, !widget->active ? widget->lightborder_ratio : 1.0,
 	                    mrn_gradient_custom, widget,
 	                    xos+1, yos+1, width-(xos*2)-2, height-(yos*2)-2,
 	                    widget->roundness, widget->corners, horizontal);
@@ -340,9 +339,9 @@
 {
 	int     fill_x, fill_y, fill_width, fill_height; /* Fill x,y,w,h */
 	int     trough_width, trough_height;
-	double  translate_x, translate_y;
 	int     fill_size = slider->fill_size;
 	int     TROUGH_SIZE = 6;
+	double  translate_x, translate_y;
 	MurrineRGB fill;
 
 	murrine_shade (&widget->parentbg, 0.95, &fill);
@@ -406,6 +405,7 @@
                             int x, int y, int width, int height,
                             boolean horizontal)
 {
+	int num_handles = 2, bar_x, i;
 	MurrineRGB handle;
 	murrine_shade (&colors->shade[6], 0.95, &handle);
 
@@ -417,13 +417,11 @@
 		int tmp = height; height = width; width = tmp;
 	}
 
-	int num_handles = 2;
 	if (width&1)
 		num_handles = 3;
+	bar_x = width/2 - num_handles;
 
-	int bar_x = width/2 - num_handles;
 	cairo_translate (cr, 0.5, 0.5);
-	int i;
 	for (i=0; i<num_handles; i++)
 	{
 		cairo_move_to (cr, bar_x, 3.5);
@@ -512,7 +510,7 @@
 	{
 		int tmp = height; height = width; width = tmp;
 
-		x = x + 1; y = y - 1; width = width + 2; height = height - 2;
+		x = x+1; y = y-1; width = width+2; height = height-2;
 
 		if (progressbar->orientation == MRN_ORIENTATION_TOP_TO_BOTTOM)
 			rotate_mirror_translate (cr, M_PI/2, x, y, FALSE, FALSE);
@@ -909,10 +907,10 @@
 	{
 		MurrineRGB shade1, shade2, shade3, shade4, highlight;
 		MurrineGradients mrn_gradient_custom = get_decreased_gradient_shades (widget->mrn_gradient, 3.0);
-		double custom_highlight_ratio = get_decreased_ratio (widget->highlight_ratio, 2.0);
+		double highlight_ratio_custom = get_decreased_ratio (widget->highlight_ratio, 2.0);
 
-		murrine_shade (fill, mrn_gradient_custom.gradient_shades[0]*custom_highlight_ratio, &shade1);
-		murrine_shade (fill, mrn_gradient_custom.gradient_shades[1]*custom_highlight_ratio, &shade2);
+		murrine_shade (fill, mrn_gradient_custom.gradient_shades[0]*highlight_ratio_custom, &shade1);
+		murrine_shade (fill, mrn_gradient_custom.gradient_shades[1]*highlight_ratio_custom, &shade2);
 		murrine_shade (fill, mrn_gradient_custom.gradient_shades[2], &shade3);
 		murrine_shade (fill, mrn_gradient_custom.gradient_shades[3], &shade4);
 
@@ -943,9 +941,9 @@
 		cairo_pattern_destroy (pattern);
 
 		/* Draw lightborder */
-		murrine_shade (fill, widget->lightborder_ratio*custom_highlight_ratio, &highlight);
-		murrine_shade (&highlight, mrn_gradient_custom.gradient_shades[0]*custom_highlight_ratio, &shade1);
-		murrine_shade (&highlight, mrn_gradient_custom.gradient_shades[1]*custom_highlight_ratio, &shade2);
+		murrine_shade (fill, widget->lightborder_ratio*highlight_ratio_custom, &highlight);
+		murrine_shade (&highlight, mrn_gradient_custom.gradient_shades[0]*highlight_ratio_custom, &shade1);
+		murrine_shade (&highlight, mrn_gradient_custom.gradient_shades[1]*highlight_ratio_custom, &shade2);
 		murrine_shade (&highlight, mrn_gradient_custom.gradient_shades[2], &shade3);
 		murrine_shade (&highlight, mrn_gradient_custom.gradient_shades[3], &shade4);
 
@@ -979,10 +977,10 @@
 	{
 		MurrineRGB shade1, shade2, shade3, shade4, highlight;
 		MurrineGradients mrn_gradient_custom = get_decreased_gradient_shades (widget->mrn_gradient, 3.0);
-		double custom_highlight_ratio = get_decreased_ratio (widget->highlight_ratio, 2.0);
+		double highlight_ratio_custom = get_decreased_ratio (widget->highlight_ratio, 2.0);
 
-		murrine_shade (fill, mrn_gradient_custom.gradient_shades[0]*custom_highlight_ratio, &shade1);
-		murrine_shade (fill, mrn_gradient_custom.gradient_shades[1]*custom_highlight_ratio, &shade2);
+		murrine_shade (fill, mrn_gradient_custom.gradient_shades[0]*highlight_ratio_custom, &shade1);
+		murrine_shade (fill, mrn_gradient_custom.gradient_shades[1]*highlight_ratio_custom, &shade2);
 		murrine_shade (fill, mrn_gradient_custom.gradient_shades[2], &shade3);
 		murrine_shade (fill, 1.0, &shade4);
 
@@ -1014,9 +1012,9 @@
 		cairo_pattern_destroy (pattern);
 
 		/* Draw lightborder */
-		murrine_shade (fill, widget->lightborder_ratio*custom_highlight_ratio, &highlight);
-		murrine_shade (&highlight, mrn_gradient_custom.gradient_shades[0]*custom_highlight_ratio, &shade1);
-		murrine_shade (&highlight, mrn_gradient_custom.gradient_shades[1]*custom_highlight_ratio, &shade2);
+		murrine_shade (fill, widget->lightborder_ratio*highlight_ratio_custom, &highlight);
+		murrine_shade (&highlight, mrn_gradient_custom.gradient_shades[0]*highlight_ratio_custom, &shade1);
+		murrine_shade (&highlight, mrn_gradient_custom.gradient_shades[1]*highlight_ratio_custom, &shade2);
 		murrine_shade (&highlight, mrn_gradient_custom.gradient_shades[2], &shade3);
 		murrine_shade (fill, 1.04, &shade4); /* this value should change as draw_frame */
 
@@ -1618,7 +1616,6 @@
                      int x, int y, int width, int height)
 {
 	const MurrineRGB *dark  = &colors->shade[4];
-
 	int bar_height;
 	int bar_width  = 4;
 	int i, bar_y = 1;

Modified: trunk/src/murrine_draw_rgba.c
==============================================================================
--- trunk/src/murrine_draw_rgba.c	(original)
+++ trunk/src/murrine_draw_rgba.c	Tue Sep 30 00:03:52 2008
@@ -147,7 +147,7 @@
 {
 	double xos = widget->xthickness > 2 ? 1 : 0;
 	double yos = widget->ythickness > 2 ? 1 : 0;
-	double custom_highlight_ratio = widget->highlight_ratio;
+	double highlight_ratio_custom = 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;
@@ -155,7 +155,7 @@
 	if (widget->disabled)
 	{
 		mrn_gradient_custom = get_decreased_gradient_shades (widget->mrn_gradient, 3.0);
-		custom_highlight_ratio = get_decreased_ratio (widget->highlight_ratio, 2.0);
+		highlight_ratio_custom = get_decreased_ratio (widget->highlight_ratio, 2.0);
 	}
 	else
 		murrine_shade (&colors->shade[8], 0.95, &border);
@@ -196,7 +196,7 @@
 	if (widget->roundness > 1)
 		cairo_clip_preserve (cr);
 
-	murrine_draw_glaze (cr, &fill, custom_highlight_ratio, !widget->active ? widget->lightborder_ratio : 1.0,
+	murrine_draw_glaze (cr, &fill, highlight_ratio_custom, !widget->active ? widget->lightborder_ratio : 1.0,
 	                    mrn_gradient_custom, widget, xos+1, yos+1, width-(xos*2)-2, height-(yos*2)-2,
 	                    widget->roundness, widget->corners, horizontal);
 
@@ -323,9 +323,9 @@
 {
 	int     fill_x, fill_y, fill_width, fill_height; /* Fill x,y,w,h */
 	int     trough_width, trough_height;
-	double  translate_x, translate_y;
 	int     fill_size = slider->fill_size;
 	int     TROUGH_SIZE = 6;
+	double  translate_x, translate_y;
 	MurrineRGB fill;
 
 	murrine_shade (&widget->parentbg, 0.95, &fill);
@@ -460,7 +460,7 @@
 	{
 		int tmp = height; height = width; width = tmp;
 
-		x = x + 1; y = y - 1; width = width + 2; height = height - 2;
+		x = x+1; y = y-1; width = width+2; height = height-2;
 
 		if (progressbar->orientation == MRN_ORIENTATION_TOP_TO_BOTTOM)
 			rotate_mirror_translate (cr, M_PI/2, x, y, FALSE, FALSE);
@@ -913,10 +913,10 @@
 	{
 		MurrineRGB shade1, shade2, shade3, shade4, highlight;
 		MurrineGradients mrn_gradient_custom = mrn_gradient_custom = get_decreased_gradient_shades (widget->mrn_gradient, 3.0);
-		double custom_highlight_ratio = get_decreased_ratio (widget->highlight_ratio, 2.0);
+		double highlight_ratio_custom = get_decreased_ratio (widget->highlight_ratio, 2.0);
 
-		murrine_shade (fill, mrn_gradient_custom.gradient_shades[0]*custom_highlight_ratio, &shade1);
-		murrine_shade (fill, mrn_gradient_custom.gradient_shades[1]*custom_highlight_ratio, &shade2);
+		murrine_shade (fill, mrn_gradient_custom.gradient_shades[0]*highlight_ratio_custom, &shade1);
+		murrine_shade (fill, mrn_gradient_custom.gradient_shades[1]*highlight_ratio_custom, &shade2);
 		murrine_shade (fill, mrn_gradient_custom.gradient_shades[2], &shade3);
 		murrine_shade (fill, mrn_gradient_custom.gradient_shades[3], &shade4);
 
@@ -949,9 +949,9 @@
 		/* Draw lightborder */
 		cairo_set_operator (cr, CAIRO_OPERATOR_OVER);
 
-		murrine_shade (fill, widget->lightborder_ratio*custom_highlight_ratio, &highlight);
-		murrine_shade (&highlight, mrn_gradient_custom.gradient_shades[0]*custom_highlight_ratio, &shade1);
-		murrine_shade (&highlight, mrn_gradient_custom.gradient_shades[1]*custom_highlight_ratio, &shade2);
+		murrine_shade (fill, widget->lightborder_ratio*highlight_ratio_custom, &highlight);
+		murrine_shade (&highlight, mrn_gradient_custom.gradient_shades[0]*highlight_ratio_custom, &shade1);
+		murrine_shade (&highlight, mrn_gradient_custom.gradient_shades[1]*highlight_ratio_custom, &shade2);
 		murrine_shade (&highlight, mrn_gradient_custom.gradient_shades[2], &shade3);
 		murrine_shade (&highlight, mrn_gradient_custom.gradient_shades[3], &shade4);
 
@@ -985,10 +985,10 @@
 	{
 		MurrineRGB shade1, shade2, shade3, shade4, highlight;
 		MurrineGradients mrn_gradient_custom = mrn_gradient_custom = get_decreased_gradient_shades (widget->mrn_gradient, 3.0);
-		double custom_highlight_ratio = get_decreased_ratio (widget->highlight_ratio, 2.0);
+		double highlight_ratio_custom = get_decreased_ratio (widget->highlight_ratio, 2.0);
 
-		murrine_shade (fill, mrn_gradient_custom.gradient_shades[0]*custom_highlight_ratio, &shade1);
-		murrine_shade (fill, mrn_gradient_custom.gradient_shades[1]*custom_highlight_ratio, &shade2);
+		murrine_shade (fill, mrn_gradient_custom.gradient_shades[0]*highlight_ratio_custom, &shade1);
+		murrine_shade (fill, mrn_gradient_custom.gradient_shades[1]*highlight_ratio_custom, &shade2);
 		murrine_shade (fill, mrn_gradient_custom.gradient_shades[2], &shade3);
 		murrine_shade (fill, 1.0, &shade4); /* this value should change as draw_frame */
 
@@ -1022,9 +1022,9 @@
 		/* Draw lightborder */
 		cairo_set_operator (cr, CAIRO_OPERATOR_OVER);
 
-		murrine_shade (fill, widget->lightborder_ratio*custom_highlight_ratio, &highlight);
-		murrine_shade (&highlight, mrn_gradient_custom.gradient_shades[0]*custom_highlight_ratio, &shade1);
-		murrine_shade (&highlight, mrn_gradient_custom.gradient_shades[1]*custom_highlight_ratio, &shade2);
+		murrine_shade (fill, widget->lightborder_ratio*highlight_ratio_custom, &highlight);
+		murrine_shade (&highlight, mrn_gradient_custom.gradient_shades[0]*highlight_ratio_custom, &shade1);
+		murrine_shade (&highlight, mrn_gradient_custom.gradient_shades[1]*highlight_ratio_custom, &shade2);
 		murrine_shade (&highlight, mrn_gradient_custom.gradient_shades[2], &shade3);
 		murrine_shade (fill, 1.15, &shade4); /* this value should change as draw_frame */
 



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