From 70b584c5f55aaf18188914e400e7e44ba8144706 Mon Sep 17 00:00:00 2001 From: jean-pierre charras Date: Sat, 10 Oct 2015 18:56:31 +0200 Subject: [PATCH] Dialog Pad Properties: fix 2 issues: Bug #1504749 (pad parameter "delta" checking error for non trapezoid pads which do not use this parameter) and SMD pads allowed on all layers The existing test was disabled for an unknown reason, which is a non sense and more important breaks the DRC. --- .../kit-dev-coldfire-xilinx_5213.kicad_pcb | 10 ++- demos/video/video.kicad_pcb | 15 ++-- pcbnew/dialogs/dialog_pad_properties.cpp | 84 ++++++++++--------- 3 files changed, 60 insertions(+), 49 deletions(-) diff --git a/demos/kit-dev-coldfire-xilinx_5213/kit-dev-coldfire-xilinx_5213.kicad_pcb b/demos/kit-dev-coldfire-xilinx_5213/kit-dev-coldfire-xilinx_5213.kicad_pcb index edbc320615..dd78e72871 100644 --- a/demos/kit-dev-coldfire-xilinx_5213/kit-dev-coldfire-xilinx_5213.kicad_pcb +++ b/demos/kit-dev-coldfire-xilinx_5213/kit-dev-coldfire-xilinx_5213.kicad_pcb @@ -1,9 +1,9 @@ -(kicad_pcb (version 4) (host pcbnew "(2014-08-25 BZR 5096)-product") +(kicad_pcb (version 4) (host pcbnew "(2015-10-08 BZR 6256)-product") (general (links 534) (no_connects 0) - (area 65.592458 36.781599 237.49 147.510501) + (area 66.45592 36.781599 233.50792 151.36432) (thickness 1.6) (drawings 8) (tracks 3535) @@ -13,6 +13,12 @@ ) (page A4) + (title_block + (title "Demo Kicad") + (date 2015-10-09) + (rev 2) + ) + (layers (0 Composant signal) (1 GND_layer power) diff --git a/demos/video/video.kicad_pcb b/demos/video/video.kicad_pcb index 79469f4b3c..5c76f1a6b5 100644 --- a/demos/video/video.kicad_pcb +++ b/demos/video/video.kicad_pcb @@ -1,9 +1,9 @@ -(kicad_pcb (version 4) (host pcbnew "(2014-08-26 BZR 5101)-product") +(kicad_pcb (version 4) (host pcbnew "(2015-10-08 BZR 6256)-product") (general (links 1575) (no_connects 0) - (area 53.492399 56.413399 365.734601 163.296601) + (area 40.893999 55.3974 365.734601 163.525201) (thickness 1.6002) (drawings 39) (tracks 9218) @@ -58,17 +58,18 @@ (pad_size 3.81 5.08) (pad_drill 3.048) (pad_to_mask_clearance 0.254) - (aux_axis_origin 0 0) + (aux_axis_origin 40.9 173.1) (visible_elements 7FFFFFFF) (pcbplotparams - (layerselection 0x00030_80000001) + (layerselection 0x010fc_80000007) (usegerberextensions false) - (excludeedgelayer true) + (usegerberattributes true) + (excludeedgelayer false) (linewidth 0.150000) (plotframeref false) (viasonmask false) (mode 1) - (useauxorigin false) + (useauxorigin true) (hpglpennumber 1) (hpglpenspeed 20) (hpglpendiameter 15) @@ -84,7 +85,7 @@ (mirror false) (drillshape 0) (scaleselection 1) - (outputdirectory "")) + (outputdirectory plots)) ) (net 0 "") diff --git a/pcbnew/dialogs/dialog_pad_properties.cpp b/pcbnew/dialogs/dialog_pad_properties.cpp index 41945b69ff..375b8a42b8 100644 --- a/pcbnew/dialogs/dialog_pad_properties.cpp +++ b/pcbnew/dialogs/dialog_pad_properties.cpp @@ -6,10 +6,10 @@ /* * This program source code file is part of KiCad, a free EDA CAD application. * - * Copyright (C) 2013 Jean-Pierre Charras, jp.charras at wanadoo.fr + * Copyright (C) 2015 Jean-Pierre Charras, jp.charras at wanadoo.fr * Copyright (C) 2013 Dick Hollenbeck, dick@softplc.com * Copyright (C) 2008-2013 Wayne Stambaugh - * Copyright (C) 1992-2013 KiCad Developers, see AUTHORS.txt for contributors. + * Copyright (C) 1992-2015 KiCad Developers, see AUTHORS.txt for contributors. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -182,9 +182,6 @@ DIALOG_PAD_PROPERTIES::DIALOG_PAD_PROPERTIES( PCB_BASE_FRAME* aParent, D_PAD* aP { m_panelShowPadGal->UseColorScheme( m_board->GetColorsSettings() ); m_panelShowPadGal->SwitchBackend( m_parent->GetGalCanvas()->GetBackend() ); -#if !wxCHECK_VERSION( 3, 0, 0 ) - m_panelShowPadGal->SetSize( m_panelShowPad->GetSize() ); -#endif m_panelShowPadGal->Show(); m_panelShowPad->Hide(); m_panelShowPadGal->GetView()->Add( m_dummyPad ); @@ -256,7 +253,7 @@ void DIALOG_PAD_PROPERTIES::OnPaintShowPanel( wxPaintEvent& event ) // If drill size has been set, use that. Otherwise default to 1mm. dim = m_dummyPad->GetDrillSize().x; if( dim == 0 ) - dim = 1000000; + dim = Millimeter2iu( 1.0 ); } if( m_dummyPad->GetLocalClearance() > 0 ) @@ -343,6 +340,7 @@ void DIALOG_PAD_PROPERTIES::initValues() m_staticModuleSideValue->SetLabel( _( "Back side (footprint is mirrored)" ) ); } + //Internal angles are in 0.1 degree msg.Printf( wxT( "%.1f" ), module->GetOrientation() / 10.0 ); m_staticModuleRotValue->SetLabel( msg ); } @@ -805,10 +803,13 @@ bool DIALOG_PAD_PROPERTIES::padValuesOK() "Use SMD pads instead" ) ); // Fall trough case PAD_ATTRIB_SMD: // SMD and Connector pads (One external copper layer only) -/* - if( padlayers_mask[B_Cu] && padlayers_mask[F_Cu] ) - error_msgs.Add( _( "Error: only one copper layer allowed for SMD or Connector pads" ) ); -*/ + { + LSET innerlayers_mask = padlayers_mask & LSET::InternalCuMask(); + + if( ( padlayers_mask[F_Cu] && padlayers_mask[B_Cu] ) || + innerlayers_mask.count() != 0 ) + error_msgs.Add( _( "Error: only one external copper layer allowed for SMD or Connector pads" ) ); + } break; } @@ -1044,44 +1045,47 @@ bool DIALOG_PAD_PROPERTIES::transferDataToPad( D_PAD* aPad ) // Read pad length die aPad->SetPadToDieLength( ValueFromTextCtrl( *m_LengthPadToDieCtrl ) ); - // Read pad shape delta size: - // m_DeltaSize.x or m_DeltaSize.y must be NULL. for a trapezoid. - wxSize delta; - - if( m_trapDeltaDirChoice->GetSelection() == 0 ) - delta.x = ValueFromTextCtrl( *m_ShapeDelta_Ctrl ); - else - delta.y = ValueFromTextCtrl( *m_ShapeDelta_Ctrl ); - - // Test bad values (be sure delta values are not too large) + // For a trapezoid, test delta value (be sure delta is not too large for pad size) // remember DeltaSize.x is the Y size variation bool error = false; - if( delta.x < 0 && delta.x <= -aPad->GetSize().y ) + if( aPad->GetShape() == PAD_SHAPE_TRAPEZOID ) { - delta.x = -aPad->GetSize().y + 2; - error = true; - } + wxSize delta; - if( delta.x > 0 && delta.x >= aPad->GetSize().y ) - { - delta.x = aPad->GetSize().y - 2; - error = true; - } + // For a trapezoid, only one of delta.x or delta.y is not 0, depending on + // the direction. + if( m_trapDeltaDirChoice->GetSelection() == 0 ) + delta.x = ValueFromTextCtrl( *m_ShapeDelta_Ctrl ); + else + delta.y = ValueFromTextCtrl( *m_ShapeDelta_Ctrl ); - if( delta.y < 0 && delta.y <= -aPad->GetSize().x ) - { - delta.y = -aPad->GetSize().x + 2; - error = true; - } + if( delta.x < 0 && delta.x <= -aPad->GetSize().y ) + { + delta.x = -aPad->GetSize().y + 2; + error = true; + } - if( delta.y > 0 && delta.y >= aPad->GetSize().x ) - { - delta.y = aPad->GetSize().x - 2; - error = true; - } + if( delta.x > 0 && delta.x >= aPad->GetSize().y ) + { + delta.x = aPad->GetSize().y - 2; + error = true; + } - aPad->SetDelta( delta ); + if( delta.y < 0 && delta.y <= -aPad->GetSize().x ) + { + delta.y = -aPad->GetSize().x + 2; + error = true; + } + + if( delta.y > 0 && delta.y >= aPad->GetSize().x ) + { + delta.y = aPad->GetSize().x - 2; + error = true; + } + + aPad->SetDelta( delta ); + } // Read pad shape offset: x = ValueFromTextCtrl( *m_ShapeOffset_X_Ctrl );