pcbnew: Move pads to std::deque
This commit is contained in:
parent
6c93cccb70
commit
9163ac543a
|
@ -482,7 +482,7 @@ class CINFO3D_VISU
|
||||||
SHAPE_POLY_SET &aCornerBuffer,
|
SHAPE_POLY_SET &aCornerBuffer,
|
||||||
int aWidth) const;
|
int aWidth) const;
|
||||||
|
|
||||||
void transformPadsShapesWithClearanceToPolygon( const DLIST<D_PAD> &aPads,
|
void transformPadsShapesWithClearanceToPolygon( const PADS &aPads,
|
||||||
PCB_LAYER_ID aLayer,
|
PCB_LAYER_ID aLayer,
|
||||||
SHAPE_POLY_SET &aCornerBuffer,
|
SHAPE_POLY_SET &aCornerBuffer,
|
||||||
int aInflateValue,
|
int aInflateValue,
|
||||||
|
|
|
@ -623,11 +623,9 @@ void CINFO3D_VISU::AddPadsShapesWithClearanceToContainer( const MODULE* aModule,
|
||||||
int aInflateValue,
|
int aInflateValue,
|
||||||
bool aSkipNPTHPadsWihNoCopper )
|
bool aSkipNPTHPadsWihNoCopper )
|
||||||
{
|
{
|
||||||
const D_PAD* pad = aModule->PadsList();
|
|
||||||
|
|
||||||
wxSize margin;
|
wxSize margin;
|
||||||
|
|
||||||
for( ; pad != NULL; pad = pad->Next() )
|
for( auto pad : aModule->Pads() )
|
||||||
{
|
{
|
||||||
if( !pad->IsOnLayer( aLayerId ) )
|
if( !pad->IsOnLayer( aLayerId ) )
|
||||||
continue;
|
continue;
|
||||||
|
|
|
@ -490,9 +490,7 @@ void CINFO3D_VISU::createLayers( REPORTER *aStatusTextReporter )
|
||||||
// /////////////////////////////////////////////////////////////////////////
|
// /////////////////////////////////////////////////////////////////////////
|
||||||
for( auto module : m_board->Modules() )
|
for( auto module : m_board->Modules() )
|
||||||
{
|
{
|
||||||
const D_PAD* pad = module->PadsList();
|
for( auto pad : module->Pads() )
|
||||||
|
|
||||||
for( ; pad; pad = pad->Next() )
|
|
||||||
{
|
{
|
||||||
const wxSize padHole = pad->GetDrillSize();
|
const wxSize padHole = pad->GetDrillSize();
|
||||||
|
|
||||||
|
@ -524,9 +522,7 @@ void CINFO3D_VISU::createLayers( REPORTER *aStatusTextReporter )
|
||||||
// /////////////////////////////////////////////////////////////////////////
|
// /////////////////////////////////////////////////////////////////////////
|
||||||
for( auto module : m_board->Modules() )
|
for( auto module : m_board->Modules() )
|
||||||
{
|
{
|
||||||
const D_PAD* pad = module->PadsList();
|
for( auto pad : module->Pads() )
|
||||||
|
|
||||||
for( ; pad; pad = pad->Next() )
|
|
||||||
{
|
{
|
||||||
const wxSize padHole = pad->GetDrillSize();
|
const wxSize padHole = pad->GetDrillSize();
|
||||||
|
|
||||||
|
@ -610,7 +606,7 @@ void CINFO3D_VISU::createLayers( REPORTER *aStatusTextReporter )
|
||||||
|
|
||||||
// Note: NPTH pads are not drawn on copper layers when the pad
|
// Note: NPTH pads are not drawn on copper layers when the pad
|
||||||
// has same shape as its hole
|
// has same shape as its hole
|
||||||
transformPadsShapesWithClearanceToPolygon( module->PadsList(),
|
transformPadsShapesWithClearanceToPolygon( module->Pads(),
|
||||||
curr_layer_id,
|
curr_layer_id,
|
||||||
*layerPoly,
|
*layerPoly,
|
||||||
0,
|
0,
|
||||||
|
@ -997,10 +993,9 @@ void CINFO3D_VISU::createLayers( REPORTER *aStatusTextReporter )
|
||||||
{
|
{
|
||||||
if( (curr_layer_id == F_SilkS) || (curr_layer_id == B_SilkS) )
|
if( (curr_layer_id == F_SilkS) || (curr_layer_id == B_SilkS) )
|
||||||
{
|
{
|
||||||
D_PAD* pad = module->PadsList();
|
|
||||||
int linewidth = g_DrawDefaultLineThickness;
|
int linewidth = g_DrawDefaultLineThickness;
|
||||||
|
|
||||||
for( ; pad; pad = pad->Next() )
|
for( auto pad : module->Pads() )
|
||||||
{
|
{
|
||||||
if( !pad->IsOnLayer( curr_layer_id ) )
|
if( !pad->IsOnLayer( curr_layer_id ) )
|
||||||
continue;
|
continue;
|
||||||
|
@ -1024,10 +1019,9 @@ void CINFO3D_VISU::createLayers( REPORTER *aStatusTextReporter )
|
||||||
{
|
{
|
||||||
if( (curr_layer_id == F_SilkS) || (curr_layer_id == B_SilkS) )
|
if( (curr_layer_id == F_SilkS) || (curr_layer_id == B_SilkS) )
|
||||||
{
|
{
|
||||||
D_PAD* pad = module->PadsList();
|
|
||||||
const int linewidth = g_DrawDefaultLineThickness;
|
const int linewidth = g_DrawDefaultLineThickness;
|
||||||
|
|
||||||
for( ; pad; pad = pad->Next() )
|
for( auto pad : module->Pads() )
|
||||||
{
|
{
|
||||||
if( !pad->IsOnLayer( curr_layer_id ) )
|
if( !pad->IsOnLayer( curr_layer_id ) )
|
||||||
continue;
|
continue;
|
||||||
|
@ -1038,7 +1032,7 @@ void CINFO3D_VISU::createLayers( REPORTER *aStatusTextReporter )
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
transformPadsShapesWithClearanceToPolygon(
|
transformPadsShapesWithClearanceToPolygon(
|
||||||
module->PadsList(), curr_layer_id, *layerPoly, 0, false );
|
module->Pads(), curr_layer_id, *layerPoly, 0, false );
|
||||||
}
|
}
|
||||||
|
|
||||||
// On tech layers, use a poor circle approximation, only for texts (stroke font)
|
// On tech layers, use a poor circle approximation, only for texts (stroke font)
|
||||||
|
|
|
@ -139,15 +139,13 @@ void CINFO3D_VISU::buildPadShapeThickOutlineAsPolygon( const D_PAD* aPad,
|
||||||
|
|
||||||
// Based on the same function name in board_items_to_polyshape_transform.cpp
|
// Based on the same function name in board_items_to_polyshape_transform.cpp
|
||||||
// It was implemented here to allow dynamic segments count per pad shape
|
// It was implemented here to allow dynamic segments count per pad shape
|
||||||
void CINFO3D_VISU::transformPadsShapesWithClearanceToPolygon( const DLIST<D_PAD>& aPads, PCB_LAYER_ID aLayer,
|
void CINFO3D_VISU::transformPadsShapesWithClearanceToPolygon( const PADS& aPads, PCB_LAYER_ID aLayer,
|
||||||
SHAPE_POLY_SET& aCornerBuffer,
|
SHAPE_POLY_SET& aCornerBuffer,
|
||||||
int aInflateValue,
|
int aInflateValue,
|
||||||
bool aSkipNPTHPadsWihNoCopper ) const
|
bool aSkipNPTHPadsWihNoCopper ) const
|
||||||
{
|
{
|
||||||
const D_PAD* pad = aPads;
|
|
||||||
|
|
||||||
wxSize margin;
|
wxSize margin;
|
||||||
for( ; pad != NULL; pad = pad->Next() )
|
for( auto pad : aPads )
|
||||||
{
|
{
|
||||||
if( !pad->IsOnLayer(aLayer) )
|
if( !pad->IsOnLayer(aLayer) )
|
||||||
continue;
|
continue;
|
||||||
|
|
|
@ -800,7 +800,7 @@ void C3D_RENDER_OGL_LEGACY::generate_3D_Vias_and_Pads()
|
||||||
// Insert pads holes (vertical cylinders)
|
// Insert pads holes (vertical cylinders)
|
||||||
for( const auto module : m_settings.GetBoard()->Modules() )
|
for( const auto module : m_settings.GetBoard()->Modules() )
|
||||||
{
|
{
|
||||||
for( const D_PAD* pad = module->PadsList(); pad; pad = pad->Next() )
|
for( auto pad : module->Pads() )
|
||||||
{
|
{
|
||||||
if( pad->GetAttribute() != PAD_ATTRIB_HOLE_NOT_PLATED )
|
if( pad->GetAttribute() != PAD_ATTRIB_HOLE_NOT_PLATED )
|
||||||
{
|
{
|
||||||
|
|
|
@ -1183,7 +1183,7 @@ void C3D_RENDER_RAYTRACING::add_3D_vias_and_pads_to_container()
|
||||||
// Insert pads holes (vertical cylinders)
|
// Insert pads holes (vertical cylinders)
|
||||||
for( auto module : m_settings.GetBoard()->Modules() )
|
for( auto module : m_settings.GetBoard()->Modules() )
|
||||||
{
|
{
|
||||||
for( const D_PAD* pad = module->PadsList(); pad; pad = pad->Next() )
|
for( auto pad : module->Pads() )
|
||||||
if( pad->GetAttribute () != PAD_ATTRIB_HOLE_NOT_PLATED )
|
if( pad->GetAttribute () != PAD_ATTRIB_HOLE_NOT_PLATED )
|
||||||
{
|
{
|
||||||
insert3DPadHole( pad );
|
insert3DPadHole( pad );
|
||||||
|
|
|
@ -69,8 +69,8 @@ size_t hash_eda( const EDA_ITEM* aItem, int aFlags )
|
||||||
for( const BOARD_ITEM* i = module->GraphicalItemsList(); i; i = i->Next() )
|
for( const BOARD_ITEM* i = module->GraphicalItemsList(); i; i = i->Next() )
|
||||||
ret ^= hash_eda( i, aFlags );
|
ret ^= hash_eda( i, aFlags );
|
||||||
|
|
||||||
for( const D_PAD* i = module->PadsList(); i; i = i->Next() )
|
for( auto i : module->Pads() )
|
||||||
ret ^= hash_eda( i, aFlags );
|
ret ^= hash_eda( static_cast<EDA_ITEM*>( i ), aFlags );
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
|
@ -45,7 +45,7 @@ ARRAY_PAD_NAME_PROVIDER::ARRAY_PAD_NAME_PROVIDER(
|
||||||
if( aMod )
|
if( aMod )
|
||||||
{
|
{
|
||||||
// reserve the name of each existing pad
|
// reserve the name of each existing pad
|
||||||
for( D_PAD* pad = aMod->PadsList(); pad; pad = pad->Next() )
|
for( auto pad : aMod->Pads() )
|
||||||
{
|
{
|
||||||
m_existing_pad_names.insert( pad->GetName() );
|
m_existing_pad_names.insert( pad->GetName() );
|
||||||
}
|
}
|
||||||
|
|
|
@ -128,10 +128,9 @@ void MODULE::TransformPadsShapesWithClearanceToPolygon( PCB_LAYER_ID aLayer,
|
||||||
SHAPE_POLY_SET& aCornerBuffer, int aInflateValue, int aMaxError,
|
SHAPE_POLY_SET& aCornerBuffer, int aInflateValue, int aMaxError,
|
||||||
bool aSkipNPTHPadsWihNoCopper ) const
|
bool aSkipNPTHPadsWihNoCopper ) const
|
||||||
{
|
{
|
||||||
D_PAD* pad = PadsList();
|
|
||||||
|
|
||||||
wxSize margin;
|
wxSize margin;
|
||||||
for( ; pad != NULL; pad = pad->Next() )
|
|
||||||
|
for( auto pad : m_pads )
|
||||||
{
|
{
|
||||||
if( aLayer != UNDEFINED_LAYER && !pad->IsOnLayer(aLayer) )
|
if( aLayer != UNDEFINED_LAYER && !pad->IsOnLayer(aLayer) )
|
||||||
continue;
|
continue;
|
||||||
|
|
|
@ -291,7 +291,7 @@ bool BOARD_NETLIST_UPDATER::updateComponentPadConnections( MODULE* aPcbComponent
|
||||||
bool changed = false;
|
bool changed = false;
|
||||||
|
|
||||||
// At this point, the component footprint is updated. Now update the nets.
|
// At this point, the component footprint is updated. Now update the nets.
|
||||||
for( D_PAD* pad = aPcbComponent->PadsList(); pad; pad = pad->Next() )
|
for( auto pad : aPcbComponent->Pads() )
|
||||||
{
|
{
|
||||||
COMPONENT_NET net = aNewComponent->GetNet( pad->GetName() );
|
COMPONENT_NET net = aNewComponent->GetNet( pad->GetName() );
|
||||||
|
|
||||||
|
|
|
@ -1725,7 +1725,7 @@ unsigned BOARD::GetPadCount()
|
||||||
unsigned retval = 0;
|
unsigned retval = 0;
|
||||||
|
|
||||||
for( auto mod : Modules() )
|
for( auto mod : Modules() )
|
||||||
retval += mod->Pads().Size();
|
retval += mod->Pads().size();
|
||||||
|
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,7 +32,6 @@
|
||||||
|
|
||||||
#include <tuple>
|
#include <tuple>
|
||||||
|
|
||||||
#include <dlist.h>
|
|
||||||
#include <core/iterators.h>
|
#include <core/iterators.h>
|
||||||
|
|
||||||
#include <board_design_settings.h>
|
#include <board_design_settings.h>
|
||||||
|
@ -163,8 +162,6 @@ protected:
|
||||||
DECL_VEC_FOR_SWIG( MARKERS, MARKER_PCB* )
|
DECL_VEC_FOR_SWIG( MARKERS, MARKER_PCB* )
|
||||||
DECL_VEC_FOR_SWIG( ZONE_CONTAINERS, ZONE_CONTAINER* )
|
DECL_VEC_FOR_SWIG( ZONE_CONTAINERS, ZONE_CONTAINER* )
|
||||||
DECL_DEQ_FOR_SWIG( TRACKS, TRACK* )
|
DECL_DEQ_FOR_SWIG( TRACKS, TRACK* )
|
||||||
DECL_DEQ_FOR_SWIG( DRAWINGS, BOARD_ITEM* )
|
|
||||||
DECL_DEQ_FOR_SWIG( MODULES, MODULE* )
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -103,7 +103,7 @@ MODULE::MODULE( const MODULE& aModule ) :
|
||||||
m_Value->SetParent( this );
|
m_Value->SetParent( this );
|
||||||
|
|
||||||
// Copy auxiliary data: Pads
|
// Copy auxiliary data: Pads
|
||||||
for( D_PAD* pad = aModule.m_Pads; pad; pad = pad->Next() )
|
for( auto pad : aModule.Pads() )
|
||||||
{
|
{
|
||||||
Add( new D_PAD( *pad ) );
|
Add( new D_PAD( *pad ) );
|
||||||
}
|
}
|
||||||
|
@ -179,9 +179,9 @@ MODULE& MODULE::operator=( const MODULE& aOther )
|
||||||
m_Value->SetParent( this );
|
m_Value->SetParent( this );
|
||||||
|
|
||||||
// Copy auxiliary data: Pads
|
// Copy auxiliary data: Pads
|
||||||
m_Pads.DeleteAll();
|
m_pads.clear();
|
||||||
|
|
||||||
for( D_PAD* pad = aOther.m_Pads; pad; pad = pad->Next() )
|
for( auto pad : aOther.Pads() )
|
||||||
{
|
{
|
||||||
Add( new D_PAD( *pad ) );
|
Add( new D_PAD( *pad ) );
|
||||||
}
|
}
|
||||||
|
@ -221,7 +221,7 @@ void MODULE::ClearAllNets()
|
||||||
{
|
{
|
||||||
// Force the ORPHANED dummy net info for all pads.
|
// Force the ORPHANED dummy net info for all pads.
|
||||||
// ORPHANED dummy net does not depend on a board
|
// ORPHANED dummy net does not depend on a board
|
||||||
for( D_PAD* pad = PadsList(); pad; pad = pad->Next() )
|
for( auto pad : m_pads )
|
||||||
pad->SetNetCode( NETINFO_LIST::ORPHANED );
|
pad->SetNetCode( NETINFO_LIST::ORPHANED );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -245,9 +245,9 @@ void MODULE::Add( BOARD_ITEM* aBoardItem, ADD_MODE aMode )
|
||||||
|
|
||||||
case PCB_PAD_T:
|
case PCB_PAD_T:
|
||||||
if( aMode == ADD_APPEND )
|
if( aMode == ADD_APPEND )
|
||||||
m_Pads.PushBack( static_cast<D_PAD*>( aBoardItem ) );
|
m_pads.push_back( static_cast<D_PAD*>( aBoardItem ) );
|
||||||
else
|
else
|
||||||
m_Pads.PushFront( static_cast<D_PAD*>( aBoardItem ) );
|
m_pads.push_front( static_cast<D_PAD*>( aBoardItem ) );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
@ -280,7 +280,8 @@ void MODULE::Remove( BOARD_ITEM* aBoardItem )
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PCB_PAD_T:
|
case PCB_PAD_T:
|
||||||
m_Pads.Remove( static_cast<D_PAD*>( aBoardItem ) );
|
m_pads.erase( std::remove_if( m_pads.begin(), m_pads.end(),
|
||||||
|
[aBoardItem]( BOARD_ITEM* aItem ) { return aItem == aBoardItem; } ) );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
@ -321,7 +322,7 @@ void MODULE::CopyNetlistSettings( MODULE* aModule, bool aCopyLocalSettings )
|
||||||
aModule->SetThermalGap( GetThermalGap() );
|
aModule->SetThermalGap( GetThermalGap() );
|
||||||
}
|
}
|
||||||
|
|
||||||
for( D_PAD* pad = aModule->PadsList(); pad; pad = pad->Next() )
|
for( auto pad : m_pads )
|
||||||
{
|
{
|
||||||
// Fix me: if aCopyLocalSettings == true, for "multiple" pads
|
// Fix me: if aCopyLocalSettings == true, for "multiple" pads
|
||||||
// (set of pads having the same name/number) this is broken
|
// (set of pads having the same name/number) this is broken
|
||||||
|
@ -343,7 +344,7 @@ void MODULE::CopyNetlistSettings( MODULE* aModule, bool aCopyLocalSettings )
|
||||||
|
|
||||||
void MODULE::Print( PCB_BASE_FRAME* aFrame, wxDC* aDC, const wxPoint& aOffset )
|
void MODULE::Print( PCB_BASE_FRAME* aFrame, wxDC* aDC, const wxPoint& aOffset )
|
||||||
{
|
{
|
||||||
for( D_PAD* pad = m_Pads; pad; pad = pad->Next() )
|
for( auto pad : m_pads )
|
||||||
pad->Print( aFrame, aDC, aOffset );
|
pad->Print( aFrame, aDC, aOffset );
|
||||||
|
|
||||||
BOARD* brd = GetBoard();
|
BOARD* brd = GetBoard();
|
||||||
|
@ -399,7 +400,7 @@ EDA_RECT MODULE::GetFootprintRect() const
|
||||||
area.Merge( item->GetBoundingBox() );
|
area.Merge( item->GetBoundingBox() );
|
||||||
}
|
}
|
||||||
|
|
||||||
for( D_PAD* pad = m_Pads; pad; pad = pad->Next() )
|
for( auto pad : m_pads )
|
||||||
area.Merge( pad->GetBoundingBox() );
|
area.Merge( pad->GetBoundingBox() );
|
||||||
|
|
||||||
return area;
|
return area;
|
||||||
|
@ -475,7 +476,6 @@ SHAPE_POLY_SET MODULE::GetBoundingPoly() const
|
||||||
|
|
||||||
void MODULE::GetMsgPanelInfo( EDA_UNITS_T aUnits, std::vector< MSG_PANEL_ITEM >& aList )
|
void MODULE::GetMsgPanelInfo( EDA_UNITS_T aUnits, std::vector< MSG_PANEL_ITEM >& aList )
|
||||||
{
|
{
|
||||||
int nbpad;
|
|
||||||
wxString msg;
|
wxString msg;
|
||||||
|
|
||||||
aList.push_back( MSG_PANEL_ITEM( m_Reference->GetShownText(), m_Value->GetShownText(), DARKCYAN ) );
|
aList.push_back( MSG_PANEL_ITEM( m_Reference->GetShownText(), m_Value->GetShownText(), DARKCYAN ) );
|
||||||
|
@ -498,16 +498,8 @@ void MODULE::GetMsgPanelInfo( EDA_UNITS_T aUnits, std::vector< MSG_PANEL_ITEM >&
|
||||||
aList.push_back( MSG_PANEL_ITEM( _( "Board Side" ),
|
aList.push_back( MSG_PANEL_ITEM( _( "Board Side" ),
|
||||||
IsFlipped()? _( "Back (Flipped)" ) : _( "Front" ), RED ) );
|
IsFlipped()? _( "Back (Flipped)" ) : _( "Front" ), RED ) );
|
||||||
|
|
||||||
EDA_ITEM* PtStruct = m_Pads;
|
|
||||||
nbpad = 0;
|
|
||||||
|
|
||||||
while( PtStruct )
|
msg.Printf( wxT( "%zu" ), m_pads.size() );
|
||||||
{
|
|
||||||
nbpad++;
|
|
||||||
PtStruct = PtStruct->Next();
|
|
||||||
}
|
|
||||||
|
|
||||||
msg.Printf( wxT( "%d" ), nbpad );
|
|
||||||
aList.push_back( MSG_PANEL_ITEM( _( "Pads" ), msg, BLUE ) );
|
aList.push_back( MSG_PANEL_ITEM( _( "Pads" ), msg, BLUE ) );
|
||||||
|
|
||||||
msg = wxT( ".." );
|
msg = wxT( ".." );
|
||||||
|
@ -592,7 +584,7 @@ bool MODULE::HitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy ) co
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// Determine if any elements in the MODULE intersect the rect
|
// Determine if any elements in the MODULE intersect the rect
|
||||||
for( D_PAD* pad = m_Pads; pad; pad = pad->Next() )
|
for( auto pad : m_pads )
|
||||||
{
|
{
|
||||||
if( pad->HitTest( arect, false, 0 ) )
|
if( pad->HitTest( arect, false, 0 ) )
|
||||||
return true;
|
return true;
|
||||||
|
@ -612,7 +604,7 @@ bool MODULE::HitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy ) co
|
||||||
|
|
||||||
D_PAD* MODULE::FindPadByName( const wxString& aPadName ) const
|
D_PAD* MODULE::FindPadByName( const wxString& aPadName ) const
|
||||||
{
|
{
|
||||||
for( D_PAD* pad = m_Pads; pad; pad = pad->Next() )
|
for( auto pad : m_pads )
|
||||||
{
|
{
|
||||||
if( pad->GetName().CmpNoCase( aPadName ) == 0 ) // why case insensitive?
|
if( pad->GetName().CmpNoCase( aPadName ) == 0 ) // why case insensitive?
|
||||||
return pad;
|
return pad;
|
||||||
|
@ -624,7 +616,7 @@ D_PAD* MODULE::FindPadByName( const wxString& aPadName ) const
|
||||||
|
|
||||||
D_PAD* MODULE::GetPad( const wxPoint& aPosition, LSET aLayerMask )
|
D_PAD* MODULE::GetPad( const wxPoint& aPosition, LSET aLayerMask )
|
||||||
{
|
{
|
||||||
for( D_PAD* pad = m_Pads; pad; pad = pad->Next() )
|
for( auto pad : m_pads )
|
||||||
{
|
{
|
||||||
// ... and on the correct layer.
|
// ... and on the correct layer.
|
||||||
if( !( pad->GetLayerSet() & aLayerMask ).any() )
|
if( !( pad->GetLayerSet() & aLayerMask ).any() )
|
||||||
|
@ -640,9 +632,9 @@ D_PAD* MODULE::GetPad( const wxPoint& aPosition, LSET aLayerMask )
|
||||||
|
|
||||||
D_PAD* MODULE::GetTopLeftPad()
|
D_PAD* MODULE::GetTopLeftPad()
|
||||||
{
|
{
|
||||||
D_PAD* topLeftPad = m_Pads;
|
D_PAD* topLeftPad = GetFirstPad();
|
||||||
|
|
||||||
for( D_PAD* p = m_Pads->Next(); p; p = p->Next() )
|
for( auto p : m_pads )
|
||||||
{
|
{
|
||||||
wxPoint pnt = p->GetPosition(); // GetPosition() returns the center of the pad
|
wxPoint pnt = p->GetPosition(); // GetPosition() returns the center of the pad
|
||||||
|
|
||||||
|
@ -661,11 +653,11 @@ D_PAD* MODULE::GetTopLeftPad()
|
||||||
unsigned MODULE::GetPadCount( INCLUDE_NPTH_T aIncludeNPTH ) const
|
unsigned MODULE::GetPadCount( INCLUDE_NPTH_T aIncludeNPTH ) const
|
||||||
{
|
{
|
||||||
if( aIncludeNPTH )
|
if( aIncludeNPTH )
|
||||||
return m_Pads.GetCount();
|
return m_pads.size();
|
||||||
|
|
||||||
unsigned cnt = 0;
|
unsigned cnt = 0;
|
||||||
|
|
||||||
for( D_PAD* pad = m_Pads; pad; pad = pad->Next() )
|
for( auto pad : m_pads )
|
||||||
{
|
{
|
||||||
if( pad->GetAttribute() == PAD_ATTRIB_HOLE_NOT_PLATED )
|
if( pad->GetAttribute() == PAD_ATTRIB_HOLE_NOT_PLATED )
|
||||||
continue;
|
continue;
|
||||||
|
@ -682,7 +674,7 @@ unsigned MODULE::GetUniquePadCount( INCLUDE_NPTH_T aIncludeNPTH ) const
|
||||||
std::set<wxString> usedNames;
|
std::set<wxString> usedNames;
|
||||||
|
|
||||||
// Create a set of used pad numbers
|
// Create a set of used pad numbers
|
||||||
for( D_PAD* pad = PadsList(); pad; pad = pad->Next() )
|
for( auto pad : m_pads )
|
||||||
{
|
{
|
||||||
// Skip pads not on copper layers (used to build complex
|
// Skip pads not on copper layers (used to build complex
|
||||||
// solder paste shapes for instance)
|
// solder paste shapes for instance)
|
||||||
|
@ -746,7 +738,7 @@ SEARCH_RESULT MODULE::Visit( INSPECTOR inspector, void* testData, const KICAD_T
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PCB_PAD_T:
|
case PCB_PAD_T:
|
||||||
result = IterateForward( m_Pads, inspector, testData, p );
|
result = IterateForward<D_PAD*>( m_pads, inspector, testData, p );
|
||||||
++p;
|
++p;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -824,7 +816,7 @@ void MODULE::RunOnChildren( const std::function<void (BOARD_ITEM*)>& aFunction )
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
for( D_PAD* pad = m_Pads; pad; pad = pad->Next() )
|
for( auto pad : m_pads )
|
||||||
aFunction( static_cast<BOARD_ITEM*>( pad ) );
|
aFunction( static_cast<BOARD_ITEM*>( pad ) );
|
||||||
|
|
||||||
for( BOARD_ITEM* drawing = m_Drawings; drawing; drawing = drawing->Next() )
|
for( BOARD_ITEM* drawing = m_Drawings; drawing; drawing = drawing->Next() )
|
||||||
|
@ -851,7 +843,7 @@ void MODULE::GetAllDrawingLayers( int aLayers[], int& aCount, bool aIncludePads
|
||||||
|
|
||||||
if( aIncludePads )
|
if( aIncludePads )
|
||||||
{
|
{
|
||||||
for( D_PAD* pad = m_Pads; pad; pad = pad->Next() )
|
for( auto pad : m_pads )
|
||||||
{
|
{
|
||||||
int pad_layers[KIGFX::VIEW::VIEW_MAX_LAYERS], pad_layers_count;
|
int pad_layers[KIGFX::VIEW::VIEW_MAX_LAYERS], pad_layers_count;
|
||||||
pad->ViewGetLayers( pad_layers, pad_layers_count );
|
pad->ViewGetLayers( pad_layers, pad_layers_count );
|
||||||
|
@ -904,7 +896,7 @@ void MODULE::ViewGetLayers( int aLayers[], int& aCount ) const
|
||||||
non_silk = true;
|
non_silk = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( ( f_silk || b_silk ) && !non_silk && m_Pads.GetCount() == 0 )
|
if( ( f_silk || b_silk ) && !non_silk && m_pads.empty() )
|
||||||
{
|
{
|
||||||
if( f_silk )
|
if( f_silk )
|
||||||
aLayers[ aCount++ ] = F_SilkS;
|
aLayers[ aCount++ ] = F_SilkS;
|
||||||
|
@ -1015,7 +1007,7 @@ void MODULE::Flip( const wxPoint& aCentre )
|
||||||
NORMALIZE_ANGLE_POS( m_Orient );
|
NORMALIZE_ANGLE_POS( m_Orient );
|
||||||
|
|
||||||
// Mirror pads to other side of board about the x axis, i.e. vertically.
|
// Mirror pads to other side of board about the x axis, i.e. vertically.
|
||||||
for( D_PAD* pad = m_Pads; pad; pad = pad->Next() )
|
for( auto pad : m_pads )
|
||||||
pad->Flip( m_Pos );
|
pad->Flip( m_Pos );
|
||||||
|
|
||||||
// Mirror reference and value.
|
// Mirror reference and value.
|
||||||
|
@ -1054,7 +1046,7 @@ void MODULE::SetPosition( const wxPoint& newpos )
|
||||||
m_Reference->EDA_TEXT::Offset( delta );
|
m_Reference->EDA_TEXT::Offset( delta );
|
||||||
m_Value->EDA_TEXT::Offset( delta );
|
m_Value->EDA_TEXT::Offset( delta );
|
||||||
|
|
||||||
for( D_PAD* pad = m_Pads; pad; pad = pad->Next() )
|
for( auto pad : m_pads )
|
||||||
{
|
{
|
||||||
pad->SetPosition( pad->GetPosition() + delta );
|
pad->SetPosition( pad->GetPosition() + delta );
|
||||||
}
|
}
|
||||||
|
@ -1109,7 +1101,7 @@ void MODULE::MoveAnchorPosition( const wxPoint& aMoveVector )
|
||||||
m_Value->SetDrawCoord();
|
m_Value->SetDrawCoord();
|
||||||
|
|
||||||
// Update the pad local coordinates.
|
// Update the pad local coordinates.
|
||||||
for( D_PAD* pad = PadsList(); pad; pad = pad->Next() )
|
for( auto pad : m_pads )
|
||||||
{
|
{
|
||||||
pad->SetPos0( pad->GetPos0() + moveVector );
|
pad->SetPos0( pad->GetPos0() + moveVector );
|
||||||
pad->SetDrawCoord();
|
pad->SetDrawCoord();
|
||||||
|
@ -1152,7 +1144,7 @@ void MODULE::SetOrientation( double newangle )
|
||||||
|
|
||||||
m_Orient = newangle;
|
m_Orient = newangle;
|
||||||
|
|
||||||
for( D_PAD* pad = m_Pads; pad; pad = pad->Next() )
|
for( auto pad : m_pads )
|
||||||
{
|
{
|
||||||
pad->SetOrientation( pad->GetOrientation() + angleChange );
|
pad->SetOrientation( pad->GetOrientation() + angleChange );
|
||||||
pad->SetDrawCoord();
|
pad->SetDrawCoord();
|
||||||
|
@ -1192,7 +1184,7 @@ BOARD_ITEM* MODULE::Duplicate( const BOARD_ITEM* aItem,
|
||||||
new_pad = new D_PAD( *static_cast<const D_PAD*>( aItem ) );
|
new_pad = new D_PAD( *static_cast<const D_PAD*>( aItem ) );
|
||||||
|
|
||||||
if( aAddToModule )
|
if( aAddToModule )
|
||||||
PadsList().PushBack( new_pad );
|
m_pads.push_back( new_pad );
|
||||||
|
|
||||||
new_item = new_pad;
|
new_item = new_pad;
|
||||||
break;
|
break;
|
||||||
|
@ -1253,7 +1245,7 @@ wxString MODULE::GetNextPadName( bool aFillSequenceGaps ) const
|
||||||
std::set<int> usedNumbers;
|
std::set<int> usedNumbers;
|
||||||
|
|
||||||
// Create a set of used pad numbers
|
// Create a set of used pad numbers
|
||||||
for( D_PAD* pad = PadsList(); pad; pad = pad->Next() )
|
for( auto pad : m_pads )
|
||||||
{
|
{
|
||||||
int padNumber = GetTrailingInt( pad->GetName() );
|
int padNumber = GetTrailingInt( pad->GetName() );
|
||||||
usedNumbers.insert( padNumber );
|
usedNumbers.insert( padNumber );
|
||||||
|
@ -1310,7 +1302,7 @@ double MODULE::CoverageRatio( const GENERAL_COLLECTOR& aCollector ) const
|
||||||
// build list of holes (covered areas not available for selection)
|
// build list of holes (covered areas not available for selection)
|
||||||
SHAPE_POLY_SET holes;
|
SHAPE_POLY_SET holes;
|
||||||
|
|
||||||
for( D_PAD* pad = m_Pads; pad; pad = pad->Next() )
|
for( auto pad : m_pads )
|
||||||
addRect( holes, pad->GetBoundingBox() );
|
addRect( holes, pad->GetBoundingBox() );
|
||||||
|
|
||||||
addRect( holes, m_Reference->GetBoundingBox() );
|
addRect( holes, m_Reference->GetBoundingBox() );
|
||||||
|
|
|
@ -31,6 +31,7 @@
|
||||||
#ifndef MODULE_H_
|
#ifndef MODULE_H_
|
||||||
#define MODULE_H_
|
#define MODULE_H_
|
||||||
|
|
||||||
|
#include <deque>
|
||||||
|
|
||||||
#include <board_item_container.h>
|
#include <board_item_container.h>
|
||||||
#include <class_board_item.h>
|
#include <class_board_item.h>
|
||||||
|
@ -103,6 +104,10 @@ class MODULE_3D_SETTINGS
|
||||||
bool m_Preview; ///< Include module in 3D preview
|
bool m_Preview; ///< Include module in 3D preview
|
||||||
};
|
};
|
||||||
|
|
||||||
|
DECL_DEQ_FOR_SWIG( PADS, D_PAD* )
|
||||||
|
DECL_DEQ_FOR_SWIG( DRAWINGS, BOARD_ITEM* )
|
||||||
|
DECL_DEQ_FOR_SWIG( MODULES, MODULE* )
|
||||||
|
|
||||||
class MODULE : public BOARD_ITEM_CONTAINER
|
class MODULE : public BOARD_ITEM_CONTAINER
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
@ -156,15 +161,17 @@ public:
|
||||||
// Virtual function
|
// Virtual function
|
||||||
const EDA_RECT GetBoundingBox() const override;
|
const EDA_RECT GetBoundingBox() const override;
|
||||||
|
|
||||||
DLIST<D_PAD>& PadsList() { return m_Pads; }
|
|
||||||
const DLIST<D_PAD>& PadsList() const { return m_Pads; }
|
|
||||||
|
|
||||||
DLIST<BOARD_ITEM>& GraphicalItemsList() { return m_Drawings; }
|
DLIST<BOARD_ITEM>& GraphicalItemsList() { return m_Drawings; }
|
||||||
const DLIST<BOARD_ITEM>& GraphicalItemsList() const { return m_Drawings; }
|
const DLIST<BOARD_ITEM>& GraphicalItemsList() const { return m_Drawings; }
|
||||||
|
|
||||||
DLIST_ITERATOR_WRAPPER<D_PAD> Pads()
|
PADS& Pads()
|
||||||
{
|
{
|
||||||
return DLIST_ITERATOR_WRAPPER<D_PAD>( m_Pads );
|
return m_pads;
|
||||||
|
}
|
||||||
|
|
||||||
|
const PADS& Pads() const
|
||||||
|
{
|
||||||
|
return m_pads;
|
||||||
}
|
}
|
||||||
|
|
||||||
DLIST_ITERATOR_WRAPPER<BOARD_ITEM> GraphicalItems()
|
DLIST_ITERATOR_WRAPPER<BOARD_ITEM> GraphicalItems()
|
||||||
|
@ -464,6 +471,15 @@ public:
|
||||||
|
|
||||||
D_PAD* GetTopLeftPad();
|
D_PAD* GetTopLeftPad();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the first pad in the list or NULL if none
|
||||||
|
* @return first pad or null pointer
|
||||||
|
*/
|
||||||
|
D_PAD* GetFirstPad() const
|
||||||
|
{
|
||||||
|
return m_pads.empty() ? nullptr : m_pads.front();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* GetPadCount
|
* GetPadCount
|
||||||
* returns the number of pads.
|
* returns the number of pads.
|
||||||
|
@ -543,6 +559,7 @@ public:
|
||||||
* Function RunOnChildren
|
* Function RunOnChildren
|
||||||
*
|
*
|
||||||
* Invokes a function on all BOARD_ITEMs that belong to the module (pads, drawings, texts).
|
* Invokes a function on all BOARD_ITEMs that belong to the module (pads, drawings, texts).
|
||||||
|
* Note that this function should not add or remove items to the module
|
||||||
* @param aFunction is the function to be invoked.
|
* @param aFunction is the function to be invoked.
|
||||||
*/
|
*/
|
||||||
void RunOnChildren( const std::function<void (BOARD_ITEM*)>& aFunction );
|
void RunOnChildren( const std::function<void (BOARD_ITEM*)>& aFunction );
|
||||||
|
@ -652,8 +669,17 @@ public:
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
private:
|
private:
|
||||||
DLIST<D_PAD> m_Pads; ///< Linked list of pads.
|
|
||||||
DLIST<BOARD_ITEM> m_Drawings; ///< Linked list of graphical items.
|
DLIST<BOARD_ITEM> m_Drawings; ///< Linked list of graphical items.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/// BOARD_ITEMs for drawings on the board, owned by pointer.
|
||||||
|
DRAWINGS m_drawings;
|
||||||
|
|
||||||
|
/// D_PAD items, owned by pointer
|
||||||
|
PADS m_pads;
|
||||||
|
|
||||||
std::list<MODULE_3D_SETTINGS> m_3D_Drawings; ///< Linked list of 3D models.
|
std::list<MODULE_3D_SETTINGS> m_3D_Drawings; ///< Linked list of 3D models.
|
||||||
double m_Orient; ///< Orientation in tenths of a degree, 900=90.0 degrees.
|
double m_Orient; ///< Orientation in tenths of a degree, 900=90.0 degrees.
|
||||||
wxPoint m_Pos; ///< Position of module on the board in internal units.
|
wxPoint m_Pos; ///< Position of module on the board in internal units.
|
||||||
|
|
|
@ -157,8 +157,6 @@ public:
|
||||||
return aItem && PCB_PAD_T == aItem->Type();
|
return aItem && PCB_PAD_T == aItem->Type();
|
||||||
}
|
}
|
||||||
|
|
||||||
D_PAD* Next() const { return static_cast<D_PAD*>( Pnext ); }
|
|
||||||
|
|
||||||
MODULE* GetParent() const { return (MODULE*) m_Parent; }
|
MODULE* GetParent() const { return (MODULE*) m_Parent; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -103,7 +103,7 @@ void CN_CONNECTIVITY_ALGO::markItemNetAsDirty( const BOARD_ITEM* aItem )
|
||||||
{
|
{
|
||||||
auto mod = static_cast <const MODULE*>( aItem );
|
auto mod = static_cast <const MODULE*>( aItem );
|
||||||
|
|
||||||
for( D_PAD* pad = mod->PadsList(); pad; pad = pad->Next() )
|
for( auto pad : mod->Pads() )
|
||||||
MarkNetAsDirty( pad->GetNetCode() );
|
MarkNetAsDirty( pad->GetNetCode() );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -155,7 +155,7 @@ void DIALOG_GENDRILL::InitDisplayParams()
|
||||||
|
|
||||||
for( auto module : m_board->Modules() )
|
for( auto module : m_board->Modules() )
|
||||||
{
|
{
|
||||||
for( D_PAD* pad = module->PadsList(); pad != NULL; pad = pad->Next() )
|
for( auto pad : module->Pads() )
|
||||||
{
|
{
|
||||||
if( pad->GetDrillShape() == PAD_DRILL_SHAPE_CIRCLE )
|
if( pad->GetDrillShape() == PAD_DRILL_SHAPE_CIRCLE )
|
||||||
{
|
{
|
||||||
|
|
|
@ -908,7 +908,7 @@ void EAGLE_PLUGIN::loadElements( wxXmlNode* aElements )
|
||||||
m_board->Add( m, ADD_APPEND );
|
m_board->Add( m, ADD_APPEND );
|
||||||
|
|
||||||
// update the nets within the pads of the clone
|
// update the nets within the pads of the clone
|
||||||
for( D_PAD* pad = m->PadsList(); pad; pad = pad->Next() )
|
for( auto pad : m->Pads() )
|
||||||
{
|
{
|
||||||
wxString pn_key = makeKey( e.name, pad->GetName() );
|
wxString pn_key = makeKey( e.name, pad->GetName() );
|
||||||
|
|
||||||
|
@ -1515,7 +1515,7 @@ void EAGLE_PLUGIN::packagePad( MODULE* aModule, wxXmlNode* aTree ) const
|
||||||
int shape = EPAD::UNDEF;
|
int shape = EPAD::UNDEF;
|
||||||
|
|
||||||
D_PAD* pad = new D_PAD( aModule );
|
D_PAD* pad = new D_PAD( aModule );
|
||||||
aModule->PadsList().PushBack( pad );
|
aModule->Add( pad );
|
||||||
transferPad( e, pad );
|
transferPad( e, pad );
|
||||||
|
|
||||||
if( e.first && *e.first && m_rules->psFirst != EPAD::UNDEF )
|
if( e.first && *e.first && m_rules->psFirst != EPAD::UNDEF )
|
||||||
|
@ -1858,7 +1858,7 @@ void EAGLE_PLUGIN::packageHole( MODULE* aModule, wxXmlNode* aTree, bool aCenter
|
||||||
|
|
||||||
// we add a PAD_ATTRIB_HOLE_NOT_PLATED pad to this module.
|
// we add a PAD_ATTRIB_HOLE_NOT_PLATED pad to this module.
|
||||||
D_PAD* pad = new D_PAD( aModule );
|
D_PAD* pad = new D_PAD( aModule );
|
||||||
aModule->PadsList().PushBack( pad );
|
aModule->Add( pad );
|
||||||
|
|
||||||
pad->SetShape( PAD_SHAPE_CIRCLE );
|
pad->SetShape( PAD_SHAPE_CIRCLE );
|
||||||
pad->SetAttribute( PAD_ATTRIB_HOLE_NOT_PLATED );
|
pad->SetAttribute( PAD_ATTRIB_HOLE_NOT_PLATED );
|
||||||
|
@ -1902,7 +1902,7 @@ void EAGLE_PLUGIN::packageSMD( MODULE* aModule, wxXmlNode* aTree ) const
|
||||||
bool shape_set = false;
|
bool shape_set = false;
|
||||||
int shape = EPAD::UNDEF;
|
int shape = EPAD::UNDEF;
|
||||||
D_PAD* pad = new D_PAD( aModule );
|
D_PAD* pad = new D_PAD( aModule );
|
||||||
aModule->PadsList().PushBack( pad );
|
aModule->Add( pad );
|
||||||
transferPad( e, pad );
|
transferPad( e, pad );
|
||||||
|
|
||||||
if( pad->GetName() == wxT( "1" ) && m_rules->psFirst != EPAD::UNDEF )
|
if( pad->GetName() == wxT( "1" ) && m_rules->psFirst != EPAD::UNDEF )
|
||||||
|
|
|
@ -116,7 +116,7 @@ static void build_pad_testpoints( BOARD *aPcb,
|
||||||
|
|
||||||
for( auto module : aPcb->Modules() )
|
for( auto module : aPcb->Modules() )
|
||||||
{
|
{
|
||||||
for( D_PAD* pad = module->PadsList(); pad; pad = pad->Next() )
|
for( auto pad : module->Pads() )
|
||||||
{
|
{
|
||||||
D356_RECORD rk;
|
D356_RECORD rk;
|
||||||
rk.access = compute_pad_access_code( aPcb, pad->GetLayerSet() );
|
rk.access = compute_pad_access_code( aPcb, pad->GetLayerSet() );
|
||||||
|
|
|
@ -707,7 +707,7 @@ static size_t hashModule( const MODULE* aModule )
|
||||||
for( const BOARD_ITEM* i = aModule->GraphicalItemsList(); i; i = i->Next() )
|
for( const BOARD_ITEM* i = aModule->GraphicalItemsList(); i; i = i->Next() )
|
||||||
ret ^= hash_eda( i, flags );
|
ret ^= hash_eda( i, flags );
|
||||||
|
|
||||||
for( const D_PAD* i = aModule->PadsList(); i; i = i->Next() )
|
for( auto i : aModule->Pads() )
|
||||||
ret ^= hash_eda( i, flags );
|
ret ^= hash_eda( i, flags );
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
|
@ -720,7 +720,6 @@ static size_t hashModule( const MODULE* aModule )
|
||||||
*/
|
*/
|
||||||
static void CreateShapesSection( FILE* aFile, BOARD* aPcb )
|
static void CreateShapesSection( FILE* aFile, BOARD* aPcb )
|
||||||
{
|
{
|
||||||
D_PAD* pad;
|
|
||||||
const char* layer;
|
const char* layer;
|
||||||
wxString pinname;
|
wxString pinname;
|
||||||
const char* mirror = "0";
|
const char* mirror = "0";
|
||||||
|
@ -784,7 +783,7 @@ static void CreateShapesSection( FILE* aFile, BOARD* aPcb )
|
||||||
// set of already emitted pins to check for duplicates
|
// set of already emitted pins to check for duplicates
|
||||||
std::set<wxString> pins;
|
std::set<wxString> pins;
|
||||||
|
|
||||||
for( pad = module->PadsList(); pad; pad = pad->Next() )
|
for( auto pad : module->Pads() )
|
||||||
{
|
{
|
||||||
/* Padstacks are defined using the correct layers for the pads, therefore to
|
/* Padstacks are defined using the correct layers for the pads, therefore to
|
||||||
* all pads need to be marked as TOP to use the padstack information correctly.
|
* all pads need to be marked as TOP to use the padstack information correctly.
|
||||||
|
@ -915,7 +914,6 @@ static void CreateSignalsSection( FILE* aFile, BOARD* aPcb )
|
||||||
{
|
{
|
||||||
wxString msg;
|
wxString msg;
|
||||||
NETINFO_ITEM* net;
|
NETINFO_ITEM* net;
|
||||||
D_PAD* pad;
|
|
||||||
int NbNoConn = 1;
|
int NbNoConn = 1;
|
||||||
|
|
||||||
fputs( "$SIGNALS\n", aFile );
|
fputs( "$SIGNALS\n", aFile );
|
||||||
|
@ -939,7 +937,7 @@ static void CreateSignalsSection( FILE* aFile, BOARD* aPcb )
|
||||||
|
|
||||||
for( auto module : aPcb->Modules() )
|
for( auto module : aPcb->Modules() )
|
||||||
{
|
{
|
||||||
for( pad = module->PadsList(); pad; pad = pad->Next() )
|
for( auto pad : module->Pads() )
|
||||||
{
|
{
|
||||||
if( pad->GetNetCode() != net->GetNet() )
|
if( pad->GetNetCode() != net->GetNet() )
|
||||||
continue;
|
continue;
|
||||||
|
|
|
@ -287,7 +287,7 @@ static void idf_export_module( BOARD* aPcb, MODULE* aModule,
|
||||||
|
|
||||||
aIDFBoard.GetUserOffset( dx, dy );
|
aIDFBoard.GetUserOffset( dx, dy );
|
||||||
|
|
||||||
for( D_PAD* pad = aModule->PadsList(); pad; pad = pad->Next() )
|
for( auto pad : aModule->Pads() )
|
||||||
{
|
{
|
||||||
drill = (double) pad->GetDrillSize().x * scale;
|
drill = (double) pad->GetDrillSize().x * scale;
|
||||||
x = pad->GetPosition().x * scale + dx;
|
x = pad->GetPosition().x * scale + dx;
|
||||||
|
|
|
@ -1358,7 +1358,7 @@ static void export_vrml_module( MODEL_VRML& aModel, BOARD* aPcb,
|
||||||
}
|
}
|
||||||
|
|
||||||
// Export pads
|
// Export pads
|
||||||
for( D_PAD* pad = aModule->PadsList(); pad; pad = pad->Next() )
|
for( auto pad : aModule->Pads() )
|
||||||
export_vrml_pad( aModel, aPcb, pad );
|
export_vrml_pad( aModel, aPcb, pad );
|
||||||
|
|
||||||
bool isFlipped = aModule->GetLayer() == B_Cu;
|
bool isFlipped = aModule->GetLayer() == B_Cu;
|
||||||
|
|
|
@ -401,9 +401,7 @@ static bool sortFPlist( const LIST_MOD& ref, const LIST_MOD& tst )
|
||||||
*/
|
*/
|
||||||
static bool HasNonSMDPins( MODULE* aModule )
|
static bool HasNonSMDPins( MODULE* aModule )
|
||||||
{
|
{
|
||||||
D_PAD* pad;
|
for( auto pad : aModule->Pads() )
|
||||||
|
|
||||||
for( pad = aModule->PadsList(); pad; pad = pad->Next() )
|
|
||||||
{
|
{
|
||||||
if( pad->GetAttribute() != PAD_ATTRIB_SMD )
|
if( pad->GetAttribute() != PAD_ATTRIB_SMD )
|
||||||
return true;
|
return true;
|
||||||
|
@ -733,7 +731,7 @@ bool PCB_EDIT_FRAME::DoGenFootprintsReport( const wxString& aFullFilename, bool
|
||||||
else
|
else
|
||||||
fputs( "layer other\n", rptfile );
|
fputs( "layer other\n", rptfile );
|
||||||
|
|
||||||
for( D_PAD* pad = Module->PadsList(); pad != NULL; pad = pad->Next() )
|
for( auto pad : Module->Pads() )
|
||||||
{
|
{
|
||||||
fprintf( rptfile, "$PAD \"%s\"\n", TO_UTF8( pad->GetName() ) );
|
fprintf( rptfile, "$PAD \"%s\"\n", TO_UTF8( pad->GetName() ) );
|
||||||
int layer = 0;
|
int layer = 0;
|
||||||
|
|
|
@ -99,7 +99,7 @@ void CLIPBOARD_IO::SaveSelection( const SELECTION& aSelected )
|
||||||
// Do not modify existing board
|
// Do not modify existing board
|
||||||
MODULE newModule(*mod);
|
MODULE newModule(*mod);
|
||||||
|
|
||||||
for( D_PAD* pad = newModule.PadsList().begin(); pad; pad = pad->Next() )
|
for( auto pad : newModule.Pads() )
|
||||||
{
|
{
|
||||||
pad->SetNetCode( 0, 0 );
|
pad->SetNetCode( 0, 0 );
|
||||||
}
|
}
|
||||||
|
|
|
@ -1094,7 +1094,7 @@ void PCB_IO::format( MODULE* aModule, int aNestLevel ) const
|
||||||
Format( gr, aNestLevel+1 );
|
Format( gr, aNestLevel+1 );
|
||||||
|
|
||||||
// Save pads.
|
// Save pads.
|
||||||
for( D_PAD* pad = aModule->PadsList(); pad; pad = pad->Next() )
|
for( auto pad : aModule->Pads() )
|
||||||
format( pad, aNestLevel+1 );
|
format( pad, aNestLevel+1 );
|
||||||
|
|
||||||
// Save 3D info.
|
// Save 3D info.
|
||||||
|
|
|
@ -1617,7 +1617,7 @@ void LEGACY_PLUGIN::loadPAD( MODULE* aModule )
|
||||||
|
|
||||||
pad->SetPosition( padpos + aModule->GetPosition() );
|
pad->SetPosition( padpos + aModule->GetPosition() );
|
||||||
|
|
||||||
aModule->PadsList().PushBack( pad.release() );
|
aModule->Add( pad.release() );
|
||||||
return; // preferred exit
|
return; // preferred exit
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -76,7 +76,7 @@ MODULE* PCB_EDIT_FRAME::CreateMuWaveBaseFootprint( const wxString& aValue,
|
||||||
{
|
{
|
||||||
D_PAD* pad = new D_PAD( module );
|
D_PAD* pad = new D_PAD( module );
|
||||||
|
|
||||||
module->PadsList().PushFront( pad );
|
module->Add( pad, ADD_INSERT );
|
||||||
|
|
||||||
int tw = GetDesignSettings().GetCurrentTrackWidth();
|
int tw = GetDesignSettings().GetCurrentTrackWidth();
|
||||||
pad->SetSize( wxSize( tw, tw ) );
|
pad->SetSize( wxSize( tw, tw ) );
|
||||||
|
@ -175,7 +175,8 @@ MODULE* PCB_EDIT_FRAME::Create_MuWaveComponent( int shape_type )
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
module = CreateMuWaveBaseFootprint( cmp_name, text_size, pad_count );
|
module = CreateMuWaveBaseFootprint( cmp_name, text_size, pad_count );
|
||||||
pad = module->PadsList();
|
auto it = module->Pads().begin();
|
||||||
|
pad = *it;
|
||||||
|
|
||||||
switch( shape_type )
|
switch( shape_type )
|
||||||
{
|
{
|
||||||
|
@ -185,7 +186,7 @@ MODULE* PCB_EDIT_FRAME::Create_MuWaveComponent( int shape_type )
|
||||||
|
|
||||||
pad->SetX( pad->GetPos0().x + pad->GetPosition().x );
|
pad->SetX( pad->GetPos0().x + pad->GetPosition().x );
|
||||||
|
|
||||||
pad = pad->Next();
|
pad = *( it + 1 );
|
||||||
|
|
||||||
pad->SetX0( oX + gap_size + pad->GetSize().x );
|
pad->SetX0( oX + gap_size + pad->GetSize().x );
|
||||||
pad->SetX( pad->GetPos0().x + pad->GetPosition().x );
|
pad->SetX( pad->GetPos0().x + pad->GetPosition().x );
|
||||||
|
@ -193,7 +194,7 @@ MODULE* PCB_EDIT_FRAME::Create_MuWaveComponent( int shape_type )
|
||||||
|
|
||||||
case 1: //Stub :
|
case 1: //Stub :
|
||||||
pad->SetName( wxT( "1" ) );
|
pad->SetName( wxT( "1" ) );
|
||||||
pad = pad->Next();
|
pad = *( it + 1 );
|
||||||
pad->SetY0( -( gap_size + pad->GetSize().y ) / 2 );
|
pad->SetY0( -( gap_size + pad->GetSize().y ) / 2 );
|
||||||
pad->SetSize( wxSize( pad->GetSize().x, gap_size ) );
|
pad->SetSize( wxSize( pad->GetSize().x, gap_size ) );
|
||||||
pad->SetY( pad->GetPos0().y + pad->GetPosition().y );
|
pad->SetY( pad->GetPos0().y + pad->GetPosition().y );
|
||||||
|
@ -479,11 +480,13 @@ MODULE* PCB_EDIT_FRAME::Create_MuWavePolygonShape()
|
||||||
wxPoint offset;
|
wxPoint offset;
|
||||||
offset.x = -ShapeSize.x / 2;
|
offset.x = -ShapeSize.x / 2;
|
||||||
|
|
||||||
pad1 = module->PadsList();
|
auto it = module->Pads().begin();
|
||||||
|
|
||||||
|
pad1 = *it;
|
||||||
pad1->SetX0( offset.x );
|
pad1->SetX0( offset.x );
|
||||||
pad1->SetX( pad1->GetPos0().x );
|
pad1->SetX( pad1->GetPos0().x );
|
||||||
|
|
||||||
pad2 = pad1->Next();
|
pad2 = *( ++it );
|
||||||
pad2->SetX0( offset.x + ShapeSize.x );
|
pad2->SetX0( offset.x + ShapeSize.x );
|
||||||
pad2->SetX( pad2->GetPos0().x );
|
pad2->SetX( pad2->GetPos0().x );
|
||||||
|
|
||||||
|
|
|
@ -404,7 +404,7 @@ MODULE* MWAVE::CreateMicrowaveInductor( INDUCTOR_PATTERN& inductorPattern,
|
||||||
// Place a pad on each end of coil.
|
// Place a pad on each end of coil.
|
||||||
pad = new D_PAD( module );
|
pad = new D_PAD( module );
|
||||||
|
|
||||||
module->PadsList().PushFront( pad );
|
module->Add( pad );
|
||||||
|
|
||||||
pad->SetName( "1" );
|
pad->SetName( "1" );
|
||||||
pad->SetPosition( inductorPattern.m_End );
|
pad->SetPosition( inductorPattern.m_End );
|
||||||
|
@ -418,7 +418,7 @@ MODULE* MWAVE::CreateMicrowaveInductor( INDUCTOR_PATTERN& inductorPattern,
|
||||||
|
|
||||||
D_PAD* newpad = new D_PAD( *pad );
|
D_PAD* newpad = new D_PAD( *pad );
|
||||||
|
|
||||||
module->PadsList().Insert( newpad, pad->Next() );
|
module->Add( newpad );
|
||||||
|
|
||||||
pad = newpad;
|
pad = newpad;
|
||||||
pad->SetName( "2" );
|
pad->SetName( "2" );
|
||||||
|
|
|
@ -214,7 +214,7 @@ void NETINFO_MAPPING::Update()
|
||||||
// Modules/pads
|
// Modules/pads
|
||||||
for( auto module : m_board->Modules() )
|
for( auto module : m_board->Modules() )
|
||||||
{
|
{
|
||||||
for( D_PAD* pad = module->PadsList().GetFirst(); pad; pad = pad->Next() )
|
for( auto pad : module->Pads() )
|
||||||
{
|
{
|
||||||
nets.insert( pad->GetNetCode() );
|
nets.insert( pad->GetNetCode() );
|
||||||
}
|
}
|
||||||
|
|
|
@ -114,7 +114,7 @@ void PCB_BASE_FRAME::AddPad( MODULE* aModule, bool draw )
|
||||||
D_PAD* pad = new D_PAD( aModule );
|
D_PAD* pad = new D_PAD( aModule );
|
||||||
|
|
||||||
// Add the new pad to end of the module pad list.
|
// Add the new pad to end of the module pad list.
|
||||||
aModule->PadsList().PushBack( pad );
|
aModule->Add( pad );
|
||||||
|
|
||||||
// Update the pad properties,
|
// Update the pad properties,
|
||||||
// and keep NETINFO_LIST::ORPHANED as net info
|
// and keep NETINFO_LIST::ORPHANED as net info
|
||||||
|
|
|
@ -304,7 +304,7 @@ void PCB_PAD::AddToModule( MODULE* aModule, int aRotation, bool aEncapsulatedPad
|
||||||
pad->SetPosition( padpos + aModule->GetPosition() );
|
pad->SetPosition( padpos + aModule->GetPosition() );
|
||||||
}
|
}
|
||||||
|
|
||||||
aModule->PadsList().PushBack( pad );
|
aModule->Add( pad );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -162,7 +162,7 @@ static void Trace_Pads_Only( PCB_BASE_FRAME* aFrame, wxDC* DC, MODULE* aModule,
|
||||||
displ_opts->m_DisplayPadFill = false;
|
displ_opts->m_DisplayPadFill = false;
|
||||||
|
|
||||||
// Draw pads.
|
// Draw pads.
|
||||||
for( D_PAD* pad = aModule->PadsList(); pad; pad = pad->Next() )
|
for( auto pad : aModule->Pads() )
|
||||||
{
|
{
|
||||||
if( (pad->GetLayerSet() & aLayerMask) == 0 )
|
if( (pad->GetLayerSet() & aLayerMask) == 0 )
|
||||||
continue;
|
continue;
|
||||||
|
|
|
@ -92,7 +92,7 @@ void PlotSilkScreen( BOARD *aBoard, PLOTTER* aPlotter, LSET aLayerMask,
|
||||||
{
|
{
|
||||||
aPlotter->StartBlock( NULL );
|
aPlotter->StartBlock( NULL );
|
||||||
|
|
||||||
for( D_PAD* pad = Module->PadsList(); pad; pad = pad->Next() )
|
for( auto pad : Module->Pads() )
|
||||||
{
|
{
|
||||||
// See if the pad is on this layer
|
// See if the pad is on this layer
|
||||||
LSET masklayer = pad->GetLayerSet();
|
LSET masklayer = pad->GetLayerSet();
|
||||||
|
@ -332,7 +332,7 @@ void PlotStandardLayer( BOARD *aBoard, PLOTTER* aPlotter,
|
||||||
{
|
{
|
||||||
aPlotter->StartBlock( NULL );
|
aPlotter->StartBlock( NULL );
|
||||||
|
|
||||||
for( D_PAD* pad = module->PadsList(); pad; pad = pad->Next() )
|
for( auto pad : module->Pads() )
|
||||||
{
|
{
|
||||||
if( (pad->GetLayerSet() & aLayerMask) == 0 )
|
if( (pad->GetLayerSet() & aLayerMask) == 0 )
|
||||||
continue;
|
continue;
|
||||||
|
@ -697,7 +697,7 @@ void PlotLayerOutlines( BOARD* aBoard, PLOTTER* aPlotter,
|
||||||
|
|
||||||
for( auto module : aBoard->Modules() )
|
for( auto module : aBoard->Modules() )
|
||||||
{
|
{
|
||||||
for( D_PAD* pad = module->PadsList(); pad; pad = pad->Next() )
|
for( auto pad : module->Pads() )
|
||||||
{
|
{
|
||||||
wxSize hole = pad->GetDrillSize();
|
wxSize hole = pad->GetDrillSize();
|
||||||
|
|
||||||
|
|
|
@ -845,7 +845,7 @@ void BRDITEMS_PLOTTER::PlotDrillMarks()
|
||||||
|
|
||||||
for( auto Module : m_board->Modules() )
|
for( auto Module : m_board->Modules() )
|
||||||
{
|
{
|
||||||
for( D_PAD* pad = Module->PadsList(); pad != NULL; pad = pad->Next() )
|
for( auto pad : Module->Pads() )
|
||||||
{
|
{
|
||||||
if( pad->GetDrillSize().x == 0 )
|
if( pad->GetDrillSize().x == 0 )
|
||||||
continue;
|
continue;
|
||||||
|
|
|
@ -136,7 +136,7 @@ PNS_PCBNEW_RULE_RESOLVER::PNS_PCBNEW_RULE_RESOLVER( BOARD* aBoard, PNS::ROUTER*
|
||||||
{
|
{
|
||||||
auto moduleClearance = mod->GetLocalClearance();
|
auto moduleClearance = mod->GetLocalClearance();
|
||||||
|
|
||||||
for( D_PAD* pad = mod->PadsList(); pad; pad = pad->Next() )
|
for( auto pad : mod->Pads() )
|
||||||
{
|
{
|
||||||
int padClearance = pad->GetLocalClearance();
|
int padClearance = pad->GetLocalClearance();
|
||||||
|
|
||||||
|
|
|
@ -142,7 +142,7 @@ int MODULE_EDITOR_TOOLS::PlacePad( const TOOL_EVENT& aEvent )
|
||||||
|
|
||||||
int MODULE_EDITOR_TOOLS::EnumeratePads( const TOOL_EVENT& aEvent )
|
int MODULE_EDITOR_TOOLS::EnumeratePads( const TOOL_EVENT& aEvent )
|
||||||
{
|
{
|
||||||
if( !board()->GetFirstModule() || !board()->GetFirstModule()->PadsList() )
|
if( !board()->GetFirstModule() || !board()->GetFirstModule()->Pads().empty() )
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
DIALOG_ENUM_PADS settingsDlg( frame() );
|
DIALOG_ENUM_PADS settingsDlg( frame() );
|
||||||
|
|
|
@ -275,7 +275,7 @@ static void doPushPadProperties( BOARD& board, const D_PAD& aSrcPad, BOARD_COMMI
|
||||||
if( module->GetFPID() != moduleRef->GetFPID() )
|
if( module->GetFPID() != moduleRef->GetFPID() )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
for( D_PAD* pad = module->PadsList(); pad; pad = pad->Next() )
|
for( auto pad : module->Pads() )
|
||||||
{
|
{
|
||||||
if( aPadShapeFilter && ( pad->GetShape() != aSrcPad.GetShape() ) )
|
if( aPadShapeFilter && ( pad->GetShape() != aSrcPad.GetShape() ) )
|
||||||
continue;
|
continue;
|
||||||
|
|
|
@ -707,9 +707,9 @@ int PCBNEW_CONTROL::Paste( const TOOL_EVENT& aEvent )
|
||||||
auto oldModule = static_cast<MODULE*>( clipItem );
|
auto oldModule = static_cast<MODULE*>( clipItem );
|
||||||
auto newModule = board()->GetFirstModule();
|
auto newModule = board()->GetFirstModule();
|
||||||
|
|
||||||
for( D_PAD* pad = oldModule->PadsList(), *next = nullptr; pad; pad = next )
|
for( auto it = oldModule->Pads().begin(); it != oldModule->Pads().end(); it++ )
|
||||||
{
|
{
|
||||||
next = pad->Next();
|
auto pad = *it;
|
||||||
oldModule->Remove( pad );
|
oldModule->Remove( pad );
|
||||||
pad->SetParent( newModule );
|
pad->SetParent( newModule );
|
||||||
items.push_back( pad );
|
items.push_back( pad );
|
||||||
|
|
|
@ -246,7 +246,7 @@ void PCB_BASE_EDIT_FRAME::SaveCopyInUndoList( const PICKED_ITEMS_LIST& aItemsLis
|
||||||
for( EDA_ITEM* child = clone->GraphicalItemsList(); child; child = child->Next() )
|
for( EDA_ITEM* child = clone->GraphicalItemsList(); child; child = child->Next() )
|
||||||
child->ClearEditFlags();
|
child->ClearEditFlags();
|
||||||
|
|
||||||
for( D_PAD* pad = clone->PadsList(); pad; pad = pad->Next() )
|
for( auto pad : clone->Pads() )
|
||||||
pad->ClearEditFlags();
|
pad->ClearEditFlags();
|
||||||
|
|
||||||
clone->Reference().ClearEditFlags();
|
clone->Reference().ClearEditFlags();
|
||||||
|
|
|
@ -379,13 +379,8 @@ void ZONE_FILLER::buildZoneFeatureHoleList( const ZONE_CONTAINER* aZone,
|
||||||
|
|
||||||
for( auto module : m_board->Modules() )
|
for( auto module : m_board->Modules() )
|
||||||
{
|
{
|
||||||
D_PAD* nextpad;
|
for( auto pad : module->Pads() )
|
||||||
|
|
||||||
for( D_PAD* pad = module->PadsList(); pad != NULL; pad = nextpad )
|
|
||||||
{
|
{
|
||||||
nextpad = pad->Next(); // pad pointer can be modified by next code, so
|
|
||||||
// calculate the next pad here
|
|
||||||
|
|
||||||
if( !pad->IsOnLayer( aZone->GetLayer() ) )
|
if( !pad->IsOnLayer( aZone->GetLayer() ) )
|
||||||
{
|
{
|
||||||
/* Test for pads that are on top or bottom only and have a hole.
|
/* Test for pads that are on top or bottom only and have a hole.
|
||||||
|
|
|
@ -48,7 +48,7 @@ static std::unique_ptr<MODULE> ModuleWithPads( const std::vector<wxString> aName
|
||||||
|
|
||||||
pad->SetName( name );
|
pad->SetName( name );
|
||||||
|
|
||||||
module->PadsList().PushBack( pad.release() );
|
module->Add( pad.release() );
|
||||||
}
|
}
|
||||||
|
|
||||||
return module;
|
return module;
|
||||||
|
|
Loading…
Reference in New Issue