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

gEDA-cvs: pcb.git: branch: master updated (5d39ef90df7568517bccefde13156ec794ee661e)



The branch, master has been updated
       via  5d39ef90df7568517bccefde13156ec794ee661e (commit)
      from  9d4af8a46e33e5657abb5e3f70e2f353eda5a2bf (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
=========

 src/draw.c |   56 +++++++++++++++++++++++++++++++++-----------------------
 1 files changed, 33 insertions(+), 23 deletions(-)


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

commit 5d39ef90df7568517bccefde13156ec794ee661e
Author: Peter Clifton <pcjc2@xxxxxxxxx>
Commit: Peter Clifton <pcjc2@xxxxxxxxx>

    draw.c: Separate out common code for drawing holes
    
    Makes things a bit clearer

:100644 100644 d3bc398... 4a8de5f... M	src/draw.c

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

commit 5d39ef90df7568517bccefde13156ec794ee661e
Author: Peter Clifton <pcjc2@xxxxxxxxx>
Commit: Peter Clifton <pcjc2@xxxxxxxxx>

    draw.c: Separate out common code for drawing holes
    
    Makes things a bit clearer

diff --git a/src/draw.c b/src/draw.c
index d3bc398..4a8de5f 100644
--- a/src/draw.c
+++ b/src/draw.c
@@ -449,6 +449,18 @@ hole_callback (const BoxType * b, void *cl)
   return 1;
 }
 
+static void
+DrawHoles (bool draw_plated, bool draw_unplated, BoxType *drawn_area)
+{
+  int plated = -1;
+
+  if ( draw_plated && !draw_unplated) plated = 1;
+  if (!draw_plated &&  draw_unplated) plated = 0;
+
+  r_search (PCB->Data->pin_tree, drawn_area, NULL, hole_callback, &plated);
+  r_search (PCB->Data->via_tree, drawn_area, NULL, hole_callback, &plated);
+}
+
 typedef struct
 {
   int nplated;
@@ -468,6 +480,18 @@ hole_counting_callback (const BoxType * b, void *cl)
 }
 
 static void
+CountHoles (int *plated, int *unplated, BoxType *drawn_area)
+{
+  HoleCountStruct hcs = {0, 0};
+
+  r_search (PCB->Data->pin_tree, drawn_area, NULL, hole_counting_callback, &hcs);
+  r_search (PCB->Data->via_tree, drawn_area, NULL, hole_counting_callback, &hcs);
+
+  if (plated != NULL) *plated = hcs.nplated;
+  if (unplated != NULL) *unplated = hcs.nunplated;
+}
+
+static void
 _draw_line (LineType *line)
 {
   gui->set_line_cap (Output.fgGC, Trace_Cap);
@@ -638,12 +662,12 @@ static void
 DrawEverything (BoxTypePtr drawn_area)
 {
   int i, ngroups, side;
-  int plated;
   int component, solder;
   /* This is the list of layer groups we will draw.  */
   int do_group[MAX_LAYER];
   /* This is the reverse of the order in which we draw them.  */
   int drawn_groups[MAX_LAYER];
+  int plated, unplated;
   bool paste_empty;
 
   PCB->Data->SILKLAYER.Color = PCB->ElementColor;
@@ -698,29 +722,15 @@ DrawEverything (BoxTypePtr drawn_area)
     DrawPPV (SWAP_IDENT ? solder : component, drawn_area);
   else
     {
-      HoleCountStruct hcs;
-      hcs.nplated = hcs.nunplated = 0;
-      r_search (PCB->Data->pin_tree, drawn_area, NULL, hole_counting_callback,
-		&hcs);
-      r_search (PCB->Data->via_tree, drawn_area, NULL, hole_counting_callback,
-		&hcs);
-      if (hcs.nplated && gui->set_layer ("plated-drill", SL (PDRILL, 0), 0))
-	{
-	  plated = 1;
-	  r_search (PCB->Data->pin_tree, drawn_area, NULL, hole_callback,
-		    &plated);
-	  r_search (PCB->Data->via_tree, drawn_area, NULL, hole_callback,
-		    &plated);
-	}
-      if (hcs.nunplated && gui->set_layer ("unplated-drill", SL (UDRILL, 0), 0))
-	{
-	  plated = 0;
-	  r_search (PCB->Data->pin_tree, drawn_area, NULL, hole_callback,
-		    &plated);
-	  r_search (PCB->Data->via_tree, drawn_area, NULL, hole_callback,
-		    &plated);
-	}
+      CountHoles (&plated, &unplated, drawn_area);
+
+      if (plated && gui->set_layer ("plated-drill", SL (PDRILL, 0), 0))
+        DrawHoles (true, false, drawn_area);
+
+      if (unplated && gui->set_layer ("unplated-drill", SL (PDRILL, 0), 0))
+        DrawHoles (false, true, drawn_area);
     }
+
   /* Draw the solder mask if turned on */
   if (gui->set_layer ("componentmask", SL (MASK, TOP), 0))
     DrawMask (COMPONENT_LAYER, drawn_area);




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