Pcbnew: fix bug #1272714 . Code cleanup: use 2 different enums for pad shapes and pad drill shapes. Remove never used pad shape.

This commit is contained in:
jean-pierre charras 2014-01-26 15:20:58 +01:00
parent 179bb920b8
commit 3354bdde05
21 changed files with 97 additions and 67 deletions

View File

@ -203,7 +203,7 @@ static void InitKiCadAboutNew( AboutAppInfo& info )
* which should be represented by the same icon. * which should be represented by the same icon.
*/ */
// The developers // The core developers
info.AddDeveloper( info.AddDeveloper(
new Contributor( wxT( "Jean-Pierre Charras" ), wxT( "jp.charras@wanadoo.fr" ) ) ); new Contributor( wxT( "Jean-Pierre Charras" ), wxT( "jp.charras@wanadoo.fr" ) ) );
info.AddDeveloper( info.AddDeveloper(
@ -214,6 +214,8 @@ static void InitKiCadAboutNew( AboutAppInfo& info )
// alphabetically by last name after main 3 above: // alphabetically by last name after main 3 above:
info.AddDeveloper( info.AddDeveloper(
new Contributor( wxT( "Frank Bennett" ), wxT( "bennett78@lpbroadband.net" ) ) ); new Contributor( wxT( "Frank Bennett" ), wxT( "bennett78@lpbroadband.net" ) ) );
info.AddDeveloper(
new Contributor( wxT( "Cirilo Bernardo" ), wxT( "cirilo_bernardo@yahoo.com" ) ) );
info.AddDeveloper( info.AddDeveloper(
new Contributor( wxT( "Jonas Diemer" ), wxT( "diemer@gmx.de" ) ) ); new Contributor( wxT( "Jonas Diemer" ), wxT( "diemer@gmx.de" ) ) );
info.AddDeveloper( info.AddDeveloper(
@ -222,12 +224,6 @@ static void InitKiCadAboutNew( AboutAppInfo& info )
new Contributor( wxT( "Hauptmech" ), wxT( "hauptmech@gmail.com" ) ) ); new Contributor( wxT( "Hauptmech" ), wxT( "hauptmech@gmail.com" ) ) );
info.AddDeveloper( info.AddDeveloper(
new Contributor( wxT( "Jerry Jacobs" ), wxT( "xor.gate.engineering@gmail.com" ) ) ); new Contributor( wxT( "Jerry Jacobs" ), wxT( "xor.gate.engineering@gmail.com" ) ) );
/*
info.AddDeveloper(
new Contributor( wxT( "KBool Library" ), wxT( "http://boolean.klaasholwerda.nl/bool.html" ) ) );
*/
info.AddDeveloper( info.AddDeveloper(
new Contributor( wxT( "Lorenzo Marcantonio" ), wxT( "lomarcan@tin.it" ) ) ); new Contributor( wxT( "Lorenzo Marcantonio" ), wxT( "lomarcan@tin.it" ) ) );
info.AddDeveloper( info.AddDeveloper(
@ -240,10 +236,14 @@ static void InitKiCadAboutNew( AboutAppInfo& info )
new Contributor( wxT( "Marco Serantoni" ), wxT( "marco.serantoni@gmail.com" ) ) ); new Contributor( wxT( "Marco Serantoni" ), wxT( "marco.serantoni@gmail.com" ) ) );
info.AddDeveloper( info.AddDeveloper(
new Contributor( wxT( "Brian Sidebotham" ), wxT( "brian.sidebotham@gmail.com" ) ) ); new Contributor( wxT( "Brian Sidebotham" ), wxT( "brian.sidebotham@gmail.com" ) ) );
info.AddDeveloper(
new Contributor( wxT( "Orson (Maciej Suminski)" ), wxT( "maciej.suminski@cern.ch" ) ) );
info.AddDeveloper( info.AddDeveloper(
new Contributor( wxT( "Rafael Sokolowski" ), wxT( "rafael.sokolowski@web.de" ) ) ); new Contributor( wxT( "Rafael Sokolowski" ), wxT( "rafael.sokolowski@web.de" ) ) );
info.AddDeveloper( info.AddDeveloper(
new Contributor( wxT( "Vesa Solonen" ), wxT( "vesa.solonen@hut.fi" ) ) ); new Contributor( wxT( "Vesa Solonen" ), wxT( "vesa.solonen@hut.fi" ) ) );
info.AddDeveloper(
new Contributor( wxT( "Tomasz Wlostowski" ), wxT( "tomasz.wlostowski@cern.ch" ) ) );
// The document writers // The document writers
info.AddDocWriter( info.AddDocWriter(

View File

@ -11,13 +11,21 @@
*/ */
enum PAD_SHAPE_T enum PAD_SHAPE_T
{ {
PAD_NONE,
PAD_CIRCLE, PAD_CIRCLE,
PAD_ROUND = PAD_CIRCLE, PAD_ROUND = PAD_CIRCLE,
PAD_RECT, PAD_RECT,
PAD_OVAL, PAD_OVAL,
PAD_TRAPEZOID, PAD_TRAPEZOID
PAD_OCTAGON // Provided, but not existing in Pcbnew. waiting for a volunteer };
/**
* Enum PAD_DRILL_SHAPE_T
* is the set of pad dtill shapes, used with D_PAD::{Set,Get}DrillShape()
*/
enum PAD_DRILL_SHAPE_T
{
PAD_DRILL_CIRCLE,
PAD_DRILL_OBLONG
}; };

View File

@ -424,7 +424,7 @@ void D_PAD:: TransformShapeWithClearanceToPolygon( CPOLYGONS_LIST& aCornerBuffer
* trapezoidal pads are considered as rect * trapezoidal pads are considered as rect
* pad shape having they boudary box size */ * pad shape having they boudary box size */
switch( m_PadShape ) switch( GetShape() )
{ {
case PAD_CIRCLE: case PAD_CIRCLE:
dx = KiROUND( dx * aCorrectionFactor ); dx = KiROUND( dx * aCorrectionFactor );
@ -459,7 +459,6 @@ void D_PAD:: TransformShapeWithClearanceToPolygon( CPOLYGONS_LIST& aCornerBuffer
} }
break; break;
default:
case PAD_TRAPEZOID: case PAD_TRAPEZOID:
psize.x += std::abs( m_DeltaSize.y ); psize.x += std::abs( m_DeltaSize.y );
psize.y += std::abs( m_DeltaSize.x ); psize.y += std::abs( m_DeltaSize.x );
@ -550,7 +549,7 @@ void D_PAD::BuildPadShapePolygon( CPOLYGONS_LIST& aCornerBuffer,
wxPoint corners[4]; wxPoint corners[4];
wxPoint PadShapePos = ReturnShapePos(); /* Note: for pad having a shape offset, wxPoint PadShapePos = ReturnShapePos(); /* Note: for pad having a shape offset,
* the pad position is NOT the shape position */ * the pad position is NOT the shape position */
switch( m_PadShape ) switch( GetShape() )
{ {
case PAD_CIRCLE: case PAD_CIRCLE:
case PAD_OVAL: case PAD_OVAL:
@ -558,7 +557,6 @@ void D_PAD::BuildPadShapePolygon( CPOLYGONS_LIST& aCornerBuffer,
aSegmentsPerCircle, aCorrectionFactor ); aSegmentsPerCircle, aCorrectionFactor );
break; break;
default:
case PAD_TRAPEZOID: case PAD_TRAPEZOID:
case PAD_RECT: case PAD_RECT:
BuildPadPolygon( corners, aInflateValue, m_Orient ); BuildPadPolygon( corners, aInflateValue, m_Orient );

View File

@ -66,9 +66,9 @@ D_PAD::D_PAD( MODULE* parent ) :
m_Pos = GetParent()->GetPosition(); m_Pos = GetParent()->GetPosition();
} }
m_PadShape = PAD_CIRCLE; // Default pad shape is PAD_CIRCLE. SetShape( PAD_CIRCLE ); // Default pad shape is PAD_CIRCLE.
SetDrillShape( PAD_DRILL_CIRCLE ); // Default pad drill shape is a circle.
m_Attribute = PAD_STANDARD; // Default pad type is NORMAL (thru hole) m_Attribute = PAD_STANDARD; // Default pad type is NORMAL (thru hole)
m_DrillShape = PAD_CIRCLE; // Default pad drill shape is a circle.
m_LocalClearance = 0; m_LocalClearance = 0;
m_LocalSolderMaskMargin = 0; m_LocalSolderMaskMargin = 0;
m_LocalSolderPasteMargin = 0; m_LocalSolderPasteMargin = 0;
@ -382,13 +382,13 @@ void D_PAD::Copy( D_PAD* source )
m_NumPadName = source->m_NumPadName; m_NumPadName = source->m_NumPadName;
SetNet( source->GetNet() ); SetNet( source->GetNet() );
m_Drill = source->m_Drill; m_Drill = source->m_Drill;
m_DrillShape = source->m_DrillShape; m_drillShape = source->m_drillShape;
m_Offset = source->m_Offset; m_Offset = source->m_Offset;
m_Size = source->m_Size; m_Size = source->m_Size;
m_DeltaSize = source->m_DeltaSize; m_DeltaSize = source->m_DeltaSize;
m_Pos0 = source->m_Pos0; m_Pos0 = source->m_Pos0;
m_boundingRadius = source->m_boundingRadius; m_boundingRadius = source->m_boundingRadius;
m_PadShape = source->m_PadShape; m_padShape = source->m_padShape;
m_Attribute = source->m_Attribute; m_Attribute = source->m_Attribute;
m_Orient = source->m_Orient; m_Orient = source->m_Orient;
m_LengthPadToDie = source->m_LengthPadToDie; m_LengthPadToDie = source->m_LengthPadToDie;
@ -601,7 +601,7 @@ void D_PAD::GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM>& aList )
Line = ::CoordinateToString( (unsigned) m_Drill.x ); Line = ::CoordinateToString( (unsigned) m_Drill.x );
if( m_DrillShape == PAD_CIRCLE ) if( GetDrillShape() == PAD_DRILL_CIRCLE )
{ {
aList.push_back( MSG_PANEL_ITEM( _( "Drill" ), Line, RED ) ); aList.push_back( MSG_PANEL_ITEM( _( "Drill" ), Line, RED ) );
} }
@ -663,7 +663,7 @@ bool D_PAD::HitTest( const wxPoint& aPosition )
dx = m_Size.x >> 1; // dx also is the radius for rounded pads dx = m_Size.x >> 1; // dx also is the radius for rounded pads
dy = m_Size.y >> 1; dy = m_Size.y >> 1;
switch( m_PadShape & 0x7F ) switch( GetShape() )
{ {
case PAD_CIRCLE: case PAD_CIRCLE:
if( KiROUND( EuclideanNorm( delta ) ) <= dx ) if( KiROUND( EuclideanNorm( delta ) ) <= dx )
@ -679,7 +679,28 @@ bool D_PAD::HitTest( const wxPoint& aPosition )
return TestPointInsidePolygon( poly, 4, delta ); return TestPointInsidePolygon( poly, 4, delta );
} }
default: case PAD_OVAL:
{
RotatePoint( &delta, -m_Orient );
// An oval pad has the same shape as a segment with rounded ends
// After rotation, the test point is relative to an horizontal pad
int dist;
wxPoint offset;
if( dy > dx ) // shape is a vertical oval
{
offset.y = dy - dx;
dist = dx;
}
else //if( dy <= dx ) shape is an horizontal oval
{
offset.x = dy - dx;
dist = dy;
}
return TestSegmentHit( delta, - offset, offset, dist );
}
break;
case PAD_RECT:
RotatePoint( &delta, -m_Orient ); RotatePoint( &delta, -m_Orient );
if( (abs( delta.x ) <= dx ) && (abs( delta.y ) <= dy) ) if( (abs( delta.x ) <= dx ) && (abs( delta.y ) <= dy) )
@ -696,10 +717,10 @@ int D_PAD::Compare( const D_PAD* padref, const D_PAD* padcmp )
{ {
int diff; int diff;
if( ( diff = padref->m_PadShape - padcmp->m_PadShape ) != 0 ) if( ( diff = padref->GetShape() - padcmp->GetShape() ) != 0 )
return diff; return diff;
if( ( diff = padref->m_DrillShape - padcmp->m_DrillShape ) != 0) if( ( diff = padref->GetDrillShape() - padcmp->GetDrillShape() ) != 0)
return diff; return diff;
if( ( diff = padref->m_Drill.x - padcmp->m_Drill.x ) != 0 ) if( ( diff = padref->m_Drill.x - padcmp->m_Drill.x ) != 0 )
@ -737,7 +758,7 @@ int D_PAD::Compare( const D_PAD* padref, const D_PAD* padcmp )
wxString D_PAD::ShowPadShape() const wxString D_PAD::ShowPadShape() const
{ {
switch( m_PadShape ) switch( GetShape() )
{ {
case PAD_CIRCLE: case PAD_CIRCLE:
return _( "Circle" ); return _( "Circle" );

View File

@ -140,8 +140,8 @@ public:
* Function GetShape * Function GetShape
* @return the shape of this pad. * @return the shape of this pad.
*/ */
PAD_SHAPE_T GetShape() const { return m_PadShape; } PAD_SHAPE_T GetShape() const { return m_padShape; }
void SetShape( PAD_SHAPE_T aShape ) { m_PadShape = aShape; m_boundingRadius = -1; } void SetShape( PAD_SHAPE_T aShape ) { m_padShape = aShape; m_boundingRadius = -1; }
void SetPosition( const wxPoint& aPos ) { m_Pos = aPos; } // was overload void SetPosition( const wxPoint& aPos ) { m_Pos = aPos; } // was overload
const wxPoint& GetPosition() const { return m_Pos; } // was overload const wxPoint& GetPosition() const { return m_Pos; } // was overload
@ -183,8 +183,9 @@ public:
*/ */
double GetOrientation() const { return m_Orient; } double GetOrientation() const { return m_Orient; }
void SetDrillShape( PAD_SHAPE_T aDrillShape ) { m_DrillShape = aDrillShape; } void SetDrillShape( PAD_DRILL_SHAPE_T aDrillShape )
PAD_SHAPE_T GetDrillShape() const { return m_DrillShape; } { m_drillShape = aDrillShape; }
PAD_DRILL_SHAPE_T GetDrillShape() const { return m_drillShape; }
void SetLayerMask( LAYER_MSK aLayerMask ) { m_layerMask = aLayerMask; } void SetLayerMask( LAYER_MSK aLayerMask ) { m_layerMask = aLayerMask; }
LAYER_MSK GetLayerMask() const { return m_layerMask; } LAYER_MSK GetLayerMask() const { return m_layerMask; }
@ -362,7 +363,7 @@ public:
{ {
// Any member function which would affect this calculation should set // Any member function which would affect this calculation should set
// m_boundingRadius to -1 to re-trigger the calculation from here. // m_boundingRadius to -1 to re-trigger the calculation from here.
// Currently that is only m_Size, m_DeltaSize, and m_PadShape accessors. // Currently that is only m_Size, m_DeltaSize, and m_padShape accessors.
if( m_boundingRadius == -1 ) if( m_boundingRadius == -1 )
{ {
m_boundingRadius = boundingRadius(); m_boundingRadius = boundingRadius();
@ -484,7 +485,7 @@ private:
wxPoint m_Pos; ///< pad Position on board wxPoint m_Pos; ///< pad Position on board
PAD_SHAPE_T m_PadShape; ///< Shape: PAD_CIRCLE, PAD_RECT, PAD_OVAL, PAD_TRAPEZOID PAD_SHAPE_T m_padShape; ///< Shape: PAD_CIRCLE, PAD_RECT, PAD_OVAL, PAD_TRAPEZOID
int m_SubRatsnest; ///< variable used in rats nest computations int m_SubRatsnest; ///< variable used in rats nest computations
@ -496,7 +497,8 @@ private:
wxSize m_Size; ///< X and Y size ( relative to orient 0) wxSize m_Size; ///< X and Y size ( relative to orient 0)
PAD_SHAPE_T m_DrillShape; ///< Shape PAD_CIRCLE, PAD_OVAL PAD_DRILL_SHAPE_T m_drillShape; ///< PAD_DRILL_NONE, PAD_DRILL_CIRCLE, PAD_DRILL_OBLONG
/** /**
* m_Offset is useful only for oblong pads (it can be used for other * m_Offset is useful only for oblong pads (it can be used for other

View File

@ -430,15 +430,15 @@ void D_PAD::DrawShape( EDA_RECT* aClipBox, wxDC* aDC, PAD_DRAWINFO& aDrawInfo )
if( aDrawInfo. m_ShowNotPlatedHole ) // Draw a specific hole color if( aDrawInfo. m_ShowNotPlatedHole ) // Draw a specific hole color
hole_color = aDrawInfo.m_NPHoleColor; hole_color = aDrawInfo.m_NPHoleColor;
switch( m_DrillShape ) switch( GetDrillShape() )
{ {
case PAD_CIRCLE: case PAD_DRILL_CIRCLE:
if( aDC->LogicalToDeviceXRel( hole ) > MIN_DRAW_WIDTH ) if( aDC->LogicalToDeviceXRel( hole ) > MIN_DRAW_WIDTH )
GRFilledCircle( aClipBox, aDC, holepos.x, holepos.y, hole, 0, GRFilledCircle( aClipBox, aDC, holepos.x, holepos.y, hole, 0,
hole_color, hole_color ); hole_color, hole_color );
break; break;
case PAD_OVAL: case PAD_DRILL_OBLONG:
halfsize.x = m_Drill.x >> 1; halfsize.x = m_Drill.x >> 1;
halfsize.y = m_Drill.y >> 1; halfsize.y = m_Drill.y >> 1;

View File

@ -157,7 +157,7 @@ void DIALOG_GENDRILL::InitDisplayParams()
{ {
for( D_PAD* pad = module->Pads(); pad != NULL; pad = pad->Next() ) for( D_PAD* pad = module->Pads(); pad != NULL; pad = pad->Next() )
{ {
if( pad->GetDrillShape() == PAD_CIRCLE ) if( pad->GetDrillShape() == PAD_DRILL_CIRCLE )
{ {
if( pad->GetDrillSize().x != 0 ) if( pad->GetDrillSize().x != 0 )
{ {

View File

@ -473,7 +473,7 @@ void DIALOG_PAD_PROPERTIES::initValues()
m_PadNetNameCtrl->Enable( enable ); m_PadNetNameCtrl->Enable( enable );
m_LengthPadToDieCtrl->Enable( enable ); m_LengthPadToDieCtrl->Enable( enable );
if( m_dummyPad->GetDrillShape() != PAD_OVAL ) if( m_dummyPad->GetDrillShape() != PAD_DRILL_OBLONG )
m_DrillShapeCtrl->SetSelection( 0 ); m_DrillShapeCtrl->SetSelection( 0 );
else else
m_DrillShapeCtrl->SetSelection( 1 ); m_DrillShapeCtrl->SetSelection( 1 );
@ -915,11 +915,11 @@ bool DIALOG_PAD_PROPERTIES::transferDataToPad( D_PAD* aPad )
if( m_DrillShapeCtrl->GetSelection() == 0 ) if( m_DrillShapeCtrl->GetSelection() == 0 )
{ {
aPad->SetDrillShape( PAD_CIRCLE ); aPad->SetDrillShape( PAD_DRILL_CIRCLE );
y = x; y = x;
} }
else else
aPad->SetDrillShape( PAD_OVAL ); aPad->SetDrillShape( PAD_DRILL_OBLONG );
aPad->SetDrillSize( wxSize( x, y ) ); aPad->SetDrillSize( wxSize( x, y ) );

View File

@ -705,7 +705,7 @@ bool DRC::doPadToPadsDrc( D_PAD* aRefPad, D_PAD** aStart, D_PAD** aEnd, int x_li
&& pad->GetDrillSize() == aRefPad->GetDrillSize() && pad->GetDrillSize() == aRefPad->GetDrillSize()
&& pad->GetDrillShape() == aRefPad->GetDrillShape() ) && pad->GetDrillShape() == aRefPad->GetDrillShape() )
{ {
if( aRefPad->GetDrillShape() == PAD_CIRCLE ) if( aRefPad->GetDrillShape() == PAD_DRILL_CIRCLE )
continue; continue;
// for oval holes: must also have the same orientation // for oval holes: must also have the same orientation
@ -721,7 +721,8 @@ bool DRC::doPadToPadsDrc( D_PAD* aRefPad, D_PAD** aStart, D_PAD** aEnd, int x_li
// pad under testing has a hole, test this hole against pad reference // pad under testing has a hole, test this hole against pad reference
dummypad.SetPosition( pad->GetPosition() ); dummypad.SetPosition( pad->GetPosition() );
dummypad.SetSize( pad->GetDrillSize() ); dummypad.SetSize( pad->GetDrillSize() );
dummypad.SetShape( pad->GetDrillShape() == PAD_OVAL ? PAD_OVAL : PAD_CIRCLE ); dummypad.SetShape( pad->GetDrillShape() == PAD_DRILL_OBLONG ?
PAD_OVAL : PAD_CIRCLE );
dummypad.SetOrientation( pad->GetOrientation() ); dummypad.SetOrientation( pad->GetOrientation() );
if( !checkClearancePadToPad( aRefPad, &dummypad ) ) if( !checkClearancePadToPad( aRefPad, &dummypad ) )
@ -737,7 +738,8 @@ bool DRC::doPadToPadsDrc( D_PAD* aRefPad, D_PAD** aStart, D_PAD** aEnd, int x_li
{ {
dummypad.SetPosition( aRefPad->GetPosition() ); dummypad.SetPosition( aRefPad->GetPosition() );
dummypad.SetSize( aRefPad->GetDrillSize() ); dummypad.SetSize( aRefPad->GetDrillSize() );
dummypad.SetShape( aRefPad->GetDrillShape() == PAD_OVAL ? PAD_OVAL : PAD_CIRCLE ); dummypad.SetShape( aRefPad->GetDrillShape() == PAD_DRILL_OBLONG ?
PAD_OVAL : PAD_CIRCLE );
dummypad.SetOrientation( aRefPad->GetOrientation() ); dummypad.SetOrientation( aRefPad->GetOrientation() );
if( !checkClearancePadToPad( pad, &dummypad ) ) if( !checkClearancePadToPad( pad, &dummypad ) )

View File

@ -291,7 +291,8 @@ bool DRC::doTrackDrc( TRACK* aRefSeg, TRACK* aStart, bool testPads )
dummypad.SetSize( pad->GetDrillSize() ); dummypad.SetSize( pad->GetDrillSize() );
dummypad.SetPosition( pad->GetPosition() ); dummypad.SetPosition( pad->GetPosition() );
dummypad.SetShape( pad->GetDrillShape() ); dummypad.SetShape( pad->GetDrillShape() == PAD_DRILL_OBLONG ?
PAD_OVAL : PAD_CIRCLE );
dummypad.SetOrientation( pad->GetOrientation() ); dummypad.SetOrientation( pad->GetOrientation() );
m_padToTestPos = dummypad.GetPosition() - origin; m_padToTestPos = dummypad.GetPosition() - origin;

View File

@ -271,7 +271,8 @@ static void idf_export_module( BOARD* aPcb, MODULE* aModule,
tstr = TO_UTF8( pad->GetPadName() ); tstr = TO_UTF8( pad->GetPadName() );
if( tstr.empty() || !tstr.compare( "0" ) || !tstr.compare( "~" ) if( tstr.empty() || !tstr.compare( "0" ) || !tstr.compare( "~" )
|| ( kplate == IDF3::NPTH ) || ( pad->GetDrillShape() == PAD_OVAL ) ) || ( kplate == IDF3::NPTH )
||( pad->GetDrillShape() == PAD_DRILL_OBLONG ) )
pintype = "MTG"; pintype = "MTG";
else else
pintype = "PIN"; pintype = "PIN";
@ -284,7 +285,7 @@ static void idf_export_module( BOARD* aPcb, MODULE* aModule,
// 5. Assoc. part : BOARD | NOREFDES | PANEL | {"refdes"} // 5. Assoc. part : BOARD | NOREFDES | PANEL | {"refdes"}
// 6. type : PIN | VIA | MTG | TOOL | { "other" } // 6. type : PIN | VIA | MTG | TOOL | { "other" }
// 7. owner : MCAD | ECAD | UNOWNED // 7. owner : MCAD | ECAD | UNOWNED
if( ( pad->GetDrillShape() == PAD_OVAL ) if( ( pad->GetDrillShape() == PAD_DRILL_OBLONG )
&& ( pad->GetDrillSize().x != pad->GetDrillSize().y ) ) && ( pad->GetDrillSize().x != pad->GetDrillSize().y ) )
{ {
// NOTE: IDF does not have direct support for slots; // NOTE: IDF does not have direct support for slots;

View File

@ -1043,7 +1043,7 @@ static void export_vrml_pad( MODEL_VRML& aModel, BOARD* pcb, D_PAD* aPad )
// Export the hole on the edge layer // Export the hole on the edge layer
if( hole_drill > 0 ) if( hole_drill > 0 )
{ {
if( aPad->GetDrillShape() == PAD_OVAL ) if( aPad->GetDrillShape() == PAD_DRILL_OBLONG )
{ {
// Oblong hole (slot) // Oblong hole (slot)
aModel.holes.AddSlot( hole_x, -hole_y, hole_drill_w * 2.0, hole_drill_h * 2.0, aModel.holes.AddSlot( hole_x, -hole_y, hole_drill_w * 2.0, hole_drill_h * 2.0,

View File

@ -523,7 +523,7 @@ void EXCELLON_WRITER::BuildHolesList( int aFirstLayer,
new_hole.m_Hole_Diameter = std::min( pad->GetDrillSize().x, pad->GetDrillSize().y ); new_hole.m_Hole_Diameter = std::min( pad->GetDrillSize().x, pad->GetDrillSize().y );
new_hole.m_Hole_Size.x = new_hole.m_Hole_Size.y = new_hole.m_Hole_Diameter; new_hole.m_Hole_Size.x = new_hole.m_Hole_Size.y = new_hole.m_Hole_Diameter;
if( pad->GetDrillShape() != PAD_CIRCLE ) if( pad->GetDrillShape() != PAD_DRILL_CIRCLE )
new_hole.m_Hole_Shape = 1; // oval flag set new_hole.m_Hole_Shape = 1; // oval flag set
new_hole.m_Hole_Size = pad->GetDrillSize(); new_hole.m_Hole_Size = pad->GetDrillSize();

View File

@ -1208,7 +1208,7 @@ void PCB_IO::format( D_PAD* aPad, int aNestLevel ) const
{ {
m_out->Print( 0, " (drill" ); m_out->Print( 0, " (drill" );
if( aPad->GetDrillShape() == PAD_OVAL ) if( aPad->GetDrillShape() == PAD_DRILL_OBLONG )
m_out->Print( 0, " oval" ); m_out->Print( 0, " oval" );
if( sz.GetWidth() > 0 ) if( sz.GetWidth() > 0 )

View File

@ -1243,14 +1243,14 @@ void LEGACY_PLUGIN::loadPAD( MODULE* aModule )
BIU offs_x = biuParse( data, &data ); BIU offs_x = biuParse( data, &data );
BIU offs_y = biuParse( data, &data ); BIU offs_y = biuParse( data, &data );
PAD_SHAPE_T drShape = PAD_CIRCLE; PAD_DRILL_SHAPE_T drShape = PAD_DRILL_CIRCLE;
data = strtok_r( (char*) data, delims, &saveptr ); data = strtok_r( (char*) data, delims, &saveptr );
if( data ) // optional shape if( data ) // optional shape
{ {
if( data[0] == 'O' ) if( data[0] == 'O' )
{ {
drShape = PAD_OVAL; drShape = PAD_DRILL_OBLONG;
data = strtok_r( NULL, delims, &saveptr ); data = strtok_r( NULL, delims, &saveptr );
drill_x = biuParse( data ); drill_x = biuParse( data );
@ -3348,7 +3348,7 @@ void LEGACY_PLUGIN::savePAD( const D_PAD* me ) const
fmtBIU( me->GetDrillSize().x ).c_str(), fmtBIU( me->GetDrillSize().x ).c_str(),
fmtBIUPoint( me->GetOffset() ).c_str() ); fmtBIUPoint( me->GetOffset() ).c_str() );
if( me->GetDrillShape() == PAD_OVAL ) if( me->GetDrillShape() == PAD_DRILL_OBLONG )
{ {
fprintf( m_fp, " %c %s", 'O', fmtBIUSize( me->GetDrillSize() ).c_str() ); fprintf( m_fp, " %c %s", 'O', fmtBIUSize( me->GetDrillSize() ).c_str() );
} }

View File

@ -202,7 +202,7 @@ void PCB_PAD::AddToModule( MODULE* aModule, int aRotation, bool aEncapsulatedPad
pad->SetShape( PAD_CIRCLE ); pad->SetShape( PAD_CIRCLE );
pad->SetAttribute( PAD_HOLE_NOT_PLATED ); pad->SetAttribute( PAD_HOLE_NOT_PLATED );
pad->SetDrillShape( PAD_CIRCLE ); pad->SetDrillShape( PAD_DRILL_CIRCLE );
pad->SetDrillSize( wxSize( m_hole, m_hole ) ); pad->SetDrillSize( wxSize( m_hole, m_hole ) );
pad->SetSize( wxSize( m_hole, m_hole ) ); pad->SetSize( wxSize( m_hole, m_hole ) );
@ -267,7 +267,7 @@ void PCB_PAD::AddToModule( MODULE* aModule, int aRotation, bool aEncapsulatedPad
pad->SetDelta( wxSize( 0, 0 ) ); pad->SetDelta( wxSize( 0, 0 ) );
pad->SetOrientation( m_rotation + aRotation ); pad->SetOrientation( m_rotation + aRotation );
pad->SetDrillShape( PAD_CIRCLE ); pad->SetDrillShape( PAD_DRILL_CIRCLE );
pad->SetOffset( wxPoint( 0, 0 ) ); pad->SetOffset( wxPoint( 0, 0 ) );
pad->SetDrillSize( wxSize( m_hole, m_hole ) ); pad->SetDrillSize( wxSize( m_hole, m_hole ) );

View File

@ -507,9 +507,9 @@ void PCB_PAINTER::draw( const D_PAD* aPad, int aLayer )
// Choose drawing settings depending on if we are drawing a pad itself or a hole // Choose drawing settings depending on if we are drawing a pad itself or a hole
if( aLayer == ITEM_GAL_LAYER( PADS_HOLES_VISIBLE ) ) if( aLayer == ITEM_GAL_LAYER( PADS_HOLES_VISIBLE ) )
{ {
// Drawing hole // Drawing hole: has same shape as PAD_CIRCLE or PAD_OVAL
size = VECTOR2D( aPad->GetDrillSize() ) / 2.0; size = VECTOR2D( aPad->GetDrillSize() ) / 2.0;
shape = aPad->GetDrillShape(); shape = aPad->GetDrillShape() == PAD_DRILL_OBLONG ? PAD_OVAL : PAD_CIRCLE;
} }
else if( aLayer == SOLDERMASK_N_FRONT || aLayer == SOLDERMASK_N_BACK ) else if( aLayer == SOLDERMASK_N_FRONT || aLayer == SOLDERMASK_N_BACK )
{ {
@ -620,10 +620,6 @@ void PCB_PAINTER::draw( const D_PAD* aPad, int aLayer )
case PAD_CIRCLE: case PAD_CIRCLE:
m_gal->DrawCircle( VECTOR2D( 0.0, 0.0 ), size.x ); m_gal->DrawCircle( VECTOR2D( 0.0, 0.0 ), size.x );
break; break;
case PAD_OCTAGON: // it is not used anywhere, neither you can set it using pcbnew..
case PAD_NONE:
break;
} }
m_gal->Restore(); m_gal->Restore();

View File

@ -2138,7 +2138,7 @@ D_PAD* PCB_PARSER::parseD_PAD() throw( IO_ERROR, PARSE_ERROR )
switch( token ) switch( token )
{ {
case T_oval: case T_oval:
pad->SetDrillShape( PAD_OVAL ); pad->SetDrillShape( PAD_DRILL_OBLONG );
break; break;
case T_NUMBER: case T_NUMBER:

View File

@ -155,7 +155,7 @@ private:
/** Helper function to plot a single drill mark. It compensate and clamp /** Helper function to plot a single drill mark. It compensate and clamp
* the drill mark size depending on the current plot options * the drill mark size depending on the current plot options
*/ */
void plotOneDrillMark( PAD_SHAPE_T aDrillShape, void plotOneDrillMark( PAD_DRILL_SHAPE_T aDrillShape,
const wxPoint& aDrillPos, wxSize aDrillSize, const wxPoint& aDrillPos, wxSize aDrillSize,
const wxSize& aPadSize, const wxSize& aPadSize,
double aOrientation, int aSmallDrill ); double aOrientation, int aSmallDrill );

View File

@ -638,20 +638,20 @@ void BRDITEMS_PLOTTER::PlotDrawSegment( DRAWSEGMENT* aSeg )
/** Helper function to plot a single drill mark. It compensate and clamp /** Helper function to plot a single drill mark. It compensate and clamp
* the drill mark size depending on the current plot options * the drill mark size depending on the current plot options
*/ */
void BRDITEMS_PLOTTER::plotOneDrillMark( PAD_SHAPE_T aDrillShape, void BRDITEMS_PLOTTER::plotOneDrillMark( PAD_DRILL_SHAPE_T aDrillShape,
const wxPoint &aDrillPos, wxSize aDrillSize, const wxPoint &aDrillPos, wxSize aDrillSize,
const wxSize &aPadSize, const wxSize &aPadSize,
double aOrientation, int aSmallDrill ) double aOrientation, int aSmallDrill )
{ {
// Small drill marks have no significance when applied to slots // Small drill marks have no significance when applied to slots
if( aSmallDrill && aDrillShape == PAD_ROUND ) if( aSmallDrill && aDrillShape == PAD_DRILL_CIRCLE )
aDrillSize.x = std::min( aSmallDrill, aDrillSize.x ); aDrillSize.x = std::min( aSmallDrill, aDrillSize.x );
// Round holes only have x diameter, slots have both // Round holes only have x diameter, slots have both
aDrillSize.x -= getFineWidthAdj(); aDrillSize.x -= getFineWidthAdj();
aDrillSize.x = Clamp( 1, aDrillSize.x, aPadSize.x - 1 ); aDrillSize.x = Clamp( 1, aDrillSize.x, aPadSize.x - 1 );
if( aDrillShape == PAD_OVAL ) if( aDrillShape == PAD_DRILL_OBLONG )
{ {
aDrillSize.y -= getFineWidthAdj(); aDrillSize.y -= getFineWidthAdj();
aDrillSize.y = Clamp( 1, aDrillSize.y, aPadSize.y - 1 ); aDrillSize.y = Clamp( 1, aDrillSize.y, aPadSize.y - 1 );
@ -688,7 +688,7 @@ void BRDITEMS_PLOTTER::PlotDrillMarks()
if( pts->Type() != PCB_VIA_T ) if( pts->Type() != PCB_VIA_T )
continue; continue;
plotOneDrillMark( PAD_CIRCLE, pts->GetStart(), wxSize( pts->GetDrillValue(), 0 ), plotOneDrillMark( PAD_DRILL_CIRCLE, pts->GetStart(), wxSize( pts->GetDrillValue(), 0 ),
wxSize( pts->GetWidth(), 0 ), 0, small_drill ); wxSize( pts->GetWidth(), 0 ), 0, small_drill );
} }

View File

@ -221,7 +221,8 @@ void ZONE_CONTAINER::AddClearanceAreasPolygonsToPolysList( BOARD* aPcb )
// the pad hole // the pad hole
dummypad.SetSize( pad->GetDrillSize() ); dummypad.SetSize( pad->GetDrillSize() );
dummypad.SetOrientation( pad->GetOrientation() ); dummypad.SetOrientation( pad->GetOrientation() );
dummypad.SetShape( pad->GetDrillShape() ); dummypad.SetShape( pad->GetDrillShape() == PAD_DRILL_OBLONG ?
PAD_OVAL : PAD_CIRCLE );
dummypad.SetPosition( pad->GetPosition() ); dummypad.SetPosition( pad->GetPosition() );
pad = &dummypad; pad = &dummypad;