Replace PAD_SHAPE::RECT by PAD_SHAPE::RECTANGLE to avoid a collision NAME with a windows header on MSYS2, creating many compil warnings. No actual code change.

This commit is contained in:
jean-pierre charras 2023-06-02 11:10:48 +02:00
parent 0eb45a7f27
commit 9a47b34499
25 changed files with 58 additions and 50 deletions

View File

@ -34,7 +34,7 @@
enum class PAD_SHAPE : int
{
CIRCLE,
RECT,
RECTANGLE, // do not use just RECT: it collides in a header on MSYS2
OVAL,
TRAPEZOID,
ROUNDRECT,
@ -50,7 +50,7 @@ static inline std::string PAD_SHAPE_T_asString( PAD_SHAPE a )
switch( a )
{
case PAD_SHAPE::CIRCLE: return "PAD_SHAPE::CIRCLE";
case PAD_SHAPE::RECT: return "PAD_SHAPE::RECT";
case PAD_SHAPE::RECTANGLE: return "PAD_SHAPE::RECT";
case PAD_SHAPE::OVAL: return "PAD_SHAPE::OVAL";
case PAD_SHAPE::TRAPEZOID: return "PAD_SHAPE::TRAPEZOID";
case PAD_SHAPE::ROUNDRECT: return "PAD_SHAPE::ROUNDRECT";

View File

@ -57,7 +57,7 @@ static PAD_SHAPE code_shape[] =
{
PAD_SHAPE::CIRCLE,
PAD_SHAPE::OVAL,
PAD_SHAPE::RECT,
PAD_SHAPE::RECTANGLE,
PAD_SHAPE::TRAPEZOID,
PAD_SHAPE::ROUNDRECT,
PAD_SHAPE::CHAMFERED_RECT,
@ -602,7 +602,7 @@ void DIALOG_PAD_PROPERTIES::initValues()
default:
case PAD_SHAPE::CIRCLE: m_PadShapeSelector->SetSelection( CHOICE_SHAPE_CIRCLE ); break;
case PAD_SHAPE::OVAL: m_PadShapeSelector->SetSelection( CHOICE_SHAPE_OVAL ); break;
case PAD_SHAPE::RECT: m_PadShapeSelector->SetSelection( CHOICE_SHAPE_RECT ); break;
case PAD_SHAPE::RECTANGLE: m_PadShapeSelector->SetSelection( CHOICE_SHAPE_RECT ); break;
case PAD_SHAPE::TRAPEZOID: m_PadShapeSelector->SetSelection( CHOICE_SHAPE_TRAPEZOID ); break;
case PAD_SHAPE::ROUNDRECT: m_PadShapeSelector->SetSelection( CHOICE_SHAPE_ROUNDRECT ); break;
@ -614,7 +614,7 @@ void DIALOG_PAD_PROPERTIES::initValues()
break;
case PAD_SHAPE::CUSTOM:
if( m_previewPad->GetAnchorPadShape() == PAD_SHAPE::RECT )
if( m_previewPad->GetAnchorPadShape() == PAD_SHAPE::RECTANGLE )
m_PadShapeSelector->SetSelection( CHOICE_SHAPE_CUSTOM_RECT_ANCHOR );
else
m_PadShapeSelector->SetSelection( CHOICE_SHAPE_CUSTOM_CIRC_ANCHOR );
@ -1670,7 +1670,7 @@ bool DIALOG_PAD_PROPERTIES::TransferDataFromWindow()
if( m_currentPad->GetShape() == PAD_SHAPE::ROUNDRECT &&
m_currentPad->GetRoundRectRadiusRatio() == 0.0 )
{
m_currentPad->SetShape( PAD_SHAPE::RECT );
m_currentPad->SetShape( PAD_SHAPE::RECTANGLE );
}
// Set the fabrication property:
@ -1774,7 +1774,7 @@ bool DIALOG_PAD_PROPERTIES::transferDataToPad( PAD* aPad )
aPad->SetShape( code_shape[m_PadShapeSelector->GetSelection()] );
if( m_PadShapeSelector->GetSelection() == CHOICE_SHAPE_CUSTOM_RECT_ANCHOR )
aPad->SetAnchorPadShape( PAD_SHAPE::RECT );
aPad->SetAnchorPadShape( PAD_SHAPE::RECTANGLE );
else
aPad->SetAnchorPadShape( PAD_SHAPE::CIRCLE );

View File

@ -117,7 +117,7 @@ bool DRC_TEST_PROVIDER_ANNULAR_WIDTH::Run()
case PAD_SHAPE::CIRCLE:
case PAD_SHAPE::OVAL:
case PAD_SHAPE::RECT:
case PAD_SHAPE::RECTANGLE:
case PAD_SHAPE::ROUNDRECT:
return 1;
@ -171,7 +171,7 @@ bool DRC_TEST_PROVIDER_ANNULAR_WIDTH::Run()
case PAD_SHAPE::CIRCLE:
case PAD_SHAPE::OVAL:
case PAD_SHAPE::RECT:
case PAD_SHAPE::RECTANGLE:
case PAD_SHAPE::ROUNDRECT:
annularWidth = std::min( pad->GetSizeX() - pad->GetDrillSizeX(),
pad->GetSizeY() - pad->GetDrillSizeY() ) / 2;

View File

@ -455,7 +455,7 @@ static void CreatePadsShapesSection( FILE* aFile, BOARD* aPcb )
pad->GetSize().x / (SCALE_FACTOR * 2) );
break;
case PAD_SHAPE::RECT:
case PAD_SHAPE::RECTANGLE:
fprintf( aFile, " RECTANGULAR %g\n",
pad->GetDrillSize().x / SCALE_FACTOR );

View File

@ -161,7 +161,7 @@ private:
shapeId = 2;
break;
case PAD_SHAPE::RECT:
case PAD_SHAPE::RECTANGLE:
shapeId = 1;
break;

View File

@ -147,7 +147,7 @@ FOOTPRINT* MICROWAVE_TOOL::createFootprint( MICROWAVE_FOOTPRINT_SHAPE aFootprint
case MICROWAVE_FOOTPRINT_SHAPE::STUB_ARC: // Arc Stub created by a polygonal approach:
{
pad->SetShape( PAD_SHAPE::CUSTOM );
pad->SetAnchorPadShape( PAD_SHAPE::RECT );
pad->SetAnchorPadShape( PAD_SHAPE::RECTANGLE );
int numPoints = ( angle.AsDegrees() / 5.0 ) + 3;
std::vector<VECTOR2I> polyPoints;
@ -218,7 +218,7 @@ FOOTPRINT* MICROWAVE_TOOL::createBaseFootprint( const wxString& aValue,
pad->SetSize( VECTOR2I( tw, tw ) );
pad->SetPosition( footprint->GetPosition() );
pad->SetShape( PAD_SHAPE::RECT );
pad->SetShape( PAD_SHAPE::RECTANGLE );
pad->SetAttribute( PAD_ATTRIB::SMD );
pad->SetLayerSet( F_Cu );

View File

@ -469,7 +469,7 @@ void PAD::BuildEffectiveShapes( PCB_LAYER_ID aLayer ) const
break;
case PAD_SHAPE::RECT:
case PAD_SHAPE::RECTANGLE:
case PAD_SHAPE::TRAPEZOID:
case PAD_SHAPE::ROUNDRECT:
{
@ -1224,7 +1224,7 @@ wxString PAD::ShowPadShape() const
{
case PAD_SHAPE::CIRCLE: return _( "Circle" );
case PAD_SHAPE::OVAL: return _( "Oval" );
case PAD_SHAPE::RECT: return _( "Rect" );
case PAD_SHAPE::RECTANGLE: return _( "Rect" );
case PAD_SHAPE::TRAPEZOID: return _( "Trap" );
case PAD_SHAPE::ROUNDRECT: return _( "Roundrect" );
case PAD_SHAPE::CHAMFERED_RECT: return _( "Chamferedrect" );
@ -1631,7 +1631,7 @@ void PAD::TransformShapeToPolygon( SHAPE_POLY_SET& aBuffer, PCB_LAYER_ID aLayer,
break;
case PAD_SHAPE::TRAPEZOID:
case PAD_SHAPE::RECT:
case PAD_SHAPE::RECTANGLE:
{
int ddx = GetShape() == PAD_SHAPE::TRAPEZOID ? m_deltaSize.x / 2 : 0;
int ddy = GetShape() == PAD_SHAPE::TRAPEZOID ? m_deltaSize.y / 2 : 0;
@ -1707,7 +1707,7 @@ static struct PAD_DESC
ENUM_MAP<PAD_SHAPE>::Instance()
.Map( PAD_SHAPE::CIRCLE, _HKI( "Circle" ) )
.Map( PAD_SHAPE::RECT, _HKI( "Rectangle" ) )
.Map( PAD_SHAPE::RECTANGLE, _HKI( "Rectangle" ) )
.Map( PAD_SHAPE::OVAL, _HKI( "Oval" ) )
.Map( PAD_SHAPE::TRAPEZOID, _HKI( "Trapezoid" ) )
.Map( PAD_SHAPE::ROUNDRECT, _HKI( "Rounded rectangle" ) )

View File

@ -227,12 +227,12 @@ public:
/**
* Set the shape of the anchor pad for custom shaped pads.
*
* @param aShape is the shape of the anchor pad shape( currently, only #PAD_SHAPE::RECT or
* @param aShape is the shape of the anchor pad shape( currently, only #PAD_SHAPE::RECTANGLE or
* #PAD_SHAPE::CIRCLE.
*/
void SetAnchorPadShape( PAD_SHAPE aShape )
{
m_anchorPadShape = ( aShape == PAD_SHAPE::RECT ) ? PAD_SHAPE::RECT : PAD_SHAPE::CIRCLE;
m_anchorPadShape = ( aShape == PAD_SHAPE::RECTANGLE ) ? PAD_SHAPE::RECTANGLE : PAD_SHAPE::CIRCLE;
SetDirty();
}
@ -758,9 +758,10 @@ private:
VECTOR2I m_pos; // Pad Position on board
PAD_SHAPE m_padShape; // Shape: PAD_SHAPE::CIRCLE, PAD_SHAPE::RECT,
PAD_SHAPE m_padShape; // Shape: PAD_SHAPE::CIRCLE, PAD_SHAPE::RECTANGLE,
// PAD_SHAPE::OVAL, PAD_SHAPE::TRAPEZOID,
// PAD_SHAPE::ROUNDRECT, PAD_SHAPE_POLYGON
// PAD_SHAPE::ROUNDRECT, PAD_SHAPE::CHAMFERED_RECT,
// PAD_SHAPE::CUSTOM
/*
* Editing definitions of primitives for custom pad shapes. In local coordinates relative
* to m_Pos (NOT shapePos) at orient 0.
@ -794,7 +795,7 @@ private:
int m_chamferPositions; // The positions of the chamfers (at orient 0)
PAD_SHAPE m_anchorPadShape; // For custom shaped pads: shape of pad anchor,
// PAD_SHAPE::RECT, PAD_SHAPE::CIRCLE
// PAD_SHAPE::RECTANGLE, PAD_SHAPE::CIRCLE
/*
* Most of the time the hole is the center of the shape (m_Offset = 0). But some designers

View File

@ -234,7 +234,7 @@ void PAD::MergePrimitivesAsPolygon( SHAPE_POLY_SET* aMergedPolygon, ERROR_LOC aE
// The anchor pad is always at 0,0
switch( GetAnchorPadShape() )
{
case PAD_SHAPE::RECT:
case PAD_SHAPE::RECTANGLE:
{
SHAPE_RECT rect( -GetSize().x / 2, -GetSize().y / 2, GetSize().x, GetSize().y );
aMergedPolygon->AddOutline( rect.Outline() );

View File

@ -395,7 +395,7 @@ void PlotStandardLayer( BOARD* aBoard, PLOTTER* aPlotter, LSET aLayerMask,
itemplotter.PlotPad( pad, color, padPlotMode );
break;
case PAD_SHAPE::RECT:
case PAD_SHAPE::RECTANGLE:
pad->SetSize( padPlotsSize );
if( mask_clearance > 0 )

View File

@ -228,7 +228,7 @@ void BRDITEMS_PLOTTER::PlotPad( const PAD* aPad, const COLOR4D& aColor, OUTLINE_
&gbr_metadata );
break;
case PAD_SHAPE::RECT:
case PAD_SHAPE::RECTANGLE:
m_plotter->FlashPadRect( shape_pos, aPad->GetSize(), aPad->GetOrientation(), aPlotMode,
&gbr_metadata );
break;

View File

@ -2468,7 +2468,7 @@ void ALTIUM_PCB::ConvertPads6ToFootprintItemOnCopper( FOOTPRINT* aFootprint, con
switch( aElem.topshape )
{
case ALTIUM_PAD_SHAPE::RECT:
pad->SetShape( PAD_SHAPE::RECT );
pad->SetShape( PAD_SHAPE::RECTANGLE );
break;
case ALTIUM_PAD_SHAPE::CIRCLE:

View File

@ -1136,7 +1136,7 @@ PAD* CADSTAR_PCB_ARCHIVE_LOADER::getKiCadPad( const COMPONENT_PAD& aCadstarPad,
// Cadstar diamond shape is a square rotated 45 degrees
// We convert it in KiCad to a square with chamfered edges
int sizeOfSquare = (double) getKiCadLength( csPadcode.Shape.Size ) * sqrt(2.0);
pad->SetShape( PAD_SHAPE::RECT );
pad->SetShape( PAD_SHAPE::RECTANGLE );
pad->SetChamferRectRatio( 0.5 );
pad->SetSize( { sizeOfSquare, sizeOfSquare } );
@ -1165,7 +1165,7 @@ PAD* CADSTAR_PCB_ARCHIVE_LOADER::getKiCadPad( const COMPONENT_PAD& aCadstarPad,
break;
case PAD_SHAPE_TYPE::RECTANGLE:
pad->SetShape( PAD_SHAPE::RECT );
pad->SetShape( PAD_SHAPE::RECTANGLE );
pad->SetSize( { getKiCadLength( (long long) csPadcode.Shape.Size
+ (long long) csPadcode.Shape.LeftLength
+ (long long) csPadcode.Shape.RightLength ),
@ -1189,7 +1189,7 @@ PAD* CADSTAR_PCB_ARCHIVE_LOADER::getKiCadPad( const COMPONENT_PAD& aCadstarPad,
case PAD_SHAPE_TYPE::SQUARE:
pad->SetShape( PAD_SHAPE::RECT );
pad->SetShape( PAD_SHAPE::RECTANGLE );
pad->SetSize( { getKiCadLength( csPadcode.Shape.Size ),
getKiCadLength( csPadcode.Shape.Size ) } );
break;
@ -1259,7 +1259,7 @@ PAD* CADSTAR_PCB_ARCHIVE_LOADER::getKiCadPad( const COMPONENT_PAD& aCadstarPad,
if( editedPadOutline.Contains( { 0, 0 } ) )
{
pad->SetAnchorPadShape( PAD_SHAPE::RECT );
pad->SetAnchorPadShape( PAD_SHAPE::RECTANGLE );
pad->SetSize( VECTOR2I( { 4, 4 } ) );
pad->SetShape( PAD_SHAPE::CUSTOM );
pad->AddPrimitive( padShape );

View File

@ -1888,7 +1888,7 @@ void EAGLE_PLUGIN::packagePad( FOOTPRINT* aFootprint, wxXmlNode* aTree )
break;
case EPAD::SQUARE:
pad->SetShape( PAD_SHAPE::RECT );
pad->SetShape( PAD_SHAPE::RECTANGLE );
break;
case EPAD::OFFSET:
@ -2386,7 +2386,7 @@ void EAGLE_PLUGIN::packageSMD( FOOTPRINT* aFootprint, wxXmlNode* aTree ) const
pad->SetKeepTopBottom( false ); // TODO: correct? This seems to be KiCad default on import
pad->SetShape( PAD_SHAPE::RECT );
pad->SetShape( PAD_SHAPE::RECTANGLE );
pad->SetAttribute( PAD_ATTRIB::SMD );
VECTOR2I padSize( e.dx.ToPcbUnits(), e.dy.ToPcbUnits() );

View File

@ -614,7 +614,7 @@ size_t FABMASTER::processPadStacks( size_t aRow )
}
else if( pad_shape == "RECTANGLE" )
{
pad->shape = PAD_SHAPE::RECT;
pad->shape = PAD_SHAPE::RECTANGLE;
}
else if( pad_shape == "ROUNDED_RECT" )
{
@ -622,14 +622,14 @@ size_t FABMASTER::processPadStacks( size_t aRow )
}
else if( pad_shape == "SQUARE" )
{
pad->shape = PAD_SHAPE::RECT;
pad->shape = PAD_SHAPE::RECTANGLE;
pad->height = pad->width;
}
else if( pad_shape == "OBLONG" || pad_shape == "OBLONG_X" || pad_shape == "OBLONG_Y" )
pad->shape = PAD_SHAPE::OVAL;
else if( pad_shape == "OCTAGON" )
{
pad->shape = PAD_SHAPE::RECT;
pad->shape = PAD_SHAPE::RECTANGLE;
pad->is_octogon = true;
}
else if( pad_shape == "SHAPE" )

View File

@ -546,7 +546,7 @@ FOOTPRINT* GPCB_FPL_CACHE::parseFOOTPRINT( LINE_READER* aLineReader )
static const LSET pad_front( 3, F_Cu, F_Mask, F_Paste );
static const LSET pad_back( 3, B_Cu, B_Mask, B_Paste );
pad->SetShape( PAD_SHAPE::RECT );
pad->SetShape( PAD_SHAPE::RECTANGLE );
pad->SetAttribute( PAD_ATTRIB::SMD );
pad->SetLayerSet( pad_front );
@ -644,7 +644,7 @@ FOOTPRINT* GPCB_FPL_CACHE::parseFOOTPRINT( LINE_READER* aLineReader )
pad->SetLayerSet( pad_set );
if( testFlags( parameters[paramCnt-2], 0x0100, wxT( "square" ) ) )
pad->SetShape( PAD_SHAPE::RECT );
pad->SetShape( PAD_SHAPE::RECTANGLE );
// Set the pad name:
// Pcbnew pad name is used for electrical connection calculations.

View File

@ -4130,7 +4130,7 @@ PAD* PCB_PARSER::parsePAD( FOOTPRINT* aParent )
break;
case T_rect:
pad->SetShape( PAD_SHAPE::RECT );
pad->SetShape( PAD_SHAPE::RECTANGLE );
break;
case T_oval:
@ -4620,7 +4620,7 @@ bool PCB_PARSER::parsePAD_option( PAD* aPad )
break;
case T_rect:
aPad->SetAnchorPadShape( PAD_SHAPE::RECT );
aPad->SetAnchorPadShape( PAD_SHAPE::RECTANGLE );
break;
default:

View File

@ -1382,7 +1382,7 @@ void PCB_PLUGIN::format( const PAD* aPad, int aNestLevel ) const
switch( aPad->GetShape() )
{
case PAD_SHAPE::CIRCLE: shape = "circle"; break;
case PAD_SHAPE::RECT: shape = "rect"; break;
case PAD_SHAPE::RECTANGLE: shape = "rect"; break;
case PAD_SHAPE::OVAL: shape = "oval"; break;
case PAD_SHAPE::TRAPEZOID: shape = "trapezoid"; break;
case PAD_SHAPE::CHAMFERED_RECT:
@ -1629,7 +1629,7 @@ void PCB_PLUGIN::format( const PAD* aPad, int aNestLevel ) const
#endif
// Output the anchor pad shape (circle/rect)
if( aPad->GetAnchorPadShape() == PAD_SHAPE::RECT )
if( aPad->GetAnchorPadShape() == PAD_SHAPE::RECTANGLE )
shape = "rect";
else
shape = "circle";

View File

@ -1340,7 +1340,7 @@ void LEGACY_PLUGIN::loadPAD( FOOTPRINT* aFootprint )
switch( padchar )
{
case 'C': padshape = static_cast<int>( PAD_SHAPE::CIRCLE ); break;
case 'R': padshape = static_cast<int>( PAD_SHAPE::RECT ); break;
case 'R': padshape = static_cast<int>( PAD_SHAPE::RECTANGLE ); break;
case 'O': padshape = static_cast<int>( PAD_SHAPE::OVAL ); break;
case 'T': padshape = static_cast<int>( PAD_SHAPE::TRAPEZOID ); break;
default:

View File

@ -276,7 +276,7 @@ void PCAD_PAD::AddToFootprint( FOOTPRINT* aFootprint, const EDA_ANGLE& aRotation
}
else if( padShapeName.IsSameAs( wxT( "Rect" ), false ) )
{
pad->SetShape( PAD_SHAPE::RECT );
pad->SetShape( PAD_SHAPE::RECTANGLE );
}
else if( padShapeName.IsSameAs( wxT( "RndRect" ), false ) )
{
@ -284,7 +284,7 @@ void PCAD_PAD::AddToFootprint( FOOTPRINT* aFootprint, const EDA_ANGLE& aRotation
}
else if( padShapeName.IsSameAs( wxT( "Polygon" ), false ) )
{
pad->SetShape( PAD_SHAPE::RECT ); // approximation
pad->SetShape( PAD_SHAPE::RECTANGLE ); // approximation
}
pad->SetSize( VECTOR2I( width, height ) );

View File

@ -8,6 +8,13 @@
#include <pad.h>
%}
/* Only for compatibility with old python scripts: */
const int PAD_SHAPE_RECT = (const int)PAD_SHAPE::RECTANGLE;
%{
const int PAD_SHAPE_RECT = (const int)PAD_SHAPE::RECTANGLE;
%}
%extend PAD
{
%pythoncode

View File

@ -327,7 +327,7 @@ PADSTACK* SPECCTRA_DB::makePADSTACK( BOARD* aBoard, PAD* aPad )
break;
}
case PAD_SHAPE::RECT:
case PAD_SHAPE::RECTANGLE:
{
double dx = scale( aPad->GetSize().x ) / 2.0;
double dy = scale( aPad->GetSize().y ) / 2.0;

View File

@ -824,7 +824,7 @@ std::vector<PCB_SHAPE*> PAD_TOOL::RecombinePad( PAD* aPad, bool aIsDryRun, BOARD
{
aCommit.Modify( aPad );
if( aPad->GetShape() == PAD_SHAPE::RECT || aPad->GetShape() == PAD_SHAPE::CIRCLE )
if( aPad->GetShape() == PAD_SHAPE::RECTANGLE || aPad->GetShape() == PAD_SHAPE::CIRCLE )
{
aPad->SetAnchorPadShape( aPad->GetShape() );
}

View File

@ -473,7 +473,7 @@ void PCB_GRID_HELPER::computeAnchors( BOARD_ITEM* aItem, const VECTOR2I& aRefPos
break;
}
case PAD_SHAPE::RECT:
case PAD_SHAPE::RECTANGLE:
case PAD_SHAPE::TRAPEZOID:
case PAD_SHAPE::ROUNDRECT:
case PAD_SHAPE::CHAMFERED_RECT:

View File

@ -282,7 +282,7 @@ std::shared_ptr<EDIT_POINTS> PCB_POINT_EDITOR::makePoints( EDA_ITEM* aItem )
case PAD_SHAPE::OVAL:
case PAD_SHAPE::TRAPEZOID:
case PAD_SHAPE::RECT:
case PAD_SHAPE::RECTANGLE:
case PAD_SHAPE::ROUNDRECT:
case PAD_SHAPE::CHAMFERED_RECT:
{
@ -1298,7 +1298,7 @@ void PCB_POINT_EDITOR::updateItem() const
case PAD_SHAPE::OVAL:
case PAD_SHAPE::TRAPEZOID:
case PAD_SHAPE::RECT:
case PAD_SHAPE::RECTANGLE:
case PAD_SHAPE::ROUNDRECT:
case PAD_SHAPE::CHAMFERED_RECT:
{
@ -1812,7 +1812,7 @@ void PCB_POINT_EDITOR::updatePoints()
case PAD_SHAPE::OVAL:
case PAD_SHAPE::TRAPEZOID:
case PAD_SHAPE::RECT:
case PAD_SHAPE::RECTANGLE:
case PAD_SHAPE::ROUNDRECT:
case PAD_SHAPE::CHAMFERED_RECT:
{