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



Author: acimitan
Date: Sat Jan 26 20:52:54 2008
New Revision: 1037
URL: http://svn.gnome.org/viewvc/gtk-engines?rev=1037&view=rev

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

	* engines/clearlooks/src/clearlooks_draw_gummy.c:
	(clearlooks_gummy_draw_tab), (clearlooks_gummy_draw_focus):
	* engines/clearlooks/src/clearlooks_style.c:
	(clearlooks_style_draw_extension):
	* engines/clearlooks/src/clearlooks_types.h:
	Implemented focus drawing inside the draw_tab, so I added
	1px of padding.



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

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	Sat Jan 26 20:52:54 2008
@@ -791,10 +791,8 @@
 		ge_cairo_rounded_rectangle (cr, 0, 0, width-1, height-1, radius, params->corners);
 
 		cairo_pattern_add_color_stop_rgba (pattern, 0.0, stripe_fill->r, stripe_fill->g, stripe_fill->b, 0.6);
-/*
-		cairo_pattern_add_color_stop_rgba (pattern, 1.0/(horizontal ? height : width), stripe_fill->r, stripe_fill->g, stripe_fill->b, 0.34);
-		cairo_pattern_add_color_stop_rgba (pattern, 1.0/(horizontal ? height : width), stripe_fill->r, stripe_fill->g, stripe_fill->b, 0.5);
-*/
+		/* cairo_pattern_add_color_stop_rgba (pattern, 1.0/(horizontal ? height : width), stripe_fill->r, stripe_fill->g, stripe_fill->b, 0.34);
+		   cairo_pattern_add_color_stop_rgba (pattern, 1.0/(horizontal ? height : width), stripe_fill->r, stripe_fill->g, stripe_fill->b, 0.5); */
 		cairo_pattern_add_color_stop_rgb  (pattern, stripe_fill_size, stripe_fill->r, stripe_fill->g, stripe_fill->b);
 		cairo_pattern_add_color_stop_rgba (pattern, stripe_fill_size, stripe_border->r, stripe_border->g, stripe_border->b, 0.72);
 		cairo_pattern_add_color_stop_rgba (pattern, stripe_border_pos, stripe_border->r, stripe_border->g, stripe_border->b, 0.72);
@@ -836,6 +834,38 @@
 		cairo_stroke (cr);
 		cairo_pattern_destroy (pattern);
 	}
+
+	if (params->focus && !params->active)
+	{
+		CairoColor focus_fill = tab->focus.color;
+		CairoColor fill_shade1, fill_shade2, fill_shade3;
+		CairoColor focus_border;
+
+		double focus_inset_x = ((tab->gap_side == CL_GAP_TOP || tab->gap_side == CL_GAP_BOTTOM) ? 4 : stripe_size + 3);
+		double focus_inset_y = ((tab->gap_side == CL_GAP_TOP || tab->gap_side == CL_GAP_BOTTOM) ? stripe_size + 3 : 4);
+		double border_alpha = 0.5;
+		double fill_alpha = 0.17;
+
+		ge_shade_color (&focus_fill, 0.65, &focus_border);
+		ge_shade_color (&focus_fill, 1.18, &fill_shade1);
+		ge_shade_color (&focus_fill, 1.02, &fill_shade2);
+		ge_shade_color (&focus_fill, 0.84, &fill_shade3);
+
+		ge_cairo_rounded_rectangle (cr, focus_inset_x, focus_inset_y, width-focus_inset_x*2-1, height-focus_inset_y*2-1, radius-1, CR_CORNER_ALL);
+		pattern = cairo_pattern_create_linear (0, 0, 0, height);
+
+		cairo_pattern_add_color_stop_rgba (pattern, 0.0, fill_shade1.r, fill_shade1.g, fill_shade1.b, fill_alpha);
+		cairo_pattern_add_color_stop_rgba (pattern, 0.5, fill_shade2.r, fill_shade2.g, fill_shade2.b, fill_alpha);
+		cairo_pattern_add_color_stop_rgba (pattern, 0.5, focus_fill.r,   focus_fill.g, focus_fill.b,  fill_alpha);
+		cairo_pattern_add_color_stop_rgba (pattern, 1.0, fill_shade3.r, fill_shade3.g, fill_shade3.b, fill_alpha);
+		cairo_set_source (cr, pattern);
+		cairo_fill_preserve (cr);
+
+		cairo_pattern_destroy (pattern);
+
+		clearlooks_set_mixed_color (cr, &params->parentbg, &focus_border, border_alpha);
+		cairo_stroke (cr);
+	}
 }
 
 static void
@@ -1627,6 +1657,8 @@
 			focus_fill = FALSE;
 			break;
 		case CL_FOCUS_TAB:
+			if (widget->focus)
+				return;
 			border_alpha = 0.6;
 			fill_alpha = 0.17;
 			break;

Modified: trunk/engines/clearlooks/src/clearlooks_style.c
==============================================================================
--- trunk/engines/clearlooks/src/clearlooks_style.c	(original)
+++ trunk/engines/clearlooks/src/clearlooks_style.c	Sat Jan 26 20:52:54 2008
@@ -352,6 +352,7 @@
 	{
 		WidgetParameters params;
 		TabParameters    tab;
+		FocusParameters  focus;
 
 		clearlooks_set_widget_parameters (widget, style, state_type, &params);
 
@@ -373,6 +374,17 @@
 				break;
 		}
 
+		/* Focus color */
+		if (clearlooks_style->has_focus_color)
+		{
+			ge_gdk_color_to_cairo (&clearlooks_style->focus_color, &focus.color);
+			focus.has_color = TRUE;
+		}
+		else
+			focus.color = colors->bg[GTK_STATE_SELECTED];
+
+		tab.focus = focus;
+
 		STYLE_FUNCTION(draw_tab) (cr, colors, &params, &tab,
 		                          x, y, width, height);
 	}

Modified: trunk/engines/clearlooks/src/clearlooks_types.h
==============================================================================
--- trunk/engines/clearlooks/src/clearlooks_types.h	(original)
+++ trunk/engines/clearlooks/src/clearlooks_types.h	Sat Jan 26 20:52:54 2008
@@ -178,6 +178,18 @@
 
 typedef struct
 {
+	ClearlooksFocusType type;
+	ClearlooksContinue  continue_side;
+	CairoColor          color;
+	boolean             has_color;
+	gint                line_width;
+	gint                padding;
+	guint8*             dash_list;
+	boolean             interior;
+} FocusParameters;
+
+typedef struct
+{
 	boolean lower;
 	boolean horizontal;
 	boolean fill_level;
@@ -207,6 +219,7 @@
 typedef struct
 {
 	ClearlooksGapSide gap_side;
+	FocusParameters   focus;
 } TabParameters;
 
 typedef struct
@@ -270,18 +283,6 @@
 
 typedef struct
 {
-	ClearlooksFocusType type;
-	ClearlooksContinue  continue_side;
-	CairoColor          color;
-	boolean             has_color;
-	gint                line_width;
-	gint                padding;
-	guint8*             dash_list;
-	boolean             interior;
-} FocusParameters;
-
-typedef struct
-{
 	int      style;
 	boolean  topmost;
 } ToolbarParameters;



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