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

gEDA-cvs: gaf.git: branch: master updated (1.5.1-20081221-43-ge0e9e27)



The branch, master has been updated
       via  e0e9e2798cc4983bdf05a443ee0c3d64020e4da6 (commit)
       via  60460d8990af99999da2a611721bdb591a4723f4 (commit)
       via  2dc8887523ffe603c76849a8ca3cdee055d200ce (commit)
       via  f013cb1d70d868093ad9aa3ae1e38a5c9079ecc9 (commit)
       via  059f1be046494e1d1171953138f259b0af90409b (commit)
      from  e7d328775323dea2d82f9c22d431bf2740a90f97 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.


=========
 Summary
=========

 gschem/include/gschem_defines.h    |   11 ++-
 gschem/include/gschem_struct.h     |   11 +-
 gschem/include/i_vars.h            |    7 +-
 gschem/include/prototype.h         |    7 +-
 gschem/lib/gschem-colormap-darkbg  |    8 +-
 gschem/lib/gschem-colormap-lightbg |    8 +-
 gschem/lib/system-gschemrc.in      |   71 ++++++-----
 gschem/src/g_rc.c                  |   54 ++++++--
 gschem/src/g_register.c            |    7 +-
 gschem/src/gschem_toplevel.c       |    9 +-
 gschem/src/i_callbacks.c           |   16 ++-
 gschem/src/i_vars.c                |   16 ++-
 gschem/src/rcstrings.c             |    2 +-
 gschem/src/x_dialog.c              |    2 +-
 gschem/src/x_grid.c                |  238 ++++++++++++++++++++++++++---------
 libgeda/include/colors.h           |    4 +-
 libgeda/scheme/color-map.scm       |    4 +-
 libgeda/src/s_color.c              |    4 +-
 18 files changed, 331 insertions(+), 148 deletions(-)


=================
 Commit Messages
=================

commit 60460d8990af99999da2a611721bdb591a4723f4
Author: Peter Clifton <pcjc2@xxxxxxxxx>
Date:   Thu Dec 25 23:39:35 2008 +0000

    gschem: Change default grid to GRID_MESH to give it more exposure.
    
    This may be reverted later in the 1.5.x development series, depending on
    user preferences. For now, it is important to get this more testing.

:100644 100644 90eda97... 0bcf5ac... M	gschem/src/gschem_toplevel.c

commit 2dc8887523ffe603c76849a8ca3cdee055d200ce
Author: Peter Clifton <pcjc2@xxxxxxxxx>
Date:   Thu Dec 25 23:39:26 2008 +0000

    gschem: Change grid on/off to cycle through grid modes

:100644 100644 b13fb0d... 3f9d34c... M	gschem/lib/system-gschemrc.in
:100644 100644 e3023c4... 601b568... M	gschem/src/i_callbacks.c
:100644 100644 d797c2b... 514302e... M	gschem/src/rcstrings.c

commit f013cb1d70d868093ad9aa3ae1e38a5c9079ecc9
Author: Peter Clifton <pcjc2@xxxxxxxxx>
Date:   Thu Dec 25 22:08:49 2008 +0000

    gschem: Add a code to draw a mesh grid with major / minor lines.
    
    Adds new configuration option (mesh-grid-display-threshold {pixels}) which
    configures the minimum line pitch rendered before switching off the minor,
    then subsequently major grid lines.
    
    (NB: This grid mode is currently not accessible.)

:100644 100644 89cbf84... cd34528... M	gschem/include/gschem_defines.h
:100644 100644 21484cb... 3f6eb42... M	gschem/include/gschem_struct.h
:100644 100644 285b24d... b256a7d... M	gschem/include/i_vars.h
:100644 100644 4c61f53... 380beec... M	gschem/include/prototype.h
:100644 100644 3c96633... fe5b5f5... M	gschem/lib/gschem-colormap-darkbg
:100644 100644 d66ceec... b513c91... M	gschem/lib/gschem-colormap-lightbg
:100644 100644 8e47489... b13fb0d... M	gschem/lib/system-gschemrc.in
:100644 100644 aaf5909... 30cc44a... M	gschem/src/g_rc.c
:100644 100644 73552e3... 99145b3... M	gschem/src/g_register.c
:100644 100644 c049982... 90eda97... M	gschem/src/gschem_toplevel.c
:100644 100644 cd516ec... 16b221a... M	gschem/src/i_vars.c
:100644 100644 9d91f9d... 4406a7a... M	gschem/src/x_grid.c
:100644 100644 5461fa4... 4338412... M	libgeda/include/colors.h
:100644 100644 4f6336d... 3799930... M	libgeda/scheme/color-map.scm
:100644 100644 5dab437... 012731b... M	libgeda/src/s_color.c

commit 059f1be046494e1d1171953138f259b0af90409b
Author: Peter Clifton <pcjc2@xxxxxxxxx>
Date:   Thu Dec 25 21:25:16 2008 +0000

    gschem: Separate out dotted grid drawing and tidy up the code somewhat.
    
    Creates a separate static function for drawing the dotted style of grid,
    and a switch function to pick which grid drawing routine is in use, which
    is currently just dotted grids or nothing.
    
    Adds doxygen documentation for the grid drawing functions.
    
    Renames the "grid-color" colour map index and other dotted grid specific
    config parameters to prepend "dots-".

:100644 100644 c190518... 89cbf84... M	gschem/include/gschem_defines.h
:100644 100644 af40aa6... 21484cb... M	gschem/include/gschem_struct.h
:100644 100644 2a9b70d... 285b24d... M	gschem/include/i_vars.h
:100644 100644 624e392... 4c61f53... M	gschem/include/prototype.h
:100644 100644 b2a2eff... 3c96633... M	gschem/lib/gschem-colormap-darkbg
:100644 100644 7dce4f5... d66ceec... M	gschem/lib/gschem-colormap-lightbg
:100644 100644 dd1340d... 8e47489... M	gschem/lib/system-gschemrc.in
:100644 100644 6c84ed8... aaf5909... M	gschem/src/g_rc.c
:100644 100644 c304e34... 73552e3... M	gschem/src/g_register.c
:100644 100644 fc72529... c049982... M	gschem/src/gschem_toplevel.c
:100644 100644 ce44770... cd516ec... M	gschem/src/i_vars.c
:100644 100644 6a7ea86... b678a16... M	gschem/src/x_dialog.c
:100644 100644 976635c... 9d91f9d... M	gschem/src/x_grid.c
:100644 100644 e9a9bd6... 5461fa4... M	libgeda/include/colors.h
:100644 100644 a47ac01... 4f6336d... M	libgeda/scheme/color-map.scm
:100644 100644 4da5787... 5dab437... M	libgeda/src/s_color.c

=========
 Changes
=========

commit 60460d8990af99999da2a611721bdb591a4723f4
Author: Peter Clifton <pcjc2@xxxxxxxxx>
Date:   Thu Dec 25 23:39:35 2008 +0000

    gschem: Change default grid to GRID_MESH to give it more exposure.
    
    This may be reverted later in the 1.5.x development series, depending on
    user preferences. For now, it is important to get this more testing.

diff --git a/gschem/src/gschem_toplevel.c b/gschem/src/gschem_toplevel.c
index 90eda97..0bcf5ac 100644
--- a/gschem/src/gschem_toplevel.c
+++ b/gschem/src/gschem_toplevel.c
@@ -129,7 +129,7 @@ GSCHEM_TOPLEVEL *gschem_toplevel_new ()
   w_current->event_state = SELECT;
   w_current->image_width  = 0;
   w_current->image_height = 0;
-  w_current->grid = GRID_DOTS;
+  w_current->grid = GRID_MESH;
   w_current->min_zoom = 0;
   w_current->max_zoom = 8;
   w_current->text_alignment = 0;

commit 2dc8887523ffe603c76849a8ca3cdee055d200ce
Author: Peter Clifton <pcjc2@xxxxxxxxx>
Date:   Thu Dec 25 23:39:26 2008 +0000

    gschem: Change grid on/off to cycle through grid modes

diff --git a/gschem/lib/system-gschemrc.in b/gschem/lib/system-gschemrc.in
index b13fb0d..3f9d34c 100644
--- a/gschem/lib/system-gschemrc.in
+++ b/gschem/lib/system-gschemrc.in
@@ -1550,7 +1550,7 @@
 ;;          menu item name      menu action     	menu hotkey action
 ;;
 	'( ("Text Size..."	options-text-size       options-text-size)
-	   ("Toggle Grid On/Off" options-grid       	options-grid)
+	   ("Cycle grid styles"  options-grid           options-grid)
 	   ("Toggle Snap On/Off" options-snap       	options-snap)
 	   ("Snap Grid Spacing..." options-snap-size   	options-snap-size)
     	   ("Scale up Grid Spacing" options-scale-up-snap-size 
diff --git a/gschem/src/i_callbacks.c b/gschem/src/i_callbacks.c
index e3023c4..601b568 100644
--- a/gschem/src/i_callbacks.c
+++ b/gschem/src/i_callbacks.c
@@ -3327,12 +3327,16 @@ DEFINE_I_CALLBACK(options_grid)
 
   exit_if_null(w_current);
 
-  if (w_current->grid) {
-    w_current->grid = 0;
-    s_log_message(_("Grid OFF\n"));
-  } else {
-    w_current->grid = 1;
-    s_log_message(_("Grid ON\n"));
+  switch (w_current->grid) {
+    case GRID_NONE: w_current->grid = GRID_DOTS; break;
+    case GRID_DOTS: w_current->grid = GRID_MESH; break;
+    case GRID_MESH: w_current->grid = GRID_NONE; break;
+  }
+
+  switch (w_current->grid) {
+    case GRID_NONE: s_log_message (_("Grid OFF\n"));           break;
+    case GRID_DOTS: s_log_message (_("Dot grid selected\n"));  break;
+    case GRID_MESH: s_log_message (_("Mesh grid selected\n")); break;
   }
 
   o_invalidate_all (w_current);
diff --git a/gschem/src/rcstrings.c b/gschem/src/rcstrings.c
index d797c2b..514302e 100644
--- a/gschem/src/rcstrings.c
+++ b/gschem/src/rcstrings.c
@@ -111,7 +111,7 @@ _("Autonumber Text...")
 
 _("Options")
 _("Text Size...")
-_("Toggle Grid On/Off")
+_("Cycle grid styles")
 _("Toggle Snap On/Off")
 _("Snap Grid Spacing...")
 _("Scale up Grid Spacing")

commit f013cb1d70d868093ad9aa3ae1e38a5c9079ecc9
Author: Peter Clifton <pcjc2@xxxxxxxxx>
Date:   Thu Dec 25 22:08:49 2008 +0000

    gschem: Add a code to draw a mesh grid with major / minor lines.
    
    Adds new configuration option (mesh-grid-display-threshold {pixels}) which
    configures the minimum line pitch rendered before switching off the minor,
    then subsequently major grid lines.
    
    (NB: This grid mode is currently not accessible.)

diff --git a/gschem/include/gschem_defines.h b/gschem/include/gschem_defines.h
index 89cbf84..cd34528 100644
--- a/gschem/include/gschem_defines.h
+++ b/gschem/include/gschem_defines.h
@@ -94,6 +94,7 @@
 /* for grid */
 #define GRID_NONE               0
 #define GRID_DOTS               1
+#define GRID_MESH               2
 
 /* for dots_grid_mode */
 #define DOTS_GRID_VARIABLE_MODE 0
diff --git a/gschem/include/gschem_struct.h b/gschem/include/gschem_struct.h
index 21484cb..3f6eb42 100644
--- a/gschem/include/gschem_struct.h
+++ b/gschem/include/gschem_struct.h
@@ -184,6 +184,9 @@ struct st_gschem_toplevel {
   int dots_grid_dot_size; /* sets the grid dot size */
   int dots_grid_mode;     /* sets the mode of the dotted grid (either variable or fixed) */
 
+  /* Minimum grid line pitch to display. Applies to major and minor lines. */
+  int mesh_grid_display_threshold;
+
   /* sets the offset (in world coordinates) that are added to netname */
   /* attributes when they are attached to vertical or horizontal nets */
   int add_attribute_offset;
diff --git a/gschem/include/i_vars.h b/gschem/include/i_vars.h
index 285b24d..b256a7d 100644
--- a/gschem/include/i_vars.h
+++ b/gschem/include/i_vars.h
@@ -75,6 +75,7 @@ extern int default_force_boundingbox;
 extern int default_dots_grid_dot_size;
 extern int default_dots_grid_mode;
 extern int default_dots_grid_fixed_threshold;
+extern int default_mesh_grid_display_threshold;
 extern int default_print_vector_threshold;
 extern int default_add_attribute_offset;
 extern int default_auto_save_interval;
diff --git a/gschem/include/prototype.h b/gschem/include/prototype.h
index 4c61f53..380beec 100644
--- a/gschem/include/prototype.h
+++ b/gschem/include/prototype.h
@@ -257,6 +257,7 @@ SCM g_rc_force_boundingbox(SCM mode);
 SCM g_rc_dots_grid_dot_size(SCM dotsize);
 SCM g_rc_dots_grid_mode(SCM mode);
 SCM g_rc_dots_grid_fixed_threshold(SCM spacing);
+SCM g_rc_mesh_grid_display_threshold(SCM spacing);
 SCM g_rc_output_vector_threshold(SCM numlines);
 SCM g_rc_add_attribute_offset(SCM offset);
 SCM g_rc_auto_save_interval(SCM seconds);
diff --git a/gschem/lib/gschem-colormap-darkbg b/gschem/lib/gschem-colormap-darkbg
index 3c96633..fe5b5f5 100644
--- a/gschem/lib/gschem-colormap-darkbg
+++ b/gschem/lib/gschem-colormap-darkbg
@@ -23,6 +23,8 @@
    (attribute          "#ffff00")
    (logic-bubble       "#00ffff")
    (dots-grid          "#bebebe")
+   (mesh-grid-major    "#1e1e1e")
+   (mesh-grid-minor    "#171717")
    (detached-attribute "#ff0000")
    (text               "#00ff00")
    (bus                "#00ff00")
@@ -48,6 +50,8 @@
    (attribute          "#cdcd00")
    (logic-bubble       "#00cdcd")
    (dots-grid          #f)
+   (mesh-grid-major    #f)
+   (mesh-grid-minor    #f)
    (detached-attribute "#cd0000")
    (text               "#00cd00")
    (bus                "#00cd00")
diff --git a/gschem/lib/gschem-colormap-lightbg b/gschem/lib/gschem-colormap-lightbg
index d66ceec..b513c91 100644
--- a/gschem/lib/gschem-colormap-lightbg
+++ b/gschem/lib/gschem-colormap-lightbg
@@ -23,6 +23,8 @@
    (attribute          "#000000")
    (logic-bubble       "#008b8b")
    (dots-grid          "#7f7f7f")
+   (mesh-grid-major    "#e1e1e1")
+   (mesh-grid-minor    "#e9e9e9")
    (detached-attribute "#ff0000")
    (text               "#008b00")
    (bus                "#00ee00")
@@ -48,6 +50,8 @@
    (attribute          "#4d4d4d")
    (logic-bubble       "#008b8b")
    (dots-grid          #f)
+   (mesh-grid-major    #f)
+   (mesh-grid-minor    #f)
    (detached-attribute "#cd0000")
    (text               "#008b00")
    (bus                "#00cd00")
diff --git a/gschem/lib/system-gschemrc.in b/gschem/lib/system-gschemrc.in
index 8e47489..b13fb0d 100644
--- a/gschem/lib/system-gschemrc.in
+++ b/gschem/lib/system-gschemrc.in
@@ -810,6 +810,14 @@
 ;
 (dots-grid-fixed-threshold 10)
 
+; Mesh grid display threshold
+;
+; The mesh-grid-display-threshold specifies the minimum line pitch for a the
+; grid to be displayed. Using this parameter you can control maximum density
+; of the displayed before the minor, then major grid-lines are switched off.
+;
+(mesh-grid-display-threshold 3)
+
 ; force-boundingbox string
 ;
 ; Controls if the entire bounding box of a symbol is used when figuring out
diff --git a/gschem/src/g_rc.c b/gschem/src/g_rc.c
index aaf5909..30cc44a 100644
--- a/gschem/src/g_rc.c
+++ b/gschem/src/g_rc.c
@@ -1348,6 +1348,32 @@ SCM g_rc_dots_grid_fixed_threshold (SCM spacing)
   return SCM_BOOL_T;
 }
 
+
+/*! \todo Finish function documentation!!!
+ *  \brief
+ *  \par Function Description
+ *
+ */
+SCM g_rc_mesh_grid_display_threshold (SCM spacing)
+{
+  int val;
+
+  SCM_ASSERT (scm_is_integer (spacing), spacing, SCM_ARG1,
+              "mesh-grid-display-threshold");
+
+  val = scm_to_int (spacing);
+
+  if (val <= 0) {
+    fprintf (stderr, _("Invalid pixel spacing [%d] passed to "
+                       "mesh-grid-display-threshold\n"), val);
+    val = 3; /* absolute default */
+  }
+
+  default_mesh_grid_display_threshold = val;
+
+  return SCM_BOOL_T;
+}
+
 /*! \todo Finish function documentation!!!
  *  \brief
  *  \par Function Description
diff --git a/gschem/src/g_register.c b/gschem/src/g_register.c
index 73552e3..99145b3 100644
--- a/gschem/src/g_register.c
+++ b/gschem/src/g_register.c
@@ -129,6 +129,7 @@ static struct gsubr_t gschem_funcs[] = {
   { "dots-grid-dot-size",        1, 0, 0, g_rc_dots_grid_dot_size },
   { "dots-grid-mode",            1, 0, 0, g_rc_dots_grid_mode },
   { "dots-grid-fixed-threshold", 1, 0, 0, g_rc_dots_grid_fixed_threshold },
+  { "mesh-grid-display-threshold", 1, 0, 0, g_rc_mesh_grid_display_threshold },
   { "output-vector-threshold",   1, 0, 0, g_rc_output_vector_threshold },
   { "add-attribute-offset",      1, 0, 0, g_rc_add_attribute_offset },
   { "mousepan-gain",             1, 0, 0, g_rc_mousepan_gain },
diff --git a/gschem/src/gschem_toplevel.c b/gschem/src/gschem_toplevel.c
index c049982..90eda97 100644
--- a/gschem/src/gschem_toplevel.c
+++ b/gschem/src/gschem_toplevel.c
@@ -188,6 +188,7 @@ GSCHEM_TOPLEVEL *gschem_toplevel_new ()
   w_current->dots_grid_fixed_threshold = 10;
   w_current->dots_grid_dot_size = 1;
   w_current->dots_grid_mode = DOTS_GRID_VARIABLE_MODE;
+  w_current->mesh_grid_display_threshold = 3;
   w_current->add_attribute_offset = 50;
   w_current->drag_can_move = TRUE;
   w_current->mousepan_gain = 5;
diff --git a/gschem/src/i_vars.c b/gschem/src/i_vars.c
index cd516ec..16b221a 100644
--- a/gschem/src/i_vars.c
+++ b/gschem/src/i_vars.c
@@ -114,6 +114,7 @@ int   default_force_boundingbox = FALSE;
 int   default_dots_grid_dot_size = 1;
 int   default_dots_grid_mode = DOTS_GRID_VARIABLE_MODE;
 int   default_dots_grid_fixed_threshold = 10;
+int   default_mesh_grid_display_threshold = 3;
 int   default_print_vector_threshold = 3;
 int   default_add_attribute_offset = 50;
 
@@ -236,6 +237,7 @@ void i_vars_set(GSCHEM_TOPLEVEL *w_current)
   w_current->dots_grid_dot_size          = default_dots_grid_dot_size;
   w_current->dots_grid_mode              = default_dots_grid_mode;
   w_current->dots_grid_fixed_threshold   = default_dots_grid_fixed_threshold;
+  w_current->mesh_grid_display_threshold = default_mesh_grid_display_threshold;
 
   toplevel->print_vector_threshold  = default_print_vector_threshold;
   w_current->add_attribute_offset  = default_add_attribute_offset;
diff --git a/gschem/src/x_grid.c b/gschem/src/x_grid.c
index 9d91f9d..4406a7a 100644
--- a/gschem/src/x_grid.c
+++ b/gschem/src/x_grid.c
@@ -33,6 +33,8 @@
 #define DOTS_POINTS_ARRAY_SIZE       5000
 #define DOTS_VARIABLE_MODE_SPACING   30
 
+#define MESH_COARSE_GRID_MULTIPLIER  5
+
 
 /*! \brief Draw an area of the screen with a dotted grid pattern
  *
@@ -129,6 +131,106 @@ static void draw_dots_grid_region (GSCHEM_TOPLEVEL *w_current,
 }
 
 
+/*! \brief Helper function for draw_mesh_grid_regin
+ */
+static void draw_mesh (GSCHEM_TOPLEVEL *w_current, int color,
+                       int x_start, int y_start, int x_end, int y_end,
+                       int incr, int coarse_mult)
+{
+  TOPLEVEL *toplevel = w_current->toplevel;
+  int i, j;
+  int x1, y1, x2, y2;
+  int next_coarse_x, next_coarse_y;
+  int coarse_incr = incr * coarse_mult;
+
+  gdk_gc_set_foreground (w_current->gc, x_get_color (color));
+
+  /* figure starting grid coordinates, work by taking the start
+   * and end coordinates and rounding down to the nearest increment */
+  x_start -= (x_start % incr);
+  y_start -= (y_start % incr);
+
+  if (coarse_incr == 0) {
+    next_coarse_x = x_start - 1; /* Ensures we never hit this when looping */
+    next_coarse_y = y_start - 1; /* Ensures we never hit this when looping */
+  } else {
+    next_coarse_x = x_start - (x_start % coarse_incr);
+    next_coarse_y = y_start - (y_start % coarse_incr);
+    if (next_coarse_x < x_start) next_coarse_x += coarse_incr;
+    if (next_coarse_y < y_start) next_coarse_y += coarse_incr;
+  }
+
+  for (j = y_start; j < y_end; j = j + incr) {
+
+    /* Skip lines which will be drawn in the coarser grid */
+    if (j == next_coarse_y) {
+      next_coarse_y += coarse_incr;
+      continue;
+    }
+    WORLDtoSCREEN (toplevel, x_start, j, &x1, &y1);
+    WORLDtoSCREEN (toplevel, x_end,   j, &x2, &y2);
+    gdk_draw_line (w_current->drawable, w_current->gc, x1, y1, x2, y2);
+  }
+
+  for (i = x_start; i < x_end; i = i + incr) {
+
+    /* Skip lines which will be drawn in the coarser grid */
+    if (j == next_coarse_y) {
+      next_coarse_y += coarse_incr;
+      continue;
+    }
+    WORLDtoSCREEN (toplevel, i, y_start, &x1, &y1);
+    WORLDtoSCREEN (toplevel, i, y_end,   &x2, &y2);
+    gdk_draw_line (w_current->drawable, w_current->gc, x1, y1, x2, y2);
+  }
+}
+
+
+/*! \brief Draw an area of the screen with a mesh grid pattern
+ *
+ *  \par Function Description
+ *  Draws the mesh grid pattern over a given region of the screen.
+ *
+ *  \param [in] w_current  The GSCHEM_TOPLEVEL.
+ *  \param [in] x          The left screen coordinate for the drawing.
+ *  \param [in] y          The top screen coordinate for the drawing.
+ *  \param [in] width      The width of the region to draw.
+ *  \param [in] height     The height of the region to draw.
+ */
+static void draw_mesh_grid_region (GSCHEM_TOPLEVEL *w_current,
+                                   int x, int y, int width, int height)
+{
+  TOPLEVEL *toplevel = w_current->toplevel;
+  int x_start, y_start, x_end, y_end;
+  int incr;
+  int screen_incr;
+
+  incr = toplevel->snap_size;
+  screen_incr = SCREENabs (toplevel, incr);
+
+  /* update status bar */
+  i_set_grid (w_current, incr);
+
+  SCREENtoWORLD (toplevel, x - 1, y + height + 1, &x_start, &y_start);
+  SCREENtoWORLD (toplevel, x + width + 1, y - 1, &x_end, &y_end);
+
+  /* Draw the fine grid if its on-screen spacing is large enough */
+  if (screen_incr >= w_current->mesh_grid_display_threshold) {
+    draw_mesh (w_current, MESH_GRID_MINOR_COLOR, x_start, y_start,
+               x_end, y_end, incr, MESH_COARSE_GRID_MULTIPLIER);
+  }
+
+  incr *= MESH_COARSE_GRID_MULTIPLIER;
+  screen_incr = SCREENabs (toplevel, incr);
+
+  /* Draw the coarse grid if its on-screen spacing is large enough */
+  if (screen_incr >= w_current->mesh_grid_display_threshold) {
+    draw_mesh (w_current, MESH_GRID_MAJOR_COLOR,
+               x_start, y_start, x_end, y_end, incr, 0);
+  }
+}
+
+
 /*! \brief Draw an area of the screen with the current grid pattern.
  *
  *  \par Function Description
@@ -151,6 +253,10 @@ void x_grid_draw_region (GSCHEM_TOPLEVEL *w_current,
     case GRID_DOTS:
       draw_dots_grid_region (w_current, x, y, width, height);
       break;
+
+    case GRID_MESH:
+      draw_mesh_grid_region (w_current, x, y, width, height);
+      break;
   }
 
 #if DEBUG
diff --git a/libgeda/include/colors.h b/libgeda/include/colors.h
index 5461fa4..4338412 100644
--- a/libgeda/include/colors.h
+++ b/libgeda/include/colors.h
@@ -46,6 +46,8 @@
 #define FREESTYLE3_COLOR         	19     
 #define FREESTYLE4_COLOR         	20     
 #define JUNCTION_COLOR         		21     
+#define MESH_GRID_MAJOR_COLOR           22
+#define MESH_GRID_MINOR_COLOR           23
 
 #define OVERRIDE_NET_COLOR              4
 #define OVERRIDE_PIN_COLOR              1
diff --git a/libgeda/scheme/color-map.scm b/libgeda/scheme/color-map.scm
index 4f6336d..3799930 100644
--- a/libgeda/scheme/color-map.scm
+++ b/libgeda/scheme/color-map.scm
@@ -24,6 +24,8 @@
     (freestyle3 . 19)
     (freestyle4 . 20)
     (junction . 21)
+    (mesh-grid-major . 22)
+    (mesh-grid-minor . 23)
    ))
 
 ;; Look up the internal system ID for a symbolic color
diff --git a/libgeda/src/s_color.c b/libgeda/src/s_color.c
index 5dab437..012731b 100644
--- a/libgeda/src/s_color.c
+++ b/libgeda/src/s_color.c
@@ -62,6 +62,8 @@ static COLOR default_colors[] = {
   NOCOLOR,         /* 19: freestyle3         */
   NOCOLOR,         /* 20: freestyle4         */
   BLACK,           /* 21: junction           */
+  GRAY,            /* 22: mesh-grid-major    */
+  NOCOLOR,         /* 23: mesh-grid-minor    */
   ENDMAP
 };
 

commit 059f1be046494e1d1171953138f259b0af90409b
Author: Peter Clifton <pcjc2@xxxxxxxxx>
Date:   Thu Dec 25 21:25:16 2008 +0000

    gschem: Separate out dotted grid drawing and tidy up the code somewhat.
    
    Creates a separate static function for drawing the dotted style of grid,
    and a switch function to pick which grid drawing routine is in use, which
    is currently just dotted grids or nothing.
    
    Adds doxygen documentation for the grid drawing functions.
    
    Renames the "grid-color" colour map index and other dotted grid specific
    config parameters to prepend "dots-".

diff --git a/gschem/include/gschem_defines.h b/gschem/include/gschem_defines.h
index c190518..89cbf84 100644
--- a/gschem/include/gschem_defines.h
+++ b/gschem/include/gschem_defines.h
@@ -91,9 +91,13 @@
 #define SINGLE                  0
 #define MULTIPLE                1
 
-/* for grid_mode */
-#define GRID_VARIABLE_MODE	0
-#define GRID_FIXED_MODE		1
+/* for grid */
+#define GRID_NONE               0
+#define GRID_DOTS               1
+
+/* for dots_grid_mode */
+#define DOTS_GRID_VARIABLE_MODE 0
+#define DOTS_GRID_FIXED_MODE    1
 
 /* for log-window keyword */
 #define MAP_LATER		0
diff --git a/gschem/include/gschem_struct.h b/gschem/include/gschem_struct.h
index af40aa6..21484cb 100644
--- a/gschem/include/gschem_struct.h
+++ b/gschem/include/gschem_struct.h
@@ -111,7 +111,7 @@ struct st_gschem_toplevel {
   int num_untitled;                     /* keep track of untitled wins */
   int event_state;                      /* Current event state */
   int image_width, image_height;        /* h, w of image write */
-  int grid;                             /* Grid on/off*/
+  int grid;                             /* what type of grid to show */
   int min_zoom;                         /* minimum zoom factor */
   int max_zoom;                         /* maximum zoom factor */
   int text_alignment;                   /* current alignment of text */
@@ -176,13 +176,13 @@ struct st_gschem_toplevel {
   int bus_ripper_size;    /* sets size of the bus rippers */
   int bus_ripper_type;    /* sets type of the bus ripper (component or net) */
   int bus_ripper_rotation;  /* sets if the the bus ripper is symmetric or not */
-  int grid_dot_size;      /* sets the grid dot size */
-  int grid_mode;      /* sets the mode of the grid (either variable or fixed) */
   int magneticnet_mode; /* enables/disables the magnetic net mode ON/OFF */
 
   /* sets the mininum number of pixels necessary for the grid to be */
   /* displayed */
-  int grid_fixed_threshold;
+  int dots_grid_fixed_threshold;
+  int dots_grid_dot_size; /* sets the grid dot size */
+  int dots_grid_mode;     /* sets the mode of the dotted grid (either variable or fixed) */
 
   /* sets the offset (in world coordinates) that are added to netname */
   /* attributes when they are attached to vertical or horizontal nets */
diff --git a/gschem/include/i_vars.h b/gschem/include/i_vars.h
index 2a9b70d..285b24d 100644
--- a/gschem/include/i_vars.h
+++ b/gschem/include/i_vars.h
@@ -72,9 +72,9 @@ extern int default_bus_ripper_size;
 extern int default_bus_ripper_type;
 extern int default_bus_ripper_rotation;
 extern int default_force_boundingbox;
-extern int default_grid_dot_size;
-extern int default_grid_mode;
-extern int default_grid_fixed_threshold;
+extern int default_dots_grid_dot_size;
+extern int default_dots_grid_mode;
+extern int default_dots_grid_fixed_threshold;
 extern int default_print_vector_threshold;
 extern int default_add_attribute_offset;
 extern int default_auto_save_interval;
diff --git a/gschem/include/prototype.h b/gschem/include/prototype.h
index 624e392..4c61f53 100644
--- a/gschem/include/prototype.h
+++ b/gschem/include/prototype.h
@@ -254,9 +254,9 @@ SCM g_rc_bus_ripper_size(SCM size);
 SCM g_rc_bus_ripper_type(SCM mode);
 SCM g_rc_bus_ripper_rotation(SCM mode);
 SCM g_rc_force_boundingbox(SCM mode);
-SCM g_rc_grid_dot_size(SCM dotsize);
-SCM g_rc_grid_mode(SCM mode);
-SCM g_rc_grid_fixed_threshold(SCM spacing);
+SCM g_rc_dots_grid_dot_size(SCM dotsize);
+SCM g_rc_dots_grid_mode(SCM mode);
+SCM g_rc_dots_grid_fixed_threshold(SCM spacing);
 SCM g_rc_output_vector_threshold(SCM numlines);
 SCM g_rc_add_attribute_offset(SCM offset);
 SCM g_rc_auto_save_interval(SCM seconds);
diff --git a/gschem/lib/gschem-colormap-darkbg b/gschem/lib/gschem-colormap-darkbg
index b2a2eff..3c96633 100644
--- a/gschem/lib/gschem-colormap-darkbg
+++ b/gschem/lib/gschem-colormap-darkbg
@@ -22,7 +22,7 @@
    (net                "#0000ff")
    (attribute          "#ffff00")
    (logic-bubble       "#00ffff")
-   (grid               "#bebebe")
+   (dots-grid          "#bebebe")
    (detached-attribute "#ff0000")
    (text               "#00ff00")
    (bus                "#00ff00")
@@ -47,7 +47,7 @@
    (net                "#0000cd")
    (attribute          "#cdcd00")
    (logic-bubble       "#00cdcd")
-   (grid               #f)
+   (dots-grid          #f)
    (detached-attribute "#cd0000")
    (text               "#00cd00")
    (bus                "#00cd00")
diff --git a/gschem/lib/gschem-colormap-lightbg b/gschem/lib/gschem-colormap-lightbg
index 7dce4f5..d66ceec 100644
--- a/gschem/lib/gschem-colormap-lightbg
+++ b/gschem/lib/gschem-colormap-lightbg
@@ -22,7 +22,7 @@
    (net                "#0000ee")
    (attribute          "#000000")
    (logic-bubble       "#008b8b")
-   (grid               "#7f7f7f")
+   (dots-grid          "#7f7f7f")
    (detached-attribute "#ff0000")
    (text               "#008b00")
    (bus                "#00ee00")
@@ -47,7 +47,7 @@
    (net                "#0000cd")
    (attribute          "#4d4d4d")
    (logic-bubble       "#008b8b")
-   (grid               #f)
+   (dots-grid          #f)
    (detached-attribute "#cd0000")
    (text               "#008b00")
    (bus                "#00cd00")
diff --git a/gschem/lib/system-gschemrc.in b/gschem/lib/system-gschemrc.in
index dd1340d..8e47489 100644
--- a/gschem/lib/system-gschemrc.in
+++ b/gschem/lib/system-gschemrc.in
@@ -779,37 +779,36 @@
 ;(bus-ripper-size 200)
 ;(bus-ripper-type "net")
 
-; Grid dot size 
-;
-; The grid-dot-size keyword controls the size of the grid dots.  The units
-; are in pixels.  The default (min) value of 1 is the best performing as the
-; grid dot size is rendered as a single point and can be accelerated by 
-; the X server.  Values of 2 and 3 are good values to try if the default 
-; grid dot size is too small for your tastes.  Anything larger than 3 is 
-; probably too large.
-;
-(grid-dot-size 1)
-;(grid-dot-size 2)
-;(grid-dot-size 3)
-
-; Grid mode
-;
-; The grid-mode keyword controls the mode of the grid, either variable or 
-; fixed.  In the variable mode, the grid spacing changes depending
-; on the zoom factor.  In the fixed mode, the grid always represents
-; 100 units.  You can control the density of the grid using the 
-; grid-fixed-threshold.
-(grid-mode "variable")
-;(grid-mode "fixed")
-
-; Grid fixed threshold
-;
-; The grid-fixed-threshold specifies the minimum number of pixels needed
-; for the grid to be displayed.  Using this rc parameter you can control 
-; the density of the displayed grid (smaller numbers will cause the grid
-; to be drawn denser). This mode is only used when grid-mode is fixed.
-; 
-(grid-fixed-threshold 10)
+; Dots grid dot size
+;
+; The dots-grid-dot-size keyword controls the size of the grid dots in the
+; dots grid display. The units are in pixels. The default (min) value of 1
+; is the best performing as the grid dot size is rendered as a single pixel.
+; Values of 2 and 3 are good values to try if the default grid dot size is
+; too small for your tastes. Anything larger than 3 is probably too large.
+;
+(dots-grid-dot-size 1)
+;(dots-grid-dot-size 2)
+;(dots-grid-dot-size 3)
+
+; Dots grid mode
+;
+; The dots-grid-mode keyword controls the mode of the dotted grid, either
+; variable or fixed. In the variable mode, the grid spacing changes
+; depending on the zoom factor. In the fixed mode, the grid always
+; represents the same number of units as the snap-spacing. You can
+; control the density of the grid using the dots-grid-fixed-threshold.
+(dots-grid-mode "variable")
+;(dots-grid-mode "fixed")
+
+; Dots grid fixed threshold
+;
+; The dots-grid-fixed-threshold specifies the minimum number of pixels
+; grid-spacing for the grid to be displayed. Using this parameter you can
+; control thedensity of the displayed grid (smaller numbers will cause the
+; grid to be drawn denser). This mode is only used when grid-mode is fixed.
+;
+(dots-grid-fixed-threshold 10)
 
 ; force-boundingbox string
 ;
diff --git a/gschem/src/g_rc.c b/gschem/src/g_rc.c
index 6c84ed8..aaf5909 100644
--- a/gschem/src/g_rc.c
+++ b/gschem/src/g_rc.c
@@ -1288,21 +1288,21 @@ SCM g_rc_force_boundingbox(SCM mode)
  *  \par Function Description
  *
  */
-SCM g_rc_grid_dot_size(SCM dotsize)
+SCM g_rc_dots_grid_dot_size (SCM dotsize)
 {
   int val;
 
-  SCM_ASSERT (scm_is_integer (dotsize), dotsize, SCM_ARG1, "grid-dot-size");
+  SCM_ASSERT (scm_is_integer (dotsize), dotsize, SCM_ARG1, "dots-grid-dot-size");
   
   val = scm_to_int (dotsize);
 
   if (val <= 0) {
-    fprintf(stderr, _("Invalid dot size [%d] passed to grid-dot-size\n"),
+    fprintf(stderr, _("Invalid dot size [%d] passed to dots-grid-dot-size\n"),
             val);
     val = 1; /* absolute default */
   }
 
-  default_grid_dot_size = val;
+  default_dots_grid_dot_size = val;
 
   return SCM_BOOL_T;
 }
@@ -1312,16 +1312,16 @@ SCM g_rc_grid_dot_size(SCM dotsize)
  *  \par Function Description
  *
  */
-SCM g_rc_grid_mode(SCM mode)
+SCM g_rc_dots_grid_mode (SCM mode)
 {
   static const vstbl_entry mode_table[] = {
-    {GRID_VARIABLE_MODE,  "variable" },
-    {GRID_FIXED_MODE, "fixed"  }
+    {DOTS_GRID_VARIABLE_MODE, "variable" },
+    {DOTS_GRID_FIXED_MODE,    "fixed"  }
   };
 
-  RETURN_G_RC_MODE("grid-mode",
-		   default_grid_mode,
-		   2);
+  RETURN_G_RC_MODE ("dots-grid-mode",
+                    default_dots_grid_mode,
+                    2);
 }
 
 /*! \todo Finish function documentation!!!
@@ -1329,21 +1329,21 @@ SCM g_rc_grid_mode(SCM mode)
  *  \par Function Description
  *
  */
-SCM g_rc_grid_fixed_threshold(SCM spacing)
+SCM g_rc_dots_grid_fixed_threshold (SCM spacing)
 {
   int val;
 
-  SCM_ASSERT (scm_is_integer (spacing), spacing, SCM_ARG1, "grid-fixed-threshold");
+  SCM_ASSERT (scm_is_integer (spacing), spacing, SCM_ARG1, "dots-grid-fixed-threshold");
   
   val = scm_to_int (spacing);
 
   if (val <= 0) {
-    fprintf(stderr, _("Invalid pixel spacing [%d] passed to grid-fixed-threshold\n"),
+    fprintf(stderr, _("Invalid pixel spacing [%d] passed to dots-grid-fixed-threshold\n"),
             val);
     val = 10; /* absolute default */
   }
 
-  default_grid_fixed_threshold = val;
+  default_dots_grid_fixed_threshold = val;
 
   return SCM_BOOL_T;
 }
diff --git a/gschem/src/g_register.c b/gschem/src/g_register.c
index c304e34..73552e3 100644
--- a/gschem/src/g_register.c
+++ b/gschem/src/g_register.c
@@ -126,9 +126,9 @@ static struct gsubr_t gschem_funcs[] = {
   { "bus-ripper-type",           1, 0, 0, g_rc_bus_ripper_type },
   { "bus-ripper-rotation",       1, 0, 0, g_rc_bus_ripper_rotation },
   { "force-boundingbox",         1, 0, 0, g_rc_force_boundingbox },
-  { "grid-dot-size",             1, 0, 0, g_rc_grid_dot_size },
-  { "grid-mode",		 1, 0, 0, g_rc_grid_mode },
-  { "grid-fixed-threshold",   	 1, 0, 0, g_rc_grid_fixed_threshold },
+  { "dots-grid-dot-size",        1, 0, 0, g_rc_dots_grid_dot_size },
+  { "dots-grid-mode",            1, 0, 0, g_rc_dots_grid_mode },
+  { "dots-grid-fixed-threshold", 1, 0, 0, g_rc_dots_grid_fixed_threshold },
   { "output-vector-threshold",   1, 0, 0, g_rc_output_vector_threshold },
   { "add-attribute-offset",      1, 0, 0, g_rc_add_attribute_offset },
   { "mousepan-gain",             1, 0, 0, g_rc_mousepan_gain },
diff --git a/gschem/src/gschem_toplevel.c b/gschem/src/gschem_toplevel.c
index fc72529..c049982 100644
--- a/gschem/src/gschem_toplevel.c
+++ b/gschem/src/gschem_toplevel.c
@@ -129,7 +129,7 @@ GSCHEM_TOPLEVEL *gschem_toplevel_new ()
   w_current->event_state = SELECT;
   w_current->image_width  = 0;
   w_current->image_height = 0;
-  w_current->grid = 1;
+  w_current->grid = GRID_DOTS;
   w_current->min_zoom = 0;
   w_current->max_zoom = 8;
   w_current->text_alignment = 0;
@@ -184,10 +184,10 @@ GSCHEM_TOPLEVEL *gschem_toplevel_new ()
   w_current->bus_ripper_size = 0;
   w_current->bus_ripper_type = 0;
   w_current->bus_ripper_rotation = 0;
-  w_current->grid_dot_size = 1;
-  w_current->grid_mode = GRID_VARIABLE_MODE;
   w_current->magneticnet_mode = 0;
-  w_current->grid_fixed_threshold = 10;
+  w_current->dots_grid_fixed_threshold = 10;
+  w_current->dots_grid_dot_size = 1;
+  w_current->dots_grid_mode = DOTS_GRID_VARIABLE_MODE;
   w_current->add_attribute_offset = 50;
   w_current->drag_can_move = TRUE;
   w_current->mousepan_gain = 5;
diff --git a/gschem/src/i_vars.c b/gschem/src/i_vars.c
index ce44770..cd516ec 100644
--- a/gschem/src/i_vars.c
+++ b/gschem/src/i_vars.c
@@ -111,9 +111,9 @@ int   default_bus_ripper_size = 200;
 int   default_bus_ripper_type = COMP_BUS_RIPPER;
 int   default_bus_ripper_rotation = NON_SYMMETRIC;
 int   default_force_boundingbox = FALSE;
-int   default_grid_dot_size = 1;
-int   default_grid_mode = GRID_VARIABLE_MODE;
-int   default_grid_fixed_threshold = 10;
+int   default_dots_grid_dot_size = 1;
+int   default_dots_grid_mode = DOTS_GRID_VARIABLE_MODE;
+int   default_dots_grid_fixed_threshold = 10;
 int   default_print_vector_threshold = 3;
 int   default_add_attribute_offset = 50;
 
@@ -232,9 +232,11 @@ void i_vars_set(GSCHEM_TOPLEVEL *w_current)
   w_current->bus_ripper_rotation  = default_bus_ripper_rotation;
 
   toplevel->force_boundingbox  = default_force_boundingbox;
-  w_current->grid_dot_size  = default_grid_dot_size;
-  w_current->grid_mode  = default_grid_mode;
-  w_current->grid_fixed_threshold  = default_grid_fixed_threshold;
+
+  w_current->dots_grid_dot_size          = default_dots_grid_dot_size;
+  w_current->dots_grid_mode              = default_dots_grid_mode;
+  w_current->dots_grid_fixed_threshold   = default_dots_grid_fixed_threshold;
+
   toplevel->print_vector_threshold  = default_print_vector_threshold;
   w_current->add_attribute_offset  = default_add_attribute_offset;
 
diff --git a/gschem/src/x_dialog.c b/gschem/src/x_dialog.c
index 6a7ea86..b678a16 100644
--- a/gschem/src/x_dialog.c
+++ b/gschem/src/x_dialog.c
@@ -2207,7 +2207,7 @@ char *index2functionstring(int index)
     case(LOGIC_BUBBLE_COLOR):
       string = g_strdup (_("Logic bubble"));
       break;
-    case(GRID_COLOR):
+    case(DOTS_GRID_COLOR):
       string = g_strdup (_("Grid point"));
       break;
     case(DETACHED_ATTRIBUTE_COLOR):
diff --git a/gschem/src/x_grid.c b/gschem/src/x_grid.c
index 976635c..9d91f9d 100644
--- a/gschem/src/x_grid.c
+++ b/gschem/src/x_grid.c
@@ -30,70 +30,59 @@
 #include <dmalloc.h>
 #endif
 
-static GdkPoint points[5000];
+#define DOTS_POINTS_ARRAY_SIZE       5000
+#define DOTS_VARIABLE_MODE_SPACING   30
 
-/*! \todo Finish function documentation!!!
- *  \brief
+
+/*! \brief Draw an area of the screen with a dotted grid pattern
+ *
  *  \par Function Description
+ *  Draws the dotted grid pattern over a given region of the screen.
  *
+ *  \param [in] w_current  The GSCHEM_TOPLEVEL.
+ *  \param [in] x          The left screen coordinate for the drawing.
+ *  \param [in] y          The top screen coordinate for the drawing.
+ *  \param [in] width      The width of the region to draw.
+ *  \param [in] height     The height of the region to draw.
  */
-void x_grid_draw_region (GSCHEM_TOPLEVEL *w_current,
-                         int x, int y, int width, int height)
+static void draw_dots_grid_region (GSCHEM_TOPLEVEL *w_current,
+                                   int x, int y, int width, int height)
 {
   TOPLEVEL *toplevel = w_current->toplevel;
   int i, j;
   int dot_x, dot_y;
   int x_start, y_start, x_end, y_end;
   int count = 0;
+  GdkPoint points[DOTS_POINTS_ARRAY_SIZE];
 
-  int incr = 100;
-  int screen_incr = 0;
-
-  if (!w_current->grid) {
-    i_set_grid(w_current, -1);
-    return;
-  }
+  int incr;
+  int screen_incr;
 
-  if (w_current->grid_mode == GRID_VARIABLE_MODE)
-  {
-    /* In the variable mode around every 30th screenpixel will be grid-point */
+  if (w_current->dots_grid_mode == DOTS_GRID_VARIABLE_MODE) {
+    /* In the variable mode around every (DOTS_VARIABLE_MODE_SPACING)'th
+     * screenpixel will be grid-point. */
     /* adding 0.1 for correct cast*/
-    incr = round_5_2_1(toplevel->page_current->to_world_x_constant *30)+0.1;
+    incr = round_5_2_1 (toplevel->page_current->to_world_x_constant *
+                        DOTS_VARIABLE_MODE_SPACING) + 0.1;
 
-    /*limit grid to snap_size; only a idea of mine, hope you like it (hw) */
+    /* limit minimum grid spacing to grid to snap_size */
     if (incr < toplevel->snap_size) {
       incr = toplevel->snap_size;
     }
-    /* usually this should never happen */
-    if (incr < 1){
-      incr = 1;
-    }
-  }
-  else
-  {
+  } else {
+    /* Fixed size grid in world coorinates */
     incr = toplevel->snap_size;
-    screen_incr = SCREENabs(toplevel, incr);
-    if (screen_incr < w_current->grid_fixed_threshold)
-    {
-      /* don't draw the grid if the screen incr spacing is less than the */
-      /* threshold */
+    screen_incr = SCREENabs (toplevel, incr);
+    if (screen_incr < w_current->dots_grid_fixed_threshold) {
+      /* don't draw the grid if the on-screen spacing is less than the threshold */
       return;
     }
   }
-  
-  /* update status bar */
-  i_set_grid(w_current, incr);
-
-#if DEBUG 
-  printf("---------x_grid_draw\n incr: %d\n",incr);
 
-  printf("x1 %d\n", pix_x(w_current, 100));
-  printf("x2 %d\n", pix_x(w_current, 200));
-  printf("y1 %d\n", pix_y(w_current, 100));
-  printf("y2 %d\n", pix_y(w_current, 200));
-#endif
+  /* update status bar */
+  i_set_grid (w_current, incr);
 
-  gdk_gc_set_foreground(w_current->gc, x_get_color (GRID_COLOR));
+  gdk_gc_set_foreground (w_current->gc, x_get_color (DOTS_GRID_COLOR));
 
   SCREENtoWORLD (toplevel, x - 1, y + height + 1, &x_start, &y_start);
   SCREENtoWORLD (toplevel, x + width + 1, y - 1, &x_end, &y_end);
@@ -106,32 +95,28 @@ void x_grid_draw_region (GSCHEM_TOPLEVEL *w_current,
 
   for (i = x_start; i <= x_end; i = i + incr) {
     for(j = y_start; j <= y_end; j = j + incr) {
-      WORLDtoSCREEN(toplevel, i,j, &dot_x, &dot_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)
-        {
+      WORLDtoSCREEN (toplevel, i,j, &dot_x, &dot_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->dots_grid_dot_size == 1) {
           points[count].x = dot_x;
           points[count].y = dot_y;
           count++;
 
-          /* get out of loop if more than 1000 points */
-          if (count == 5000) {
+          /* get out of loop if we're hit the end of the array */
+          if (count == DOTS_POINTS_ARRAY_SIZE) {
             gdk_draw_points (w_current->drawable,
                              w_current->gc, points, count);
-            count=0;
+            count = 0;
           }
-        }
-        else
-        {
+        } else {
           gdk_draw_arc (w_current->drawable, w_current->gc,
                         TRUE, dot_x, dot_y,
-                        w_current->grid_dot_size,
-                        w_current->grid_dot_size, 0, FULL_CIRCLE);
+                        w_current->dots_grid_dot_size,
+                        w_current->dots_grid_dot_size, 0, FULL_CIRCLE);
         }
       }
     }
@@ -139,14 +124,39 @@ void x_grid_draw_region (GSCHEM_TOPLEVEL *w_current,
 
   /* now draw all the points in one step */
   if(count != 0) {
-    gdk_draw_points (w_current->drawable,
-                     w_current->gc, points, count);
+    gdk_draw_points (w_current->drawable, w_current->gc, points, count);
+  }
+}
+
+
+/*! \brief Draw an area of the screen with the current grid pattern.
+ *
+ *  \par Function Description
+ *  Draws the desired grid pattern over a given region of the screen.
+ *
+ *  \param [in] w_current  The GSCHEM_TOPLEVEL.
+ *  \param [in] x          The left screen coordinate for the drawing.
+ *  \param [in] y          The top screen coordinate for the drawing.
+ *  \param [in] width      The width of the region to draw.
+ *  \param [in] height     The height of the region to draw.
+ */
+void x_grid_draw_region (GSCHEM_TOPLEVEL *w_current,
+                         int x, int y, int width, int height)
+{
+  switch (w_current->grid) {
+    case GRID_NONE:
+      i_set_grid(w_current, -1);
+      return;
+
+    case GRID_DOTS:
+      draw_dots_grid_region (w_current, x, y, width, height);
+      break;
   }
 
 #if DEBUG
   /* highly temp, just for diag purposes */
   x_draw_tiles(w_current);
-#endif        
+#endif
 }
 
 /*! \todo Finish function documentation!!!
diff --git a/libgeda/include/colors.h b/libgeda/include/colors.h
index e9a9bd6..5461fa4 100644
--- a/libgeda/include/colors.h
+++ b/libgeda/include/colors.h
@@ -31,7 +31,7 @@
 #define NET_COLOR                       4
 #define ATTRIBUTE_COLOR                 5
 #define LOGIC_BUBBLE_COLOR              6
-#define GRID_COLOR                      7
+#define DOTS_GRID_COLOR                 7
 #define DETACHED_ATTRIBUTE_COLOR        8
 #define TEXT_COLOR                      9
 #define BUS_COLOR                       10
diff --git a/libgeda/scheme/color-map.scm b/libgeda/scheme/color-map.scm
index a47ac01..4f6336d 100644
--- a/libgeda/scheme/color-map.scm
+++ b/libgeda/scheme/color-map.scm
@@ -9,7 +9,7 @@
     (net . 4)
     (attribute . 5)
     (logic-bubble . 6)
-    (grid . 7)
+    (dots-grid . 7)
     (detached-attribute . 8)
     (text . 9)
     (bus . 10)
diff --git a/libgeda/src/s_color.c b/libgeda/src/s_color.c
index 4da5787..5dab437 100644
--- a/libgeda/src/s_color.c
+++ b/libgeda/src/s_color.c
@@ -47,7 +47,7 @@ static COLOR default_colors[] = {
   BLACK,           /*  4: net                */
   BLACK,           /*  5: attribute          */
   BLACK,           /*  6: logic-bubble       */
-  BLACK,           /*  7: grid               */
+  BLACK,           /*  7: dots-grid          */
   BLACK,           /*  8: detached-attribute */
   BLACK,           /*  9: text               */
   BLACK,           /* 10: bus                */




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