[murrine/border-shade-and-expander] Better tooltip theming



commit a240d43e893f875e0c75242c8a65228dedb375b9
Author: Andrea Cimitan <andrea cimitan gmail com>
Date:   Sun Nov 1 13:19:45 2009 +0100

    Better tooltip theming

 src/murrine_draw.c      |   29 +++++++++++++++--------------
 src/murrine_draw_rgba.c |   38 +++++++++++++++++++++++---------------
 src/murrine_style.c     |    2 ++
 3 files changed, 40 insertions(+), 29 deletions(-)
---
diff --git a/src/murrine_draw.c b/src/murrine_draw.c
index 44c0540..50d1d82 100644
--- a/src/murrine_draw.c
+++ b/src/murrine_draw.c
@@ -1771,27 +1771,28 @@ murrine_draw_tooltip (cairo_t *cr,
                       const WidgetParameters *widget,
                       int x, int y, int width, int height)
 {
-	MurrineRGB border, highlight;
+	MurrineRGB border;
 	MurrineGradients mrn_gradient_custom = get_decreased_gradient_shades (widget->mrn_gradient, 2.0);
-
-	murrine_shade (&colors->bg[widget->state_type], 0.6, &border);
-	murrine_shade (&colors->bg[widget->state_type], 1.0, &highlight);
+	double glow_shade_custom = get_decreased_shade (widget->glow_shade, 2.0);
+	double highlight_shade_custom = get_decreased_shade (widget->highlight_shade, 2.0);
+	
+	murrine_shade (&colors->bg[widget->state_type], get_contrast(0.6, widget->contrast), &border);
 
 	cairo_save (cr);
 
-	cairo_translate      (cr, x, y);
+	cairo_translate (cr, x, y);
 
-	murrine_set_gradient (cr, &colors->bg[widget->state_type], mrn_gradient_custom, 0, 0, 0, height, widget->mrn_gradient.gradients, FALSE);
-	cairo_rectangle (cr, 0, 0, width, height);
-	cairo_fill (cr);
+	cairo_rectangle (cr, 1, 1, width-2, height-2);
 
-	murrine_set_gradient (cr, &highlight, mrn_gradient_custom, 0, 0, 0, height, widget->mrn_gradient.gradients, TRUE);
-	cairo_rectangle (cr, 0, 0, width, height/2);
-	cairo_fill (cr);
+	murrine_draw_glaze (cr, &colors->bg[widget->state_type],
+	                    glow_shade_custom, highlight_shade_custom, widget->lightborder_shade,
+	                    mrn_gradient_custom, widget, 1, 1, width-2, height-2,
+	                    widget->roundness, widget->corners, TRUE);
 
-	murrine_set_color_rgb (cr, &border);
-	cairo_rectangle (cr, 0.5, 0.5, width-1, height-1);
-	cairo_stroke (cr);
+	murrine_draw_border (cr, &border,
+	                     0.5, 0.5, width-1, height-1,
+	                     widget->roundness, widget->corners,
+	                     mrn_gradient_custom, 1.0);
 
 	cairo_restore (cr);
 }
diff --git a/src/murrine_draw_rgba.c b/src/murrine_draw_rgba.c
index 7d7ded9..abdecfb 100644
--- a/src/murrine_draw_rgba.c
+++ b/src/murrine_draw_rgba.c
@@ -1400,11 +1400,12 @@ murrine_rgba_draw_tooltip (cairo_t *cr,
                            const WidgetParameters *widget,
                            int x, int y, int width, int height)
 {
-	MurrineRGB border, highlight;
-	MurrineGradients mrn_gradient_custom = mrn_gradient_custom = get_decreased_gradient_shades (widget->mrn_gradient, 2.0);
-
-	murrine_shade (&colors->bg[widget->state_type], 0.6, &border);
-	murrine_shade (&colors->bg[widget->state_type], 1.0, &highlight);
+	MurrineRGB border;
+	MurrineGradients mrn_gradient_custom = get_decreased_gradient_shades (widget->mrn_gradient, 2.0);
+	double glow_shade_custom = get_decreased_shade (widget->glow_shade, 2.0);
+	double highlight_shade_custom = get_decreased_shade (widget->highlight_shade, 2.0);
+	
+	murrine_shade (&colors->bg[widget->state_type], get_contrast(0.6, widget->contrast), &border);
 
 	cairo_save (cr);
 
@@ -1413,20 +1414,27 @@ murrine_rgba_draw_tooltip (cairo_t *cr,
 	cairo_rectangle (cr, 0, 0, width, height);
 	cairo_set_operator (cr, CAIRO_OPERATOR_CLEAR);
 	cairo_fill (cr);
+
+	cairo_save (cr);
+
 	cairo_set_operator (cr, CAIRO_OPERATOR_SOURCE);
 
-	murrine_set_gradient (cr, &colors->bg[widget->state_type], mrn_gradient_custom, 0, 0, 0, height, widget->mrn_gradient.gradients, FALSE);
-	clearlooks_rounded_rectangle (cr, 0, 0, width, height, widget->roundness > 1 ? widget->roundness+1 : 0, widget->corners);
-	cairo_fill (cr);
+	murrine_rounded_rectangle_closed (cr, 1, 1, width-2, height-2, widget->roundness-1, widget->corners);
+	cairo_clip_preserve (cr);
 
-	murrine_set_gradient (cr, &highlight, mrn_gradient_custom, 0, 0, 0, height, widget->mrn_gradient.gradients, TRUE);
-	clearlooks_rounded_rectangle (cr, 0, 0, width, height/2, widget->roundness > 1 ? widget->roundness+1 : 0,
-	                              widget->corners == MRN_CORNER_ALL ? MRN_CORNER_TOPLEFT | MRN_CORNER_TOPRIGHT : MRN_CORNER_NONE);
-	cairo_fill (cr);
+	murrine_draw_glaze (cr, &colors->bg[widget->state_type],
+	                    glow_shade_custom, highlight_shade_custom, widget->lightborder_shade,
+	                    mrn_gradient_custom, widget, 1, 1, width-2, height-2,
+	                    widget->roundness-1, widget->corners, TRUE);
 
-	murrine_set_color_rgb (cr, &border);
-	murrine_rounded_rectangle (cr, 0.5, 0.5, width-1, height-1, widget->roundness, widget->corners);
-	cairo_stroke (cr);
+	cairo_restore (cr);
+
+	cairo_set_operator (cr, CAIRO_OPERATOR_OVER);
+
+	murrine_draw_border (cr, &border,
+	                     0.5, 0.5, width-1, height-1,
+	                     widget->roundness, widget->corners,
+	                     mrn_gradient_custom, 1.0);
 
 	cairo_restore (cr);
 }
diff --git a/src/murrine_style.c b/src/murrine_style.c
index 8676dc0..6c301b2 100644
--- a/src/murrine_style.c
+++ b/src/murrine_style.c
@@ -229,6 +229,8 @@ murrine_style_draw_flat_box (DRAW_ARGS)
 		{
 			params.mrn_gradient.rgba_opacity = TOOLTIP_OPACITY;
 		}
+		else
+			params.corners = MRN_CORNER_NONE;
 
 /*		Not working...
 		parent = gtk_widget_get_parent (widget);



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