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

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



The branch, master has been updated
       via  cbd7c001aa130c53bf04396d347b32f9d6bb9034 (commit)
       via  ff9d14d989e2ca192e17a603e929e6a81b394486 (commit)
      from  27a0dc452f95d5bcc4355b8ad674ec1c0291d2eb (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 |  122 +++++++++++++++++++----------------------------------------
 1 files changed, 39 insertions(+), 83 deletions(-)


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

commit cbd7c001aa130c53bf04396d347b32f9d6bb9034
Author: Peter Clifton <pcjc2@xxxxxxxxx>
Commit: Peter Clifton <pcjc2@xxxxxxxxx>

    draw.c: Add layer side parameter to DrawMask()
    
    Don't use the global variable SWAP_IDENT to choose which side to draw.

:100644 100644 ed798cc... 8178e81... M	src/draw.c

commit ff9d14d989e2ca192e17a603e929e6a81b394486
Author: Peter Clifton <pcjc2@xxxxxxxxx>
Commit: Peter Clifton <pcjc2@xxxxxxxxx>

    draw.c: Combine front and back element and name callbacks
    
    Pass an integer "side" parameter to determine which is desired

:100644 100644 665bf0c... ed798cc... M	src/draw.c

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

commit cbd7c001aa130c53bf04396d347b32f9d6bb9034
Author: Peter Clifton <pcjc2@xxxxxxxxx>
Commit: Peter Clifton <pcjc2@xxxxxxxxx>

    draw.c: Add layer side parameter to DrawMask()
    
    Don't use the global variable SWAP_IDENT to choose which side to draw.

diff --git a/src/draw.c b/src/draw.c
index ed798cc..8178e81 100644
--- a/src/draw.c
+++ b/src/draw.c
@@ -102,7 +102,7 @@ static void SetPVColor (PinTypePtr, int);
 static void DrawEMark (ElementTypePtr, LocationType, LocationType, bool);
 static void ClearPad (PadTypePtr, bool);
 static void DrawHole (PinTypePtr);
-static void DrawMask (BoxType *);
+static void DrawMask (int side, BoxType *);
 static void DrawRats (BoxType *);
 static void DrawSilk (int, int, const BoxType *);
 static int pin_callback (const BoxType * b, void *cl);
@@ -440,19 +440,11 @@ DrawEverything (BoxTypePtr drawn_area)
     }
   /* Draw the solder mask if turned on */
   if (gui->set_layer ("componentmask", SL (MASK, TOP), 0))
-    {
-      int save_swap = SWAP_IDENT;
-      SWAP_IDENT = 0;
-      DrawMask (drawn_area);
-      SWAP_IDENT = save_swap;
-    }
+    DrawMask (COMPONENT_LAYER, drawn_area);
+
   if (gui->set_layer ("soldermask", SL (MASK, BOTTOM), 0))
-    {
-      int save_swap = SWAP_IDENT;
-      SWAP_IDENT = 1;
-      DrawMask (drawn_area);
-      SWAP_IDENT = save_swap;
-    }
+    DrawMask (SOLDER_LAYER, drawn_area);
+
   /* Draw top silkscreen */
   if (gui->set_layer ("topsilk", SL (SILK, TOP), 0))
     DrawSilk (0, component_silk_layer, drawn_area);
@@ -629,7 +621,8 @@ static int
 clearPad_callback (const BoxType * b, void *cl)
 {
   PadTypePtr pad = (PadTypePtr) b;
-  if (!XOR (TEST_FLAG (ONSOLDERFLAG, pad), SWAP_IDENT) && pad->Mask)
+  int *side = cl;
+  if (ON_SIDE (pad, side) && pad->Mask)
     ClearPad (pad, true);
   return 1;
 }
@@ -647,8 +640,6 @@ DrawSilk (int new_swap, int layer, const BoxType * drawn_area)
      pins and pads.  We decided it was a bad idea to do this
      unconditionally, but the code remains.  */
 #endif
-  int save_swap = SWAP_IDENT;
-  SWAP_IDENT = new_swap;
 
 #if 0
   if (gui->poly_before)
@@ -665,7 +656,7 @@ DrawSilk (int new_swap, int layer, const BoxType * drawn_area)
   gui->use_mask (HID_MASK_CLEAR);
   r_search (PCB->Data->pin_tree, drawn_area, NULL, clearPin_callback, NULL);
   r_search (PCB->Data->via_tree, drawn_area, NULL, clearPin_callback, NULL);
-  r_search (PCB->Data->pad_tree, drawn_area, NULL, clearPad_callback, NULL);
+  r_search (PCB->Data->pad_tree, drawn_area, NULL, clearPad_callback, &side);
 
   if (gui->poly_after)
     {
@@ -677,7 +668,6 @@ DrawSilk (int new_swap, int layer, const BoxType * drawn_area)
     }
   gui->use_mask (HID_MASK_OFF);
 #endif
-  SWAP_IDENT = save_swap;
 }
 
 
@@ -702,7 +692,7 @@ DrawMaskBoardArea (int mask_type, BoxType *screen)
  * draws solder mask layer - this will cover nearly everything
  */
 static void
-DrawMask (BoxType * screen)
+DrawMask (int side, BoxType * screen)
 {
   int thin = TEST_FLAG(THINDRAWFLAG, PCB) || TEST_FLAG(THINDRAWPOLYFLAG, PCB);
 
@@ -716,7 +706,7 @@ DrawMask (BoxType * screen)
 
   r_search (PCB->Data->pin_tree, screen, NULL, clearPin_callback, NULL);
   r_search (PCB->Data->via_tree, screen, NULL, clearPin_callback, NULL);
-  r_search (PCB->Data->pad_tree, screen, NULL, clearPad_callback, NULL);
+  r_search (PCB->Data->pad_tree, screen, NULL, clearPad_callback, &side);
 
   if (thin)
     gui->set_color (Output.pmGC, "erase");

commit ff9d14d989e2ca192e17a603e929e6a81b394486
Author: Peter Clifton <pcjc2@xxxxxxxxx>
Commit: Peter Clifton <pcjc2@xxxxxxxxx>

    draw.c: Combine front and back element and name callbacks
    
    Pass an integer "side" parameter to determine which is desired

diff --git a/src/draw.c b/src/draw.c
index 665bf0c..ed798cc 100644
--- a/src/draw.c
+++ b/src/draw.c
@@ -66,6 +66,7 @@ RCSID ("$Id$");
 #define	LARGE_TEXT_SIZE			3
 #define	N_TEXT_SIZES			4
 
+#define ON_SIDE(element, side) (TEST_FLAG (ONSOLDERFLAG, element) == (*side == SOLDER_LAYER))
 
 /* ---------------------------------------------------------------------------
  * some local identifiers
@@ -229,51 +230,32 @@ Redraw (bool ClearWindow, BoxTypePtr screen_area)
 }
 
 static int
-backE_callback (const BoxType * b, void *cl)
+element_callback (const BoxType * b, void *cl)
 {
   ElementTypePtr element = (ElementTypePtr) b;
+  int *side = cl;
 
-  if (!FRONT (element))
-    {
-      DrawElementPackage (element);
-    }
+  if (ON_SIDE (element, side))
+    DrawElementPackage (element);
   return 1;
 }
 
 static int
-backN_callback (const BoxType * b, void *cl)
+name_callback (const BoxType * b, void *cl)
 {
   TextTypePtr text = (TextTypePtr) b;
   ElementTypePtr element = (ElementTypePtr) text->Element;
+  int *side = cl;
 
-  if (!FRONT (element) && !TEST_FLAG (HIDENAMEFLAG, element))
+  if (TEST_FLAG (HIDENAMEFLAG, element))
+    return 0;
+
+  if (ON_SIDE (element, side))
     DrawElementName (element);
   return 0;
 }
 
 static int
-backPad_callback (const BoxType * b, void *cl)
-{
-  PadTypePtr pad = (PadTypePtr) b;
-
-  if (!FRONT (pad))
-    DrawPad (pad);
-  return 1;
-}
-
-static int
-frontE_callback (const BoxType * b, void *cl)
-{
-  ElementTypePtr element = (ElementTypePtr) b;
-
-  if (FRONT (element))
-    {
-      DrawElementPackage (element);
-    }
-  return 1;
-}
-
-static int
 EMark_callback (const BoxType * b, void *cl)
 {
   ElementTypePtr element = (ElementTypePtr) b;
@@ -283,17 +265,6 @@ EMark_callback (const BoxType * b, void *cl)
 }
 
 static int
-frontN_callback (const BoxType * b, void *cl)
-{
-  TextTypePtr text = (TextTypePtr) b;
-  ElementTypePtr element = (ElementTypePtr) text->Element;
-
-  if (FRONT (element) && !TEST_FLAG (HIDENAMEFLAG, element))
-    DrawElementName (element);
-  return 0;
-}
-
-static int
 hole_callback (const BoxType * b, void *cl)
 {
   PinTypePtr pin = (PinTypePtr) b;
@@ -392,15 +363,13 @@ DrawEverything (BoxTypePtr drawn_area)
   if (!TEST_FLAG (CHECKPLANESFLAG, PCB)
       && gui->set_layer ("invisible", SL (INVISIBLE, 0), 0))
     {
-      r_search (PCB->Data->pad_tree, drawn_area, NULL, backPad_callback,
-		NULL);
+      side = SWAP_IDENT ? COMPONENT_LAYER : SOLDER_LAYER;
+      r_search (PCB->Data->pad_tree, drawn_area, NULL, pad_callback, &side);
       if (PCB->ElementOn)
 	{
-	  r_search (PCB->Data->element_tree, drawn_area, NULL, backE_callback,
-		    NULL);
-	  r_search (PCB->Data->name_tree[NAME_INDEX (PCB)], drawn_area, NULL,
-		    backN_callback, NULL);
-	  DrawLayer (&(PCB->Data->BACKSILKLAYER), drawn_area);
+	  r_search (PCB->Data->element_tree, drawn_area, NULL, element_callback, &side);
+	  r_search (PCB->Data->name_tree[NAME_INDEX (PCB)], drawn_area, NULL, name_callback, &side);
+	  DrawLayer (&(PCB->Data->Layer[max_copper_layer + side]), drawn_area);
 	}
     }
 
@@ -413,8 +382,6 @@ DrawEverything (BoxTypePtr drawn_area)
 	{
 	  if (DrawLayerGroup (group, drawn_area) && !gui->gui)
 	    {
-	      int save_swap = SWAP_IDENT;
-
 	      if (TEST_FLAG (CHECKPLANESFLAG, PCB) && gui->gui)
 		continue;
 	      r_search (PCB->Data->pin_tree, drawn_area, NULL, pin_callback,
@@ -424,11 +391,9 @@ DrawEverything (BoxTypePtr drawn_area)
 	      /* draw element pads */
 	      if (group == component || group == solder)
 		{
-		  SWAP_IDENT = (group == solder);
-		  r_search (PCB->Data->pad_tree, drawn_area, NULL,
-			    pad_callback, NULL);
+                  side = (group == solder) ? SOLDER_LAYER : COMPONENT_LAYER;
+		  r_search (PCB->Data->pad_tree, drawn_area, NULL, pad_callback, &side);
 		}
-	      SWAP_IDENT = save_swap;
 
 	      if (!gui->gui)
 		{
@@ -609,7 +574,9 @@ static int
 pad_callback (const BoxType * b, void *cl)
 {
   PadTypePtr pad = (PadTypePtr) b;
-  if (FRONT (pad))
+  int *side = cl;
+
+  if (TEST_FLAG (ONSOLDERFLAG, pad) == (*side == SOLDER_LAYER))
     DrawPad (pad);
   return 1;
 }
@@ -620,12 +587,14 @@ pad_callback (const BoxType * b, void *cl)
 static void
 DrawTop (const BoxType * screen)
 {
+  int side = SWAP_IDENT ? SOLDER_LAYER : COMPONENT_LAYER;
+
   if (PCB->PinOn || doing_assy)
     {
       /* draw element pins */
       r_search (PCB->Data->pin_tree, screen, NULL, pin_callback, NULL);
       /* draw element pads */
-      r_search (PCB->Data->pad_tree, screen, NULL, pad_callback, NULL);
+      r_search (PCB->Data->pad_tree, screen, NULL, pad_callback, &side);
     }
   /* draw vias */
   if (PCB->ViaOn || doing_assy)
@@ -672,6 +641,7 @@ clearPad_callback (const BoxType * b, void *cl)
 static void
 DrawSilk (int new_swap, int layer, const BoxType * drawn_area)
 {
+  int side = new_swap ? SOLDER_LAYER : COMPONENT_LAYER;
 #if 0
   /* This code is used when you want to mask silk to avoid exposed
      pins and pads.  We decided it was a bad idea to do this
@@ -687,10 +657,8 @@ DrawSilk (int new_swap, int layer, const BoxType * drawn_area)
 #endif
       DrawLayer (LAYER_PTR (layer), drawn_area);
       /* draw package */
-      r_search (PCB->Data->element_tree, drawn_area, NULL, frontE_callback,
-		NULL);
-      r_search (PCB->Data->name_tree[NAME_INDEX (PCB)], drawn_area, NULL,
-		frontN_callback, NULL);
+      r_search (PCB->Data->element_tree, drawn_area, NULL, element_callback, &side);
+      r_search (PCB->Data->name_tree[NAME_INDEX (PCB)], drawn_area, NULL, name_callback, &side);
 #if 0
     }
 
@@ -704,10 +672,8 @@ DrawSilk (int new_swap, int layer, const BoxType * drawn_area)
       gui->use_mask (HID_MASK_AFTER);
       DrawLayer (LAYER_PTR (max_copper_layer + layer), drawn_area);
       /* draw package */
-      r_search (PCB->Data->element_tree, drawn_area, NULL, frontE_callback,
-		NULL);
-      r_search (PCB->Data->name_tree[NAME_INDEX (PCB)], drawn_area, NULL,
-		frontN_callback, NULL);
+      r_search (PCB->Data->element_tree, drawn_area, NULL, element_callback, &side);
+      r_search (PCB->Data->name_tree[NAME_INDEX (PCB)], drawn_area, NULL, name_callback, &side);
     }
   gui->use_mask (HID_MASK_OFF);
 #endif




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