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

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



The branch, master has been updated
       via  0e75f8fd486242b3b30c7a7390c8080bfc650d35 (commit)
      from  b0ecb342f6602c037072b99a11250ccc162bf781 (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/change.c                  |   27 +++++++++++++++++++++------
 src/find.c                    |   23 +++++++++++------------
 src/global.h                  |    6 ++++++
 src/hid/common/draw_helpers.c |    5 +++++
 src/misc.c                    |    2 +-
 src/polygon.c                 |    4 ++--
 src/search.c                  |    4 ++--
 7 files changed, 48 insertions(+), 23 deletions(-)


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

commit 0e75f8fd486242b3b30c7a7390c8080bfc650d35
Author: DJ Delorie <dj@xxxxxxxxxxx>
Commit: DJ Delorie <dj@xxxxxxxxxxx>

    Make toggling the HOLE flag reversible
    
    Closes-bug: lp-699483
    
    When toggling the HOLE flag, the Thickness is no longer changed.
    Instead, use PIN_SIZE() to select from Thickness or DrillingHole
    accordingly, and use that throughout.
    
    Mask size is handled thusly: For tented vias, the mask is opened up to
    just over the hole size.  For untented vias, the mask gap is held
    constant.
    
    Also, various minor changes to ensure that untented holes are drawn
    correctly.

:100644 100644 c65c534... 70e5470... M	src/change.c
:100644 100644 2f9053d... 43dee33... M	src/find.c
:100644 100644 3210d5f... 2a5ae93... M	src/global.h
:100644 100644 543b99f... d7ef716... M	src/hid/common/draw_helpers.c
:100644 100644 3dc87c6... 0188404... M	src/misc.c
:100644 100644 0b5b2d0... 72a9299... M	src/polygon.c
:100644 100644 60f6f46... ef9b9a7... M	src/search.c

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

commit 0e75f8fd486242b3b30c7a7390c8080bfc650d35
Author: DJ Delorie <dj@xxxxxxxxxxx>
Commit: DJ Delorie <dj@xxxxxxxxxxx>

    Make toggling the HOLE flag reversible
    
    Closes-bug: lp-699483
    
    When toggling the HOLE flag, the Thickness is no longer changed.
    Instead, use PIN_SIZE() to select from Thickness or DrillingHole
    accordingly, and use that throughout.
    
    Mask size is handled thusly: For tented vias, the mask is opened up to
    just over the hole size.  For untented vias, the mask gap is held
    constant.
    
    Also, various minor changes to ensure that untented holes are drawn
    correctly.

diff --git a/src/change.c b/src/change.c
index c65c534..70e5470 100644
--- a/src/change.c
+++ b/src/change.c
@@ -1575,19 +1575,34 @@ ChangeHole (PinTypePtr Via)
     return (false);
   EraseVia (Via);
   AddObjectToFlagUndoList (VIA_TYPE, Via, Via, Via);
+  AddObjectToMaskSizeUndoList (VIA_TYPE, Via, Via, Via);
+  r_delete_entry (PCB->Data->via_tree, (BoxType *) Via);
+  RestoreToPolygon (PCB->Data, VIA_TYPE, Via, Via);
   TOGGLE_FLAG (HOLEFLAG, Via);
+
   if (TEST_FLAG (HOLEFLAG, Via))
     {
-      RestoreToPolygon (PCB->Data, VIA_TYPE, Via, Via);
-      AddObjectToSizeUndoList (VIA_TYPE, Via, Via, Via);
-      Via->Thickness = Via->Mask = Via->DrillingHole;
-      ClearFromPolygon (PCB->Data, VIA_TYPE, Via, Via);
+      /* A tented via becomes an minimally untented hole.  An untented
+	 via retains its mask clearance.  */
+      if (Via->Mask > Via->Thickness)
+	{
+	  Via->Mask = (Via->DrillingHole
+		       + (Via->Mask - Via->Thickness));
+	}
+      else if (Via->Mask < Via->DrillingHole)
+	{
+	  Via->Mask = Via->DrillingHole + 2 * MASKFRAME;
+	}
     }
   else
     {
-      AddObjectTo2ndSizeUndoList (VIA_TYPE, Via, Via, Via);
-      Via->DrillingHole = Via->Thickness - MIN_PINORVIACOPPER;
+      Via->Mask = (Via->Thickness
+		   + (Via->Mask - Via->DrillingHole));
     }
+
+  SetPinBoundingBox (Via);
+  r_insert_entry (PCB->Data->via_tree, (BoxType *) Via, 0);
+  ClearFromPolygon (PCB->Data, VIA_TYPE, Via, Via);
   DrawVia (Via);
   Draw ();
   return (true);
diff --git a/src/find.c b/src/find.c
index 2f9053d..43dee33 100644
--- a/src/find.c
+++ b/src/find.c
@@ -485,14 +485,13 @@ PinLineIntersect (PinTypePtr PV, LineTypePtr Line)
 {
   /* IsLineInRectangle already has Bloat factor */
   return TEST_FLAG (SQUAREFLAG,
-                    PV) ? IsLineInRectangle (PV->X - (PV->Thickness + 1) / 2,
-                                             PV->Y - (PV->Thickness + 1) / 2,
-                                             PV->X + (PV->Thickness + 1) / 2,
-                                             PV->Y + (PV->Thickness + 1) / 2,
+                    PV) ? IsLineInRectangle (PV->X - (PIN_SIZE (PV) + 1) / 2,
+                                             PV->Y - (PIN_SIZE (PV) + 1) / 2,
+                                             PV->X + (PIN_SIZE (PV) + 1) / 2,
+                                             PV->Y + (PIN_SIZE (PV) + 1) / 2,
                                              Line) : IsPointInPad (PV->X,
                                                                     PV->Y,
-                                                                    MAX (PV->
-                                                                         Thickness
+								   MAX (PIN_SIZE (PV)
                                                                          /
                                                                          2.0 +
                                                                          fBloat,
@@ -1121,24 +1120,24 @@ pv_poly_callback (const BoxType * b, void *cl)
       if (TEST_FLAG (SQUAREFLAG, pv))
         {
           LocationType x1, x2, y1, y2;
-          x1 = pv->X - (pv->Thickness + 1 + Bloat) / 2;
-          x2 = pv->X + (pv->Thickness + 1 + Bloat) / 2;
-          y1 = pv->Y - (pv->Thickness + 1 + Bloat) / 2;
-          y2 = pv->Y + (pv->Thickness + 1 + Bloat) / 2;
+          x1 = pv->X - (PIN_SIZE (pv) + 1 + Bloat) / 2;
+          x2 = pv->X + (PIN_SIZE (pv) + 1 + Bloat) / 2;
+          y1 = pv->Y - (PIN_SIZE (pv) + 1 + Bloat) / 2;
+          y2 = pv->Y + (PIN_SIZE (pv) + 1 + Bloat) / 2;
           if (IsRectangleInPolygon (x1, y1, x2, y2, &i->polygon)
               && ADD_PV_TO_LIST (pv))
             longjmp (i->env, 1);
         }
       else if (TEST_FLAG (OCTAGONFLAG, pv))
         {
-          POLYAREA *oct = OctagonPoly (pv->X, pv->Y, pv->Thickness / 2);
+          POLYAREA *oct = OctagonPoly (pv->X, pv->Y, PIN_SIZE (pv) / 2);
           if (isects (oct, &i->polygon, true) && ADD_PV_TO_LIST (pv))
             longjmp (i->env, 1);
         }
       else
         {
           if (IsPointInPolygon
-              (pv->X, pv->Y, pv->Thickness * 0.5 + fBloat, &i->polygon)
+              (pv->X, pv->Y, PIN_SIZE (pv) * 0.5 + fBloat, &i->polygon)
               && ADD_PV_TO_LIST (pv))
             longjmp (i->env, 1);
         }
diff --git a/src/global.h b/src/global.h
index 3210d5f..2a5ae93 100644
--- a/src/global.h
+++ b/src/global.h
@@ -336,6 +336,12 @@ struct pin_st
   void *Spare;
 };
 
+/* This is the extents of a Pin or Via, depending on whether it's a
+   hole or not.  */
+#define PIN_SIZE(pinptr) (TEST_FLAG(HOLEFLAG, (pinptr)) \
+			  ? (pinptr)->DrillingHole \
+			  : (pinptr)->Thickness)
+
 typedef struct
 {
   ANYOBJECTFIELDS;
diff --git a/src/hid/common/draw_helpers.c b/src/hid/common/draw_helpers.c
index 543b99f..d7ef716 100644
--- a/src/hid/common/draw_helpers.c
+++ b/src/hid/common/draw_helpers.c
@@ -379,6 +379,8 @@ common_fill_pcb_pv (hidGC fg_gc, hidGC bg_gc, PinType *pv, bool drawHole, bool m
 
   if (TEST_FLAG (HOLEFLAG, pv))
     {
+      if (mask)
+	gui->fill_circle (bg_gc, pv->X, pv->Y, r);
       if (drawHole)
         {
           gui->fill_circle (bg_gc, pv->X, pv->Y, r);
@@ -416,8 +418,11 @@ common_thindraw_pcb_pv (hidGC fg_gc, hidGC bg_gc, PinType *pv, bool drawHole, bo
 
   if (TEST_FLAG (HOLEFLAG, pv))
     {
+      if (mask)
+	gui->draw_arc (fg_gc, pv->X, pv->Y, r, r, 0, 360);
       if (drawHole)
         {
+	  r = pv->DrillingHole / 2;
           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);
diff --git a/src/misc.c b/src/misc.c
index 3dc87c6..0188404 100644
--- a/src/misc.c
+++ b/src/misc.c
@@ -240,7 +240,7 @@ SetPinBoundingBox (PinTypePtr Pin)
   /* the bounding box covers the extent of influence
    * so it must include the clearance values too
    */
-  width = (Pin->Clearance + Pin->Thickness + 1) / 2;
+  width = (Pin->Clearance + PIN_SIZE (Pin) + 1) / 2;
   width = MAX (width, (Pin->Mask + 1) / 2);
 
   /* Adjust for our discrete polygon approximation */
diff --git a/src/polygon.c b/src/polygon.c
index 0b5b2d0..72a9299 100644
--- a/src/polygon.c
+++ b/src/polygon.c
@@ -799,7 +799,7 @@ SubtractPin (DataType * d, PinType * pin, LayerType * l, PolygonType * p)
     }
   else
     {
-      np = PinPoly (pin, pin->Thickness, pin->Clearance);
+      np = PinPoly (pin, PIN_SIZE (pin), pin->Clearance);
       if (!np)
         return -1;
     }
@@ -914,7 +914,7 @@ pin_sub_callback (const BoxType * b, void *cl)
     }
   else
     {
-      np = PinPoly (pin, pin->Thickness, pin->Clearance);
+      np = PinPoly (pin, PIN_SIZE (pin), pin->Clearance);
       if (!np)
         longjmp (info->env, 1);
     }
diff --git a/src/search.c b/src/search.c
index 60f6f46..ef9b9a7 100644
--- a/src/search.c
+++ b/src/search.c
@@ -653,7 +653,7 @@ IsPointOnPin (float X, float Y, float Radius, PinTypePtr pin)
   if (TEST_FLAG (SQUAREFLAG, pin))
     {
       BoxType b;
-      BDimension t = pin->Thickness / 2;
+      BDimension t = PIN_SIZE (pin) / 2;
 
       b.X1 = pin->X - t;
       b.X2 = pin->X + t;
@@ -663,7 +663,7 @@ IsPointOnPin (float X, float Y, float Radius, PinTypePtr pin)
 	return (true);
     }
   else if (SQUARE (pin->X - X) + SQUARE (pin->Y - Y) <=
-	   SQUARE (pin->Thickness / 2 + Radius))
+	   SQUARE (PIN_SIZE (pin) / 2 + Radius))
     return (true);
   return (false);
 }




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