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

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



The branch, master has been updated
       via  5f82d26c2f66fe8ed772077b5675d15978565f69 (commit)
       via  6eeed5e36bd59a70eccbfe41bfc1ee2e01ec0637 (commit)
       via  da75262390e3f9c7097a4a7a377d646d394230a5 (commit)
      from  4efcedeeac06cd4d5e559a7fe0a0ee8685f2137a (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/crosshair.c               |   71 +++++++------
 src/draw.c                    |  224 ++--------------------------------------
 src/global.h                  |    5 +-
 src/hid.h                     |    2 +
 src/hid/common/draw_helpers.c |  164 ++++++++++++++++++++++++++++++
 src/hid/common/draw_helpers.h |    2 +
 src/hid/common/hidnogui.c     |   16 +++
 7 files changed, 239 insertions(+), 245 deletions(-)


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

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

    hid/common: Draw the hole outline for pins / vias being moved or placed

:100644 100644 14b6491... 054610b... M	src/crosshair.c

commit 6eeed5e36bd59a70eccbfe41bfc1ee2e01ec0637
Author: Peter Clifton <pcjc2@xxxxxxxxx>
Commit: Peter Clifton <pcjc2@xxxxxxxxx>

    crosshair.c: Use a dummy via structure to draw vias being created

:100644 100644 4b20885... 14b6491... M	src/crosshair.c

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

    Consolidate pin / via drawing routines, moving them under the HID API
    
    Adds two new HID APIs, fill_pcb_pv and thindraw_pcb_pv, splitting
    drawing code from DrawPadLowlevel() to common_fill_pcb_pv() and
    common_thindraw_pcb_pv() in hid/common/draw_helpers.c.
    
    Octagonal vias and pins are now correctly drawn when attached to the
    cursor.

:100644 100644 64cf020... 4b20885... M	src/crosshair.c
:100644 100644 8d6e0f6... 76c9a89... M	src/draw.c
:100644 100644 0eca83b... 904d6fe... M	src/global.h
:100644 100644 d6f494a... 0a81ddd... M	src/hid.h
:100644 100644 9de587f... b043d92... M	src/hid/common/draw_helpers.c
:100644 100644 4b1e827... 8243fe4... M	src/hid/common/draw_helpers.h
:100644 100644 b6d26f8... 1568cd5... M	src/hid/common/hidnogui.c

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

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

    hid/common: Draw the hole outline for pins / vias being moved or placed

diff --git a/src/crosshair.c b/src/crosshair.c
index 14b6491..054610b 100644
--- a/src/crosshair.c
+++ b/src/crosshair.c
@@ -94,7 +94,7 @@ thindraw_moved_pv (PinType *pv, int x, int y)
   moved_pv.X += x;
   moved_pv.Y += y;
 
-  gui->thindraw_pcb_pv (Crosshair.GC, Crosshair.GC, &moved_pv, false, false);
+  gui->thindraw_pcb_pv (Crosshair.GC, Crosshair.GC, &moved_pv, true, false);
 }
 
 /* ---------------------------------------------------------------------------
@@ -573,7 +573,7 @@ DrawAttached (void)
         via.Mask = 0;
         via.Flags = NoFlags ();
 
-        gui->thindraw_pcb_pv (Crosshair.GC, Crosshair.GC, &via, false, false);
+        gui->thindraw_pcb_pv (Crosshair.GC, Crosshair.GC, &via, true, false);
 
         if (TEST_FLAG (SHOWDRCFLAG, PCB))
           {

commit 6eeed5e36bd59a70eccbfe41bfc1ee2e01ec0637
Author: Peter Clifton <pcjc2@xxxxxxxxx>
Commit: Peter Clifton <pcjc2@xxxxxxxxx>

    crosshair.c: Use a dummy via structure to draw vias being created

diff --git a/src/crosshair.c b/src/crosshair.c
index 4b20885..14b6491 100644
--- a/src/crosshair.c
+++ b/src/crosshair.c
@@ -556,28 +556,35 @@ XORDrawMoveOrCopyObject (void)
 void
 DrawAttached (void)
 {
-  BDimension s;
-
   if (!Crosshair.On)
     return;
 
   switch (Settings.Mode)
     {
     case VIA_MODE:
-      gui->draw_arc (Crosshair.GC,
-		     Crosshair.X,
-		     Crosshair.Y,
-		     Settings.ViaThickness / 2,
-		     Settings.ViaThickness / 2, 0, 360);
-      if (TEST_FLAG (SHOWDRCFLAG, PCB))
-	{
-	  s = Settings.ViaThickness / 2 + PCB->Bloat + 1;
-	  gui->set_color (Crosshair.GC, Settings.CrossColor);
-	  gui->draw_arc (Crosshair.GC,
-			 Crosshair.X, Crosshair.Y, s, s, 0, 360);
-	  gui->set_color (Crosshair.GC, Settings.CrosshairColor);
-	}
-      break;
+      {
+        /* Make a dummy via structure to draw from */
+        PinType via;
+        via.X = Crosshair.X;
+        via.Y = Crosshair.Y;
+        via.Thickness = Settings.ViaThickness;
+        via.Clearance = 2 * Settings.Keepaway;
+        via.DrillingHole = Settings.ViaDrillingHole;
+        via.Mask = 0;
+        via.Flags = NoFlags ();
+
+        gui->thindraw_pcb_pv (Crosshair.GC, Crosshair.GC, &via, false, false);
+
+        if (TEST_FLAG (SHOWDRCFLAG, PCB))
+          {
+            /* XXX: Naughty cheat - use the mask to draw DRC clearance! */
+            via.Mask = Settings.ViaThickness + PCB->Bloat * 2;
+            gui->set_color (Crosshair.GC, Settings.CrossColor);
+            gui->thindraw_pcb_pv (Crosshair.GC, Crosshair.GC, &via, false, true);
+            gui->set_color (Crosshair.GC, Settings.CrosshairColor);
+          }
+        break;
+      }
 
       /* the attached line is used by both LINEMODE, POLYGON_MODE and POLYGONHOLE_MODE*/
     case POLYGON_MODE:

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

    Consolidate pin / via drawing routines, moving them under the HID API
    
    Adds two new HID APIs, fill_pcb_pv and thindraw_pcb_pv, splitting
    drawing code from DrawPadLowlevel() to common_fill_pcb_pv() and
    common_thindraw_pcb_pv() in hid/common/draw_helpers.c.
    
    Octagonal vias and pins are now correctly drawn when attached to the
    cursor.

diff --git a/src/crosshair.c b/src/crosshair.c
index 64cf020..4b20885 100644
--- a/src/crosshair.c
+++ b/src/crosshair.c
@@ -86,6 +86,17 @@ static void XORDrawAttachedLine (LocationType, LocationType, LocationType,
 				 LocationType, BDimension);
 static void XORDrawAttachedArc (BDimension);
 
+static void
+thindraw_moved_pv (PinType *pv, int x, int y)
+{
+  /* Make a copy of the pin structure, moved to the correct position */
+  PinType moved_pv = *pv;
+  moved_pv.X += x;
+  moved_pv.Y += y;
+
+  gui->thindraw_pcb_pv (Crosshair.GC, Crosshair.GC, &moved_pv, false, false);
+}
+
 /* ---------------------------------------------------------------------------
  * creates a tmp polygon with coordinates converted to screen system
  */
@@ -245,10 +256,7 @@ XORDrawElement (ElementTypePtr Element, LocationType DX, LocationType DY)
   /* pin coordinates and angles have to be converted to X11 notation */
   PIN_LOOP (Element);
   {
-    gui->draw_arc (Crosshair.GC,
-		   DX + pin->X,
-		   DY + pin->Y,
-		   pin->Thickness / 2, pin->Thickness / 2, 0, 360);
+    thindraw_moved_pv (pin, DX, DY);
   }
   END_LOOP;
 
@@ -352,13 +360,11 @@ XORDrawBuffer (BufferTypePtr Buffer)
   }
   END_LOOP;
 
-  /* and the vias, move offset by thickness/2 */
+  /* and the vias */
   if (PCB->ViaOn)
     VIA_LOOP (Buffer->Data);
   {
-    gui->draw_arc (Crosshair.GC,
-		   x + via->X, y + via->Y,
-		   via->Thickness / 2, via->Thickness / 2, 0, 360);
+    thindraw_moved_pv (via, x, y);
   }
   END_LOOP;
 }
@@ -396,13 +402,9 @@ XORDrawMoveOrCopyObject (void)
     {
     case VIA_TYPE:
       {
-	PinTypePtr via = (PinTypePtr) Crosshair.AttachedObject.Ptr1;
-
-	gui->draw_arc (Crosshair.GC,
-		       via->X + dx,
-		       via->Y + dy,
-		       via->Thickness / 2, via->Thickness / 2, 0, 360);
-	break;
+        PinTypePtr via = (PinTypePtr) Crosshair.AttachedObject.Ptr1;
+        thindraw_moved_pv (via, dx, dy);
+        break;
       }
 
     case LINE_TYPE:
diff --git a/src/draw.c b/src/draw.c
index 8d6e0f6..76c9a89 100644
--- a/src/draw.c
+++ b/src/draw.c
@@ -68,15 +68,6 @@ RCSID ("$Id$");
 
 
 /* ---------------------------------------------------------------------------
- * some local types
- */
-typedef struct
-{
-  double X, Y;
-}
-FloatPolyType, *FloatPolyTypePtr;
-
-/* ---------------------------------------------------------------------------
  * some local identifiers
  */
 static BoxType Block = {MAXINT, MAXINT, -MAXINT, -MAXINT};
@@ -94,7 +85,6 @@ static void DrawEverything (BoxTypePtr);
 static void DrawTop (const BoxType *);
 static int DrawLayerGroup (int, const BoxType *);
 static void DrawPinOrViaLowLevel (PinTypePtr, bool);
-static void ClearOnlyPin (PinTypePtr, bool);
 static void DrawPlainPin (PinTypePtr, bool);
 static void DrawPlainVia (PinTypePtr, bool);
 static void DrawPinOrViaNameLowLevel (PinTypePtr);
@@ -664,10 +654,15 @@ struct pin_info
 static int
 clearPin_callback (const BoxType * b, void *cl)
 {
-  PinTypePtr pin = (PinTypePtr) b;
+  PinType *pin = (PinTypePtr) b;
   struct pin_info *i = (struct pin_info *) cl;
   if (i->arg)
-    ClearOnlyPin (pin, true);
+    {
+      if (TEST_FLAG (THINDRAWFLAG, PCB) || TEST_FLAG (THINDRAWPOLYFLAG, PCB))
+        gui->thindraw_pcb_pv (Output.pmGC, Output.pmGC, pin, false, true);
+      else
+        gui->fill_pcb_pv (Output.pmGC, Output.pmGC, pin, false, true);
+    }
   return 1;
 }
 static int
@@ -907,161 +902,21 @@ DrawLayerGroup (int group, const BoxType * screen)
 }
 
 /* ---------------------------------------------------------------------------
- * draws one polygon
- * x and y are already in display coordinates
- * the points are numbered:
- *
- *          5 --- 6
- *         /       \
- *        4         7
- *        |         |
- *        3         0
- *         \       /
- *          2 --- 1
-  */
-static void
-DrawSpecialPolygon (hidGC DrawGC,
-		    LocationType X, LocationType Y, int Thickness,
-		    int thin_draw)
-{
-  static FloatPolyType p[8] = {
-    {
-     0.5, -TAN_22_5_DEGREE_2},
-    {
-     TAN_22_5_DEGREE_2, -0.5},
-    {
-     -TAN_22_5_DEGREE_2, -0.5},
-    {
-     -0.5, -TAN_22_5_DEGREE_2},
-    {
-     -0.5, TAN_22_5_DEGREE_2},
-    {
-     -TAN_22_5_DEGREE_2, 0.5},
-    {
-     TAN_22_5_DEGREE_2, 0.5},
-    {
-     0.5, TAN_22_5_DEGREE_2}
-  };
-  static int special_size = 0;
-  static int scaled_x[8];
-  static int scaled_y[8];
-  int polygon_x[9];
-  int polygon_y[9];
-  int i;
-
-
-  if (Thickness != special_size)
-    {
-      special_size = Thickness;
-      for (i = 0; i < 8; i++)
-	{
-	  scaled_x[i] = p[i].X * special_size;
-	  scaled_y[i] = p[i].Y * special_size;
-	}
-    }
-  /* add line offset */
-  for (i = 0; i < 8; i++)
-    {
-      polygon_x[i] = X + scaled_x[i];
-      polygon_y[i] = Y + scaled_y[i];
-    }
-  if (thin_draw)
-    {
-      int i;
-      gui->set_line_cap (DrawGC, Round_Cap);
-      gui->set_line_width (DrawGC, 0);
-      polygon_x[8] = X + scaled_x[0];
-      polygon_y[8] = Y + scaled_y[0];
-      for (i = 0; i < 8; i++)
-	gui->draw_line (DrawGC, polygon_x[i], polygon_y[i],
-			polygon_x[i + 1], polygon_y[i + 1]);
-    }
-  else
-    gui->fill_polygon (DrawGC, 8, polygon_x, polygon_y);
-}
-
-/* ---------------------------------------------------------------------------
  * lowlevel drawing routine for pins and vias
  */
 static void
-DrawPinOrViaLowLevel (PinTypePtr Ptr, bool drawHole)
+DrawPinOrViaLowLevel (PinTypePtr pv, bool drawHole)
 {
   if (Gathering)
     {
-      AddPart (Ptr);
+      AddPart (pv);
       return;
     }
 
-  if (TEST_FLAG (HOLEFLAG, Ptr))
-    {
-      if (drawHole)
-	{
-	  gui->fill_circle (Output.bgGC, Ptr->X, Ptr->Y, Ptr->Thickness / 2);
-	  gui->set_line_cap (Output.fgGC, Round_Cap);
-	  gui->set_line_width (Output.fgGC, 0);
-	  gui->draw_arc (Output.fgGC, Ptr->X, Ptr->Y,
-			 Ptr->Thickness / 2, Ptr->Thickness / 2, 0, 360);
-	}
-      return;
-    }
-  if (TEST_FLAG (SQUAREFLAG, Ptr))
-    {
-      int l, r, t, b;
-      l = Ptr->X - Ptr->Thickness / 2;
-      b = Ptr->Y - Ptr->Thickness / 2;
-      r = l + Ptr->Thickness;
-      t = b + Ptr->Thickness;
-      if (TEST_FLAG (THINDRAWFLAG, PCB))
-        {
-          gui->set_line_cap (Output.fgGC, Round_Cap);
-          gui->set_line_width (Output.fgGC, 0);
-          gui->draw_line (Output.fgGC, r, t, r, b);
-          gui->draw_line (Output.fgGC, l, t, l, b);
-          gui->draw_line (Output.fgGC, r, t, l, t);
-          gui->draw_line (Output.fgGC, r, b, l, b);
-        }
-      else
-        {
-          gui->fill_rect (Output.fgGC, l, b, r, t);
-        }
-    }
-  else if (TEST_FLAG (OCTAGONFLAG, Ptr))
-    {
-      DrawSpecialPolygon (Output.fgGC, Ptr->X, Ptr->Y, Ptr->Thickness,
-			  TEST_FLAG (THINDRAWFLAG, PCB));
-    }
+  if (TEST_FLAG (THINDRAWFLAG, PCB))
+    gui->thindraw_pcb_pv (Output.fgGC, Output.fgGC, pv, drawHole, false);
   else
-    {				/* draw a round pin or via */
-      if (TEST_FLAG (THINDRAWFLAG, PCB))
-	{
-	  gui->set_line_cap (Output.fgGC, Round_Cap);
-	  gui->set_line_width (Output.fgGC, 0);
-	  gui->draw_arc (Output.fgGC, Ptr->X, Ptr->Y,
-			 Ptr->Thickness / 2, Ptr->Thickness / 2, 0, 360);
-	}
-      else
-	{
-	  gui->fill_circle (Output.fgGC, Ptr->X, Ptr->Y, Ptr->Thickness / 2);
-	}
-    }
-
-  /* and the drilling hole  (which is always round */
-  if (drawHole)
-    {
-      if (TEST_FLAG (THINDRAWFLAG, PCB))
-	{
-	  gui->set_line_cap (Output.fgGC, Round_Cap);
-	  gui->set_line_width (Output.fgGC, 0);
-	  gui->draw_arc (Output.fgGC,
-			 Ptr->X, Ptr->Y, Ptr->DrillingHole / 2,
-			 Ptr->DrillingHole / 2, 0, 360);
-	}
-      else
-	{
-	  gui->fill_circle (Output.bgGC, Ptr->X, Ptr->Y,
-			    Ptr->DrillingHole / 2);
-	}
-    }
+    gui->fill_pcb_pv (Output.fgGC, Output.bgGC, pv, drawHole, false);
 }
 
 /**************************************************************
@@ -1102,61 +957,6 @@ DrawHole (PinTypePtr Ptr)
     }
 }
 
-/*******************************************************************
- * draw clearance in pixmask around pins and vias that pierce polygons
- */
-static void
-ClearOnlyPin (PinTypePtr Pin, bool mask)
-{
-  BDimension half =
-    (mask ? Pin->Mask / 2 : (Pin->Thickness + Pin->Clearance) / 2);
-
-  if (!mask && TEST_FLAG (HOLEFLAG, Pin))
-    return;
-  if (half == 0)
-    return;
-  if (!mask && Pin->Clearance <= 0)
-    return;
-
-  /* Clear the area around the pin */
-  if (TEST_FLAG (SQUAREFLAG, Pin))
-    {
-      int l, r, t, b;
-      l = Pin->X - half;
-      b = Pin->Y - half;
-      r = l + half * 2;
-      t = b + half * 2;
-      if (TEST_FLAG (THINDRAWFLAG, PCB) || TEST_FLAG (THINDRAWPOLYFLAG, PCB))
-        {
-          gui->set_line_cap (Output.pmGC, Round_Cap);
-          gui->set_line_width (Output.pmGC, 0);
-          gui->draw_line (Output.pmGC, r, t, r, b);
-          gui->draw_line (Output.pmGC, l, t, l, b);
-          gui->draw_line (Output.pmGC, r, t, l, t);
-          gui->draw_line (Output.pmGC, r, b, l, b);
-        }
-      else
-	gui->fill_rect (Output.pmGC, l, b, r, t);
-    }
-  else if (TEST_FLAG (OCTAGONFLAG, Pin))
-    {
-      DrawSpecialPolygon (Output.pmGC, Pin->X, Pin->Y, half * 2,
-			  TEST_FLAG (THINDRAWFLAG, PCB) ||
-			  TEST_FLAG (THINDRAWPOLYFLAG, PCB));
-    }
-  else
-    {
-      if (TEST_FLAG (THINDRAWFLAG, PCB) || TEST_FLAG (THINDRAWPOLYFLAG, PCB))
-	{
-	  gui->set_line_cap (Output.pmGC, Round_Cap);
-	  gui->set_line_width (Output.pmGC, 0);
-	  gui->draw_arc (Output.pmGC, Pin->X, Pin->Y, half, half, 0, 360);
-	}
-      else
-	gui->fill_circle (Output.pmGC, Pin->X, Pin->Y, half);
-    }
-}
-
 /* ---------------------------------------------------------------------------
  * lowlevel drawing routine for pin and via names
  */
diff --git a/src/global.h b/src/global.h
index 0eca83b..904d6fe 100644
--- a/src/global.h
+++ b/src/global.h
@@ -55,6 +55,7 @@
 typedef struct BoxType BoxType, *BoxTypePtr;
 typedef struct polygon_st PolygonType, *PolygonTypePtr;
 typedef struct pad_st PadType, *PadTypePtr;
+typedef struct pin_st PinType, *PinTypePtr, **PinTypeHandle;
 typedef struct drc_violation_st DrcViolationType, *DrcViolationTypePtr;
 typedef struct rtree rtree_t;
 typedef struct AttributeListType AttributeListType, *AttributeListTypePtr;
@@ -320,7 +321,7 @@ struct pad_st			/* a SMD pad */
   void *Spare;
 };
 
-typedef struct
+struct pin_st
 {
   ANYOBJECTFIELDS;
   BDimension Thickness, Clearance, Mask, DrillingHole;
@@ -329,7 +330,7 @@ typedef struct
   char *Name, *Number;
   void *Element;
   void *Spare;
-} PinType, *PinTypePtr, **PinTypeHandle;
+};
 
 typedef struct
 {
diff --git a/src/hid.h b/src/hid.h
index d6f494a..0a81ddd 100644
--- a/src/hid.h
+++ b/src/hid.h
@@ -384,6 +384,8 @@ typedef enum
                                   const BoxType *clip_box);
     void (*fill_pcb_pad) (hidGC gc_, PadType *pad, bool clip, bool mask);
     void (*thindraw_pcb_pad) (hidGC gc_, PadType *pad, bool clip, bool mask);
+    void (*fill_pcb_pv) (hidGC fg_gc, hidGC bg_gc, PinType *pv, bool drawHole, bool mask);
+    void (*thindraw_pcb_pv) (hidGC fg_gc, hidGC bg_gc, PinType *pv, bool drawHole, bool mask);
     void (*fill_rect) (hidGC gc_, int x1_, int y1_, int x2_, int y2_);
 
 
diff --git a/src/hid/common/draw_helpers.c b/src/hid/common/draw_helpers.c
index 9de587f..b043d92 100644
--- a/src/hid/common/draw_helpers.c
+++ b/src/hid/common/draw_helpers.c
@@ -303,6 +303,168 @@ common_fill_pcb_pad (hidGC gc, PadType *pad, bool clear, bool mask)
     }
 }
 
+/* ---------------------------------------------------------------------------
+ * draws one polygon
+ * x and y are already in display coordinates
+ * the points are numbered:
+ *
+ *          5 --- 6
+ *         /       \
+ *        4         7
+ *        |         |
+ *        3         0
+ *         \       /
+ *          2 --- 1
+ */
+
+typedef struct
+{
+  double X, Y;
+}
+FloatPolyType;
+
+static void
+draw_octagon_poly (hidGC gc, LocationType X, LocationType Y,
+                   int Thickness, int thin_draw)
+{
+  static FloatPolyType p[8] = {
+    { 0.5,               -TAN_22_5_DEGREE_2},
+    { TAN_22_5_DEGREE_2, -0.5              },
+    {-TAN_22_5_DEGREE_2, -0.5              },
+    {-0.5,               -TAN_22_5_DEGREE_2},
+    {-0.5,                TAN_22_5_DEGREE_2},
+    {-TAN_22_5_DEGREE_2,  0.5              },
+    { TAN_22_5_DEGREE_2,  0.5              },
+    { 0.5,                TAN_22_5_DEGREE_2}
+  };
+  static int special_size = 0;
+  static int scaled_x[8];
+  static int scaled_y[8];
+  int polygon_x[9];
+  int polygon_y[9];
+  int i;
+
+  if (Thickness != special_size)
+    {
+      special_size = Thickness;
+      for (i = 0; i < 8; i++)
+        {
+          scaled_x[i] = p[i].X * special_size;
+          scaled_y[i] = p[i].Y * special_size;
+        }
+    }
+  /* add line offset */
+  for (i = 0; i < 8; i++)
+    {
+      polygon_x[i] = X + scaled_x[i];
+      polygon_y[i] = Y + scaled_y[i];
+    }
+
+  if (thin_draw)
+    {
+      int i;
+      gui->set_line_cap (gc, Round_Cap);
+      gui->set_line_width (gc, 0);
+      polygon_x[8] = X + scaled_x[0];
+      polygon_y[8] = Y + scaled_y[0];
+      for (i = 0; i < 8; i++)
+        gui->draw_line (gc, polygon_x[i    ], polygon_y[i    ],
+                            polygon_x[i + 1], polygon_y[i + 1]);
+    }
+  else
+    gui->fill_polygon (gc, 8, polygon_x, polygon_y);
+}
+
+void
+common_fill_pcb_pv (hidGC fg_gc, hidGC bg_gc, PinType *pv, bool drawHole, bool mask)
+{
+  int w = mask ? pv->Mask : pv->Thickness;
+  int r = w / 2;
+
+  if (TEST_FLAG (HOLEFLAG, pv))
+    {
+      if (drawHole)
+        {
+          gui->fill_circle (bg_gc, pv->X, pv->Y, r);
+          gui->set_line_cap (fg_gc, Round_Cap);
+          gui->set_line_width (fg_gc, 0);
+          gui->draw_arc (fg_gc, pv->X, pv->Y, r, r, 0, 360);
+        }
+      return;
+    }
+
+  if (TEST_FLAG (SQUAREFLAG, pv))
+    {
+      int l = pv->X - r;
+      int b = pv->Y - r;
+      int r = l + w;
+      int t = b + w;
+
+      gui->fill_rect (fg_gc, l, b, r, t);
+    }
+  else if (TEST_FLAG (OCTAGONFLAG, pv))
+    draw_octagon_poly (fg_gc, pv->X, pv->Y, w, false);
+  else /* draw a round pin or via */
+    gui->fill_circle (fg_gc, pv->X, pv->Y, r);
+
+  /* and the drilling hole  (which is always round) */
+  if (drawHole)
+    gui->fill_circle (bg_gc, pv->X, pv->Y, pv->DrillingHole / 2);
+}
+
+void
+common_thindraw_pcb_pv (hidGC fg_gc, hidGC bg_gc, PinType *pv, bool drawHole, bool mask)
+{
+  int w = mask ? pv->Mask : pv->Thickness;
+  int r = w / 2;
+
+  if (TEST_FLAG (HOLEFLAG, pv))
+    {
+      if (drawHole)
+        {
+          gui->set_line_cap (bg_gc, Round_Cap);
+          gui->set_line_width (bg_gc, 0);
+          gui->draw_arc (bg_gc, pv->X, pv->Y, r, r, 0, 360);
+        }
+      return;
+    }
+
+  if (TEST_FLAG (SQUAREFLAG, pv))
+    {
+      int l = pv->X - r;
+      int b = pv->Y - r;
+      int r = l + w;
+      int t = b + w;
+
+      gui->set_line_cap (fg_gc, Round_Cap);
+      gui->set_line_width (fg_gc, 0);
+      gui->draw_line (fg_gc, r, t, r, b);
+      gui->draw_line (fg_gc, l, t, l, b);
+      gui->draw_line (fg_gc, r, t, l, t);
+      gui->draw_line (fg_gc, r, b, l, b);
+
+    }
+  else if (TEST_FLAG (OCTAGONFLAG, pv))
+    {
+      draw_octagon_poly (fg_gc, pv->X, pv->Y, w, true);
+    }
+  else /* draw a round pin or via */
+    {
+      gui->set_line_cap (fg_gc, Round_Cap);
+      gui->set_line_width (fg_gc, 0);
+      gui->draw_arc (fg_gc, pv->X, pv->Y, r, r, 0, 360);
+    }
+
+  /* and the drilling hole  (which is always round */
+  if (drawHole)
+    {
+      gui->set_line_cap (bg_gc, Round_Cap);
+      gui->set_line_width (bg_gc, 0);
+      gui->draw_arc (bg_gc, pv->X, pv->Y, pv->DrillingHole / 2,
+                     pv->DrillingHole / 2, 0, 360);
+    }
+}
+
 void
 common_draw_helpers_init (HID *hid)
 {
@@ -310,4 +472,6 @@ common_draw_helpers_init (HID *hid)
   hid->thindraw_pcb_polygon = common_thindraw_pcb_polygon;
   hid->fill_pcb_pad         = common_fill_pcb_pad;
   hid->thindraw_pcb_pad     = common_thindraw_pcb_pad;
+  hid->fill_pcb_pv          = common_fill_pcb_pv;
+  hid->thindraw_pcb_pv      = common_thindraw_pcb_pv;
 }
diff --git a/src/hid/common/draw_helpers.h b/src/hid/common/draw_helpers.h
index 4b1e827..8243fe4 100644
--- a/src/hid/common/draw_helpers.h
+++ b/src/hid/common/draw_helpers.h
@@ -4,4 +4,6 @@ void common_thindraw_pcb_polygon (hidGC gc, PolygonType *poly,
                                   const BoxType *clip_box);
 void common_fill_pcb_pad (hidGC gc, PadType *pad, bool clear, bool mask);
 void common_thindraw_pcb_pad (hidGC gc, PadType *pad, bool clear, bool mask);
+void common_fill_pcb_pv (hidGC gc, PinType *pv, bool drawHole, bool mask);
+void common_thindraw_pcb_pv (hidGC fg_gc, hidGC bg_gc, PinType *pv, bool drawHole, bool mask);
 void common_draw_helpers_init (HID *hid);
diff --git a/src/hid/common/hidnogui.c b/src/hid/common/hidnogui.c
index b6d26f8..1568cd5 100644
--- a/src/hid/common/hidnogui.c
+++ b/src/hid/common/hidnogui.c
@@ -171,6 +171,18 @@ nogui_thindraw_pcb_pad (hidGC gc, PadType *pad, bool clear, bool mask)
 }
 
 static void
+nogui_fill_pcb_pv (hidGC fg_gc, hidGC bg_gc, PinType *pad, bool drawHole, bool mask)
+{
+  CRASH;
+}
+
+static void
+nogui_thindraw_pcb_pv (hidGC fg_gc, hidGC bg_gc, PinType *pad, bool drawHole, bool mask)
+{
+  CRASH;
+}
+
+static void
 nogui_fill_rect (hidGC gc, int x1, int y1, int x2, int y2)
 {
   CRASH;
@@ -451,6 +463,8 @@ HID hid_nogui = {
   0 /* nogui_thindraw_pcb_polygon */ ,
   nogui_fill_pcb_pad,
   nogui_thindraw_pcb_pad,
+  nogui_fill_pcb_pv,
+  nogui_thindraw_pcb_pv,
   nogui_fill_rect,
   nogui_calibrate,
   nogui_shift_is_pressed,
@@ -508,6 +522,8 @@ apply_default_hid (HID * d, HID * s)
   AD (thindraw_pcb_polygon);
   AD (fill_pcb_pad);
   AD (thindraw_pcb_pad);
+  AD (fill_pcb_pv);
+  AD (thindraw_pcb_pv);
   AD (calibrate);
   AD (shift_is_pressed);
   AD (control_is_pressed);




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