[murrine] Use indicator-size style property



commit 1011065e7713331a27d2ab6d1be70f9d466265c2
Author: Andrea Cimitan <andrea cimitan gmail com>
Date:   Tue May 25 15:34:16 2010 +0100

    Use indicator-size style property

 src/murrine_draw.c      |   26 +++++++++++---------------
 src/murrine_draw_rgba.c |   26 +++++++++++---------------
 2 files changed, 22 insertions(+), 30 deletions(-)
---
diff --git a/src/murrine_draw.c b/src/murrine_draw.c
index f4e3d6e..f8e8c0b 100644
--- a/src/murrine_draw.c
+++ b/src/murrine_draw.c
@@ -2309,7 +2309,7 @@ murrine_draw_radiobutton (cairo_t *cr,
 	gboolean inconsistent = FALSE;
 	gboolean draw_box = !checkbox->in_menu;
 	gboolean draw_bullet = (checkbox->shadow_type == GTK_SHADOW_IN);
-	int roundness = 5;
+	int roundness = width+height;
 	double highlight_shade_new = widget->highlight_shade;
 	double lightborder_shade_new = widget->lightborder_shade;
 	MurrineGradients mrn_gradient_new = widget->mrn_gradient;
@@ -2317,8 +2317,6 @@ murrine_draw_radiobutton (cairo_t *cr,
 	inconsistent = (checkbox->shadow_type == GTK_SHADOW_ETCHED_IN);
 	draw_bullet |= inconsistent;
 
-	width = height = 14;
-
 	if (widget->state_type == GTK_STATE_INSENSITIVE)
 	{
 		border = &colors->shade[3];
@@ -2410,8 +2408,8 @@ murrine_draw_radiobutton (cairo_t *cr,
 			cairo_set_line_cap(cr, CAIRO_LINE_CAP_ROUND);
 			cairo_set_line_width (cr, 2.0);
 
-			cairo_move_to(cr, 5, 7);
-			cairo_line_to(cr, 9, 7);
+			cairo_move_to(cr, 5, (double)height/2);
+			cairo_line_to(cr, width-5, (double)height/2);
 
 			murrine_set_color_rgba (cr, dot, trans);
 			cairo_stroke (cr);
@@ -2420,9 +2418,9 @@ murrine_draw_radiobutton (cairo_t *cr,
 		else
 		{
 			if (!draw_box)
-				cairo_arc (cr, 7, 7, 3, 0, G_PI*2);
+				cairo_arc (cr, (double)width/2, (double)height/2, (double)(width+height)/4-4, 0, G_PI*2);
 			else
-				cairo_arc (cr, 7, 7, 2.5, 0, G_PI*2);
+				cairo_arc (cr, (double)width/2, (double)height/2, (double)(width+height)/4-4.5, 0, G_PI*2);
 
 			murrine_set_color_rgba (cr, dot, trans);
 			cairo_fill (cr);
@@ -2452,8 +2450,6 @@ murrine_draw_checkbox (cairo_t *cr,
 	inconsistent = (checkbox->shadow_type == GTK_SHADOW_ETCHED_IN);
 	draw_bullet |= inconsistent;
 
-	width = height = 14;
-
 	if (widget->state_type == GTK_STATE_INSENSITIVE)
 	{
 		border = &colors->shade[3];
@@ -2543,8 +2539,8 @@ murrine_draw_checkbox (cairo_t *cr,
 		{
 			cairo_save (cr);
 			cairo_set_line_width (cr, 2.0);
-			cairo_move_to (cr, 3, height*0.5);
-			cairo_line_to (cr, width-3, height*0.5);
+			cairo_move_to (cr, 3, (double)height/2);
+			cairo_line_to (cr, width-3, (double)height/2);
 			cairo_restore (cr);
 		}
 		else
@@ -2552,13 +2548,13 @@ murrine_draw_checkbox (cairo_t *cr,
 			
 			if (!draw_box)
 			{
-				cairo_scale (cr, 0.7, 0.7);
-				cairo_translate (cr, 3.0, 4.0);
+				cairo_scale (cr, (double)width/18.0, (double)height/18.0);
+				cairo_translate (cr, 2.0, 2.0);
 			}
 			else
 			{
-				cairo_scale (cr, 0.8, 0.8);
-				cairo_translate (cr, 4.1, 1.1);
+				cairo_scale (cr, (double)width/18.0, (double)height/18.0);
+				cairo_translate (cr, 4.0, 2.0);
 			}
 			cairo_move_to (cr, 0.0, 6.0);
 			cairo_line_to (cr, 0.0, 8.0);
diff --git a/src/murrine_draw_rgba.c b/src/murrine_draw_rgba.c
index 1317dd5..50ab2b0 100644
--- a/src/murrine_draw_rgba.c
+++ b/src/murrine_draw_rgba.c
@@ -1688,7 +1688,7 @@ murrine_rgba_draw_radiobutton (cairo_t *cr,
 	gboolean inconsistent = FALSE;
 	gboolean draw_box = !checkbox->in_menu;
 	gboolean draw_bullet = (checkbox->shadow_type == GTK_SHADOW_IN);
-	int roundness = 5;
+	int roundness = width+height;
 	double highlight_shade_new = widget->highlight_shade;
 	double lightborder_shade_new = widget->lightborder_shade;
 	MurrineGradients mrn_gradient_new = widget->mrn_gradient;
@@ -1696,8 +1696,6 @@ murrine_rgba_draw_radiobutton (cairo_t *cr,
 	inconsistent = (checkbox->shadow_type == GTK_SHADOW_ETCHED_IN);
 	draw_bullet |= inconsistent;
 
-	width = height = 14;
-
 	if (widget->state_type == GTK_STATE_INSENSITIVE)
 	{
 		border = colors->shade[4];
@@ -1791,8 +1789,8 @@ murrine_rgba_draw_radiobutton (cairo_t *cr,
 			cairo_set_line_cap(cr, CAIRO_LINE_CAP_ROUND);
 			cairo_set_line_width (cr, 2.0);
 
-			cairo_move_to(cr, 5, 7);
-			cairo_line_to(cr, 9, 7);
+			cairo_move_to(cr, 5, (double)height/2);
+			cairo_line_to(cr, width-5, (double)height/2);
 
 			murrine_set_color_rgba (cr, dot, trans);
 			cairo_stroke (cr);
@@ -1801,9 +1799,9 @@ murrine_rgba_draw_radiobutton (cairo_t *cr,
 		else
 		{
 			if (!draw_box)
-				cairo_arc (cr, 7, 7, 3, 0, G_PI*2);
+				cairo_arc (cr, (double)width/2, (double)height/2, (double)(width+height)/4-4, 0, G_PI*2);
 			else
-				cairo_arc (cr, 7, 7, 2.5, 0, G_PI*2);
+				cairo_arc (cr, (double)width/2, (double)height/2, (double)(width+height)/4-4.5, 0, G_PI*2);
 
 			murrine_set_color_rgba (cr, dot, trans);
 			cairo_fill (cr);
@@ -1833,8 +1831,6 @@ murrine_rgba_draw_checkbox (cairo_t *cr,
 	inconsistent = (checkbox->shadow_type == GTK_SHADOW_ETCHED_IN);
 	draw_bullet |= inconsistent;
 
-	width = height = 14;
-
 	if (widget->state_type == GTK_STATE_INSENSITIVE)
 	{
 		border = colors->shade[4];
@@ -1926,21 +1922,21 @@ murrine_rgba_draw_checkbox (cairo_t *cr,
 		{
 			cairo_save (cr);
 			cairo_set_line_width (cr, 2.0);
-			cairo_move_to (cr, 3, height*0.5);
-			cairo_line_to (cr, width-3, height*0.5);
+			cairo_move_to (cr, 3, (double)height/2);
+			cairo_line_to (cr, width-3, (double)height/2);
 			cairo_restore (cr);
 		}
 		else
 		{
 			if (!draw_box)
 			{
-				cairo_scale (cr, 0.7, 0.7);
-				cairo_translate (cr, 3.0, 4.0);
+				cairo_scale (cr, (double)width/18.0, (double)height/18.0);
+				cairo_translate (cr, 2.0, 2.0);
 			}
 			else
 			{
-				cairo_scale (cr, 0.8, 0.8);
-				cairo_translate (cr, 4.1, 1.1);
+				cairo_scale (cr, (double)width/18.0, (double)height/18.0);
+				cairo_translate (cr, 4.0, 2.0);
 			}
 			cairo_move_to (cr, 0.0, 6.0);
 			cairo_line_to (cr, 0.0, 8.0);



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