MODULE -> FOOTPRINT.

This commit is contained in:
Jeff Young 2020-11-13 15:15:52 +00:00
parent 3451ac3088
commit bdbb68f813
210 changed files with 1735 additions and 1685 deletions

View File

@ -41,7 +41,7 @@
#include <widgets/infobar.h> #include <widgets/infobar.h>
PANEL_PREV_3D::PANEL_PREV_3D( wxWindow* aParent, PCB_BASE_FRAME* aFrame, MODULE* aFootprint, PANEL_PREV_3D::PANEL_PREV_3D( wxWindow* aParent, PCB_BASE_FRAME* aFrame, FOOTPRINT* aFootprint,
std::vector<FP_3DMODEL>* aParentModelList ) : std::vector<FP_3DMODEL>* aParentModelList ) :
PANEL_PREV_3D_BASE( aParent, wxID_ANY ), PANEL_PREV_3D_BASE( aParent, wxID_ANY ),
m_previewPane( nullptr ), m_previewPane( nullptr ),
@ -86,7 +86,7 @@ PANEL_PREV_3D::PANEL_PREV_3D( wxWindow* aParent, PCB_BASE_FRAME* aFrame, MODULE*
m_parentModelList = aParentModelList; m_parentModelList = aParentModelList;
m_dummyFootprint = new MODULE( *aFootprint ); m_dummyFootprint = new FOOTPRINT( *aFootprint );
m_dummyBoard->Add( m_dummyFootprint ); m_dummyBoard->Add( m_dummyFootprint );
// Create the infobar // Create the infobar

View File

@ -69,12 +69,12 @@ class S3D_CACHE;
class FILENAME_RESOLVER; class FILENAME_RESOLVER;
class BOARD; class BOARD;
class BOARD_ADAPTER; class BOARD_ADAPTER;
class MODULE; class FOOTPRINT;
class PANEL_PREV_3D: public EDA_3D_BOARD_HOLDER, public TOOLS_HOLDER, public PANEL_PREV_3D_BASE class PANEL_PREV_3D: public EDA_3D_BOARD_HOLDER, public TOOLS_HOLDER, public PANEL_PREV_3D_BASE
{ {
public: public:
PANEL_PREV_3D( wxWindow* aParent, PCB_BASE_FRAME* aFrame, MODULE* aFootprint, PANEL_PREV_3D( wxWindow* aParent, PCB_BASE_FRAME* aFrame, FOOTPRINT* aFootprint,
std::vector<FP_3DMODEL>* aParentModelList ); std::vector<FP_3DMODEL>* aParentModelList );
~PANEL_PREV_3D(); ~PANEL_PREV_3D();
@ -87,7 +87,7 @@ private:
CTRACK_BALL m_trackBallCamera; CTRACK_BALL m_trackBallCamera;
BOARD* m_dummyBoard; BOARD* m_dummyBoard;
MODULE* m_dummyFootprint; FOOTPRINT* m_dummyFootprint;
std::vector<FP_3DMODEL>* m_parentModelList; std::vector<FP_3DMODEL>* m_parentModelList;
int m_selected; /// Index into m_parentInfoList int m_selected; /// Index into m_parentInfoList

View File

@ -543,13 +543,13 @@ class BOARD_ADAPTER
COBJECT2D *createNewPadDrill( const PAD* aPad, int aInflateValue ); COBJECT2D *createNewPadDrill( const PAD* aPad, int aInflateValue );
void AddPadsWithClearanceToContainer( const MODULE *aFootprint, void AddPadsWithClearanceToContainer( const FOOTPRINT *aFootprint,
CGENERICCONTAINER2D *aDstContainer, CGENERICCONTAINER2D *aDstContainer,
PCB_LAYER_ID aLayerId, int aInflateValue, PCB_LAYER_ID aLayerId, int aInflateValue,
bool aSkipNPTHPadsWihNoCopper, bool aSkipPlatedPads, bool aSkipNPTHPadsWihNoCopper, bool aSkipPlatedPads,
bool aSkipNonPlatedPads ); bool aSkipNonPlatedPads );
void AddFPShapesWithClearanceToContainer( const MODULE *aFootprint, void AddFPShapesWithClearanceToContainer( const FOOTPRINT *aFootprint,
CGENERICCONTAINER2D *aDstContainer, CGENERICCONTAINER2D *aDstContainer,
PCB_LAYER_ID aLayerId, int aInflateValue ); PCB_LAYER_ID aLayerId, int aInflateValue );
@ -580,7 +580,7 @@ class BOARD_ADAPTER
void buildPadShapeThickOutlineAsPolygon( const PAD *aPad, SHAPE_POLY_SET &aCornerBuffer, void buildPadShapeThickOutlineAsPolygon( const PAD *aPad, SHAPE_POLY_SET &aCornerBuffer,
int aWidth) const; int aWidth) const;
void transformFPShapesToPolygon( const MODULE *aFootprint, PCB_LAYER_ID aLayer, void transformFPShapesToPolygon( const FOOTPRINT *aFootprint, PCB_LAYER_ID aLayer,
SHAPE_POLY_SET& aCornerBuffer ) const; SHAPE_POLY_SET& aCornerBuffer ) const;
public: public:

View File

@ -185,7 +185,7 @@ void BOARD_ADAPTER::AddShapeWithClearanceToContainer( const DIMENSION_BASE* aDim
// Based on // Based on
// void FOOTPRINT::TransformFPShapesWithClearanceToPolygonSet // void FOOTPRINT::TransformFPShapesWithClearanceToPolygonSet
// board_items_to_polygon_shape_transform.cpp#L204 // board_items_to_polygon_shape_transform.cpp#L204
void BOARD_ADAPTER::AddFPShapesWithClearanceToContainer( const MODULE* aFootprint, void BOARD_ADAPTER::AddFPShapesWithClearanceToContainer( const FOOTPRINT* aFootprint,
CGENERICCONTAINER2D *aDstContainer, CGENERICCONTAINER2D *aDstContainer,
PCB_LAYER_ID aLayerId, PCB_LAYER_ID aLayerId,
int aInflateValue ) int aInflateValue )
@ -473,7 +473,7 @@ COBJECT2D *BOARD_ADAPTER::createNewPadDrill( const PAD* aPad, int aInflateValue
} }
void BOARD_ADAPTER::AddPadsWithClearanceToContainer( const MODULE* aFootprint, void BOARD_ADAPTER::AddPadsWithClearanceToContainer( const FOOTPRINT* aFootprint,
CGENERICCONTAINER2D *aDstContainer, CGENERICCONTAINER2D *aDstContainer,
PCB_LAYER_ID aLayerId, PCB_LAYER_ID aLayerId,
int aInflateValue, int aInflateValue,

View File

@ -463,7 +463,7 @@ void BOARD_ADAPTER::createLayers( REPORTER* aStatusReporter )
// Add holes of footprints // Add holes of footprints
// ///////////////////////////////////////////////////////////////////////// // /////////////////////////////////////////////////////////////////////////
for( MODULE* footprint : m_board->Footprints() ) for( FOOTPRINT* footprint : m_board->Footprints() )
{ {
for( PAD* pad : footprint->Pads() ) for( PAD* pad : footprint->Pads() )
{ {
@ -497,7 +497,7 @@ 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* footprint : m_board->Footprints() ) for( FOOTPRINT* footprint : m_board->Footprints() )
{ {
for( PAD* pad : footprint->Pads() ) for( PAD* pad : footprint->Pads() )
{ {
@ -549,7 +549,7 @@ 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* footprint : m_board->Footprints() ) for( FOOTPRINT* 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
@ -564,7 +564,7 @@ void BOARD_ADAPTER::createLayers( REPORTER* aStatusReporter )
if( renderPlatedPadsAsPlated ) if( renderPlatedPadsAsPlated )
{ {
// ADD PLATED PADS // ADD PLATED PADS
for( MODULE* footprint : m_board->Footprints() ) for( FOOTPRINT* footprint : m_board->Footprints() )
{ {
AddPadsWithClearanceToContainer( footprint, m_platedpads_container2D_F_Cu, F_Cu, AddPadsWithClearanceToContainer( footprint, m_platedpads_container2D_F_Cu, F_Cu,
0, true, false, true ); 0, true, false, true );
@ -588,7 +588,7 @@ 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( MODULE* footprint : m_board->Footprints() ) for( FOOTPRINT* 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
@ -604,7 +604,7 @@ void BOARD_ADAPTER::createLayers( REPORTER* aStatusReporter )
if( renderPlatedPadsAsPlated ) if( renderPlatedPadsAsPlated )
{ {
// ADD PLATED PADS contourns // ADD PLATED PADS contourns
for( MODULE* footprint : m_board->Footprints() ) for( FOOTPRINT* footprint : m_board->Footprints() )
{ {
footprint->TransformPadsWithClearanceToPolygon( *m_F_Cu_PlatedPads_poly, F_Cu, footprint->TransformPadsWithClearanceToPolygon( *m_F_Cu_PlatedPads_poly, F_Cu,
0, ARC_HIGH_DEF, ERROR_INSIDE, 0, ARC_HIGH_DEF, ERROR_INSIDE,
@ -977,7 +977,7 @@ void BOARD_ADAPTER::createLayers( REPORTER* aStatusReporter )
// Add footprints tech layers - objects // Add footprints tech layers - objects
// ///////////////////////////////////////////////////////////////////// // /////////////////////////////////////////////////////////////////////
for( MODULE* footprint : m_board->Footprints() ) for( FOOTPRINT* footprint : 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) )
{ {
@ -1002,7 +1002,7 @@ void BOARD_ADAPTER::createLayers( REPORTER* aStatusReporter )
// Add footprints tech layers - contours // Add footprints tech layers - contours
for( MODULE* footprint : m_board->Footprints() ) for( FOOTPRINT* footprint : 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

@ -60,7 +60,7 @@ void BOARD_ADAPTER::buildPadShapeThickOutlineAsPolygon( const PAD* aPad,
} }
void BOARD_ADAPTER::transformFPShapesToPolygon( const MODULE *aFootprint, PCB_LAYER_ID aLayer, void BOARD_ADAPTER::transformFPShapesToPolygon( const FOOTPRINT *aFootprint, PCB_LAYER_ID aLayer,
SHAPE_POLY_SET& aCornerBuffer ) const SHAPE_POLY_SET& aCornerBuffer ) const
{ {
for( BOARD_ITEM* item : aFootprint->GraphicalItems() ) for( BOARD_ITEM* item : aFootprint->GraphicalItems() )

View File

@ -763,7 +763,7 @@ void EDA_3D_CANVAS::OnMouseMove( wxMouseEvent &event )
case PCB_FOOTPRINT_T: case PCB_FOOTPRINT_T:
{ {
MODULE* footprint = dynamic_cast<MODULE *>( intersectedBoardItem ); FOOTPRINT* footprint = dynamic_cast<FOOTPRINT *>( intersectedBoardItem );
if( footprint ) if( footprint )
activityReporter.Report( footprint->GetReference() ); activityReporter.Report( footprint->GetReference() );

View File

@ -862,7 +862,7 @@ 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 MODULE* footprint : m_boardAdapter.GetBoard()->Footprints() ) for( const FOOTPRINT* footprint : m_boardAdapter.GetBoard()->Footprints() )
{ {
for( PAD* pad : footprint->Pads() ) for( PAD* pad : footprint->Pads() )
{ {
@ -965,7 +965,7 @@ void C3D_RENDER_OGL_LEGACY::load_3D_models( REPORTER* aStatusReporter )
} }
// Go for all footprints // Go for all footprints
for( MODULE* footprint : m_boardAdapter.GetBoard()->Footprints() ) for( FOOTPRINT* footprint : m_boardAdapter.GetBoard()->Footprints() )
{ {
for( const FP_3DMODEL& model : footprint->Models() ) for( const FP_3DMODEL& model : footprint->Models() )
{ {

View File

@ -1265,7 +1265,7 @@ 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( MODULE* fp : m_boardAdapter.GetBoard()->Footprints() ) for( FOOTPRINT* fp : m_boardAdapter.GetBoard()->Footprints() )
{ {
const bool isIntersected = ( fp == m_currentIntersectedBoardItem ); const bool isIntersected = ( fp == m_currentIntersectedBoardItem );
@ -1319,7 +1319,7 @@ void C3D_RENDER_OGL_LEGACY::render_3D_models( bool aRenderTopOrBot,
} }
void C3D_RENDER_OGL_LEGACY::render_3D_footprint( const MODULE* aFootprint, void C3D_RENDER_OGL_LEGACY::render_3D_footprint( const FOOTPRINT* aFootprint,
bool aRenderTransparentOnly, bool aRenderTransparentOnly,
bool aIsSelected ) bool aIsSelected )
{ {

View File

@ -201,9 +201,11 @@ private:
*/ */
void render_3D_models( bool aRenderTopOrBot, bool aRenderTransparentOnly ); void render_3D_models( bool aRenderTopOrBot, bool aRenderTransparentOnly );
void render_3D_models_selected( bool aRenderTopOrBot, bool aRenderTransparentOnly, bool aRenderSelectedOnly ); void render_3D_models_selected( bool aRenderTopOrBot, bool aRenderTransparentOnly,
bool aRenderSelectedOnly );
void render_3D_footprint( const MODULE* aFootprint, bool aRenderTransparentOnly, bool aIsSelected ); void render_3D_footprint( const FOOTPRINT* aFootprint, bool aRenderTransparentOnly,
bool aIsSelected );
void setLight_Front( bool enabled ); void setLight_Front( bool enabled );
void setLight_Top( bool enabled ); void setLight_Top( bool enabled );

View File

@ -1386,7 +1386,7 @@ void C3D_RENDER_RAYTRACING::add_3D_vias_and_pads_to_container()
} }
// Insert pads holes (vertical cylinders) // Insert pads holes (vertical cylinders)
for( MODULE* footprint : m_boardAdapter.GetBoard()->Footprints() ) for( FOOTPRINT* footprint : m_boardAdapter.GetBoard()->Footprints() )
{ {
for( PAD* pad : footprint->Pads() ) for( PAD* pad : footprint->Pads() )
if( pad->GetAttribute () != PAD_ATTRIB_NPTH ) if( pad->GetAttribute () != PAD_ATTRIB_NPTH )
@ -1400,7 +1400,7 @@ 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( MODULE* fp : m_boardAdapter.GetBoard()->Footprints() ) for( FOOTPRINT* fp : m_boardAdapter.GetBoard()->Footprints() )
{ {
if( !fp->Models().empty() if( !fp->Models().empty()
&& m_boardAdapter.ShouldFPBeDisplayed((FOOTPRINT_ATTR_T) fp->GetAttributes()) ) && m_boardAdapter.ShouldFPBeDisplayed((FOOTPRINT_ATTR_T) fp->GetAttributes()) )

View File

@ -307,8 +307,8 @@ const FP_LIB_TABLE_ROW* FP_LIB_TABLE::FindRow( const wxString& aNickname )
} }
static void setLibNickname( MODULE* aModule, static void setLibNickname( FOOTPRINT* aModule, const wxString& aNickname,
const wxString& aNickname, const wxString& aFootprintName ) const wxString& aFootprintName )
{ {
// The library cannot know its own name, because it might have been renamed or moved. // The library cannot know its own name, because it might have been renamed or moved.
// Therefore footprints cannot know their own library nickname when residing in // Therefore footprints cannot know their own library nickname when residing in
@ -331,7 +331,7 @@ static void setLibNickname( MODULE* aModule,
} }
const MODULE* FP_LIB_TABLE::GetEnumeratedFootprint( const wxString& aNickname, const FOOTPRINT* FP_LIB_TABLE::GetEnumeratedFootprint( const wxString& aNickname,
const wxString& aFootprintName ) const wxString& aFootprintName )
{ {
const FP_LIB_TABLE_ROW* row = FindRow( aNickname ); const FP_LIB_TABLE_ROW* row = FindRow( aNickname );
@ -359,12 +359,12 @@ bool FP_LIB_TABLE::FootprintExists( const wxString& aNickname, const wxString& a
} }
MODULE* FP_LIB_TABLE::FootprintLoad( const wxString& aNickname, const wxString& aFootprintName ) FOOTPRINT* FP_LIB_TABLE::FootprintLoad( const wxString& aNickname, const wxString& aFootprintName )
{ {
const FP_LIB_TABLE_ROW* row = FindRow( aNickname ); const FP_LIB_TABLE_ROW* row = FindRow( aNickname );
wxASSERT( (PLUGIN*) row->plugin ); wxASSERT( (PLUGIN*) row->plugin );
MODULE* ret = row->plugin->FootprintLoad( row->GetFullURI( true ), aFootprintName, FOOTPRINT* ret = row->plugin->FootprintLoad( row->GetFullURI( true ), aFootprintName,
row->GetProperties() ); row->GetProperties() );
setLibNickname( ret, row->GetNickName(), aFootprintName ); setLibNickname( ret, row->GetNickName(), aFootprintName );
@ -374,7 +374,7 @@ MODULE* FP_LIB_TABLE::FootprintLoad( const wxString& aNickname, const wxString&
FP_LIB_TABLE::SAVE_T FP_LIB_TABLE::FootprintSave( const wxString& aNickname, FP_LIB_TABLE::SAVE_T FP_LIB_TABLE::FootprintSave( const wxString& aNickname,
const MODULE* aFootprint, bool aOverwrite ) const FOOTPRINT* aFootprint, bool aOverwrite )
{ {
const FP_LIB_TABLE_ROW* row = FindRow( aNickname ); const FP_LIB_TABLE_ROW* row = FindRow( aNickname );
wxASSERT( (PLUGIN*) row->plugin ); wxASSERT( (PLUGIN*) row->plugin );
@ -386,8 +386,9 @@ FP_LIB_TABLE::SAVE_T FP_LIB_TABLE::FootprintSave( const wxString& aNickname,
wxString fpname = aFootprint->GetFPID().GetLibItemName(); wxString fpname = aFootprint->GetFPID().GetLibItemName();
std::unique_ptr<MODULE> footprint( row->plugin->FootprintLoad( row->GetFullURI( true ), std::unique_ptr<FOOTPRINT> footprint( row->plugin->FootprintLoad( row->GetFullURI( true ),
fpname, row->GetProperties() ) ); fpname,
row->GetProperties() ) );
if( footprint.get() ) if( footprint.get() )
return SAVE_SKIPPED; return SAVE_SKIPPED;
@ -432,7 +433,7 @@ void FP_LIB_TABLE::FootprintLibCreate( const wxString& aNickname )
} }
MODULE* FP_LIB_TABLE::FootprintLoadWithOptionalNickname( const LIB_ID& aFootprintId ) FOOTPRINT* FP_LIB_TABLE::FootprintLoadWithOptionalNickname( const LIB_ID& aFootprintId )
{ {
wxString nickname = aFootprintId.GetLibNickname(); wxString nickname = aFootprintId.GetLibNickname();
wxString fpname = aFootprintId.GetLibItemName(); wxString fpname = aFootprintId.GetLibItemName();
@ -452,7 +453,7 @@ MODULE* FP_LIB_TABLE::FootprintLoadWithOptionalNickname( const LIB_ID& aFootprin
{ {
// FootprintLoad() returns NULL on not found, does not throw exception // FootprintLoad() returns NULL on not found, does not throw exception
// unless there's an IO_ERROR. // unless there's an IO_ERROR.
MODULE* ret = FootprintLoad( nicks[i], fpname ); FOOTPRINT* ret = FootprintLoad( nicks[i], fpname );
if( ret ) if( ret )
return ret; return ret;

View File

@ -54,7 +54,7 @@ size_t hash_eda( const EDA_ITEM* aItem, int aFlags )
{ {
case PCB_FOOTPRINT_T: case PCB_FOOTPRINT_T:
{ {
const MODULE* footprint = static_cast<const MODULE*>( aItem ); const FOOTPRINT* footprint = static_cast<const FOOTPRINT*>( aItem );
ret = hash_board_item( footprint, aFlags ); ret = hash_board_item( footprint, aFlags );

View File

@ -42,13 +42,13 @@
#include <kicad_string.h> #include <kicad_string.h>
#include <common.h> // needed for wxString hash template #include <common.h> // needed for wxString hash template
class MODULE; class FOOTPRINT;
struct EINSTANCE; struct EINSTANCE;
struct EPART; struct EPART;
struct ETEXT; struct ETEXT;
typedef std::unordered_map<wxString, wxXmlNode*> NODE_MAP; typedef std::unordered_map<wxString, wxXmlNode*> NODE_MAP;
typedef std::map<wxString, MODULE*> MODULE_MAP; typedef std::map<wxString, FOOTPRINT*> FOOTPRINT_MAP;
typedef std::map<wxString, EINSTANCE*> EINSTANCE_MAP; typedef std::map<wxString, EINSTANCE*> EINSTANCE_MAP;
typedef std::map<wxString, std::unique_ptr<EPART>> EPART_MAP; typedef std::map<wxString, std::unique_ptr<EPART>> EPART_MAP;

View File

@ -171,7 +171,7 @@ DISPLAY_FOOTPRINTS_FRAME::~DISPLAY_FOOTPRINTS_FRAME()
if( m_toolManager ) if( m_toolManager )
m_toolManager->ShutdownAllTools(); m_toolManager->ShutdownAllTools();
GetBoard()->DeleteAllModules(); GetBoard()->DeleteAllFootprints();
GetCanvas()->StopDrawing(); GetCanvas()->StopDrawing();
GetCanvas()->GetView()->Clear(); GetCanvas()->GetView()->Clear();
// Be sure any event cannot be fired after frame deletion: // Be sure any event cannot be fired after frame deletion:
@ -371,10 +371,10 @@ COLOR4D DISPLAY_FOOTPRINTS_FRAME::GetGridColor()
} }
MODULE* DISPLAY_FOOTPRINTS_FRAME::GetFootprint( const wxString& aFootprintName, FOOTPRINT* DISPLAY_FOOTPRINTS_FRAME::GetFootprint( const wxString& aFootprintName,
REPORTER& aReporter ) REPORTER& aReporter )
{ {
MODULE* footprint = NULL; FOOTPRINT* footprint = NULL;
LIB_ID fpid; LIB_ID fpid;
if( fpid.Parse( aFootprintName, LIB_ID::ID_PCB ) >= 0 ) if( fpid.Parse( aFootprintName, LIB_ID::ID_PCB ) >= 0 )
@ -434,10 +434,10 @@ MODULE* DISPLAY_FOOTPRINTS_FRAME::GetFootprint( const wxString& aFootprintName,
void DISPLAY_FOOTPRINTS_FRAME::InitDisplay() void DISPLAY_FOOTPRINTS_FRAME::InitDisplay()
{ {
CVPCB_MAINFRAME* parentframe = (CVPCB_MAINFRAME *) GetParent(); CVPCB_MAINFRAME* parentframe = (CVPCB_MAINFRAME *) GetParent();
MODULE* footprint = nullptr; FOOTPRINT* footprint = nullptr;
const FOOTPRINT_INFO* fpInfo = nullptr; const FOOTPRINT_INFO* fpInfo = nullptr;
GetBoard()->DeleteAllModules(); GetBoard()->DeleteAllFootprints();
GetCanvas()->GetView()->Clear(); GetCanvas()->GetView()->Clear();
wxString footprintName = parentframe->GetSelectedFootprint(); wxString footprintName = parentframe->GetSelectedFootprint();
@ -500,7 +500,7 @@ void DISPLAY_FOOTPRINTS_FRAME::updateView()
void DISPLAY_FOOTPRINTS_FRAME::UpdateMsgPanel() void DISPLAY_FOOTPRINTS_FRAME::UpdateMsgPanel()
{ {
MODULE* footprint = GetBoard()->GetFirstFootprint(); FOOTPRINT* footprint = GetBoard()->GetFirstFootprint();
MSG_PANEL_ITEMS items; MSG_PANEL_ITEMS items;
if( footprint ) if( footprint )

View File

@ -87,7 +87,7 @@ public:
*/ */
COLOR4D GetGridColor() override; COLOR4D GetGridColor() override;
MODULE* GetFootprint( const wxString& aFootprintName, REPORTER& aReporter ); FOOTPRINT* GetFootprint( const wxString& aFootprintName, REPORTER& aReporter );
/* SaveCopyInUndoList() virtual /* SaveCopyInUndoList() virtual
* currently: do nothing in CvPcb. * currently: do nothing in CvPcb.

View File

@ -75,7 +75,7 @@ public:
}; };
///> Map to hold NETLIST footprints data ///> Map to hold NETLIST footprints data
using PCB_MODULES_MAP = std::map<wxString, std::shared_ptr<PCB_FP_DATA>>; using PCB_FOOTPRINTS_MAP = std::map<wxString, std::shared_ptr<PCB_FP_DATA>>;
using CHANGELIST_ITEM = std::pair<SCH_REFERENCE, std::shared_ptr<PCB_FP_DATA>>; using CHANGELIST_ITEM = std::pair<SCH_REFERENCE, std::shared_ptr<PCB_FP_DATA>>;
@ -111,7 +111,7 @@ private:
bool m_processNetNames; bool m_processNetNames;
bool m_dryRun; bool m_dryRun;
PCB_MODULES_MAP m_pcbFootprints; PCB_FOOTPRINTS_MAP m_pcbFootprints;
SCH_REFERENCE_LIST m_refs; SCH_REFERENCE_LIST m_refs;
SCH_MULTI_UNIT_REFERENCE_MAP m_multiUnitsRefs; SCH_MULTI_UNIT_REFERENCE_MAP m_multiUnitsRefs;
std::deque<CHANGELIST_ITEM> m_changelist; std::deque<CHANGELIST_ITEM> m_changelist;

View File

@ -86,7 +86,7 @@ enum KICAD_T
SCREEN_T, ///< not really an item, used to identify a screen SCREEN_T, ///< not really an item, used to identify a screen
// Items in pcb // Items in pcb
PCB_FOOTPRINT_T, ///< class MODULE, a footprint PCB_FOOTPRINT_T, ///< class FOOTPRINT, a footprint
PCB_PAD_T, ///< class PAD, a pad in a footprint PCB_PAD_T, ///< class PAD, a pad in a footprint
PCB_SHAPE_T, ///< class PCB_SHAPE, a segment not on copper layers PCB_SHAPE_T, ///< class PCB_SHAPE, a segment not on copper layers
PCB_TEXT_T, ///< class PCB_TEXT, text on a layer PCB_TEXT_T, ///< class PCB_TEXT, text on a layer

View File

@ -29,7 +29,7 @@
#include <lib_table_base.h> #include <lib_table_base.h>
#include <io_mgr.h> #include <io_mgr.h>
class MODULE; class FOOTPRINT;
class FP_LIB_TABLE_GRID; class FP_LIB_TABLE_GRID;
@ -182,12 +182,12 @@ public:
* *
* @param aFootprintName is the name of the footprint to load. * @param aFootprintName is the name of the footprint to load.
* *
* @return MODULE* - if found caller owns it, else NULL if not found. * @return FOOTPRINT* - if found caller owns it, else NULL if not found.
* *
* @throw IO_ERROR if the library cannot be found or read. No exception * @throw IO_ERROR if the library cannot be found or read. No exception
* is thrown in the case where aFootprintName cannot be found. * is thrown in the case where aFootprintName cannot be found.
*/ */
MODULE* FootprintLoad( const wxString& aNickname, const wxString& aFootprintName ); FOOTPRINT* FootprintLoad( const wxString& aNickname, const wxString& aFootprintName );
/** /**
* Function FootprintExists * Function FootprintExists
@ -203,7 +203,7 @@ public:
* cache management. Return value is const to allow it to return a reference to a cached * cache management. Return value is const to allow it to return a reference to a cached
* item. * item.
*/ */
const MODULE* GetEnumeratedFootprint( const wxString& aNickname, const FOOTPRINT* GetEnumeratedFootprint( const wxString& aNickname,
const wxString& aFootprintName ); const wxString& aFootprintName );
/** /**
* Enum SAVE_T * Enum SAVE_T
@ -233,7 +233,7 @@ public:
* *
* @throw IO_ERROR if there is a problem saving. * @throw IO_ERROR if there is a problem saving.
*/ */
SAVE_T FootprintSave( const wxString& aNickname, const MODULE* aFootprint, SAVE_T FootprintSave( const wxString& aNickname, const FOOTPRINT* aFootprint,
bool aOverwrite = true ); bool aOverwrite = true );
/** /**
@ -271,13 +271,13 @@ public:
* *
* @param aFootprintId the [nickname] & footprint name of the footprint to load. * @param aFootprintId the [nickname] & footprint name of the footprint to load.
* *
* @return MODULE* - if found caller owns it, else NULL if not found. * @return FOOTPRINT* - if found caller owns it, else NULL if not found.
* *
* @throw IO_ERROR if the library cannot be found or read. No exception * @throw IO_ERROR if the library cannot be found or read. No exception
* is thrown in the case where aFootprintName cannot be found. * is thrown in the case where aFootprintName cannot be found.
* @throw PARSE_ERROR if @a aFootprintId is not parsed OK. * @throw PARSE_ERROR if @a aFootprintId is not parsed OK.
*/ */
MODULE* FootprintLoadWithOptionalNickname( const LIB_ID& aFootprintId ); FOOTPRINT* FootprintLoadWithOptionalNickname( const LIB_ID& aFootprintId );
/** /**
* Function LoadGlobalTable * Function LoadGlobalTable

View File

@ -50,7 +50,7 @@ class APP_SETTINGS_BASE;
class BOARD; class BOARD;
class BOARD_CONNECTED_ITEM; class BOARD_CONNECTED_ITEM;
class COLOR_SETTINGS; class COLOR_SETTINGS;
class MODULE; class FOOTPRINT;
class TRACK; class TRACK;
class PAD; class PAD;
class EDA_3D_VIEWER; class EDA_3D_VIEWER;
@ -86,12 +86,12 @@ protected:
* attempts to load \a aFootprintId from the footprint library table. * attempts to load \a aFootprintId from the footprint library table.
* *
* @param aFootprintId is the #LIB_ID of component footprint to load. * @param aFootprintId is the #LIB_ID of component footprint to load.
* @return the #MODULE if found or NULL if \a aFootprintId not found in any of the * @return the #FOOTPRINT if found or NULL if \a aFootprintId not found in any of the
* libraries in the table returned from #Prj().PcbFootprintLibs(). * libraries in the table returned from #Prj().PcbFootprintLibs().
* @throw IO_ERROR if an I/O error occurs or a #PARSE_ERROR if a file parsing error * @throw IO_ERROR if an I/O error occurs or a #PARSE_ERROR if a file parsing error
* occurs while reading footprint library files. * occurs while reading footprint library files.
*/ */
MODULE* loadFootprint( const LIB_ID& aFootprintId ); FOOTPRINT* loadFootprint( const LIB_ID& aFootprintId );
public: public:
PCB_BASE_FRAME( KIWAY* aKiway, wxWindow* aParent, FRAME_T aFrameType, PCB_BASE_FRAME( KIWAY* aKiway, wxWindow* aParent, FRAME_T aFrameType,
@ -124,10 +124,10 @@ public:
* attempts to load \a aFootprintId from the footprint library table. * attempts to load \a aFootprintId from the footprint library table.
* *
* @param aFootprintId is the #LIB_ID of component footprint to load. * @param aFootprintId is the #LIB_ID of component footprint to load.
* @return the #MODULE if found or NULL if \a aFootprintId not found in any of the * @return the #FOOTPRINT if found or NULL if \a aFootprintId not found in any of the
* libraries in table returned from #Prj().PcbFootprintLibs(). * libraries in table returned from #Prj().PcbFootprintLibs().
*/ */
MODULE* LoadFootprint( const LIB_ID& aFootprintId ); FOOTPRINT* LoadFootprint( const LIB_ID& aFootprintId );
/** /**
* Function GetBoardBoundingBox * Function GetBoardBoundingBox
@ -275,7 +275,7 @@ public:
* reference is entered by the user from a dialog (by awxTextCtlr, or a list of * reference is entered by the user from a dialog (by awxTextCtlr, or a list of
* available references) * available references)
*/ */
MODULE* GetFootprintFromBoardByReference(); FOOTPRINT* GetFootprintFromBoardByReference();
/** /**
* Function OnModify * Function OnModify
@ -298,7 +298,7 @@ public:
* when the fooprint is placed on a board and a netlist is read * when the fooprint is placed on a board and a netlist is read
* @param aFootprintName = name of the new footprint in library * @param aFootprintName = name of the new footprint in library
*/ */
MODULE* CreateNewFootprint( const wxString& aFootprintName ); FOOTPRINT* CreateNewFootprint( const wxString& aFootprintName );
/** /**
* Function PlaceFootprint * Function PlaceFootprint
@ -307,7 +307,7 @@ public:
* *
* @param aRecreateRatsnest A bool true redraws the footprint ratsnest. * @param aRecreateRatsnest A bool true redraws the footprint ratsnest.
*/ */
void PlaceFootprint( MODULE* aFootprint, bool aRecreateRatsnest = true ); void PlaceFootprint( FOOTPRINT* aFootprint, bool aRecreateRatsnest = true );
void ShowPadPropertiesDialog( PAD* aPad ); void ShowPadPropertiesDialog( PAD* aPad );
@ -317,14 +317,14 @@ public:
* *
* @param aPreslect = if valid, the LIB_ID to select (otherwise the global history is used) * @param aPreslect = if valid, the LIB_ID to select (otherwise the global history is used)
*/ */
MODULE* SelectFootprintFromLibTree( LIB_ID aPreselect = LIB_ID() ); FOOTPRINT* SelectFootprintFromLibTree( LIB_ID aPreselect = LIB_ID() );
/** /**
* Adds the given footprint to the board. * Adds the given footprint to the board.
* @param aFootprint * @param aFootprint
* @param aDC (can be NULL ) = the current Device Context, to draw the new footprint * @param aDC (can be NULL ) = the current Device Context, to draw the new footprint
*/ */
virtual void AddFootprintToBoard( MODULE* aFootprint ); virtual void AddFootprintToBoard( FOOTPRINT* aFootprint );
/** /**
* Function SelectFootprintFromLibBrowser * Function SelectFootprintFromLibBrowser

View File

@ -52,7 +52,7 @@ void ARRAY_CREATOR::Invoke()
if( m_selection.Size() == 0 ) if( m_selection.Size() == 0 )
return; return;
MODULE* const fp = m_isFootprintEditor ? m_parent.GetBoard()->GetFirstFootprint() : nullptr; FOOTPRINT* const fp = m_isFootprintEditor ? m_parent.GetBoard()->GetFirstFootprint() : nullptr;
const bool enableArrayNumbering = m_isFootprintEditor; const bool enableArrayNumbering = m_isFootprintEditor;
const wxPoint rotPoint = (wxPoint) m_selection.GetCenter(); const wxPoint rotPoint = (wxPoint) m_selection.GetCenter();
@ -77,7 +77,7 @@ void ARRAY_CREATOR::Invoke()
if( item->Type() == PCB_PAD_T && !m_isFootprintEditor ) if( item->Type() == PCB_PAD_T && !m_isFootprintEditor )
{ {
// If it is not the footprint editor, then duplicate the parent footprint instead // If it is not the footprint editor, then duplicate the parent footprint instead
item = static_cast<MODULE*>( item )->GetParent(); item = static_cast<FOOTPRINT*>( item )->GetParent();
} }
// The first item in list is the original item. We do not modify it // The first item in list is the original item. We do not modify it
@ -130,8 +130,8 @@ void ARRAY_CREATOR::Invoke()
// @TODO: renumber footprints if asked. This needs UI to enable. // @TODO: renumber footprints if asked. This needs UI to enable.
// something like this, but needs a "block offset" to prevent // something like this, but needs a "block offset" to prevent
// multiple selections overlapping. // multiple selections overlapping.
// if( new_item->Type() == PCB_MODULE_T ) // if( new_item->Type() == PCB_FOOTPRINT_T )
// static_cast<MODULE&>( *new_item ).IncrementReference( ptN ); // static_cast<FOOTPRINT&>( *new_item ).IncrementReference( ptN );
// @TODO: we should merge zones. This is a bit tricky, because // @TODO: we should merge zones. This is a bit tricky, because
// the undo command needs saving old area, if it is merged. // the undo command needs saving old area, if it is merged.
@ -147,7 +147,7 @@ void ARRAY_CREATOR::Invoke()
if( this_item->Type() == PCB_FOOTPRINT_T ) if( this_item->Type() == PCB_FOOTPRINT_T )
{ {
static_cast<MODULE*>( this_item )->RunOnChildren( static_cast<FOOTPRINT*>( this_item )->RunOnChildren(
[&]( BOARD_ITEM* aItem ) [&]( BOARD_ITEM* aItem )
{ {
aItem->ClearSelected(); aItem->ClearSelected();

View File

@ -26,7 +26,7 @@
#include <pad.h> #include <pad.h>
ARRAY_PAD_NAME_PROVIDER::ARRAY_PAD_NAME_PROVIDER( const MODULE* aFootprint, ARRAY_PAD_NAME_PROVIDER::ARRAY_PAD_NAME_PROVIDER( const FOOTPRINT* aFootprint,
const ARRAY_OPTIONS& aArrayOpts ) const ARRAY_OPTIONS& aArrayOpts )
: m_arrayOpts( aArrayOpts ) : m_arrayOpts( aArrayOpts )
{ {

View File

@ -40,7 +40,7 @@ public:
* @param aFootprint the footprint to gather existing names from (nullptr for no footprint) * @param aFootprint the footprint to gather existing names from (nullptr for no footprint)
* @oaram aArrayOpts the array options that provide the candidate names * @oaram aArrayOpts the array options that provide the candidate names
*/ */
ARRAY_PAD_NAME_PROVIDER( const MODULE* aFootprint, const ARRAY_OPTIONS& aArrayOpts ); ARRAY_PAD_NAME_PROVIDER( const FOOTPRINT* aFootprint, const ARRAY_OPTIONS& aArrayOpts );
/** /**
* Get the next available pad name. * Get the next available pad name.

View File

@ -82,7 +82,7 @@ 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( MODULE* footprint : m_board->Footprints() ) for( FOOTPRINT* footprint : m_board->Footprints() )
m_connectivity->Add( footprint ); m_connectivity->Add( footprint );
m_gridSize = Millimeter2iu( STEP_AR_MM ); m_gridSize = Millimeter2iu( STEP_AR_MM );
@ -92,7 +92,7 @@ AR_AUTOPLACER::AR_AUTOPLACER( BOARD* aBoard )
} }
void AR_AUTOPLACER::placeFootprint( MODULE* aFootprint, bool aDoNotRecreateRatsnest, void AR_AUTOPLACER::placeFootprint( FOOTPRINT* aFootprint, bool aDoNotRecreateRatsnest,
const wxPoint& aPos ) const wxPoint& aPos )
{ {
if( !aFootprint ) if( !aFootprint )
@ -271,7 +271,7 @@ bool AR_AUTOPLACER::fillMatrix()
} }
void AR_AUTOPLACER::rotateFootprint( MODULE* aFootprint, double angle, bool incremental ) void AR_AUTOPLACER::rotateFootprint( FOOTPRINT* aFootprint, double angle, bool incremental )
{ {
if( aFootprint == NULL ) if( aFootprint == NULL )
return; return;
@ -332,7 +332,7 @@ void AR_AUTOPLACER::addPad( PAD* aPad, int aClearance )
} }
void AR_AUTOPLACER::buildFpAreas( MODULE* aFootprint, int aFpClearance ) void AR_AUTOPLACER::buildFpAreas( FOOTPRINT* aFootprint, int aFpClearance )
{ {
m_fpAreaTop.RemoveAllContours(); m_fpAreaTop.RemoveAllContours();
m_fpAreaBottom.RemoveAllContours(); m_fpAreaBottom.RemoveAllContours();
@ -365,7 +365,7 @@ void AR_AUTOPLACER::buildFpAreas( MODULE* aFootprint, int aFpClearance )
} }
void AR_AUTOPLACER::genModuleOnRoutingMatrix( MODULE* Module ) void AR_AUTOPLACER::genModuleOnRoutingMatrix( FOOTPRINT* Module )
{ {
int ox, oy, fx, fy; int ox, oy, fx, fy;
LSET layerMask; LSET layerMask;
@ -546,7 +546,7 @@ unsigned int AR_AUTOPLACER::calculateKeepOutArea( const EDA_RECT& aRect, int sid
* Returns the value TstRectangle(). * Returns the value TstRectangle().
* Module is known by its bounding box * Module is known by its bounding box
*/ */
int AR_AUTOPLACER::testFootprintOnBoard( MODULE* aFootprint, bool TstOtherSide, int AR_AUTOPLACER::testFootprintOnBoard( FOOTPRINT* aFootprint, bool TstOtherSide,
const wxPoint& aOffset ) const wxPoint& aOffset )
{ {
int side = AR_SIDE_TOP; int side = AR_SIDE_TOP;
@ -584,7 +584,7 @@ int AR_AUTOPLACER::testFootprintOnBoard( MODULE* aFootprint, bool TstOtherSide,
} }
int AR_AUTOPLACER::getOptimalFPPlacement( MODULE* aFootprint ) int AR_AUTOPLACER::getOptimalFPPlacement( FOOTPRINT* aFootprint )
{ {
int error = 1; int error = 1;
wxPoint lastPosOK; wxPoint lastPosOK;
@ -678,12 +678,12 @@ int AR_AUTOPLACER::getOptimalFPPlacement( MODULE* aFootprint )
} }
const PAD* AR_AUTOPLACER::nearestPad( MODULE *aRefFP, PAD* aRefPad, const wxPoint& aOffset) const PAD* AR_AUTOPLACER::nearestPad( FOOTPRINT *aRefFP, PAD* aRefPad, const wxPoint& aOffset)
{ {
const PAD* nearest = nullptr; const PAD* nearest = nullptr;
int64_t nearestDist = INT64_MAX; int64_t nearestDist = INT64_MAX;
for ( MODULE* footprint : m_board->Footprints() ) for( FOOTPRINT* footprint : m_board->Footprints() )
{ {
if ( footprint == aRefFP ) if ( footprint == aRefFP )
continue; continue;
@ -710,7 +710,7 @@ const PAD* AR_AUTOPLACER::nearestPad( MODULE *aRefFP, PAD* aRefPad, const wxPoin
} }
double AR_AUTOPLACER::computePlacementRatsnestCost( MODULE *aFootprint, const wxPoint& aOffset ) double AR_AUTOPLACER::computePlacementRatsnestCost( FOOTPRINT *aFootprint, const wxPoint& aOffset )
{ {
double curr_cost; double curr_cost;
VECTOR2I start; // start point of a ratsnest VECTOR2I start; // start point of a ratsnest
@ -719,7 +719,7 @@ double AR_AUTOPLACER::computePlacementRatsnestCost( MODULE *aFootprint, const wx
curr_cost = 0; curr_cost = 0;
for ( PAD* pad : aFootprint->Pads() ) for( PAD* pad : aFootprint->Pads() )
{ {
const PAD* nearest = nearestPad( aFootprint, pad, aOffset ); const PAD* nearest = nearestPad( aFootprint, pad, aOffset );
@ -758,7 +758,7 @@ double AR_AUTOPLACER::computePlacementRatsnestCost( MODULE *aFootprint, const wx
// Sort routines // Sort routines
static bool sortFootprintsByComplexity( MODULE* ref, MODULE* compare ) static bool sortFootprintsByComplexity( FOOTPRINT* ref, FOOTPRINT* compare )
{ {
double ff1, ff2; double ff1, ff2;
@ -769,7 +769,7 @@ static bool sortFootprintsByComplexity( MODULE* ref, MODULE* compare )
} }
static bool sortFootprintsByRatsnestSize( MODULE* ref, MODULE* compare ) static bool sortFootprintsByRatsnestSize( FOOTPRINT* ref, FOOTPRINT* compare )
{ {
double ff1, ff2; double ff1, ff2;
@ -779,12 +779,12 @@ static bool sortFootprintsByRatsnestSize( MODULE* ref, MODULE* compare )
} }
MODULE* AR_AUTOPLACER::pickFootprint( ) FOOTPRINT* AR_AUTOPLACER::pickFootprint( )
{ {
std::vector<MODULE*> fpList; std::vector<FOOTPRINT*> fpList;
for( MODULE* footprint : m_board->Footprints() ) for( FOOTPRINT* footprint : m_board->Footprints() )
{ {
footprint->CalculateBoundingBox(); footprint->CalculateBoundingBox();
fpList.push_back( footprint ); fpList.push_back( footprint );
@ -794,7 +794,7 @@ MODULE* AR_AUTOPLACER::pickFootprint( )
for( unsigned kk = 0; kk < fpList.size(); kk++ ) for( unsigned kk = 0; kk < fpList.size(); kk++ )
{ {
MODULE* footprint = fpList[kk]; FOOTPRINT* footprint = fpList[kk];
footprint->SetFlag( 0 ); footprint->SetFlag( 0 );
if( !footprint->NeedsPlaced() ) if( !footprint->NeedsPlaced() )
@ -807,7 +807,7 @@ MODULE* AR_AUTOPLACER::pickFootprint( )
for( unsigned kk = 0; kk < fpList.size(); kk++ ) for( unsigned kk = 0; kk < fpList.size(); kk++ )
{ {
MODULE* footprint = fpList[kk]; FOOTPRINT* footprint = fpList[kk];
auto edges = m_connectivity->GetRatsnestForComponent( footprint, true ); auto edges = m_connectivity->GetRatsnestForComponent( footprint, true );
@ -817,12 +817,12 @@ MODULE* AR_AUTOPLACER::pickFootprint( )
sort( fpList.begin(), fpList.end(), sortFootprintsByRatsnestSize ); sort( fpList.begin(), fpList.end(), sortFootprintsByRatsnestSize );
// Search for "best" footprint. // Search for "best" footprint.
MODULE* bestFootprint = nullptr; FOOTPRINT* bestFootprint = nullptr;
MODULE* altFootprint = nullptr; FOOTPRINT* altFootprint = nullptr;
for( unsigned ii = 0; ii < fpList.size(); ii++ ) for( unsigned ii = 0; ii < fpList.size(); ii++ )
{ {
MODULE* footprint = fpList[ii]; FOOTPRINT* footprint = fpList[ii];
if( !footprint->NeedsPlaced() ) if( !footprint->NeedsPlaced() )
continue; continue;
@ -874,7 +874,7 @@ void AR_AUTOPLACER::drawPlacementRoutingMatrix( )
} }
AR_RESULT AR_AUTOPLACER::AutoplaceFootprints( std::vector<MODULE*>& aFootprints, AR_RESULT AR_AUTOPLACER::AutoplaceFootprints( std::vector<FOOTPRINT*>& aFootprints,
BOARD_COMMIT* aCommit, BOARD_COMMIT* aCommit,
bool aPlaceOffboardModules ) bool aPlaceOffboardModules )
{ {
@ -896,33 +896,33 @@ AR_RESULT AR_AUTOPLACER::AutoplaceFootprints( std::vector<MODULE*>& aFootprints,
int placedCount = 0; int placedCount = 0;
for( MODULE* footprint : m_board->Footprints() ) for( FOOTPRINT* footprint : m_board->Footprints() )
footprint->SetNeedsPlaced( false ); footprint->SetNeedsPlaced( false );
std::vector<MODULE*> offboardMods; std::vector<FOOTPRINT*> offboardMods;
if( aPlaceOffboardModules ) if( aPlaceOffboardModules )
{ {
for( MODULE* footprint : m_board->Footprints() ) for( FOOTPRINT* footprint : m_board->Footprints() )
{ {
if( !m_matrix.m_BrdBox.Contains( footprint->GetPosition() ) ) if( !m_matrix.m_BrdBox.Contains( footprint->GetPosition() ) )
offboardMods.push_back( footprint ); offboardMods.push_back( footprint );
} }
} }
for( MODULE* footprint : aFootprints ) for( FOOTPRINT* footprint : aFootprints )
{ {
footprint->SetNeedsPlaced( true ); footprint->SetNeedsPlaced( true );
aCommit->Modify( footprint ); aCommit->Modify( footprint );
} }
for( MODULE* footprint : offboardMods ) for( FOOTPRINT* footprint : offboardMods )
{ {
footprint->SetNeedsPlaced( true ); footprint->SetNeedsPlaced( true );
aCommit->Modify( footprint ); aCommit->Modify( footprint );
} }
for( MODULE* footprint : m_board->Footprints() ) for( FOOTPRINT* footprint : m_board->Footprints() )
{ {
if( footprint->NeedsPlaced() ) // Erase from screen if( footprint->NeedsPlaced() ) // Erase from screen
placedCount++; placedCount++;
@ -945,7 +945,7 @@ AR_RESULT AR_AUTOPLACER::AutoplaceFootprints( std::vector<MODULE*>& aFootprints,
if( m_refreshCallback ) if( m_refreshCallback )
m_refreshCallback( nullptr ); m_refreshCallback( nullptr );
MODULE* footprint; FOOTPRINT* footprint;
while( ( footprint = pickFootprint() ) != nullptr ) while( ( footprint = pickFootprint() ) != nullptr )
{ {
@ -1075,7 +1075,7 @@ end_of_tst:
m_matrix.UnInitRoutingMatrix(); m_matrix.UnInitRoutingMatrix();
for( MODULE* fp : m_board->Footprints() ) for( FOOTPRINT* fp : m_board->Footprints() )
fp->CalculateBoundingBox(); fp->CalculateBoundingBox();
return cancelled ? AR_CANCELLED : AR_COMPLETED; return cancelled ? AR_CANCELLED : AR_COMPLETED;

View File

@ -59,7 +59,7 @@ class AR_AUTOPLACER
public: public:
AR_AUTOPLACER( BOARD* aBoard ); AR_AUTOPLACER( BOARD* aBoard );
AR_RESULT AutoplaceFootprints( std::vector<MODULE*>& aFootprints, BOARD_COMMIT* aCommit, AR_RESULT AutoplaceFootprints( std::vector<FOOTPRINT*>& aFootprints, BOARD_COMMIT* aCommit,
bool aPlaceOffboardModules = false ); bool aPlaceOffboardModules = false );
/** /**
@ -74,7 +74,7 @@ public:
* a callback function to redraw on screen the view after changes, * a callback function to redraw on screen the view after changes,
* for instance after moving a footprint * for instance after moving a footprint
*/ */
void SetRefreshCallback( std::function<int( MODULE* aModule )> aCallback ) void SetRefreshCallback( std::function<int( FOOTPRINT* aFootprint )> aCallback )
{ {
m_refreshCallback = aCallback; m_refreshCallback = aCallback;
} }
@ -86,32 +86,31 @@ public:
private: private:
void drawPlacementRoutingMatrix(); // draw the working area (shows free and occupied areas) void drawPlacementRoutingMatrix(); // draw the working area (shows free and occupied areas)
void rotateFootprint( MODULE* aFootprint, double angle, bool incremental ); void rotateFootprint( FOOTPRINT* aFootprint, double angle, bool incremental );
int genPlacementRoutingMatrix(); int genPlacementRoutingMatrix();
/** fills m_matrix cells from m_boardShape. /** fills m_matrix cells from m_boardShape.
* cells inside m_boardShape are set to CELL_IS_ZONE * cells inside m_boardShape are set to CELL_IS_ZONE
*/ */
bool fillMatrix(); bool fillMatrix();
void genModuleOnRoutingMatrix( MODULE* Module ); void genModuleOnRoutingMatrix( FOOTPRINT* aFootprint );
int testRectangle( const EDA_RECT& aRect, int side ); int testRectangle( const EDA_RECT& aRect, int side );
unsigned int calculateKeepOutArea( const EDA_RECT& aRect, int side ); unsigned int calculateKeepOutArea( const EDA_RECT& aRect, int side );
int testFootprintOnBoard( MODULE* aFootprint, bool TstOtherSide, const wxPoint& aOffset ); int testFootprintOnBoard( FOOTPRINT* aFootprint, bool TstOtherSide, const wxPoint& aOffset );
int getOptimalFPPlacement( MODULE* aFootprint ); int getOptimalFPPlacement( FOOTPRINT* aFootprint );
double computePlacementRatsnestCost( MODULE* aFootprint, const wxPoint& aOffset ); double computePlacementRatsnestCost( FOOTPRINT* aFootprint, const wxPoint& aOffset );
/** /**
* Find the "best" footprint place. The criteria are: * Find the "best" footprint place. The criteria are:
* - Maximum ratsnest with footprints already placed * - Maximum ratsnest with footprints already placed
* - Max size, and number of pads max * - Max size, and number of pads max
*/ */
MODULE* pickFootprint(); FOOTPRINT* pickFootprint();
void placeFootprint( MODULE* aFootprint, bool aDoNotRecreateRatsnest, void placeFootprint( FOOTPRINT* aFootprint, bool aDoNotRecreateRatsnest, const wxPoint& aPos );
const wxPoint& aPos );
const PAD* nearestPad( MODULE* aRefFP, PAD* aRefPad, const wxPoint& aOffset ); const PAD* nearestPad( FOOTPRINT* aRefFP, PAD* aRefPad, const wxPoint& aOffset );
// Add a polygonal shape (rectangle) to m_fpAreaFront and/or m_fpAreaBack // Add a polygonal shape (rectangle) to m_fpAreaFront and/or m_fpAreaBack
void addFpBody( wxPoint aStart, wxPoint aEnd, LSET aLayerMask ); void addFpBody( wxPoint aStart, wxPoint aEnd, LSET aLayerMask );
@ -121,7 +120,7 @@ private:
// Build m_fpAreaTop and m_fpAreaBottom polygonal shapes for aFootprint. // Build m_fpAreaTop and m_fpAreaBottom polygonal shapes for aFootprint.
// aFpClearance is a mechanical clearance. // aFpClearance is a mechanical clearance.
void buildFpAreas( MODULE* aFootprint, int aFpClearance ); void buildFpAreas( FOOTPRINT* aFootprint, int aFpClearance );
AR_MATRIX m_matrix; AR_MATRIX m_matrix;
SHAPE_POLY_SET m_topFreeArea; // The polygonal description of the top side free areas; SHAPE_POLY_SET m_topFreeArea; // The polygonal description of the top side free areas;
@ -138,7 +137,7 @@ private:
std::shared_ptr<KIGFX::VIEW_OVERLAY> m_overlay; std::shared_ptr<KIGFX::VIEW_OVERLAY> m_overlay;
std::unique_ptr<CONNECTIVITY_DATA> m_connectivity; std::unique_ptr<CONNECTIVITY_DATA> m_connectivity;
std::function<int( MODULE* aModule )> m_refreshCallback; std::function<int( FOOTPRINT* aFootprint )> m_refreshCallback;
PROGRESS_REPORTER* m_progressReporter; PROGRESS_REPORTER* m_progressReporter;
}; };

View File

@ -35,7 +35,7 @@
class PCB_SHAPE; class PCB_SHAPE;
class TRACK; class TRACK;
class PAD; class PAD;
class MODULE; class FOOTPRINT;
#define AR_MAX_ROUTING_LAYERS_COUNT 2 #define AR_MAX_ROUTING_LAYERS_COUNT 2

View File

@ -46,7 +46,7 @@ AUTOPLACE_TOOL::~AUTOPLACE_TOOL()
// especially each time a footprint is autoplaced, // especially each time a footprint is autoplaced,
static PCB_BASE_EDIT_FRAME* fparent; static PCB_BASE_EDIT_FRAME* fparent;
static int refreshCallback( MODULE* aFootprint ) static int refreshCallback( FOOTPRINT* aFootprint )
{ {
if( aFootprint ) if( aFootprint )
fparent->GetCanvas()->GetView()->Update( aFootprint ); fparent->GetCanvas()->GetView()->Update( aFootprint );
@ -59,7 +59,7 @@ static int refreshCallback( MODULE* aFootprint )
} }
int AUTOPLACE_TOOL::autoplace( std::vector<MODULE*>& aFootprints, bool aPlaceOffboard ) int AUTOPLACE_TOOL::autoplace( std::vector<FOOTPRINT*>& aFootprints, bool aPlaceOffboard )
{ {
EDA_RECT bbox = board()->GetBoardEdgesBoundingBox(); EDA_RECT bbox = board()->GetBoardEdgesBoundingBox();
@ -82,7 +82,7 @@ int AUTOPLACE_TOOL::autoplace( std::vector<MODULE*>& aFootprints, bool aPlaceOff
autoplacer.SetOverlay( overlay ); autoplacer.SetOverlay( overlay );
fparent = frame(); fparent = frame();
std::function<int( MODULE* aFootprint )> callback = refreshCallback; std::function<int( FOOTPRINT* aFootprint )> callback = refreshCallback;
autoplacer.SetRefreshCallback( callback ); autoplacer.SetRefreshCallback( callback );
std::unique_ptr<WX_PROGRESS_REPORTER> progressReporter( std::unique_ptr<WX_PROGRESS_REPORTER> progressReporter(
@ -102,12 +102,12 @@ int AUTOPLACE_TOOL::autoplace( std::vector<MODULE*>& aFootprints, bool aPlaceOff
int AUTOPLACE_TOOL::autoplaceSelected( const TOOL_EVENT& aEvent ) int AUTOPLACE_TOOL::autoplaceSelected( const TOOL_EVENT& aEvent )
{ {
std::vector<MODULE*> footprints; std::vector<FOOTPRINT*> footprints;
for( EDA_ITEM* item : selection() ) for( EDA_ITEM* item : selection() )
{ {
if( item->Type() == PCB_FOOTPRINT_T ) if( item->Type() == PCB_FOOTPRINT_T )
footprints.push_back( static_cast<MODULE*>( item ) ); footprints.push_back( static_cast<FOOTPRINT*>( item ) );
} }
return autoplace( footprints, false ); return autoplace( footprints, false );
@ -116,7 +116,7 @@ int AUTOPLACE_TOOL::autoplaceSelected( const TOOL_EVENT& aEvent )
int AUTOPLACE_TOOL::autoplaceOffboard( const TOOL_EVENT& aEvent ) int AUTOPLACE_TOOL::autoplaceOffboard( const TOOL_EVENT& aEvent )
{ {
std::vector<MODULE*> footprints; std::vector<FOOTPRINT*> footprints;
return autoplace( footprints, true ); return autoplace( footprints, true );
} }

View File

@ -42,7 +42,7 @@ public:
void setTransitions() override; void setTransitions() override;
private: private:
int autoplace( std::vector<MODULE*>& aFootprints, bool aPlaceOffboard ); int autoplace( std::vector<FOOTPRINT*>& aFootprints, bool aPlaceOffboard );
int autoplaceSelected( const TOOL_EVENT& aEvent ); int autoplaceSelected( const TOOL_EVENT& aEvent );
int autoplaceOffboard( const TOOL_EVENT& aEvent ); int autoplaceOffboard( const TOOL_EVENT& aEvent );

View File

@ -63,7 +63,7 @@ const int scale = (int)(0.01 * IU_PER_MM);
const int PADDING = (int)(1 * IU_PER_MM); const int PADDING = (int)(1 * IU_PER_MM);
// Populates a list of rectangles, from a list of footprints // Populates a list of rectangles, from a list of footprints
void fillRectList( CSubRectArray& vecSubRects, std::vector <MODULE*>& aFootprintList ) void fillRectList( CSubRectArray& vecSubRects, std::vector <FOOTPRINT*>& aFootprintList )
{ {
vecSubRects.clear(); vecSubRects.clear();
@ -148,7 +148,7 @@ void spreadRectangles( CRectPlacement& aPlacementArea,
} }
void moveFootprintsInArea( CRectPlacement& aPlacementArea, std::vector <MODULE*>& aFootprintList, void moveFootprintsInArea( CRectPlacement& aPlacementArea, std::vector <FOOTPRINT*>& aFootprintList,
EDA_RECT& aFreeArea, bool aFindAreaOnly ) EDA_RECT& aFreeArea, bool aFindAreaOnly )
{ {
CSubRectArray vecSubRects; CSubRectArray vecSubRects;
@ -165,7 +165,7 @@ void moveFootprintsInArea( CRectPlacement& aPlacementArea, std::vector <MODULE*>
pos.x *= scale; pos.x *= scale;
pos.y *= scale; pos.y *= scale;
MODULE* footprint = aFootprintList[vecSubRects[it].n]; FOOTPRINT* footprint = aFootprintList[vecSubRects[it].n];
EDA_RECT fpBBox = footprint->GetFootprintRect(); EDA_RECT fpBBox = footprint->GetFootprintRect();
wxPoint mod_pos = pos + ( footprint->GetPosition() - fpBBox.GetOrigin() ) wxPoint mod_pos = pos + ( footprint->GetPosition() - fpBBox.GetOrigin() )
@ -175,7 +175,7 @@ void moveFootprintsInArea( CRectPlacement& aPlacementArea, std::vector <MODULE*>
} }
} }
static bool sortFootprintsbySheetPath( MODULE* ref, MODULE* compare ); static bool sortFootprintsbySheetPath( FOOTPRINT* ref, FOOTPRINT* compare );
/** /**
@ -186,13 +186,13 @@ static bool sortFootprintsbySheetPath( MODULE* ref, MODULE* compare );
* @param aSpreadAreaPosition the position of the upper left corner of the * @param aSpreadAreaPosition the position of the upper left corner of the
* area allowed to spread footprints * area allowed to spread footprints
*/ */
void SpreadFootprints( std::vector<MODULE*>* aFootprints, wxPoint aSpreadAreaPosition ) void SpreadFootprints( std::vector<FOOTPRINT*>* aFootprints, wxPoint aSpreadAreaPosition )
{ {
// Build candidate list // Build candidate list
// calculate also the area needed by these footprints // calculate also the area needed by these footprints
std::vector <MODULE*> footprintList; std::vector <FOOTPRINT*> footprintList;
for( MODULE* footprint : *aFootprints ) for( FOOTPRINT* footprint : *aFootprints )
{ {
if( footprint->IsLocked() ) if( footprint->IsLocked() )
continue; continue;
@ -208,7 +208,7 @@ void SpreadFootprints( std::vector<MODULE*>* aFootprints, wxPoint aSpreadAreaPo
sort( footprintList.begin(), footprintList.end(), sortFootprintsbySheetPath ); sort( footprintList.begin(), footprintList.end(), sortFootprintsbySheetPath );
// Extract and place footprints by sheet // Extract and place footprints by sheet
std::vector <MODULE*> footprintListBySheet; std::vector <FOOTPRINT*> footprintListBySheet;
std::vector <EDA_RECT> placementSheetAreas; std::vector <EDA_RECT> placementSheetAreas;
double subsurface; double subsurface;
double placementsurface = 0.0; double placementsurface = 0.0;
@ -228,7 +228,7 @@ void SpreadFootprints( std::vector<MODULE*>* aFootprints, wxPoint aSpreadAreaPo
for( unsigned ii = 0; ii < footprintList.size(); ii++ ) for( unsigned ii = 0; ii < footprintList.size(); ii++ )
{ {
MODULE* footprint = footprintList[ii]; FOOTPRINT* footprint = footprintList[ii];
bool islastItem = false; bool islastItem = false;
if( ii == footprintList.size() - 1 || if( ii == footprintList.size() - 1 ||
@ -337,7 +337,7 @@ void SpreadFootprints( std::vector<MODULE*>* aFootprints, wxPoint aSpreadAreaPo
// Footprints are sorted by their sheet path. // Footprints are sorted by their sheet path.
// (the full sheet path restricted to the time stamp of the sheet itself, // (the full sheet path restricted to the time stamp of the sheet itself,
// without the time stamp of the footprint ). // without the time stamp of the footprint ).
static bool sortFootprintsbySheetPath( MODULE* ref, MODULE* compare ) static bool sortFootprintsbySheetPath( FOOTPRINT* ref, FOOTPRINT* compare )
{ {
return ref->GetPath() < compare->GetPath(); return ref->GetPath() < compare->GetPath();
} }

View File

@ -107,7 +107,7 @@ BOARD::~BOARD()
m_zones.clear(); m_zones.clear();
for( MODULE* footprint : m_footprints ) for( FOOTPRINT* footprint : m_footprints )
delete footprint; delete footprint;
m_footprints.clear(); m_footprints.clear();
@ -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 : Footprints() ) for( FOOTPRINT* 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_FOOTPRINT_T: case PCB_FOOTPRINT_T:
if( aMode == ADD_MODE::APPEND ) if( aMode == ADD_MODE::APPEND )
m_footprints.push_back((MODULE*) aBoardItem ); m_footprints.push_back( static_cast<FOOTPRINT*>( aBoardItem ) );
else else
m_footprints.push_front((MODULE*) aBoardItem ); m_footprints.push_front( static_cast<FOOTPRINT*>( aBoardItem ) );
break; break;
@ -768,7 +768,7 @@ BOARD_ITEM* BOARD::GetItem( const KIID& aID ) const
return track; return track;
} }
for( MODULE* footprint : Footprints() ) for( FOOTPRINT* 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 : Footprints() ) for( FOOTPRINT* 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 : Footprints() ) for( FOOTPRINT* footprint : Footprints() )
{ {
if( footprint->GetReference().CmpNoCase( ref ) == 0 ) if( footprint->GetReference().CmpNoCase( ref ) == 0 )
{ {
@ -956,7 +956,7 @@ wxString BOARD::ConvertKIIDsToCrossReferences( const wxString& aSource )
BOARD_ITEM* refItem = GetItem( KIID( ref ) ); BOARD_ITEM* refItem = GetItem( KIID( ref ) );
if( refItem && refItem->Type() == PCB_FOOTPRINT_T ) if( refItem && refItem->Type() == PCB_FOOTPRINT_T )
token = static_cast<MODULE*>( refItem )->GetReference() + ":" + remainder; token = static_cast<FOOTPRINT*>( refItem )->GetReference() + ":" + remainder;
} }
newbuf.append( "${" + token + "}" ); newbuf.append( "${" + token + "}" );
@ -975,7 +975,7 @@ unsigned BOARD::GetNodesCount( int aNet ) const
{ {
unsigned retval = 0; unsigned retval = 0;
for( MODULE* footprint : Footprints() ) for( FOOTPRINT* 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_footprints ) for( FOOTPRINT* footprint : m_footprints )
{ {
if( !( footprint->GetLayerSet() & visible ).any() ) if( !( footprint->GetLayerSet() & visible ).any() )
continue; continue;
@ -1122,7 +1122,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 FOOTPRINT::Visit() on each footprint. // this calls FOOTPRINT::Visit() on each footprint.
result = IterateForward<MODULE*>( m_footprints, inspector, testData, p ); result = IterateForward<FOOTPRINT*>( 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( ; ; )
@ -1251,9 +1251,9 @@ NETINFO_ITEM* BOARD::FindNet( const wxString& aNetname ) const
} }
MODULE* BOARD::FindModuleByReference( const wxString& aReference ) const FOOTPRINT* BOARD::FindFootprintByReference( const wxString& aReference ) const
{ {
for( MODULE* footprint : m_footprints ) for( FOOTPRINT* footprint : m_footprints )
{ {
if( aReference == footprint->GetReference() ) if( aReference == footprint->GetReference() )
return footprint; return footprint;
@ -1263,9 +1263,9 @@ MODULE* BOARD::FindModuleByReference( const wxString& aReference ) const
} }
MODULE* BOARD::FindModuleByPath( const KIID_PATH& aPath ) const FOOTPRINT* BOARD::FindFootprintByPath( const KIID_PATH& aPath ) const
{ {
for( MODULE* footprint : m_footprints ) for( FOOTPRINT* footprint : m_footprints )
{ {
if( footprint->GetPath() == aPath ) if( footprint->GetPath() == aPath )
return footprint; return footprint;
@ -1447,7 +1447,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_footprints ) for( FOOTPRINT* footprint : m_footprints )
{ {
PAD* pad = NULL; PAD* pad = NULL;
@ -1474,7 +1474,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 : Footprints() ) for( FOOTPRINT* footprint : Footprints() )
{ {
for( PAD* pad : footprint->Pads() ) for( PAD* pad : footprint->Pads() )
{ {
@ -1600,7 +1600,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 : Footprints() ) for( FOOTPRINT* footprint : Footprints() )
{ {
for( PAD* pad : footprint->Pads( ) ) for( PAD* pad : footprint->Pads( ) )
{ {
@ -1666,16 +1666,16 @@ std::tuple<int, double, double> BOARD::GetTrackLength( const TRACK& aTrack ) con
} }
MODULE* BOARD::GetFootprint( const wxPoint& aPosition, PCB_LAYER_ID aActiveLayer, FOOTPRINT* BOARD::GetFootprint( const wxPoint& aPosition, PCB_LAYER_ID aActiveLayer,
bool aVisibleOnly, bool aIgnoreLocked ) bool aVisibleOnly, bool aIgnoreLocked )
{ {
MODULE* footprint = NULL; FOOTPRINT* footprint = NULL;
MODULE* alt_footprint = NULL; FOOTPRINT* alt_footprint = NULL;
int min_dim = 0x7FFFFFFF; int min_dim = 0x7FFFFFFF;
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_footprints ) for( FOOTPRINT* 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 ) )
@ -1739,7 +1739,7 @@ std::list<ZONE*> BOARD::GetZoneList( bool aIncludeZonesInFootprints )
if( aIncludeZonesInFootprints ) if( aIncludeZonesInFootprints )
{ {
for( MODULE* footprint : m_footprints ) for( FOOTPRINT* footprint : m_footprints )
{ {
for( FP_ZONE* zone : footprint->Zones() ) for( FP_ZONE* zone : footprint->Zones() )
zones.push_back( zone ); zones.push_back( zone );
@ -1859,7 +1859,7 @@ const std::vector<PAD*> BOARD::GetPads() const
{ {
std::vector<PAD*> allPads; std::vector<PAD*> allPads;
for( MODULE* footprint : Footprints() ) for( FOOTPRINT* footprint : Footprints() )
{ {
for( PAD* pad : footprint->Pads() ) for( PAD* pad : footprint->Pads() )
allPads.push_back( pad ); allPads.push_back( pad );
@ -1873,7 +1873,7 @@ unsigned BOARD::GetPadCount() const
{ {
unsigned retval = 0; unsigned retval = 0;
for( MODULE* footprint : Footprints() ) for( FOOTPRINT* footprint : Footprints() )
retval += footprint->Pads().size(); retval += footprint->Pads().size();
return retval; return retval;
@ -1887,7 +1887,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 : Footprints() ) for( FOOTPRINT* 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_footprints; FOOTPRINTS 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& Footprints() { return m_footprints; } FOOTPRINTS& Footprints() { return m_footprints; }
const MODULES& Footprints() const { return m_footprints; } const FOOTPRINTS& 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; }
@ -345,7 +345,7 @@ public:
* This is used primarily by the footprint editor which knows there is only one. * This is used primarily by the footprint editor which knows there is only one.
* @return first footprint or null pointer * @return first footprint or null pointer
*/ */
MODULE* GetFirstFootprint() const FOOTPRINT* GetFirstFootprint() const
{ {
return m_footprints.empty() ? nullptr : m_footprints.front(); return m_footprints.empty() ? nullptr : m_footprints.front();
} }
@ -353,9 +353,9 @@ public:
/** /**
* Removes all footprints from the deque and frees the memory associated with them * Removes all footprints from the deque and frees the memory associated with them
*/ */
void DeleteAllModules() void DeleteAllFootprints()
{ {
for( MODULE* footprint : m_footprints ) for( FOOTPRINT* footprint : m_footprints )
delete footprint; delete footprint;
m_footprints.clear(); m_footprints.clear();
@ -802,22 +802,23 @@ public:
SEARCH_RESULT Visit( INSPECTOR inspector, void* testData, const KICAD_T scanTypes[] ) override; SEARCH_RESULT Visit( INSPECTOR inspector, void* testData, const KICAD_T scanTypes[] ) override;
/** /**
* Search for a MODULE within this board with the given reference designator. * Search for a FOOTPRINT within this board with the given reference designator.
* *
* Finds only the first one, if there is more than one such MODULE. * Finds only the first one, if there is more than one such FOOTPRINT.
* *
* @param aReference The reference designator of the MODULE to find. * @param aReference The reference designator of the FOOTPRINT to find.
* @return MODULE* - If found, the MODULE having the given reference designator, else NULL. * @return FOOTPRINT* - If found, the FOOTPRINT having the given reference designator, else
* nullptr.
*/ */
MODULE* FindModuleByReference( const wxString& aReference ) const; FOOTPRINT* FindFootprintByReference( const wxString& aReference ) const;
/** /**
* Search for a MODULE within this board with the given path. * Search for a FOOTPRINT within this board with the given path.
* *
* @param aPath The path ([sheetUUID, .., symbolUUID]) to search for. * @param aPath The path ([sheetUUID, .., symbolUUID]) to search for.
* @return MODULE* - If found, the MODULE having the given uuid, else NULL. * @return FOOTPRINT* - If found, the FOOTPRINT having the given uuid, else NULL.
*/ */
MODULE* FindModuleByPath( const KIID_PATH& aPath ) const; FOOTPRINT* FindFootprintByPath( const KIID_PATH& aPath ) const;
/** /**
* @param aNames An array string to fill with net names. * @param aNames An array string to fill with net names.
@ -1082,7 +1083,7 @@ public:
* @param aVisibleOnly Search only the visible layers if true. * @param aVisibleOnly Search only the visible layers if true.
* @param aIgnoreLocked Ignore locked footprints when true. * @param aIgnoreLocked Ignore locked footprints when true.
*/ */
MODULE* GetFootprint( const wxPoint& aPosition, PCB_LAYER_ID aActiveLayer, FOOTPRINT* GetFootprint( const wxPoint& aPosition, PCB_LAYER_ID aActiveLayer,
bool aVisibleOnly, bool aIgnoreLocked = false ); bool aVisibleOnly, bool aIgnoreLocked = false );
/** /**

View File

@ -130,7 +130,7 @@ void BOARD_COMMIT::Push( const wxString& aMessage, bool aCreateUndoEntry, bool a
} }
savedModules.insert( ent.m_item ); savedModules.insert( ent.m_item );
static_cast<MODULE*>( ent.m_item )->SetLastEditTime(); static_cast<FOOTPRINT*>( ent.m_item )->SetLastEditTime();
} }
} }
@ -204,7 +204,7 @@ void BOARD_COMMIT::Push( const wxString& aMessage, bool aCreateUndoEntry, bool a
if( !( changeFlags & CHT_DONE ) ) if( !( changeFlags & CHT_DONE ) )
{ {
MODULE* footprint = static_cast<MODULE*>( boardItem->GetParent() ); FOOTPRINT* footprint = static_cast<FOOTPRINT*>( boardItem->GetParent() );
wxASSERT( footprint && footprint->Type() == PCB_FOOTPRINT_T ); wxASSERT( footprint && footprint->Type() == PCB_FOOTPRINT_T );
footprint->Delete( boardItem ); footprint->Delete( boardItem );
} }
@ -236,7 +236,7 @@ void BOARD_COMMIT::Push( const wxString& aMessage, bool aCreateUndoEntry, bool a
// No support for nested footprints (yet) // No support for nested footprints (yet)
wxASSERT( !m_isFootprintEditor ); wxASSERT( !m_isFootprintEditor );
MODULE* footprint = static_cast<MODULE*>( boardItem ); FOOTPRINT* footprint = static_cast<FOOTPRINT*>( boardItem );
view->Remove( footprint ); view->Remove( footprint );
footprint->ClearFlags(); footprint->ClearFlags();
@ -286,7 +286,8 @@ void BOARD_COMMIT::Push( const wxString& aMessage, bool aCreateUndoEntry, bool a
if( m_isFootprintEditor ) if( m_isFootprintEditor )
{ {
static_cast<MODULE*>( boardItem )->RunOnChildren( [&]( BOARD_ITEM* aChild ) static_cast<FOOTPRINT*>( boardItem )->RunOnChildren(
[&]( BOARD_ITEM* aChild )
{ {
view->Update( aChild ); view->Update( aChild );
}); });
@ -373,7 +374,7 @@ EDA_ITEM* BOARD_COMMIT::parentObject( EDA_ITEM* aItem ) const
return aItem->GetParent(); return aItem->GetParent();
case PCB_ZONE_T: case PCB_ZONE_T:
wxASSERT( !dynamic_cast<MODULE*>( aItem->GetParent() ) ); wxASSERT( !dynamic_cast<FOOTPRINT*>( aItem->GetParent() ) );
return aItem; return aItem;
default: default:

View File

@ -77,7 +77,7 @@ void BOARD::ConvertBrdLayerToPolygonalContours( PCB_LAYER_ID aLayer, SHAPE_POLY_
} }
// convert pads // convert pads
for( MODULE* footprint : m_footprints ) for( FOOTPRINT* footprint : m_footprints )
{ {
footprint->TransformPadsWithClearanceToPolygon( aOutlines, aLayer, 0, maxError, footprint->TransformPadsWithClearanceToPolygon( aOutlines, aLayer, 0, maxError,
ERROR_INSIDE ); ERROR_INSIDE );
@ -125,7 +125,7 @@ void BOARD::ConvertBrdLayerToPolygonalContours( PCB_LAYER_ID aLayer, SHAPE_POLY_
} }
void MODULE::TransformPadsWithClearanceToPolygon( SHAPE_POLY_SET& aCornerBuffer, void FOOTPRINT::TransformPadsWithClearanceToPolygon( SHAPE_POLY_SET& aCornerBuffer,
PCB_LAYER_ID aLayer, int aClearance, PCB_LAYER_ID aLayer, int aClearance,
int aMaxError, ERROR_LOC aErrorLoc, int aMaxError, ERROR_LOC aErrorLoc,
bool aSkipNPTHPadsWihNoCopper, bool aSkipNPTHPadsWihNoCopper,
@ -223,7 +223,7 @@ void MODULE::TransformPadsWithClearanceToPolygon( SHAPE_POLY_SET& aCornerBuffer,
* @aIncludeText = indicates footprint text items (reference, value, etc.) should be included * @aIncludeText = indicates footprint text items (reference, value, etc.) should be included
* in the outline * in the outline
*/ */
void MODULE::TransformFPShapesWithClearanceToPolygon( SHAPE_POLY_SET& aCornerBuffer, void FOOTPRINT::TransformFPShapesWithClearanceToPolygon( SHAPE_POLY_SET& aCornerBuffer,
PCB_LAYER_ID aLayer, int aClearance, PCB_LAYER_ID aLayer, int aClearance,
int aError, ERROR_LOC aErrorLoc, int aError, ERROR_LOC aErrorLoc,
bool aIncludeText, bool aIncludeText,
@ -455,7 +455,7 @@ void PCB_SHAPE::TransformShapeWithClearanceToPolygon( SHAPE_POLY_SET& aCornerBuf
{ {
// The polygon is expected to be a simple polygon // The polygon is expected to be a simple polygon
// not self intersecting, no hole. // not self intersecting, no hole.
MODULE* footprint = GetParentFootprint(); // NULL for items not in footprints FOOTPRINT* footprint = GetParentFootprint(); // NULL for items not in footprints
double orientation = footprint ? footprint->GetOrientation() : 0.0; double orientation = footprint ? footprint->GetOrientation() : 0.0;
wxPoint offset; wxPoint offset;

View File

@ -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* fp : GetBoard()->Footprints() ) for( FOOTPRINT* fp : GetBoard()->Footprints() )
{ {
bool valExist = false; bool valExist = false;

View File

@ -189,7 +189,7 @@ const KICAD_T GENERAL_COLLECTOR::Dimensions[] = {
SEARCH_RESULT GENERAL_COLLECTOR::Inspect( EDA_ITEM* testItem, void* testData ) SEARCH_RESULT GENERAL_COLLECTOR::Inspect( EDA_ITEM* testItem, void* testData )
{ {
BOARD_ITEM* item = (BOARD_ITEM*) testItem; BOARD_ITEM* item = (BOARD_ITEM*) testItem;
MODULE* footprint = nullptr; FOOTPRINT* footprint = nullptr;
PCB_GROUP* group = nullptr; PCB_GROUP* group = nullptr;
PAD* pad = nullptr; PAD* pad = nullptr;
bool pad_through = false; bool pad_through = false;
@ -206,7 +206,7 @@ SEARCH_RESULT GENERAL_COLLECTOR::Inspect( EDA_ITEM* testItem, void* testData )
{ {
case PCB_PAD_T: case PCB_PAD_T:
{ {
MODULE* footprint = (MODULE*) item->GetParent(); FOOTPRINT* footprint = (FOOTPRINT*) item->GetParent();
if( footprint->GetReference() == wxT( "Y2" ) ) if( footprint->GetReference() == wxT( "Y2" ) )
breakhere++; breakhere++;
@ -245,7 +245,7 @@ SEARCH_RESULT GENERAL_COLLECTOR::Inspect( EDA_ITEM* testItem, void* testData )
case PCB_FOOTPRINT_T: case PCB_FOOTPRINT_T:
{ {
MODULE* footprint = (MODULE*) item; FOOTPRINT* footprint = (FOOTPRINT*) item;
if( footprint->GetReference() == wxT( "C98" ) ) if( footprint->GetReference() == wxT( "C98" ) )
breakhere++; breakhere++;
@ -284,7 +284,7 @@ SEARCH_RESULT GENERAL_COLLECTOR::Inspect( EDA_ITEM* testItem, void* testData )
} }
else // smd, so use pads test after footprint test else // smd, so use pads test after footprint test
{ {
footprint = static_cast<MODULE*>( item->GetParent() ); footprint = static_cast<FOOTPRINT*>( item->GetParent() );
} }
break; break;
@ -300,7 +300,7 @@ SEARCH_RESULT GENERAL_COLLECTOR::Inspect( EDA_ITEM* testItem, void* testData )
break; break;
case PCB_FP_ZONE_T: case PCB_FP_ZONE_T:
footprint = static_cast<MODULE*>( item->GetParent() ); footprint = static_cast<FOOTPRINT*>( item->GetParent() );
// Fallthrough to get the zone as well // Fallthrough to get the zone as well
KI_FALLTHROUGH; KI_FALLTHROUGH;
@ -364,7 +364,7 @@ SEARCH_RESULT GENERAL_COLLECTOR::Inspect( EDA_ITEM* testItem, void* testData )
} }
// Extract the footprint since it could be hidden // Extract the footprint since it could be hidden
footprint = static_cast<MODULE*>( item->GetParent() ); footprint = static_cast<FOOTPRINT*>( item->GetParent() );
} }
break; break;
@ -373,7 +373,7 @@ SEARCH_RESULT GENERAL_COLLECTOR::Inspect( EDA_ITEM* testItem, void* testData )
break; break;
case PCB_FOOTPRINT_T: case PCB_FOOTPRINT_T:
footprint = static_cast<MODULE*>( item ); footprint = static_cast<FOOTPRINT*>( item );
break; break;
case PCB_GROUP_T: case PCB_GROUP_T:
@ -390,7 +390,7 @@ SEARCH_RESULT GENERAL_COLLECTOR::Inspect( EDA_ITEM* testItem, void* testData )
// common tests: // common tests:
if( footprint ) // true from case PCB_PAD_T, PCB_FP_TEXT_T, or PCB_MODULE_T if( footprint ) // true from case PCB_PAD_T, PCB_FP_TEXT_T, or PCB_FOOTPRINT_T
{ {
if( m_Guide->IgnoreFootprintsOnBack() && ( footprint->GetLayer() == B_Cu) ) if( m_Guide->IgnoreFootprintsOnBack() && ( footprint->GetLayer() == B_Cu) )
goto exit; goto exit;

View File

@ -309,12 +309,12 @@ public:
static const KICAD_T ModuleItems[]; static const KICAD_T ModuleItems[];
/** /**
* A scan list for only TRACKS * A scan list for only TRACKs
*/ */
static const KICAD_T Tracks[]; static const KICAD_T Tracks[];
/** /**
* A scan list for TRACKS, VIAS, MODULES * A scan list for TRACKs, VIAs, FOOTPRINTs
*/ */
static const KICAD_T LockableItems[]; static const KICAD_T LockableItems[];

View File

@ -46,7 +46,7 @@ bool CN_CONNECTIVITY_ALGO::Remove( BOARD_ITEM* aItem )
switch( aItem->Type() ) switch( aItem->Type() )
{ {
case PCB_FOOTPRINT_T: case PCB_FOOTPRINT_T:
for( PAD* pad : static_cast<MODULE*>( aItem )->Pads() ) for( PAD* pad : static_cast<FOOTPRINT*>( aItem )->Pads() )
{ {
m_itemMap[pad].MarkItemsAsInvalid(); m_itemMap[pad].MarkItemsAsInvalid();
m_itemMap.erase( pad ); m_itemMap.erase( pad );
@ -102,9 +102,9 @@ void CN_CONNECTIVITY_ALGO::markItemNetAsDirty( const BOARD_ITEM* aItem )
{ {
if( aItem->Type() == PCB_FOOTPRINT_T ) if( aItem->Type() == PCB_FOOTPRINT_T )
{ {
auto mod = static_cast <const MODULE*>( aItem ); const FOOTPRINT* footprint = static_cast<const FOOTPRINT*>( aItem );
for( auto pad : mod->Pads() ) for( PAD* pad : footprint->Pads() )
MarkNetAsDirty( pad->GetNetCode() ); MarkNetAsDirty( pad->GetNetCode() );
} }
} }
@ -125,7 +125,7 @@ bool CN_CONNECTIVITY_ALGO::Add( BOARD_ITEM* aItem )
break; break;
case PCB_FOOTPRINT_T: case PCB_FOOTPRINT_T:
for( PAD* pad : static_cast<MODULE*>( aItem )->Pads() ) for( PAD* pad : static_cast<FOOTPRINT*>( aItem )->Pads() )
{ {
if( m_itemMap.find( pad ) != m_itemMap.end() ) if( m_itemMap.find( pad ) != m_itemMap.end() )
return false; return false;
@ -423,7 +423,7 @@ 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* footprint : aBoard->Footprints() ) for( FOOTPRINT* footprint : aBoard->Footprints() )
size += footprint->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
@ -440,7 +440,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->Footprints() ) for( FOOTPRINT* footprint : aBoard->Footprints() )
{ {
for( PAD* pad : footprint->Pads() ) for( PAD* pad : footprint->Pads() )
{ {
@ -465,7 +465,7 @@ void CN_CONNECTIVITY_ALGO::Build( const std::vector<BOARD_ITEM*>& aItems )
break; break;
case PCB_FOOTPRINT_T: case PCB_FOOTPRINT_T:
for( PAD* pad : static_cast<MODULE*>( item )->Pads() ) for( PAD* pad : static_cast<FOOTPRINT*>( item )->Pads() )
Add( pad ); Add( pad );
break; break;

View File

@ -225,7 +225,7 @@ void CONNECTIVITY_DATA::BlockRatsnestItems( const std::vector<BOARD_ITEM*>& aIte
{ {
if( item->Type() == PCB_FOOTPRINT_T ) if( item->Type() == PCB_FOOTPRINT_T )
{ {
for( auto pad : static_cast<MODULE*>(item)->Pads() ) for( PAD* pad : static_cast<FOOTPRINT*>(item)->Pads() )
citems.push_back( pad ); citems.push_back( pad );
} }
else else
@ -656,11 +656,9 @@ void CONNECTIVITY_DATA::MarkItemNetAsDirty( BOARD_ITEM *aItem )
{ {
if ( aItem->Type() == PCB_FOOTPRINT_T) if ( aItem->Type() == PCB_FOOTPRINT_T)
{ {
for ( auto pad : static_cast<MODULE*>( aItem )->Pads() ) for( PAD* pad : static_cast<FOOTPRINT*>( aItem )->Pads() )
{
m_connAlgo->MarkNetAsDirty( pad->GetNetCode() ); m_connAlgo->MarkNetAsDirty( pad->GetNetCode() );
} }
}
if (aItem->IsConnected() ) if (aItem->IsConnected() )
{ {
m_connAlgo->MarkNetAsDirty( static_cast<BOARD_CONNECTED_ITEM*>( aItem )->GetNetCode() ); m_connAlgo->MarkNetAsDirty( static_cast<BOARD_CONNECTED_ITEM*>( aItem )->GetNetCode() );
@ -685,9 +683,9 @@ const std::vector<CN_EDGE> CONNECTIVITY_DATA::GetRatsnestForItems( std::vector<B
{ {
if( item->Type() == PCB_FOOTPRINT_T ) if( item->Type() == PCB_FOOTPRINT_T )
{ {
auto component = static_cast<MODULE*>( item ); FOOTPRINT* footprint = static_cast<FOOTPRINT*>( item );
for( auto pad : component->Pads() ) for( PAD* pad : footprint->Pads() )
{ {
nets.insert( pad->GetNetCode() ); nets.insert( pad->GetNetCode() );
item_set.insert( pad ); item_set.insert( pad );
@ -724,7 +722,7 @@ const std::vector<CN_EDGE> CONNECTIVITY_DATA::GetRatsnestForItems( std::vector<B
} }
const std::vector<CN_EDGE> CONNECTIVITY_DATA::GetRatsnestForComponent( MODULE* aComponent, bool aSkipInternalConnections ) const std::vector<CN_EDGE> CONNECTIVITY_DATA::GetRatsnestForComponent( FOOTPRINT* aComponent, bool aSkipInternalConnections )
{ {
std::set<int> nets; std::set<int> nets;
std::set<const PAD*> pads; std::set<const PAD*> pads;

View File

@ -51,7 +51,7 @@ class RN_DATA;
class RN_NET; class RN_NET;
class TRACK; class TRACK;
class PAD; class PAD;
class MODULE; class FOOTPRINT;
class PROGRESS_REPORTER; class PROGRESS_REPORTER;
struct CN_DISJOINT_NET_ENTRY struct CN_DISJOINT_NET_ENTRY
@ -267,7 +267,8 @@ public:
#ifndef SWIG #ifndef SWIG
const std::vector<CN_EDGE> GetRatsnestForItems( const std::vector<BOARD_ITEM*> aItems ); const std::vector<CN_EDGE> GetRatsnestForItems( const std::vector<BOARD_ITEM*> aItems );
const std::vector<CN_EDGE> GetRatsnestForComponent( MODULE* aComponent, bool aSkipInternalConnections = false ); const std::vector<CN_EDGE> GetRatsnestForComponent( FOOTPRINT* aComponent,
bool aSkipInternalConnections = false );
#endif #endif
std::shared_ptr<FROM_TO_CACHE> GetFromToCache() std::shared_ptr<FROM_TO_CACHE> GetFromToCache()

View File

@ -35,7 +35,7 @@ void FROM_TO_CACHE::buildEndpointList( )
{ {
m_ftEndpoints.clear(); m_ftEndpoints.clear();
for( MODULE* footprint : m_board->Footprints() ) for( FOOTPRINT* footprint : m_board->Footprints() )
{ {
for( PAD* pad : footprint->Pads() ) for( PAD* pad : footprint->Pads() )
{ {

View File

@ -901,7 +901,7 @@ void buildBoardBoundingBoxPoly( const BOARD* aBoard, SHAPE_POLY_SET& aOutline )
} }
bool isCopperOutside( const MODULE* aMod, SHAPE_POLY_SET& aShape ) bool isCopperOutside( const FOOTPRINT* aMod, SHAPE_POLY_SET& aShape )
{ {
bool padOutside = false; bool padOutside = false;
@ -1038,7 +1038,7 @@ bool BuildFootprintPolygonOutlines( BOARD* aBoard, SHAPE_POLY_SET& aOutlines,
bool success = ConvertOutlineToPolygon( segList, outlines, aTolerance, aErrorText, bool success = ConvertOutlineToPolygon( segList, outlines, aTolerance, aErrorText,
aDiscontinuities, aIntersections ); aDiscontinuities, aIntersections );
MODULE* footprint = aBoard->GetFirstFootprint(); FOOTPRINT* footprint = aBoard->GetFirstFootprint();
// No footprint loaded // No footprint loaded
if( !footprint ) if( !footprint )

View File

@ -68,7 +68,7 @@ void PCB_EDIT_FRAME::ExecuteRemoteCommand( const char* cmdline )
char* text; char* text;
int netcode = -1; int netcode = -1;
bool multiHighlight = false; bool multiHighlight = false;
MODULE* footprint = nullptr; FOOTPRINT* footprint = nullptr;
PAD* pad = nullptr; PAD* pad = nullptr;
BOARD* pcb = GetBoard(); BOARD* pcb = GetBoard();
@ -151,7 +151,7 @@ void PCB_EDIT_FRAME::ExecuteRemoteCommand( const char* cmdline )
modName = FROM_UTF8( text ); modName = FROM_UTF8( text );
footprint = pcb->FindModuleByReference( modName ); footprint = pcb->FindFootprintByReference( modName );
if( footprint ) if( footprint )
pad = footprint->FindPadByName( pinName ); pad = footprint->FindPadByName( pinName );
@ -174,7 +174,7 @@ void PCB_EDIT_FRAME::ExecuteRemoteCommand( const char* cmdline )
modName = FROM_UTF8( text ); modName = FROM_UTF8( text );
footprint = pcb->FindModuleByReference( modName ); footprint = pcb->FindFootprintByReference( modName );
if( footprint ) if( footprint )
msg.Printf( _( "%s found" ), modName ); msg.Printf( _( "%s found" ), modName );
@ -256,7 +256,7 @@ void PCB_EDIT_FRAME::ExecuteRemoteCommand( const char* cmdline )
for( TRACK* track : pcb->Tracks() ) for( TRACK* track : pcb->Tracks() )
merge_area( track ); merge_area( track );
for( MODULE* fp : pcb->Footprints() ) for( FOOTPRINT* fp : pcb->Footprints() )
{ {
for( PAD* p : fp->Pads() ) for( PAD* p : fp->Pads() )
merge_area( p ); merge_area( p );
@ -402,7 +402,7 @@ void PCB_EDIT_FRAME::ExecuteRemoteCommand( const char* cmdline )
std::string FormatProbeItem( BOARD_ITEM* aItem ) std::string FormatProbeItem( BOARD_ITEM* aItem )
{ {
MODULE* footprint; FOOTPRINT* footprint;
if( !aItem ) if( !aItem )
return "$CLEAR: \"HIGHLIGHTED\""; // message to clear highlight state return "$CLEAR: \"HIGHLIGHTED\""; // message to clear highlight state
@ -410,12 +410,12 @@ std::string FormatProbeItem( BOARD_ITEM* aItem )
switch( aItem->Type() ) switch( aItem->Type() )
{ {
case PCB_FOOTPRINT_T: case PCB_FOOTPRINT_T:
footprint = (MODULE*) aItem; footprint = (FOOTPRINT*) aItem;
return StrPrintf( "$PART: \"%s\"", TO_UTF8( footprint->GetReference() ) ); return StrPrintf( "$PART: \"%s\"", TO_UTF8( footprint->GetReference() ) );
case PCB_PAD_T: case PCB_PAD_T:
{ {
footprint = (MODULE*) aItem->GetParent(); footprint = static_cast<FOOTPRINT*>( aItem->GetParent() );
wxString pad = static_cast<PAD*>( aItem )->GetName(); wxString pad = static_cast<PAD*>( aItem )->GetName();
return StrPrintf( "$PART: \"%s\" $PAD: \"%s\"", return StrPrintf( "$PART: \"%s\" $PAD: \"%s\"",
@ -425,7 +425,7 @@ std::string FormatProbeItem( BOARD_ITEM* aItem )
case PCB_FP_TEXT_T: case PCB_FP_TEXT_T:
{ {
footprint = static_cast<MODULE*>( aItem->GetParent() ); footprint = static_cast<FOOTPRINT*>( aItem->GetParent() );
FP_TEXT* text = static_cast<FP_TEXT*>( aItem ); FP_TEXT* text = static_cast<FP_TEXT*>( aItem );
const char* text_key; const char* text_key;
@ -510,7 +510,7 @@ void PCB_EDIT_FRAME::KiwayMailIn( KIWAY_EXPRESS& mail )
NETLIST netlist; NETLIST netlist;
STRING_FORMATTER sf; STRING_FORMATTER sf;
for( MODULE* footprint : this->GetBoard()->Footprints() ) for( FOOTPRINT* footprint : this->GetBoard()->Footprints() )
{ {
COMPONENT* component = new COMPONENT( footprint->GetFPID(), footprint->GetReference(), COMPONENT* component = new COMPONENT( footprint->GetFPID(), footprint->GetReference(),
footprint->GetValue(), footprint->GetPath() ); footprint->GetValue(), footprint->GetPath() );

View File

@ -636,7 +636,7 @@ bool DIALOG_BOARD_REANNOTATE::ReannotateBoard()
if( m_UpdateSchematic->GetValue() ) if( m_UpdateSchematic->GetValue() )
{ //If updating schematic send a netlist { //If updating schematic send a netlist
for( MODULE* footprint : m_footprints ) for( FOOTPRINT* footprint : m_footprints )
{ // Create a netlist { // Create a netlist
newref = GetNewRefDes( footprint ); newref = GetNewRefDes( footprint );
@ -672,7 +672,7 @@ bool DIALOG_BOARD_REANNOTATE::ReannotateBoard()
if( reannotateOk )//Only update if no errors if( reannotateOk )//Only update if no errors
{ {
for( MODULE* footprint : m_footprints ) for( FOOTPRINT* footprint : m_footprints )
{ {
newref = GetNewRefDes( footprint ); newref = GetNewRefDes( footprint );
@ -743,7 +743,7 @@ bool DIALOG_BOARD_REANNOTATE::BuildFootprintList( std::vector<RefDesInfo>& aBadR
RefDesInfo fpData; RefDesInfo fpData;
bool useModuleLocation = m_locationChoice->GetSelection() == 0; bool useModuleLocation = m_locationChoice->GetSelection() == 0;
for( MODULE* footprint : m_footprints ) for( FOOTPRINT* footprint : m_footprints )
{ {
fpData.Uuid = footprint->m_Uuid; fpData.Uuid = footprint->m_Uuid;
fpData.RefDesString = footprint->GetReference(); fpData.RefDesString = footprint->GetReference();
@ -948,7 +948,7 @@ void DIALOG_BOARD_REANNOTATE::BuildChangeArray( std::vector<RefDesInfo>& aFootpr
// //
/// @returns the new refdes for this footprint /// @returns the new refdes for this footprint
RefDesChange* DIALOG_BOARD_REANNOTATE::GetNewRefDes( MODULE* aFootprint ) RefDesChange* DIALOG_BOARD_REANNOTATE::GetNewRefDes( FOOTPRINT* aFootprint )
{ {
size_t i; size_t i;

View File

@ -105,7 +105,7 @@ public:
private: private:
PCB_EDIT_FRAME* m_frame; PCB_EDIT_FRAME* m_frame;
MODULES m_footprints; FOOTPRINTS m_footprints;
PCB_SCREEN* m_screen; PCB_SCREEN* m_screen;
PCBNEW_SELECTION m_selection; PCBNEW_SELECTION m_selection;
@ -181,7 +181,7 @@ private:
wxString aPrefix, bool aRemovePrefix, wxString aPrefix, bool aRemovePrefix,
std::vector<RefDesInfo>& aBadRefDes ); std::vector<RefDesInfo>& aBadRefDes );
RefDesChange* GetNewRefDes( MODULE* aFootprint ); RefDesChange* GetNewRefDes( FOOTPRINT* aFootprint );
int RoundToGrid( int aCoord, int aGrid ); int RoundToGrid( int aCoord, int aGrid );
wxString CoordTowxString( int aX, int aY ); wxString CoordTowxString( int aX, int aY );

View File

@ -181,7 +181,7 @@ 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* footprint : board->Footprints() ) for( FOOTPRINT* 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() && ! footprint->Pads().size() ) if( m_checkBoxExcludeComponentsNoPins->GetValue() && ! footprint->Pads().size() )

View File

@ -42,7 +42,7 @@ class wxTimer;
class PCB_BASE_FRAME; class PCB_BASE_FRAME;
class LIB_TREE; class LIB_TREE;
class MODULE; class FOOTPRINT;
/** /**

View File

@ -84,7 +84,7 @@ void DIALOG_CLEANUP_GRAPHICS::doCleanup( bool aDryRun )
BOARD_COMMIT commit( m_parentFrame ); BOARD_COMMIT commit( m_parentFrame );
BOARD* board = m_parentFrame->GetBoard(); BOARD* board = m_parentFrame->GetBoard();
MODULE* fp = m_isFootprintEditor ? board->GetFirstFootprint() : nullptr; FOOTPRINT* fp = m_isFootprintEditor ? board->GetFirstFootprint() : nullptr;
GRAPHICS_CLEANER cleaner( fp ? fp->GraphicalItems() : board->Drawings(), fp, commit ); GRAPHICS_CLEANER cleaner( fp ? fp->GraphicalItems() : board->Drawings(), fp, commit );
if( !aDryRun ) if( !aDryRun )

View File

@ -52,7 +52,7 @@ int DIALOG_FOOTPRINT_FP_EDITOR::m_page = 0; // remember the last open page d
DIALOG_FOOTPRINT_FP_EDITOR::DIALOG_FOOTPRINT_FP_EDITOR( FOOTPRINT_EDIT_FRAME* aParent, DIALOG_FOOTPRINT_FP_EDITOR::DIALOG_FOOTPRINT_FP_EDITOR( FOOTPRINT_EDIT_FRAME* aParent,
MODULE* aFootprint ) : FOOTPRINT* aFootprint ) :
DIALOG_FOOTPRINT_FP_EDITOR_BASE( aParent ), DIALOG_FOOTPRINT_FP_EDITOR_BASE( aParent ),
m_netClearance( aParent, m_NetClearanceLabel, m_NetClearanceCtrl, m_NetClearanceUnits, true ), m_netClearance( aParent, m_NetClearanceLabel, m_NetClearanceCtrl, m_NetClearanceUnits, true ),
m_solderMask( aParent, m_SolderMaskMarginLabel, m_SolderMaskMarginCtrl, m_SolderMaskMarginUnits ), m_solderMask( aParent, m_SolderMaskMarginLabel, m_SolderMaskMarginCtrl, m_SolderMaskMarginUnits ),
@ -526,10 +526,10 @@ bool DIALOG_FOOTPRINT_FP_EDITOR::checkFootprintName( const wxString& aFootprintN
m_delayedErrorMessage = _( "Footprint must have a name." ); m_delayedErrorMessage = _( "Footprint must have a name." );
return false; return false;
} }
else if( !MODULE::IsLibNameValid( aFootprintName ) ) else if( !FOOTPRINT::IsLibNameValid( aFootprintName ) )
{ {
m_delayedErrorMessage.Printf( _( "Footprint name may not contain \"%s\"." ), m_delayedErrorMessage.Printf( _( "Footprint name may not contain \"%s\"." ),
MODULE::StringLibNameInvalidChars( true ) ); FOOTPRINT::StringLibNameInvalidChars( true ) );
return false; return false;
} }
@ -709,7 +709,7 @@ bool DIALOG_FOOTPRINT_FP_EDITOR::TransferDataFromWindow()
} }
static bool footprintIsFromBoard( MODULE* aFootprint ) static bool footprintIsFromBoard( FOOTPRINT* aFootprint )
{ {
return aFootprint->GetLink() != niluuid; return aFootprint->GetLink() != niluuid;
} }

View File

@ -40,7 +40,7 @@ class DIALOG_FOOTPRINT_FP_EDITOR : public DIALOG_FOOTPRINT_FP_EDITOR_BASE
{ {
private: private:
FOOTPRINT_EDIT_FRAME* m_frame; FOOTPRINT_EDIT_FRAME* m_frame;
MODULE* m_footprint; FOOTPRINT* m_footprint;
static int m_page; // remember the last open page during session static int m_page; // remember the last open page during session
@ -65,7 +65,7 @@ private:
public: public:
// Constructor and destructor // Constructor and destructor
DIALOG_FOOTPRINT_FP_EDITOR( FOOTPRINT_EDIT_FRAME* aParent, MODULE* aFootprint ); DIALOG_FOOTPRINT_FP_EDITOR( FOOTPRINT_EDIT_FRAME* aParent, FOOTPRINT* aFootprint );
~DIALOG_FOOTPRINT_FP_EDITOR() override; ~DIALOG_FOOTPRINT_FP_EDITOR() override;
bool Validate() override; bool Validate() override;

View File

@ -57,7 +57,7 @@ bool g_reset3DModels[2] = { false, true };
DIALOG_EXCHANGE_FOOTPRINTS::DIALOG_EXCHANGE_FOOTPRINTS( PCB_EDIT_FRAME* aParent, DIALOG_EXCHANGE_FOOTPRINTS::DIALOG_EXCHANGE_FOOTPRINTS( PCB_EDIT_FRAME* aParent,
MODULE* aFootprint, FOOTPRINT* aFootprint,
bool updateMode, bool selectedMode ) : bool updateMode, bool selectedMode ) :
DIALOG_EXCHANGE_FOOTPRINTS_BASE( aParent ), DIALOG_EXCHANGE_FOOTPRINTS_BASE( aParent ),
m_commit( aParent ), m_commit( aParent ),
@ -169,7 +169,7 @@ DIALOG_EXCHANGE_FOOTPRINTS::~DIALOG_EXCHANGE_FOOTPRINTS()
} }
bool DIALOG_EXCHANGE_FOOTPRINTS::isMatch( MODULE* aFootprint ) bool DIALOG_EXCHANGE_FOOTPRINTS::isMatch( FOOTPRINT* aFootprint )
{ {
LIB_ID specifiedID; LIB_ID specifiedID;
@ -351,7 +351,7 @@ bool DIALOG_EXCHANGE_FOOTPRINTS::processMatchingFootprints()
} }
bool DIALOG_EXCHANGE_FOOTPRINTS::processFootprint( MODULE* aFootprint, const LIB_ID& aNewFPID ) bool DIALOG_EXCHANGE_FOOTPRINTS::processFootprint( FOOTPRINT* aFootprint, const LIB_ID& aNewFPID )
{ {
LIB_ID oldFPID = aFootprint->GetFPID(); LIB_ID oldFPID = aFootprint->GetFPID();
wxString msg; wxString msg;
@ -363,7 +363,7 @@ bool DIALOG_EXCHANGE_FOOTPRINTS::processFootprint( MODULE* aFootprint, const LIB
oldFPID.Format().c_str(), oldFPID.Format().c_str(),
aNewFPID.Format().c_str() ); aNewFPID.Format().c_str() );
MODULE* newFootprint = m_parent->LoadFootprint( aNewFPID ); FOOTPRINT* newFootprint = m_parent->LoadFootprint( aNewFPID );
if( !newFootprint ) if( !newFootprint )
{ {
@ -411,7 +411,7 @@ void processTextItem( const FP_TEXT& aSrc, FP_TEXT& aDest,
} }
FP_TEXT* getMatchingTextItem( FP_TEXT* aRefItem, MODULE* aFootprint ) FP_TEXT* getMatchingTextItem( FP_TEXT* aRefItem, FOOTPRINT* aFootprint )
{ {
std::vector<FP_TEXT*> candidates; std::vector<FP_TEXT*> candidates;
@ -459,10 +459,10 @@ FP_TEXT* getMatchingTextItem( FP_TEXT* aRefItem, MODULE* aFootprint )
} }
void PCB_EDIT_FRAME::ExchangeFootprint( MODULE* aExisting, MODULE* aNew, BOARD_COMMIT& aCommit, void PCB_EDIT_FRAME::ExchangeFootprint( FOOTPRINT* aExisting, FOOTPRINT* aNew,
bool deleteExtraTexts, bool resetTextLayers, BOARD_COMMIT& aCommit, bool deleteExtraTexts,
bool resetTextEffects, bool resetFabricationAttrs, bool resetTextLayers, bool resetTextEffects,
bool reset3DModels ) bool resetFabricationAttrs, bool reset3DModels )
{ {
PCB_GROUP* parentGroup = aExisting->GetParentGroup(); PCB_GROUP* parentGroup = aExisting->GetParentGroup();

View File

@ -30,7 +30,7 @@
#include <board_commit.h> #include <board_commit.h>
class PCB_EDIT_FRAME; class PCB_EDIT_FRAME;
class MODULE; class FOOTPRINT;
class LIB_ID; class LIB_ID;
class DIALOG_EXCHANGE_FOOTPRINTS : public DIALOG_EXCHANGE_FOOTPRINTS_BASE class DIALOG_EXCHANGE_FOOTPRINTS : public DIALOG_EXCHANGE_FOOTPRINTS_BASE
@ -38,12 +38,12 @@ class DIALOG_EXCHANGE_FOOTPRINTS : public DIALOG_EXCHANGE_FOOTPRINTS_BASE
private: private:
BOARD_COMMIT m_commit; BOARD_COMMIT m_commit;
PCB_EDIT_FRAME* m_parent; PCB_EDIT_FRAME* m_parent;
MODULE* m_currentFootprint; FOOTPRINT* m_currentFootprint;
bool m_updateMode; bool m_updateMode;
int* m_matchMode; int* m_matchMode;
public: public:
DIALOG_EXCHANGE_FOOTPRINTS( PCB_EDIT_FRAME* aParent, MODULE* aFootprint, bool updateMode, DIALOG_EXCHANGE_FOOTPRINTS( PCB_EDIT_FRAME* aParent, FOOTPRINT* aFootprint, bool updateMode,
bool selectedMode ); bool selectedMode );
~DIALOG_EXCHANGE_FOOTPRINTS() override; ~DIALOG_EXCHANGE_FOOTPRINTS() override;
@ -59,9 +59,9 @@ private:
wxRadioButton* getRadioButtonForMode(); wxRadioButton* getRadioButtonForMode();
bool isMatch( MODULE* ); bool isMatch( FOOTPRINT* );
bool processMatchingFootprints(); bool processMatchingFootprints();
bool processFootprint( MODULE* aFootprint, const LIB_ID& aNewFPID ); bool processFootprint( FOOTPRINT* aFootprint, const LIB_ID& aNewFPID );
}; };
#endif // DIALOG_EXCHANGE_FOOTPRINTS_H_ #endif // DIALOG_EXCHANGE_FOOTPRINTS_H_

View File

@ -220,7 +220,7 @@ void DIALOG_FIND::search( bool aDirection )
if( FindIncludeTexts || FindIncludeValues || FindIncludeReferences ) if( FindIncludeTexts || FindIncludeValues || FindIncludeReferences )
{ {
for( MODULE* fp : m_frame->GetBoard()->Footprints() ) for( FOOTPRINT* fp : m_frame->GetBoard()->Footprints() )
{ {
if( ( fp->Reference().Matches( m_frame->GetFindReplaceData(), nullptr ) if( ( fp->Reference().Matches( m_frame->GetFindReplaceData(), nullptr )
&& FindIncludeReferences ) && FindIncludeReferences )

View File

@ -51,7 +51,7 @@ int DIALOG_FOOTPRINT_PROPERTIES::m_page = 0; // remember the last open page
DIALOG_FOOTPRINT_PROPERTIES::DIALOG_FOOTPRINT_PROPERTIES( PCB_EDIT_FRAME* aParent, DIALOG_FOOTPRINT_PROPERTIES::DIALOG_FOOTPRINT_PROPERTIES( PCB_EDIT_FRAME* aParent,
MODULE* aFootprint ) : FOOTPRINT* aFootprint ) :
DIALOG_FOOTPRINT_PROPERTIES_BASE( aParent ), DIALOG_FOOTPRINT_PROPERTIES_BASE( aParent ),
m_posX( aParent, m_XPosLabel, m_ModPositionX, m_XPosUnit ), m_posX( aParent, m_XPosLabel, m_ModPositionX, m_XPosUnit ),
m_posY( aParent, m_YPosLabel, m_ModPositionY, m_YPosUnit ), m_posY( aParent, m_YPosLabel, m_ModPositionY, m_YPosUnit ),

View File

@ -42,7 +42,7 @@ class DIALOG_FOOTPRINT_PROPERTIES: public DIALOG_FOOTPRINT_PROPERTIES_BASE
{ {
private: private:
PCB_EDIT_FRAME* m_frame; PCB_EDIT_FRAME* m_frame;
MODULE* m_footprint; FOOTPRINT* m_footprint;
static int m_page; // remember the last open page during session static int m_page; // remember the last open page during session
@ -81,7 +81,7 @@ public:
public: public:
// Constructor and destructor // Constructor and destructor
DIALOG_FOOTPRINT_PROPERTIES( PCB_EDIT_FRAME* aParent, MODULE* aFootprint ); DIALOG_FOOTPRINT_PROPERTIES( PCB_EDIT_FRAME* aParent, FOOTPRINT* aFootprint );
~DIALOG_FOOTPRINT_PROPERTIES() override; ~DIALOG_FOOTPRINT_PROPERTIES() override;
bool Validate() override; bool Validate() override;

View File

@ -139,7 +139,7 @@ void DIALOG_GENDRILL::InitDisplayParams()
m_microViasCount = 0; m_microViasCount = 0;
m_blindOrBuriedViasCount = 0; m_blindOrBuriedViasCount = 0;
for( MODULE* footprint : m_board->Footprints() ) for( FOOTPRINT* footprint : m_board->Footprints() )
{ {
for( PAD* pad : footprint->Pads() ) for( PAD* pad : footprint->Pads() )
{ {

View File

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

View File

@ -343,7 +343,7 @@ void DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::visitItem( BOARD_COMMIT& aCommit, BOA
if( m_referenceFilterOpt->GetValue() && !m_referenceFilter->GetValue().IsEmpty() ) if( m_referenceFilterOpt->GetValue() && !m_referenceFilter->GetValue().IsEmpty() )
{ {
MODULE* fp = dynamic_cast<MODULE*>( aItem->GetParent() ); FOOTPRINT* fp = dynamic_cast<FOOTPRINT*>( aItem->GetParent() );
if( fp ) if( fp )
{ {
@ -354,7 +354,7 @@ void DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::visitItem( BOARD_COMMIT& aCommit, BOA
if( m_footprintFilterOpt->GetValue() && !m_footprintFilter->GetValue().IsEmpty() ) if( m_footprintFilterOpt->GetValue() && !m_footprintFilter->GetValue().IsEmpty() )
{ {
MODULE* fp = dynamic_cast<MODULE*>( aItem->GetParent() ); FOOTPRINT* fp = dynamic_cast<FOOTPRINT*>( aItem->GetParent() );
if( fp ) if( fp )
{ {
@ -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()->Footprints() ) for( FOOTPRINT* fp : m_parent->GetBoard()->Footprints() )
{ {
if( m_references->GetValue() ) if( m_references->GetValue() )
visitItem( commit, &fp->Reference() ); visitItem( commit, &fp->Reference() );

View File

@ -1154,7 +1154,7 @@ void DIALOG_NET_INSPECTOR::OnBoardItemAdded( BOARD& aBoard, BOARD_ITEM* aBoardIt
// resort to generic slower net update otherwise. // resort to generic slower net update otherwise.
updateNet( i->GetNet() ); updateNet( i->GetNet() );
} }
else if( MODULE* footprint = dynamic_cast<MODULE*>( aBoardItem ) ) else if( FOOTPRINT* footprint = dynamic_cast<FOOTPRINT*>( aBoardItem ) )
{ {
for( const PAD* pad : footprint->Pads() ) for( const PAD* pad : footprint->Pads() )
{ {
@ -1193,7 +1193,7 @@ void DIALOG_NET_INSPECTOR::OnBoardItemRemoved( BOARD& aBoard, BOARD_ITEM* aBoard
{ {
m_data_model->deleteItem( m_data_model->findItem( net ) ); m_data_model->deleteItem( m_data_model->findItem( net ) );
} }
else if( MODULE* footprint = dynamic_cast<MODULE*>( aBoardItem ) ) else if( FOOTPRINT* footprint = dynamic_cast<FOOTPRINT*>( aBoardItem ) )
{ {
for( const PAD* pad : footprint->Pads() ) for( const PAD* pad : footprint->Pads() )
{ {
@ -1244,7 +1244,7 @@ void DIALOG_NET_INSPECTOR::OnBoardItemRemoved( BOARD& aBoard, BOARD_ITEM* aBoard
void DIALOG_NET_INSPECTOR::OnBoardItemChanged( BOARD& aBoard, BOARD_ITEM* aBoardItem ) void DIALOG_NET_INSPECTOR::OnBoardItemChanged( BOARD& aBoard, BOARD_ITEM* aBoardItem )
{ {
if( dynamic_cast<BOARD_CONNECTED_ITEM*>( aBoardItem ) != nullptr if( dynamic_cast<BOARD_CONNECTED_ITEM*>( aBoardItem ) != nullptr
|| dynamic_cast<MODULE*>( aBoardItem ) != nullptr ) || dynamic_cast<FOOTPRINT*>( aBoardItem ) != nullptr )
{ {
buildNetsList(); buildNetsList();
m_netsList->Refresh(); m_netsList->Refresh();
@ -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 footprints' pads is faster. // iterating over the footprints' pads is faster.
for( MODULE* footprint : m_brd->Footprints() ) for( FOOTPRINT* footprint : m_brd->Footprints() )
{ {
for( PAD* pad : footprint->Pads() ) for( PAD* pad : footprint->Pads() )
{ {

View File

@ -31,7 +31,7 @@
#include <dialog_netlist_base.h> #include <dialog_netlist_base.h>
class MODULE; class FOOTPRINT;
class NETLIST; class NETLIST;

View File

@ -156,7 +156,7 @@ DIALOG_PAD_PROPERTIES::DIALOG_PAD_PROPERTIES( PCB_BASE_FRAME* aParent, PAD* aPad
m_nonCopperWarningIcon->SetBitmap( KiBitmap( dialog_warning_xpm ) ); m_nonCopperWarningIcon->SetBitmap( KiBitmap( dialog_warning_xpm ) );
m_padMaster = &m_parent->GetDesignSettings().m_Pad_Master; m_padMaster = &m_parent->GetDesignSettings().m_Pad_Master;
m_dummyPad = new PAD((MODULE*) NULL ); m_dummyPad = new PAD( (FOOTPRINT*) NULL );
if( aPad ) if( aPad )
{ {
@ -462,7 +462,7 @@ void DIALOG_PAD_PROPERTIES::initValues()
m_isFlipped = m_currentPad->IsFlipped(); m_isFlipped = m_currentPad->IsFlipped();
// Diplay parent footprint info // Diplay parent footprint info
MODULE* footprint = m_currentPad->GetParent(); FOOTPRINT* footprint = m_currentPad->GetParent();
if( footprint ) if( footprint )
{ {
@ -479,7 +479,7 @@ void DIALOG_PAD_PROPERTIES::initValues()
if( m_currentPad ) if( m_currentPad )
{ {
MODULE* footprint = m_currentPad->GetParent(); FOOTPRINT* footprint = m_currentPad->GetParent();
if( footprint ) if( footprint )
{ {
@ -1523,7 +1523,7 @@ bool DIALOG_PAD_PROPERTIES::TransferDataFromWindow()
m_currentPad->SetOrientation( m_padMaster->GetOrientation() ); m_currentPad->SetOrientation( m_padMaster->GetOrientation() );
wxSize size; wxSize size;
MODULE* footprint = m_currentPad->GetParent(); FOOTPRINT* footprint = m_currentPad->GetParent();
m_currentPad->SetSize( m_padMaster->GetSize() ); m_currentPad->SetSize( m_padMaster->GetSize() );

View File

@ -249,7 +249,7 @@ bool DIALOG_TEXT_PROPERTIES::TransferDataToWindow()
if( m_item->Type() == PCB_FP_TEXT_T && m_fpText ) if( m_item->Type() == PCB_FP_TEXT_T && m_fpText )
{ {
MODULE* footprint = dynamic_cast<MODULE*>( m_fpText->GetParent() ); FOOTPRINT* footprint = dynamic_cast<FOOTPRINT*>( m_fpText->GetParent() );
wxString msg; wxString msg;
if( footprint ) if( footprint )

View File

@ -103,7 +103,7 @@ bool DIALOG_UNUSED_PAD_LAYERS::TransferDataFromWindow()
if( item->Type() == PCB_FOOTPRINT_T && m_rbScope->GetSelection() == SCOPE_PADS ) if( item->Type() == PCB_FOOTPRINT_T && m_rbScope->GetSelection() == SCOPE_PADS )
{ {
MODULE* footprint = static_cast<MODULE*>( item ); FOOTPRINT* footprint = static_cast<FOOTPRINT*>( item );
for( PAD* pad : footprint->Pads() ) for( PAD* pad : footprint->Pads() )
{ {
@ -125,7 +125,7 @@ bool DIALOG_UNUSED_PAD_LAYERS::TransferDataFromWindow()
{ {
if( m_rbScope->GetSelection() == SCOPE_PADS ) if( m_rbScope->GetSelection() == SCOPE_PADS )
{ {
for( MODULE* footprint : m_frame->GetBoard()->Footprints() ) for( FOOTPRINT* footprint : m_frame->GetBoard()->Footprints() )
{ {
m_commit.Modify( footprint ); m_commit.Modify( footprint );

View File

@ -365,7 +365,7 @@ void DRC_ENGINE::loadImplicitRules()
keepoutZones.push_back( zone ); keepoutZones.push_back( zone );
} }
for( MODULE* footprint : m_board->Footprints() ) for( FOOTPRINT* 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* footprint : m_board->Footprints() ) for( FOOTPRINT* footprint : m_board->Footprints() )
{ {
for( ZONE* zone : footprint->Zones() ) for( ZONE* zone : footprint->Zones() )
zone->CacheBoundingBox(); zone->CacheBoundingBox();

View File

@ -228,7 +228,7 @@ int DRC_TEST_PROVIDER::forEachGeometryItem( const std::vector<KICAD_T>& aTypes,
} }
} }
for( MODULE* footprint : brd->Footprints() ) for( FOOTPRINT* footprint : brd->Footprints() )
{ {
if( typeMask[ PCB_FP_TEXT_T ] ) if( typeMask[ PCB_FP_TEXT_T ] )
{ {

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->Footprints() ) for( FOOTPRINT* footprint : m_board->Footprints() )
{ {
for( ZONE* zone : footprint->Zones() ) for( ZONE* zone : footprint->Zones() )
{ {
@ -513,14 +513,14 @@ void DRC_TEST_PROVIDER_COPPER_CLEARANCE::testPadClearances( )
size_t count = 0; size_t count = 0;
for( MODULE* footprint : m_board->Footprints() ) for( FOOTPRINT* footprint : m_board->Footprints() )
count += footprint->Pads().size(); count += footprint->Pads().size();
reportAux( "Testing %d pads...", count ); reportAux( "Testing %d pads...", count );
int ii = 0; int ii = 0;
for( MODULE* footprint : m_board->Footprints() ) for( FOOTPRINT* footprint : m_board->Footprints() )
{ {
for( PAD* pad : footprint->Pads() ) for( PAD* pad : footprint->Pads() )
{ {

View File

@ -82,7 +82,7 @@ void DRC_TEST_PROVIDER_COURTYARD_CLEARANCE::testFootprintCourtyardDefinitions()
int ii = 0; int ii = 0;
for( MODULE* footprint : m_board->Footprints() ) for( FOOTPRINT* footprint : m_board->Footprints() )
{ {
if( !reportProgress( ii++, m_board->Footprints().size(), delta ) ) if( !reportProgress( ii++, m_board->Footprints().size(), delta ) )
return; return;
@ -136,7 +136,7 @@ void DRC_TEST_PROVIDER_COURTYARD_CLEARANCE::testOverlappingComponentCourtyards()
if( m_drcEngine->IsErrorLimitExceeded( DRCE_OVERLAPPING_FOOTPRINTS) ) if( m_drcEngine->IsErrorLimitExceeded( DRCE_OVERLAPPING_FOOTPRINTS) )
break; break;
MODULE* footprint = *it1; FOOTPRINT* footprint = *it1;
SHAPE_POLY_SET& footprintFront = footprint->GetPolyCourtyardFront(); SHAPE_POLY_SET& footprintFront = footprint->GetPolyCourtyardFront();
SHAPE_POLY_SET& footprintBack = footprint->GetPolyCourtyardBack(); SHAPE_POLY_SET& footprintBack = footprint->GetPolyCourtyardBack();
@ -145,7 +145,7 @@ void DRC_TEST_PROVIDER_COURTYARD_CLEARANCE::testOverlappingComponentCourtyards()
for( auto it2 = it1 + 1; it2 != m_board->Footprints().end(); it2++ ) for( auto it2 = it1 + 1; it2 != m_board->Footprints().end(); it2++ )
{ {
MODULE* test = *it2; FOOTPRINT* test = *it2;
SHAPE_POLY_SET& testFront = test->GetPolyCourtyardFront(); SHAPE_POLY_SET& testFront = test->GetPolyCourtyardFront();
SHAPE_POLY_SET& testBack = test->GetPolyCourtyardBack(); SHAPE_POLY_SET& testBack = test->GetPolyCourtyardBack();
SHAPE_POLY_SET intersection; SHAPE_POLY_SET intersection;

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->Footprints() ) for( FOOTPRINT* footprint : m_board->Footprints() )
{ {
for( PAD* pad : footprint->Pads() ) for( PAD* pad : footprint->Pads() )
{ {

View File

@ -81,7 +81,7 @@ bool DRC_TEST_PROVIDER_HOLE_SIZE::Run()
m_board = m_drcEngine->GetBoard(); m_board = m_drcEngine->GetBoard();
for( MODULE* footprint : m_board->Footprints() ) for( FOOTPRINT* footprint : m_board->Footprints() )
{ {
if( m_drcEngine->IsErrorLimitExceeded( DRCE_TOO_SMALL_DRILL ) ) if( m_drcEngine->IsErrorLimitExceeded( DRCE_TOO_SMALL_DRILL ) )
break; break;

View File

@ -80,15 +80,15 @@ void DRC_TEST_PROVIDER_LVS::testFootprints( NETLIST& aNetlist )
{ {
BOARD* board = m_drcEngine->GetBoard(); BOARD* board = m_drcEngine->GetBoard();
auto compare = []( const MODULE* x, const MODULE* y ) auto compare = []( const FOOTPRINT* x, const FOOTPRINT* y )
{ {
return x->GetReference().CmpNoCase( y->GetReference() ) < 0; return x->GetReference().CmpNoCase( y->GetReference() ) < 0;
}; };
auto footprints = std::set<MODULE*, decltype( compare )>( compare ); auto footprints = std::set<FOOTPRINT*, decltype( compare )>( compare );
// Search for duplicate footprints on the board // Search for duplicate footprints on the board
for( MODULE* footprint : board->Footprints() ) for( FOOTPRINT* footprint : board->Footprints() )
{ {
if( m_drcEngine->IsErrorLimitExceeded( DRCE_DUPLICATE_FOOTPRINT ) ) if( m_drcEngine->IsErrorLimitExceeded( DRCE_DUPLICATE_FOOTPRINT ) )
break; break;
@ -108,7 +108,7 @@ 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* footprint = board->FindModuleByReference( component->GetReference() ); FOOTPRINT* footprint = board->FindFootprintByReference( component->GetReference());
if( footprint == nullptr ) if( footprint == nullptr )
{ {
@ -188,7 +188,7 @@ void DRC_TEST_PROVIDER_LVS::testFootprints( NETLIST& aNetlist )
} }
// Search for component footprints found on board but not in netlist. // Search for component footprints found on board but not in netlist.
for( MODULE* footprint : board->Footprints() ) for( FOOTPRINT* footprint : board->Footprints() )
{ {
if( m_drcEngine->IsErrorLimitExceeded( DRCE_EXTRA_FOOTPRINT ) ) if( m_drcEngine->IsErrorLimitExceeded( DRCE_EXTRA_FOOTPRINT ) )
break; break;

View File

@ -167,8 +167,8 @@ bool DRC_TEST_PROVIDER_SILK_CLEARANCE::Run()
if( refGraphic && testGraphic ) if( refGraphic && testGraphic )
{ {
MODULE *refParentFP = dynamic_cast<MODULE*>( refGraphic->GetParent() ); FOOTPRINT *refParentFP = dynamic_cast<FOOTPRINT*>( refGraphic->GetParent() );
MODULE *testParentFP = dynamic_cast<MODULE*>( testGraphic->GetParent() ); FOOTPRINT *testParentFP = dynamic_cast<FOOTPRINT*>( testGraphic->GetParent() );
if( refParentFP == testParentFP ) // also true when both are nullptr if( refParentFP == testParentFP ) // also true when both are nullptr
return true; return true;

View File

@ -131,7 +131,7 @@ void PCB_EDIT_FRAME::OnEditItemRequest( BOARD_ITEM* aItem )
break; break;
case PCB_FOOTPRINT_T: case PCB_FOOTPRINT_T:
ShowFootprintPropertiesDialog( static_cast<MODULE*>( aItem ) ); ShowFootprintPropertiesDialog( static_cast<FOOTPRINT*>( aItem ) );
break; break;
case PCB_TARGET_T: case PCB_TARGET_T:

View File

@ -94,7 +94,7 @@ 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( MODULE* footprint : aPcb->Footprints() ) for( FOOTPRINT* footprint : aPcb->Footprints() )
{ {
for( PAD* pad : footprint->Pads() ) for( PAD* pad : footprint->Pads() )
{ {

View File

@ -39,7 +39,7 @@ 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( MODULE* fp : aBrd->Footprints() ) for( FOOTPRINT* fp : aBrd->Footprints() )
{ {
fprintf( cmpFile, "\nBeginCmp\n" ); fprintf( cmpFile, "\nBeginCmp\n" );
fprintf( cmpFile, "TimeStamp = %s\n", TO_UTF8( fp->m_Uuid.AsString() ) ); fprintf( cmpFile, "TimeStamp = %s\n", TO_UTF8( fp->m_Uuid.AsString() ) );

View File

@ -35,7 +35,7 @@
class LIST_MOD // An helper class used to build a list of useful footprints. class LIST_MOD // An helper class used to build a list of useful footprints.
{ {
public: public:
MODULE* m_Footprint; // Link to the actual footprint FOOTPRINT* m_Footprint; // Link to the actual footprint
wxString m_Reference; // Its schematic reference wxString m_Reference; // Its schematic reference
wxString m_Value; // Its schematic value wxString m_Value; // Its schematic value
LAYER_NUM m_Layer; // its side (B_Cu, or F_Cu) LAYER_NUM m_Layer; // its side (B_Cu, or F_Cu)
@ -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->Footprints() ) for( FOOTPRINT* footprint : m_board->Footprints() )
{ {
if( m_side != PCB_BOTH_SIDES ) if( m_side != PCB_BOTH_SIDES )
{ {
@ -303,18 +303,18 @@ std::string PLACE_FILE_EXPORTER::GenReportData()
buffer += "$EndBOARD\n\n"; buffer += "$EndBOARD\n\n";
std::vector<MODULE*> sortedFootprints; std::vector<FOOTPRINT*> sortedFootprints;
for( MODULE* footprint : m_board->Footprints() ) for( FOOTPRINT* footprint : m_board->Footprints() )
sortedFootprints.push_back( footprint ); sortedFootprints.push_back( footprint );
std::sort( sortedFootprints.begin(), sortedFootprints.end(), std::sort( sortedFootprints.begin(), sortedFootprints.end(),
[]( MODULE* a, MODULE* b ) -> bool []( FOOTPRINT* a, FOOTPRINT* b ) -> bool
{ {
return StrNumCmp( a->GetReference(), b->GetReference(), true ) < 0; return StrNumCmp( a->GetReference(), b->GetReference(), true ) < 0;
}); });
for( MODULE* footprint : sortedFootprints ) for( FOOTPRINT* footprint : sortedFootprints )
{ {
wxString ref = footprint->Reference().GetShownText(); wxString ref = footprint->Reference().GetShownText();

View File

@ -53,7 +53,7 @@ static void CreateRoutesSection( FILE* aFile, BOARD* aPcb );
static void CreateSignalsSection( FILE* aFile, BOARD* aPcb ); static void CreateSignalsSection( FILE* aFile, BOARD* aPcb );
static void CreateShapesSection( FILE* aFile, BOARD* aPcb ); static void CreateShapesSection( FILE* aFile, BOARD* aPcb );
static void CreatePadsShapesSection( FILE* aFile, BOARD* aPcb ); static void CreatePadsShapesSection( FILE* aFile, BOARD* aPcb );
static void FootprintWriteShape( FILE* File, MODULE* aFootprint, const wxString& aShapeName ); static void FootprintWriteShape( FILE* File, FOOTPRINT* aFootprint, const wxString& aShapeName );
// layer names for Gencad export // layer names for Gencad export
@ -181,10 +181,10 @@ static bool storeOriginCoords;
static int GencadOffsetX, GencadOffsetY; static int GencadOffsetX, GencadOffsetY;
// Association between shape names (using shapeName index) and components // Association between shape names (using shapeName index) and components
static std::map<MODULE*, int> componentShapes; static std::map<FOOTPRINT*, int> componentShapes;
static std::map<int, wxString> shapeNames; static std::map<int, wxString> shapeNames;
static const wxString getShapeName( MODULE* aFootprint ) static const wxString getShapeName( FOOTPRINT* aFootprint )
{ {
static const wxString invalid( "invalid" ); static const wxString invalid( "invalid" );
@ -275,7 +275,7 @@ void PCB_EDIT_FRAME::ExportToGenCAD( wxCommandEvent& aEvent )
*/ */
BOARD* pcb = GetBoard(); BOARD* pcb = GetBoard();
for( MODULE* footprint : pcb->Footprints() ) for( FOOTPRINT* footprint : pcb->Footprints() )
{ {
footprint->SetFlag( 0 ); footprint->SetFlag( 0 );
@ -311,7 +311,7 @@ void PCB_EDIT_FRAME::ExportToGenCAD( wxCommandEvent& aEvent )
fclose( file ); fclose( file );
// Undo the footprints modifications (flipped footprints) // Undo the footprints modifications (flipped footprints)
for( MODULE* footprint : pcb->Footprints() ) for( FOOTPRINT* footprint : pcb->Footprints() )
{ {
if( footprint->GetFlag() ) if( footprint->GetFlag() )
{ {
@ -664,17 +664,16 @@ static void CreatePadsShapesSection( FILE* aFile, BOARD* aPcb )
/// Compute hashes for footprints without taking into account their position, rotation or layer /// Compute hashes for footprints without taking into account their position, rotation or layer
static size_t hashModule( const MODULE* aFootprint ) static size_t hashFootprint( const FOOTPRINT* aFootprint )
{ {
size_t ret = 0x11223344; size_t ret = 0x11223344;
constexpr int flags = HASH_FLAGS::HASH_POS | HASH_FLAGS::REL_COORD constexpr int flags = HASH_FLAGS::HASH_POS | HASH_FLAGS::REL_COORD
| HASH_FLAGS::HASH_ROT | HASH_FLAGS::HASH_LAYER; | HASH_FLAGS::HASH_ROT | HASH_FLAGS::HASH_LAYER;
for( BOARD_ITEM* i : aFootprint->GraphicalItems() )
for( auto i : aFootprint->GraphicalItems() )
ret += hash_eda( i, flags ); ret += hash_eda( i, flags );
for( auto i : aFootprint->Pads() ) for( PAD* i : aFootprint->Pads() )
ret += hash_eda( i, flags ); ret += hash_eda( i, flags );
return ret; return ret;
@ -694,7 +693,7 @@ static void CreateShapesSection( FILE* aFile, BOARD* aPcb )
fputs( "$SHAPES\n", aFile ); fputs( "$SHAPES\n", aFile );
for( MODULE* footprint : aPcb->Footprints() ) for( FOOTPRINT* footprint : aPcb->Footprints() )
{ {
if( !individualShapes ) if( !individualShapes )
{ {
@ -705,7 +704,7 @@ static void CreateShapesSection( FILE* aFile, BOARD* aPcb )
wxString shapeName = footprint->GetFPID().Format(); wxString shapeName = footprint->GetFPID().Format();
auto shapeIt = shapes.find( shapeName ); auto shapeIt = shapes.find( shapeName );
size_t modHash = hashModule( footprint ); size_t modHash = hashFootprint( footprint );
if( shapeIt != shapes.end() ) if( shapeIt != shapes.end() )
{ {
@ -807,7 +806,7 @@ static void CreateComponentsSection( FILE* aFile, BOARD* aPcb )
int cu_count = aPcb->GetCopperLayerCount(); int cu_count = aPcb->GetCopperLayerCount();
for( MODULE* footprint : aPcb->Footprints() ) for( FOOTPRINT* footprint : aPcb->Footprints() )
{ {
const char* mirror; const char* mirror;
const char* flip; const char* flip;
@ -898,7 +897,7 @@ 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* footprint : aPcb->Footprints() ) for( FOOTPRINT* footprint : aPcb->Footprints() )
{ {
for( PAD* pad : footprint->Pads() ) for( PAD* pad : footprint->Pads() )
{ {
@ -1065,7 +1064,7 @@ static void CreateDevicesSection( FILE* aFile, BOARD* aPcb )
if( !newDevice ) // do not repeat device definitions if( !newDevice ) // do not repeat device definitions
continue; continue;
const MODULE* footprint = componentShape.first; const FOOTPRINT* footprint = componentShape.first;
fprintf( aFile, "\nDEVICE \"DEV_%s\"\n", TO_UTF8( escapeString( shapeName ) ) ); fprintf( aFile, "\nDEVICE \"DEV_%s\"\n", TO_UTF8( escapeString( shapeName ) ) );
@ -1142,7 +1141,7 @@ static void CreateTracksInfoData( FILE* aFile, BOARD* aPcb )
* It's almost guaranteed that the silk layer will be imported wrong but * It's almost guaranteed that the silk layer will be imported wrong but
* the shape also contains the pads! * the shape also contains the pads!
*/ */
static void FootprintWriteShape( FILE* aFile, MODULE* aFootprint, const wxString& aShapeName ) static void FootprintWriteShape( FILE* aFile, FOOTPRINT* aFootprint, const wxString& aShapeName )
{ {
FP_SHAPE* shape; FP_SHAPE* shape;

View File

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

View File

@ -273,7 +273,7 @@ UseBoundingBox:
* compiles data for the PLACEMENT section and compiles data for * compiles data for the PLACEMENT section and compiles data for
* the library ELECTRICAL section. * the library ELECTRICAL section.
*/ */
static void idf_export_footprint( BOARD* aPcb, MODULE* aFootprint, IDF3_BOARD& aIDFBoard ) static void idf_export_footprint( BOARD* aPcb, FOOTPRINT* aFootprint, IDF3_BOARD& aIDFBoard )
{ {
// Reference Designator // Reference Designator
std::string crefdes = TO_UTF8( aFootprint->Reference().GetShownText() ); std::string crefdes = TO_UTF8( aFootprint->Reference().GetShownText() );
@ -616,7 +616,7 @@ 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 footprint (library) data. // Output the drill holes and footprint (library) data.
for( MODULE* footprint : aPcb->Footprints() ) for( FOOTPRINT* footprint : aPcb->Footprints() )
idf_export_footprint( aPcb, footprint, idfBoard ); idf_export_footprint( aPcb, footprint, idfBoard );
if( !idfBoard.WriteFile( aFullFileName, idfUnit, false ) ) if( !idfBoard.WriteFile( aFullFileName, idfUnit, false ) )

View File

@ -1069,7 +1069,7 @@ static void export_vrml_fp_text( FP_TEXT* item )
} }
static void export_vrml_fp_shape( MODEL_VRML& aModel, FP_SHAPE* aOutline, MODULE* aFootprint ) static void export_vrml_fp_shape( MODEL_VRML& aModel, FP_SHAPE* aOutline, FOOTPRINT* aFootprint )
{ {
LAYER_NUM layer = aOutline->GetLayer(); LAYER_NUM layer = aOutline->GetLayer();
double x = aOutline->GetStart().x * BOARD_SCALE; double x = aOutline->GetStart().x * BOARD_SCALE;
@ -1361,7 +1361,7 @@ static void compose_quat( double q1[4], double q2[4], double qr[4] )
} }
static void export_vrml_footprint( MODEL_VRML& aModel, BOARD* aPcb, MODULE* aFootprint, static void export_vrml_footprint( MODEL_VRML& aModel, BOARD* aPcb, FOOTPRINT* aFootprint,
std::ostream* aOutputFile ) std::ostream* aOutputFile )
{ {
if( !aModel.m_plainPCB ) if( !aModel.m_plainPCB )
@ -1655,7 +1655,7 @@ 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* footprint : pcb->Footprints() ) for( FOOTPRINT* footprint : pcb->Footprints() )
export_vrml_footprint( model3d, pcb, footprint, &output_file ); export_vrml_footprint( model3d, pcb, footprint, &output_file );
// write out the board and all layers // write out the board and all layers
@ -1669,7 +1669,7 @@ bool PCB_EDIT_FRAME::ExportVRML_File( const wxString& aFullFileName, double aMMt
else else
{ {
// Export footprints // Export footprints
for( MODULE* footprint : pcb->Footprints() ) for( FOOTPRINT* footprint : pcb->Footprints() )
export_vrml_footprint( model3d, pcb, footprint, NULL ); export_vrml_footprint( model3d, pcb, footprint, NULL );
// write out the board and all layers // write out the board and all layers

View File

@ -119,7 +119,7 @@ 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( MODULE* footprint : m_pcb->Footprints() ) for( FOOTPRINT* footprint : m_pcb->Footprints() )
{ {
for( PAD* pad : footprint->Pads() ) for( PAD* pad : footprint->Pads() )
{ {

View File

@ -464,7 +464,7 @@ void GERBER_JOBFILE_WRITER::addJSONDesignRules()
int minPadClearanceOuter = defaultNC.GetClearance(); int minPadClearanceOuter = defaultNC.GetClearance();
int minPadClearanceInner = defaultNC.GetClearance(); int minPadClearanceInner = defaultNC.GetClearance();
for( MODULE* footprint : m_pcb->Footprints() ) for( FOOTPRINT* footprint : m_pcb->Footprints() )
{ {
for( PAD* pad : footprint->Pads() ) for( PAD* pad : footprint->Pads() )
{ {

View File

@ -65,9 +65,9 @@ int PLACEFILE_GERBER_WRITER::CreatePlaceFile( wxString& aFullFilename, PCB_LAYER
m_offset = m_pcb->GetDesignSettings().m_AuxOrigin; m_offset = m_pcb->GetDesignSettings().m_AuxOrigin;
// Collect footprints on the right layer // Collect footprints on the right layer
std::vector<MODULE*> fp_list; std::vector<FOOTPRINT*> fp_list;
for( MODULE* footprint : m_pcb->Footprints() ) for( FOOTPRINT* footprint : m_pcb->Footprints() )
{ {
if( footprint->GetAttributes() & FP_EXCLUDE_FROM_POS_FILES ) if( footprint->GetAttributes() & FP_EXCLUDE_FROM_POS_FILES )
continue; continue;
@ -124,7 +124,7 @@ int PLACEFILE_GERBER_WRITER::CreatePlaceFile( wxString& aFullFilename, PCB_LAYER
bool allowUtf8 = true; bool allowUtf8 = true;
// Plot components data: position, outlines, pad1 and other pads. // Plot components data: position, outlines, pad1 and other pads.
for( MODULE* footprint : fp_list ) for( FOOTPRINT* footprint : fp_list )
{ {
// Manage the aperture attribute component position: // Manage the aperture attribute component position:
GBR_METADATA gbr_metadata; GBR_METADATA gbr_metadata;
@ -299,7 +299,7 @@ int PLACEFILE_GERBER_WRITER::CreatePlaceFile( wxString& aFullFilename, PCB_LAYER
brd_plotter.PlotBoardGraphicItems(); brd_plotter.PlotBoardGraphicItems();
// Draw footprint other graphic items: // Draw footprint other graphic items:
for( MODULE* footprint : fp_list ) for( FOOTPRINT* footprint : fp_list )
{ {
for( BOARD_ITEM* item : footprint->GraphicalItems() ) for( BOARD_ITEM* item : footprint->GraphicalItems() )
{ {
@ -324,7 +324,7 @@ double PLACEFILE_GERBER_WRITER::mapRotationAngle( double aAngle )
} }
void PLACEFILE_GERBER_WRITER::findPads1( std::vector<PAD*>& aPadList, MODULE* aFootprint ) const void PLACEFILE_GERBER_WRITER::findPads1( std::vector<PAD*>& aPadList, FOOTPRINT* aFootprint ) const
{ {
// Fint the pad "1" or pad "A1" // Fint the pad "1" or pad "A1"
// this is possible only if only one pad is found // this is possible only if only one pad is found

View File

@ -30,7 +30,7 @@
#include <wx/gdicmn.h> #include <wx/gdicmn.h>
class BOARD; class BOARD;
class MODULE; class FOOTPRINT;
class PAD; class PAD;
/** /**
@ -101,7 +101,7 @@ private:
* @param aPadList is the list to fill * @param aPadList is the list to fill
* @param aFootprint is the footprint to test * @param aFootprint is the footprint to test
*/ */
void findPads1( std::vector<PAD*>& aPadList, MODULE* aFootprint ) const; void findPads1( std::vector<PAD*>& aPadList, FOOTPRINT* aFootprint ) const;
}; };
#endif // #ifndef PLACEFILE_GERBER_WRITER_H #endif // #ifndef PLACEFILE_GERBER_WRITER_H

View File

@ -1104,7 +1104,7 @@ bool PCB_EDIT_FRAME::importFile( const wxString& aFileName, int aFileType )
// Update footprint LIB_IDs to point to the just imported Eagle library // Update footprint LIB_IDs to point to the just imported Eagle library
for( MODULE* footprint : GetBoard()->Footprints() ) for( FOOTPRINT* footprint : GetBoard()->Footprints() )
{ {
LIB_ID libId = footprint->GetFPID(); LIB_ID libId = footprint->GetFPID();

View File

@ -39,7 +39,7 @@
#include <convert_drawsegment_list_to_polygon.h> #include <convert_drawsegment_list_to_polygon.h>
MODULE::MODULE( BOARD* parent ) : FOOTPRINT::FOOTPRINT( BOARD* parent ) :
BOARD_ITEM_CONTAINER((BOARD_ITEM*) parent, PCB_FOOTPRINT_T ), BOARD_ITEM_CONTAINER((BOARD_ITEM*) parent, PCB_FOOTPRINT_T ),
m_initial_comments( 0 ) m_initial_comments( 0 )
{ {
@ -67,7 +67,7 @@ MODULE::MODULE( BOARD* parent ) :
} }
MODULE::MODULE( const MODULE& aFootprint ) : FOOTPRINT::FOOTPRINT( const FOOTPRINT& aFootprint ) :
BOARD_ITEM_CONTAINER( aFootprint ) BOARD_ITEM_CONTAINER( aFootprint )
{ {
m_pos = aFootprint.m_pos; m_pos = aFootprint.m_pos;
@ -164,14 +164,14 @@ MODULE::MODULE( const MODULE& aFootprint ) :
} }
MODULE::MODULE( MODULE&& aFootprint ) : FOOTPRINT::FOOTPRINT( FOOTPRINT&& aFootprint ) :
BOARD_ITEM_CONTAINER( aFootprint ) BOARD_ITEM_CONTAINER( aFootprint )
{ {
*this = std::move( aFootprint ); *this = std::move( aFootprint );
} }
MODULE::~MODULE() FOOTPRINT::~FOOTPRINT()
{ {
// Clean up the owned elements // Clean up the owned elements
delete m_reference; delete m_reference;
@ -200,7 +200,7 @@ MODULE::~MODULE()
} }
MODULE& MODULE::operator=( MODULE&& aOther ) FOOTPRINT& FOOTPRINT::operator=( FOOTPRINT&& aOther )
{ {
BOARD_ITEM::operator=( aOther ); BOARD_ITEM::operator=( aOther );
@ -295,7 +295,7 @@ MODULE& MODULE::operator=( MODULE&& aOther )
} }
MODULE& MODULE::operator=( const MODULE& aOther ) FOOTPRINT& FOOTPRINT::operator=( const FOOTPRINT& aOther )
{ {
BOARD_ITEM::operator=( aOther ); BOARD_ITEM::operator=( aOther );
@ -394,7 +394,7 @@ MODULE& MODULE::operator=( const MODULE& aOther )
} }
void MODULE::GetContextualTextVars( wxArrayString* aVars ) const void FOOTPRINT::GetContextualTextVars( wxArrayString* aVars ) const
{ {
aVars->push_back( wxT( "REFERENCE" ) ); aVars->push_back( wxT( "REFERENCE" ) );
aVars->push_back( wxT( "VALUE" ) ); aVars->push_back( wxT( "VALUE" ) );
@ -402,7 +402,7 @@ void MODULE::GetContextualTextVars( wxArrayString* aVars ) const
} }
bool MODULE::ResolveTextVar( wxString* token, int aDepth ) const bool FOOTPRINT::ResolveTextVar( wxString* token, int aDepth ) const
{ {
if( token->IsSameAs( wxT( "REFERENCE" ) ) ) if( token->IsSameAs( wxT( "REFERENCE" ) ) )
{ {
@ -429,7 +429,7 @@ bool MODULE::ResolveTextVar( wxString* token, int aDepth ) const
} }
void MODULE::ClearAllNets() void FOOTPRINT::ClearAllNets()
{ {
// Force the ORPHANED dummy net info for all pads. // Force the ORPHANED dummy net info for all pads.
// ORPHANED dummy net does not depend on a board // ORPHANED dummy net does not depend on a board
@ -438,7 +438,7 @@ void MODULE::ClearAllNets()
} }
void MODULE::Add( BOARD_ITEM* aBoardItem, ADD_MODE aMode ) void FOOTPRINT::Add( BOARD_ITEM* aBoardItem, ADD_MODE aMode )
{ {
switch( aBoardItem->Type() ) switch( aBoardItem->Type() )
{ {
@ -491,7 +491,7 @@ void MODULE::Add( BOARD_ITEM* aBoardItem, ADD_MODE aMode )
} }
void MODULE::Remove( BOARD_ITEM* aBoardItem ) void FOOTPRINT::Remove( BOARD_ITEM* aBoardItem )
{ {
switch( aBoardItem->Type() ) switch( aBoardItem->Type() )
{ {
@ -561,13 +561,13 @@ void MODULE::Remove( BOARD_ITEM* aBoardItem )
} }
void MODULE::CalculateBoundingBox() void FOOTPRINT::CalculateBoundingBox()
{ {
m_boundingBox = GetFootprintRect(); m_boundingBox = GetFootprintRect();
} }
double MODULE::GetArea( int aPadding ) const double FOOTPRINT::GetArea( int aPadding ) const
{ {
double w = std::abs( static_cast<double>( m_boundingBox.GetWidth() ) ) + aPadding; double w = std::abs( static_cast<double>( m_boundingBox.GetWidth() ) ) + aPadding;
double h = std::abs( static_cast<double>( m_boundingBox.GetHeight() ) ) + aPadding; double h = std::abs( static_cast<double>( m_boundingBox.GetHeight() ) ) + aPadding;
@ -575,7 +575,7 @@ double MODULE::GetArea( int aPadding ) const
} }
EDA_RECT MODULE::GetFootprintRect() const EDA_RECT FOOTPRINT::GetFootprintRect() const
{ {
EDA_RECT area; EDA_RECT area;
@ -601,13 +601,13 @@ EDA_RECT MODULE::GetFootprintRect() const
} }
EDA_RECT MODULE::GetFpPadsLocalBbox() const EDA_RECT FOOTPRINT::GetFpPadsLocalBbox() const
{ {
EDA_RECT area; EDA_RECT area;
// We want the bounding box of the footprint pads at rot 0, not flipped // We want the bounding box of the footprint pads at rot 0, not flipped
// Create such a image: // Create such a image:
MODULE dummy( *this ); FOOTPRINT dummy( *this );
dummy.SetPosition( wxPoint( 0, 0 ) ); dummy.SetPosition( wxPoint( 0, 0 ) );
@ -624,13 +624,13 @@ EDA_RECT MODULE::GetFpPadsLocalBbox() const
} }
const EDA_RECT MODULE::GetBoundingBox() const const EDA_RECT FOOTPRINT::GetBoundingBox() const
{ {
return GetBoundingBox( true ); return GetBoundingBox( true );
} }
const EDA_RECT MODULE::GetBoundingBox( bool aIncludeInvisibleText ) const const EDA_RECT FOOTPRINT::GetBoundingBox( bool aIncludeInvisibleText ) const
{ {
EDA_RECT area = GetFootprintRect(); EDA_RECT area = GetFootprintRect();
@ -687,13 +687,12 @@ const EDA_RECT MODULE::GetBoundingBox( bool aIncludeInvisibleText ) const
* We should consider doing that instead at some point in the future if we can * We should consider doing that instead at some point in the future if we can
* use a performant algorithm and cache the result to avoid extra computing. * use a performant algorithm and cache the result to avoid extra computing.
*/ */
SHAPE_POLY_SET MODULE::GetBoundingPoly() const SHAPE_POLY_SET FOOTPRINT::GetBoundingPoly() const
{ {
SHAPE_POLY_SET poly; SHAPE_POLY_SET poly;
double orientation = GetOrientationRadians(); double orientation = GetOrientationRadians();
FOOTPRINT temp = *this;
MODULE temp = *this;
temp.SetOrientation( 0.0 ); temp.SetOrientation( 0.0 );
BOX2I area = temp.GetFootprintRect(); BOX2I area = temp.GetFootprintRect();
@ -722,7 +721,7 @@ SHAPE_POLY_SET MODULE::GetBoundingPoly() const
} }
void MODULE::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>& aList ) void FOOTPRINT::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>& aList )
{ {
wxString msg, msg2; wxString msg, msg2;
@ -790,20 +789,20 @@ void MODULE::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM
} }
bool MODULE::HitTest( const wxPoint& aPosition, int aAccuracy ) const bool FOOTPRINT::HitTest( const wxPoint& aPosition, int aAccuracy ) const
{ {
EDA_RECT rect = m_boundingBox;//.GetBoundingBoxRotated( GetPosition(), m_Orient ); EDA_RECT rect = m_boundingBox;//.GetBoundingBoxRotated( GetPosition(), m_Orient );
return rect.Inflate( aAccuracy ).Contains( aPosition ); return rect.Inflate( aAccuracy ).Contains( aPosition );
} }
bool MODULE::HitTestAccurate( const wxPoint& aPosition, int aAccuracy ) const bool FOOTPRINT::HitTestAccurate( const wxPoint& aPosition, int aAccuracy ) const
{ {
return GetBoundingPoly().Collide( aPosition, aAccuracy ); return GetBoundingPoly().Collide( aPosition, aAccuracy );
} }
bool MODULE::HitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy ) const bool FOOTPRINT::HitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy ) const
{ {
EDA_RECT arect = aRect; EDA_RECT arect = aRect;
arect.Inflate( aAccuracy ); arect.Inflate( aAccuracy );
@ -816,7 +815,7 @@ bool MODULE::HitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy ) co
if( !aRect.Intersects( GetBoundingBox() ) ) if( !aRect.Intersects( GetBoundingBox() ) )
return false; return false;
// Determine if any elements in the MODULE intersect the rect // Determine if any elements in the FOOTPRINT intersect the rect
for( PAD* pad : m_pads ) for( PAD* pad : m_pads )
{ {
if( pad->HitTest( arect, false, 0 ) ) if( pad->HitTest( arect, false, 0 ) )
@ -843,7 +842,7 @@ bool MODULE::HitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy ) co
} }
PAD* MODULE::FindPadByName( const wxString& aPadName ) const PAD* FOOTPRINT::FindPadByName( const wxString& aPadName ) const
{ {
for( PAD* pad : m_pads ) for( PAD* pad : m_pads )
{ {
@ -855,7 +854,7 @@ PAD* MODULE::FindPadByName( const wxString& aPadName ) const
} }
PAD* MODULE::GetPad( const wxPoint& aPosition, LSET aLayerMask ) PAD* FOOTPRINT::GetPad( const wxPoint& aPosition, LSET aLayerMask )
{ {
for( PAD* pad : m_pads ) for( PAD* pad : m_pads )
{ {
@ -871,7 +870,7 @@ PAD* MODULE::GetPad( const wxPoint& aPosition, LSET aLayerMask )
} }
PAD* MODULE::GetTopLeftPad() PAD* FOOTPRINT::GetTopLeftPad()
{ {
PAD* topLeftPad = GetFirstPad(); PAD* topLeftPad = GetFirstPad();
@ -890,7 +889,7 @@ PAD* MODULE::GetTopLeftPad()
} }
unsigned MODULE::GetPadCount( INCLUDE_NPTH_T aIncludeNPTH ) const unsigned FOOTPRINT::GetPadCount( INCLUDE_NPTH_T aIncludeNPTH ) const
{ {
if( aIncludeNPTH ) if( aIncludeNPTH )
return m_pads.size(); return m_pads.size();
@ -909,7 +908,7 @@ unsigned MODULE::GetPadCount( INCLUDE_NPTH_T aIncludeNPTH ) const
} }
unsigned MODULE::GetUniquePadCount( INCLUDE_NPTH_T aIncludeNPTH ) const unsigned FOOTPRINT::GetUniquePadCount( INCLUDE_NPTH_T aIncludeNPTH ) const
{ {
std::set<wxString> usedNames; std::set<wxString> usedNames;
@ -942,7 +941,7 @@ unsigned MODULE::GetUniquePadCount( INCLUDE_NPTH_T aIncludeNPTH ) const
} }
void MODULE::Add3DModel( FP_3DMODEL* a3DModel ) void FOOTPRINT::Add3DModel( FP_3DMODEL* a3DModel )
{ {
if( NULL == a3DModel ) if( NULL == a3DModel )
return; return;
@ -955,7 +954,7 @@ void MODULE::Add3DModel( FP_3DMODEL* a3DModel )
// see footprint.h // see footprint.h
SEARCH_RESULT MODULE::Visit( INSPECTOR inspector, void* testData, const KICAD_T scanTypes[] ) SEARCH_RESULT FOOTPRINT::Visit( INSPECTOR inspector, void* testData, const KICAD_T scanTypes[] )
{ {
KICAD_T stype; KICAD_T stype;
SEARCH_RESULT result = SEARCH_RESULT::CONTINUE; SEARCH_RESULT result = SEARCH_RESULT::CONTINUE;
@ -998,7 +997,7 @@ SEARCH_RESULT MODULE::Visit( INSPECTOR inspector, void* testData, const KICAD_T
if( result == SEARCH_RESULT::QUIT ) if( result == SEARCH_RESULT::QUIT )
break; break;
// Intentionally fall through since m_Drawings can hold TYPETEXTMODULE also // Intentionally fall through since m_Drawings can hold PCB_FP_SHAPE_T also
KI_FALLTHROUGH; KI_FALLTHROUGH;
case PCB_FP_SHAPE_T: case PCB_FP_SHAPE_T:
@ -1040,7 +1039,7 @@ SEARCH_RESULT MODULE::Visit( INSPECTOR inspector, void* testData, const KICAD_T
} }
wxString MODULE::GetSelectMenuText( EDA_UNITS aUnits ) const wxString FOOTPRINT::GetSelectMenuText( EDA_UNITS aUnits ) const
{ {
wxString reference = GetReference(); wxString reference = GetReference();
@ -1051,19 +1050,19 @@ wxString MODULE::GetSelectMenuText( EDA_UNITS aUnits ) const
} }
BITMAP_DEF MODULE::GetMenuImage() const BITMAP_DEF FOOTPRINT::GetMenuImage() const
{ {
return module_xpm; return module_xpm;
} }
EDA_ITEM* MODULE::Clone() const EDA_ITEM* FOOTPRINT::Clone() const
{ {
return new MODULE( *this ); return new FOOTPRINT( *this );
} }
void MODULE::RunOnChildren( const std::function<void (BOARD_ITEM*)>& aFunction ) const void FOOTPRINT::RunOnChildren( const std::function<void ( BOARD_ITEM*)>& aFunction ) const
{ {
try try
{ {
@ -1084,12 +1083,12 @@ void MODULE::RunOnChildren( const std::function<void (BOARD_ITEM*)>& aFunction )
} }
catch( std::bad_function_call& ) catch( std::bad_function_call& )
{ {
wxFAIL_MSG( "Error running MODULE::RunOnChildren" ); wxFAIL_MSG( "Error running FOOTPRINT::RunOnChildren" );
} }
} }
void MODULE::GetAllDrawingLayers( int aLayers[], int& aCount, bool aIncludePads ) const void FOOTPRINT::GetAllDrawingLayers( int aLayers[], int& aCount, bool aIncludePads ) const
{ {
std::unordered_set<int> layers; std::unordered_set<int> layers;
@ -1116,7 +1115,7 @@ void MODULE::GetAllDrawingLayers( int aLayers[], int& aCount, bool aIncludePads
} }
void MODULE::ViewGetLayers( int aLayers[], int& aCount ) const void FOOTPRINT::ViewGetLayers( int aLayers[], int& aCount ) const
{ {
aCount = 2; aCount = 2;
aLayers[0] = LAYER_ANCHOR; aLayers[0] = LAYER_ANCHOR;
@ -1162,7 +1161,7 @@ void MODULE::ViewGetLayers( int aLayers[], int& aCount ) const
} }
double MODULE::ViewGetLOD( int aLayer, KIGFX::VIEW* aView ) const double FOOTPRINT::ViewGetLOD( int aLayer, KIGFX::VIEW* aView ) const
{ {
int layer = ( m_Layer == F_Cu ) ? LAYER_MOD_FR : int layer = ( m_Layer == F_Cu ) ? LAYER_MOD_FR :
( m_Layer == B_Cu ) ? LAYER_MOD_BK : LAYER_ANCHOR; ( m_Layer == B_Cu ) ? LAYER_MOD_BK : LAYER_ANCHOR;
@ -1179,7 +1178,7 @@ double MODULE::ViewGetLOD( int aLayer, KIGFX::VIEW* aView ) const
} }
const BOX2I MODULE::ViewBBox() const const BOX2I FOOTPRINT::ViewBBox() const
{ {
EDA_RECT area = GetFootprintRect(); EDA_RECT area = GetFootprintRect();
@ -1200,7 +1199,7 @@ const BOX2I MODULE::ViewBBox() const
} }
bool MODULE::IsLibNameValid( const wxString & aName ) bool FOOTPRINT::IsLibNameValid( const wxString & aName )
{ {
const wxChar * invalids = StringLibNameInvalidChars( false ); const wxChar * invalids = StringLibNameInvalidChars( false );
@ -1211,7 +1210,7 @@ bool MODULE::IsLibNameValid( const wxString & aName )
} }
const wxChar* MODULE::StringLibNameInvalidChars( bool aUserReadable ) const wxChar* FOOTPRINT::StringLibNameInvalidChars( bool aUserReadable )
{ {
// This list of characters is also duplicated in validators.cpp and // This list of characters is also duplicated in validators.cpp and
// lib_id.cpp // lib_id.cpp
@ -1226,14 +1225,14 @@ const wxChar* MODULE::StringLibNameInvalidChars( bool aUserReadable )
} }
void MODULE::Move( const wxPoint& aMoveVector ) void FOOTPRINT::Move( const wxPoint& aMoveVector )
{ {
wxPoint newpos = m_pos + aMoveVector; wxPoint newpos = m_pos + aMoveVector;
SetPosition( newpos ); SetPosition( newpos );
} }
void MODULE::Rotate( const wxPoint& aRotCentre, double aAngle ) void FOOTPRINT::Rotate( const wxPoint& aRotCentre, double aAngle )
{ {
double orientation = GetOrientation(); double orientation = GetOrientation();
double newOrientation = orientation + aAngle; double newOrientation = orientation + aAngle;
@ -1255,7 +1254,7 @@ void MODULE::Rotate( const wxPoint& aRotCentre, double aAngle )
} }
void MODULE::Flip( const wxPoint& aCentre, bool aFlipLeftRight ) void FOOTPRINT::Flip( const wxPoint& aCentre, bool aFlipLeftRight )
{ {
// Move footprint to its final position: // Move footprint to its final position:
wxPoint finalPos = m_pos; wxPoint finalPos = m_pos;
@ -1320,7 +1319,7 @@ void MODULE::Flip( const wxPoint& aCentre, bool aFlipLeftRight )
} }
void MODULE::SetPosition( const wxPoint& aPos ) void FOOTPRINT::SetPosition( const wxPoint& aPos )
{ {
wxPoint delta = aPos - m_pos; wxPoint delta = aPos - m_pos;
@ -1363,7 +1362,7 @@ void MODULE::SetPosition( const wxPoint& aPos )
} }
void MODULE::MoveAnchorPosition( const wxPoint& aMoveVector ) void FOOTPRINT::MoveAnchorPosition( const wxPoint& aMoveVector )
{ {
/* Move the reference point of the footprint /* Move the reference point of the footprint
* the footprints elements (pads, outlines, edges .. ) are moved * the footprints elements (pads, outlines, edges .. ) are moved
@ -1420,7 +1419,7 @@ void MODULE::MoveAnchorPosition( const wxPoint& aMoveVector )
} }
void MODULE::SetOrientation( double aNewAngle ) void FOOTPRINT::SetOrientation( double aNewAngle )
{ {
double angleChange = aNewAngle - m_orient; // change in rotation double angleChange = aNewAngle - m_orient; // change in rotation
@ -1458,9 +1457,9 @@ void MODULE::SetOrientation( double aNewAngle )
} }
BOARD_ITEM* MODULE::Duplicate() const BOARD_ITEM* FOOTPRINT::Duplicate() const
{ {
MODULE* dupe = (MODULE*) Clone(); FOOTPRINT* dupe = (FOOTPRINT*) Clone();
const_cast<KIID&>( dupe->m_Uuid ) = KIID(); const_cast<KIID&>( dupe->m_Uuid ) = KIID();
dupe->RunOnChildren( [&]( BOARD_ITEM* child ) dupe->RunOnChildren( [&]( BOARD_ITEM* child )
@ -1472,7 +1471,7 @@ BOARD_ITEM* MODULE::Duplicate() const
} }
BOARD_ITEM* MODULE::DuplicateItem( const BOARD_ITEM* aItem, bool aAddToFootprint ) BOARD_ITEM* FOOTPRINT::DuplicateItem( const BOARD_ITEM* aItem, bool aAddToFootprint )
{ {
BOARD_ITEM* new_item = NULL; BOARD_ITEM* new_item = NULL;
FP_ZONE* new_zone = NULL; FP_ZONE* new_zone = NULL;
@ -1557,7 +1556,7 @@ BOARD_ITEM* MODULE::DuplicateItem( const BOARD_ITEM* aItem, bool aAddToFootprint
} }
wxString MODULE::GetNextPadName( const wxString& aLastPadName ) const wxString FOOTPRINT::GetNextPadName( const wxString& aLastPadName ) const
{ {
std::set<wxString> usedNames; std::set<wxString> usedNames;
@ -1575,7 +1574,7 @@ wxString MODULE::GetNextPadName( const wxString& aLastPadName ) const
} }
void MODULE::IncrementReference( int aDelta ) void FOOTPRINT::IncrementReference( int aDelta )
{ {
const wxString& refdes = GetReference(); const wxString& refdes = GetReference();
@ -1614,7 +1613,7 @@ static void addRect( SHAPE_POLY_SET& aPolySet, wxRect aRect )
aPolySet.Append( aRect.GetX(), aRect.GetY()+aRect.height ); aPolySet.Append( aRect.GetX(), aRect.GetY()+aRect.height );
} }
double MODULE::CoverageRatio( const GENERAL_COLLECTOR& aCollector ) const double FOOTPRINT::CoverageRatio( const GENERAL_COLLECTOR& aCollector ) const
{ {
double fpArea = GetFootprintRect().GetArea(); double fpArea = GetFootprintRect().GetArea();
SHAPE_POLY_SET coveredRegion; SHAPE_POLY_SET coveredRegion;
@ -1669,7 +1668,7 @@ double MODULE::CoverageRatio( const GENERAL_COLLECTOR& aCollector ) const
} }
std::shared_ptr<SHAPE> MODULE::GetEffectiveShape( PCB_LAYER_ID aLayer ) const std::shared_ptr<SHAPE> FOOTPRINT::GetEffectiveShape( PCB_LAYER_ID aLayer ) const
{ {
std::shared_ptr<SHAPE_COMPOUND> shape = std::make_shared<SHAPE_COMPOUND>(); std::shared_ptr<SHAPE_COMPOUND> shape = std::make_shared<SHAPE_COMPOUND>();
@ -1693,7 +1692,7 @@ std::shared_ptr<SHAPE> MODULE::GetEffectiveShape( PCB_LAYER_ID aLayer ) const
} }
void MODULE::BuildPolyCourtyards() void FOOTPRINT::BuildPolyCourtyards()
{ {
m_poly_courtyard_front.RemoveAllContours(); m_poly_courtyard_front.RemoveAllContours();
m_poly_courtyard_back.RemoveAllContours(); m_poly_courtyard_back.RemoveAllContours();
@ -1741,15 +1740,15 @@ void MODULE::BuildPolyCourtyards()
} }
void MODULE::SwapData( BOARD_ITEM* aImage ) void FOOTPRINT::SwapData( BOARD_ITEM* aImage )
{ {
assert( aImage->Type() == PCB_FOOTPRINT_T ); assert( aImage->Type() == PCB_FOOTPRINT_T );
std::swap( *((MODULE*) this), *((MODULE*) aImage) ); std::swap( *((FOOTPRINT*) this), *((FOOTPRINT*) aImage) );
} }
bool MODULE::HasThroughHolePads() const bool FOOTPRINT::HasThroughHolePads() const
{ {
for( PAD* pad : Pads() ) for( PAD* pad : Pads() )
{ {
@ -1761,7 +1760,8 @@ bool MODULE::HasThroughHolePads() const
} }
bool MODULE::cmp_drawings::operator()( const BOARD_ITEM* aFirst, const BOARD_ITEM* aSecond ) const bool FOOTPRINT::cmp_drawings::operator()( const BOARD_ITEM* aFirst,
const BOARD_ITEM* aSecond ) const
{ {
if( aFirst->Type() != aSecond->Type() ) if( aFirst->Type() != aSecond->Type() )
return aFirst->Type() < aSecond->Type(); return aFirst->Type() < aSecond->Type();
@ -1785,7 +1785,7 @@ bool MODULE::cmp_drawings::operator()( const BOARD_ITEM* aFirst, const BOARD_ITE
} }
bool MODULE::cmp_pads::operator()( const PAD* aFirst, const PAD* aSecond ) const bool FOOTPRINT::cmp_pads::operator()( const PAD* aFirst, const PAD* aSecond ) const
{ {
if( aFirst->GetName() != aSecond->GetName() ) if( aFirst->GetName() != aSecond->GetName() )
return StrNumCmp( aFirst->GetName(), aSecond->GetName() ) < 0; return StrNumCmp( aFirst->GetName(), aSecond->GetName() ) < 0;
@ -1816,37 +1816,37 @@ static struct MODULE_DESC
fpLayers.Add( LSET::Name( B_Cu ), B_Cu ); fpLayers.Add( LSET::Name( B_Cu ), B_Cu );
PROPERTY_MANAGER& propMgr = PROPERTY_MANAGER::Instance(); PROPERTY_MANAGER& propMgr = PROPERTY_MANAGER::Instance();
REGISTER_TYPE( MODULE ); REGISTER_TYPE( FOOTPRINT );
propMgr.AddTypeCast( new TYPE_CAST<MODULE, BOARD_ITEM> ); propMgr.AddTypeCast( new TYPE_CAST<FOOTPRINT, BOARD_ITEM> );
propMgr.AddTypeCast( new TYPE_CAST<MODULE, BOARD_ITEM_CONTAINER> ); propMgr.AddTypeCast( new TYPE_CAST<FOOTPRINT, BOARD_ITEM_CONTAINER> );
propMgr.InheritsAfter( TYPE_HASH( MODULE ), TYPE_HASH( BOARD_ITEM ) ); propMgr.InheritsAfter( TYPE_HASH( FOOTPRINT ), TYPE_HASH( BOARD_ITEM ) );
propMgr.InheritsAfter( TYPE_HASH( MODULE ), TYPE_HASH( BOARD_ITEM_CONTAINER ) ); propMgr.InheritsAfter( TYPE_HASH( FOOTPRINT ), TYPE_HASH( BOARD_ITEM_CONTAINER ) );
auto layer = new PROPERTY_ENUM<MODULE, PCB_LAYER_ID, BOARD_ITEM>( _HKI( "Layer" ), auto layer = new PROPERTY_ENUM<FOOTPRINT, PCB_LAYER_ID, BOARD_ITEM>( _HKI( "Layer" ),
&MODULE::SetLayer, &MODULE::GetLayer ); &FOOTPRINT::SetLayer, &FOOTPRINT::GetLayer );
layer->SetChoices( fpLayers ); layer->SetChoices( fpLayers );
propMgr.ReplaceProperty( TYPE_HASH( BOARD_ITEM ), _HKI( "Layer" ), layer ); propMgr.ReplaceProperty( TYPE_HASH( BOARD_ITEM ), _HKI( "Layer" ), layer );
propMgr.AddProperty( new PROPERTY<MODULE, wxString>( _HKI( "Reference" ), propMgr.AddProperty( new PROPERTY<FOOTPRINT, wxString>( _HKI( "Reference" ),
&MODULE::SetReference, &MODULE::GetReference ) ); &FOOTPRINT::SetReference, &FOOTPRINT::GetReference ) );
propMgr.AddProperty( new PROPERTY<MODULE, wxString>( _HKI( "Value" ), propMgr.AddProperty( new PROPERTY<FOOTPRINT, wxString>( _HKI( "Value" ),
&MODULE::SetValue, &MODULE::GetValue ) ); &FOOTPRINT::SetValue, &FOOTPRINT::GetValue ) );
propMgr.AddProperty( new PROPERTY<MODULE, double>( _HKI( "Orientation" ), propMgr.AddProperty( new PROPERTY<FOOTPRINT, double>( _HKI( "Orientation" ),
&MODULE::SetOrientationDegrees, &MODULE::GetOrientationDegrees, &FOOTPRINT::SetOrientationDegrees, &FOOTPRINT::GetOrientationDegrees,
PROPERTY_DISPLAY::DEGREE ) ); PROPERTY_DISPLAY::DEGREE ) );
propMgr.AddProperty( new PROPERTY<MODULE, int>( _HKI( "Local Clearance" ), propMgr.AddProperty( new PROPERTY<FOOTPRINT, int>( _HKI( "Local Clearance" ),
&MODULE::SetLocalClearance, &MODULE::GetLocalClearance, &FOOTPRINT::SetLocalClearance, &FOOTPRINT::GetLocalClearance,
PROPERTY_DISPLAY::DISTANCE ) ); PROPERTY_DISPLAY::DISTANCE ) );
propMgr.AddProperty( new PROPERTY<MODULE, int>( _HKI( "Local Solderpaste Margin" ), propMgr.AddProperty( new PROPERTY<FOOTPRINT, int>( _HKI( "Local Solderpaste Margin" ),
&MODULE::SetLocalSolderPasteMargin, &MODULE::GetLocalSolderPasteMargin, &FOOTPRINT::SetLocalSolderPasteMargin, &FOOTPRINT::GetLocalSolderPasteMargin,
PROPERTY_DISPLAY::DISTANCE ) ); PROPERTY_DISPLAY::DISTANCE ) );
propMgr.AddProperty( new PROPERTY<MODULE, double>( _HKI( "Local Solderpaste Margin Ratio" ), propMgr.AddProperty( new PROPERTY<FOOTPRINT, double>( _HKI( "Local Solderpaste Margin Ratio" ),
&MODULE::SetLocalSolderPasteMarginRatio, &MODULE::GetLocalSolderPasteMarginRatio ) ); &FOOTPRINT::SetLocalSolderPasteMarginRatio, &FOOTPRINT::GetLocalSolderPasteMarginRatio ) );
propMgr.AddProperty( new PROPERTY<MODULE, int>( _HKI( "Thermal Width" ), propMgr.AddProperty( new PROPERTY<FOOTPRINT, int>( _HKI( "Thermal Width" ),
&MODULE::SetThermalWidth, &MODULE::GetThermalWidth, &FOOTPRINT::SetThermalWidth, &FOOTPRINT::GetThermalWidth,
PROPERTY_DISPLAY::DISTANCE ) ); PROPERTY_DISPLAY::DISTANCE ) );
propMgr.AddProperty( new PROPERTY<MODULE, int>( _HKI( "Thermal Gap" ), propMgr.AddProperty( new PROPERTY<FOOTPRINT, int>( _HKI( "Thermal Gap" ),
&MODULE::SetThermalGap, &MODULE::GetThermalGap, &FOOTPRINT::SetThermalGap, &FOOTPRINT::GetThermalGap,
PROPERTY_DISPLAY::DISTANCE ) ); PROPERTY_DISPLAY::DISTANCE ) );
// TODO zone connection, FPID? // TODO zone connection, FPID?
} }

View File

@ -101,23 +101,23 @@ public:
DECL_DEQ_FOR_SWIG( PADS, PAD* ) DECL_DEQ_FOR_SWIG( PADS, PAD* )
DECL_DEQ_FOR_SWIG( DRAWINGS, BOARD_ITEM* ) DECL_DEQ_FOR_SWIG( DRAWINGS, BOARD_ITEM* )
DECL_VEC_FOR_SWIG( FP_ZONES, FP_ZONE* ) DECL_VEC_FOR_SWIG( FP_ZONES, FP_ZONE* )
DECL_VEC_FOR_SWIG( MODULE_GROUPS, PCB_GROUP* ) DECL_VEC_FOR_SWIG( FP_GROUPS, PCB_GROUP* )
DECL_DEQ_FOR_SWIG( MODULES, MODULE* ) DECL_DEQ_FOR_SWIG( FOOTPRINTS, FOOTPRINT* )
class MODULE : public BOARD_ITEM_CONTAINER class FOOTPRINT : public BOARD_ITEM_CONTAINER
{ {
public: public:
MODULE( BOARD* parent ); FOOTPRINT( BOARD* parent );
MODULE( const MODULE& aFootprint ); FOOTPRINT( const FOOTPRINT& aFootprint );
// Move constructor and operator needed due to std containers inside the footprint // Move constructor and operator needed due to std containers inside the footprint
MODULE( MODULE&& aFootprint ); FOOTPRINT( FOOTPRINT&& aFootprint );
~MODULE(); ~FOOTPRINT();
MODULE& operator=( const MODULE& aOther ); FOOTPRINT& operator=( const FOOTPRINT& aOther );
MODULE& operator=( MODULE&& aOther ); FOOTPRINT& operator=( FOOTPRINT&& aOther );
static inline bool ClassOf( const EDA_ITEM* aItem ) static inline bool ClassOf( const EDA_ITEM* aItem )
{ {
@ -187,8 +187,8 @@ public:
FP_ZONES& Zones() { return m_fp_zones; } FP_ZONES& Zones() { return m_fp_zones; }
const FP_ZONES& Zones() const { return m_fp_zones; } const FP_ZONES& Zones() const { return m_fp_zones; }
MODULE_GROUPS& Groups() { return m_fp_groups; } FP_GROUPS& Groups() { return m_fp_groups; }
const MODULE_GROUPS& Groups() const { return m_fp_groups; } const FP_GROUPS& Groups() const { return m_fp_groups; }
bool HasThroughHolePads() const; bool HasThroughHolePads() const;
@ -694,7 +694,7 @@ private:
DRAWINGS m_drawings; // BOARD_ITEMs for drawings on the board, owned by pointer. DRAWINGS m_drawings; // BOARD_ITEMs for drawings on the board, owned by pointer.
PADS m_pads; // PAD items, owned by pointer PADS m_pads; // PAD items, owned by pointer
FP_ZONES m_fp_zones; // FP_ZONE items, owned by pointer FP_ZONES m_fp_zones; // FP_ZONE items, owned by pointer
MODULE_GROUPS m_fp_groups; // PCB_GROUP items, owned by pointer FP_GROUPS m_fp_groups; // PCB_GROUP items, owned by pointer
double m_orient; // Orientation in tenths of a degree, 900=90.0 degrees. double m_orient; // Orientation in tenths of a degree, 900=90.0 degrees.
wxPoint m_pos; // Position of footprint on the board in internal units. wxPoint m_pos; // Position of footprint on the board in internal units.

View File

@ -374,7 +374,7 @@ LIB_ID FOOTPRINT_EDIT_FRAME::GetTargetFPID() const
LIB_ID FOOTPRINT_EDIT_FRAME::GetLoadedFPID() const LIB_ID FOOTPRINT_EDIT_FRAME::GetLoadedFPID() const
{ {
MODULE* footprint = GetBoard()->GetFirstFootprint(); FOOTPRINT* footprint = GetBoard()->GetFirstFootprint();
if( footprint ) if( footprint )
return LIB_ID( footprint->GetFPID().GetLibNickname(), m_footprintNameWhenLoaded ); return LIB_ID( footprint->GetFPID().GetLibNickname(), m_footprintNameWhenLoaded );
@ -394,7 +394,7 @@ void FOOTPRINT_EDIT_FRAME::ClearModify()
bool FOOTPRINT_EDIT_FRAME::IsCurrentFPFromBoard() const bool FOOTPRINT_EDIT_FRAME::IsCurrentFPFromBoard() const
{ {
MODULE* footprint = GetBoard()->GetFirstFootprint(); FOOTPRINT* footprint = GetBoard()->GetFirstFootprint();
return ( footprint && footprint->GetLink() != niluuid ); return ( footprint && footprint->GetLink() != niluuid );
} }
@ -423,7 +423,7 @@ void FOOTPRINT_EDIT_FRAME::restoreLastFootprint()
id.SetLibNickname( libNickname ); id.SetLibNickname( libNickname );
id.SetLibItemName( footprintName ); id.SetLibItemName( footprintName );
MODULE* footprint = loadFootprint( id ); FOOTPRINT* footprint = loadFootprint( id );
if( footprint ) if( footprint )
AddFootprintToBoard( footprint ); AddFootprintToBoard( footprint );
@ -431,9 +431,9 @@ void FOOTPRINT_EDIT_FRAME::restoreLastFootprint()
} }
void FOOTPRINT_EDIT_FRAME::AddFootprintToBoard( MODULE* aFootprint ) void FOOTPRINT_EDIT_FRAME::AddFootprintToBoard( FOOTPRINT* aFootprint )
{ {
m_revertModule.reset( (MODULE*) aFootprint->Clone() ); m_revertModule.reset( (FOOTPRINT*) aFootprint->Clone() );
m_footprintNameWhenLoaded = aFootprint->GetFPID().GetLibItemName(); m_footprintNameWhenLoaded = aFootprint->GetFPID().GetLibItemName();
@ -542,7 +542,7 @@ MAGNETIC_SETTINGS* FOOTPRINT_EDIT_FRAME::GetMagneticItemsSettings()
const BOX2I FOOTPRINT_EDIT_FRAME::GetDocumentExtents( bool aIncludeAllVisible ) const const BOX2I FOOTPRINT_EDIT_FRAME::GetDocumentExtents( bool aIncludeAllVisible ) const
{ {
MODULE* footprint = GetBoard()->GetFirstFootprint(); FOOTPRINT* footprint = GetBoard()->GetFirstFootprint();
if( footprint ) if( footprint )
{ {
@ -653,7 +653,7 @@ void FOOTPRINT_EDIT_FRAME::OnUpdateSaveFootprintToBoard( wxUpdateUIEvent& aEvent
{ {
PCB_EDIT_FRAME* frame = (PCB_EDIT_FRAME*) Kiway().Player( FRAME_PCB_EDITOR, false ); PCB_EDIT_FRAME* frame = (PCB_EDIT_FRAME*) Kiway().Player( FRAME_PCB_EDITOR, false );
MODULE* editorFootprint = GetBoard()->GetFirstFootprint(); FOOTPRINT* editorFootprint = GetBoard()->GetFirstFootprint();
bool canInsert = frame && editorFootprint && editorFootprint->GetLink() == niluuid; bool canInsert = frame && editorFootprint && editorFootprint->GetLink() == niluuid;
// If the source was deleted, the footprint can inserted but not updated in the board. // If the source was deleted, the footprint can inserted but not updated in the board.
@ -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->Footprints() ) for( FOOTPRINT* candidate : mainpcb->Footprints() )
{ {
if( editorFootprint->GetLink() == candidate->m_Uuid ) if( editorFootprint->GetLink() == candidate->m_Uuid )
{ {
@ -716,7 +716,7 @@ void FOOTPRINT_EDIT_FRAME::updateTitle()
{ {
wxString title; wxString title;
LIB_ID fpid = GetLoadedFPID(); LIB_ID fpid = GetLoadedFPID();
MODULE* footprint = GetBoard()->GetFirstFootprint(); FOOTPRINT* footprint = GetBoard()->GetFirstFootprint();
bool writable = true; bool writable = true;
if( IsCurrentFPFromBoard() ) if( IsCurrentFPFromBoard() )

View File

@ -44,7 +44,7 @@ class FOOTPRINT_EDIT_FRAME : public PCB_BASE_EDIT_FRAME
wxObjectDataPtr<LIB_TREE_MODEL_ADAPTER> m_adapter; wxObjectDataPtr<LIB_TREE_MODEL_ADAPTER> m_adapter;
std::unique_ptr<MODULE> m_revertModule; std::unique_ptr<FOOTPRINT> m_revertModule;
wxString m_footprintNameWhenLoaded; wxString m_footprintNameWhenLoaded;
int m_defaultLibWidth; int m_defaultLibWidth;
@ -180,10 +180,10 @@ public:
* @param aFootprint = the given footprint * @param aFootprint = the given footprint
* @return : true if OK, false if abort * @return : true if OK, false if abort
*/ */
bool SaveFootprint( MODULE* aFootprint ); bool SaveFootprint( FOOTPRINT* aFootprint );
bool SaveFootprintAs( MODULE* aFootprint ); bool SaveFootprintAs( FOOTPRINT* aFootprint );
bool SaveFootprintToBoard( bool aAddNew ); bool SaveFootprintToBoard( bool aAddNew );
bool SaveFootprintInLibrary( MODULE* aFootprint, const wxString& aLibraryName ); bool SaveFootprintInLibrary( FOOTPRINT* aFootprint, const wxString& aLibraryName );
bool RevertFootprint(); bool RevertFootprint();
/** /**
@ -221,7 +221,7 @@ public:
/** /**
* Create a file containing only one footprint. * Create a file containing only one footprint.
*/ */
void ExportFootprint( MODULE* aFootprint ); void ExportFootprint( FOOTPRINT* aFootprint );
/** /**
* Read a file containing only one footprint. * Read a file containing only one footprint.
@ -229,7 +229,7 @@ public:
* The import function can also read gpcb footprint file, in Newlib format. * The import function can also read gpcb footprint file, in Newlib format.
* (One footprint per file, Newlib files have no special ext.) * (One footprint per file, Newlib files have no special ext.)
*/ */
MODULE* ImportFootprint( const wxString& aName = wxT( "") ); FOOTPRINT* ImportFootprint( const wxString& aName = wxT( "") );
/** /**
* Load a footprint from the main board into the Footprint Editor. * Load a footprint from the main board into the Footprint Editor.
@ -238,14 +238,14 @@ public:
* footprint reference. * footprint reference.
* @return true if a footprint is loaded. * @return true if a footprint is loaded.
*/ */
bool LoadFootprintFromBoard( MODULE* aFootprint ); bool LoadFootprintFromBoard( FOOTPRINT* aFootprint );
/** /**
* Display the list of footprints currently existing on the BOARD. * Display the list of footprints currently existing on the BOARD.
* *
* @return the selected footprint or nullptr * @return the selected footprint or nullptr
*/ */
MODULE* SelectFootprintFromBoard( BOARD* aPcb ); FOOTPRINT* SelectFootprintFromBoard( BOARD* aPcb );
/** /**
* Delete the given footprint from its library. * Delete the given footprint from its library.
@ -281,7 +281,7 @@ public:
* Override from PCB_BASE_EDIT_FRAME which adds a footprint to the editor's dummy board, * Override from PCB_BASE_EDIT_FRAME which adds a footprint to the editor's dummy board,
* NOT to the user's PCB. * NOT to the user's PCB.
*/ */
void AddFootprintToBoard( MODULE* aFootprint ) override; void AddFootprintToBoard( FOOTPRINT* aFootprint ) override;
/** /**
* Allows Modedit to install its preferences panel into the preferences dialog. * Allows Modedit to install its preferences panel into the preferences dialog.
@ -347,7 +347,7 @@ protected:
/** /**
* Run the Footprint Properties dialog and handle changes made in it. * Run the Footprint Properties dialog and handle changes made in it.
*/ */
void editFootprintProperties( MODULE* aFootprint ); void editFootprintProperties( FOOTPRINT* aFootprint );
void setupUIConditions() override; void setupUIConditions() override;
}; };

View File

@ -50,7 +50,7 @@ void FOOTPRINT_EDIT_FRAME::LoadFootprintFromLibrary( LIB_ID aFPID)
{ {
bool is_last_fp_from_brd = IsCurrentFPFromBoard(); bool is_last_fp_from_brd = IsCurrentFPFromBoard();
MODULE* footprint = LoadFootprint( aFPID ); FOOTPRINT* footprint = LoadFootprint( aFPID );
if( !footprint ) if( !footprint )
return; return;
@ -122,7 +122,7 @@ void FOOTPRINT_EDIT_FRAME::SaveFootprintToBoard( wxCommandEvent& event )
class BASIC_FOOTPRINT_INFO : public FOOTPRINT_INFO class BASIC_FOOTPRINT_INFO : public FOOTPRINT_INFO
{ {
public: public:
BASIC_FOOTPRINT_INFO( MODULE* aFootprint ) BASIC_FOOTPRINT_INFO( FOOTPRINT* aFootprint )
{ {
m_nickname = aFootprint->GetFPID().GetLibNickname().wx_str(); m_nickname = aFootprint->GetFPID().GetLibNickname().wx_str();
m_fpname = aFootprint->GetFPID().GetLibItemName().wx_str(); m_fpname = aFootprint->GetFPID().GetLibItemName().wx_str();
@ -135,7 +135,7 @@ public:
}; };
void FOOTPRINT_EDIT_FRAME::editFootprintProperties( MODULE* aFootprint ) void FOOTPRINT_EDIT_FRAME::editFootprintProperties( FOOTPRINT* aFootprint )
{ {
LIB_ID oldFPID = aFootprint->GetFPID(); LIB_ID oldFPID = aFootprint->GetFPID();
@ -164,11 +164,11 @@ void FOOTPRINT_EDIT_FRAME::OnEditItemRequest( BOARD_ITEM* aItem )
switch( aItem->Type() ) switch( aItem->Type() )
{ {
case PCB_PAD_T: case PCB_PAD_T:
ShowPadPropertiesDialog( static_cast<PAD*>( aItem )); ShowPadPropertiesDialog( static_cast<PAD*>( aItem ) );
break; break;
case PCB_FOOTPRINT_T: case PCB_FOOTPRINT_T:
editFootprintProperties( (MODULE*) aItem ); editFootprintProperties( static_cast<FOOTPRINT*>( aItem ) );
GetCanvas()->Refresh(); GetCanvas()->Refresh();
break; break;

View File

@ -46,7 +46,7 @@ void FOOTPRINT_INFO_IMPL::load()
wxASSERT( fptable ); wxASSERT( fptable );
const MODULE* footprint = fptable->GetEnumeratedFootprint( m_nickname, m_fpname ); const FOOTPRINT* footprint = fptable->GetEnumeratedFootprint( m_nickname, m_fpname );
if( footprint == NULL ) // Should happen only with malformed/broken libraries if( footprint == NULL ) // Should happen only with malformed/broken libraries
{ {

View File

@ -148,7 +148,7 @@ static IO_MGR::PCB_FILE_T detect_file_type( FILE* aFile, const wxFileName& aFile
* @param aFileType - type of the file * @param aFileType - type of the file
* @param aName - name of the footprint * @param aName - name of the footprint
*/ */
static MODULE* parse_module_with_plugin( const wxFileName& aFileName, static FOOTPRINT* parse_module_with_plugin( const wxFileName& aFileName,
IO_MGR::PCB_FILE_T aFileType, IO_MGR::PCB_FILE_T aFileType,
const wxString& aName ) const wxString& aName )
{ {
@ -176,7 +176,7 @@ static MODULE* parse_module_with_plugin( const wxFileName& aFileName,
* Parse a KICAD footprint. * Parse a KICAD footprint.
* @param aFileName - file name to parse * @param aFileName - file name to parse
*/ */
static MODULE* parse_module_kicad( const wxFileName& aFileName ) static FOOTPRINT* parse_module_kicad( const wxFileName& aFileName )
{ {
wxString fcontents; wxString fcontents;
PCB_IO pcb_io; PCB_IO pcb_io;
@ -187,7 +187,7 @@ static MODULE* parse_module_kicad( const wxFileName& aFileName )
f.ReadAll( &fcontents ); f.ReadAll( &fcontents );
return dynamic_cast<MODULE*>( pcb_io.Parse( fcontents ) ); return dynamic_cast<FOOTPRINT*>( pcb_io.Parse( fcontents ) );
} }
@ -197,10 +197,10 @@ static MODULE* parse_module_kicad( const wxFileName& aFileName )
* @param aFileType - type of the file to load * @param aFileType - type of the file to load
* @param aName - footprint name * @param aName - footprint name
*/ */
MODULE* try_load_footprint( const wxFileName& aFileName, IO_MGR::PCB_FILE_T aFileType, FOOTPRINT* try_load_footprint( const wxFileName& aFileName, IO_MGR::PCB_FILE_T aFileType,
const wxString& aName ) const wxString& aName )
{ {
MODULE* footprint; FOOTPRINT* footprint;
switch( aFileType ) switch( aFileType )
{ {
@ -222,7 +222,7 @@ MODULE* try_load_footprint( const wxFileName& aFileName, IO_MGR::PCB_FILE_T aFil
} }
MODULE* FOOTPRINT_EDIT_FRAME::ImportFootprint( const wxString& aName ) FOOTPRINT* FOOTPRINT_EDIT_FRAME::ImportFootprint( const wxString& aName )
{ {
wxString lastOpenedPathForLoading = m_mruPath; wxString lastOpenedPathForLoading = m_mruPath;
FOOTPRINT_EDITOR_SETTINGS* cfg = GetSettings(); FOOTPRINT_EDITOR_SETTINGS* cfg = GetSettings();
@ -260,7 +260,7 @@ MODULE* FOOTPRINT_EDIT_FRAME::ImportFootprint( const wxString& aName )
return NULL; return NULL;
} }
MODULE* footprint = NULL; FOOTPRINT* footprint = NULL;
try try
{ {
@ -306,7 +306,7 @@ MODULE* FOOTPRINT_EDIT_FRAME::ImportFootprint( const wxString& aName )
} }
void FOOTPRINT_EDIT_FRAME::ExportFootprint( MODULE* aFootprint ) void FOOTPRINT_EDIT_FRAME::ExportFootprint( FOOTPRINT* aFootprint )
{ {
wxFileName fn; wxFileName fn;
FOOTPRINT_EDITOR_SETTINGS* cfg = GetSettings(); FOOTPRINT_EDITOR_SETTINGS* cfg = GetSettings();
@ -621,7 +621,7 @@ void PCB_EDIT_FRAME::ExportFootprintsToLibrary( bool aStoreInNewLib, const wxStr
wxString footprintName; wxString footprintName;
auto resetReference = auto resetReference =
[]( MODULE* aFootprint ) []( FOOTPRINT* aFootprint )
{ {
aFootprint->SetReference( "REF**" ); aFootprint->SetReference( "REF**" );
}; };
@ -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()->Footprints() ) for( FOOTPRINT* footprint : GetBoard()->Footprints() )
{ {
try try
{ {
@ -646,7 +646,7 @@ void PCB_EDIT_FRAME::ExportFootprintsToLibrary( bool aStoreInNewLib, const wxStr
if( !footprint->GetFPID().GetLibItemName().empty() ) // Handle old boards. if( !footprint->GetFPID().GetLibItemName().empty() ) // Handle old boards.
{ {
MODULE* fpCopy = static_cast<MODULE*>( footprint->Duplicate() ); FOOTPRINT* fpCopy = static_cast<FOOTPRINT*>( footprint->Duplicate() );
resetReference( fpCopy ); resetReference( fpCopy );
tbl->FootprintSave( nickname, fpCopy, true ); tbl->FootprintSave( nickname, fpCopy, true );
@ -675,13 +675,13 @@ 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()->Footprints() ) for( FOOTPRINT* footprint : GetBoard()->Footprints() )
{ {
try try
{ {
if( !footprint->GetFPID().GetLibItemName().empty() ) // Handle old boards. if( !footprint->GetFPID().GetLibItemName().empty() ) // Handle old boards.
{ {
MODULE* fpCopy = static_cast<MODULE*>( footprint->Duplicate() ); FOOTPRINT* fpCopy = static_cast<FOOTPRINT*>( footprint->Duplicate() );
resetReference( fpCopy ); resetReference( fpCopy );
pi->FootprintSave( libPath, fpCopy ); pi->FootprintSave( libPath, fpCopy );
@ -698,7 +698,7 @@ void PCB_EDIT_FRAME::ExportFootprintsToLibrary( bool aStoreInNewLib, const wxStr
} }
bool FOOTPRINT_EDIT_FRAME::SaveFootprint( MODULE* aFootprint ) bool FOOTPRINT_EDIT_FRAME::SaveFootprint( FOOTPRINT* aFootprint )
{ {
if( !aFootprint ) // Happen if no footprint loaded if( !aFootprint ) // Happen if no footprint loaded
return false; return false;
@ -760,7 +760,7 @@ bool FOOTPRINT_EDIT_FRAME::SaveFootprint( MODULE* aFootprint )
} }
bool FOOTPRINT_EDIT_FRAME::SaveFootprintInLibrary( MODULE* aFootprint, bool FOOTPRINT_EDIT_FRAME::SaveFootprintInLibrary( FOOTPRINT* aFootprint,
const wxString& aLibraryName ) const wxString& aLibraryName )
{ {
try try
@ -795,8 +795,8 @@ bool FOOTPRINT_EDIT_FRAME::SaveFootprintToBoard( bool aAddNew )
} }
BOARD* mainpcb = pcbframe->GetBoard(); BOARD* mainpcb = pcbframe->GetBoard();
MODULE* sourceFootprint = NULL; FOOTPRINT* sourceFootprint = NULL;
MODULE* editorFootprint = GetBoard()->GetFirstFootprint(); FOOTPRINT* editorFootprint = GetBoard()->GetFirstFootprint();
// Search the old footprint (source) if exists // Search the old footprint (source) if exists
// Because this source could be deleted when editing the main board... // Because this source could be deleted when editing the main board...
@ -804,7 +804,7 @@ bool FOOTPRINT_EDIT_FRAME::SaveFootprintToBoard( bool aAddNew )
{ {
sourceFootprint = nullptr; sourceFootprint = nullptr;
for( MODULE* candidate : mainpcb->Footprints() ) for( FOOTPRINT* candidate : mainpcb->Footprints() )
{ {
if( editorFootprint->GetLink() == candidate->m_Uuid ) if( editorFootprint->GetLink() == candidate->m_Uuid )
{ {
@ -825,7 +825,7 @@ bool FOOTPRINT_EDIT_FRAME::SaveFootprintToBoard( bool aAddNew )
BOARD_COMMIT commit( pcbframe ); BOARD_COMMIT commit( pcbframe );
// Create the "new" footprint // Create the "new" footprint
MODULE* newFootprint = new MODULE( *editorFootprint ); FOOTPRINT* newFootprint = new FOOTPRINT( *editorFootprint );
const_cast<KIID&>( newFootprint->m_Uuid ) = KIID(); const_cast<KIID&>( newFootprint->m_Uuid ) = KIID();
newFootprint->SetParent( mainpcb ); newFootprint->SetParent( mainpcb );
@ -863,7 +863,7 @@ bool FOOTPRINT_EDIT_FRAME::SaveFootprintToBoard( bool aAddNew )
} }
bool FOOTPRINT_EDIT_FRAME::SaveFootprintAs( MODULE* aFootprint ) bool FOOTPRINT_EDIT_FRAME::SaveFootprintAs( FOOTPRINT* aFootprint )
{ {
if( aFootprint == NULL ) if( aFootprint == NULL )
return false; return false;
@ -906,7 +906,7 @@ bool FOOTPRINT_EDIT_FRAME::SaveFootprintAs( MODULE* aFootprint )
bNameSizer->Add( nameTextCtrl, 1, wxALIGN_CENTER_VERTICAL|wxALL, 5 ); bNameSizer->Add( nameTextCtrl, 1, wxALIGN_CENTER_VERTICAL|wxALL, 5 );
wxTextValidator nameValidator( wxFILTER_EXCLUDE_CHAR_LIST ); wxTextValidator nameValidator( wxFILTER_EXCLUDE_CHAR_LIST );
nameValidator.SetCharExcludes( MODULE::StringLibNameInvalidChars( false ) ); nameValidator.SetCharExcludes( FOOTPRINT::StringLibNameInvalidChars( false ) );
nameTextCtrl->SetValidator( nameValidator ); nameTextCtrl->SetValidator( nameValidator );
wxSizer* mainSizer = dlg.GetSizer(); wxSizer* mainSizer = dlg.GetSizer();
@ -1000,7 +1000,7 @@ bool FOOTPRINT_EDIT_FRAME::RevertFootprint()
if( ConfirmRevertDialog( this, msg ) ) if( ConfirmRevertDialog( this, msg ) )
{ {
Clear_Pcb( false ); Clear_Pcb( false );
AddFootprintToBoard( (MODULE*) m_revertModule->Clone()); AddFootprintToBoard( (FOOTPRINT*) m_revertModule->Clone());
Zoom_Automatique( false ); Zoom_Automatique( false );
@ -1020,7 +1020,7 @@ bool FOOTPRINT_EDIT_FRAME::RevertFootprint()
} }
MODULE* PCB_BASE_FRAME::CreateNewFootprint( const wxString& aFootprintName ) FOOTPRINT* PCB_BASE_FRAME::CreateNewFootprint( const wxString& aFootprintName )
{ {
wxString footprintName = aFootprintName; wxString footprintName = aFootprintName;
@ -1045,7 +1045,7 @@ MODULE* PCB_BASE_FRAME::CreateNewFootprint( const wxString& aFootprintName )
} }
// Creates the new footprint and add it to the head of the linked list of footprints // Creates the new footprint and add it to the head of the linked list of footprints
MODULE* footprint = new MODULE( GetBoard() ); FOOTPRINT* footprint = new FOOTPRINT( GetBoard() );
// Update parameters: timestamp ... // Update parameters: timestamp ...
footprint->SetLastEditTime(); footprint->SetLastEditTime();

View File

@ -327,7 +327,7 @@ void FOOTPRINT_PREVIEW_PANEL::CacheFootprint( const LIB_ID& aFPID )
} }
void FOOTPRINT_PREVIEW_PANEL::renderFootprint( std::shared_ptr<MODULE> aFootprint ) void FOOTPRINT_PREVIEW_PANEL::renderFootprint( std::shared_ptr<FOOTPRINT> aFootprint )
{ {
if( m_currentFootprint ) if( m_currentFootprint )
{ {

View File

@ -37,7 +37,7 @@
#include <widgets/footprint_preview_widget.h> #include <widgets/footprint_preview_widget.h>
class MODULE; class FOOTPRINT;
class KIWAY; class KIWAY;
class IO_MGR; class IO_MGR;
class BOARD; class BOARD;
@ -77,7 +77,7 @@ private:
struct CACHE_ENTRY struct CACHE_ENTRY
{ {
LIB_ID fpid; LIB_ID fpid;
std::shared_ptr<MODULE> footprint; std::shared_ptr<FOOTPRINT> footprint;
FOOTPRINT_STATUS status; FOOTPRINT_STATUS status;
}; };
@ -98,7 +98,7 @@ private:
void OnLoaderThreadUpdate( wxCommandEvent& aEvent ); void OnLoaderThreadUpdate( wxCommandEvent& aEvent );
void renderFootprint( std::shared_ptr<MODULE> aFootprint ); void renderFootprint( std::shared_ptr<FOOTPRINT> aFootprint );
private: private:
FP_LOADER_THREAD* m_loader; FP_LOADER_THREAD* m_loader;
@ -108,7 +108,7 @@ private:
std::unique_ptr<BOARD> m_dummyBoard; std::unique_ptr<BOARD> m_dummyBoard;
std::unique_ptr<KIGFX::GAL_DISPLAY_OPTIONS> m_displayOptions; std::unique_ptr<KIGFX::GAL_DISPLAY_OPTIONS> m_displayOptions;
std::shared_ptr<MODULE> m_currentFootprint; std::shared_ptr<FOOTPRINT> m_currentFootprint;
LIB_ID m_currentFPID; LIB_ID m_currentFPID;
bool m_footprintDisplayed; bool m_footprintDisplayed;
}; };

View File

@ -663,7 +663,7 @@ void FOOTPRINT_VIEWER_FRAME::ClickOnFootprintList( wxCommandEvent& aEvent )
// Delete the current footprint (MUST reset tools first) // Delete the current footprint (MUST reset tools first)
GetToolManager()->ResetTools( TOOL_BASE::MODEL_RELOAD ); GetToolManager()->ResetTools( TOOL_BASE::MODEL_RELOAD );
GetBoard()->DeleteAllModules(); GetBoard()->DeleteAllFootprints();
LIB_ID id; LIB_ID id;
id.SetLibNickname( getCurNickname() ); id.SetLibNickname( getCurNickname() );
@ -733,7 +733,7 @@ void FOOTPRINT_VIEWER_FRAME::AddFootprintToPCB( wxCommandEvent& aEvent )
BOARD_COMMIT commit( pcbframe ); BOARD_COMMIT commit( pcbframe );
// Create the "new" footprint // Create the "new" footprint
MODULE* newFootprint = (MODULE*) GetBoard()->GetFirstFootprint()->Duplicate(); FOOTPRINT* newFootprint = (FOOTPRINT*) GetBoard()->GetFirstFootprint()->Duplicate();
newFootprint->SetParent( pcbframe->GetBoard() ); newFootprint->SetParent( pcbframe->GetBoard() );
newFootprint->SetLink( 0 ); newFootprint->SetLink( 0 );
@ -1027,9 +1027,9 @@ void FOOTPRINT_VIEWER_FRAME::SelectAndViewFootprint( int aMode )
setCurFootprintName( m_fpList->GetString((unsigned) selection ) ); setCurFootprintName( m_fpList->GetString((unsigned) selection ) );
// Delete the current footprint // Delete the current footprint
GetBoard()->DeleteAllModules(); GetBoard()->DeleteAllFootprints();
MODULE* footprint = Prj().PcbFootprintLibs()->FootprintLoad( getCurNickname(), FOOTPRINT* footprint = Prj().PcbFootprintLibs()->FootprintLoad( getCurNickname(),
getCurFootprintName() ); getCurFootprintName() );
if( footprint ) if( footprint )

View File

@ -151,7 +151,7 @@ public:
* @param aMessage a wxString to store messages (if any) generated by the * @param aMessage a wxString to store messages (if any) generated by the
* footprint generator * footprint generator
*/ */
virtual MODULE* GetFootprint( wxString* aMessage ) = 0; virtual FOOTPRINT* GetFootprint( wxString* aMessage ) = 0;
/** /**
* Function GetObject * Function GetObject

View File

@ -80,7 +80,7 @@ public:
///> @copydoc PCB_BASE_FRAME::GetModel() ///> @copydoc PCB_BASE_FRAME::GetModel()
BOARD_ITEM_CONTAINER* GetModel() const override; BOARD_ITEM_CONTAINER* GetModel() const override;
MODULE* GetBuiltFootprint(); FOOTPRINT* GetBuiltFootprint();
/** /**
* Reload the Python plugins if they are newer than * Reload the Python plugins if they are newer than

View File

@ -99,11 +99,11 @@ void FOOTPRINT_WIZARD_FRAME::ReloadFootprint()
m_toolManager->ResetTools( TOOL_BASE::MODEL_RELOAD ); m_toolManager->ResetTools( TOOL_BASE::MODEL_RELOAD );
// Delete the current footprint // Delete the current footprint
GetBoard()->DeleteAllModules(); GetBoard()->DeleteAllFootprints();
// Creates the footprint // Creates the footprint
wxString msg; wxString msg;
MODULE* footprint = footprintWizard->GetFootprint( &msg ); FOOTPRINT* footprint = footprintWizard->GetFootprint( &msg );
DisplayBuildMessage( msg ); DisplayBuildMessage( msg );
if( footprint ) if( footprint )
@ -141,14 +141,14 @@ FOOTPRINT_WIZARD* FOOTPRINT_WIZARD_FRAME::GetMyWizard()
} }
MODULE* FOOTPRINT_WIZARD_FRAME::GetBuiltFootprint() FOOTPRINT* FOOTPRINT_WIZARD_FRAME::GetBuiltFootprint()
{ {
FOOTPRINT_WIZARD* footprintWizard = FOOTPRINT_WIZARD_LIST::GetWizard( m_wizardName ); FOOTPRINT_WIZARD* footprintWizard = FOOTPRINT_WIZARD_LIST::GetWizard( m_wizardName );
if( footprintWizard && m_modal_ret_val ) if( footprintWizard && m_modal_ret_val )
{ {
wxString msg; wxString msg;
MODULE * footprint = footprintWizard->GetFootprint( &msg ); FOOTPRINT* footprint = footprintWizard->GetFootprint( &msg );
DisplayBuildMessage( msg ); DisplayBuildMessage( msg );
return footprint; return footprint;

View File

@ -35,7 +35,7 @@
#include <view/view.h> #include <view/view.h>
FP_SHAPE::FP_SHAPE( MODULE* parent, PCB_SHAPE_TYPE_T aShape ) : FP_SHAPE::FP_SHAPE( FOOTPRINT* parent, PCB_SHAPE_TYPE_T aShape ) :
PCB_SHAPE( parent, PCB_FP_SHAPE_T ) PCB_SHAPE( parent, PCB_FP_SHAPE_T )
{ {
m_Shape = aShape; m_Shape = aShape;
@ -51,7 +51,7 @@ FP_SHAPE::~FP_SHAPE()
void FP_SHAPE::SetLocalCoord() void FP_SHAPE::SetLocalCoord()
{ {
MODULE* fp = (MODULE*) m_Parent; FOOTPRINT* fp = (FOOTPRINT*) m_Parent;
if( fp == NULL ) if( fp == NULL )
{ {
@ -79,7 +79,7 @@ void FP_SHAPE::SetLocalCoord()
void FP_SHAPE::SetDrawCoord() void FP_SHAPE::SetDrawCoord()
{ {
MODULE* fp = (MODULE*) m_Parent; FOOTPRINT* fp = (FOOTPRINT*) m_Parent;
m_Start = m_Start0; m_Start = m_Start0;
m_End = m_End0; m_End = m_End0;
@ -110,8 +110,7 @@ void FP_SHAPE::SetDrawCoord()
void FP_SHAPE::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>& aList ) void FP_SHAPE::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>& aList )
{ {
wxString msg; wxString msg;
FOOTPRINT* fp = (FOOTPRINT*) m_Parent;
MODULE* fp = (MODULE*) m_Parent;
if( !fp ) if( !fp )
return; return;

View File

@ -39,7 +39,7 @@ class MSG_PANEL_ITEM;
class FP_SHAPE : public PCB_SHAPE class FP_SHAPE : public PCB_SHAPE
{ {
public: public:
FP_SHAPE( MODULE* parent, PCB_SHAPE_TYPE_T aShape = S_SEGMENT ); FP_SHAPE( FOOTPRINT* parent, PCB_SHAPE_TYPE_T aShape = S_SEGMENT );
// Do not create a copy constructor & operator=. // Do not create a copy constructor & operator=.
// The ones generated by the compiler are adequate. // The ones generated by the compiler are adequate.

View File

@ -31,11 +31,11 @@
#include <settings/settings_manager.h> #include <settings/settings_manager.h>
#include <trigo.h> #include <trigo.h>
FP_TEXT::FP_TEXT( MODULE* aParentFootprint, TEXT_TYPE text_type ) : FP_TEXT::FP_TEXT( FOOTPRINT* aParentFootprint, TEXT_TYPE text_type ) :
BOARD_ITEM( aParentFootprint, PCB_FP_TEXT_T ), BOARD_ITEM( aParentFootprint, PCB_FP_TEXT_T ),
EDA_TEXT() EDA_TEXT()
{ {
MODULE* parentFootprint = static_cast<MODULE*>( m_Parent ); FOOTPRINT* parentFootprint = static_cast<FOOTPRINT*>( m_Parent );
m_Type = text_type; m_Type = text_type;
m_keepUpright = true; m_keepUpright = true;
@ -197,7 +197,7 @@ int FP_TEXT::GetLength() const
void FP_TEXT::SetDrawCoord() void FP_TEXT::SetDrawCoord()
{ {
const MODULE* parentFootprint = static_cast<const MODULE*>( m_Parent ); const FOOTPRINT* parentFootprint = static_cast<const FOOTPRINT*>( m_Parent );
SetTextPos( m_Pos0 ); SetTextPos( m_Pos0 );
@ -216,7 +216,7 @@ void FP_TEXT::SetDrawCoord()
void FP_TEXT::SetLocalCoord() void FP_TEXT::SetLocalCoord()
{ {
const MODULE* parentFootprint = static_cast<const MODULE*>( m_Parent ); const FOOTPRINT* parentFootprint = static_cast<const FOOTPRINT*>( m_Parent );
if( parentFootprint ) if( parentFootprint )
{ {
@ -246,7 +246,7 @@ const EDA_RECT FP_TEXT::GetBoundingBox() const
double FP_TEXT::GetDrawRotation() const double FP_TEXT::GetDrawRotation() const
{ {
MODULE* parentFootprint = (MODULE*) m_Parent; FOOTPRINT* parentFootprint = static_cast<FOOTPRINT*>( m_Parent );
double rotation = GetTextAngle(); double rotation = GetTextAngle();
if( parentFootprint ) if( parentFootprint )
@ -273,7 +273,7 @@ double FP_TEXT::GetDrawRotation() const
// see class_text_mod.h // see class_text_mod.h
void FP_TEXT::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>& aList ) void FP_TEXT::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>& aList )
{ {
MODULE* parentFootprint = (MODULE*) m_Parent; FOOTPRINT* parentFootprint = static_cast<FOOTPRINT*>( m_Parent );
if( parentFootprint == NULL ) // Happens in modedit, and for new texts if( parentFootprint == NULL ) // Happens in modedit, and for new texts
return; return;
@ -331,17 +331,17 @@ wxString FP_TEXT::GetSelectMenuText( EDA_UNITS aUnits ) const
{ {
case TEXT_is_REFERENCE: case TEXT_is_REFERENCE:
return wxString::Format( _( "Reference '%s'" ), return wxString::Format( _( "Reference '%s'" ),
static_cast<MODULE*>( GetParent() )->GetReference() ); static_cast<FOOTPRINT*>( GetParent() )->GetReference() );
case TEXT_is_VALUE: case TEXT_is_VALUE:
return wxString::Format( _( "Value '%s' of %s" ), return wxString::Format( _( "Value '%s' of %s" ),
GetShownText(), GetShownText(),
static_cast<MODULE*>( GetParent() )->GetReference() ); static_cast<FOOTPRINT*>( GetParent() )->GetReference() );
default: default:
return wxString::Format( _( "Footprint Text '%s' of %s" ), return wxString::Format( _( "Footprint Text '%s' of %s" ),
ShortenedShownText(), ShortenedShownText(),
static_cast<MODULE*>( GetParent() )->GetReference() ); static_cast<FOOTPRINT*>( GetParent() )->GetReference() );
} }
} }
@ -421,7 +421,7 @@ double FP_TEXT::ViewGetLOD( int aLayer, KIGFX::VIEW* aView ) const
wxString FP_TEXT::GetShownText( int aDepth ) const wxString FP_TEXT::GetShownText( int aDepth ) const
{ {
const MODULE* parentFootprint = static_cast<MODULE*>( GetParent() ); const FOOTPRINT* parentFootprint = static_cast<FOOTPRINT*>( GetParent() );
wxASSERT( parentFootprint ); wxASSERT( parentFootprint );
const BOARD* board = parentFootprint->GetBoard(); const BOARD* board = parentFootprint->GetBoard();

View File

@ -30,7 +30,7 @@
class LINE_READER; class LINE_READER;
class EDA_RECT; class EDA_RECT;
class MODULE; class FOOTPRINT;
class MSG_PANEL_ITEM; class MSG_PANEL_ITEM;
class PCB_BASE_FRAME; class PCB_BASE_FRAME;
class SHAPE; class SHAPE;
@ -52,7 +52,7 @@ public:
TEXT_is_DIVERS = 2 TEXT_is_DIVERS = 2
}; };
FP_TEXT( MODULE* aParentFootprint, TEXT_TYPE text_type = TEXT_is_DIVERS ); FP_TEXT( FOOTPRINT* aParentFootprint, TEXT_TYPE text_type = TEXT_is_DIVERS );
// Do not create a copy constructor & operator=. // Do not create a copy constructor & operator=.
// The ones generated by the compiler are adequate. // The ones generated by the compiler are adequate.

Some files were not shown because too many files have changed in this diff Show More