Blob Blame History Raw
diff -ru kicad-2010.04.06/CHANGELOG.txt kicad-2010.04.06-new/CHANGELOG.txt
--- kicad-2010.04.06/CHANGELOG.txt	2010-03-31 19:59:32.000000000 +0200
+++ kicad-2010.04.06-new/CHANGELOG.txt	2010-05-01 14:06:25.000000000 +0200
@@ -4,6 +4,15 @@
 Please add newer entries at the top, list the date and your name with
 email address.
 
+2010-apr-08, UPDATE Jean-Pierre Charras <jean-pierre.charras@gipsa-lab.inpg.fr>
+================================================================================
+++Pcbnew:
+    Drc: take in account the clearance "local parameters" for pads that have local parameters.
+         Until now, only NETCLASS clearance values were used.
+         (local parameters are used in zone filling)
+         But because a pad (or a footprint) can have a specific clearance value
+         Drc used now this value, and NETCLASS value only if no local value specified.
+
 2010-mar-31, UPDATE Jean-Pierre Charras <jean-pierre.charras@gipsa-lab.inpg.fr>
 ================================================================================
 ++Pcbnew
diff -ru kicad-2010.04.06/common/build_version.cpp kicad-2010.04.06-new/common/build_version.cpp
--- kicad-2010.04.06/common/build_version.cpp	2010-03-30 20:52:34.000000000 +0200
+++ kicad-2010.04.06-new/common/build_version.cpp	2010-05-01 14:29:03.000000000 +0200
@@ -6,10 +6,10 @@
 #endif
 
 #ifndef KICAD_BUILD_VERSION
-#define KICAD_BUILD_VERSION "(2010-03-30 SVN 2479)"
+#define KICAD_BUILD_VERSION "(2010-04-06 SVN 2515)"
 #endif
 
-#define VERSION_STABILITY "final"
+#define VERSION_STABILITY "stable"
 
 /** Function GetBuildVersion()
  * Return the build date and version
diff -ru kicad-2010.04.06/gerbview/class_gerbview_layer_widget.cpp kicad-2010.04.06-new/gerbview/class_gerbview_layer_widget.cpp
--- kicad-2010.04.06/gerbview/class_gerbview_layer_widget.cpp	2010-02-26 16:39:10.000000000 +0100
+++ kicad-2010.04.06-new/gerbview/class_gerbview_layer_widget.cpp	2010-05-01 14:09:55.000000000 +0200
@@ -143,6 +143,7 @@
     int     rowCount;
     int     menuId = event.GetId();
     bool    visible;
+    int     visibleLayers = 0;
 
     switch( menuId )
     {
@@ -153,36 +154,19 @@
     case ID_SHOW_NO_COPPERS:
         visible = false;
     L_change_coppers:
-        int lastCu = -1;
         rowCount = GetLayerRowCount();
-        for( int row=rowCount-1;  row>=0;  --row )
+        for( int row=0; row < rowCount; ++row )
         {
             wxCheckBox* cb = (wxCheckBox*) getLayerComp( row, 3 );
-            int layer = getDecodedId( cb->GetId() );
-            if( IsValidCopperLayerIndex( layer ) )
-            {
-                lastCu = row;
-                break;
-            }
+            cb->SetValue( visible );
+            if( visible )
+                visibleLayers |= (1 << row);
+            else
+                visibleLayers &= ~(1 << row);
         }
 
-        for( int row=0;  row<rowCount;  ++row )
-        {
-            wxCheckBox* cb = (wxCheckBox*) getLayerComp( row, 3 );
-            int layer = getDecodedId( cb->GetId() );
-
-            if( IsValidCopperLayerIndex( layer ) )
-            {
-                cb->SetValue( visible );
-
-                bool isLastCopperLayer = (row==lastCu);
-
-                OnLayerVisible( layer, visible, isLastCopperLayer );
-
-                if( isLastCopperLayer )
-                    break;
-            }
-        }
+        myframe->GetBoard()->SetVisibleLayers( visibleLayers );
+        myframe->DrawPanel->Refresh();
         break;
     }
 }
diff -ru kicad-2010.04.06/pcbnew/class_board_connected_item.cpp kicad-2010.04.06-new/pcbnew/class_board_connected_item.cpp
--- kicad-2010.04.06/pcbnew/class_board_connected_item.cpp	2009-11-05 21:59:42.000000000 +0100
+++ kicad-2010.04.06-new/pcbnew/class_board_connected_item.cpp	2010-05-01 14:20:00.000000000 +0200
@@ -78,27 +78,17 @@
     // and a call to wxASSERT can crash the application.
     if( myclass )
     {
+        int myClearance  = myclass->GetClearance();
         // @todo : after GetNetClass() is reliably not returning NULL, remove the
-        // tests for if( myclass ) and if( hisclass )
+        // tests for if( myclass )
 
         if( aItem )
         {
-            NETCLASS*   hisclass = aItem->GetNetClass();
-            if( hisclass )
-            {
-                int hisClearance = hisclass->GetClearance();
-                int myClearance  = myclass->GetClearance();
-                return max( hisClearance, myClearance );
-            }
-            else
-            {
-#ifdef __WXDEBUG__
-                wxLogWarning(wxT("BOARD_CONNECTED_ITEM::GetClearance(): NULL hisclass") );
-#endif
-            }
+            int hisClearance = aItem->GetClearance();
+            return max( hisClearance, myClearance );
         }
 
-        return myclass->GetClearance();
+        return myClearance;
     }
     else
     {
diff -ru kicad-2010.04.06/pcbnew/class_pad.cpp kicad-2010.04.06-new/pcbnew/class_pad.cpp
--- kicad-2010.04.06/pcbnew/class_pad.cpp	2010-02-22 20:56:32.000000000 +0100
+++ kicad-2010.04.06-new/pcbnew/class_pad.cpp	2010-05-01 14:18:28.000000000 +0200
@@ -201,37 +201,38 @@
 
 
 /** Virtual function GetClearance
- * returns the clearance in 1/10000 inches.  If \a aItem is not NULL then the
- * returned clearance is the greater of this object's NETCLASS clearance and
- * aItem's NETCLASS clearance.  If \a aItem is NULL, then this objects
+ * returns the clearance in internal units.  If \a aItem is not NULL then the
+ * returned clearance is the greater of this object's clearance and
+ * aItem's clearance.  If \a aItem is NULL, then this objects
  * clearance
  * is returned.
  * @param aItem is another BOARD_CONNECTED_ITEM or NULL
- * @return int - the clearance in 1/10000 inches.
+ * @return int - the clearance in internal units.
  */
 int D_PAD::GetClearance( BOARD_CONNECTED_ITEM* aItem ) const
 {
+    // A pad can have specific clearance parameters that
+    // overrides its NETCLASS clearance value
     int clearance = m_LocalClearance;
 
     if( clearance == 0 )
-    {
+    {   // If local clearance is 0, use the parent footprint clearance value
         if( GetParent() && ( (MODULE*) GetParent() )->m_LocalClearance )
             clearance = ( (MODULE*) GetParent() )->m_LocalClearance;
     }
 
-    if( clearance == 0 )
+    if( clearance == 0 )   // If the parent footprint clearance value = 0, use NETCLASS value
         return BOARD_CONNECTED_ITEM::GetClearance( aItem );
 
+    // We have a specific clearance.
+    // if aItem, return the biggest clearance
     if( aItem )
     {
-        NETCLASS* hisclass = aItem->GetNetClass();
-        if( hisclass )
-        {
-            int hisClearance = hisclass->GetClearance();
-            return max( hisClearance, clearance );
-        }
+        int hisClearance = aItem->GetClearance();
+        return max( hisClearance, clearance );
     }
 
+    // Return the specific clearance.
     return clearance;
 }
 
diff -ru kicad-2010.04.06/pcbnew/class_pad.h kicad-2010.04.06-new/pcbnew/class_pad.h
--- kicad-2010.04.06/pcbnew/class_pad.h	2010-02-22 20:56:32.000000000 +0100
+++ kicad-2010.04.06-new/pcbnew/class_pad.h	2010-05-01 14:20:46.000000000 +0200
@@ -160,12 +160,12 @@
 
      /**
      * Function GetClearance
-     * returns the clearance in 1/10000 inches.  If \a aItem is not NULL then the
-     * returned clearance is the greater of this object's NETCLASS clearance and
-     * aItem's NETCLASS clearance.  If \a aItem is NULL, then this objects clearance
+     * returns the clearance in internal units.  If \a aItem is not NULL then the
+     * returned clearance is the greater of this object's clearance and
+     * aItem's clearance.  If \a aItem is NULL, then this objects clearance
      * is returned.
      * @param aItem is another BOARD_CONNECTED_ITEM or NULL
-     * @return int - the clearance in 1/10000 inches.
+     * @return int - the clearance in internal units.
      */
     virtual int GetClearance( BOARD_CONNECTED_ITEM* aItem = NULL ) const;
 
diff -ru kicad-2010.04.06/pcbnew/class_track.cpp kicad-2010.04.06-new/pcbnew/class_track.cpp
--- kicad-2010.04.06/pcbnew/class_track.cpp	2010-02-08 19:15:42.000000000 +0100
+++ kicad-2010.04.06-new/pcbnew/class_track.cpp	2010-05-01 14:15:08.000000000 +0200
@@ -107,6 +107,22 @@
     return NULL;    // should never happen
 }
 
+/** Virtual function GetClearance
+ * returns the clearance in internal units.  If \a aItem is not NULL then the
+ * returned clearance is the greater of this object's clearance and
+ * aItem's clearance.  If \a aItem is NULL, then this objects
+ * clearance
+ * is returned.
+ * @param aItem is another BOARD_CONNECTED_ITEM or NULL
+ * @return int - the clearance in internal units.
+ */
+int TRACK::GetClearance( BOARD_CONNECTED_ITEM* aItem ) const
+{
+    // Currently tracks have no specific clearance parameter
+    // on a per track or per segment basis.
+    // the NETCLASS clearance is used
+    return BOARD_CONNECTED_ITEM::GetClearance( aItem );
+}
 
 /**
  * Function GetDrillValue
diff -ru kicad-2010.04.06/pcbnew/class_track.h kicad-2010.04.06-new/pcbnew/class_track.h
--- kicad-2010.04.06/pcbnew/class_track.h	2009-12-21 14:05:11.000000000 +0100
+++ kicad-2010.04.06-new/pcbnew/class_track.h	2010-05-01 14:16:21.000000000 +0200
@@ -275,6 +275,18 @@
         return wxT( "TRACK" );
     }
 
+     /**
+     * Function GetClearance
+     * returns the clearance in internal units.  If \a aItem is not NULL then the
+     * returned clearance is the greater of this object's clearance and
+     * aItem's clearance.  If \a aItem is NULL, then this objects clearance
+     * is returned.
+     * @param aItem is another BOARD_CONNECTED_ITEM or NULL
+     * @return int - the clearance in internal units.
+     */
+    virtual int GetClearance( BOARD_CONNECTED_ITEM* aItem = NULL ) const;
+ 
+
 
 #if defined (DEBUG)
 
diff -ru kicad-2010.04.06/pcbnew/dialog_drc.cpp kicad-2010.04.06-new/pcbnew/dialog_drc.cpp
--- kicad-2010.04.06/pcbnew/dialog_drc.cpp	2010-01-31 21:01:46.000000000 +0100
+++ kicad-2010.04.06-new/pcbnew/dialog_drc.cpp	2010-05-01 14:13:55.000000000 +0200
@@ -551,6 +551,7 @@
 void DIALOG_DRC_CONTROL::DelDRCMarkers()
 /*********************************************************/
 {
+    m_Parent->SetCurItem( NULL );           // clear curr item, because it could be a DRC marker
     m_ClearanceListBox->DeleteAllItems();
     m_UnconnectedListBox->DeleteAllItems();
 }
diff -ru kicad-2010.04.06/pcbnew/drc.cpp kicad-2010.04.06-new/pcbnew/drc.cpp
--- kicad-2010.04.06/pcbnew/drc.cpp	2010-01-31 21:01:46.000000000 +0100
+++ kicad-2010.04.06-new/pcbnew/drc.cpp	2010-05-01 14:13:00.000000000 +0200
@@ -704,7 +704,6 @@
 {
     TRACK*      track;
     int         dx, dy;         // utilise pour calcul des dim x et dim y des segments
-    int         w_dist;
     int         layerMask;
     int         net_code_ref;
     wxPoint     shape_pos;
@@ -813,7 +812,7 @@
     D_PAD pseudo_pad( (MODULE*) NULL );     // construct this once outside following loop
 
     // Compute the min distance to pads
-    w_dist = aRefSeg->m_Width >> 1;
+    int refsegm_half_width = aRefSeg->m_Width >> 1;
 
     if( testPads )
     {
@@ -842,7 +841,7 @@
                 m_spotcx = pseudo_pad.GetPosition().x - org_X;
                 m_spotcy = pseudo_pad.GetPosition().y - org_Y;
 
-                if( !checkClearanceSegmToPad( &pseudo_pad, w_dist, netclass->GetClearance() ))
+                if( !checkClearanceSegmToPad( &pseudo_pad, refsegm_half_width, netclass->GetClearance() ))
                 {
                     m_currentMarker = fillMarker( aRefSeg, pad,
                                                   DRCE_TRACK_NEAR_THROUGH_HOLE, m_currentMarker );
@@ -863,7 +862,7 @@
             m_spotcx  = shape_pos.x - org_X;
             m_spotcy  = shape_pos.y - org_Y;
 
-            if( !checkClearanceSegmToPad( pad, w_dist, aRefSeg->GetClearance( pad ) ) )
+            if( !checkClearanceSegmToPad( pad, refsegm_half_width, aRefSeg->GetClearance( pad ) ) )
             {
                 m_currentMarker = fillMarker( aRefSeg, pad,
                                               DRCE_TRACK_NEAR_PAD, m_currentMarker );
@@ -897,7 +896,7 @@
 
         // the minimum distance = clearance plus half the reference track
         // width plus half the other track's width
-        w_dist = aRefSeg->GetClearance( track );
+        int w_dist = aRefSeg->GetClearance( track );
         w_dist += (aRefSeg->m_Width + track->m_Width)/2;
 
         // If the reference segment is a via, we test it here
@@ -1423,7 +1422,7 @@
 }
 
 
-bool DRC::checkClearanceSegmToPad( const D_PAD* pad_to_test, int w_segm, int dist_min )
+bool DRC::checkClearanceSegmToPad( const D_PAD* pad_to_test, int w_segm, int aMinDist )
 {
     int p_dimx;
     int p_dimy;         // half the dimension of the pad
@@ -1432,7 +1431,7 @@
     int seuil;
     int deltay;
 
-    seuil  = w_segm + dist_min;
+    seuil  = w_segm + aMinDist;
     p_dimx = pad_to_test->m_Size.x >> 1;
     p_dimy = pad_to_test->m_Size.y >> 1;