Re: Nodoka theme engine

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

 



Hi,

I've done some hacking on the Nodoka engine. I worked on the gradients
and completely (but it can be still optionally turned on) removed the
glassy effect. For now it's all I am able to do - everything more would
need further studying of how it works. So the tab effect on menu is
still missing, progressbar background is still without gradient, frames
are still old, tabs are without gradient, notebook looks still old,
check and radio buttons are still not changed, and shadow isn't still
added. I attach the patch I made.

Martin
--- nodoka-0.1/src/nodoka_draw.c.old	2007-07-12 04:16:19.000000000 +0200
+++ nodoka-0.1/src/nodoka_draw.c	2007-07-12 14:42:36.000000000 +0200
@@ -155,12 +155,14 @@ nodoka_set_gradient (cairo_t *cr, const 
   if (gradients) {
 		cairo_pattern_t *pattern;
 
+		NodokaRGB top_shade;
 		NodokaRGB bottom_shade;
-		nodoka_shade (color, &bottom_shade, hilight);
+		nodoka_shade (color, &top_shade, hilight);
+		nodoka_shade (color, &bottom_shade, 1.0+(1.0-hilight)/abs(1.0-hilight)*1.05);
 
 		pattern	= cairo_pattern_create_linear (0, 0, width, height);
-		cairo_pattern_add_color_stop_rgb (pattern, 0, bottom_shade.r, bottom_shade.g, bottom_shade.b);
-		cairo_pattern_add_color_stop_rgb (pattern, 0.5, color->r, color->g, color->b);
+		cairo_pattern_add_color_stop_rgb (pattern, 0, top_shade.r, top_shade.g, top_shade.b);
+		cairo_pattern_add_color_stop_rgb (pattern, 0.7, color->r, color->g, color->b);
 		cairo_pattern_add_color_stop_rgb (pattern, 1, bottom_shade.r, bottom_shade.g, bottom_shade.b);
 		
 		cairo_set_source (cr, pattern);
@@ -227,31 +229,33 @@ nodoka_draw_button (cairo_t *cr,
 		cairo_clip_preserve(cr);
 
 	int curve_pos = 1;
-	if (widget->roundness < 2 && widget->glazestyle != 4)
+	if (widget->roundness < 2 && widget->glazestyle != 5)
 		curve_pos = 2;
 
-	//glass effect
-	if (widget->glazestyle > 0) {
+	//glass effect 0 = no highligt 1 = flat hilight, 2 = curved hilight, 3 = concave style, 4 = top curved hilight
+	if (widget->glazestyle > 1) {
 		cairo_set_fill_rule (cr, CAIRO_FILL_RULE_EVEN_ODD);
-		widget->glazestyle == 2 ? cairo_fill_preserve(cr) : cairo_fill(cr);
+		widget->glazestyle == 3 ? cairo_fill_preserve(cr) : cairo_fill(cr);
 		if (!horizontal)
 			rotate_mirror_translate (cr, M_PI/2, x, y, FALSE, FALSE);
-		if (widget->glazestyle < 3)
+		if (widget->glazestyle < 4)
 			nodoka_draw_curved_hilight (cr, curve_pos, (horizontal ? width : height), (horizontal ? height : width));
 		else
 			nodoka_draw_curved_hilight_top (cr, curve_pos, (horizontal ? width : height), (horizontal ? height : width));
 	}
-	else {
+	else { 
 		cairo_fill(cr);
-		if (!horizontal)
-			rotate_mirror_translate (cr, M_PI/2, x, y, FALSE, FALSE);
-		nodoka_draw_flat_hilight (cr, xoffset + 1, yoffset + 1, (horizontal ? width-(xoffset*2)-2 : height-(yoffset*2)-2), (horizontal ? height-(yoffset*2)-2 : width-(xoffset*2)-2));
+		if (widget->glazestyle == 1) {
+			if (!horizontal)
+				rotate_mirror_translate (cr, M_PI/2, x, y, FALSE, FALSE);
+			nodoka_draw_flat_hilight (cr, xoffset + 1, yoffset + 1, (horizontal ? width-(xoffset*2)-2 : height-(yoffset*2)-2), (horizontal ? height-(yoffset*2)-2 : width-(xoffset*2)-2));
+		}
 	}
 
 	nodoka_set_gradient (cr, &hilight, GLASS_HILIGHT, 0, height, widget->gradients, TRUE);
 	cairo_fill(cr);
 
-	if (widget->glazestyle == 4) {
+	if (widget->glazestyle == 5) {
 		if (!horizontal)
 			rotate_mirror_translate (cr, M_PI/2, x, y, FALSE, FALSE);
 		nodoka_draw_curved_hilight_bottom (cr, curve_pos, (horizontal ? width : height), (horizontal ? height : width));
@@ -509,7 +513,7 @@ nodoka_draw_progressbar_fill (cairo_t *c
 	NodokaRGB *fill = (NodokaRGB*)&colors->spot[1];
 	NodokaRGB *border = (NodokaRGB*)&colors->spot[2];
 	NodokaRGB hilight;
-	nodoka_shade (fill, &hilight, 1.1*widget->hilight_ratio);
+	nodoka_shade (fill, &hilight, 0.7*widget->hilight_ratio);
 
 	cairo_rectangle (cr, x, y, width, height);
 
@@ -547,25 +551,26 @@ nodoka_draw_progressbar_fill (cairo_t *c
 	cairo_rectangle (cr, 1.5, 0.5, width-2, height-1);
 
 	/* Draw fill */
-	nodoka_set_gradient (cr, fill, GLASS_HILIGHT, 0, height, widget->gradients, FALSE);
+	nodoka_set_gradient (cr, fill, 1.5*GLASS_HILIGHT, 0, height, widget->gradients, FALSE);
 		
 	//glass effect
-	if (widget->glazestyle > 0) {
-		widget->glazestyle == 2 ? cairo_fill_preserve(cr) : cairo_fill(cr);
-		if (widget->glazestyle < 3)
+	if (widget->glazestyle > 1) {
+		widget->glazestyle == 3 ? cairo_fill_preserve(cr) : cairo_fill(cr);
+		if (widget->glazestyle < 4)
 			nodoka_draw_curved_hilight (cr, 1, width, height);
 		else
 			nodoka_draw_curved_hilight_top (cr, 1, width, height);
 	}
 	else {
 		cairo_fill(cr);
-		nodoka_draw_flat_hilight (cr, 1.5, 0.5, width-2, height);
+		if (widget->glazestyle == 1) 
+			nodoka_draw_flat_hilight (cr, 1.5, 0.5, width-2, height);
 	}
 	
 	nodoka_set_gradient (cr, &hilight, GLASS_HILIGHT, 0, height, widget->gradients, TRUE);
 	cairo_fill (cr);
 
-	if (widget->glazestyle == 4) {
+	if (widget->glazestyle == 5) {
 		nodoka_draw_curved_hilight_bottom (cr, 1, width, height+1);
 		NodokaRGB shadow;
 		nodoka_shade (fill, &shadow, 0.96*(1/widget->hilight_ratio));
@@ -573,7 +578,7 @@ nodoka_draw_progressbar_fill (cairo_t *c
 		cairo_fill(cr);
 	}
 
-	if (widget->glazestyle == 2) {
+	if (widget->glazestyle == 3) {
 		cairo_move_to (cr, 2.5, height-2);
 		cairo_line_to (cr, 2.5, 2);
 		cairo_move_to (cr, 2, 1.5);
@@ -589,7 +594,7 @@ nodoka_draw_progressbar_fill (cairo_t *c
 	}	
 	
 	/* Draw strokes */
-	while (tile_pos <= width+x_step-2)
+/*	while (tile_pos <= width+x_step-2)
 	{
 		cairo_move_to (cr, stroke_width/2-x_step, 0);
 		cairo_line_to (cr, stroke_width-x_step,   0);
@@ -602,7 +607,7 @@ nodoka_draw_progressbar_fill (cairo_t *c
 
 	cairo_set_source_rgba (cr, border->r, border->g, border->b, 0.15);
 	cairo_fill (cr);
-	cairo_restore (cr);
+	cairo_restore (cr);*/
 	
 	//border
 	cairo_set_source_rgba (cr, border->r, border->g, border->b, 0.8);
@@ -651,25 +656,26 @@ nodoka_draw_menubar (cairo_t *cr,
 	//glass menubar
 	if (menubarstyle == 1) {
 		NodokaRGB hilight;
-		nodoka_set_gradient (cr, fill, GLASS_HILIGHT, 0, height, widget->gradients, FALSE);
+		nodoka_set_gradient (cr, fill, 1.5*GLASS_HILIGHT, 0, height, widget->gradients, FALSE);
 		nodoka_shade (fill, &hilight, 1.1*widget->hilight_ratio);
 		//glass effect
-		if (widget->glazestyle > 0) {
-			widget->glazestyle == 2 ? cairo_fill_preserve(cr) : cairo_fill(cr);
-			if (widget->glazestyle < 3)
+		if (widget->glazestyle > 1) {
+			widget->glazestyle == 3 ? cairo_fill_preserve(cr) : cairo_fill(cr);
+			if (widget->glazestyle < 4)
 				nodoka_draw_curved_hilight (cr, 0, width, height);
 			else
 				nodoka_draw_curved_hilight_top (cr, 0, width, height);
 		}
 		else {
 			cairo_fill(cr);
-			nodoka_draw_flat_hilight (cr, 0, 0, width, height);
+			if (widget->glazestyle == 1)
+				nodoka_draw_flat_hilight (cr, 0, 0, width, height);
 		}
 
-		nodoka_set_gradient (cr, &hilight, GLASS_HILIGHT, 0, height, widget->gradients, TRUE);
+		nodoka_set_gradient (cr, &hilight, 1.5*GLASS_HILIGHT, 0, height, widget->gradients, TRUE);
 		cairo_fill (cr);
 
-		if (widget->glazestyle == 4) {
+		if (widget->glazestyle == 5) {
 			nodoka_draw_curved_hilight_bottom (cr, 0, width, height);
 			NodokaRGB shadow;
 			nodoka_shade (fill, &shadow, 0.96*(1/widget->hilight_ratio));
@@ -677,19 +683,19 @@ nodoka_draw_menubar (cairo_t *cr,
 			cairo_fill(cr);
 		}
 
-		if (widget->glazestyle == 2) {
+		if (widget->glazestyle == 3) {
 			cairo_set_line_width (cr, 1.0);
 			cairo_move_to (cr, 1.5, height-2);
 			cairo_line_to (cr, 1.5, 1);
 			cairo_move_to (cr, 1, 1.5);
 			cairo_line_to (cr, width-1, 1.5);
-			nodoka_set_gradient (cr, &hilight, GLASS_HILIGHT, 0, height, widget->gradients, FALSE);
+			nodoka_set_gradient (cr, &hilight, 1.5*GLASS_HILIGHT, 0, height, widget->gradients, FALSE);
 			cairo_stroke (cr);
 			cairo_move_to (cr, width-1.5, 2);
 			cairo_line_to (cr, width-1.5, height-2);
 			cairo_move_to (cr, width-1, height-1.5);
 			cairo_line_to (cr, 1, height-1.5);
-			nodoka_set_gradient (cr, &hilight, GLASS_HILIGHT, 0, height, widget->gradients, FALSE);
+			nodoka_set_gradient (cr, &hilight, 1.5*GLASS_HILIGHT, 0, height, widget->gradients, FALSE);
 			cairo_stroke (cr);
 		}	
 	}
@@ -734,7 +740,7 @@ nodoka_draw_menubar (cairo_t *cr,
 	}
 	
 	/* Draw bottom line */
-	if (menubarstyle == 1 && widget->glazestyle == 2)
+	if (menubarstyle == 1 && widget->glazestyle == 3)
 		cairo_rectangle(cr, 0.5, 0.5, width-1, height-1);
 #ifndef HAVE_MACMENU	
 	else {
@@ -1137,22 +1143,23 @@ nodoka_draw_list_view_header (cairo_t *c
 			cairo_rectangle (cr, 0, 0, width, height);
 			nodoka_set_gradient (cr, fill, GLASS_HILIGHT, 0, height, widget->gradients, FALSE);
 			//glass effect
-			if (widget->glazestyle > 0) {
-				widget->glazestyle == 2 ? cairo_fill_preserve(cr) : cairo_fill(cr);
-				if (widget->glazestyle < 3)
+			if (widget->glazestyle > 1) {
+				widget->glazestyle == 3 ? cairo_fill_preserve(cr) : cairo_fill(cr);
+				if (widget->glazestyle < 4)
 					nodoka_draw_curved_hilight (cr, 0, width, height);
 				else
 					nodoka_draw_curved_hilight_top (cr, 0, width, height);
 			}
 			else {
 				cairo_fill (cr);
-				nodoka_draw_flat_hilight (cr, 0 , 0 , width, height);
+				if (widget->glazestyle == 1)
+					nodoka_draw_flat_hilight (cr, 0 , 0 , width, height);
 			}
 			
 			nodoka_set_gradient (cr, &hilight_header, GLASS_HILIGHT, 0, height, widget->gradients, TRUE);
 			cairo_fill (cr);
 
-			if (widget->glazestyle == 4) {
+			if (widget->glazestyle == 5) {
 				nodoka_draw_curved_hilight_bottom (cr, 0, width, height);
 				NodokaRGB shadow;
 				nodoka_shade (fill, &shadow, 0.96*(1/widget->hilight_ratio));
@@ -1160,7 +1167,7 @@ nodoka_draw_list_view_header (cairo_t *c
 				cairo_fill(cr);
 			}
 
-			if (widget->glazestyle == 2) {
+			if (widget->glazestyle == 3) {
 				cairo_move_to (cr, 0.5, height-2);
 				cairo_line_to (cr, 0.5, 1);
 				cairo_move_to (cr, 0.0, 0.5);
@@ -1271,7 +1278,7 @@ nodoka_draw_menuitem (cairo_t *cr,
 		cairo_rectangle (cr, 0, 0, width, height);
 	else
 		clearlooks_rounded_rectangle  (cr, 0, 0, width, height, widget->roundness, widget->corners);
-	nodoka_set_gradient (cr, fill, menuitemstyle == 1 ? GLASS_HILIGHT : 1.08, 0, height, widget->gradients, FALSE);
+	nodoka_set_gradient (cr, fill, 1.5*GLASS_HILIGHT, 0, height, widget->gradients, FALSE);
 
 	//striped
 	if (menuitemstyle == 2) {
@@ -1302,40 +1309,41 @@ nodoka_draw_menuitem (cairo_t *cr,
 		if (widget->roundness > 1)
 			cairo_clip_preserve(cr);
 		//glass effect
-		if (widget->glazestyle > 0) {
-			widget->glazestyle == 2 ? cairo_fill_preserve(cr) : cairo_fill(cr);
-			if (widget->glazestyle < 3)
+		if (widget->glazestyle > 1) {
+			widget->glazestyle == 3 ? cairo_fill_preserve(cr) : cairo_fill(cr);
+			if (widget->glazestyle < 4)
 				nodoka_draw_curved_hilight (cr, 0, width, height);
 			else
 				nodoka_draw_curved_hilight_top (cr, 0, width, height);
 		}
 		else {
 			cairo_fill(cr);
-			nodoka_draw_flat_hilight (cr, 0, 0, width, height);
+			if (widget->glazestyle == 1)
+				nodoka_draw_flat_hilight (cr, 0, 0, width, height);
 		}
 		nodoka_set_gradient (cr, &hilight, GLASS_HILIGHT, 0, height, widget->gradients, TRUE);
 		cairo_fill (cr);
 		
-		if (widget->glazestyle == 4) {
+		if (widget->glazestyle == 5) {
 			nodoka_draw_curved_hilight_bottom (cr, 0, width, height);
 			NodokaRGB shadow;
 			nodoka_shade (&colors->spot[1], &shadow, 0.96*(1/widget->hilight_ratio));
-			nodoka_set_gradient (cr, &shadow, GLASS_HILIGHT, 0, height, widget->gradients, TRUE);
+			nodoka_set_gradient (cr, &shadow, 1.5*GLASS_HILIGHT, 0, height, widget->gradients, TRUE);
 			cairo_fill(cr);
 		}
 
-		if (widget->glazestyle == 2) {
+		if (widget->glazestyle == 3) {
 			cairo_move_to (cr, 1.5, height-2);
 			cairo_line_to (cr, 1.5, 2);
 			cairo_move_to (cr, 1, 1.5);
 			cairo_line_to (cr, width-1, 1.5);
-			nodoka_set_gradient (cr, &hilight, GLASS_HILIGHT, 0, height, widget->gradients, FALSE);
+			nodoka_set_gradient (cr, &hilight, 1.5*GLASS_HILIGHT, 0, height, widget->gradients, FALSE);
 			cairo_stroke (cr);
 			cairo_move_to (cr, width-1.5, 2);
 			cairo_line_to (cr, width-1.5, height-2);
 			cairo_move_to (cr, width-1, height-1.5);
 			cairo_line_to (cr, 1, height-1.5);
-			nodoka_set_gradient (cr, fill, GLASS_HILIGHT, 0, height, widget->gradients, FALSE);
+			nodoka_set_gradient (cr, fill, 1.5*GLASS_HILIGHT, 0, height, widget->gradients, FALSE);
 			cairo_stroke (cr);
 		}
 	}
@@ -1425,23 +1433,24 @@ nodoka_draw_scrollbar_stepper (cairo_t *
 	if (widget->roundness < 2  && widget->glazestyle != 4)
 		curve_pos = 2;
 	//glass effect
-	if (widget->glazestyle > 0) {
+	if (widget->glazestyle > 1) {
 		cairo_set_fill_rule (cr, CAIRO_FILL_RULE_EVEN_ODD);
-		widget->glazestyle == 2 ? cairo_fill_preserve(cr) : cairo_fill(cr);
-		if (widget->glazestyle < 3)
+		widget->glazestyle == 3 ? cairo_fill_preserve(cr) : cairo_fill(cr);
+		if (widget->glazestyle < 4)
 			nodoka_draw_curved_hilight (cr, curve_pos, width, height);
 		else
 			nodoka_draw_curved_hilight_top (cr, curve_pos, width, height);
 	}
 	else {
 		cairo_fill(cr);
-		nodoka_draw_flat_hilight (cr, 1, 1, width-2, height-2);
+		if (widget->glazestyle == 1)
+			nodoka_draw_flat_hilight (cr, 1, 1, width-2, height-2);
 	}
 	
 	nodoka_set_gradient (cr, &hilight, GLASS_HILIGHT, 0, height, widget->gradients, TRUE);
 	cairo_fill(cr);
 
-	if (widget->glazestyle == 4) {
+	if (widget->glazestyle == 5) {
 		nodoka_draw_curved_hilight_bottom (cr, curve_pos, width, height);
 		NodokaRGB shadow;
 		nodoka_shade (fill, &shadow, 0.96*(1/widget->hilight_ratio));
@@ -1451,7 +1460,7 @@ nodoka_draw_scrollbar_stepper (cairo_t *
 
 	nodoka_shade (fill, &hilight, 1.08*widget->hilight_ratio); 
 	//the white inner border
-	if (widget->roundness < 2 && widget->glazestyle != 4) {
+	if (widget->roundness < 2 && widget->glazestyle != 5) {
 		cairo_rectangle(cr, 1.5, 1.5, width-3, height-3);		
 		nodoka_set_gradient (cr, &hilight, GLASS_HILIGHT, 0, height, widget->gradients, FALSE);
 		cairo_stroke(cr);
@@ -1549,22 +1558,23 @@ nodoka_draw_scrollbar_slider (cairo_t *c
 	nodoka_set_gradient (cr, &fill, GLASS_HILIGHT, 0, height, widget->gradients, FALSE);
 
 	//glass effect
-	if (widget->glazestyle > 0) {
-		widget->glazestyle == 2 ? cairo_fill_preserve(cr) : cairo_fill(cr);
-		if (widget->glazestyle < 3)
+	if (widget->glazestyle > 1) {
+		widget->glazestyle == 3 ? cairo_fill_preserve(cr) : cairo_fill(cr);
+		if (widget->glazestyle < 4)
 			nodoka_draw_curved_hilight (cr, 1, width, height);
 		else
 			nodoka_draw_curved_hilight_top (cr, 1, width, height);
 	}	
 	else {
 		cairo_fill(cr);
-		nodoka_draw_flat_hilight (cr, 1, 1, width-2, height-2);
+		if (widget->glazestyle == 1)
+			nodoka_draw_flat_hilight (cr, 1, 1, width-2, height-2);
 	}
 	
 	nodoka_set_gradient (cr, &hilight, GLASS_HILIGHT, 0, height, widget->gradients, TRUE);
 	cairo_fill(cr);
 
-	if (widget->glazestyle == 4) {
+	if (widget->glazestyle == 5) {
 		nodoka_draw_curved_hilight_bottom (cr, 1, width, height);
 		NodokaRGB shadow;
 		nodoka_shade (&fill, &shadow, 0.96*(1/widget->hilight_ratio));
@@ -1573,7 +1583,7 @@ nodoka_draw_scrollbar_slider (cairo_t *c
 	}
 
 	nodoka_shade (&fill, &hilight, 1.08*widget->hilight_ratio);
-	if (widget->roundness < 2 && widget->glazestyle != 4) {
+	if (widget->roundness < 2 && widget->glazestyle != 5) {
 		//the white inner border
 		cairo_rectangle(cr, 1.5, 1.5, width-3, height-3);		
 		nodoka_set_gradient (cr, &hilight, GLASS_HILIGHT, 0, height, widget->gradients, FALSE);

Attachment: signature.asc
Description: This is a digitally signed message part

_______________________________________________
Fedora-art-list mailing list
Fedora-art-list@xxxxxxxxxx
http://www.redhat.com/mailman/listinfo/fedora-art-list

[Index of Archives]     [Fedora Music]     [Fedora Development]     [Linux Kernel]     [Fedora Legacy]     [Fedora Desktop]     [Fedora Directory]     [PAM]     [Big List of Linux Books]     [Gimp]     [Yosemite News]

  Powered by Linux