murrine r108 - in trunk: . src



Author: acimitan
Date: Fri Jan  2 04:45:47 2009
New Revision: 108
URL: http://svn.gnome.org/viewvc/murrine?rev=108&view=rev

Log:
2009-01-02  Andrea Cimitan  <andrea cimitan gmail com>

	* src/murrine_draw.c (murrine_draw_progressbar_trough),
	(murrine_draw_progressbar_fill):
	* src/murrine_draw_rgba.c (murrine_rgba_draw_progressbar_trough),
	(murrine_rgba_draw_progressbar_fill):
	* src/murrine_rc_style.c (murrine_rc_style_parse):
	* src/murrine_style.c (murrine_style_draw_box):
	* src/murrine_types.h:
	First approach with rounded scrollbars.
	Print more info when using an old option.


Modified:
   trunk/ChangeLog
   trunk/src/murrine_draw.c
   trunk/src/murrine_draw_rgba.c
   trunk/src/murrine_rc_style.c
   trunk/src/murrine_style.c
   trunk/src/murrine_types.h

Modified: trunk/src/murrine_draw.c
==============================================================================
--- trunk/src/murrine_draw.c	(original)
+++ trunk/src/murrine_draw.c	Fri Jan  2 04:45:47 2009
@@ -438,12 +438,12 @@
 	murrine_shade (&widget->parentbg, 0.95, &fill);
 
 	/* Create trough box */
-	cairo_rectangle (cr, x+1, y+1, width-2, height-2);
+	murrine_rounded_rectangle_closed (cr, x+1, y+1, width-2, height-2, widget->roundness, widget->corners);
 	murrine_set_color_rgba (cr, &fill, 0.44);
 	cairo_fill (cr);
 
 	/* Draw border */
-	cairo_rectangle (cr, x+0.5, y+0.5, width-1, height-1);
+	murrine_rounded_rectangle (cr, x+0.5, y+0.5, width-1, height-1, widget->roundness, widget->corners);
 	murrine_set_color_rgba (cr, border, 0.74);
 	cairo_stroke (cr);
 
@@ -454,6 +454,10 @@
 
 		murrine_shade (border, 0.94, &shadow);
 
+		/* clip the corners of the shadows */
+		murrine_rounded_rectangle_closed (cr, x+1, y+1, width-2, height-2, widget->roundness, widget->corners);
+		cairo_clip (cr);
+
 		/* Top shadow */
 		cairo_rectangle (cr, x+1, y+1, width-2, 4);
 		pat = cairo_pattern_create_linear (x, y, x, y+4);
@@ -480,18 +484,16 @@
                                const WidgetParameters      *widget,
                                const ProgressBarParameters *progressbar,
                                int x, int y, int width, int height,
-                               gint offset, int progressbarstyle)
+                               gint offset)
 {
-	boolean    is_horizontal = progressbar->orientation < 2;
 	double     tile_pos = 0;
 	double     stroke_width;
 	int        x_step;
 	const      MurrineRGB *fill = &colors->spot[1];
 	MurrineRGB border = colors->spot[2];
 
-	cairo_rectangle (cr, x, y, width, height);
-
-	if (is_horizontal)
+	/* progressbar->orientation < 2 == boolean is_horizontal */
+	if (progressbar->orientation < 2)
 	{
 		if (progressbar->orientation == MRN_ORIENTATION_LEFT_TO_RIGHT)
 			rotate_mirror_translate (cr, 0, x, y, FALSE, FALSE);
@@ -514,9 +516,14 @@
 	x_step = (((float)stroke_width/10)*offset);
 
 	cairo_save (cr);
+
+	murrine_rounded_rectangle_closed (cr, 2, 1, width-4+widget->roundness, height-2,
+	                                  widget->roundness, MRN_CORNER_TOPLEFT | MRN_CORNER_BOTTOMLEFT);
+	cairo_clip (cr);
+	murrine_rounded_rectangle_closed (cr, 2-widget->roundness, 1, width-4+widget->roundness, height-2,
+	                                  widget->roundness, MRN_CORNER_TOPRIGHT | MRN_CORNER_BOTTOMRIGHT);
 	cairo_clip (cr);
 
-	cairo_save (cr);
 	cairo_rectangle (cr, 2, 1, width-4, height-2);
 
 	murrine_draw_glaze (cr, fill,
@@ -524,7 +531,7 @@
 	                    widget->mrn_gradient, widget, 2, 1, width-4, height-2,
 	                    widget->roundness, widget->corners, TRUE);
 
-	switch (progressbarstyle)
+	switch (progressbar->style)
 	{
 		case 0:
 			break;
@@ -554,7 +561,7 @@
 	/* Draw the border */
 	murrine_mix_color (&border, fill, 0.28, &border);
 	murrine_set_color_rgb (cr, &border);
-	cairo_rectangle (cr, 1.5, 0.5, width-3, height-1);
+	murrine_rounded_rectangle (cr, 1.5, 0.5, width-3, height-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	Fri Jan  2 04:45:47 2009
@@ -392,13 +392,13 @@
 	murrine_shade (&widget->parentbg, 0.95, &fill);
 
 	/* Create trough box */
+	murrine_rounded_rectangle_closed (cr, x+1, y+1, width-2, height-2, widget->roundness, widget->corners);
 	murrine_set_color_rgba (cr, &fill, 0.8);
-	cairo_rectangle (cr, x+1, y+1, width-2, height-2);
 	cairo_fill (cr);
 
 	/* Draw border */
+	murrine_rounded_rectangle (cr, x+0.5, y+0.5, width-1, height-1, widget->roundness, widget->corners);
 	murrine_set_color_rgba (cr, border, 0.8);
-	cairo_rectangle (cr, x+0.5, y+0.5, width-1, height-1);
 	cairo_stroke (cr);
 
 	if (widget->mrn_gradient.gradients)
@@ -408,6 +408,10 @@
 
 		murrine_shade (border, 0.94, &shadow);
 
+		/* clip the corners of the shadows */
+		murrine_rounded_rectangle_closed (cr, x+1, y+1, width-2, height-2, widget->roundness, widget->corners);
+		cairo_clip (cr);
+
 		/* Top shadow */
 		cairo_rectangle (cr, x+1, y+1, width-2, 4);
 		pat = cairo_pattern_create_linear (x, y, x, y+4);
@@ -434,18 +438,16 @@
                                     const WidgetParameters      *widget,
                                     const ProgressBarParameters *progressbar,
                                     int x, int y, int width, int height,
-                                    gint offset, int progressbarstyle)
+                                    gint offset)
 {
-	boolean    is_horizontal = progressbar->orientation < 2;
 	double     tile_pos = 0;
 	double     stroke_width;
 	int        x_step;
 	const      MurrineRGB *fill = &colors->spot[1];
 	MurrineRGB border = colors->spot[2];
 
-	cairo_rectangle (cr, x, y, width, height);
-
-	if (is_horizontal)
+	/* progressbar->orientation < 2 == boolean is_horizontal */
+	if (progressbar->orientation < 2)
 	{
 		if (progressbar->orientation == MRN_ORIENTATION_LEFT_TO_RIGHT)
 			rotate_mirror_translate (cr, 0, x, y, FALSE, FALSE);
@@ -464,15 +466,19 @@
 			rotate_mirror_translate (cr, M_PI/2, x, y+width, TRUE, FALSE);
 	}
 
-	cairo_save (cr);
-	cairo_clip (cr);
-
 	stroke_width = height*2;
 	x_step = (((float)stroke_width/10)*offset);
 
 	cairo_save (cr);
 	cairo_set_operator (cr, CAIRO_OPERATOR_SOURCE);
 
+	murrine_rounded_rectangle_closed (cr, 2, 1, width-4+widget->roundness, height-2,
+	                                  widget->roundness, MRN_CORNER_TOPLEFT | MRN_CORNER_BOTTOMLEFT);
+	cairo_clip (cr);
+	murrine_rounded_rectangle_closed (cr, 2-widget->roundness, 1, width-4+widget->roundness, height-2,
+	                                  widget->roundness, MRN_CORNER_TOPRIGHT | MRN_CORNER_BOTTOMRIGHT);
+	cairo_clip (cr);
+
 	cairo_rectangle (cr, 2, 1, width-4, height-2);
 
 	murrine_draw_glaze (cr, fill,
@@ -480,13 +486,15 @@
 	                    widget->mrn_gradient, widget, 2, 1, width-4, height-2,
 	                    widget->roundness, widget->corners, TRUE);
 
-	switch (progressbarstyle)
+	switch (progressbar->style)
 	{
 		case 0:
 			break;
 		default:
 		case 1:
 		{
+			cairo_set_operator (cr, CAIRO_OPERATOR_OVER);
+
 			/* Draw strokes */
 			while (tile_pos <= width+x_step-2)
 			{
@@ -510,7 +518,7 @@
 	/* Draw the border */
 	murrine_mix_color (&border, fill, 0.28, &border);
 	murrine_set_color_rgb (cr, &border);
-	cairo_rectangle (cr, 1.5, 0.5, width-3, height-1);
+	murrine_rounded_rectangle (cr, 1.5, 0.5, width-3, height-1, widget->roundness, widget->corners);
 	cairo_stroke (cr);
 }
 

Modified: trunk/src/murrine_rc_style.c
==============================================================================
--- trunk/src/murrine_rc_style.c	(original)
+++ trunk/src/murrine_rc_style.c	Fri Jan  2 04:45:47 2009
@@ -314,29 +314,29 @@
 
 	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);
 
 	switch (token)
 	{
 		case TOKEN_MURRINE:
-		   *profile = MRN_PROFILE_MURRINE;
-		   break;
+			*profile = MRN_PROFILE_MURRINE;
+			break;
 		case TOKEN_NODOKA:
-		   *profile = MRN_PROFILE_NODOKA;
-		   break;
+			*profile = MRN_PROFILE_NODOKA;
+			break;
 		case TOKEN_MIST:
-		   *profile = MRN_PROFILE_MIST;
-		   break;
+			*profile = MRN_PROFILE_MIST;
+			break;
 		case TOKEN_CANDIDO:
-		   *profile = MRN_PROFILE_CANDIDO;
-		   break;
+			*profile = MRN_PROFILE_CANDIDO;
+			break;
 		case TOKEN_CLEARLOOKS:
-		   *profile = MRN_PROFILE_CLEARLOOKS;
-		   break;
+			*profile = MRN_PROFILE_CLEARLOOKS;
+			break;
 		default:
-		   return TOKEN_MURRINE;
+			return TOKEN_MURRINE;
 	}
 
 	return G_TOKEN_NONE;
@@ -575,19 +575,19 @@
 
 			/* stuff to ignore */
 			case TOKEN_HILIGHT_RATIO:
-				g_scanner_warn (scanner, "Murrine configuration option \"hilight_ratio\" will be deprecated in future releases. Please update this theme to get rid of this warning.", "hilight_ratio");
+				g_scanner_warn (scanner, "Murrine configuration option \"hilight_ratio\" will be deprecated in future releases. Please use \"highlight_shade\" instead.", "hilight_ratio");
 				double hilight_ratio;
 				token = theme_parse_shade (settings, scanner, &hilight_ratio);
 				murrine_style->highlight_shade = hilight_ratio/0.909090;
 				murrine_style->flags |= MRN_FLAG_HIGHLIGHT_SHADE;
 				break;
 			case TOKEN_HIGHLIGHT_RATIO:
-				g_scanner_warn (scanner, "Murrine configuration option \"highlight_ratio\" will be deprecated in future releases. Please update this theme to get rid of this warning.", "highlight_ratio");
+				g_scanner_warn (scanner, "Murrine configuration option \"highlight_ratio\" will be deprecated in future releases. Please use \"highlight_shade\" instead.", "highlight_ratio");
 				token = theme_parse_shade (settings, scanner, &murrine_style->highlight_shade);
 				murrine_style->flags |= MRN_FLAG_HIGHLIGHT_SHADE;
 				break;
 			case TOKEN_LIGHTBORDER_RATIO:
-				g_scanner_warn (scanner, "Murrine configuration option \"lightborder_ratio\" will be deprecated in future releases. Please update this theme to get rid of this warning.", "lightborder_ratio");
+				g_scanner_warn (scanner, "Murrine configuration option \"lightborder_ratio\" will be deprecated in future releases. Please use \"lightborder_shade\" instead.", "lightborder_ratio");
 				token = theme_parse_shade (settings, scanner, &murrine_style->lightborder_shade);
 				murrine_style->flags |= MRN_FLAG_LIGHTBORDER_SHADE;
 				break;

Modified: trunk/src/murrine_style.c
==============================================================================
--- trunk/src/murrine_style.c	(original)
+++ trunk/src/murrine_style.c	Fri Jan  2 04:45:47 2009
@@ -987,10 +987,9 @@
 		WidgetParameters      params;
 		ProgressBarParameters progressbar;
 		gdouble               elapsed = 0.0;
-		int progressbarstyle = murrine_style->progressbarstyle;
 
 		murrine_set_widget_parameters (widget, style, state_type, &params);
-		params.corners = MRN_CORNER_NONE;
+		progressbar.style = murrine_style->progressbarstyle;
 
 		if (widget && MRN_IS_PROGRESS_BAR (widget))
 			progressbar.orientation = gtk_progress_bar_get_orientation (GTK_PROGRESS_BAR (widget));
@@ -1017,19 +1016,17 @@
 		elapsed = murrine_animation_elapsed (widget);
 #endif
 
-		/* cairo_reset_clip (cr); */
-
 		/* The x-1 and width+2 are to make the fill cover the left and
 		 * right-hand sides of the trough box */
 
 #ifndef HAVE_ANIMATIONRTL
 		STYLE_FUNCTION(draw_progressbar_fill) (cr, colors, &params, &progressbar,
 		                                       x-1, y, width+2, height,
-		                                       10-(int)(elapsed*10.0) % 10, progressbarstyle);
+		                                       10-(int)(elapsed*10.0) % 10);
 #else
 		STYLE_FUNCTION(draw_progressbar_fill) (cr, colors, &params, &progressbar,
 		                                       x-1, y, width+2, height,
-		                                       10+(int)(elapsed*10.0) % 10, progressbarstyle);
+		                                       10+(int)(elapsed*10.0) % 10);
 #endif
 	}
 	else if (DETAIL ("hscale") || DETAIL ("vscale"))

Modified: trunk/src/murrine_types.h
==============================================================================
--- trunk/src/murrine_types.h	(original)
+++ trunk/src/murrine_types.h	Fri Jan  2 04:45:47 2009
@@ -130,12 +130,6 @@
 
 typedef enum
 {
-	MRN_PROGRESSBAR_CONTINUOUS,
-	MRN_PROGRESSBAR_DISCRETE
-} MurrineProgressBarStyle;
-
-typedef enum
-{
 	MRN_WINDOW_EDGE_NORTH_WEST,
 	MRN_WINDOW_EDGE_NORTH,
 	MRN_WINDOW_EDGE_NORTH_EAST,
@@ -220,7 +214,7 @@
 typedef struct
 {
 	MurrineOrientation orientation;
-	MurrineProgressBarStyle style;
+	int style;
 } ProgressBarParameters;
 
 typedef struct
@@ -337,7 +331,7 @@
 	                               const WidgetParameters      *widget,
 	                               const ProgressBarParameters *progressbar,
 	                               int x, int y, int width, int height,
-	                               gint offset, int progressbarstyle);
+	                               gint offset);
 
 	void (*draw_entry) (cairo_t *cr,
 	                    const MurrineColors    *colors,



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