More module -> footprint.

This commit is contained in:
Jeff Young 2020-11-12 23:50:33 +00:00
parent a3a9ef4f32
commit 52a46341db
71 changed files with 419 additions and 404 deletions

View File

@ -93,12 +93,12 @@ BOARD_ADAPTER::BOARD_ADAPTER() :
m_calc_seg_max_factor3DU = 0.0f; m_calc_seg_max_factor3DU = 0.0f;
SetFlag( FL_USE_REALISTIC_MODE, true ); SetFlag( FL_USE_REALISTIC_MODE, true );
SetFlag( FL_MODULE_ATTRIBUTES_NORMAL, true ); SetFlag( FL_FP_ATTRIBUTES_NORMAL, true );
SetFlag( FL_SHOW_BOARD_BODY, true ); SetFlag( FL_SHOW_BOARD_BODY, true );
SetFlag( FL_CLIP_SILK_ON_VIA_ANNULUS, false ); SetFlag( FL_CLIP_SILK_ON_VIA_ANNULUS, false );
SetFlag( FL_MODULE_ATTRIBUTES_NORMAL, true ); SetFlag( FL_FP_ATTRIBUTES_NORMAL, true );
SetFlag( FL_MODULE_ATTRIBUTES_NORMAL_INSERT, true ); SetFlag( FL_FP_ATTRIBUTES_NORMAL_INSERT, true );
SetFlag( FL_MODULE_ATTRIBUTES_VIRTUAL, true ); SetFlag( FL_FP_ATTRIBUTES_VIRTUAL, true );
SetFlag( FL_ZONE, true ); SetFlag( FL_ZONE, true );
SetFlag( FL_SILKSCREEN, true ); SetFlag( FL_SILKSCREEN, true );
SetFlag( FL_SOLDERMASK, true ); SetFlag( FL_SOLDERMASK, true );
@ -241,11 +241,11 @@ void BOARD_ADAPTER::SetFlag( DISPLAY3D_FLG aFlag, bool aState )
bool BOARD_ADAPTER::ShouldModuleBeDisplayed( MODULE_ATTR_T aModuleAttributs ) const bool BOARD_ADAPTER::ShouldModuleBeDisplayed( MODULE_ATTR_T aModuleAttributs ) const
{ {
if( aModuleAttributs & MOD_SMD ) if( aModuleAttributs & MOD_SMD )
return GetFlag( FL_MODULE_ATTRIBUTES_NORMAL_INSERT ); return GetFlag( FL_FP_ATTRIBUTES_NORMAL_INSERT );
else if( aModuleAttributs & MOD_THROUGH_HOLE ) else if( aModuleAttributs & MOD_THROUGH_HOLE )
return GetFlag( FL_MODULE_ATTRIBUTES_NORMAL ); return GetFlag( FL_FP_ATTRIBUTES_NORMAL );
else else
return GetFlag( FL_MODULE_ATTRIBUTES_VIRTUAL ); return GetFlag( FL_FP_ATTRIBUTES_VIRTUAL );
} }

View File

@ -463,9 +463,9 @@ void BOARD_ADAPTER::createLayers( REPORTER* aStatusReporter )
// Add holes of footprints // Add holes of footprints
// ///////////////////////////////////////////////////////////////////////// // /////////////////////////////////////////////////////////////////////////
for( MODULE* module : m_board->Modules() ) for( MODULE* footprint : m_board->Footprints() )
{ {
for( PAD* pad : module->Pads() ) for( PAD* pad : footprint->Pads() )
{ {
const wxSize padHole = pad->GetDrillSize(); const wxSize padHole = pad->GetDrillSize();
@ -497,9 +497,9 @@ void BOARD_ADAPTER::createLayers( REPORTER* aStatusReporter )
// Add contours of the pad holes (pads can be Circle or Segment holes) // Add contours of the pad holes (pads can be Circle or Segment holes)
// ///////////////////////////////////////////////////////////////////////// // /////////////////////////////////////////////////////////////////////////
for( MODULE* module : m_board->Modules() ) for( MODULE* footprint : m_board->Footprints() )
{ {
for( PAD* pad : module->Pads() ) for( PAD* pad : footprint->Pads() )
{ {
const wxSize padHole = pad->GetDrillSize(); const wxSize padHole = pad->GetDrillSize();
@ -549,28 +549,28 @@ void BOARD_ADAPTER::createLayers( REPORTER* aStatusReporter )
CBVHCONTAINER2D *layerContainer = m_layers_container2D[curr_layer_id]; CBVHCONTAINER2D *layerContainer = m_layers_container2D[curr_layer_id];
// ADD PADS // ADD PADS
for( MODULE* module : m_board->Modules() ) for( MODULE* footprint : m_board->Footprints() )
{ {
// 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
AddPadsShapesWithClearanceToContainer( module, layerContainer, curr_layer_id, 0, AddPadsShapesWithClearanceToContainer( footprint, layerContainer, curr_layer_id, 0,
true, renderPlatedPadsAsPlated, false ); true, renderPlatedPadsAsPlated, false );
// Micro-wave footprints may have items on copper layers // Micro-wave footprints may have items on copper layers
AddGraphicsShapesWithClearanceToContainer( module, layerContainer, curr_layer_id, 0 ); AddGraphicsShapesWithClearanceToContainer( footprint, layerContainer, curr_layer_id, 0 );
} }
} }
if( renderPlatedPadsAsPlated ) if( renderPlatedPadsAsPlated )
{ {
// ADD PLATED PADS // ADD PLATED PADS
for( MODULE* module : m_board->Modules() ) for( MODULE* footprint : m_board->Footprints() )
{ {
AddPadsShapesWithClearanceToContainer( module, m_platedpads_container2D_F_Cu, F_Cu, 0, AddPadsShapesWithClearanceToContainer( footprint, m_platedpads_container2D_F_Cu, F_Cu,
true, false, true ); 0, true, false, true );
AddPadsShapesWithClearanceToContainer( module, m_platedpads_container2D_B_Cu, B_Cu, 0, AddPadsShapesWithClearanceToContainer( footprint, m_platedpads_container2D_B_Cu, B_Cu,
true, false, true ); 0, true, false, true );
} }
m_platedpads_container2D_F_Cu->BuildBVH(); m_platedpads_container2D_F_Cu->BuildBVH();
@ -588,33 +588,33 @@ void BOARD_ADAPTER::createLayers( REPORTER* aStatusReporter )
SHAPE_POLY_SET *layerPoly = m_layers_poly[curr_layer_id]; SHAPE_POLY_SET *layerPoly = m_layers_poly[curr_layer_id];
// Add pads to polygon list // Add pads to polygon list
for( auto module : m_board->Modules() ) for( MODULE* footprint : m_board->Footprints() )
{ {
// 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
module->TransformPadsShapesWithClearanceToPolygon( *layerPoly, curr_layer_id, footprint->TransformPadsShapesWithClearanceToPolygon( *layerPoly, curr_layer_id,
0, ARC_HIGH_DEF, ERROR_INSIDE, 0, ARC_HIGH_DEF, ERROR_INSIDE,
true, renderPlatedPadsAsPlated, true, renderPlatedPadsAsPlated,
false ); false );
transformGraphicModuleEdgeToPolygonSet( module, curr_layer_id, *layerPoly ); transformGraphicModuleEdgeToPolygonSet( footprint, curr_layer_id, *layerPoly );
} }
} }
if( renderPlatedPadsAsPlated ) if( renderPlatedPadsAsPlated )
{ {
// ADD PLATED PADS contourns // ADD PLATED PADS contourns
for( auto module : m_board->Modules() ) for( MODULE* footprint : m_board->Footprints() )
{ {
module->TransformPadsShapesWithClearanceToPolygon( *m_F_Cu_PlatedPads_poly, F_Cu, footprint->TransformPadsShapesWithClearanceToPolygon( *m_F_Cu_PlatedPads_poly, F_Cu,
0, ARC_HIGH_DEF, ERROR_INSIDE, 0, ARC_HIGH_DEF, ERROR_INSIDE,
true, false, true ); true, false, true );
//transformGraphicModuleEdgeToPolygonSet( module, F_Cu, *m_F_Cu_PlatedPads_poly ); //transformGraphicModuleEdgeToPolygonSet( module, F_Cu, *m_F_Cu_PlatedPads_poly );
module->TransformPadsShapesWithClearanceToPolygon( *m_B_Cu_PlatedPads_poly, B_Cu, footprint->TransformPadsShapesWithClearanceToPolygon( *m_B_Cu_PlatedPads_poly, B_Cu,
0, ARC_HIGH_DEF, ERROR_INSIDE, 0, ARC_HIGH_DEF, ERROR_INSIDE,
true, false, true ); true, false, true );
//transformGraphicModuleEdgeToPolygonSet( module, B_Cu, *m_B_Cu_PlatedPads_poly ); //transformGraphicModuleEdgeToPolygonSet( module, B_Cu, *m_B_Cu_PlatedPads_poly );
} }
@ -994,7 +994,7 @@ void BOARD_ADAPTER::createLayers( REPORTER* aStatusReporter )
// Add footprints tech layers - objects // Add footprints tech layers - objects
// ///////////////////////////////////////////////////////////////////// // /////////////////////////////////////////////////////////////////////
for( MODULE* module : m_board->Modules() ) for( MODULE* module : m_board->Footprints() )
{ {
if( (curr_layer_id == F_SilkS) || (curr_layer_id == B_SilkS) ) if( (curr_layer_id == F_SilkS) || (curr_layer_id == B_SilkS) )
{ {
@ -1021,7 +1021,7 @@ void BOARD_ADAPTER::createLayers( REPORTER* aStatusReporter )
// Add footprints tech layers - contours // Add footprints tech layers - contours
for( MODULE* module : m_board->Modules() ) for( MODULE* module : m_board->Footprints() )
{ {
if( (curr_layer_id == F_SilkS) || (curr_layer_id == B_SilkS) ) if( (curr_layer_id == F_SilkS) || (curr_layer_id == B_SilkS) )
{ {

View File

@ -42,9 +42,9 @@ enum DISPLAY3D_FLG
FL_COMMENTS, FL_COMMENTS,
FL_ECO, FL_ECO,
FL_MODULE_ATTRIBUTES_NORMAL, FL_FP_ATTRIBUTES_NORMAL,
FL_MODULE_ATTRIBUTES_NORMAL_INSERT, FL_FP_ATTRIBUTES_NORMAL_INSERT,
FL_MODULE_ATTRIBUTES_VIRTUAL, FL_FP_ATTRIBUTES_VIRTUAL,
FL_USE_SELECTION, FL_USE_SELECTION,

View File

@ -862,9 +862,9 @@ void C3D_RENDER_OGL_LEGACY::generate_3D_Vias_and_Pads()
tht_inner_holes_poly.RemoveAllContours(); tht_inner_holes_poly.RemoveAllContours();
// Insert pads holes (vertical cylinders) // Insert pads holes (vertical cylinders)
for( const auto module : m_boardAdapter.GetBoard()->Modules() ) for( const MODULE* footprint : m_boardAdapter.GetBoard()->Footprints() )
{ {
for( auto pad : module->Pads() ) for( PAD* pad : footprint->Pads() )
{ {
if( pad->GetAttribute() != PAD_ATTRIB_NPTH ) if( pad->GetAttribute() != PAD_ATTRIB_NPTH )
{ {
@ -957,15 +957,17 @@ void C3D_RENDER_OGL_LEGACY::generate_3D_Vias_and_Pads()
*/ */
void C3D_RENDER_OGL_LEGACY::load_3D_models( REPORTER* aStatusReporter ) void C3D_RENDER_OGL_LEGACY::load_3D_models( REPORTER* aStatusReporter )
{ {
if((!m_boardAdapter.GetFlag( FL_MODULE_ATTRIBUTES_NORMAL )) && if( !m_boardAdapter.GetFlag( FL_FP_ATTRIBUTES_NORMAL )
(!m_boardAdapter.GetFlag( FL_MODULE_ATTRIBUTES_NORMAL_INSERT )) && && !m_boardAdapter.GetFlag( FL_FP_ATTRIBUTES_NORMAL_INSERT )
(!m_boardAdapter.GetFlag( FL_MODULE_ATTRIBUTES_VIRTUAL )) ) && !m_boardAdapter.GetFlag( FL_FP_ATTRIBUTES_VIRTUAL ) )
{
return; return;
}
// Go for all footprints // Go for all footprints
for( MODULE* module : m_boardAdapter.GetBoard()->Modules() ) for( MODULE* footprint : m_boardAdapter.GetBoard()->Footprints() )
{ {
for( const MODULE_3D_SETTINGS& model : module->Models() ) for( const MODULE_3D_SETTINGS& model : footprint->Models() )
{ {
if( model.m_Show && !model.m_Filename.empty() ) if( model.m_Show && !model.m_Filename.empty() )
{ {

View File

@ -970,8 +970,7 @@ bool C3D_RENDER_OGL_LEGACY::Redraw( bool aIsMoving, REPORTER* aStatusReporter,
glEnable( GL_BLEND ); glEnable( GL_BLEND );
glBlendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA ); glBlendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA );
// Enables Texture Env so it can combine model transparency with // Enables Texture Env so it can combine model transparency with each footprint opacity
// each module opacity setting
glEnable( GL_TEXTURE_2D ); glEnable( GL_TEXTURE_2D );
glActiveTexture( GL_TEXTURE0 ); glActiveTexture( GL_TEXTURE0 );
@ -1266,15 +1265,16 @@ void C3D_RENDER_OGL_LEGACY::render_3D_models_selected( bool aRenderTopOrBot,
C_OGL_3DMODEL::BeginDrawMulti( !aRenderSelectedOnly ); C_OGL_3DMODEL::BeginDrawMulti( !aRenderSelectedOnly );
// Go for all footprints // Go for all footprints
for( auto module : m_boardAdapter.GetBoard()->Modules() ) for( MODULE* fp : m_boardAdapter.GetBoard()->Footprints() )
{ {
const bool isIntersected = ( module == m_currentIntersectedBoardItem ); const bool isIntersected = ( fp == m_currentIntersectedBoardItem );
if( m_boardAdapter.GetFlag( FL_USE_SELECTION ) && if( m_boardAdapter.GetFlag( FL_USE_SELECTION ) && !isIntersected
!isIntersected && && ( ( aRenderSelectedOnly && !fp->IsSelected() )
( ( aRenderSelectedOnly && !module->IsSelected() ) || || ( !aRenderSelectedOnly && fp->IsSelected() ) ) )
( !aRenderSelectedOnly && module->IsSelected() ) ) ) {
continue; continue;
}
if( isIntersected && aRenderSelectedOnly ) if( isIntersected && aRenderSelectedOnly )
{ {
@ -1285,11 +1285,17 @@ void C3D_RENDER_OGL_LEGACY::render_3D_models_selected( bool aRenderTopOrBot,
glLineWidth( 6 ); glLineWidth( 6 );
} }
if( !module->Models().empty() ) if( !fp->Models().empty() )
if( m_boardAdapter.ShouldModuleBeDisplayed((MODULE_ATTR_T) module->GetAttributes() ) ) {
if( ( aRenderTopOrBot && !module->IsFlipped() ) if( m_boardAdapter.ShouldModuleBeDisplayed( (MODULE_ATTR_T) fp->GetAttributes() ) )
|| ( !aRenderTopOrBot && module->IsFlipped() ) ) {
render_3D_module( module, aRenderTransparentOnly, isIntersected ); if( ( aRenderTopOrBot && !fp->IsFlipped() )
|| ( !aRenderTopOrBot && fp->IsFlipped() ) )
{
render_3D_module( fp, aRenderTransparentOnly, isIntersected );
}
}
}
if( isIntersected && aRenderSelectedOnly ) if( isIntersected && aRenderSelectedOnly )
{ {

View File

@ -1376,7 +1376,7 @@ void C3D_RENDER_RAYTRACING::add_3D_vias_and_pads_to_container()
// ///////////////////////////////////////////////////////////////////////// // /////////////////////////////////////////////////////////////////////////
// Insert vias holes (vertical cylinders) // Insert vias holes (vertical cylinders)
for( auto track : m_boardAdapter.GetBoard()->Tracks() ) for( TRACK* track : m_boardAdapter.GetBoard()->Tracks() )
{ {
if( track->Type() == PCB_VIA_T ) if( track->Type() == PCB_VIA_T )
{ {
@ -1386,9 +1386,9 @@ 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_boardAdapter.GetBoard()->Modules() ) for( MODULE* footprint : m_boardAdapter.GetBoard()->Footprints() )
{ {
for( auto pad : module->Pads() ) for( PAD* pad : footprint->Pads() )
if( pad->GetAttribute () != PAD_ATTRIB_NPTH ) if( pad->GetAttribute () != PAD_ATTRIB_NPTH )
{ {
insert3DPadHole( pad ); insert3DPadHole( pad );
@ -1400,14 +1400,14 @@ void C3D_RENDER_RAYTRACING::add_3D_vias_and_pads_to_container()
void C3D_RENDER_RAYTRACING::load_3D_models( CCONTAINER &aDstContainer, bool aSkipMaterialInformation ) void C3D_RENDER_RAYTRACING::load_3D_models( CCONTAINER &aDstContainer, bool aSkipMaterialInformation )
{ {
// Go for all footprints // Go for all footprints
for( auto module : m_boardAdapter.GetBoard()->Modules() ) for( MODULE* fp : m_boardAdapter.GetBoard()->Footprints() )
{ {
if((!module->Models().empty() ) && if( !fp->Models().empty()
m_boardAdapter.ShouldModuleBeDisplayed((MODULE_ATTR_T)module->GetAttributes() ) ) && m_boardAdapter.ShouldModuleBeDisplayed( (MODULE_ATTR_T)fp->GetAttributes() ) )
{ {
double zpos = m_boardAdapter.GetModulesZcoord3DIU( module->IsFlipped() ); double zpos = m_boardAdapter.GetModulesZcoord3DIU( fp->IsFlipped() );
wxPoint pos = module->GetPosition(); wxPoint pos = fp->GetPosition();
glm::mat4 moduleMatrix = glm::mat4( 1.0f ); glm::mat4 moduleMatrix = glm::mat4( 1.0f );
@ -1416,16 +1416,16 @@ void C3D_RENDER_RAYTRACING::load_3D_models( CCONTAINER &aDstContainer, bool aSki
-pos.y * m_boardAdapter.BiuTo3Dunits(), -pos.y * m_boardAdapter.BiuTo3Dunits(),
zpos ) ); zpos ) );
if( module->GetOrientation() ) if( fp->GetOrientation() )
{ {
moduleMatrix = glm::rotate( moduleMatrix, moduleMatrix = glm::rotate( moduleMatrix,
( (float)(module->GetOrientation() / 10.0f) / 180.0f ) * ( (float)(fp->GetOrientation() / 10.0f) / 180.0f ) *
glm::pi<float>(), glm::pi<float>(),
SFVEC3F( 0.0f, 0.0f, 1.0f ) ); SFVEC3F( 0.0f, 0.0f, 1.0f ) );
} }
if( module->IsFlipped() ) if( fp->IsFlipped() )
{ {
moduleMatrix = glm::rotate( moduleMatrix, moduleMatrix = glm::rotate( moduleMatrix,
glm::pi<float>(), glm::pi<float>(),
@ -1444,12 +1444,12 @@ void C3D_RENDER_RAYTRACING::load_3D_models( CCONTAINER &aDstContainer, bool aSki
modelunit_to_3d_units_factor, modelunit_to_3d_units_factor,
modelunit_to_3d_units_factor ) ); modelunit_to_3d_units_factor ) );
BOARD_ITEM* boardItem = dynamic_cast<BOARD_ITEM*>( module ); BOARD_ITEM* boardItem = dynamic_cast<BOARD_ITEM*>( fp );
// Get the list of model files for this model // Get the list of model files for this model
S3D_CACHE* cacheMgr = m_boardAdapter.Get3DCacheManager(); S3D_CACHE* cacheMgr = m_boardAdapter.Get3DCacheManager();
auto sM = module->Models().begin(); auto sM = fp->Models().begin();
auto eM = module->Models().end(); auto eM = fp->Models().end();
while( sM != eM ) while( sM != eM )
{ {

View File

@ -188,9 +188,9 @@ bool DIALOG_3D_VIEW_OPTIONS::TransferDataToWindow()
m_checkBoxBoardBody->SetValue( m_settings.GetFlag( FL_SHOW_BOARD_BODY ) ); m_checkBoxBoardBody->SetValue( m_settings.GetFlag( FL_SHOW_BOARD_BODY ) );
m_checkBoxAreas->SetValue( m_settings.GetFlag( FL_ZONE ) ); m_checkBoxAreas->SetValue( m_settings.GetFlag( FL_ZONE ) );
m_checkBox3DshapesTH->SetValue( m_settings.GetFlag( FL_MODULE_ATTRIBUTES_NORMAL ) ); m_checkBox3DshapesTH->SetValue( m_settings.GetFlag( FL_FP_ATTRIBUTES_NORMAL ) );
m_checkBox3DshapesSMD->SetValue( m_settings.GetFlag( FL_MODULE_ATTRIBUTES_NORMAL_INSERT ) ); m_checkBox3DshapesSMD->SetValue( m_settings.GetFlag( FL_FP_ATTRIBUTES_NORMAL_INSERT ) );
m_checkBox3DshapesVirtual->SetValue( m_settings.GetFlag( FL_MODULE_ATTRIBUTES_VIRTUAL ) ); m_checkBox3DshapesVirtual->SetValue( m_settings.GetFlag( FL_FP_ATTRIBUTES_VIRTUAL ) );
m_checkBoxSilkscreen->SetValue( m_settings.GetFlag( FL_SILKSCREEN ) ); m_checkBoxSilkscreen->SetValue( m_settings.GetFlag( FL_SILKSCREEN ) );
m_checkBoxSolderMask->SetValue( m_settings.GetFlag( FL_SOLDERMASK ) ); m_checkBoxSolderMask->SetValue( m_settings.GetFlag( FL_SOLDERMASK ) );
@ -259,9 +259,9 @@ bool DIALOG_3D_VIEW_OPTIONS::TransferDataFromWindow()
m_settings.SetFlag( FL_RENDER_PLATED_PADS_AS_PLATED, m_checkBoxRenderPlatedPadsAsPlated->GetValue() ); m_settings.SetFlag( FL_RENDER_PLATED_PADS_AS_PLATED, m_checkBoxRenderPlatedPadsAsPlated->GetValue() );
// Set 3D shapes visibility // Set 3D shapes visibility
m_settings.SetFlag( FL_MODULE_ATTRIBUTES_NORMAL, m_checkBox3DshapesTH->GetValue() ); m_settings.SetFlag( FL_FP_ATTRIBUTES_NORMAL, m_checkBox3DshapesTH->GetValue() );
m_settings.SetFlag( FL_MODULE_ATTRIBUTES_NORMAL_INSERT, m_checkBox3DshapesSMD->GetValue() ); m_settings.SetFlag( FL_FP_ATTRIBUTES_NORMAL_INSERT, m_checkBox3DshapesSMD->GetValue() );
m_settings.SetFlag( FL_MODULE_ATTRIBUTES_VIRTUAL, m_checkBox3DshapesVirtual->GetValue() ); m_settings.SetFlag( FL_FP_ATTRIBUTES_VIRTUAL, m_checkBox3DshapesVirtual->GetValue() );
// Set Layer visibility // Set Layer visibility
m_settings.SetFlag( FL_SILKSCREEN, m_checkBoxSilkscreen->GetValue() ); m_settings.SetFlag( FL_SILKSCREEN, m_checkBoxSilkscreen->GetValue() );

View File

@ -520,9 +520,9 @@ void EDA_3D_VIEWER::LoadSettings( APP_SETTINGS_BASE *aCfg )
TRANSFER_SETTING( FL_RENDER_RAYTRACING_PROCEDURAL_TEXTURES, raytrace_procedural_textures ); TRANSFER_SETTING( FL_RENDER_RAYTRACING_PROCEDURAL_TEXTURES, raytrace_procedural_textures );
TRANSFER_SETTING( FL_AXIS, show_axis ); TRANSFER_SETTING( FL_AXIS, show_axis );
TRANSFER_SETTING( FL_MODULE_ATTRIBUTES_NORMAL, show_footprints_normal ); TRANSFER_SETTING( FL_FP_ATTRIBUTES_NORMAL, show_footprints_normal );
TRANSFER_SETTING( FL_MODULE_ATTRIBUTES_NORMAL_INSERT, show_footprints_insert ); TRANSFER_SETTING( FL_FP_ATTRIBUTES_NORMAL_INSERT, show_footprints_insert );
TRANSFER_SETTING( FL_MODULE_ATTRIBUTES_VIRTUAL, show_footprints_virtual ); TRANSFER_SETTING( FL_FP_ATTRIBUTES_VIRTUAL, show_footprints_virtual );
TRANSFER_SETTING( FL_ZONE, show_zones ); TRANSFER_SETTING( FL_ZONE, show_zones );
TRANSFER_SETTING( FL_ADHESIVE, show_adhesive ); TRANSFER_SETTING( FL_ADHESIVE, show_adhesive );
TRANSFER_SETTING( FL_SILKSCREEN, show_silkscreen ); TRANSFER_SETTING( FL_SILKSCREEN, show_silkscreen );
@ -688,9 +688,9 @@ void EDA_3D_VIEWER::SaveSettings( APP_SETTINGS_BASE *aCfg )
TRANSFER_SETTING( renderPlatedPadsAsPlated, FL_RENDER_PLATED_PADS_AS_PLATED ); TRANSFER_SETTING( renderPlatedPadsAsPlated, FL_RENDER_PLATED_PADS_AS_PLATED );
TRANSFER_SETTING( show_comments, FL_COMMENTS ); TRANSFER_SETTING( show_comments, FL_COMMENTS );
TRANSFER_SETTING( show_eco, FL_ECO ); TRANSFER_SETTING( show_eco, FL_ECO );
TRANSFER_SETTING( show_footprints_insert, FL_MODULE_ATTRIBUTES_NORMAL_INSERT ); TRANSFER_SETTING( show_footprints_insert, FL_FP_ATTRIBUTES_NORMAL_INSERT );
TRANSFER_SETTING( show_footprints_normal, FL_MODULE_ATTRIBUTES_NORMAL ); TRANSFER_SETTING( show_footprints_normal, FL_FP_ATTRIBUTES_NORMAL );
TRANSFER_SETTING( show_footprints_virtual, FL_MODULE_ATTRIBUTES_VIRTUAL ); TRANSFER_SETTING( show_footprints_virtual, FL_FP_ATTRIBUTES_VIRTUAL );
TRANSFER_SETTING( show_silkscreen, FL_SILKSCREEN ); TRANSFER_SETTING( show_silkscreen, FL_SILKSCREEN );
TRANSFER_SETTING( show_soldermask, FL_SOLDERMASK ); TRANSFER_SETTING( show_soldermask, FL_SOLDERMASK );
TRANSFER_SETTING( show_solderpaste, FL_SOLDERPASTE ); TRANSFER_SETTING( show_solderpaste, FL_SOLDERPASTE );

View File

@ -208,19 +208,19 @@ TOOL_ACTION EDA_3D_ACTIONS::attributesTHT( "3DViewer.Control.attributesTHT",
AS_ACTIVE, AS_ACTIVE,
'T', "", 'T', "",
_( "Toggle Through Hole 3D models" ), _( "Toggle 3D models with 'Through hole' attribute" ), _( "Toggle Through Hole 3D models" ), _( "Toggle 3D models with 'Through hole' attribute" ),
nullptr, AF_NONE, (void*) FL_MODULE_ATTRIBUTES_NORMAL ); nullptr, AF_NONE, (void*) FL_FP_ATTRIBUTES_NORMAL );
TOOL_ACTION EDA_3D_ACTIONS::attributesSMD( "3DViewer.Control.attributesSMD", TOOL_ACTION EDA_3D_ACTIONS::attributesSMD( "3DViewer.Control.attributesSMD",
AS_ACTIVE, AS_ACTIVE,
'S', "", 'S', "",
_( "Toggle SMD 3D models" ), _( "Toggle 3D models with 'Surface mount' attribute" ), _( "Toggle SMD 3D models" ), _( "Toggle 3D models with 'Surface mount' attribute" ),
nullptr, AF_NONE, (void*) FL_MODULE_ATTRIBUTES_NORMAL_INSERT ); nullptr, AF_NONE, (void*) FL_FP_ATTRIBUTES_NORMAL_INSERT );
TOOL_ACTION EDA_3D_ACTIONS::attributesVirtual( "3DViewer.Control.attributesVirtual", TOOL_ACTION EDA_3D_ACTIONS::attributesVirtual( "3DViewer.Control.attributesVirtual",
AS_ACTIVE, AS_ACTIVE,
'V', "", 'V', "",
_( "Toggle Virtual 3D models" ), _( "Toggle 3D models with 'Virtual' attribute" ), _( "Toggle Virtual 3D models" ), _( "Toggle 3D models with 'Virtual' attribute" ),
nullptr, AF_NONE, (void*) FL_MODULE_ATTRIBUTES_VIRTUAL ); nullptr, AF_NONE, (void*) FL_FP_ATTRIBUTES_VIRTUAL );
TOOL_ACTION EDA_3D_ACTIONS::showBoundingBoxes( "3DViewer.Control.showBoundingBoxes", TOOL_ACTION EDA_3D_ACTIONS::showBoundingBoxes( "3DViewer.Control.showBoundingBoxes",
AS_GLOBAL, 0, "", AS_GLOBAL, 0, "",

View File

@ -82,8 +82,8 @@ AR_AUTOPLACER::AR_AUTOPLACER( BOARD* aBoard )
m_board = aBoard; m_board = aBoard;
m_connectivity = std::make_unique<CONNECTIVITY_DATA>( ); m_connectivity = std::make_unique<CONNECTIVITY_DATA>( );
for( auto mod : m_board->Modules() ) for( MODULE* footprint : m_board->Footprints() )
m_connectivity->Add( mod ); m_connectivity->Add( footprint );
m_gridSize = Millimeter2iu( STEP_AR_MM ); m_gridSize = Millimeter2iu( STEP_AR_MM );
m_progressReporter = nullptr; m_progressReporter = nullptr;
@ -684,17 +684,17 @@ const PAD* AR_AUTOPLACER::nearestPad( MODULE *aRefModule, PAD* aRefPad, const wx
const PAD* nearest = nullptr; const PAD* nearest = nullptr;
int64_t nearestDist = INT64_MAX; int64_t nearestDist = INT64_MAX;
for ( auto mod : m_board->Modules() ) for ( MODULE* footprint : m_board->Footprints() )
{ {
if ( mod == aRefModule ) if ( footprint == aRefModule )
continue; continue;
if( !m_matrix.m_BrdBox.Contains( mod->GetPosition() ) ) if( !m_matrix.m_BrdBox.Contains( footprint->GetPosition() ) )
continue; continue;
for ( auto pad: mod->Pads() ) for( PAD* pad: footprint->Pads() )
{ {
if ( pad->GetNetCode() != aRefPad->GetNetCode() || pad->GetNetCode() <= 0 ) if( pad->GetNetCode() != aRefPad->GetNetCode() || pad->GetNetCode() <= 0 )
continue; continue;
auto dist = (VECTOR2I( aRefPad->GetPosition() - aOffset ) - VECTOR2I( pad->GetPosition() ) ).EuclideanNorm(); auto dist = (VECTOR2I( aRefPad->GetPosition() - aOffset ) - VECTOR2I( pad->GetPosition() ) ).EuclideanNorm();
@ -786,10 +786,10 @@ MODULE* AR_AUTOPLACER::pickModule( )
std::vector <MODULE*> moduleList; std::vector <MODULE*> moduleList;
for( auto m : m_board->Modules() ) for( MODULE* footprint : m_board->Footprints() )
{ {
m->CalculateBoundingBox(); footprint->CalculateBoundingBox();
moduleList.push_back( m ); moduleList.push_back( footprint );
} }
sort( moduleList.begin(), moduleList.end(), sortFootprintsByComplexity ); sort( moduleList.begin(), moduleList.end(), sortFootprintsByComplexity );
@ -898,40 +898,38 @@ AR_RESULT AR_AUTOPLACER::AutoplaceModules( std::vector<MODULE*>& aModules, BOARD
int moduleCount = 0; int moduleCount = 0;
for ( auto m : m_board->Modules() ) for( MODULE* footprint : m_board->Footprints() )
{ footprint->SetNeedsPlaced( false );
m->SetNeedsPlaced( false );
}
std::vector<MODULE*> offboardMods; std::vector<MODULE*> offboardMods;
if( aPlaceOffboardModules ) if( aPlaceOffboardModules )
{ {
for( MODULE* m : m_board->Modules() ) for( MODULE* footprint : m_board->Footprints() )
{ {
if( !m_matrix.m_BrdBox.Contains( m->GetPosition() ) ) if( !m_matrix.m_BrdBox.Contains( footprint->GetPosition() ) )
offboardMods.push_back( m ); offboardMods.push_back( footprint );
} }
} }
for( MODULE* m : aModules ) for( MODULE* footprint : aModules )
{ {
m->SetNeedsPlaced( true ); footprint->SetNeedsPlaced( true );
aCommit->Modify(m); aCommit->Modify( footprint );
} }
for( MODULE* m : offboardMods ) for( MODULE* footprint : offboardMods )
{ {
m->SetNeedsPlaced( true ); footprint->SetNeedsPlaced( true );
aCommit->Modify(m); aCommit->Modify( footprint );
} }
for( MODULE* m : m_board->Modules() ) for( MODULE* footprint : m_board->Footprints() )
{ {
if( m->NeedsPlaced() ) // Erase from screen if( footprint->NeedsPlaced() ) // Erase from screen
moduleCount++; moduleCount++;
else else
genModuleOnRoutingMatrix( m ); genModuleOnRoutingMatrix( footprint );
} }
@ -1079,8 +1077,8 @@ end_of_tst:
m_matrix.UnInitRoutingMatrix(); m_matrix.UnInitRoutingMatrix();
for( MODULE* m : m_board->Modules() ) for( MODULE* footprint : m_board->Footprints() )
m->CalculateBoundingBox(); footprint->CalculateBoundingBox();
return cancelled ? AR_CANCELLED : AR_COMPLETED; return cancelled ? AR_CANCELLED : AR_COMPLETED;
} }

View File

@ -107,10 +107,10 @@ BOARD::~BOARD()
m_zones.clear(); m_zones.clear();
for( MODULE* m : m_modules ) for( MODULE* footprint : m_footprints )
delete m; delete footprint;
m_modules.clear(); m_footprints.clear();
for( TRACK* t : m_tracks ) for( TRACK* t : m_tracks )
delete t; delete t;
@ -514,7 +514,7 @@ void BOARD::SetElementVisibility( GAL_LAYER_ID aLayer, bool isEnabled )
for( TRACK* track : Tracks() ) for( TRACK* track : Tracks() )
track->SetLocalRatsnestVisible( isEnabled ); track->SetLocalRatsnestVisible( isEnabled );
for( MODULE* footprint : Modules() ) for( MODULE* footprint : Footprints() )
{ {
for( PAD* pad : footprint->Pads() ) for( PAD* pad : footprint->Pads() )
pad->SetLocalRatsnestVisible( isEnabled ); pad->SetLocalRatsnestVisible( isEnabled );
@ -598,9 +598,9 @@ void BOARD::Add( BOARD_ITEM* aBoardItem, ADD_MODE aMode )
case PCB_MODULE_T: case PCB_MODULE_T:
if( aMode == ADD_MODE::APPEND ) if( aMode == ADD_MODE::APPEND )
m_modules.push_back( (MODULE*) aBoardItem ); m_footprints.push_back((MODULE*) aBoardItem );
else else
m_modules.push_front( (MODULE*) aBoardItem ); m_footprints.push_front((MODULE*) aBoardItem );
break; break;
@ -677,11 +677,11 @@ void BOARD::Remove( BOARD_ITEM* aBoardItem )
break; break;
case PCB_MODULE_T: case PCB_MODULE_T:
m_modules.erase( std::remove_if( m_modules.begin(), m_modules.end(), m_footprints.erase( std::remove_if( m_footprints.begin(), m_footprints.end(),
[aBoardItem]( BOARD_ITEM* aItem ) [aBoardItem]( BOARD_ITEM* aItem )
{ {
return aItem == aBoardItem; return aItem == aBoardItem;
} ) ); } ) );
break; break;
case PCB_TRACE_T: case PCB_TRACE_T:
@ -768,7 +768,7 @@ BOARD_ITEM* BOARD::GetItem( const KIID& aID ) const
return track; return track;
} }
for( MODULE* footprint : Modules() ) for( MODULE* footprint : Footprints() )
{ {
if( footprint->m_Uuid == aID ) if( footprint->m_Uuid == aID )
return footprint; return footprint;
@ -844,7 +844,7 @@ void BOARD::FillItemMap( std::map<KIID, EDA_ITEM*>& aMap )
for( TRACK* track : Tracks() ) for( TRACK* track : Tracks() )
aMap[ track->m_Uuid ] = track; aMap[ track->m_Uuid ] = track;
for( MODULE* footprint : Modules() ) for( MODULE* footprint : Footprints() )
{ {
aMap[ footprint->m_Uuid ] = footprint; aMap[ footprint->m_Uuid ] = footprint;
@ -900,7 +900,7 @@ wxString BOARD::ConvertCrossReferencesToKIIDs( const wxString& aSource )
wxString remainder; wxString remainder;
wxString ref = token.BeforeFirst( ':', &remainder ); wxString ref = token.BeforeFirst( ':', &remainder );
for( MODULE* footprint : Modules() ) for( MODULE* footprint : Footprints() )
{ {
if( footprint->GetReference().CmpNoCase( ref ) == 0 ) if( footprint->GetReference().CmpNoCase( ref ) == 0 )
{ {
@ -975,7 +975,7 @@ unsigned BOARD::GetNodesCount( int aNet ) const
{ {
unsigned retval = 0; unsigned retval = 0;
for( MODULE* footprint : Modules() ) for( MODULE* footprint : Footprints() )
{ {
for( PAD* pad : footprint->Pads() ) for( PAD* pad : footprint->Pads() )
{ {
@ -1012,7 +1012,7 @@ EDA_RECT BOARD::ComputeBoundingBox( bool aBoardEdgesOnly ) const
} }
// Check footprints // Check footprints
for( MODULE* footprint : m_modules ) for( MODULE* footprint : m_footprints )
{ {
if( !( footprint->GetLayerSet() & visible ).any() ) if( !( footprint->GetLayerSet() & visible ).any() )
continue; continue;
@ -1123,7 +1123,7 @@ SEARCH_RESULT BOARD::Visit( INSPECTOR inspector, void* testData, const KICAD_T s
case PCB_FP_ZONE_T: case PCB_FP_ZONE_T:
// this calls MODULE::Visit() on each module. // this calls MODULE::Visit() on each module.
result = IterateForward<MODULE*>( m_modules, inspector, testData, p ); result = IterateForward<MODULE*>( m_footprints, inspector, testData, p );
// skip over any types handled in the above call. // skip over any types handled in the above call.
for( ; ; ) for( ; ; )
@ -1254,7 +1254,7 @@ NETINFO_ITEM* BOARD::FindNet( const wxString& aNetname ) const
MODULE* BOARD::FindModuleByReference( const wxString& aReference ) const MODULE* BOARD::FindModuleByReference( const wxString& aReference ) const
{ {
for( MODULE* footprint : m_modules ) for( MODULE* footprint : m_footprints )
{ {
if( aReference == footprint->GetReference() ) if( aReference == footprint->GetReference() )
return footprint; return footprint;
@ -1266,7 +1266,7 @@ MODULE* BOARD::FindModuleByReference( const wxString& aReference ) const
MODULE* BOARD::FindModuleByPath( const KIID_PATH& aPath ) const MODULE* BOARD::FindModuleByPath( const KIID_PATH& aPath ) const
{ {
for( MODULE* footprint : m_modules ) for( MODULE* footprint : m_footprints )
{ {
if( footprint->GetPath() == aPath ) if( footprint->GetPath() == aPath )
return footprint; return footprint;
@ -1448,7 +1448,7 @@ PAD* BOARD::GetPad( const wxPoint& aPosition, LSET aLayerSet )
if( !aLayerSet.any() ) if( !aLayerSet.any() )
aLayerSet = LSET::AllCuMask(); aLayerSet = LSET::AllCuMask();
for( MODULE* footprint : m_modules ) for( MODULE* footprint : m_footprints )
{ {
PAD* pad = NULL; PAD* pad = NULL;
@ -1475,7 +1475,7 @@ PAD* BOARD::GetPad( TRACK* aTrace, ENDPOINT_T aEndPoint )
PAD* BOARD::GetPadFast( const wxPoint& aPosition, LSET aLayerSet ) PAD* BOARD::GetPadFast( const wxPoint& aPosition, LSET aLayerSet )
{ {
for( MODULE* footprint : Modules() ) for( MODULE* footprint : Footprints() )
{ {
for( PAD* pad : footprint->Pads() ) for( PAD* pad : footprint->Pads() )
{ {
@ -1601,7 +1601,7 @@ bool sortPadsByXthenYCoord( PAD* const & ref, PAD* const & comp )
void BOARD::GetSortedPadListByXthenYCoord( std::vector<PAD*>& aVector, int aNetCode ) void BOARD::GetSortedPadListByXthenYCoord( std::vector<PAD*>& aVector, int aNetCode )
{ {
for( MODULE* footprint : Modules() ) for( MODULE* footprint : Footprints() )
{ {
for( PAD* pad : footprint->Pads( ) ) for( PAD* pad : footprint->Pads( ) )
{ {
@ -1676,7 +1676,7 @@ MODULE* BOARD::GetFootprint( const wxPoint& aPosition, PCB_LAYER_ID aActiveLayer
int alt_min_dim = 0x7FFFFFFF; int alt_min_dim = 0x7FFFFFFF;
bool current_layer_back = IsBackLayer( aActiveLayer ); bool current_layer_back = IsBackLayer( aActiveLayer );
for( MODULE* candidate : m_modules ) for( MODULE* candidate : m_footprints )
{ {
// is the ref point within the footprint's bounds? // is the ref point within the footprint's bounds?
if( !candidate->HitTest( aPosition ) ) if( !candidate->HitTest( aPosition ) )
@ -1740,7 +1740,7 @@ std::list<ZONE*> BOARD::GetZoneList( bool aIncludeZonesInFootprints )
if( aIncludeZonesInFootprints ) if( aIncludeZonesInFootprints )
{ {
for( MODULE* footprint : m_modules ) for( MODULE* footprint : m_footprints )
{ {
for( FP_ZONE* zone : footprint->Zones() ) for( FP_ZONE* zone : footprint->Zones() )
zones.push_back( zone ); zones.push_back( zone );
@ -1860,7 +1860,7 @@ const std::vector<PAD*> BOARD::GetPads() const
{ {
std::vector<PAD*> allPads; std::vector<PAD*> allPads;
for( MODULE* footprint : Modules() ) for( MODULE* footprint : Footprints() )
{ {
for( PAD* pad : footprint->Pads() ) for( PAD* pad : footprint->Pads() )
allPads.push_back( pad ); allPads.push_back( pad );
@ -1874,7 +1874,7 @@ unsigned BOARD::GetPadCount() const
{ {
unsigned retval = 0; unsigned retval = 0;
for( MODULE* footprint : Modules() ) for( MODULE* footprint : Footprints() )
retval += footprint->Pads().size(); retval += footprint->Pads().size();
return retval; return retval;
@ -1888,7 +1888,7 @@ const std::vector<BOARD_CONNECTED_ITEM*> BOARD::AllConnectedItems()
for( TRACK* track : Tracks() ) for( TRACK* track : Tracks() )
items.push_back( track ); items.push_back( track );
for( MODULE* footprint : Modules() ) for( MODULE* footprint : Footprints() )
{ {
for( PAD* pad : footprint->Pads() ) for( PAD* pad : footprint->Pads() )
items.push_back( pad ); items.push_back( pad );

View File

@ -194,7 +194,7 @@ private:
wxString m_fileName; wxString m_fileName;
MARKERS m_markers; MARKERS m_markers;
DRAWINGS m_drawings; DRAWINGS m_drawings;
MODULES m_modules; MODULES m_footprints;
TRACKS m_tracks; TRACKS m_tracks;
GROUPS m_groups; GROUPS m_groups;
ZONES m_zones; ZONES m_zones;
@ -281,8 +281,8 @@ public:
TRACKS& Tracks() { return m_tracks; } TRACKS& Tracks() { return m_tracks; }
const TRACKS& Tracks() const { return m_tracks; } const TRACKS& Tracks() const { return m_tracks; }
MODULES& Modules() { return m_modules; } MODULES& Footprints() { return m_footprints; }
const MODULES& Modules() const { return m_modules; } const MODULES& Footprints() const { return m_footprints; }
DRAWINGS& Drawings() { return m_drawings; } DRAWINGS& Drawings() { return m_drawings; }
const DRAWINGS& Drawings() const { return m_drawings; } const DRAWINGS& Drawings() const { return m_drawings; }
@ -328,7 +328,7 @@ public:
bool IsEmpty() const bool IsEmpty() const
{ {
return m_drawings.empty() && m_modules.empty() && m_tracks.empty() && m_zones.empty(); return m_drawings.empty() && m_footprints.empty() && m_tracks.empty() && m_zones.empty();
} }
void Move( const wxPoint& aMoveVector ) override; void Move( const wxPoint& aMoveVector ) override;
@ -347,7 +347,7 @@ public:
*/ */
MODULE* GetFirstFootprint() const MODULE* GetFirstFootprint() const
{ {
return m_modules.empty() ? nullptr : m_modules.front(); return m_footprints.empty() ? nullptr : m_footprints.front();
} }
/** /**
@ -355,10 +355,10 @@ public:
*/ */
void DeleteAllModules() void DeleteAllModules()
{ {
for( MODULE* mod : m_modules ) for( MODULE* footprint : m_footprints )
delete mod; delete footprint;
m_modules.clear(); m_footprints.clear();
} }
/** /**

View File

@ -143,10 +143,10 @@ void BOARD_COMMIT::Push( const wxString& aMessage, bool aCreateUndoEntry, bool a
// footprints inside footprints are not supported yet // footprints inside footprints are not supported yet
wxASSERT( boardItem->Type() != PCB_MODULE_T ); wxASSERT( boardItem->Type() != PCB_MODULE_T );
boardItem->SetParent( board->Modules().front() ); boardItem->SetParent( board->Footprints().front() );
if( !( changeFlags & CHT_DONE ) ) if( !( changeFlags & CHT_DONE ) )
board->Modules().front()->Add( boardItem ); board->Footprints().front()->Add( boardItem );
} }
else if( boardItem->Type() == PCB_FP_TEXT_T || else if( boardItem->Type() == PCB_FP_TEXT_T ||
boardItem->Type() == PCB_FP_SHAPE_T || boardItem->Type() == PCB_FP_SHAPE_T ||

View File

@ -77,14 +77,14 @@ void BOARD::ConvertBrdLayerToPolygonalContours( PCB_LAYER_ID aLayer, SHAPE_POLY_
} }
// convert pads // convert pads
for( MODULE* module : m_modules ) for( MODULE* footprint : m_footprints )
{ {
module->TransformPadsShapesWithClearanceToPolygon( aOutlines, aLayer, 0, maxError, footprint->TransformPadsShapesWithClearanceToPolygon( aOutlines, aLayer, 0, maxError,
ERROR_INSIDE ); ERROR_INSIDE );
// Micro-wave footprints may have items on copper layers // Micro-wave footprints may have items on copper layers
module->TransformGraphicShapesWithClearanceToPolygonSet( aOutlines, aLayer, 0, maxError, footprint->TransformGraphicShapesWithClearanceToPolygonSet( aOutlines, aLayer, 0, maxError,
ERROR_INSIDE ); ERROR_INSIDE );
} }
// convert copper zones // convert copper zones

View File

@ -74,7 +74,7 @@ void PCB_EDIT_FRAME::RecreateBOMFileFromBoard( wxCommandEvent& aEvent )
FILE* fp_bom; FILE* fp_bom;
wxString msg; wxString msg;
if( GetBoard()->Modules().empty() ) if( GetBoard()->Footprints().empty() )
{ {
ShowInfoBarError( _( "Cannot export BOM: there are no footprints on the PCB." ) ); ShowInfoBarError( _( "Cannot export BOM: there are no footprints on the PCB." ) );
return; return;
@ -119,7 +119,7 @@ void PCB_EDIT_FRAME::RecreateBOMFileFromBoard( wxCommandEvent& aEvent )
CmpList::iterator iter; CmpList::iterator iter;
int i = 1; int i = 1;
for( MODULE* module : GetBoard()->Modules() ) for( MODULE* fp : GetBoard()->Footprints() )
{ {
bool valExist = false; bool valExist = false;
@ -128,10 +128,10 @@ void PCB_EDIT_FRAME::RecreateBOMFileFromBoard( wxCommandEvent& aEvent )
{ {
cmp* current = *iter; cmp* current = *iter;
if( (current->m_Val == module->GetValue()) && (current->m_fpid == module->GetFPID()) ) if( (current->m_Val == fp->GetValue()) && (current->m_fpid == fp->GetFPID()) )
{ {
current->m_Ref.Append( wxT( ", " ), 1 ); current->m_Ref.Append( wxT( ", " ), 1 );
current->m_Ref.Append( module->Reference().GetShownText() ); current->m_Ref.Append( fp->Reference().GetShownText() );
current->m_CmpCount++; current->m_CmpCount++;
valExist = true; valExist = true;
@ -144,9 +144,9 @@ void PCB_EDIT_FRAME::RecreateBOMFileFromBoard( wxCommandEvent& aEvent )
{ {
comp = new cmp(); comp = new cmp();
comp->m_Id = i++; comp->m_Id = i++;
comp->m_Val = module->Value().GetShownText(); comp->m_Val = fp->Value().GetShownText();
comp->m_Ref = module->Reference().GetShownText(); comp->m_Ref = fp->Reference().GetShownText();
comp->m_fpid = module->GetFPID(); comp->m_fpid = fp->GetFPID();
comp->m_CmpCount = 1; comp->m_CmpCount = 1;
list.Append( comp ); list.Append( comp );
} }

View File

@ -433,8 +433,8 @@ void CN_CONNECTIVITY_ALGO::Build( BOARD* aBoard, PROGRESS_REPORTER* aReporter )
size += aBoard->Zones().size(); size += aBoard->Zones().size();
size += aBoard->Tracks().size(); size += aBoard->Tracks().size();
for( MODULE* mod : aBoard->Modules() ) for( MODULE* footprint : aBoard->Footprints() )
size += mod->Pads().size(); size += footprint->Pads().size();
size *= 2; // Our caller us gets the other half of the progress bar size *= 2; // Our caller us gets the other half of the progress bar
@ -450,7 +450,7 @@ void CN_CONNECTIVITY_ALGO::Build( BOARD* aBoard, PROGRESS_REPORTER* aReporter )
reportProgress( aReporter, ii++, size, delta ); reportProgress( aReporter, ii++, size, delta );
} }
for( MODULE* footprint : aBoard->Modules() ) for( MODULE* footprint : aBoard->Footprints() )
{ {
for( PAD* pad : footprint->Pads() ) for( PAD* pad : footprint->Pads() )
{ {

View File

@ -35,15 +35,15 @@ void FROM_TO_CACHE::buildEndpointList( )
{ {
m_ftEndpoints.clear(); m_ftEndpoints.clear();
for( auto mod : m_board->Modules() ) for( MODULE* footprint : m_board->Footprints() )
{ {
for( auto pad : mod->Pads() ) for( PAD* pad : footprint->Pads() )
{ {
FT_ENDPOINT ent; FT_ENDPOINT ent;
ent.name = mod->GetReference() + "-" + pad->GetName(); ent.name = footprint->GetReference() + "-" + pad->GetName();
ent.parent = pad; ent.parent = pad;
m_ftEndpoints.push_back( ent ); m_ftEndpoints.push_back( ent );
ent.name = mod->GetReference(); ent.name = footprint->GetReference();
ent.parent = pad; ent.parent = pad;
m_ftEndpoints.push_back( ent ); m_ftEndpoints.push_back( ent );
} }

View File

@ -250,15 +250,17 @@ void PCB_EDIT_FRAME::ExecuteRemoteCommand( const char* cmdline )
if( crossProbingSettings.center_on_items ) if( crossProbingSettings.center_on_items )
{ {
for( auto zone : pcb->Zones() ) for( ZONE* zone : pcb->Zones() )
merge_area( zone ); merge_area( zone );
for( auto track : pcb->Tracks() ) for( TRACK* track : pcb->Tracks() )
merge_area( track ); merge_area( track );
for( auto mod : pcb->Modules() ) for( MODULE* footprint : pcb->Footprints() )
for( auto mod_pad : mod->Pads() ) {
merge_area( mod_pad ); for( PAD* pad : footprint->Pads() )
merge_area( pad );
}
} }
} }
else else
@ -508,7 +510,7 @@ void PCB_EDIT_FRAME::KiwayMailIn( KIWAY_EXPRESS& mail )
NETLIST netlist; NETLIST netlist;
STRING_FORMATTER sf; STRING_FORMATTER sf;
for( MODULE* module : this->GetBoard()->Modules() ) for( MODULE* module : this->GetBoard()->Footprints() )
{ {
COMPONENT* component = new COMPONENT( module->GetFPID(), module->GetReference(), COMPONENT* component = new COMPONENT( module->GetFPID(), module->GetReference(),
module->GetValue(), module->GetPath() ); module->GetValue(), module->GetPath() );

View File

@ -97,7 +97,7 @@ wxString ActionMessage[] = {
DIALOG_BOARD_REANNOTATE::DIALOG_BOARD_REANNOTATE( PCB_EDIT_FRAME* aParentFrame ) DIALOG_BOARD_REANNOTATE::DIALOG_BOARD_REANNOTATE( PCB_EDIT_FRAME* aParentFrame )
: DIALOG_BOARD_REANNOTATE_BASE( aParentFrame ), : DIALOG_BOARD_REANNOTATE_BASE( aParentFrame ),
m_modules( aParentFrame->GetBoard()->Modules() ) m_modules( aParentFrame->GetBoard()->Footprints() )
{ {
m_Config = Kiface().KifaceSettings(); m_Config = Kiface().KifaceSettings();
InitValues(); InitValues();
@ -706,7 +706,7 @@ bool DIALOG_BOARD_REANNOTATE::BuildModuleList( std::vector<RefDesInfo>& aBadRefD
m_FrontModules.clear(); m_FrontModules.clear();
m_BackModules.clear(); m_BackModules.clear();
m_ExcludeArray.clear(); m_ExcludeArray.clear();
m_modules = m_frame->GetBoard()->Modules(); m_modules = m_frame->GetBoard()->Footprints();
std::vector<KIID> selected; std::vector<KIID> selected;

View File

@ -181,18 +181,18 @@ void DIALOG_BOARD_STATISTICS::getDataFromPCB()
BOARD* board = m_parentFrame->GetBoard(); BOARD* board = m_parentFrame->GetBoard();
// Get footprints and pads count // Get footprints and pads count
for( MODULE* module : board->Modules() ) for( MODULE* footprint : board->Footprints() )
{ {
// Do not proceed footprints with no pads if checkbox checked // Do not proceed footprints with no pads if checkbox checked
if( m_checkBoxExcludeComponentsNoPins->GetValue() && ! module->Pads().size() ) if( m_checkBoxExcludeComponentsNoPins->GetValue() && ! footprint->Pads().size() )
continue; continue;
// Go through components types list // Go through components types list
for( auto& type : m_componentsTypes ) for( auto& type : m_componentsTypes )
{ {
if( ( module->GetAttributes() & type.attribute ) > 0 ) if(( footprint->GetAttributes() & type.attribute ) > 0 )
{ {
if( module->IsFlipped() ) if( footprint->IsFlipped() )
type.backSideQty++; type.backSideQty++;
else else
type.frontSideQty++; type.frontSideQty++;
@ -200,7 +200,7 @@ void DIALOG_BOARD_STATISTICS::getDataFromPCB()
} }
} }
for( PAD* pad : module->Pads() ) for( PAD* pad : footprint->Pads() )
{ {
// Go through pads types list // Go through pads types list
for( auto& type : m_padsTypes ) for( auto& type : m_padsTypes )
@ -229,10 +229,11 @@ void DIALOG_BOARD_STATISTICS::getDataFromPCB()
} }
drillType_t drill( pad->GetDrillSize().x, pad->GetDrillSize().y, drillType_t drill( pad->GetDrillSize().x, pad->GetDrillSize().y,
pad->GetDrillShape(), pad->GetAttribute() != PAD_ATTRIB_NPTH, pad->GetDrillShape(), pad->GetAttribute() != PAD_ATTRIB_NPTH,
true, top, bottom ); true, top, bottom );
auto it = m_drillTypes.begin(); auto it = m_drillTypes.begin();
for( ; it != m_drillTypes.end(); it++ ) for( ; it != m_drillTypes.end(); it++ )
{ {
if( *it == drill ) if( *it == drill )
@ -267,9 +268,10 @@ void DIALOG_BOARD_STATISTICS::getDataFromPCB()
} }
drillType_t drill( via->GetDrillValue(), via->GetDrillValue(), PAD_DRILL_SHAPE_CIRCLE, drillType_t drill( via->GetDrillValue(), via->GetDrillValue(), PAD_DRILL_SHAPE_CIRCLE,
true, false, via->TopLayer(), via->BottomLayer() ); true, false, via->TopLayer(), via->BottomLayer() );
auto it = m_drillTypes.begin(); auto it = m_drillTypes.begin();
for( ; it != m_drillTypes.end(); it++ ) for( ; it != m_drillTypes.end(); it++ )
{ {
if( *it == drill ) if( *it == drill )
@ -289,7 +291,7 @@ void DIALOG_BOARD_STATISTICS::getDataFromPCB()
} }
sort( m_drillTypes.begin(), m_drillTypes.end(), sort( m_drillTypes.begin(), m_drillTypes.end(),
drillType_t::COMPARE( drillType_t::COL_COUNT, false ) ); drillType_t::COMPARE( drillType_t::COL_COUNT, false ) );
bool boundingBoxCreated = false; //flag if bounding box initialized bool boundingBoxCreated = false; //flag if bounding box initialized
BOX2I bbox; BOX2I bbox;

View File

@ -313,7 +313,7 @@ bool DIALOG_EXCHANGE_FOOTPRINTS::processMatchingFootprints()
LIB_ID newFPID; LIB_ID newFPID;
wxString value; wxString value;
if( m_parent->GetBoard()->Modules().empty() ) if( m_parent->GetBoard()->Footprints().empty() )
return false; return false;
if( !m_updateMode ) if( !m_updateMode )
@ -327,8 +327,8 @@ bool DIALOG_EXCHANGE_FOOTPRINTS::processMatchingFootprints()
/* The change is done from the last footprint because processFootprint() modifies the last /* The change is done from the last footprint because processFootprint() modifies the last
* item in the list. * item in the list.
*/ */
for( auto it = m_parent->GetBoard()->Modules().rbegin(); for( auto it = m_parent->GetBoard()->Footprints().rbegin();
it != m_parent->GetBoard()->Modules().rend(); it++ ) it != m_parent->GetBoard()->Footprints().rend(); it++ )
{ {
auto mod = *it; auto mod = *it;

View File

@ -220,26 +220,25 @@ void DIALOG_FIND::search( bool aDirection )
if( FindIncludeTexts || FindIncludeValues || FindIncludeReferences ) if( FindIncludeTexts || FindIncludeValues || FindIncludeReferences )
{ {
for( MODULE* module : m_frame->GetBoard()->Modules() ) for( MODULE* fp : m_frame->GetBoard()->Footprints() )
{ {
if( ( module->Reference().Matches( m_frame->GetFindReplaceData(), nullptr ) if( ( fp->Reference().Matches( m_frame->GetFindReplaceData(), nullptr )
&& FindIncludeReferences ) && FindIncludeReferences )
|| ( module->Value().Matches( m_frame->GetFindReplaceData(), nullptr ) || ( fp->Value().Matches( m_frame->GetFindReplaceData(), nullptr )
&& FindIncludeValues ) ) && FindIncludeValues ) )
{ {
m_hitList.push_back( module ); m_hitList.push_back( fp );
} }
if( m_includeTexts->GetValue() ) if( m_includeTexts->GetValue() )
{ {
for( BOARD_ITEM* item : module->GraphicalItems() ) for( BOARD_ITEM* item : fp->GraphicalItems() )
{ {
FP_TEXT* textItem = dynamic_cast<FP_TEXT*>( item ); FP_TEXT* textItem = dynamic_cast<FP_TEXT*>( item );
if( textItem if( textItem && textItem->Matches( m_frame->GetFindReplaceData(), nullptr ) )
&& textItem->Matches( m_frame->GetFindReplaceData(), nullptr ) )
{ {
m_hitList.push_back( module ); m_hitList.push_back( fp );
} }
} }
} }

View File

@ -139,9 +139,9 @@ void DIALOG_GENDRILL::InitDisplayParams()
m_microViasCount = 0; m_microViasCount = 0;
m_blindOrBuriedViasCount = 0; m_blindOrBuriedViasCount = 0;
for( MODULE* module : m_board->Modules() ) for( MODULE* footprint : m_board->Footprints() )
{ {
for( PAD* pad : module->Pads() ) for( PAD* pad : footprint->Pads() )
{ {
if( pad->GetDrillShape() == PAD_DRILL_SHAPE_CIRCLE ) if( pad->GetDrillShape() == PAD_DRILL_SHAPE_CIRCLE )
{ {
@ -169,6 +169,7 @@ void DIALOG_GENDRILL::InitDisplayParams()
for( TRACK* track : m_board->Tracks() ) for( TRACK* track : m_board->Tracks() )
{ {
const VIA *via = dynamic_cast<const VIA*>( track ); const VIA *via = dynamic_cast<const VIA*>( track );
if( via ) if( via )
{ {
switch( via->GetViaType() ) switch( via->GetViaType() )
@ -262,8 +263,11 @@ void DIALOG_GENDRILL::OnSelZerosFmtSelected( wxCommandEvent& event )
void DIALOG_GENDRILL::UpdatePrecisionOptions() void DIALOG_GENDRILL::UpdatePrecisionOptions()
{ {
if( m_Choice_Unit->GetSelection()== 1 ) // Units = inches if( m_Choice_Unit->GetSelection()== 1 )
{
// Units = inches
m_staticTextPrecision->SetLabel( precisionListForInches.GetPrecisionString() ); m_staticTextPrecision->SetLabel( precisionListForInches.GetPrecisionString() );
}
else else
{ {
// metric options // metric options

View File

@ -170,7 +170,7 @@ void DIALOG_GLOBAL_DELETION::AcceptPcbDelete()
if( delAll || m_DelModules->GetValue() ) if( delAll || m_DelModules->GetValue() )
{ {
for( auto item : pcb->Modules() ) for( MODULE* item : pcb->Footprints() )
{ {
bool del_fp = delAll; bool del_fp = delAll;

View File

@ -378,7 +378,7 @@ bool DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::TransferDataFromWindow()
BOARD_COMMIT commit( m_parent ); BOARD_COMMIT commit( m_parent );
// Go through the footprints // Go through the footprints
for( MODULE* fp : m_parent->GetBoard()->Modules() ) for( MODULE* fp : m_parent->GetBoard()->Footprints() )
{ {
if( m_references->GetValue() ) if( m_references->GetValue() )
visitItem( commit, &fp->Reference() ); visitItem( commit, &fp->Reference() );

View File

@ -1471,7 +1471,7 @@ void DIALOG_NET_INSPECTOR::buildNetsList()
// count the pads for each net. since the nets are sorted by netcode // count the pads for each net. since the nets are sorted by netcode
// iterating over the modules' pads is faster. // iterating over the modules' pads is faster.
for( MODULE* footprint : m_brd->Modules() ) for( MODULE* footprint : m_brd->Footprints() )
{ {
for( PAD* pad : footprint->Pads() ) for( PAD* pad : footprint->Pads() )
{ {

View File

@ -90,7 +90,7 @@ bool DIALOG_UNUSED_PAD_LAYERS::TransferDataFromWindow()
{ {
if( m_cbSelectedOnly->IsChecked() ) if( m_cbSelectedOnly->IsChecked() )
{ {
for( auto item : m_items ) for( EDA_ITEM* item : m_items )
{ {
m_commit.Modify( item ); m_commit.Modify( item );
@ -103,9 +103,9 @@ bool DIALOG_UNUSED_PAD_LAYERS::TransferDataFromWindow()
if( item->Type() == PCB_MODULE_T && m_rbScope->GetSelection() == SCOPE_PADS ) if( item->Type() == PCB_MODULE_T && m_rbScope->GetSelection() == SCOPE_PADS )
{ {
MODULE* mod = static_cast<MODULE*>( item ); MODULE* footprint = static_cast<MODULE*>( item );
for( auto pad : mod->Pads() ) for( PAD* pad : footprint->Pads() )
{ {
pad->SetRemoveUnconnected( m_rbAction->GetSelection() == PAD_ACTION_REMOVE ); pad->SetRemoveUnconnected( m_rbAction->GetSelection() == PAD_ACTION_REMOVE );
pad->SetKeepTopBottom( m_cbPreservePads->IsChecked() ); pad->SetKeepTopBottom( m_cbPreservePads->IsChecked() );
@ -125,12 +125,11 @@ bool DIALOG_UNUSED_PAD_LAYERS::TransferDataFromWindow()
{ {
if( m_rbScope->GetSelection() == SCOPE_PADS ) if( m_rbScope->GetSelection() == SCOPE_PADS )
{ {
for( auto item : m_frame->GetBoard()->Modules() ) for( MODULE* footprint : m_frame->GetBoard()->Footprints() )
{ {
m_commit.Modify( item ); m_commit.Modify( footprint );
MODULE* mod = static_cast<MODULE*>( item );
for( auto pad : mod->Pads() ) for( PAD* pad : footprint->Pads() )
{ {
pad->SetRemoveUnconnected( m_rbAction->GetSelection() == PAD_ACTION_REMOVE ); pad->SetRemoveUnconnected( m_rbAction->GetSelection() == PAD_ACTION_REMOVE );
pad->SetKeepTopBottom( m_cbPreservePads->IsChecked() ); pad->SetKeepTopBottom( m_cbPreservePads->IsChecked() );
@ -139,7 +138,7 @@ bool DIALOG_UNUSED_PAD_LAYERS::TransferDataFromWindow()
} }
else else
{ {
for( auto item : m_frame->GetBoard()->Tracks() ) for( TRACK* item : m_frame->GetBoard()->Tracks() )
{ {
if( item->Type() != PCB_VIA_T ) if( item->Type() != PCB_VIA_T )
continue; continue;

View File

@ -365,7 +365,7 @@ void DRC_ENGINE::loadImplicitRules()
keepoutZones.push_back( zone ); keepoutZones.push_back( zone );
} }
for( MODULE* footprint : m_board->Modules() ) for( MODULE* footprint : m_board->Footprints() )
{ {
for( ZONE* zone : footprint->Zones() ) for( ZONE* zone : footprint->Zones() )
{ {
@ -659,7 +659,7 @@ void DRC_ENGINE::RunTests( EDA_UNITS aUnits, bool aReportAllTrackErrors, bool aT
for( ZONE* zone : m_board->Zones() ) for( ZONE* zone : m_board->Zones() )
zone->CacheBoundingBox(); zone->CacheBoundingBox();
for( MODULE* module : m_board->Modules() ) for( MODULE* module : m_board->Footprints() )
{ {
for( ZONE* zone : module->Zones() ) for( ZONE* zone : module->Zones() )
zone->CacheBoundingBox(); zone->CacheBoundingBox();

View File

@ -218,7 +218,7 @@ int DRC_TEST_PROVIDER::forEachGeometryItem( const std::vector<KICAD_T>& aTypes,
{ {
for( ZONE* item : brd->Zones() ) for( ZONE* item : brd->Zones() )
{ {
if( (item->GetLayerSet() & aLayers).any() ) if( ( item->GetLayerSet() & aLayers ).any() )
{ {
if( !aFunc( item ) ) if( !aFunc( item ) )
return n; return n;
@ -228,21 +228,21 @@ int DRC_TEST_PROVIDER::forEachGeometryItem( const std::vector<KICAD_T>& aTypes,
} }
} }
for( MODULE* mod : brd->Modules() ) for( MODULE* footprint : brd->Footprints() )
{ {
if( typeMask[ PCB_FP_TEXT_T ] ) if( typeMask[ PCB_FP_TEXT_T ] )
{ {
if( (mod->Reference().GetLayerSet() & aLayers).any() ) if( ( footprint->Reference().GetLayerSet() & aLayers ).any() )
{ {
if( !aFunc( &mod->Reference() ) ) if( !aFunc( &footprint->Reference() ) )
return n; return n;
n++; n++;
} }
if( (mod->Value().GetLayerSet() & aLayers).any() ) if( ( footprint->Value().GetLayerSet() & aLayers ).any() )
{ {
if( !aFunc( &mod->Value() ) ) if( !aFunc( &footprint->Value() ) )
return n; return n;
n++; n++;
@ -251,7 +251,7 @@ int DRC_TEST_PROVIDER::forEachGeometryItem( const std::vector<KICAD_T>& aTypes,
if( typeMask[ PCB_PAD_T ] ) if( typeMask[ PCB_PAD_T ] )
{ {
for( PAD* pad : mod->Pads() ) for( PAD* pad : footprint->Pads() )
{ {
if( ( pad->GetLayerSet() & aLayers ).any() ) if( ( pad->GetLayerSet() & aLayers ).any() )
{ {
@ -263,7 +263,7 @@ int DRC_TEST_PROVIDER::forEachGeometryItem( const std::vector<KICAD_T>& aTypes,
} }
} }
for( BOARD_ITEM* dwg : mod->GraphicalItems() ) for( BOARD_ITEM* dwg : footprint->GraphicalItems() )
{ {
if( (dwg->GetLayerSet() & aLayers).any() ) if( (dwg->GetLayerSet() & aLayers).any() )
{ {
@ -286,7 +286,7 @@ int DRC_TEST_PROVIDER::forEachGeometryItem( const std::vector<KICAD_T>& aTypes,
if( typeMask[ PCB_FP_ZONE_T ] ) if( typeMask[ PCB_FP_ZONE_T ] )
{ {
for( ZONE* zone : mod->Zones() ) for( ZONE* zone : footprint->Zones() )
{ {
if( (zone->GetLayerSet() & aLayers).any() ) if( (zone->GetLayerSet() & aLayers).any() )
{ {
@ -300,7 +300,7 @@ int DRC_TEST_PROVIDER::forEachGeometryItem( const std::vector<KICAD_T>& aTypes,
if( typeMask[ PCB_MODULE_T ] ) if( typeMask[ PCB_MODULE_T ] )
{ {
if( !aFunc( mod ) ) if( !aFunc( footprint ) )
return n; return n;
n++; n++;

View File

@ -127,7 +127,7 @@ bool DRC_TEST_PROVIDER_COPPER_CLEARANCE::Run()
m_zones.push_back( zone ); m_zones.push_back( zone );
} }
for( MODULE* footprint : m_board->Modules() ) for( MODULE* footprint : m_board->Footprints() )
{ {
for( ZONE* zone : footprint->Zones() ) for( ZONE* zone : footprint->Zones() )
{ {
@ -513,16 +513,16 @@ void DRC_TEST_PROVIDER_COPPER_CLEARANCE::testPadClearances( )
size_t count = 0; size_t count = 0;
for( MODULE* module : m_board->Modules() ) for( MODULE* footprint : m_board->Footprints() )
count += module->Pads().size(); count += footprint->Pads().size();
reportAux( "Testing %d pads...", count ); reportAux( "Testing %d pads...", count );
int ii = 0; int ii = 0;
for( MODULE* module : m_board->Modules() ) for( MODULE* footprint : m_board->Footprints() )
{ {
for( PAD* pad : module->Pads() ) for( PAD* pad : footprint->Pads() )
{ {
if( !reportProgress( ii++, count, delta ) ) if( !reportProgress( ii++, count, delta ) )
break; break;

View File

@ -82,9 +82,9 @@ void DRC_TEST_PROVIDER_COURTYARD_CLEARANCE::testFootprintCourtyardDefinitions()
int ii = 0; int ii = 0;
for( MODULE* footprint : m_board->Modules() ) for( MODULE* footprint : m_board->Footprints() )
{ {
if( !reportProgress( ii++, m_board->Modules().size(), delta ) ) if( !reportProgress( ii++, m_board->Footprints().size(), delta ) )
return; return;
if( ( footprint->GetFlags() & MALFORMED_COURTYARD ) != 0 ) if( ( footprint->GetFlags() & MALFORMED_COURTYARD ) != 0 )
@ -128,9 +128,9 @@ void DRC_TEST_PROVIDER_COURTYARD_CLEARANCE::testOverlappingComponentCourtyards()
int ii = 0; int ii = 0;
for( auto it1 = m_board->Modules().begin(); it1 != m_board->Modules().end(); it1++ ) for( auto it1 = m_board->Footprints().begin(); it1 != m_board->Footprints().end(); it1++ )
{ {
if( !reportProgress( ii++, m_board->Modules().size(), delta ) ) if( !reportProgress( ii++, m_board->Footprints().size(), delta ) )
break; break;
if( m_drcEngine->IsErrorLimitExceeded( DRCE_OVERLAPPING_FOOTPRINTS) ) if( m_drcEngine->IsErrorLimitExceeded( DRCE_OVERLAPPING_FOOTPRINTS) )
@ -143,7 +143,7 @@ void DRC_TEST_PROVIDER_COURTYARD_CLEARANCE::testOverlappingComponentCourtyards()
if( footprintFront.OutlineCount() == 0 && footprintBack.OutlineCount() == 0 ) if( footprintFront.OutlineCount() == 0 && footprintBack.OutlineCount() == 0 )
continue; // No courtyards defined continue; // No courtyards defined
for( auto it2 = it1 + 1; it2 != m_board->Modules().end(); it2++ ) for( auto it2 = it1 + 1; it2 != m_board->Footprints().end(); it2++ )
{ {
MODULE* test = *it2; MODULE* test = *it2;
SHAPE_POLY_SET& testFront = test->GetPolyCourtyardFront(); SHAPE_POLY_SET& testFront = test->GetPolyCourtyardFront();

View File

@ -196,7 +196,7 @@ bool DRC_TEST_PROVIDER_HOLE_CLEARANCE::Run()
via->SetFlags( SKIP_STRUCT ); via->SetFlags( SKIP_STRUCT );
} }
for( MODULE* footprint : m_board->Modules() ) for( MODULE* footprint : m_board->Footprints() )
{ {
for( PAD* pad : footprint->Pads() ) for( PAD* pad : footprint->Pads() )
{ {

View File

@ -81,12 +81,12 @@ bool DRC_TEST_PROVIDER_HOLE_SIZE::Run()
m_board = m_drcEngine->GetBoard(); m_board = m_drcEngine->GetBoard();
for( MODULE* module : m_board->Modules() ) for( MODULE* footprint : m_board->Footprints() )
{ {
if( m_drcEngine->IsErrorLimitExceeded( DRCE_TOO_SMALL_DRILL ) ) if( m_drcEngine->IsErrorLimitExceeded( DRCE_TOO_SMALL_DRILL ) )
break; break;
for( PAD* pad : module->Pads() ) for( PAD* pad : footprint->Pads() )
{ {
if( m_drcEngine->IsErrorLimitExceeded( DRCE_TOO_SMALL_DRILL ) ) if( m_drcEngine->IsErrorLimitExceeded( DRCE_TOO_SMALL_DRILL ) )
break; break;

View File

@ -85,22 +85,22 @@ void DRC_TEST_PROVIDER_LVS::testFootprints( NETLIST& aNetlist )
return x->GetReference().CmpNoCase( y->GetReference() ) < 0; return x->GetReference().CmpNoCase( y->GetReference() ) < 0;
}; };
auto mods = std::set<MODULE*, decltype( compare )>( compare ); auto footprints = std::set<MODULE*, decltype( compare )>( compare );
// Search for duplicate footprints on the board // Search for duplicate footprints on the board
for( MODULE* mod : board->Modules() ) for( MODULE* footprint : board->Footprints() )
{ {
if( m_drcEngine->IsErrorLimitExceeded( DRCE_DUPLICATE_FOOTPRINT ) ) if( m_drcEngine->IsErrorLimitExceeded( DRCE_DUPLICATE_FOOTPRINT ) )
break; break;
auto ins = mods.insert( mod ); auto ins = footprints.insert( footprint );
if( !ins.second ) if( !ins.second )
{ {
std::shared_ptr<DRC_ITEM> drcItem = DRC_ITEM::Create( DRCE_DUPLICATE_FOOTPRINT ); std::shared_ptr<DRC_ITEM> drcItem = DRC_ITEM::Create( DRCE_DUPLICATE_FOOTPRINT );
drcItem->SetItems( mod, *ins.first ); drcItem->SetItems( footprint, *ins.first );
reportViolation( drcItem, mod->GetPosition() ); reportViolation( drcItem, footprint->GetPosition() );
} }
} }
@ -108,9 +108,9 @@ void DRC_TEST_PROVIDER_LVS::testFootprints( NETLIST& aNetlist )
for( unsigned ii = 0; ii < aNetlist.GetCount(); ii++ ) for( unsigned ii = 0; ii < aNetlist.GetCount(); ii++ )
{ {
COMPONENT* component = aNetlist.GetComponent( ii ); COMPONENT* component = aNetlist.GetComponent( ii );
MODULE* module = board->FindModuleByReference( component->GetReference() ); MODULE* footprint = board->FindModuleByReference( component->GetReference() );
if( module == nullptr ) if( footprint == nullptr )
{ {
if( m_drcEngine->IsErrorLimitExceeded( DRCE_MISSING_FOOTPRINT ) ) if( m_drcEngine->IsErrorLimitExceeded( DRCE_MISSING_FOOTPRINT ) )
break; break;
@ -126,7 +126,7 @@ void DRC_TEST_PROVIDER_LVS::testFootprints( NETLIST& aNetlist )
} }
else else
{ {
for( PAD* pad : module->Pads() ) for( PAD* pad : footprint->Pads() )
{ {
if( m_drcEngine->IsErrorLimitExceeded( DRCE_NET_CONFLICT ) ) if( m_drcEngine->IsErrorLimitExceeded( DRCE_NET_CONFLICT ) )
break; break;
@ -141,7 +141,7 @@ void DRC_TEST_PROVIDER_LVS::testFootprints( NETLIST& aNetlist )
std::shared_ptr<DRC_ITEM> drcItem = DRC_ITEM::Create( DRCE_NET_CONFLICT ); std::shared_ptr<DRC_ITEM> drcItem = DRC_ITEM::Create( DRCE_NET_CONFLICT );
drcItem->SetErrorMessage( m_msg ); drcItem->SetErrorMessage( m_msg );
drcItem->SetItems( pad ); drcItem->SetItems( pad );
reportViolation( drcItem, module->GetPosition() ); reportViolation( drcItem, footprint->GetPosition() );
} }
else if( pcb_netname.IsEmpty() && !sch_net.GetNetName().IsEmpty() ) else if( pcb_netname.IsEmpty() && !sch_net.GetNetName().IsEmpty() )
{ {
@ -151,7 +151,7 @@ void DRC_TEST_PROVIDER_LVS::testFootprints( NETLIST& aNetlist )
std::shared_ptr<DRC_ITEM> drcItem = DRC_ITEM::Create( DRCE_NET_CONFLICT ); std::shared_ptr<DRC_ITEM> drcItem = DRC_ITEM::Create( DRCE_NET_CONFLICT );
drcItem->SetErrorMessage( m_msg ); drcItem->SetErrorMessage( m_msg );
drcItem->SetItems( pad ); drcItem->SetItems( pad );
reportViolation( drcItem, module->GetPosition() ); reportViolation( drcItem, footprint->GetPosition() );
} }
else if( pcb_netname != sch_net.GetNetName() ) else if( pcb_netname != sch_net.GetNetName() )
{ {
@ -162,7 +162,7 @@ void DRC_TEST_PROVIDER_LVS::testFootprints( NETLIST& aNetlist )
std::shared_ptr<DRC_ITEM> drcItem = DRC_ITEM::Create( DRCE_NET_CONFLICT ); std::shared_ptr<DRC_ITEM> drcItem = DRC_ITEM::Create( DRCE_NET_CONFLICT );
drcItem->SetErrorMessage( m_msg ); drcItem->SetErrorMessage( m_msg );
drcItem->SetItems( pad ); drcItem->SetItems( pad );
reportViolation( drcItem, module->GetPosition() ); reportViolation( drcItem, footprint->GetPosition() );
} }
} }
@ -173,35 +173,35 @@ void DRC_TEST_PROVIDER_LVS::testFootprints( NETLIST& aNetlist )
const COMPONENT_NET& sch_net = component->GetNet( jj ); const COMPONENT_NET& sch_net = component->GetNet( jj );
if( !module->FindPadByName( sch_net.GetPinName() ) ) if( !footprint->FindPadByName( sch_net.GetPinName() ) )
{ {
m_msg.Printf( _( "No pad found for pin %s in schematic." ), m_msg.Printf( _( "No pad found for pin %s in schematic." ),
sch_net.GetPinName() ); sch_net.GetPinName() );
std::shared_ptr<DRC_ITEM> drcItem = DRC_ITEM::Create( DRCE_NET_CONFLICT ); std::shared_ptr<DRC_ITEM> drcItem = DRC_ITEM::Create( DRCE_NET_CONFLICT );
drcItem->SetErrorMessage( m_msg ); drcItem->SetErrorMessage( m_msg );
drcItem->SetItems( module ); drcItem->SetItems( footprint );
reportViolation( drcItem, module->GetPosition() ); reportViolation( drcItem, footprint->GetPosition() );
} }
} }
} }
} }
// Search for component footprints found on board but not in netlist. // Search for component footprints found on board but not in netlist.
for( MODULE* module : board->Modules() ) for( MODULE* footprint : board->Footprints() )
{ {
if( m_drcEngine->IsErrorLimitExceeded( DRCE_EXTRA_FOOTPRINT ) ) if( m_drcEngine->IsErrorLimitExceeded( DRCE_EXTRA_FOOTPRINT ) )
break; break;
if( module->GetAttributes() & MOD_BOARD_ONLY ) if( footprint->GetAttributes() & MOD_BOARD_ONLY )
continue; continue;
if( !aNetlist.GetComponentByReference( module->GetReference() ) ) if( !aNetlist.GetComponentByReference( footprint->GetReference() ) )
{ {
std::shared_ptr<DRC_ITEM> drcItem = DRC_ITEM::Create( DRCE_EXTRA_FOOTPRINT ); std::shared_ptr<DRC_ITEM> drcItem = DRC_ITEM::Create( DRCE_EXTRA_FOOTPRINT );
drcItem->SetItems( module ); drcItem->SetItems( footprint );
reportViolation( drcItem, module->GetPosition() ); reportViolation( drcItem, footprint->GetPosition() );
} }
} }
} }

View File

@ -94,9 +94,9 @@ static void build_pad_testpoints( BOARD *aPcb, std::vector <D356_RECORD>& aRecor
{ {
wxPoint origin = aPcb->GetDesignSettings().m_AuxOrigin; wxPoint origin = aPcb->GetDesignSettings().m_AuxOrigin;
for( auto module : aPcb->Modules() ) for( MODULE* footprint : aPcb->Footprints() )
{ {
for( auto pad : module->Pads() ) for( PAD* pad : footprint->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() );
@ -106,7 +106,7 @@ static void build_pad_testpoints( BOARD *aPcb, std::vector <D356_RECORD>& aRecor
{ {
rk.netname = pad->GetNetname(); rk.netname = pad->GetNetname();
rk.pin = pad->GetName(); rk.pin = pad->GetName();
rk.refdes = module->GetReference(); rk.refdes = footprint->GetReference();
rk.midpoint = false; // XXX MAYBE need to be computed (how?) rk.midpoint = false; // XXX MAYBE need to be computed (how?)
const wxSize& drill = pad->GetDrillSize(); const wxSize& drill = pad->GetDrillSize();
rk.drill = std::min( drill.x, drill.y ); rk.drill = std::min( drill.x, drill.y );

View File

@ -39,16 +39,16 @@ bool RecreateCmpFile( BOARD * aBrd, const wxString& aFullCmpFileName )
fprintf( cmpFile, "Cmp-Mod V01 Created by PcbNew date = %s\n", TO_UTF8( DateAndTime() ) ); fprintf( cmpFile, "Cmp-Mod V01 Created by PcbNew date = %s\n", TO_UTF8( DateAndTime() ) );
for( auto module : aBrd->Modules() ) for( MODULE* fp : aBrd->Footprints() )
{ {
fprintf( cmpFile, "\nBeginCmp\n" ); fprintf( cmpFile, "\nBeginCmp\n" );
fprintf( cmpFile, "TimeStamp = %s\n", TO_UTF8( module->m_Uuid.AsString() ) ); fprintf( cmpFile, "TimeStamp = %s\n", TO_UTF8( fp->m_Uuid.AsString() ) );
fprintf( cmpFile, "Path = %s\n", TO_UTF8( module->GetPath().AsString() ) ); fprintf( cmpFile, "Path = %s\n", TO_UTF8( fp->GetPath().AsString() ) );
fprintf( cmpFile, "Reference = %s;\n", fprintf( cmpFile, "Reference = %s;\n",
!module->GetReference().IsEmpty() ? TO_UTF8( module->GetReference() ) : "[NoRef]" ); !fp->GetReference().IsEmpty() ? TO_UTF8( fp->GetReference() ) : "[NoRef]" );
fprintf( cmpFile, "ValeurCmp = %s;\n", fprintf( cmpFile, "ValeurCmp = %s;\n",
!module->GetValue().IsEmpty() ? TO_UTF8( module->GetValue() ) : "[NoVal]" ); !fp->GetValue().IsEmpty() ? TO_UTF8( fp->GetValue() ) : "[NoVal]" );
fprintf( cmpFile, "IdModule = %s;\n", module->GetFPID().Format().c_str() ); fprintf( cmpFile, "IdModule = %s;\n", fp->GetFPID().Format().c_str() );
fprintf( cmpFile, "EndCmp\n" ); fprintf( cmpFile, "EndCmp\n" );
} }

View File

@ -113,7 +113,7 @@ std::string PLACE_FILE_EXPORTER::GenPositionData()
// Build and sort the list of footprints alphabetically // Build and sort the list of footprints alphabetically
std::vector<LIST_MOD> list; std::vector<LIST_MOD> list;
for( MODULE* footprint : m_board->Modules() ) for( MODULE* footprint : m_board->Footprints() )
{ {
if( m_side != PCB_BOTH_SIDES ) if( m_side != PCB_BOTH_SIDES )
{ {
@ -303,61 +303,61 @@ std::string PLACE_FILE_EXPORTER::GenReportData()
buffer += "$EndBOARD\n\n"; buffer += "$EndBOARD\n\n";
std::vector<MODULE*> sortedModules; std::vector<MODULE*> sortedFootprints;
for( MODULE* module : m_board->Modules() ) for( MODULE* footprint : m_board->Footprints() )
sortedModules.push_back( module ); sortedFootprints.push_back( footprint );
std::sort( sortedModules.begin(), sortedModules.end(), std::sort( sortedFootprints.begin(), sortedFootprints.end(),
[]( MODULE* a, MODULE* b ) -> bool []( MODULE* a, MODULE* b ) -> bool
{ {
return StrNumCmp( a->GetReference(), b->GetReference(), true ) < 0; return StrNumCmp( a->GetReference(), b->GetReference(), true ) < 0;
}); });
for( MODULE* module : sortedModules ) for( MODULE* footprint : sortedFootprints )
{ {
wxString ref = module->Reference().GetShownText(); wxString ref = footprint->Reference().GetShownText();
sprintf( line, "$MODULE %s\n", TO_UTF8( ref ) ); sprintf( line, "$MODULE %s\n", TO_UTF8( ref ) );
buffer += line; buffer += line;
sprintf( line, "reference %s\n", TO_UTF8( ref ) ); sprintf( line, "reference %s\n", TO_UTF8( ref ) );
sprintf( line, "value %s\n", EscapedUTF8( module->Value().GetShownText() ).c_str() ); sprintf( line, "value %s\n", EscapedUTF8( footprint->Value().GetShownText() ).c_str() );
sprintf( line, "footprint %s\n", module->GetFPID().Format().c_str() ); sprintf( line, "footprint %s\n", footprint->GetFPID().Format().c_str() );
buffer += line; buffer += line;
buffer += "attribut"; buffer += "attribut";
if( ( module->GetAttributes() & ( MOD_THROUGH_HOLE | MOD_SMD ) ) == 0 ) if(( footprint->GetAttributes() & ( MOD_THROUGH_HOLE | MOD_SMD ) ) == 0 )
buffer += " virtual"; buffer += " virtual";
if( module->GetAttributes() & MOD_SMD ) if( footprint->GetAttributes() & MOD_SMD )
buffer += " smd"; buffer += " smd";
if( module->GetAttributes() & MOD_THROUGH_HOLE ) if( footprint->GetAttributes() & MOD_THROUGH_HOLE )
buffer += " none"; buffer += " none";
buffer += "\n"; buffer += "\n";
wxPoint module_pos = module->GetPosition(); wxPoint module_pos = footprint->GetPosition();
module_pos -= m_place_Offset; module_pos -= m_place_Offset;
sprintf( line, "position %9.6f %9.6f orientation %.2f\n", sprintf( line, "position %9.6f %9.6f orientation %.2f\n",
module_pos.x * conv_unit, module_pos.x * conv_unit,
module_pos.y * conv_unit, module_pos.y * conv_unit,
module->GetOrientation() / 10.0 ); footprint->GetOrientation() / 10.0 );
buffer += line; buffer += line;
if( module->GetLayer() == F_Cu ) if( footprint->GetLayer() == F_Cu )
buffer += "layer front\n"; buffer += "layer front\n";
else if( module->GetLayer() == B_Cu ) else if( footprint->GetLayer() == B_Cu )
buffer += "layer back\n"; buffer += "layer back\n";
else else
buffer += "layer other\n"; buffer += "layer other\n";
std::vector<PAD*> sortedPads; std::vector<PAD*> sortedPads;
for( PAD* pad : module->Pads() ) for( PAD* pad : footprint->Pads() )
sortedPads.push_back( pad ); sortedPads.push_back( pad );
std::sort( sortedPads.begin(), sortedPads.end(), std::sort( sortedPads.begin(), sortedPads.end(),
@ -390,7 +390,7 @@ std::string PLACE_FILE_EXPORTER::GenReportData()
pad->GetPos0().y * conv_unit, pad->GetPos0().y * conv_unit,
pad->GetSize().x * conv_unit, pad->GetSize().x * conv_unit,
pad->GetSize().y * conv_unit, pad->GetSize().y * conv_unit,
( pad->GetOrientation() - module->GetOrientation()) / 10.0 ); ( pad->GetOrientation() - footprint->GetOrientation()) / 10.0 );
buffer += line; buffer += line;
sprintf( line, "drill %9.6f\n", pad->GetDrillSize().x * conv_unit ); sprintf( line, "drill %9.6f\n", pad->GetDrillSize().x * conv_unit );

View File

@ -275,14 +275,14 @@ void PCB_EDIT_FRAME::ExportToGenCAD( wxCommandEvent& aEvent )
*/ */
BOARD* pcb = GetBoard(); BOARD* pcb = GetBoard();
for( MODULE* module : pcb->Modules() ) for( MODULE* footprint : pcb->Footprints() )
{ {
module->SetFlag( 0 ); footprint->SetFlag( 0 );
if( module->GetLayer() == B_Cu ) if( footprint->GetLayer() == B_Cu )
{ {
module->Flip( module->GetPosition(), Settings().m_FlipLeftRight ); footprint->Flip( footprint->GetPosition(), Settings().m_FlipLeftRight );
module->SetFlag( 1 ); footprint->SetFlag( 1 );
} }
} }
@ -311,12 +311,12 @@ void PCB_EDIT_FRAME::ExportToGenCAD( wxCommandEvent& aEvent )
fclose( file ); fclose( file );
// Undo the footprints modifications (flipped footprints) // Undo the footprints modifications (flipped footprints)
for( auto module : pcb->Modules() ) for( MODULE* footprint : pcb->Footprints() )
{ {
if( module->GetFlag() ) if( footprint->GetFlag() )
{ {
module->Flip( module->GetPosition(), Settings().m_FlipLeftRight ); footprint->Flip( footprint->GetPosition(), Settings().m_FlipLeftRight );
module->SetFlag( 0 ); footprint->SetFlag( 0 );
} }
} }
@ -694,7 +694,7 @@ static void CreateShapesSection( FILE* aFile, BOARD* aPcb )
fputs( "$SHAPES\n", aFile ); fputs( "$SHAPES\n", aFile );
for( MODULE* module : aPcb->Modules() ) for( MODULE* footprint : aPcb->Footprints() )
{ {
if( !individualShapes ) if( !individualShapes )
{ {
@ -702,10 +702,10 @@ static void CreateShapesSection( FILE* aFile, BOARD* aPcb )
// It is necessary to compute hash (i.e. check all children objects) as // It is necessary to compute hash (i.e. check all children objects) as
// certain components instances might have been modified on the board. // certain components instances might have been modified on the board.
// In such case the shape will be different despite the same LIB_ID. // In such case the shape will be different despite the same LIB_ID.
wxString shapeName = module->GetFPID().Format(); wxString shapeName = footprint->GetFPID().Format();
auto shapeIt = shapes.find( shapeName ); auto shapeIt = shapes.find( shapeName );
size_t modHash = hashModule( module ); size_t modHash = hashModule( footprint );
if( shapeIt != shapes.end() ) if( shapeIt != shapes.end() )
{ {
@ -731,26 +731,26 @@ static void CreateShapesSection( FILE* aFile, BOARD* aPcb )
if( shapeIt != shapes.end() && modHash == shapeIt->second ) if( shapeIt != shapes.end() && modHash == shapeIt->second )
{ {
// shape found, so reuse it // shape found, so reuse it
componentShapes[module] = modHash; componentShapes[footprint] = modHash;
continue; continue;
} }
} }
// new shape // new shape
componentShapes[module] = modHash; componentShapes[footprint] = modHash;
shapeNames[modHash] = shapeName; shapeNames[modHash] = shapeName;
shapes[shapeName] = modHash; shapes[shapeName] = modHash;
FootprintWriteShape( aFile, module, shapeName ); FootprintWriteShape( aFile, footprint, shapeName );
} }
else // individual shape for each component else // individual shape for each component
{ {
FootprintWriteShape( aFile, module, module->GetReference() ); FootprintWriteShape( aFile, footprint, footprint->GetReference() );
} }
// 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* pad : module->Pads() ) for( PAD* pad : footprint->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.
@ -778,11 +778,11 @@ static void CreateShapesSection( FILE* aFile, BOARD* aPcb )
pins.insert( pinname ); pins.insert( pinname );
} }
double orient = pad->GetOrientation() - module->GetOrientation(); double orient = pad->GetOrientation() - footprint->GetOrientation();
NORMALIZE_ANGLE_POS( orient ); NORMALIZE_ANGLE_POS( orient );
// Bottom side footprints use the flipped padstack // Bottom side footprints use the flipped padstack
fprintf( aFile, ( flipBottomPads && module->GetFlag() ) ? fprintf( aFile, ( flipBottomPads && footprint->GetFlag() ) ?
"PIN \"%s\" PAD%dF %g %g %s %g %s\n" : "PIN \"%s\" PAD%dF %g %g %s %g %s\n" :
"PIN \"%s\" PAD%d %g %g %s %g %s\n", "PIN \"%s\" PAD%d %g %g %s %g %s\n",
TO_UTF8( escapeString( pinname ) ), pad->GetSubRatsnest(), TO_UTF8( escapeString( pinname ) ), pad->GetSubRatsnest(),
@ -807,13 +807,13 @@ static void CreateComponentsSection( FILE* aFile, BOARD* aPcb )
int cu_count = aPcb->GetCopperLayerCount(); int cu_count = aPcb->GetCopperLayerCount();
for( MODULE* module : aPcb->Modules() ) for( MODULE* footprint : aPcb->Footprints() )
{ {
const char* mirror; const char* mirror;
const char* flip; const char* flip;
double fp_orient = module->GetOrientation(); double fp_orient = footprint->GetOrientation();
if( module->GetFlag() ) if( footprint->GetFlag() )
{ {
mirror = "MIRRORX"; mirror = "MIRRORX";
flip = "FLIP"; flip = "FLIP";
@ -826,25 +826,25 @@ static void CreateComponentsSection( FILE* aFile, BOARD* aPcb )
} }
fprintf( aFile, "\nCOMPONENT \"%s\"\n", fprintf( aFile, "\nCOMPONENT \"%s\"\n",
TO_UTF8( escapeString( module->GetReference() ) ) ); TO_UTF8( escapeString( footprint->GetReference() ) ) );
fprintf( aFile, "DEVICE \"DEV_%s\"\n", fprintf( aFile, "DEVICE \"DEV_%s\"\n",
TO_UTF8( escapeString( getShapeName( module ) ) ) ); TO_UTF8( escapeString( getShapeName( footprint ) ) ) );
fprintf( aFile, "PLACE %g %g\n", fprintf( aFile, "PLACE %g %g\n",
MapXTo( module->GetPosition().x ), MapXTo( footprint->GetPosition().x ),
MapYTo( module->GetPosition().y ) ); MapYTo( footprint->GetPosition().y ) );
fprintf( aFile, "LAYER %s\n", fprintf( aFile, "LAYER %s\n",
module->GetFlag() ? "BOTTOM" : "TOP" ); footprint->GetFlag() ? "BOTTOM" : "TOP" );
fprintf( aFile, "ROTATION %g\n", fprintf( aFile, "ROTATION %g\n",
fp_orient / 10.0 ); fp_orient / 10.0 );
fprintf( aFile, "SHAPE \"%s\" %s %s\n", fprintf( aFile, "SHAPE \"%s\" %s %s\n",
TO_UTF8( escapeString( getShapeName( module ) ) ), TO_UTF8( escapeString( getShapeName( footprint ) ) ),
mirror, flip ); mirror, flip );
// Text on silk layer: RefDes and value (are they actually useful?) // Text on silk layer: RefDes and value (are they actually useful?)
for( FP_TEXT* textItem : { &module->Reference(), &module->Value() } ) for( FP_TEXT* textItem : { &footprint->Reference(), &footprint->Value() } )
{ {
double txt_orient = textItem->GetTextAngle(); double txt_orient = textItem->GetTextAngle();
std::string layer = GenCADLayerName( cu_count, module->GetFlag() ? B_SilkS : F_SilkS ); std::string layer = GenCADLayerName( cu_count, footprint->GetFlag() ? B_SilkS : F_SilkS );
fprintf( aFile, "TEXT %g %g %g %g %s %s \"%s\"", fprintf( aFile, "TEXT %g %g %g %g %s %s \"%s\"",
textItem->GetPos0().x / SCALE_FACTOR, textItem->GetPos0().x / SCALE_FACTOR,
@ -863,8 +863,8 @@ static void CreateComponentsSection( FILE* aFile, BOARD* aPcb )
// The SHEET is a 'generic description' for referencing the component // The SHEET is a 'generic description' for referencing the component
fprintf( aFile, "SHEET \"RefDes: %s, Value: %s\"\n", fprintf( aFile, "SHEET \"RefDes: %s, Value: %s\"\n",
TO_UTF8( module->GetReference() ), TO_UTF8( footprint->GetReference() ),
TO_UTF8( module->GetValue() ) ); TO_UTF8( footprint->GetValue() ) );
} }
fputs( "$ENDCOMPONENTS\n\n", aFile ); fputs( "$ENDCOMPONENTS\n\n", aFile );
@ -898,15 +898,15 @@ static void CreateSignalsSection( FILE* aFile, BOARD* aPcb )
fputs( TO_UTF8( msg ), aFile ); fputs( TO_UTF8( msg ), aFile );
fputs( "\n", aFile ); fputs( "\n", aFile );
for( MODULE* module : aPcb->Modules() ) for( MODULE* footprint : aPcb->Footprints() )
{ {
for( PAD* pad : module->Pads() ) for( PAD* pad : footprint->Pads() )
{ {
if( pad->GetNetCode() != net->GetNet() ) if( pad->GetNetCode() != net->GetNet() )
continue; continue;
msg.Printf( wxT( "NODE \"%s\" \"%s\"" ), msg.Printf( wxT( "NODE \"%s\" \"%s\"" ),
escapeString( module->GetReference() ), escapeString( footprint->GetReference() ),
escapeString( pad->GetName() ) ); escapeString( pad->GetName() ) );
fputs( TO_UTF8( msg ), aFile ); fputs( TO_UTF8( msg ), aFile );
@ -922,8 +922,8 @@ static void CreateSignalsSection( FILE* aFile, BOARD* aPcb )
// Creates the header section // Creates the header section
static bool CreateHeaderInfoData( FILE* aFile, PCB_EDIT_FRAME* aFrame ) static bool CreateHeaderInfoData( FILE* aFile, PCB_EDIT_FRAME* aFrame )
{ {
wxString msg; wxString msg;
BOARD *board = aFrame->GetBoard(); BOARD* board = aFrame->GetBoard();
fputs( "$HEADER\n", aFile ); fputs( "$HEADER\n", aFile );
fputs( "GENCAD 1.4\n", aFile ); fputs( "GENCAD 1.4\n", aFile );

View File

@ -383,10 +383,10 @@ bool HYPERLYNX_EXPORTER::writeDevices()
{ {
m_out->Print( 0, "{DEVICES\n" ); m_out->Print( 0, "{DEVICES\n" );
for( MODULE* mod : m_board->Modules() ) for( MODULE* footprint : m_board->Footprints() )
{ {
wxString ref = mod->GetReference(); wxString ref = footprint->GetReference();
wxString layerName = m_board->GetLayerName( mod->GetLayer() ); wxString layerName = m_board->GetLayerName( footprint->GetLayer() );
if( ref.IsEmpty() ) if( ref.IsEmpty() )
ref = "EMPTY"; ref = "EMPTY";
@ -402,9 +402,9 @@ bool HYPERLYNX_EXPORTER::writeDevices()
bool HYPERLYNX_EXPORTER::writePadStacks() bool HYPERLYNX_EXPORTER::writePadStacks()
{ {
for( MODULE* mod : m_board->Modules() ) for( MODULE* footprint : m_board->Footprints() )
{ {
for( PAD* pad : mod->Pads() ) for( PAD* pad : footprint->Pads() )
{ {
HYPERLYNX_PAD_STACK* ps = addPadStack( HYPERLYNX_PAD_STACK( m_board, pad ) ); HYPERLYNX_PAD_STACK* ps = addPadStack( HYPERLYNX_PAD_STACK( m_board, pad ) );
m_padMap[pad] = ps; m_padMap[pad] = ps;
@ -546,7 +546,7 @@ const std::vector<BOARD_ITEM*> HYPERLYNX_EXPORTER::collectNetObjects( int netcod
return false; return false;
}; };
for( MODULE* mod : m_board->Modules() ) for( MODULE* mod : m_board->Footprints() )
{ {
for( PAD* pad : mod->Pads() ) for( PAD* pad : mod->Pads() )
{ {

View File

@ -617,8 +617,8 @@ bool PCB_EDIT_FRAME::Export_IDF3( BOARD* aPcb, const wxString& aFullFileName,
idf_export_outline( aPcb, idfBoard ); idf_export_outline( aPcb, idfBoard );
// Output the drill holes and module (library) data. // Output the drill holes and module (library) data.
for( auto module : aPcb->Modules() ) for( MODULE* footprint : aPcb->Footprints() )
idf_export_module( aPcb, module, idfBoard ); idf_export_module( aPcb, footprint, idfBoard );
if( !idfBoard.WriteFile( aFullFileName, idfUnit, false ) ) if( !idfBoard.WriteFile( aFullFileName, idfUnit, false ) )
{ {

View File

@ -1655,8 +1655,8 @@ bool PCB_EDIT_FRAME::ExportVRML_File( const wxString& aFullFileName, double aMMt
output_file << " children [\n"; output_file << " children [\n";
// Export footprints // Export footprints
for( MODULE* module : pcb->Modules() ) for( MODULE* footprint : pcb->Footprints() )
export_vrml_module( model3d, pcb, module, &output_file ); export_vrml_module( model3d, pcb, footprint, &output_file );
// write out the board and all layers // write out the board and all layers
write_layers( model3d, pcb, TO_UTF8( aFullFileName ), &output_file ); write_layers( model3d, pcb, TO_UTF8( aFullFileName ), &output_file );
@ -1669,8 +1669,8 @@ bool PCB_EDIT_FRAME::ExportVRML_File( const wxString& aFullFileName, double aMMt
else else
{ {
// Export footprints // Export footprints
for( MODULE* module : pcb->Modules() ) for( MODULE* footprint : pcb->Footprints() )
export_vrml_module( model3d, pcb, module, NULL ); export_vrml_module( model3d, pcb, footprint, NULL );
// write out the board and all layers // write out the board and all layers
write_layers( model3d, pcb, TO_UTF8( aFullFileName ), NULL ); write_layers( model3d, pcb, TO_UTF8( aFullFileName ), NULL );

View File

@ -119,9 +119,9 @@ void GENDRILL_WRITER_BASE::buildHolesList( DRILL_LAYER_PAIR aLayerPair,
if( aLayerPair == DRILL_LAYER_PAIR( F_Cu, B_Cu ) ) if( aLayerPair == DRILL_LAYER_PAIR( F_Cu, B_Cu ) )
{ {
// add holes for thru hole pads // add holes for thru hole pads
for( auto module : m_pcb->Modules() ) for( MODULE* footprint : m_pcb->Footprints() )
{ {
for( auto& pad : module->Pads() ) for( PAD* pad : footprint->Pads() )
{ {
if( !m_merge_PTH_NPTH ) if( !m_merge_PTH_NPTH )
{ {

View File

@ -464,9 +464,9 @@ void GERBER_JOBFILE_WRITER::addJSONDesignRules()
int minPadClearanceOuter = defaultNC.GetClearance(); int minPadClearanceOuter = defaultNC.GetClearance();
int minPadClearanceInner = defaultNC.GetClearance(); int minPadClearanceInner = defaultNC.GetClearance();
for( MODULE* module : m_pcb->Modules() ) for( MODULE* footprint : m_pcb->Footprints() )
{ {
for( PAD* pad : module->Pads() ) for( PAD* pad : footprint->Pads() )
{ {
for( PCB_LAYER_ID layer : pad->GetLayerSet().Seq() ) for( PCB_LAYER_ID layer : pad->GetLayerSet().Seq() )
{ {

View File

@ -67,7 +67,7 @@ int PLACEFILE_GERBER_WRITER::CreatePlaceFile( wxString& aFullFilename, PCB_LAYER
// Collect footprints on the right layer // Collect footprints on the right layer
std::vector<MODULE*> fp_list; std::vector<MODULE*> fp_list;
for( MODULE* footprint : m_pcb->Modules() ) for( MODULE* footprint : m_pcb->Footprints() )
{ {
if( footprint->GetAttributes() & MOD_EXCLUDE_FROM_POS_FILES ) if( footprint->GetAttributes() & MOD_EXCLUDE_FROM_POS_FILES )
continue; continue;

View File

@ -1104,15 +1104,15 @@ bool PCB_EDIT_FRAME::importFile( const wxString& aFileName, int aFileType )
// Update module LIB_IDs to point to the just imported Eagle library // Update module LIB_IDs to point to the just imported Eagle library
for( MODULE* module : GetBoard()->Modules() ) for( MODULE* footprint : GetBoard()->Footprints() )
{ {
LIB_ID libId = module->GetFPID(); LIB_ID libId = footprint->GetFPID();
if( libId.GetLibItemName().empty() ) if( libId.GetLibItemName().empty() )
continue; continue;
libId.SetLibNickname( newfilename.GetName() ); libId.SetLibNickname( newfilename.GetName() );
module->SetFPID( libId ); footprint->SetFPID( libId );
} }

View File

@ -663,7 +663,7 @@ void FOOTPRINT_EDIT_FRAME::OnUpdateSaveFootprintToBoard( wxUpdateUIEvent& aEvent
canInsert = true; canInsert = true;
// search if the source footprint was not deleted: // search if the source footprint was not deleted:
for( MODULE* candidate : mainpcb->Modules() ) for( MODULE* candidate : mainpcb->Footprints() )
{ {
if( editorFootprint->GetLink() == candidate->m_Uuid ) if( editorFootprint->GetLink() == candidate->m_Uuid )
{ {

View File

@ -638,7 +638,7 @@ void PCB_EDIT_FRAME::ExportFootprintsToLibrary( bool aStoreInNewLib, const wxStr
prj.SetRString( PROJECT::PCB_LIB_NICKNAME, nickname ); prj.SetRString( PROJECT::PCB_LIB_NICKNAME, nickname );
for( MODULE* footprint : GetBoard()->Modules() ) for( MODULE* footprint : GetBoard()->Footprints() )
{ {
try try
{ {
@ -675,7 +675,7 @@ void PCB_EDIT_FRAME::ExportFootprintsToLibrary( bool aStoreInNewLib, const wxStr
IO_MGR::PCB_FILE_T piType = IO_MGR::KICAD_SEXP; IO_MGR::PCB_FILE_T piType = IO_MGR::KICAD_SEXP;
PLUGIN::RELEASER pi( IO_MGR::PluginFind( piType ) ); PLUGIN::RELEASER pi( IO_MGR::PluginFind( piType ) );
for( MODULE* footprint : GetBoard()->Modules() ) for( MODULE* footprint : GetBoard()->Footprints() )
{ {
try try
{ {
@ -804,7 +804,7 @@ bool FOOTPRINT_EDIT_FRAME::SaveFootprintToBoard( bool aAddNew )
{ {
sourceFootprint = nullptr; sourceFootprint = nullptr;
for( MODULE* candidate : mainpcb->Modules() ) for( MODULE* candidate : mainpcb->Footprints() )
{ {
if( editorFootprint->GetLink() == candidate->m_Uuid ) if( editorFootprint->GetLink() == candidate->m_Uuid )
{ {

View File

@ -100,9 +100,12 @@ bool FOOTPRINT_EDIT_FRAME::Clear_Pcb( bool aQuery )
{ {
wxSafeYield( this, true ); // Allow frame to come to front before showing warning. wxSafeYield( this, true ); // Allow frame to come to front before showing warning.
if( !HandleUnsavedChanges( this, _( "The current footprint has been modified. " if( !HandleUnsavedChanges(
"Save changes?" ), this, _( "The current footprint has been modified. Save changes?" ),
[&]() -> bool { return SaveFootprint( GetBoard()->Modules().front() ); } ) ) [&]() -> bool
{
return SaveFootprint( GetBoard()->Footprints().front() );
} ) )
{ {
return false; return false;
} }

View File

@ -136,7 +136,7 @@ void CLIPBOARD_IO::SaveSelection( const PCBNEW_SELECTION& aSelected, bool isModE
} }
// Set the new relative internal local coordinates of copied items // Set the new relative internal local coordinates of copied items
MODULE* editedFootprint = m_board->Modules().front(); MODULE* editedFootprint = m_board->Footprints().front();
wxPoint moveVector = partialFootprint.GetPosition() + editedFootprint->GetPosition(); wxPoint moveVector = partialFootprint.GetPosition() + editedFootprint->GetPosition();
partialFootprint.MoveAnchorPosition( moveVector ); partialFootprint.MoveAnchorPosition( moveVector );

View File

@ -331,7 +331,7 @@ MODULE* FOOTPRINT_EDIT_FRAME::SelectFootprintFromBoard( BOARD* aPcb )
wxString msg; wxString msg;
wxArrayString listnames; wxArrayString listnames;
for( MODULE* footprint : aPcb->Modules() ) for( MODULE* footprint : aPcb->Footprints() )
listnames.Add( footprint->GetReference() ); listnames.Add( footprint->GetReference() );
msg.Printf( _( "Footprints [%u items]" ), (unsigned) listnames.GetCount() ); msg.Printf( _( "Footprints [%u items]" ), (unsigned) listnames.GetCount() );
@ -360,7 +360,7 @@ MODULE* FOOTPRINT_EDIT_FRAME::SelectFootprintFromBoard( BOARD* aPcb )
oldName = fpname; oldName = fpname;
for( auto mod : aPcb->Modules() ) for( auto mod : aPcb->Footprints() )
{ {
if( fpname == mod->GetReference() ) if( fpname == mod->GetReference() )
return mod; return mod;
@ -431,7 +431,7 @@ MODULE* PCB_BASE_FRAME::GetFootprintFromBoardByReference()
wxArrayString fplist; wxArrayString fplist;
// Build list of available fp references, to display them in dialog // Build list of available fp references, to display them in dialog
for( auto fp : GetBoard()->Modules() ) for( auto fp : GetBoard()->Footprints() )
fplist.Add( fp->GetReference() + wxT(" ( ") + fp->GetValue() + wxT(" )") ); fplist.Add( fp->GetReference() + wxT(" ( ") + fp->GetValue() + wxT(" )") );
fplist.Sort(); fplist.Sort();
@ -447,7 +447,7 @@ MODULE* PCB_BASE_FRAME::GetFootprintFromBoardByReference()
if( !footprintName.IsEmpty() ) if( !footprintName.IsEmpty() )
{ {
for( auto mod : GetBoard()->Modules() ) for( auto mod : GetBoard()->Footprints() )
{ {
if( mod->GetReference().CmpNoCase( footprintName ) == 0 ) if( mod->GetReference().CmpNoCase( footprintName ) == 0 )
return mod; return mod;

View File

@ -88,7 +88,7 @@ void NETINFO_ITEM::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANE
int count = 0; int count = 0;
for( MODULE* mod : board->Modules() ) for( MODULE* mod : board->Footprints() )
{ {
for( PAD* pad : mod->Pads() ) for( PAD* pad : mod->Pads() )
{ {

View File

@ -218,7 +218,7 @@ void NETINFO_MAPPING::Update()
nets.insert( track->GetNetCode() ); nets.insert( track->GetNetCode() );
// footprints/pads // footprints/pads
for( MODULE* module : m_board->Modules() ) for( MODULE* module : m_board->Footprints() )
{ {
for( PAD* pad : module->Pads() ) for( PAD* pad : module->Pads() )
nets.insert( pad->GetNetCode() ); nets.insert( pad->GetNetCode() );

View File

@ -624,7 +624,7 @@ bool BOARD_NETLIST_UPDATER::deleteUnusedComponents( NETLIST& aNetlist )
wxString msg; wxString msg;
const COMPONENT* component; const COMPONENT* component;
for( MODULE* footprint : m_board->Modules() ) for( MODULE* footprint : m_board->Footprints() )
{ {
if(( footprint->GetAttributes() & MOD_BOARD_ONLY ) > 0 ) if(( footprint->GetAttributes() & MOD_BOARD_ONLY ) > 0 )
continue; continue;
@ -785,7 +785,7 @@ bool BOARD_NETLIST_UPDATER::UpdateNetlist( NETLIST& aNetlist )
m_errorCount = 0; m_errorCount = 0;
m_warningCount = 0; m_warningCount = 0;
m_newFootprintsCount = 0; m_newFootprintsCount = 0;
MODULE* lastPreexistingFootprint = m_board->Modules().empty() ? NULL : m_board->Modules().back(); MODULE* lastPreexistingFootprint = m_board->Footprints().empty() ? NULL : m_board->Footprints().back();
cacheCopperZoneConnections(); cacheCopperZoneConnections();
@ -813,7 +813,7 @@ bool BOARD_NETLIST_UPDATER::UpdateNetlist( NETLIST& aNetlist )
component->GetFPID().Format().wx_str() ); component->GetFPID().Format().wx_str() );
m_reporter->Report( msg, RPT_SEVERITY_INFO ); m_reporter->Report( msg, RPT_SEVERITY_INFO );
for( auto footprint : m_board->Modules() ) for( MODULE* footprint : m_board->Footprints() )
{ {
bool match = false; bool match = false;

View File

@ -197,7 +197,7 @@ void PCB_DRAW_PANEL_GAL::DisplayBoard( BOARD* aBoard )
m_view->Add( track ); m_view->Add( track );
// Load footprints and its additional elements // Load footprints and its additional elements
for( auto module : aBoard->Modules() ) for( auto module : aBoard->Footprints() )
m_view->Add( module ); m_view->Add( module );
// DRC markers // DRC markers

View File

@ -164,7 +164,7 @@ static void insideCourtyard( LIBEVAL::CONTEXT* aCtx, void* self )
} }
else else
{ {
for( MODULE* candidate : item->GetBoard()->Modules() ) for( MODULE* candidate : item->GetBoard()->Footprints() )
{ {
if( candidate->GetReference().Matches( arg->AsString() ) ) if( candidate->GetReference().Matches( arg->AsString() ) )
{ {
@ -322,7 +322,7 @@ static void insideArea( LIBEVAL::CONTEXT* aCtx, void* self )
} }
} }
for( MODULE* module : item->GetBoard()->Modules() ) for( MODULE* module : item->GetBoard()->Footprints() )
{ {
for( ZONE* candidate : module->Zones() ) for( ZONE* candidate : module->Zones() )
{ {
@ -353,7 +353,7 @@ static void insideArea( LIBEVAL::CONTEXT* aCtx, void* self )
} }
} }
for( MODULE* module : item->GetBoard()->Modules() ) for( MODULE* module : item->GetBoard()->Footprints() )
{ {
for( ZONE* candidate : module->Zones() ) for( ZONE* candidate : module->Zones() )
{ {

View File

@ -219,15 +219,15 @@ void PlotStandardLayer( BOARD *aBoard, PLOTTER* aPlotter, LSET aLayerMask,
itemplotter.PlotBoardGraphicItems(); itemplotter.PlotBoardGraphicItems();
// Draw footprint texts: // Draw footprint texts:
for( MODULE* module : aBoard->Modules() ) for( MODULE* module : aBoard->Footprints() )
itemplotter.PlotFootprintTextItems( module ); itemplotter.PlotFootprintTextItems( module );
// Draw footprint other graphic items: // Draw footprint other graphic items:
for( MODULE* module : aBoard->Modules() ) for( MODULE* module : aBoard->Footprints() )
itemplotter.PlotFootprintGraphicItems( module ); itemplotter.PlotFootprintGraphicItems( module );
// Plot footprint pads // Plot footprint pads
for( MODULE* module : aBoard->Modules() ) for( MODULE* module : aBoard->Footprints() )
{ {
aPlotter->StartBlock( NULL ); aPlotter->StartBlock( NULL );
@ -632,7 +632,7 @@ void PlotLayerOutlines( BOARD* aBoard, PLOTTER* aPlotter, LSET aLayerMask,
int smallDrill = (aPlotOpt.GetDrillMarksType() == PCB_PLOT_PARAMS::SMALL_DRILL_SHAPE) int smallDrill = (aPlotOpt.GetDrillMarksType() == PCB_PLOT_PARAMS::SMALL_DRILL_SHAPE)
? SMALL_DRILL : INT_MAX; ? SMALL_DRILL : INT_MAX;
for( MODULE* module : aBoard->Modules() ) for( MODULE* module : aBoard->Footprints() )
{ {
for( PAD* pad : module->Pads() ) for( PAD* pad : module->Pads() )
{ {
@ -727,7 +727,7 @@ void PlotSolderMaskLayer( BOARD *aBoard, PLOTTER* aPlotter, LSET aLayerMask,
itemplotter.PlotBoardGraphicItems(); itemplotter.PlotBoardGraphicItems();
for( MODULE* module : aBoard->Modules() ) for( MODULE* module : aBoard->Footprints() )
{ {
for( BOARD_ITEM* item : module->GraphicalItems() ) for( BOARD_ITEM* item : module->GraphicalItems() )
{ {
@ -757,7 +757,7 @@ void PlotSolderMaskLayer( BOARD *aBoard, PLOTTER* aPlotter, LSET aLayerMask,
#endif #endif
{ {
// Plot pads // Plot pads
for( MODULE* module : aBoard->Modules() ) for( MODULE* module : aBoard->Footprints() )
{ {
// add shapes with their exact mask layer size in initialPolys // add shapes with their exact mask layer size in initialPolys
module->TransformPadsShapesWithClearanceToPolygon( initialPolys, layer, 0, maxError, module->TransformPadsShapesWithClearanceToPolygon( initialPolys, layer, 0, maxError,

View File

@ -1022,7 +1022,7 @@ void BRDITEMS_PLOTTER::PlotDrillMarks()
} }
} }
for( auto Module : m_board->Modules() ) for( auto Module : m_board->Footprints() )
{ {
for( auto pad : Module->Pads() ) for( auto pad : Module->Pads() )
{ {

View File

@ -445,9 +445,9 @@ void ALTIUM_PCB::Parse( const CFB::CompoundFileReader& aReader,
} }
// Finish Board by recalculating module boundingboxes // Finish Board by recalculating module boundingboxes
for( auto& module : m_board->Modules() ) for( MODULE* footprint : m_board->Footprints() )
{ {
module->CalculateBoundingBox(); footprint->CalculateBoundingBox();
} }
// Otherwise we cannot save the imported board // Otherwise we cannot save the imported board

View File

@ -619,8 +619,8 @@ void PCB_IO::formatHeader( BOARD* aBoard, int aNestLevel ) const
void PCB_IO::format( BOARD* aBoard, int aNestLevel ) const void PCB_IO::format( BOARD* aBoard, int aNestLevel ) const
{ {
std::set<BOARD_ITEM*, BOARD_ITEM::ptr_cmp> sorted_modules( aBoard->Modules().begin(), std::set<BOARD_ITEM*, BOARD_ITEM::ptr_cmp> sorted_modules( aBoard->Footprints().begin(),
aBoard->Modules().end() ); aBoard->Footprints().end() );
std::set<BOARD_ITEM*, BOARD_ITEM::ptr_cmp> sorted_drawings( aBoard->Drawings().begin(), std::set<BOARD_ITEM*, BOARD_ITEM::ptr_cmp> sorted_drawings( aBoard->Drawings().begin(),
aBoard->Drawings().end() ); aBoard->Drawings().end() );
std::set<TRACK*, TRACK::cmp_tracks> sorted_tracks( aBoard->Tracks().begin(), std::set<TRACK*, TRACK::cmp_tracks> sorted_tracks( aBoard->Tracks().begin(),

View File

@ -1186,7 +1186,7 @@ void PNS_KICAD_IFACE_BASE::SyncWorld( PNS::NODE *aWorld )
syncZone( aWorld, zone, boardOutline ); syncZone( aWorld, zone, boardOutline );
} }
for( MODULE* module : m_board->Modules() ) for( MODULE* module : m_board->Footprints() )
{ {
for( PAD* pad : module->Pads() ) for( PAD* pad : module->Pads() )
{ {

View File

@ -1736,7 +1736,7 @@ void SPECCTRA_DB::FlipMODULEs( BOARD* aBoard )
// top view. // top view.
// Note: to export footprints, the footprints must be flipped around the X axis, // Note: to export footprints, the footprints must be flipped around the X axis,
// otherwise the rotation angle is not good // otherwise the rotation angle is not good
for( auto module : aBoard->Modules() ) for( auto module : aBoard->Footprints() )
{ {
module->SetFlag( 0 ); module->SetFlag( 0 );
if( module->GetLayer() == B_Cu ) if( module->GetLayer() == B_Cu )
@ -1758,7 +1758,7 @@ void SPECCTRA_DB::RevertMODULEs( BOARD* aBoard )
// DSN Images (=KiCad MODULES and pads) must be presented from the // DSN Images (=KiCad MODULES and pads) must be presented from the
// top view. Restore those that were flipped. // top view. Restore those that were flipped.
// Note: to export footprints, the footprints were flipped around the X axis, // Note: to export footprints, the footprints were flipped around the X axis,
for( auto module : aBoard->Modules() ) for( auto module : aBoard->Footprints() )
{ {
if( module->GetFlag() ) if( module->GetFlag() )
{ {

View File

@ -2173,9 +2173,9 @@ int DRAWING_TOOL::DrawVia( const TOOL_EVENT& aEvent )
const wxPoint position = aVia->GetPosition(); const wxPoint position = aVia->GetPosition();
const LSET lset = aVia->GetLayerSet(); const LSET lset = aVia->GetLayerSet();
for( auto mod : m_board->Modules() ) for( MODULE* footprint : m_board->Footprints() )
{ {
for( PAD* pad : mod->Pads() ) for( PAD* pad : footprint->Pads() )
{ {
if( pad->HitTest( position ) && ( pad->GetLayerSet() & lset ).any() ) if( pad->HitTest( position ) && ( pad->GetLayerSet() & lset ).any() )
return -1; return -1;

View File

@ -167,7 +167,7 @@ static void doPushPadProperties( BOARD& board, const PAD& aSrcPad, BOARD_COMMIT&
double pad_orient = aSrcPad.GetOrientation() - moduleRef->GetOrientation(); double pad_orient = aSrcPad.GetOrientation() - moduleRef->GetOrientation();
for( auto module : board.Modules() ) for( auto module : board.Footprints() )
{ {
if( !aSameFootprints && ( module != moduleRef ) ) if( !aSameFootprints && ( module != moduleRef ) )
continue; continue;

View File

@ -411,13 +411,13 @@ int PCB_EDITOR_CONTROL::RepairBoard( const TOOL_EVENT& aEvent )
// Footprint IDs are the most important, so give them the first crack at "claiming" a // Footprint IDs are the most important, so give them the first crack at "claiming" a
// particular KIID. // particular KIID.
for( MODULE* footprint : board()->Modules() ) for( MODULE* footprint : board()->Footprints() )
processItem( footprint ); processItem( footprint );
// After that the principal use is for DRC marker pointers, which are most likely to pads // After that the principal use is for DRC marker pointers, which are most likely to pads
// or tracks. // or tracks.
for( MODULE* footprint : board()->Modules() ) for( MODULE* footprint : board()->Footprints() )
{ {
for( PAD* pad : footprint->Pads() ) for( PAD* pad : footprint->Pads() )
processItem( pad ); processItem( pad );
@ -428,7 +428,7 @@ int PCB_EDITOR_CONTROL::RepairBoard( const TOOL_EVENT& aEvent )
// From here out I don't think order matters much. // From here out I don't think order matters much.
for( MODULE* footprint : board()->Modules() ) for( MODULE* footprint : board()->Footprints() )
{ {
processItem( &footprint->Reference() ); processItem( &footprint->Reference() );
processItem( &footprint->Value() ); processItem( &footprint->Value() );

View File

@ -403,7 +403,7 @@ int PCB_INSPECTION_TOOL::InspectConstraints( const TOOL_EVENT& aEvent )
for( ZONE* zone : m_frame->GetBoard()->Zones() ) for( ZONE* zone : m_frame->GetBoard()->Zones() )
zone->CacheBoundingBox(); zone->CacheBoundingBox();
for( MODULE* module : m_frame->GetBoard()->Modules() ) for( MODULE* module : m_frame->GetBoard()->Footprints() )
{ {
for( ZONE* zone : module->Zones() ) for( ZONE* zone : module->Zones() )
zone->CacheBoundingBox(); zone->CacheBoundingBox();
@ -863,7 +863,7 @@ int PCB_INSPECTION_TOOL::LocalRatsnestTool( const TOOL_EVENT& aEvent )
if( selection.Empty() ) if( selection.Empty() )
{ {
// Clear the previous local ratsnest if we click off all items // Clear the previous local ratsnest if we click off all items
for( MODULE* fp : board->Modules() ) for( MODULE* fp : board->Footprints() )
{ {
for( PAD* pad : fp->Pads() ) for( PAD* pad : fp->Pads() )
pad->SetLocalRatsnestVisible( opt.m_ShowGlobalRatsnest ); pad->SetLocalRatsnestVisible( opt.m_ShowGlobalRatsnest );
@ -900,7 +900,7 @@ int PCB_INSPECTION_TOOL::LocalRatsnestTool( const TOOL_EVENT& aEvent )
{ {
if( aCondition != PCBNEW_PICKER_TOOL::END_ACTIVATE ) if( aCondition != PCBNEW_PICKER_TOOL::END_ACTIVATE )
{ {
for( MODULE* fp : board->Modules() ) for( MODULE* fp : board->Footprints() )
{ {
for( PAD* pad : fp->Pads() ) for( PAD* pad : fp->Pads() )
pad->SetLocalRatsnestVisible( opt.m_ShowGlobalRatsnest ); pad->SetLocalRatsnestVisible( opt.m_ShowGlobalRatsnest );

View File

@ -98,7 +98,7 @@ int PCB_VIEWER_TOOLS::ShowPadNumbers( const TOOL_EVENT& aEvent )
Flip( opts.m_DisplayPadNum ); Flip( opts.m_DisplayPadNum );
frame()->SetDisplayOptions( opts ); frame()->SetDisplayOptions( opts );
for( MODULE* fp : board()->Modules() ) for( MODULE* fp : board()->Footprints() )
{ {
for( PAD* pad : fp->Pads() ) for( PAD* pad : fp->Pads() )
view()->Update( pad, KIGFX::GEOMETRY ); view()->Update( pad, KIGFX::GEOMETRY );
@ -117,7 +117,7 @@ int PCB_VIEWER_TOOLS::PadDisplayMode( const TOOL_EVENT& aEvent )
Flip( opts.m_DisplayPadFill ); Flip( opts.m_DisplayPadFill );
frame()->SetDisplayOptions( opts ); frame()->SetDisplayOptions( opts );
for( MODULE* fp : board()->Modules() ) for( MODULE* fp : board()->Footprints() )
{ {
for( PAD* pad : fp->Pads() ) for( PAD* pad : fp->Pads() )
view()->Update( pad, KIGFX::GEOMETRY ); view()->Update( pad, KIGFX::GEOMETRY );
@ -136,7 +136,7 @@ int PCB_VIEWER_TOOLS::GraphicOutlines( const TOOL_EVENT& aEvent )
Flip( opts.m_DisplayGraphicsFill ); Flip( opts.m_DisplayGraphicsFill );
frame()->SetDisplayOptions( opts ); frame()->SetDisplayOptions( opts );
for( MODULE* fp : board()->Modules() ) for( MODULE* fp : board()->Footprints() )
{ {
for( BOARD_ITEM* item : fp->GraphicalItems() ) for( BOARD_ITEM* item : fp->GraphicalItems() )
{ {
@ -166,7 +166,7 @@ int PCB_VIEWER_TOOLS::TextOutlines( const TOOL_EVENT& aEvent )
Flip( opts.m_DisplayTextFill ); Flip( opts.m_DisplayTextFill );
frame()->SetDisplayOptions( opts ); frame()->SetDisplayOptions( opts );
for( MODULE* fp : board()->Modules() ) for( MODULE* fp : board()->Footprints() )
{ {
view()->Update( &fp->Reference(), KIGFX::GEOMETRY ); view()->Update( &fp->Reference(), KIGFX::GEOMETRY );
view()->Update( &fp->Value(), KIGFX::GEOMETRY ); view()->Update( &fp->Value(), KIGFX::GEOMETRY );

View File

@ -669,7 +669,7 @@ int PCBNEW_CONTROL::Paste( const TOOL_EVENT& aEvent )
MODULE* editorFootprint = board()->GetFirstFootprint(); MODULE* editorFootprint = board()->GetFirstFootprint();
std::vector<BOARD_ITEM*> pastedItems; std::vector<BOARD_ITEM*> pastedItems;
for( MODULE* clipFootprint : clipBoard->Modules() ) for( MODULE* clipFootprint : clipBoard->Footprints() )
pasteFootprintItemsToFootprintEditor( clipFootprint, board(), pastedItems ); pasteFootprintItemsToFootprintEditor( clipFootprint, board(), pastedItems );
for( BOARD_ITEM* clipDrawItem : clipBoard->Drawings() ) for( BOARD_ITEM* clipDrawItem : clipBoard->Drawings() )
@ -832,7 +832,7 @@ int PCBNEW_CONTROL::placeBoardItems( BOARD* aBoard, bool aAnchorAtOrigin )
std::vector<BOARD_ITEM*> items; std::vector<BOARD_ITEM*> items;
moveUnflaggedItems( aBoard->Tracks(), items, isNew ); moveUnflaggedItems( aBoard->Tracks(), items, isNew );
moveUnflaggedItems( aBoard->Modules(), items, isNew ); moveUnflaggedItems( aBoard->Footprints(), items, isNew );
moveUnflaggedItems( aBoard->Drawings(), items, isNew ); moveUnflaggedItems( aBoard->Drawings(), items, isNew );
moveUnflaggedItems( aBoard->Zones(), items, isNew ); moveUnflaggedItems( aBoard->Zones(), items, isNew );
@ -955,7 +955,7 @@ int PCBNEW_CONTROL::AppendBoard( PLUGIN& pi, wxString& fileName )
for( auto track : brd->Tracks() ) for( auto track : brd->Tracks() )
track->SetFlags( SKIP_STRUCT ); track->SetFlags( SKIP_STRUCT );
for( auto module : brd->Modules() ) for( auto module : brd->Footprints() )
module->SetFlags( SKIP_STRUCT ); module->SetFlags( SKIP_STRUCT );
for( auto group : brd->Groups() ) for( auto group : brd->Groups() )

View File

@ -1173,7 +1173,7 @@ void SELECTION_TOOL::selectAllItemsOnSheet( wxString& aSheetPath )
std::list<MODULE*> modList; std::list<MODULE*> modList;
// store all footprints that are on that sheet path // store all footprints that are on that sheet path
for( MODULE* module : board()->Modules() ) for( MODULE* module : board()->Footprints() )
{ {
if( module == nullptr ) if( module == nullptr )
continue; continue;

View File

@ -118,7 +118,7 @@ static bool TestForExistingItem( BOARD* aPcb, BOARD_ITEM* aItem )
return true; return true;
} }
for( MODULE* item : aPcb->Modules() ) for( MODULE* item : aPcb->Footprints() )
{ {
if( aItem == static_cast<BOARD_ITEM*>( item ) ) if( aItem == static_cast<BOARD_ITEM*>( item ) )
return true; return true;

View File

@ -119,7 +119,7 @@ bool ZONE_FILLER::Fill( std::vector<ZONE*>& aZones, bool aCheck, wxWindow* aPare
m_worstClearance = std::max( m_worstClearance, zone->GetLocalClearance() ); m_worstClearance = std::max( m_worstClearance, zone->GetLocalClearance() );
} }
for( MODULE* module : m_board->Modules() ) for( MODULE* module : m_board->Footprints() )
{ {
for( PAD* pad : module->Pads() ) for( PAD* pad : module->Pads() )
{ {
@ -615,7 +615,7 @@ void ZONE_FILLER::knockoutThermalReliefs( const ZONE* aZone, PCB_LAYER_ID aLayer
{ {
SHAPE_POLY_SET holes; SHAPE_POLY_SET holes;
for( MODULE* module : m_board->Modules() ) for( MODULE* module : m_board->Footprints() )
{ {
for( PAD* pad : module->Pads() ) for( PAD* pad : module->Pads() )
{ {
@ -729,7 +729,7 @@ void ZONE_FILLER::buildCopperItemClearances( const ZONE* aZone, PCB_LAYER_ID aLa
} }
}; };
for( MODULE* module : m_board->Modules() ) for( MODULE* module : m_board->Footprints() )
{ {
for( PAD* pad : module->Pads() ) for( PAD* pad : module->Pads() )
{ {
@ -818,7 +818,7 @@ void ZONE_FILLER::buildCopperItemClearances( const ZONE* aZone, PCB_LAYER_ID aLa
} }
}; };
for( MODULE* module : m_board->Modules() ) for( MODULE* module : m_board->Footprints() )
{ {
knockoutGraphicClearance( &module->Reference() ); knockoutGraphicClearance( &module->Reference() );
knockoutGraphicClearance( &module->Value() ); knockoutGraphicClearance( &module->Value() );
@ -895,7 +895,7 @@ void ZONE_FILLER::buildCopperItemClearances( const ZONE* aZone, PCB_LAYER_ID aLa
} }
} }
for( MODULE* module : m_board->Modules() ) for( MODULE* module : m_board->Footprints() )
{ {
for( ZONE* otherZone : module->Zones() ) for( ZONE* otherZone : module->Zones() )
{ {
@ -947,7 +947,7 @@ void ZONE_FILLER::subtractHigherPriorityZones( const ZONE* aZone, PCB_LAYER_ID a
} }
} }
for( MODULE* module : m_board->Modules() ) for( MODULE* module : m_board->Footprints() )
{ {
for( ZONE* otherZone : module->Zones() ) for( ZONE* otherZone : module->Zones() )
{ {
@ -1248,7 +1248,7 @@ void ZONE_FILLER::buildThermalSpokes( const ZONE* aZone, PCB_LAYER_ID aLayer,
// us avoid the question. // us avoid the question.
int epsilon = KiROUND( IU_PER_MM * 0.04 ); // about 1.5 mil int epsilon = KiROUND( IU_PER_MM * 0.04 ); // about 1.5 mil
for( auto module : m_board->Modules() ) for( auto module : m_board->Footprints() )
{ {
for( auto pad : module->Pads() ) for( auto pad : module->Pads() )
{ {
@ -1530,7 +1530,7 @@ bool ZONE_FILLER::addHatchFillTypeOnZone( const ZONE* aZone, PCB_LAYER_ID aLayer
} }
} }
for( MODULE* module : m_board->Modules() ) for( MODULE* module : m_board->Footprints() )
{ {
for( PAD* pad : module->Pads() ) for( PAD* pad : module->Pads() )
{ {

View File

@ -82,7 +82,7 @@ int polygon_gererator_main( int argc, char* argv[] )
for( auto track : brd->Tracks() ) for( auto track : brd->Tracks() )
process( track, net ); process( track, net );
for( auto mod : brd->Modules() ) for( auto mod : brd->Footprints() )
{ {
for( auto pad : mod->Pads() ) for( auto pad : mod->Pads() )
process( pad, net ); process( pad, net );