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

Re: gEDA-dev: Darker grid color when zoomed out



Hi,

I'm getting "Tried to get an invalid color: 22" messages when running
gschem 1.3.1 (and libgeda) with your patch.

How about a major/minor grid with two different colors? See the
attached patch for the x_grid.c file. Note that this patch is for
illustrating the idea only. It was not tested with variable grid sizes
and is using hard-coded parameters (minor grid color is a net color,
grid spacing is fixed to 2x/16x of the snap spacing).

Cheers,

-r.


On Jan 26, 2008 2:40 PM, Tomaž Šolc <tomaz.solc@tablix.org> wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Hi guys
>
> I finally had some time to do some electronic design again and hack on
> gschem. Since I'm just learning to use git I made a small patch to try
> it out.
>
> This patch defines a new color "grid-blend-color" which is a darker or
> lighter variant of the "grid-color" (depending on the color used for
> background). This color is used for drawing the grid when grid is in
> fixed mode and distance between grid points falls bellow the number of
> screen pixels specified in "w_current->grid_fixed_blend_threshold".
>
> The end result is that the schematic is a bit more readable when zoomed
> out and grid points are still well visible when zoomed in. This is
> basically a primitive simulation of rendering grid points that are less
> than one pixel in diameter.
>
> I submitted it to sf.net tracker in case anyone else finds it useful. I
> guess it won't be necessary once gschem gets support for cairo.
>
> http://sourceforge.net/tracker/index.php?func=detail&aid=1880298&group_id=161080&atid=818428
>
> When I made this patch I also noticed the weird way colors are set via
> Scheme functions. Is there a reason why for example Scheme functions for
> defining colors must have the "DO NOT CHANGE" index parameter? Why
> couldn't this parameter be set to a constant value for each function
> call in g_rc.c?
>
> Best regards
> Tomaz
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.6 (GNU/Linux)
> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
>
> iD8DBQFHm0ZusAlAlRhL9q8RAgFFAJ4sV16ly9cfxU7euBxJq6pqvT82tQCfQIkX
> pMl/BPy6rpukQUWUjMlnEdE=
> =sV0p
> -----END PGP SIGNATURE-----
>
>
> _______________________________________________
> geda-dev mailing list
> geda-dev@moria.seul.org
> http://www.seul.org/cgi-bin/mailman/listinfo/geda-dev
>
77c77
<     incr = toplevel->snap_size;
---
>     incr = toplevel->snap_size * 2;
79c79
<     if (screen_incr < w_current->grid_fixed_threshold)
---
>     if (screen_incr < w_current->grid_fixed_threshold / 16) //check major grid
98a99,154
>   if (screen_incr > w_current->grid_fixed_threshold) //check minor grid
>     {
>       gdk_gc_set_foreground(w_current->gc,
> 			    x_get_color(w_current->net_color));
>       
>       /* figure starting grid coordinates, work by taking the start
>        * and end coordinates and rounding down to the nearest
>        * increment */
>       x_start = (toplevel->page_current->left -
> 		 (toplevel->page_current->left % incr));
>       y_start = (toplevel->page_current->top -
> 		 (toplevel->page_current->top  % incr));
>       
>       for (i = x_start; i < toplevel->page_current->right; i = i + incr) {
> 	for(j = y_start; j < toplevel->page_current->bottom; j = j + incr) {
> 	  WORLDtoSCREEN(toplevel, i,j, &x, &y);
> 	  if (inside_region(toplevel->page_current->left,
> 			    toplevel->page_current->top,
> 			    toplevel->page_current->right,
> 			    toplevel->page_current->bottom,
> 			    i, j)) {
> 	    
> 	    if (w_current->grid_dot_size == 1)
> 	      {
> 		points[count].x = x;
> 		points[count].y = y;
> 		count++;
> 		
> 		/* get out of loop if more than 1000 points */
> 		if (count == 5000) {
> 		  gdk_draw_points(
> 				  w_current->backingstore,
> 				  w_current->gc, points, count);
> 		  count=0;
> 		}
> 	      }
> 	    else
> 	      {
> 		gdk_draw_arc(w_current->backingstore, w_current->gc,
> 			     TRUE, x, y,
> 			     w_current->grid_dot_size,
> 			     w_current->grid_dot_size, 0, FULL_CIRCLE);
> 	      }
> 	  }
> 	}
>       }
>     
>   /* now draw all the points in one step */
>   if(count != 0) {
>     gdk_draw_points(w_current->backingstore,
>                     w_current->gc, points, count);
>   }
>     }
> 
>   count = 0;
>   incr *= 8; // draw major grid
149d204
< 


_______________________________________________
geda-dev mailing list
geda-dev@moria.seul.org
http://www.seul.org/cgi-bin/mailman/listinfo/geda-dev