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

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



The branch, master has been updated
       via  c9e069b19455c6e20b7988b86a4736f6ea0b1bc0 (commit)
      from  e97a3932e65e936d87f2eb59e3453a9ff4976501 (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/buffer.c |  152 +++++++++++++++++++++++++++++----------------------------
 1 files changed, 77 insertions(+), 75 deletions(-)


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

commit c9e069b19455c6e20b7988b86a4736f6ea0b1bc0
Author: DJ Delorie <dj@xxxxxxxxxxx>
Commit: DJ Delorie <dj@xxxxxxxxxxx>

    Support far-side polygons when converting buffer to element.

:100644 100644 4447c30... 4442bbb... M	src/buffer.c

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

commit c9e069b19455c6e20b7988b86a4736f6ea0b1bc0
Author: DJ Delorie <dj@xxxxxxxxxxx>
Commit: DJ Delorie <dj@xxxxxxxxxxx>

    Support far-side polygons when converting buffer to element.

diff --git a/src/buffer.c b/src/buffer.c
index 4447c30..4442bbb 100644
--- a/src/buffer.c
+++ b/src/buffer.c
@@ -1047,6 +1047,8 @@ ConvertBufferToElement (BufferTypePtr Buffer)
   Cardinal group;
   Cardinal pin_n = 1;
   bool hasParts = false, crooked = false;
+  int onsolder;
+  bool warned = false;
 
   if (Buffer->Data->pcb == 0)
     Buffer->Data->pcb = PCB;
@@ -1081,85 +1083,85 @@ ConvertBufferToElement (BufferTypePtr Buffer)
     hasParts = true;
   }
   END_LOOP;
-  /* get the component-side SM pads */
-  group = GetLayerGroupNumberByNumber (SWAP_IDENT ? solder_silk_layer :
-						    component_silk_layer);
-  GROUP_LOOP (Buffer->Data, group);
-  {
-    char num[8];
-    LINE_LOOP (layer);
-    {
-      sprintf (num, "%d", pin_n++);
-      CreateNewPad (Element, line->Point1.X,
-		    line->Point1.Y, line->Point2.X,
-		    line->Point2.Y, line->Thickness,
-		    line->Clearance,
-		    line->Thickness + line->Clearance, NULL,
-		    line->Number ? line->Number : num,
-		    MakeFlags (SWAP_IDENT ? ONSOLDERFLAG : NOFLAG));
-      hasParts = true;
-    }
-    END_LOOP;
-    POLYGON_LOOP (layer);
-    {
-      int x1, y1, x2, y2, w, h, t;
-
-      if (! polygon_is_rectangle (polygon))
-        {
-          crooked = true;
-	  continue;
-        }
-
-      w = polygon->Points[2].X - polygon->Points[0].X;
-      h = polygon->Points[1].Y - polygon->Points[0].Y;
-      t = (w < h) ? w : h;
-      x1 = polygon->Points[0].X + t/2;
-      y1 = polygon->Points[0].Y + t/2;
-      x2 = x1 + (w-t);
-      y2 = y1 + (h-t);
-
-      sprintf (num, "%d", pin_n++);
-      CreateNewPad (Element,
-		    x1, y1, x2, y2, t,
-		    2 * Settings.Keepaway,
-		    t + Settings.Keepaway,
-		    NULL, num,
-		    MakeFlags (SQUAREFLAG | (SWAP_IDENT ? ONSOLDERFLAG : NOFLAG)));
-      hasParts = true;
-    }
-    END_LOOP;
-  }
-  END_LOOP;
-  /* now get the opposite side pads */
-  group = GetLayerGroupNumberByNumber (SWAP_IDENT ? component_silk_layer :
-						    solder_silk_layer);
-  GROUP_LOOP (Buffer->Data, group);
-  {
-    bool warned = false;
-    char num[8];
-    LINE_LOOP (layer);
+
+  for (onsolder = 0; onsolder < 2; onsolder ++)
     {
-      sprintf (num, "%d", pin_n++);
-      CreateNewPad (Element, line->Point1.X,
-		    line->Point1.Y, line->Point2.X,
-		    line->Point2.Y, line->Thickness,
-		    line->Clearance,
-		    line->Thickness + line->Clearance, NULL,
-		    line->Number ? line->Number : num,
-		    MakeFlags (SWAP_IDENT ? NOFLAG : ONSOLDERFLAG));
-      if (!hasParts && !warned)
+      int silk_layer;
+      int onsolderflag;
+
+      if ((!onsolder) == (!SWAP_IDENT))
+	{
+	  silk_layer = component_silk_layer;
+	  onsolderflag = NOFLAG;
+	}
+      else
 	{
-	  warned = true;
-	  Message
-	    (_("Warning: All of the pads are on the opposite\n"
-	       "side from the component - that's probably not what\n"
-	       "you wanted\n"));
+	  silk_layer = solder_silk_layer;
+	  onsolderflag = ONSOLDERFLAG;
 	}
-      hasParts = true;
+
+#define MAYBE_WARN() \
+	  if (onsolder && !hasParts && !warned) \
+	    { \
+	      warned = true; \
+	      Message \
+		(_("Warning: All of the pads are on the opposite\n" \
+		   "side from the component - that's probably not what\n" \
+		   "you wanted\n")); \
+	    } \
+
+      /* get the component-side SM pads */
+      group = GetLayerGroupNumberByNumber (silk_layer);
+      GROUP_LOOP (Buffer->Data, group);
+      {
+	char num[8];
+	LINE_LOOP (layer);
+	{
+	  sprintf (num, "%d", pin_n++);
+	  CreateNewPad (Element, line->Point1.X,
+			line->Point1.Y, line->Point2.X,
+			line->Point2.Y, line->Thickness,
+			line->Clearance,
+			line->Thickness + line->Clearance, NULL,
+			line->Number ? line->Number : num,
+			MakeFlags (onsolderflag));
+	  MAYBE_WARN();
+	  hasParts = true;
+	}
+	END_LOOP;
+	POLYGON_LOOP (layer);
+	{
+	  int x1, y1, x2, y2, w, h, t;
+
+	  if (! polygon_is_rectangle (polygon))
+	    {
+	      crooked = true;
+	      continue;
+	    }
+
+	  w = polygon->Points[2].X - polygon->Points[0].X;
+	  h = polygon->Points[1].Y - polygon->Points[0].Y;
+	  t = (w < h) ? w : h;
+	  x1 = polygon->Points[0].X + t/2;
+	  y1 = polygon->Points[0].Y + t/2;
+	  x2 = x1 + (w-t);
+	  y2 = y1 + (h-t);
+
+	  sprintf (num, "%d", pin_n++);
+	  CreateNewPad (Element,
+			x1, y1, x2, y2, t,
+			2 * Settings.Keepaway,
+			t + Settings.Keepaway,
+			NULL, num,
+			MakeFlags (SQUAREFLAG | onsolderflag));
+	  MAYBE_WARN();
+	  hasParts = true;
+	}
+	END_LOOP;
+      }
+      END_LOOP;
     }
-    END_LOOP;
-  }
-  END_LOOP;
+
   /* now add the silkscreen. NOTE: elements must have pads or pins too */
   LINE_LOOP (&Buffer->Data->SILKLAYER);
   {




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