diff --git a/3d-viewer/3d_cache/dialogs/panel_prev_3d.cpp b/3d-viewer/3d_cache/dialogs/panel_prev_3d.cpp index fec9cad0e3..b0ce4e6ead 100644 --- a/3d-viewer/3d_cache/dialogs/panel_prev_3d.cpp +++ b/3d-viewer/3d_cache/dialogs/panel_prev_3d.cpp @@ -41,7 +41,7 @@ #include -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* aParentModelList ) : PANEL_PREV_3D_BASE( aParent, wxID_ANY ), m_previewPane( nullptr ), @@ -86,7 +86,7 @@ PANEL_PREV_3D::PANEL_PREV_3D( wxWindow* aParent, PCB_BASE_FRAME* aFrame, MODULE* m_parentModelList = aParentModelList; - m_dummyFootprint = new MODULE( *aFootprint ); + m_dummyFootprint = new FOOTPRINT( *aFootprint ); m_dummyBoard->Add( m_dummyFootprint ); // Create the infobar diff --git a/3d-viewer/3d_cache/dialogs/panel_prev_3d.h b/3d-viewer/3d_cache/dialogs/panel_prev_3d.h index d59cf3b684..5b2ef04e9b 100644 --- a/3d-viewer/3d_cache/dialogs/panel_prev_3d.h +++ b/3d-viewer/3d_cache/dialogs/panel_prev_3d.h @@ -69,12 +69,12 @@ class S3D_CACHE; class FILENAME_RESOLVER; class BOARD; class BOARD_ADAPTER; -class MODULE; +class FOOTPRINT; class PANEL_PREV_3D: public EDA_3D_BOARD_HOLDER, public TOOLS_HOLDER, public PANEL_PREV_3D_BASE { 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* aParentModelList ); ~PANEL_PREV_3D(); @@ -87,7 +87,7 @@ private: CTRACK_BALL m_trackBallCamera; BOARD* m_dummyBoard; - MODULE* m_dummyFootprint; + FOOTPRINT* m_dummyFootprint; std::vector* m_parentModelList; int m_selected; /// Index into m_parentInfoList diff --git a/3d-viewer/3d_canvas/board_adapter.h b/3d-viewer/3d_canvas/board_adapter.h index 11f961460f..3f288d7cd2 100644 --- a/3d-viewer/3d_canvas/board_adapter.h +++ b/3d-viewer/3d_canvas/board_adapter.h @@ -543,13 +543,13 @@ class BOARD_ADAPTER COBJECT2D *createNewPadDrill( const PAD* aPad, int aInflateValue ); - void AddPadsWithClearanceToContainer( const MODULE *aFootprint, + void AddPadsWithClearanceToContainer( const FOOTPRINT *aFootprint, CGENERICCONTAINER2D *aDstContainer, PCB_LAYER_ID aLayerId, int aInflateValue, bool aSkipNPTHPadsWihNoCopper, bool aSkipPlatedPads, bool aSkipNonPlatedPads ); - void AddFPShapesWithClearanceToContainer( const MODULE *aFootprint, + void AddFPShapesWithClearanceToContainer( const FOOTPRINT *aFootprint, CGENERICCONTAINER2D *aDstContainer, PCB_LAYER_ID aLayerId, int aInflateValue ); @@ -580,7 +580,7 @@ class BOARD_ADAPTER void buildPadShapeThickOutlineAsPolygon( const PAD *aPad, SHAPE_POLY_SET &aCornerBuffer, 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; public: diff --git a/3d-viewer/3d_canvas/create_3Dgraphic_brd_items.cpp b/3d-viewer/3d_canvas/create_3Dgraphic_brd_items.cpp index b28c4e82d1..80a771c7b9 100644 --- a/3d-viewer/3d_canvas/create_3Dgraphic_brd_items.cpp +++ b/3d-viewer/3d_canvas/create_3Dgraphic_brd_items.cpp @@ -185,7 +185,7 @@ void BOARD_ADAPTER::AddShapeWithClearanceToContainer( const DIMENSION_BASE* aDim // Based on // void FOOTPRINT::TransformFPShapesWithClearanceToPolygonSet // board_items_to_polygon_shape_transform.cpp#L204 -void BOARD_ADAPTER::AddFPShapesWithClearanceToContainer( const MODULE* aFootprint, +void BOARD_ADAPTER::AddFPShapesWithClearanceToContainer( const FOOTPRINT* aFootprint, CGENERICCONTAINER2D *aDstContainer, PCB_LAYER_ID aLayerId, 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, PCB_LAYER_ID aLayerId, int aInflateValue, diff --git a/3d-viewer/3d_canvas/create_layer_items.cpp b/3d-viewer/3d_canvas/create_layer_items.cpp index 82f66de0f2..dcd902d029 100644 --- a/3d-viewer/3d_canvas/create_layer_items.cpp +++ b/3d-viewer/3d_canvas/create_layer_items.cpp @@ -463,7 +463,7 @@ void BOARD_ADAPTER::createLayers( REPORTER* aStatusReporter ) // Add holes of footprints // ///////////////////////////////////////////////////////////////////////// - for( MODULE* footprint : m_board->Footprints() ) + for( FOOTPRINT* footprint : m_board->Footprints() ) { 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) // ///////////////////////////////////////////////////////////////////////// - for( MODULE* footprint : m_board->Footprints() ) + for( FOOTPRINT* footprint : m_board->Footprints() ) { for( PAD* pad : footprint->Pads() ) { @@ -549,7 +549,7 @@ void BOARD_ADAPTER::createLayers( REPORTER* aStatusReporter ) CBVHCONTAINER2D *layerContainer = m_layers_container2D[curr_layer_id]; // 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 // has same shape as its hole @@ -564,7 +564,7 @@ void BOARD_ADAPTER::createLayers( REPORTER* aStatusReporter ) if( renderPlatedPadsAsPlated ) { // ADD PLATED PADS - for( MODULE* footprint : m_board->Footprints() ) + for( FOOTPRINT* footprint : m_board->Footprints() ) { AddPadsWithClearanceToContainer( footprint, m_platedpads_container2D_F_Cu, F_Cu, 0, true, false, true ); @@ -588,7 +588,7 @@ void BOARD_ADAPTER::createLayers( REPORTER* aStatusReporter ) SHAPE_POLY_SET *layerPoly = m_layers_poly[curr_layer_id]; // 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 // has same shape as its hole @@ -604,7 +604,7 @@ void BOARD_ADAPTER::createLayers( REPORTER* aStatusReporter ) if( renderPlatedPadsAsPlated ) { // 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, 0, ARC_HIGH_DEF, ERROR_INSIDE, @@ -977,7 +977,7 @@ void BOARD_ADAPTER::createLayers( REPORTER* aStatusReporter ) // 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) ) { @@ -1002,7 +1002,7 @@ void BOARD_ADAPTER::createLayers( REPORTER* aStatusReporter ) // 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) ) { diff --git a/3d-viewer/3d_canvas/create_layer_poly.cpp b/3d-viewer/3d_canvas/create_layer_poly.cpp index 5393a7fa60..45e1ad6c0f 100644 --- a/3d-viewer/3d_canvas/create_layer_poly.cpp +++ b/3d-viewer/3d_canvas/create_layer_poly.cpp @@ -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 { for( BOARD_ITEM* item : aFootprint->GraphicalItems() ) diff --git a/3d-viewer/3d_canvas/eda_3d_canvas.cpp b/3d-viewer/3d_canvas/eda_3d_canvas.cpp index 04df94f543..8f6692fbe0 100644 --- a/3d-viewer/3d_canvas/eda_3d_canvas.cpp +++ b/3d-viewer/3d_canvas/eda_3d_canvas.cpp @@ -763,7 +763,7 @@ void EDA_3D_CANVAS::OnMouseMove( wxMouseEvent &event ) case PCB_FOOTPRINT_T: { - MODULE* footprint = dynamic_cast( intersectedBoardItem ); + FOOTPRINT* footprint = dynamic_cast( intersectedBoardItem ); if( footprint ) activityReporter.Report( footprint->GetReference() ); diff --git a/3d-viewer/3d_rendering/3d_render_ogl_legacy/c3d_render_createscene_ogl_legacy.cpp b/3d-viewer/3d_rendering/3d_render_ogl_legacy/c3d_render_createscene_ogl_legacy.cpp index ee670f5c08..82d6e73285 100644 --- a/3d-viewer/3d_rendering/3d_render_ogl_legacy/c3d_render_createscene_ogl_legacy.cpp +++ b/3d-viewer/3d_rendering/3d_render_ogl_legacy/c3d_render_createscene_ogl_legacy.cpp @@ -862,7 +862,7 @@ void C3D_RENDER_OGL_LEGACY::generate_3D_Vias_and_Pads() tht_inner_holes_poly.RemoveAllContours(); // 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() ) { @@ -965,7 +965,7 @@ void C3D_RENDER_OGL_LEGACY::load_3D_models( REPORTER* aStatusReporter ) } // 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() ) { diff --git a/3d-viewer/3d_rendering/3d_render_ogl_legacy/c3d_render_ogl_legacy.cpp b/3d-viewer/3d_rendering/3d_render_ogl_legacy/c3d_render_ogl_legacy.cpp index fe98ef2bf6..3a27a3f8fd 100644 --- a/3d-viewer/3d_rendering/3d_render_ogl_legacy/c3d_render_ogl_legacy.cpp +++ b/3d-viewer/3d_rendering/3d_render_ogl_legacy/c3d_render_ogl_legacy.cpp @@ -1265,7 +1265,7 @@ void C3D_RENDER_OGL_LEGACY::render_3D_models_selected( bool aRenderTopOrBot, C_OGL_3DMODEL::BeginDrawMulti( !aRenderSelectedOnly ); // Go for all footprints - for( MODULE* fp : m_boardAdapter.GetBoard()->Footprints() ) + for( FOOTPRINT* fp : m_boardAdapter.GetBoard()->Footprints() ) { 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 aIsSelected ) { diff --git a/3d-viewer/3d_rendering/3d_render_ogl_legacy/c3d_render_ogl_legacy.h b/3d-viewer/3d_rendering/3d_render_ogl_legacy/c3d_render_ogl_legacy.h index ada81ba4cc..64dd5e590c 100644 --- a/3d-viewer/3d_rendering/3d_render_ogl_legacy/c3d_render_ogl_legacy.h +++ b/3d-viewer/3d_rendering/3d_render_ogl_legacy/c3d_render_ogl_legacy.h @@ -201,9 +201,11 @@ private: */ 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_Top( bool enabled ); diff --git a/3d-viewer/3d_rendering/3d_render_raytracing/c3d_render_createscene.cpp b/3d-viewer/3d_rendering/3d_render_raytracing/c3d_render_createscene.cpp index 68648e8fe7..fefa19d57a 100644 --- a/3d-viewer/3d_rendering/3d_render_raytracing/c3d_render_createscene.cpp +++ b/3d-viewer/3d_rendering/3d_render_raytracing/c3d_render_createscene.cpp @@ -1386,7 +1386,7 @@ void C3D_RENDER_RAYTRACING::add_3D_vias_and_pads_to_container() } // Insert pads holes (vertical cylinders) - for( MODULE* footprint : m_boardAdapter.GetBoard()->Footprints() ) + for( FOOTPRINT* footprint : m_boardAdapter.GetBoard()->Footprints() ) { for( PAD* pad : footprint->Pads() ) 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 ) { // Go for all footprints - for( MODULE* fp : m_boardAdapter.GetBoard()->Footprints() ) + for( FOOTPRINT* fp : m_boardAdapter.GetBoard()->Footprints() ) { if( !fp->Models().empty() && m_boardAdapter.ShouldFPBeDisplayed((FOOTPRINT_ATTR_T) fp->GetAttributes()) ) diff --git a/common/fp_lib_table.cpp b/common/fp_lib_table.cpp index 63d75a83f0..1b4580a6cf 100644 --- a/common/fp_lib_table.cpp +++ b/common/fp_lib_table.cpp @@ -307,8 +307,8 @@ const FP_LIB_TABLE_ROW* FP_LIB_TABLE::FindRow( const wxString& aNickname ) } -static void setLibNickname( MODULE* aModule, - const wxString& aNickname, const wxString& aFootprintName ) +static void setLibNickname( FOOTPRINT* aModule, const wxString& aNickname, + const wxString& aFootprintName ) { // 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 @@ -331,8 +331,8 @@ static void setLibNickname( MODULE* aModule, } -const MODULE* FP_LIB_TABLE::GetEnumeratedFootprint( const wxString& aNickname, - const wxString& aFootprintName ) +const FOOTPRINT* FP_LIB_TABLE::GetEnumeratedFootprint( const wxString& aNickname, + const wxString& aFootprintName ) { const FP_LIB_TABLE_ROW* row = FindRow( aNickname ); wxASSERT( (PLUGIN*) row->plugin ); @@ -359,13 +359,13 @@ 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 ); wxASSERT( (PLUGIN*) row->plugin ); - MODULE* ret = row->plugin->FootprintLoad( row->GetFullURI( true ), aFootprintName, - row->GetProperties() ); + FOOTPRINT* ret = row->plugin->FootprintLoad( row->GetFullURI( true ), aFootprintName, + row->GetProperties() ); 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, - const MODULE* aFootprint, bool aOverwrite ) + const FOOTPRINT* aFootprint, bool aOverwrite ) { const FP_LIB_TABLE_ROW* row = FindRow( aNickname ); 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(); - std::unique_ptr footprint( row->plugin->FootprintLoad( row->GetFullURI( true ), - fpname, row->GetProperties() ) ); + std::unique_ptr footprint( row->plugin->FootprintLoad( row->GetFullURI( true ), + fpname, + row->GetProperties() ) ); if( footprint.get() ) 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 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 // unless there's an IO_ERROR. - MODULE* ret = FootprintLoad( nicks[i], fpname ); + FOOTPRINT* ret = FootprintLoad( nicks[i], fpname ); if( ret ) return ret; diff --git a/common/hash_eda.cpp b/common/hash_eda.cpp index e798d4a8b3..199c6c2c70 100644 --- a/common/hash_eda.cpp +++ b/common/hash_eda.cpp @@ -54,7 +54,7 @@ size_t hash_eda( const EDA_ITEM* aItem, int aFlags ) { case PCB_FOOTPRINT_T: { - const MODULE* footprint = static_cast( aItem ); + const FOOTPRINT* footprint = static_cast( aItem ); ret = hash_board_item( footprint, aFlags ); diff --git a/common/plugins/eagle/eagle_parser.h b/common/plugins/eagle/eagle_parser.h index 391cf5291b..f598ce88d8 100644 --- a/common/plugins/eagle/eagle_parser.h +++ b/common/plugins/eagle/eagle_parser.h @@ -42,13 +42,13 @@ #include #include // needed for wxString hash template -class MODULE; +class FOOTPRINT; struct EINSTANCE; struct EPART; struct ETEXT; typedef std::unordered_map NODE_MAP; -typedef std::map MODULE_MAP; +typedef std::map FOOTPRINT_MAP; typedef std::map EINSTANCE_MAP; typedef std::map> EPART_MAP; diff --git a/cvpcb/display_footprints_frame.cpp b/cvpcb/display_footprints_frame.cpp index f40d50dc75..9e3a508aae 100644 --- a/cvpcb/display_footprints_frame.cpp +++ b/cvpcb/display_footprints_frame.cpp @@ -171,7 +171,7 @@ DISPLAY_FOOTPRINTS_FRAME::~DISPLAY_FOOTPRINTS_FRAME() if( m_toolManager ) m_toolManager->ShutdownAllTools(); - GetBoard()->DeleteAllModules(); + GetBoard()->DeleteAllFootprints(); GetCanvas()->StopDrawing(); GetCanvas()->GetView()->Clear(); // Be sure any event cannot be fired after frame deletion: @@ -371,11 +371,11 @@ COLOR4D DISPLAY_FOOTPRINTS_FRAME::GetGridColor() } -MODULE* DISPLAY_FOOTPRINTS_FRAME::GetFootprint( const wxString& aFootprintName, - REPORTER& aReporter ) +FOOTPRINT* DISPLAY_FOOTPRINTS_FRAME::GetFootprint( const wxString& aFootprintName, + REPORTER& aReporter ) { - MODULE* footprint = NULL; - LIB_ID fpid; + FOOTPRINT* footprint = NULL; + LIB_ID fpid; 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() { CVPCB_MAINFRAME* parentframe = (CVPCB_MAINFRAME *) GetParent(); - MODULE* footprint = nullptr; + FOOTPRINT* footprint = nullptr; const FOOTPRINT_INFO* fpInfo = nullptr; - GetBoard()->DeleteAllModules(); + GetBoard()->DeleteAllFootprints(); GetCanvas()->GetView()->Clear(); wxString footprintName = parentframe->GetSelectedFootprint(); @@ -500,7 +500,7 @@ void DISPLAY_FOOTPRINTS_FRAME::updateView() void DISPLAY_FOOTPRINTS_FRAME::UpdateMsgPanel() { - MODULE* footprint = GetBoard()->GetFirstFootprint(); + FOOTPRINT* footprint = GetBoard()->GetFirstFootprint(); MSG_PANEL_ITEMS items; if( footprint ) diff --git a/cvpcb/display_footprints_frame.h b/cvpcb/display_footprints_frame.h index bcc0ab09b1..cef9b01c8b 100644 --- a/cvpcb/display_footprints_frame.h +++ b/cvpcb/display_footprints_frame.h @@ -87,7 +87,7 @@ public: */ COLOR4D GetGridColor() override; - MODULE* GetFootprint( const wxString& aFootprintName, REPORTER& aReporter ); + FOOTPRINT* GetFootprint( const wxString& aFootprintName, REPORTER& aReporter ); /* SaveCopyInUndoList() virtual * currently: do nothing in CvPcb. diff --git a/eeschema/tools/backannotate.h b/eeschema/tools/backannotate.h index 43939d87ab..dc329ce172 100644 --- a/eeschema/tools/backannotate.h +++ b/eeschema/tools/backannotate.h @@ -75,7 +75,7 @@ public: }; ///> Map to hold NETLIST footprints data - using PCB_MODULES_MAP = std::map>; + using PCB_FOOTPRINTS_MAP = std::map>; using CHANGELIST_ITEM = std::pair>; @@ -111,7 +111,7 @@ private: bool m_processNetNames; bool m_dryRun; - PCB_MODULES_MAP m_pcbFootprints; + PCB_FOOTPRINTS_MAP m_pcbFootprints; SCH_REFERENCE_LIST m_refs; SCH_MULTI_UNIT_REFERENCE_MAP m_multiUnitsRefs; std::deque m_changelist; diff --git a/include/core/typeinfo.h b/include/core/typeinfo.h index 7af5ccc935..786d8dc156 100644 --- a/include/core/typeinfo.h +++ b/include/core/typeinfo.h @@ -86,7 +86,7 @@ enum KICAD_T SCREEN_T, ///< not really an item, used to identify a screen // 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_SHAPE_T, ///< class PCB_SHAPE, a segment not on copper layers PCB_TEXT_T, ///< class PCB_TEXT, text on a layer diff --git a/include/fp_lib_table.h b/include/fp_lib_table.h index 84b3f45336..6272f37f52 100644 --- a/include/fp_lib_table.h +++ b/include/fp_lib_table.h @@ -29,7 +29,7 @@ #include #include -class MODULE; +class FOOTPRINT; class FP_LIB_TABLE_GRID; @@ -182,12 +182,12 @@ public: * * @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 * 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 @@ -203,8 +203,8 @@ public: * cache management. Return value is const to allow it to return a reference to a cached * item. */ - const MODULE* GetEnumeratedFootprint( const wxString& aNickname, - const wxString& aFootprintName ); + const FOOTPRINT* GetEnumeratedFootprint( const wxString& aNickname, + const wxString& aFootprintName ); /** * Enum SAVE_T * is the set of return values from FootprintSave() below. @@ -233,7 +233,7 @@ public: * * @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 ); /** @@ -271,13 +271,13 @@ public: * * @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 * is thrown in the case where aFootprintName cannot be found. * @throw PARSE_ERROR if @a aFootprintId is not parsed OK. */ - MODULE* FootprintLoadWithOptionalNickname( const LIB_ID& aFootprintId ); + FOOTPRINT* FootprintLoadWithOptionalNickname( const LIB_ID& aFootprintId ); /** * Function LoadGlobalTable diff --git a/include/pcb_base_frame.h b/include/pcb_base_frame.h index f1eb0965f7..8b8ff87d40 100644 --- a/include/pcb_base_frame.h +++ b/include/pcb_base_frame.h @@ -50,7 +50,7 @@ class APP_SETTINGS_BASE; class BOARD; class BOARD_CONNECTED_ITEM; class COLOR_SETTINGS; -class MODULE; +class FOOTPRINT; class TRACK; class PAD; class EDA_3D_VIEWER; @@ -86,12 +86,12 @@ protected: * attempts to load \a aFootprintId from the footprint library table. * * @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(). * @throw IO_ERROR if an I/O error occurs or a #PARSE_ERROR if a file parsing error * occurs while reading footprint library files. */ - MODULE* loadFootprint( const LIB_ID& aFootprintId ); + FOOTPRINT* loadFootprint( const LIB_ID& aFootprintId ); public: 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. * * @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(). */ - MODULE* LoadFootprint( const LIB_ID& aFootprintId ); + FOOTPRINT* LoadFootprint( const LIB_ID& aFootprintId ); /** * Function GetBoardBoundingBox @@ -275,7 +275,7 @@ public: * reference is entered by the user from a dialog (by awxTextCtlr, or a list of * available references) */ - MODULE* GetFootprintFromBoardByReference(); + FOOTPRINT* GetFootprintFromBoardByReference(); /** * Function OnModify @@ -298,7 +298,7 @@ public: * when the fooprint is placed on a board and a netlist is read * @param aFootprintName = name of the new footprint in library */ - MODULE* CreateNewFootprint( const wxString& aFootprintName ); + FOOTPRINT* CreateNewFootprint( const wxString& aFootprintName ); /** * Function PlaceFootprint @@ -307,7 +307,7 @@ public: * * @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 ); @@ -317,14 +317,14 @@ public: * * @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. * @param aFootprint * @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 diff --git a/pcbnew/array_creator.cpp b/pcbnew/array_creator.cpp index df260b6227..df7ce0a525 100644 --- a/pcbnew/array_creator.cpp +++ b/pcbnew/array_creator.cpp @@ -52,7 +52,7 @@ void ARRAY_CREATOR::Invoke() if( m_selection.Size() == 0 ) 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 wxPoint rotPoint = (wxPoint) m_selection.GetCenter(); @@ -77,7 +77,7 @@ void ARRAY_CREATOR::Invoke() if( item->Type() == PCB_PAD_T && !m_isFootprintEditor ) { // If it is not the footprint editor, then duplicate the parent footprint instead - item = static_cast( item )->GetParent(); + item = static_cast( item )->GetParent(); } // 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. // something like this, but needs a "block offset" to prevent // multiple selections overlapping. - // if( new_item->Type() == PCB_MODULE_T ) - // static_cast( *new_item ).IncrementReference( ptN ); + // if( new_item->Type() == PCB_FOOTPRINT_T ) + // static_cast( *new_item ).IncrementReference( ptN ); // @TODO: we should merge zones. This is a bit tricky, because // 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 ) { - static_cast( this_item )->RunOnChildren( + static_cast( this_item )->RunOnChildren( [&]( BOARD_ITEM* aItem ) { aItem->ClearSelected(); diff --git a/pcbnew/array_pad_name_provider.cpp b/pcbnew/array_pad_name_provider.cpp index 26dbe6ba9d..afb81b0318 100644 --- a/pcbnew/array_pad_name_provider.cpp +++ b/pcbnew/array_pad_name_provider.cpp @@ -26,7 +26,7 @@ #include -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 ) : m_arrayOpts( aArrayOpts ) { diff --git a/pcbnew/array_pad_name_provider.h b/pcbnew/array_pad_name_provider.h index 0ed5f54610..ba1c436b63 100644 --- a/pcbnew/array_pad_name_provider.h +++ b/pcbnew/array_pad_name_provider.h @@ -40,7 +40,7 @@ public: * @param aFootprint the footprint to gather existing names from (nullptr for no footprint) * @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. diff --git a/pcbnew/autorouter/ar_autoplacer.cpp b/pcbnew/autorouter/ar_autoplacer.cpp index da5be0ef00..6c8a61ba56 100644 --- a/pcbnew/autorouter/ar_autoplacer.cpp +++ b/pcbnew/autorouter/ar_autoplacer.cpp @@ -82,7 +82,7 @@ AR_AUTOPLACER::AR_AUTOPLACER( BOARD* aBoard ) m_board = aBoard; m_connectivity = std::make_unique( ); - for( MODULE* footprint : m_board->Footprints() ) + for( FOOTPRINT* footprint : m_board->Footprints() ) m_connectivity->Add( footprint ); 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 ) { 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 ) 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_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; LSET layerMask; @@ -546,7 +546,7 @@ unsigned int AR_AUTOPLACER::calculateKeepOutArea( const EDA_RECT& aRect, int sid * Returns the value TstRectangle(). * 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 ) { 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; 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; int64_t nearestDist = INT64_MAX; - for ( MODULE* footprint : m_board->Footprints() ) + for( FOOTPRINT* footprint : m_board->Footprints() ) { if ( footprint == aRefFP ) 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; VECTOR2I start; // start point of a ratsnest @@ -719,7 +719,7 @@ double AR_AUTOPLACER::computePlacementRatsnestCost( MODULE *aFootprint, const wx curr_cost = 0; - for ( PAD* pad : aFootprint->Pads() ) + for( PAD* pad : aFootprint->Pads() ) { const PAD* nearest = nearestPad( aFootprint, pad, aOffset ); @@ -758,7 +758,7 @@ double AR_AUTOPLACER::computePlacementRatsnestCost( MODULE *aFootprint, const wx // Sort routines -static bool sortFootprintsByComplexity( MODULE* ref, MODULE* compare ) +static bool sortFootprintsByComplexity( FOOTPRINT* ref, FOOTPRINT* compare ) { 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; @@ -779,12 +779,12 @@ static bool sortFootprintsByRatsnestSize( MODULE* ref, MODULE* compare ) } -MODULE* AR_AUTOPLACER::pickFootprint( ) +FOOTPRINT* AR_AUTOPLACER::pickFootprint( ) { - std::vector fpList; + std::vector fpList; - for( MODULE* footprint : m_board->Footprints() ) + for( FOOTPRINT* footprint : m_board->Footprints() ) { footprint->CalculateBoundingBox(); fpList.push_back( footprint ); @@ -794,7 +794,7 @@ MODULE* AR_AUTOPLACER::pickFootprint( ) for( unsigned kk = 0; kk < fpList.size(); kk++ ) { - MODULE* footprint = fpList[kk]; + FOOTPRINT* footprint = fpList[kk]; footprint->SetFlag( 0 ); if( !footprint->NeedsPlaced() ) @@ -807,7 +807,7 @@ MODULE* AR_AUTOPLACER::pickFootprint( ) for( unsigned kk = 0; kk < fpList.size(); kk++ ) { - MODULE* footprint = fpList[kk]; + FOOTPRINT* footprint = fpList[kk]; auto edges = m_connectivity->GetRatsnestForComponent( footprint, true ); @@ -817,12 +817,12 @@ MODULE* AR_AUTOPLACER::pickFootprint( ) sort( fpList.begin(), fpList.end(), sortFootprintsByRatsnestSize ); // Search for "best" footprint. - MODULE* bestFootprint = nullptr; - MODULE* altFootprint = nullptr; + FOOTPRINT* bestFootprint = nullptr; + FOOTPRINT* altFootprint = nullptr; for( unsigned ii = 0; ii < fpList.size(); ii++ ) { - MODULE* footprint = fpList[ii]; + FOOTPRINT* footprint = fpList[ii]; if( !footprint->NeedsPlaced() ) continue; @@ -874,7 +874,7 @@ void AR_AUTOPLACER::drawPlacementRoutingMatrix( ) } -AR_RESULT AR_AUTOPLACER::AutoplaceFootprints( std::vector& aFootprints, +AR_RESULT AR_AUTOPLACER::AutoplaceFootprints( std::vector& aFootprints, BOARD_COMMIT* aCommit, bool aPlaceOffboardModules ) { @@ -896,33 +896,33 @@ AR_RESULT AR_AUTOPLACER::AutoplaceFootprints( std::vector& aFootprints, int placedCount = 0; - for( MODULE* footprint : m_board->Footprints() ) + for( FOOTPRINT* footprint : m_board->Footprints() ) footprint->SetNeedsPlaced( false ); - std::vector offboardMods; + std::vector offboardMods; if( aPlaceOffboardModules ) { - for( MODULE* footprint : m_board->Footprints() ) + for( FOOTPRINT* footprint : m_board->Footprints() ) { if( !m_matrix.m_BrdBox.Contains( footprint->GetPosition() ) ) offboardMods.push_back( footprint ); } } - for( MODULE* footprint : aFootprints ) + for( FOOTPRINT* footprint : aFootprints ) { footprint->SetNeedsPlaced( true ); aCommit->Modify( footprint ); } - for( MODULE* footprint : offboardMods ) + for( FOOTPRINT* footprint : offboardMods ) { footprint->SetNeedsPlaced( true ); aCommit->Modify( footprint ); } - for( MODULE* footprint : m_board->Footprints() ) + for( FOOTPRINT* footprint : m_board->Footprints() ) { if( footprint->NeedsPlaced() ) // Erase from screen placedCount++; @@ -945,7 +945,7 @@ AR_RESULT AR_AUTOPLACER::AutoplaceFootprints( std::vector& aFootprints, if( m_refreshCallback ) m_refreshCallback( nullptr ); - MODULE* footprint; + FOOTPRINT* footprint; while( ( footprint = pickFootprint() ) != nullptr ) { @@ -1075,7 +1075,7 @@ end_of_tst: m_matrix.UnInitRoutingMatrix(); - for( MODULE* fp : m_board->Footprints() ) + for( FOOTPRINT* fp : m_board->Footprints() ) fp->CalculateBoundingBox(); return cancelled ? AR_CANCELLED : AR_COMPLETED; diff --git a/pcbnew/autorouter/ar_autoplacer.h b/pcbnew/autorouter/ar_autoplacer.h index 8334440e89..8639442c6c 100644 --- a/pcbnew/autorouter/ar_autoplacer.h +++ b/pcbnew/autorouter/ar_autoplacer.h @@ -59,7 +59,7 @@ class AR_AUTOPLACER public: AR_AUTOPLACER( BOARD* aBoard ); - AR_RESULT AutoplaceFootprints( std::vector& aFootprints, BOARD_COMMIT* aCommit, + AR_RESULT AutoplaceFootprints( std::vector& aFootprints, BOARD_COMMIT* aCommit, bool aPlaceOffboardModules = false ); /** @@ -74,7 +74,7 @@ public: * a callback function to redraw on screen the view after changes, * for instance after moving a footprint */ - void SetRefreshCallback( std::function aCallback ) + void SetRefreshCallback( std::function aCallback ) { m_refreshCallback = aCallback; } @@ -85,33 +85,32 @@ public: } private: - void drawPlacementRoutingMatrix(); // draw the working area (shows free and occupied areas) - void rotateFootprint( MODULE* aFootprint, double angle, bool incremental ); - int genPlacementRoutingMatrix(); + void drawPlacementRoutingMatrix(); // draw the working area (shows free and occupied areas) + void rotateFootprint( FOOTPRINT* aFootprint, double angle, bool incremental ); + int genPlacementRoutingMatrix(); /** fills m_matrix cells from m_boardShape. * cells inside m_boardShape are set to CELL_IS_ZONE */ - bool fillMatrix(); - void genModuleOnRoutingMatrix( MODULE* Module ); + bool fillMatrix(); + 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 ); - int testFootprintOnBoard( MODULE* aFootprint, bool TstOtherSide, const wxPoint& aOffset ); - int getOptimalFPPlacement( MODULE* aFootprint ); - double computePlacementRatsnestCost( MODULE* aFootprint, const wxPoint& aOffset ); + int testFootprintOnBoard( FOOTPRINT* aFootprint, bool TstOtherSide, const wxPoint& aOffset ); + int getOptimalFPPlacement( FOOTPRINT* aFootprint ); + double computePlacementRatsnestCost( FOOTPRINT* aFootprint, const wxPoint& aOffset ); /** * Find the "best" footprint place. The criteria are: * - Maximum ratsnest with footprints already placed * - Max size, and number of pads max */ - MODULE* pickFootprint(); + FOOTPRINT* pickFootprint(); - void placeFootprint( MODULE* aFootprint, bool aDoNotRecreateRatsnest, - const wxPoint& aPos ); + void placeFootprint( FOOTPRINT* aFootprint, bool aDoNotRecreateRatsnest, 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 void addFpBody( wxPoint aStart, wxPoint aEnd, LSET aLayerMask ); @@ -121,7 +120,7 @@ private: // Build m_fpAreaTop and m_fpAreaBottom polygonal shapes for aFootprint. // aFpClearance is a mechanical clearance. - void buildFpAreas( MODULE* aFootprint, int aFpClearance ); + void buildFpAreas( FOOTPRINT* aFootprint, int aFpClearance ); AR_MATRIX m_matrix; SHAPE_POLY_SET m_topFreeArea; // The polygonal description of the top side free areas; @@ -136,10 +135,10 @@ private: double m_minCost; int m_gridSize; - std::shared_ptr m_overlay; - std::unique_ptr m_connectivity; - std::function m_refreshCallback; - PROGRESS_REPORTER* m_progressReporter; + std::shared_ptr m_overlay; + std::unique_ptr m_connectivity; + std::function m_refreshCallback; + PROGRESS_REPORTER* m_progressReporter; }; #endif diff --git a/pcbnew/autorouter/ar_matrix.h b/pcbnew/autorouter/ar_matrix.h index b195a749ba..9545d37a6e 100644 --- a/pcbnew/autorouter/ar_matrix.h +++ b/pcbnew/autorouter/ar_matrix.h @@ -35,7 +35,7 @@ class PCB_SHAPE; class TRACK; class PAD; -class MODULE; +class FOOTPRINT; #define AR_MAX_ROUTING_LAYERS_COUNT 2 diff --git a/pcbnew/autorouter/autoplace_tool.cpp b/pcbnew/autorouter/autoplace_tool.cpp index e4ec8e7481..55d86cf418 100644 --- a/pcbnew/autorouter/autoplace_tool.cpp +++ b/pcbnew/autorouter/autoplace_tool.cpp @@ -46,7 +46,7 @@ AUTOPLACE_TOOL::~AUTOPLACE_TOOL() // especially each time a footprint is autoplaced, static PCB_BASE_EDIT_FRAME* fparent; -static int refreshCallback( MODULE* aFootprint ) +static int refreshCallback( FOOTPRINT* aFootprint ) { if( aFootprint ) fparent->GetCanvas()->GetView()->Update( aFootprint ); @@ -59,7 +59,7 @@ static int refreshCallback( MODULE* aFootprint ) } -int AUTOPLACE_TOOL::autoplace( std::vector& aFootprints, bool aPlaceOffboard ) +int AUTOPLACE_TOOL::autoplace( std::vector& aFootprints, bool aPlaceOffboard ) { EDA_RECT bbox = board()->GetBoardEdgesBoundingBox(); @@ -82,7 +82,7 @@ int AUTOPLACE_TOOL::autoplace( std::vector& aFootprints, bool aPlaceOff autoplacer.SetOverlay( overlay ); fparent = frame(); - std::function callback = refreshCallback; + std::function callback = refreshCallback; autoplacer.SetRefreshCallback( callback ); std::unique_ptr progressReporter( @@ -102,12 +102,12 @@ int AUTOPLACE_TOOL::autoplace( std::vector& aFootprints, bool aPlaceOff int AUTOPLACE_TOOL::autoplaceSelected( const TOOL_EVENT& aEvent ) { - std::vector footprints; + std::vector footprints; for( EDA_ITEM* item : selection() ) { if( item->Type() == PCB_FOOTPRINT_T ) - footprints.push_back( static_cast( item ) ); + footprints.push_back( static_cast( item ) ); } return autoplace( footprints, false ); @@ -116,7 +116,7 @@ int AUTOPLACE_TOOL::autoplaceSelected( const TOOL_EVENT& aEvent ) int AUTOPLACE_TOOL::autoplaceOffboard( const TOOL_EVENT& aEvent ) { - std::vector footprints; + std::vector footprints; return autoplace( footprints, true ); } diff --git a/pcbnew/autorouter/autoplace_tool.h b/pcbnew/autorouter/autoplace_tool.h index 410c83c5f0..175e275394 100644 --- a/pcbnew/autorouter/autoplace_tool.h +++ b/pcbnew/autorouter/autoplace_tool.h @@ -42,7 +42,7 @@ public: void setTransitions() override; private: - int autoplace( std::vector& aFootprints, bool aPlaceOffboard ); + int autoplace( std::vector& aFootprints, bool aPlaceOffboard ); int autoplaceSelected( const TOOL_EVENT& aEvent ); int autoplaceOffboard( const TOOL_EVENT& aEvent ); diff --git a/pcbnew/autorouter/spread_footprints.cpp b/pcbnew/autorouter/spread_footprints.cpp index f549af2b07..bdf61192af 100644 --- a/pcbnew/autorouter/spread_footprints.cpp +++ b/pcbnew/autorouter/spread_footprints.cpp @@ -63,7 +63,7 @@ const int scale = (int)(0.01 * IU_PER_MM); const int PADDING = (int)(1 * IU_PER_MM); // Populates a list of rectangles, from a list of footprints -void fillRectList( CSubRectArray& vecSubRects, std::vector & aFootprintList ) +void fillRectList( CSubRectArray& vecSubRects, std::vector & aFootprintList ) { vecSubRects.clear(); @@ -148,7 +148,7 @@ void spreadRectangles( CRectPlacement& aPlacementArea, } -void moveFootprintsInArea( CRectPlacement& aPlacementArea, std::vector & aFootprintList, +void moveFootprintsInArea( CRectPlacement& aPlacementArea, std::vector & aFootprintList, EDA_RECT& aFreeArea, bool aFindAreaOnly ) { CSubRectArray vecSubRects; @@ -165,7 +165,7 @@ void moveFootprintsInArea( CRectPlacement& aPlacementArea, std::vector pos.x *= scale; pos.y *= scale; - MODULE* footprint = aFootprintList[vecSubRects[it].n]; + FOOTPRINT* footprint = aFootprintList[vecSubRects[it].n]; EDA_RECT fpBBox = footprint->GetFootprintRect(); wxPoint mod_pos = pos + ( footprint->GetPosition() - fpBBox.GetOrigin() ) @@ -175,7 +175,7 @@ void moveFootprintsInArea( CRectPlacement& aPlacementArea, std::vector } } -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 * area allowed to spread footprints */ -void SpreadFootprints( std::vector* aFootprints, wxPoint aSpreadAreaPosition ) +void SpreadFootprints( std::vector* aFootprints, wxPoint aSpreadAreaPosition ) { // Build candidate list // calculate also the area needed by these footprints - std::vector footprintList; + std::vector footprintList; - for( MODULE* footprint : *aFootprints ) + for( FOOTPRINT* footprint : *aFootprints ) { if( footprint->IsLocked() ) continue; @@ -208,10 +208,10 @@ void SpreadFootprints( std::vector* aFootprints, wxPoint aSpreadAreaPo sort( footprintList.begin(), footprintList.end(), sortFootprintsbySheetPath ); // Extract and place footprints by sheet - std::vector footprintListBySheet; - std::vector placementSheetAreas; - double subsurface; - double placementsurface = 0.0; + std::vector footprintListBySheet; + std::vector placementSheetAreas; + double subsurface; + double placementsurface = 0.0; // The placement uses 2 passes: // the first pass creates the rectangular areas to place footprints @@ -228,8 +228,8 @@ void SpreadFootprints( std::vector* aFootprints, wxPoint aSpreadAreaPo for( unsigned ii = 0; ii < footprintList.size(); ii++ ) { - MODULE* footprint = footprintList[ii]; - bool islastItem = false; + FOOTPRINT* footprint = footprintList[ii]; + bool islastItem = false; if( ii == footprintList.size() - 1 || ( footprintList[ii]->GetPath().AsString().BeforeLast( '/' ) != @@ -337,7 +337,7 @@ void SpreadFootprints( std::vector* aFootprints, wxPoint aSpreadAreaPo // Footprints are sorted by their sheet path. // (the full sheet path restricted to the time stamp of the sheet itself, // 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(); } diff --git a/pcbnew/board.cpp b/pcbnew/board.cpp index c4d491e57f..f28e65f020 100644 --- a/pcbnew/board.cpp +++ b/pcbnew/board.cpp @@ -107,7 +107,7 @@ BOARD::~BOARD() m_zones.clear(); - for( MODULE* footprint : m_footprints ) + for( FOOTPRINT* footprint : m_footprints ) delete footprint; m_footprints.clear(); @@ -514,7 +514,7 @@ void BOARD::SetElementVisibility( GAL_LAYER_ID aLayer, bool isEnabled ) for( TRACK* track : Tracks() ) track->SetLocalRatsnestVisible( isEnabled ); - for( MODULE* footprint : Footprints() ) + for( FOOTPRINT* footprint : Footprints() ) { for( PAD* pad : footprint->Pads() ) pad->SetLocalRatsnestVisible( isEnabled ); @@ -598,9 +598,9 @@ void BOARD::Add( BOARD_ITEM* aBoardItem, ADD_MODE aMode ) case PCB_FOOTPRINT_T: if( aMode == ADD_MODE::APPEND ) - m_footprints.push_back((MODULE*) aBoardItem ); + m_footprints.push_back( static_cast( aBoardItem ) ); else - m_footprints.push_front((MODULE*) aBoardItem ); + m_footprints.push_front( static_cast( aBoardItem ) ); break; @@ -768,7 +768,7 @@ BOARD_ITEM* BOARD::GetItem( const KIID& aID ) const return track; } - for( MODULE* footprint : Footprints() ) + for( FOOTPRINT* footprint : Footprints() ) { if( footprint->m_Uuid == aID ) return footprint; @@ -844,7 +844,7 @@ void BOARD::FillItemMap( std::map& aMap ) for( TRACK* track : Tracks() ) aMap[ track->m_Uuid ] = track; - for( MODULE* footprint : Footprints() ) + for( FOOTPRINT* footprint : Footprints() ) { aMap[ footprint->m_Uuid ] = footprint; @@ -900,7 +900,7 @@ wxString BOARD::ConvertCrossReferencesToKIIDs( const wxString& aSource ) wxString remainder; wxString ref = token.BeforeFirst( ':', &remainder ); - for( MODULE* footprint : Footprints() ) + for( FOOTPRINT* footprint : Footprints() ) { if( footprint->GetReference().CmpNoCase( ref ) == 0 ) { @@ -956,7 +956,7 @@ wxString BOARD::ConvertKIIDsToCrossReferences( const wxString& aSource ) BOARD_ITEM* refItem = GetItem( KIID( ref ) ); if( refItem && refItem->Type() == PCB_FOOTPRINT_T ) - token = static_cast( refItem )->GetReference() + ":" + remainder; + token = static_cast( refItem )->GetReference() + ":" + remainder; } newbuf.append( "${" + token + "}" ); @@ -975,7 +975,7 @@ unsigned BOARD::GetNodesCount( int aNet ) const { unsigned retval = 0; - for( MODULE* footprint : Footprints() ) + for( FOOTPRINT* footprint : Footprints() ) { for( PAD* pad : footprint->Pads() ) { @@ -1012,7 +1012,7 @@ EDA_RECT BOARD::ComputeBoundingBox( bool aBoardEdgesOnly ) const } // Check footprints - for( MODULE* footprint : m_footprints ) + for( FOOTPRINT* footprint : m_footprints ) { if( !( footprint->GetLayerSet() & visible ).any() ) continue; @@ -1122,7 +1122,7 @@ SEARCH_RESULT BOARD::Visit( INSPECTOR inspector, void* testData, const KICAD_T s case PCB_FP_ZONE_T: // this calls FOOTPRINT::Visit() on each footprint. - result = IterateForward( m_footprints, inspector, testData, p ); + result = IterateForward( m_footprints, inspector, testData, p ); // skip over any types handled in the above call. 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() ) 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 ) return footprint; @@ -1447,7 +1447,7 @@ PAD* BOARD::GetPad( const wxPoint& aPosition, LSET aLayerSet ) if( !aLayerSet.any() ) aLayerSet = LSET::AllCuMask(); - for( MODULE* footprint : m_footprints ) + for( FOOTPRINT* footprint : m_footprints ) { PAD* pad = NULL; @@ -1474,7 +1474,7 @@ PAD* BOARD::GetPad( TRACK* aTrace, ENDPOINT_T aEndPoint ) PAD* BOARD::GetPadFast( const wxPoint& aPosition, LSET aLayerSet ) { - for( MODULE* footprint : Footprints() ) + for( FOOTPRINT* footprint : Footprints() ) { for( PAD* pad : footprint->Pads() ) { @@ -1600,7 +1600,7 @@ bool sortPadsByXthenYCoord( PAD* const & ref, PAD* const & comp ) void BOARD::GetSortedPadListByXthenYCoord( std::vector& aVector, int aNetCode ) { - for( MODULE* footprint : Footprints() ) + for( FOOTPRINT* footprint : Footprints() ) { for( PAD* pad : footprint->Pads( ) ) { @@ -1666,16 +1666,16 @@ std::tuple BOARD::GetTrackLength( const TRACK& aTrack ) con } -MODULE* BOARD::GetFootprint( const wxPoint& aPosition, PCB_LAYER_ID aActiveLayer, - bool aVisibleOnly, bool aIgnoreLocked ) +FOOTPRINT* BOARD::GetFootprint( const wxPoint& aPosition, PCB_LAYER_ID aActiveLayer, + bool aVisibleOnly, bool aIgnoreLocked ) { - MODULE* footprint = NULL; - MODULE* alt_footprint = NULL; - int min_dim = 0x7FFFFFFF; - int alt_min_dim = 0x7FFFFFFF; - bool current_layer_back = IsBackLayer( aActiveLayer ); + FOOTPRINT* footprint = NULL; + FOOTPRINT* alt_footprint = NULL; + int min_dim = 0x7FFFFFFF; + int alt_min_dim = 0x7FFFFFFF; + 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? if( !candidate->HitTest( aPosition ) ) @@ -1739,7 +1739,7 @@ std::list BOARD::GetZoneList( bool aIncludeZonesInFootprints ) if( aIncludeZonesInFootprints ) { - for( MODULE* footprint : m_footprints ) + for( FOOTPRINT* footprint : m_footprints ) { for( FP_ZONE* zone : footprint->Zones() ) zones.push_back( zone ); @@ -1859,7 +1859,7 @@ const std::vector BOARD::GetPads() const { std::vector allPads; - for( MODULE* footprint : Footprints() ) + for( FOOTPRINT* footprint : Footprints() ) { for( PAD* pad : footprint->Pads() ) allPads.push_back( pad ); @@ -1873,7 +1873,7 @@ unsigned BOARD::GetPadCount() const { unsigned retval = 0; - for( MODULE* footprint : Footprints() ) + for( FOOTPRINT* footprint : Footprints() ) retval += footprint->Pads().size(); return retval; @@ -1887,7 +1887,7 @@ const std::vector BOARD::AllConnectedItems() for( TRACK* track : Tracks() ) items.push_back( track ); - for( MODULE* footprint : Footprints() ) + for( FOOTPRINT* footprint : Footprints() ) { for( PAD* pad : footprint->Pads() ) items.push_back( pad ); diff --git a/pcbnew/board.h b/pcbnew/board.h index b6767d4b77..51b0369e51 100644 --- a/pcbnew/board.h +++ b/pcbnew/board.h @@ -194,7 +194,7 @@ private: wxString m_fileName; MARKERS m_markers; DRAWINGS m_drawings; - MODULES m_footprints; + FOOTPRINTS m_footprints; TRACKS m_tracks; GROUPS m_groups; ZONES m_zones; @@ -281,8 +281,8 @@ public: TRACKS& Tracks() { return m_tracks; } const TRACKS& Tracks() const { return m_tracks; } - MODULES& Footprints() { return m_footprints; } - const MODULES& Footprints() const { return m_footprints; } + FOOTPRINTS& Footprints() { return m_footprints; } + const FOOTPRINTS& Footprints() const { return m_footprints; } DRAWINGS& Drawings() { 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. * @return first footprint or null pointer */ - MODULE* GetFirstFootprint() const + FOOTPRINT* GetFirstFootprint() const { 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 */ - void DeleteAllModules() + void DeleteAllFootprints() { - for( MODULE* footprint : m_footprints ) + for( FOOTPRINT* footprint : m_footprints ) delete footprint; m_footprints.clear(); @@ -802,22 +802,23 @@ public: 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. - * @return MODULE* - If found, the MODULE having the given reference designator, else NULL. + * @param aReference The reference designator of the FOOTPRINT to find. + * @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. - * @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. @@ -1082,8 +1083,8 @@ public: * @param aVisibleOnly Search only the visible layers if true. * @param aIgnoreLocked Ignore locked footprints when true. */ - MODULE* GetFootprint( const wxPoint& aPosition, PCB_LAYER_ID aActiveLayer, - bool aVisibleOnly, bool aIgnoreLocked = false ); + FOOTPRINT* GetFootprint( const wxPoint& aPosition, PCB_LAYER_ID aActiveLayer, + bool aVisibleOnly, bool aIgnoreLocked = false ); /** * Reset all items' netcodes to 0 (no net). diff --git a/pcbnew/board_commit.cpp b/pcbnew/board_commit.cpp index a8ba66fc9b..4ea5e5d952 100644 --- a/pcbnew/board_commit.cpp +++ b/pcbnew/board_commit.cpp @@ -130,7 +130,7 @@ void BOARD_COMMIT::Push( const wxString& aMessage, bool aCreateUndoEntry, bool a } savedModules.insert( ent.m_item ); - static_cast( ent.m_item )->SetLastEditTime(); + static_cast( ent.m_item )->SetLastEditTime(); } } @@ -204,7 +204,7 @@ void BOARD_COMMIT::Push( const wxString& aMessage, bool aCreateUndoEntry, bool a if( !( changeFlags & CHT_DONE ) ) { - MODULE* footprint = static_cast( boardItem->GetParent() ); + FOOTPRINT* footprint = static_cast( boardItem->GetParent() ); wxASSERT( footprint && footprint->Type() == PCB_FOOTPRINT_T ); footprint->Delete( boardItem ); } @@ -236,7 +236,7 @@ void BOARD_COMMIT::Push( const wxString& aMessage, bool aCreateUndoEntry, bool a // No support for nested footprints (yet) wxASSERT( !m_isFootprintEditor ); - MODULE* footprint = static_cast( boardItem ); + FOOTPRINT* footprint = static_cast( boardItem ); view->Remove( footprint ); footprint->ClearFlags(); @@ -286,10 +286,11 @@ void BOARD_COMMIT::Push( const wxString& aMessage, bool aCreateUndoEntry, bool a if( m_isFootprintEditor ) { - static_cast( boardItem )->RunOnChildren( [&]( BOARD_ITEM* aChild ) - { - view->Update( aChild ); - }); + static_cast( boardItem )->RunOnChildren( + [&]( BOARD_ITEM* aChild ) + { + view->Update( aChild ); + }); } board->OnItemChanged( boardItem ); @@ -373,7 +374,7 @@ EDA_ITEM* BOARD_COMMIT::parentObject( EDA_ITEM* aItem ) const return aItem->GetParent(); case PCB_ZONE_T: - wxASSERT( !dynamic_cast( aItem->GetParent() ) ); + wxASSERT( !dynamic_cast( aItem->GetParent() ) ); return aItem; default: diff --git a/pcbnew/board_items_to_polygon_shape_transform.cpp b/pcbnew/board_items_to_polygon_shape_transform.cpp index 4b3f3b2b46..b1dd4cb6df 100644 --- a/pcbnew/board_items_to_polygon_shape_transform.cpp +++ b/pcbnew/board_items_to_polygon_shape_transform.cpp @@ -77,7 +77,7 @@ void BOARD::ConvertBrdLayerToPolygonalContours( PCB_LAYER_ID aLayer, SHAPE_POLY_ } // convert pads - for( MODULE* footprint : m_footprints ) + for( FOOTPRINT* footprint : m_footprints ) { footprint->TransformPadsWithClearanceToPolygon( aOutlines, aLayer, 0, maxError, ERROR_INSIDE ); @@ -125,12 +125,12 @@ void BOARD::ConvertBrdLayerToPolygonalContours( PCB_LAYER_ID aLayer, SHAPE_POLY_ } -void MODULE::TransformPadsWithClearanceToPolygon( SHAPE_POLY_SET& aCornerBuffer, - PCB_LAYER_ID aLayer, int aClearance, - int aMaxError, ERROR_LOC aErrorLoc, - bool aSkipNPTHPadsWihNoCopper, - bool aSkipPlatedPads, - bool aSkipNonPlatedPads ) const +void FOOTPRINT::TransformPadsWithClearanceToPolygon( SHAPE_POLY_SET& aCornerBuffer, + PCB_LAYER_ID aLayer, int aClearance, + int aMaxError, ERROR_LOC aErrorLoc, + bool aSkipNPTHPadsWihNoCopper, + bool aSkipPlatedPads, + bool aSkipNonPlatedPads ) const { for( PAD* pad : m_pads ) { @@ -223,11 +223,11 @@ void MODULE::TransformPadsWithClearanceToPolygon( SHAPE_POLY_SET& aCornerBuffer, * @aIncludeText = indicates footprint text items (reference, value, etc.) should be included * in the outline */ -void MODULE::TransformFPShapesWithClearanceToPolygon( SHAPE_POLY_SET& aCornerBuffer, - PCB_LAYER_ID aLayer, int aClearance, - int aError, ERROR_LOC aErrorLoc, - bool aIncludeText, - bool aIncludeShapes ) const +void FOOTPRINT::TransformFPShapesWithClearanceToPolygon( SHAPE_POLY_SET& aCornerBuffer, + PCB_LAYER_ID aLayer, int aClearance, + int aError, ERROR_LOC aErrorLoc, + bool aIncludeText, + bool aIncludeShapes ) const { std::vector texts; // List of FP_TEXT to convert @@ -455,9 +455,9 @@ void PCB_SHAPE::TransformShapeWithClearanceToPolygon( SHAPE_POLY_SET& aCornerBuf { // The polygon is expected to be a simple polygon // not self intersecting, no hole. - MODULE* footprint = GetParentFootprint(); // NULL for items not in footprints - double orientation = footprint ? footprint->GetOrientation() : 0.0; - wxPoint offset; + FOOTPRINT* footprint = GetParentFootprint(); // NULL for items not in footprints + double orientation = footprint ? footprint->GetOrientation() : 0.0; + wxPoint offset; if( footprint ) offset = footprint->GetPosition(); diff --git a/pcbnew/build_BOM_from_board.cpp b/pcbnew/build_BOM_from_board.cpp index 2716b2bd49..876c741a20 100644 --- a/pcbnew/build_BOM_from_board.cpp +++ b/pcbnew/build_BOM_from_board.cpp @@ -119,7 +119,7 @@ void PCB_EDIT_FRAME::RecreateBOMFileFromBoard( wxCommandEvent& aEvent ) CmpList::iterator iter; int i = 1; - for( MODULE* fp : GetBoard()->Footprints() ) + for( FOOTPRINT* fp : GetBoard()->Footprints() ) { bool valExist = false; diff --git a/pcbnew/collectors.cpp b/pcbnew/collectors.cpp index a2c6161c12..fc5c2f7348 100644 --- a/pcbnew/collectors.cpp +++ b/pcbnew/collectors.cpp @@ -189,7 +189,7 @@ const KICAD_T GENERAL_COLLECTOR::Dimensions[] = { SEARCH_RESULT GENERAL_COLLECTOR::Inspect( EDA_ITEM* testItem, void* testData ) { BOARD_ITEM* item = (BOARD_ITEM*) testItem; - MODULE* footprint = nullptr; + FOOTPRINT* footprint = nullptr; PCB_GROUP* group = nullptr; PAD* pad = nullptr; bool pad_through = false; @@ -206,7 +206,7 @@ SEARCH_RESULT GENERAL_COLLECTOR::Inspect( EDA_ITEM* testItem, void* testData ) { case PCB_PAD_T: { - MODULE* footprint = (MODULE*) item->GetParent(); + FOOTPRINT* footprint = (FOOTPRINT*) item->GetParent(); if( footprint->GetReference() == wxT( "Y2" ) ) breakhere++; @@ -245,7 +245,7 @@ SEARCH_RESULT GENERAL_COLLECTOR::Inspect( EDA_ITEM* testItem, void* testData ) case PCB_FOOTPRINT_T: { - MODULE* footprint = (MODULE*) item; + FOOTPRINT* footprint = (FOOTPRINT*) item; if( footprint->GetReference() == wxT( "C98" ) ) breakhere++; @@ -284,7 +284,7 @@ SEARCH_RESULT GENERAL_COLLECTOR::Inspect( EDA_ITEM* testItem, void* testData ) } else // smd, so use pads test after footprint test { - footprint = static_cast( item->GetParent() ); + footprint = static_cast( item->GetParent() ); } break; @@ -300,7 +300,7 @@ SEARCH_RESULT GENERAL_COLLECTOR::Inspect( EDA_ITEM* testItem, void* testData ) break; case PCB_FP_ZONE_T: - footprint = static_cast( item->GetParent() ); + footprint = static_cast( item->GetParent() ); // Fallthrough to get the zone as well KI_FALLTHROUGH; @@ -364,7 +364,7 @@ SEARCH_RESULT GENERAL_COLLECTOR::Inspect( EDA_ITEM* testItem, void* testData ) } // Extract the footprint since it could be hidden - footprint = static_cast( item->GetParent() ); + footprint = static_cast( item->GetParent() ); } break; @@ -373,7 +373,7 @@ SEARCH_RESULT GENERAL_COLLECTOR::Inspect( EDA_ITEM* testItem, void* testData ) break; case PCB_FOOTPRINT_T: - footprint = static_cast( item ); + footprint = static_cast( item ); break; case PCB_GROUP_T: @@ -390,7 +390,7 @@ SEARCH_RESULT GENERAL_COLLECTOR::Inspect( EDA_ITEM* testItem, void* testData ) // 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) ) goto exit; diff --git a/pcbnew/collectors.h b/pcbnew/collectors.h index 1066c3e2af..430e6a475d 100644 --- a/pcbnew/collectors.h +++ b/pcbnew/collectors.h @@ -309,12 +309,12 @@ public: static const KICAD_T ModuleItems[]; /** - * A scan list for only TRACKS + * A scan list for only 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[]; diff --git a/pcbnew/connectivity/connectivity_algo.cpp b/pcbnew/connectivity/connectivity_algo.cpp index 88fe7d9607..16c87a9728 100644 --- a/pcbnew/connectivity/connectivity_algo.cpp +++ b/pcbnew/connectivity/connectivity_algo.cpp @@ -46,7 +46,7 @@ bool CN_CONNECTIVITY_ALGO::Remove( BOARD_ITEM* aItem ) switch( aItem->Type() ) { case PCB_FOOTPRINT_T: - for( PAD* pad : static_cast( aItem )->Pads() ) + for( PAD* pad : static_cast( aItem )->Pads() ) { m_itemMap[pad].MarkItemsAsInvalid(); m_itemMap.erase( pad ); @@ -102,9 +102,9 @@ void CN_CONNECTIVITY_ALGO::markItemNetAsDirty( const BOARD_ITEM* aItem ) { if( aItem->Type() == PCB_FOOTPRINT_T ) { - auto mod = static_cast ( aItem ); + const FOOTPRINT* footprint = static_cast( aItem ); - for( auto pad : mod->Pads() ) + for( PAD* pad : footprint->Pads() ) MarkNetAsDirty( pad->GetNetCode() ); } } @@ -125,7 +125,7 @@ bool CN_CONNECTIVITY_ALGO::Add( BOARD_ITEM* aItem ) break; case PCB_FOOTPRINT_T: - for( PAD* pad : static_cast( aItem )->Pads() ) + for( PAD* pad : static_cast( aItem )->Pads() ) { if( m_itemMap.find( pad ) != m_itemMap.end() ) return false; @@ -423,7 +423,7 @@ void CN_CONNECTIVITY_ALGO::Build( BOARD* aBoard, PROGRESS_REPORTER* aReporter ) size += aBoard->Zones().size(); size += aBoard->Tracks().size(); - for( MODULE* footprint : aBoard->Footprints() ) + for( FOOTPRINT* footprint : aBoard->Footprints() ) size += footprint->Pads().size(); 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 ); } - for( MODULE* footprint : aBoard->Footprints() ) + for( FOOTPRINT* footprint : aBoard->Footprints() ) { for( PAD* pad : footprint->Pads() ) { @@ -465,7 +465,7 @@ void CN_CONNECTIVITY_ALGO::Build( const std::vector& aItems ) break; case PCB_FOOTPRINT_T: - for( PAD* pad : static_cast( item )->Pads() ) + for( PAD* pad : static_cast( item )->Pads() ) Add( pad ); break; diff --git a/pcbnew/connectivity/connectivity_data.cpp b/pcbnew/connectivity/connectivity_data.cpp index e8c47ba751..281ee38507 100644 --- a/pcbnew/connectivity/connectivity_data.cpp +++ b/pcbnew/connectivity/connectivity_data.cpp @@ -225,7 +225,7 @@ void CONNECTIVITY_DATA::BlockRatsnestItems( const std::vector& aIte { if( item->Type() == PCB_FOOTPRINT_T ) { - for( auto pad : static_cast(item)->Pads() ) + for( PAD* pad : static_cast(item)->Pads() ) citems.push_back( pad ); } else @@ -656,10 +656,8 @@ void CONNECTIVITY_DATA::MarkItemNetAsDirty( BOARD_ITEM *aItem ) { if ( aItem->Type() == PCB_FOOTPRINT_T) { - for ( auto pad : static_cast( aItem )->Pads() ) - { + for( PAD* pad : static_cast( aItem )->Pads() ) m_connAlgo->MarkNetAsDirty( pad->GetNetCode() ); - } } if (aItem->IsConnected() ) { @@ -685,9 +683,9 @@ const std::vector CONNECTIVITY_DATA::GetRatsnestForItems( std::vectorType() == PCB_FOOTPRINT_T ) { - auto component = static_cast( item ); + FOOTPRINT* footprint = static_cast( item ); - for( auto pad : component->Pads() ) + for( PAD* pad : footprint->Pads() ) { nets.insert( pad->GetNetCode() ); item_set.insert( pad ); @@ -724,7 +722,7 @@ const std::vector CONNECTIVITY_DATA::GetRatsnestForItems( std::vector CONNECTIVITY_DATA::GetRatsnestForComponent( MODULE* aComponent, bool aSkipInternalConnections ) +const std::vector CONNECTIVITY_DATA::GetRatsnestForComponent( FOOTPRINT* aComponent, bool aSkipInternalConnections ) { std::set nets; std::set pads; diff --git a/pcbnew/connectivity/connectivity_data.h b/pcbnew/connectivity/connectivity_data.h index a3c5b53bd3..64618643af 100644 --- a/pcbnew/connectivity/connectivity_data.h +++ b/pcbnew/connectivity/connectivity_data.h @@ -51,7 +51,7 @@ class RN_DATA; class RN_NET; class TRACK; class PAD; -class MODULE; +class FOOTPRINT; class PROGRESS_REPORTER; struct CN_DISJOINT_NET_ENTRY @@ -267,7 +267,8 @@ public: #ifndef SWIG const std::vector GetRatsnestForItems( const std::vector aItems ); - const std::vector GetRatsnestForComponent( MODULE* aComponent, bool aSkipInternalConnections = false ); + const std::vector GetRatsnestForComponent( FOOTPRINT* aComponent, + bool aSkipInternalConnections = false ); #endif std::shared_ptr GetFromToCache() diff --git a/pcbnew/connectivity/from_to_cache.cpp b/pcbnew/connectivity/from_to_cache.cpp index 2790859301..2696c61273 100644 --- a/pcbnew/connectivity/from_to_cache.cpp +++ b/pcbnew/connectivity/from_to_cache.cpp @@ -35,7 +35,7 @@ void FROM_TO_CACHE::buildEndpointList( ) { m_ftEndpoints.clear(); - for( MODULE* footprint : m_board->Footprints() ) + for( FOOTPRINT* footprint : m_board->Footprints() ) { for( PAD* pad : footprint->Pads() ) { diff --git a/pcbnew/convert_drawsegment_list_to_polygon.cpp b/pcbnew/convert_drawsegment_list_to_polygon.cpp index 7d01072177..80c9a3c427 100644 --- a/pcbnew/convert_drawsegment_list_to_polygon.cpp +++ b/pcbnew/convert_drawsegment_list_to_polygon.cpp @@ -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; @@ -1038,7 +1038,7 @@ bool BuildFootprintPolygonOutlines( BOARD* aBoard, SHAPE_POLY_SET& aOutlines, bool success = ConvertOutlineToPolygon( segList, outlines, aTolerance, aErrorText, aDiscontinuities, aIntersections ); - MODULE* footprint = aBoard->GetFirstFootprint(); + FOOTPRINT* footprint = aBoard->GetFirstFootprint(); // No footprint loaded if( !footprint ) diff --git a/pcbnew/cross-probing.cpp b/pcbnew/cross-probing.cpp index 7596854365..5ddb7e5de9 100644 --- a/pcbnew/cross-probing.cpp +++ b/pcbnew/cross-probing.cpp @@ -68,7 +68,7 @@ void PCB_EDIT_FRAME::ExecuteRemoteCommand( const char* cmdline ) char* text; int netcode = -1; bool multiHighlight = false; - MODULE* footprint = nullptr; + FOOTPRINT* footprint = nullptr; PAD* pad = nullptr; BOARD* pcb = GetBoard(); @@ -151,7 +151,7 @@ void PCB_EDIT_FRAME::ExecuteRemoteCommand( const char* cmdline ) modName = FROM_UTF8( text ); - footprint = pcb->FindModuleByReference( modName ); + footprint = pcb->FindFootprintByReference( modName ); if( footprint ) pad = footprint->FindPadByName( pinName ); @@ -174,7 +174,7 @@ void PCB_EDIT_FRAME::ExecuteRemoteCommand( const char* cmdline ) modName = FROM_UTF8( text ); - footprint = pcb->FindModuleByReference( modName ); + footprint = pcb->FindFootprintByReference( modName ); if( footprint ) msg.Printf( _( "%s found" ), modName ); @@ -256,7 +256,7 @@ void PCB_EDIT_FRAME::ExecuteRemoteCommand( const char* cmdline ) for( TRACK* track : pcb->Tracks() ) merge_area( track ); - for( MODULE* fp : pcb->Footprints() ) + for( FOOTPRINT* fp : pcb->Footprints() ) { for( PAD* p : fp->Pads() ) merge_area( p ); @@ -402,7 +402,7 @@ void PCB_EDIT_FRAME::ExecuteRemoteCommand( const char* cmdline ) std::string FormatProbeItem( BOARD_ITEM* aItem ) { - MODULE* footprint; + FOOTPRINT* footprint; if( !aItem ) return "$CLEAR: \"HIGHLIGHTED\""; // message to clear highlight state @@ -410,12 +410,12 @@ std::string FormatProbeItem( BOARD_ITEM* aItem ) switch( aItem->Type() ) { case PCB_FOOTPRINT_T: - footprint = (MODULE*) aItem; + footprint = (FOOTPRINT*) aItem; return StrPrintf( "$PART: \"%s\"", TO_UTF8( footprint->GetReference() ) ); case PCB_PAD_T: { - footprint = (MODULE*) aItem->GetParent(); + footprint = static_cast( aItem->GetParent() ); wxString pad = static_cast( aItem )->GetName(); return StrPrintf( "$PART: \"%s\" $PAD: \"%s\"", @@ -425,7 +425,7 @@ std::string FormatProbeItem( BOARD_ITEM* aItem ) case PCB_FP_TEXT_T: { - footprint = static_cast( aItem->GetParent() ); + footprint = static_cast( aItem->GetParent() ); FP_TEXT* text = static_cast( aItem ); const char* text_key; @@ -510,7 +510,7 @@ void PCB_EDIT_FRAME::KiwayMailIn( KIWAY_EXPRESS& mail ) NETLIST netlist; STRING_FORMATTER sf; - for( MODULE* footprint : this->GetBoard()->Footprints() ) + for( FOOTPRINT* footprint : this->GetBoard()->Footprints() ) { COMPONENT* component = new COMPONENT( footprint->GetFPID(), footprint->GetReference(), footprint->GetValue(), footprint->GetPath() ); diff --git a/pcbnew/dialogs/dialog_board_reannotate.cpp b/pcbnew/dialogs/dialog_board_reannotate.cpp index f9ffb8ae36..58a6c6b988 100644 --- a/pcbnew/dialogs/dialog_board_reannotate.cpp +++ b/pcbnew/dialogs/dialog_board_reannotate.cpp @@ -636,7 +636,7 @@ bool DIALOG_BOARD_REANNOTATE::ReannotateBoard() if( m_UpdateSchematic->GetValue() ) { //If updating schematic send a netlist - for( MODULE* footprint : m_footprints ) + for( FOOTPRINT* footprint : m_footprints ) { // Create a netlist newref = GetNewRefDes( footprint ); @@ -672,7 +672,7 @@ bool DIALOG_BOARD_REANNOTATE::ReannotateBoard() if( reannotateOk )//Only update if no errors { - for( MODULE* footprint : m_footprints ) + for( FOOTPRINT* footprint : m_footprints ) { newref = GetNewRefDes( footprint ); @@ -743,7 +743,7 @@ bool DIALOG_BOARD_REANNOTATE::BuildFootprintList( std::vector& aBadR RefDesInfo fpData; bool useModuleLocation = m_locationChoice->GetSelection() == 0; - for( MODULE* footprint : m_footprints ) + for( FOOTPRINT* footprint : m_footprints ) { fpData.Uuid = footprint->m_Uuid; fpData.RefDesString = footprint->GetReference(); @@ -948,7 +948,7 @@ void DIALOG_BOARD_REANNOTATE::BuildChangeArray( std::vector& aFootpr // /// @returns the new refdes for this footprint -RefDesChange* DIALOG_BOARD_REANNOTATE::GetNewRefDes( MODULE* aFootprint ) +RefDesChange* DIALOG_BOARD_REANNOTATE::GetNewRefDes( FOOTPRINT* aFootprint ) { size_t i; diff --git a/pcbnew/dialogs/dialog_board_reannotate.h b/pcbnew/dialogs/dialog_board_reannotate.h index 4d0b87dadc..f67473fe85 100644 --- a/pcbnew/dialogs/dialog_board_reannotate.h +++ b/pcbnew/dialogs/dialog_board_reannotate.h @@ -105,7 +105,7 @@ public: private: PCB_EDIT_FRAME* m_frame; - MODULES m_footprints; + FOOTPRINTS m_footprints; PCB_SCREEN* m_screen; PCBNEW_SELECTION m_selection; @@ -181,7 +181,7 @@ private: wxString aPrefix, bool aRemovePrefix, std::vector& aBadRefDes ); - RefDesChange* GetNewRefDes( MODULE* aFootprint ); + RefDesChange* GetNewRefDes( FOOTPRINT* aFootprint ); int RoundToGrid( int aCoord, int aGrid ); wxString CoordTowxString( int aX, int aY ); diff --git a/pcbnew/dialogs/dialog_board_statistics.cpp b/pcbnew/dialogs/dialog_board_statistics.cpp index 1a8bf0aa68..f945fe39e1 100644 --- a/pcbnew/dialogs/dialog_board_statistics.cpp +++ b/pcbnew/dialogs/dialog_board_statistics.cpp @@ -181,7 +181,7 @@ void DIALOG_BOARD_STATISTICS::getDataFromPCB() BOARD* board = m_parentFrame->GetBoard(); // 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 if( m_checkBoxExcludeComponentsNoPins->GetValue() && ! footprint->Pads().size() ) diff --git a/pcbnew/dialogs/dialog_choose_footprint.h b/pcbnew/dialogs/dialog_choose_footprint.h index a3e628b65f..12dd962abc 100644 --- a/pcbnew/dialogs/dialog_choose_footprint.h +++ b/pcbnew/dialogs/dialog_choose_footprint.h @@ -42,7 +42,7 @@ class wxTimer; class PCB_BASE_FRAME; class LIB_TREE; -class MODULE; +class FOOTPRINT; /** diff --git a/pcbnew/dialogs/dialog_cleanup_graphics.cpp b/pcbnew/dialogs/dialog_cleanup_graphics.cpp index d0d559cafc..6c37b2148b 100644 --- a/pcbnew/dialogs/dialog_cleanup_graphics.cpp +++ b/pcbnew/dialogs/dialog_cleanup_graphics.cpp @@ -84,7 +84,7 @@ void DIALOG_CLEANUP_GRAPHICS::doCleanup( bool aDryRun ) BOARD_COMMIT commit( m_parentFrame ); 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 ); if( !aDryRun ) diff --git a/pcbnew/dialogs/dialog_edit_footprint_for_fp_editor.cpp b/pcbnew/dialogs/dialog_edit_footprint_for_fp_editor.cpp index 7f23cb3c8a..8c40033984 100644 --- a/pcbnew/dialogs/dialog_edit_footprint_for_fp_editor.cpp +++ b/pcbnew/dialogs/dialog_edit_footprint_for_fp_editor.cpp @@ -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, - MODULE* aFootprint ) : + FOOTPRINT* aFootprint ) : DIALOG_FOOTPRINT_FP_EDITOR_BASE( aParent ), m_netClearance( aParent, m_NetClearanceLabel, m_NetClearanceCtrl, m_NetClearanceUnits, true ), 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." ); return false; } - else if( !MODULE::IsLibNameValid( aFootprintName ) ) + else if( !FOOTPRINT::IsLibNameValid( aFootprintName ) ) { m_delayedErrorMessage.Printf( _( "Footprint name may not contain \"%s\"." ), - MODULE::StringLibNameInvalidChars( true ) ); + FOOTPRINT::StringLibNameInvalidChars( true ) ); 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; } diff --git a/pcbnew/dialogs/dialog_edit_footprint_for_fp_editor.h b/pcbnew/dialogs/dialog_edit_footprint_for_fp_editor.h index 5c61147fe0..779eaf7955 100644 --- a/pcbnew/dialogs/dialog_edit_footprint_for_fp_editor.h +++ b/pcbnew/dialogs/dialog_edit_footprint_for_fp_editor.h @@ -40,7 +40,7 @@ class DIALOG_FOOTPRINT_FP_EDITOR : public DIALOG_FOOTPRINT_FP_EDITOR_BASE { private: FOOTPRINT_EDIT_FRAME* m_frame; - MODULE* m_footprint; + FOOTPRINT* m_footprint; static int m_page; // remember the last open page during session @@ -65,7 +65,7 @@ private: public: // 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; bool Validate() override; diff --git a/pcbnew/dialogs/dialog_exchange_footprints.cpp b/pcbnew/dialogs/dialog_exchange_footprints.cpp index cde387583d..e904bd622d 100644 --- a/pcbnew/dialogs/dialog_exchange_footprints.cpp +++ b/pcbnew/dialogs/dialog_exchange_footprints.cpp @@ -57,7 +57,7 @@ bool g_reset3DModels[2] = { false, true }; DIALOG_EXCHANGE_FOOTPRINTS::DIALOG_EXCHANGE_FOOTPRINTS( PCB_EDIT_FRAME* aParent, - MODULE* aFootprint, + FOOTPRINT* aFootprint, bool updateMode, bool selectedMode ) : DIALOG_EXCHANGE_FOOTPRINTS_BASE( 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; @@ -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(); wxString msg; @@ -363,7 +363,7 @@ bool DIALOG_EXCHANGE_FOOTPRINTS::processFootprint( MODULE* aFootprint, const LIB oldFPID.Format().c_str(), aNewFPID.Format().c_str() ); - MODULE* newFootprint = m_parent->LoadFootprint( aNewFPID ); + FOOTPRINT* newFootprint = m_parent->LoadFootprint( aNewFPID ); 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 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, - bool deleteExtraTexts, bool resetTextLayers, - bool resetTextEffects, bool resetFabricationAttrs, - bool reset3DModels ) +void PCB_EDIT_FRAME::ExchangeFootprint( FOOTPRINT* aExisting, FOOTPRINT* aNew, + BOARD_COMMIT& aCommit, bool deleteExtraTexts, + bool resetTextLayers, bool resetTextEffects, + bool resetFabricationAttrs, bool reset3DModels ) { PCB_GROUP* parentGroup = aExisting->GetParentGroup(); diff --git a/pcbnew/dialogs/dialog_exchange_footprints.h b/pcbnew/dialogs/dialog_exchange_footprints.h index c45598e67d..312807f80b 100644 --- a/pcbnew/dialogs/dialog_exchange_footprints.h +++ b/pcbnew/dialogs/dialog_exchange_footprints.h @@ -30,7 +30,7 @@ #include class PCB_EDIT_FRAME; -class MODULE; +class FOOTPRINT; class LIB_ID; class DIALOG_EXCHANGE_FOOTPRINTS : public DIALOG_EXCHANGE_FOOTPRINTS_BASE @@ -38,12 +38,12 @@ class DIALOG_EXCHANGE_FOOTPRINTS : public DIALOG_EXCHANGE_FOOTPRINTS_BASE private: BOARD_COMMIT m_commit; PCB_EDIT_FRAME* m_parent; - MODULE* m_currentFootprint; + FOOTPRINT* m_currentFootprint; bool m_updateMode; int* m_matchMode; 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 ); ~DIALOG_EXCHANGE_FOOTPRINTS() override; @@ -59,9 +59,9 @@ private: wxRadioButton* getRadioButtonForMode(); - bool isMatch( MODULE* ); + bool isMatch( FOOTPRINT* ); bool processMatchingFootprints(); - bool processFootprint( MODULE* aFootprint, const LIB_ID& aNewFPID ); + bool processFootprint( FOOTPRINT* aFootprint, const LIB_ID& aNewFPID ); }; #endif // DIALOG_EXCHANGE_FOOTPRINTS_H_ diff --git a/pcbnew/dialogs/dialog_find.cpp b/pcbnew/dialogs/dialog_find.cpp index 9a595b2e72..edcdacb142 100644 --- a/pcbnew/dialogs/dialog_find.cpp +++ b/pcbnew/dialogs/dialog_find.cpp @@ -220,7 +220,7 @@ void DIALOG_FIND::search( bool aDirection ) 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 ) && FindIncludeReferences ) diff --git a/pcbnew/dialogs/dialog_footprint_properties.cpp b/pcbnew/dialogs/dialog_footprint_properties.cpp index 97b3176706..415f30f8e7 100644 --- a/pcbnew/dialogs/dialog_footprint_properties.cpp +++ b/pcbnew/dialogs/dialog_footprint_properties.cpp @@ -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, - MODULE* aFootprint ) : + FOOTPRINT* aFootprint ) : DIALOG_FOOTPRINT_PROPERTIES_BASE( aParent ), m_posX( aParent, m_XPosLabel, m_ModPositionX, m_XPosUnit ), m_posY( aParent, m_YPosLabel, m_ModPositionY, m_YPosUnit ), diff --git a/pcbnew/dialogs/dialog_footprint_properties.h b/pcbnew/dialogs/dialog_footprint_properties.h index 5ad815d836..77b379e18f 100644 --- a/pcbnew/dialogs/dialog_footprint_properties.h +++ b/pcbnew/dialogs/dialog_footprint_properties.h @@ -42,7 +42,7 @@ class DIALOG_FOOTPRINT_PROPERTIES: public DIALOG_FOOTPRINT_PROPERTIES_BASE { private: PCB_EDIT_FRAME* m_frame; - MODULE* m_footprint; + FOOTPRINT* m_footprint; static int m_page; // remember the last open page during session @@ -81,7 +81,7 @@ public: public: // 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; bool Validate() override; diff --git a/pcbnew/dialogs/dialog_gendrill.cpp b/pcbnew/dialogs/dialog_gendrill.cpp index 7e2823fbbb..6c2d1286f9 100644 --- a/pcbnew/dialogs/dialog_gendrill.cpp +++ b/pcbnew/dialogs/dialog_gendrill.cpp @@ -139,7 +139,7 @@ void DIALOG_GENDRILL::InitDisplayParams() m_microViasCount = 0; m_blindOrBuriedViasCount = 0; - for( MODULE* footprint : m_board->Footprints() ) + for( FOOTPRINT* footprint : m_board->Footprints() ) { for( PAD* pad : footprint->Pads() ) { diff --git a/pcbnew/dialogs/dialog_global_deletion.cpp b/pcbnew/dialogs/dialog_global_deletion.cpp index 940c598c93..3a24449832 100644 --- a/pcbnew/dialogs/dialog_global_deletion.cpp +++ b/pcbnew/dialogs/dialog_global_deletion.cpp @@ -170,7 +170,7 @@ void DIALOG_GLOBAL_DELETION::AcceptPcbDelete() if( delAll || m_DelModules->GetValue() ) { - for( MODULE* item : pcb->Footprints() ) + for( FOOTPRINT* item : pcb->Footprints() ) { bool del_fp = delAll; diff --git a/pcbnew/dialogs/dialog_global_edit_text_and_graphics.cpp b/pcbnew/dialogs/dialog_global_edit_text_and_graphics.cpp index ba76fab6ca..cec473d0b3 100644 --- a/pcbnew/dialogs/dialog_global_edit_text_and_graphics.cpp +++ b/pcbnew/dialogs/dialog_global_edit_text_and_graphics.cpp @@ -343,7 +343,7 @@ void DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::visitItem( BOARD_COMMIT& aCommit, BOA if( m_referenceFilterOpt->GetValue() && !m_referenceFilter->GetValue().IsEmpty() ) { - MODULE* fp = dynamic_cast( aItem->GetParent() ); + FOOTPRINT* fp = dynamic_cast( aItem->GetParent() ); 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() ) { - MODULE* fp = dynamic_cast( aItem->GetParent() ); + FOOTPRINT* fp = dynamic_cast( aItem->GetParent() ); if( fp ) { @@ -378,7 +378,7 @@ bool DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::TransferDataFromWindow() BOARD_COMMIT commit( m_parent ); // Go through the footprints - for( MODULE* fp : m_parent->GetBoard()->Footprints() ) + for( FOOTPRINT* fp : m_parent->GetBoard()->Footprints() ) { if( m_references->GetValue() ) visitItem( commit, &fp->Reference() ); diff --git a/pcbnew/dialogs/dialog_net_inspector.cpp b/pcbnew/dialogs/dialog_net_inspector.cpp index ba6b5b9507..3dc832a0c6 100644 --- a/pcbnew/dialogs/dialog_net_inspector.cpp +++ b/pcbnew/dialogs/dialog_net_inspector.cpp @@ -1154,7 +1154,7 @@ void DIALOG_NET_INSPECTOR::OnBoardItemAdded( BOARD& aBoard, BOARD_ITEM* aBoardIt // resort to generic slower net update otherwise. updateNet( i->GetNet() ); } - else if( MODULE* footprint = dynamic_cast( aBoardItem ) ) + else if( FOOTPRINT* footprint = dynamic_cast( aBoardItem ) ) { 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 ) ); } - else if( MODULE* footprint = dynamic_cast( aBoardItem ) ) + else if( FOOTPRINT* footprint = dynamic_cast( aBoardItem ) ) { 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 ) { if( dynamic_cast( aBoardItem ) != nullptr - || dynamic_cast( aBoardItem ) != nullptr ) + || dynamic_cast( aBoardItem ) != nullptr ) { buildNetsList(); 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 // iterating over the footprints' pads is faster. - for( MODULE* footprint : m_brd->Footprints() ) + for( FOOTPRINT* footprint : m_brd->Footprints() ) { for( PAD* pad : footprint->Pads() ) { diff --git a/pcbnew/dialogs/dialog_netlist.h b/pcbnew/dialogs/dialog_netlist.h index 4ab59202d8..9fa129987b 100644 --- a/pcbnew/dialogs/dialog_netlist.h +++ b/pcbnew/dialogs/dialog_netlist.h @@ -31,7 +31,7 @@ #include -class MODULE; +class FOOTPRINT; class NETLIST; diff --git a/pcbnew/dialogs/dialog_pad_properties.cpp b/pcbnew/dialogs/dialog_pad_properties.cpp index b68fdca653..584c04c047 100644 --- a/pcbnew/dialogs/dialog_pad_properties.cpp +++ b/pcbnew/dialogs/dialog_pad_properties.cpp @@ -156,7 +156,7 @@ DIALOG_PAD_PROPERTIES::DIALOG_PAD_PROPERTIES( PCB_BASE_FRAME* aParent, PAD* aPad m_nonCopperWarningIcon->SetBitmap( KiBitmap( dialog_warning_xpm ) ); m_padMaster = &m_parent->GetDesignSettings().m_Pad_Master; - m_dummyPad = new PAD((MODULE*) NULL ); + m_dummyPad = new PAD( (FOOTPRINT*) NULL ); if( aPad ) { @@ -462,7 +462,7 @@ void DIALOG_PAD_PROPERTIES::initValues() m_isFlipped = m_currentPad->IsFlipped(); // Diplay parent footprint info - MODULE* footprint = m_currentPad->GetParent(); + FOOTPRINT* footprint = m_currentPad->GetParent(); if( footprint ) { @@ -479,7 +479,7 @@ void DIALOG_PAD_PROPERTIES::initValues() if( m_currentPad ) { - MODULE* footprint = m_currentPad->GetParent(); + FOOTPRINT* footprint = m_currentPad->GetParent(); if( footprint ) { @@ -1522,8 +1522,8 @@ bool DIALOG_PAD_PROPERTIES::TransferDataFromWindow() m_currentPad->SetPosition( m_padMaster->GetPosition() ); m_currentPad->SetOrientation( m_padMaster->GetOrientation() ); - wxSize size; - MODULE* footprint = m_currentPad->GetParent(); + wxSize size; + FOOTPRINT* footprint = m_currentPad->GetParent(); m_currentPad->SetSize( m_padMaster->GetSize() ); diff --git a/pcbnew/dialogs/dialog_text_properties.cpp b/pcbnew/dialogs/dialog_text_properties.cpp index 44f08ab995..3cc4a74feb 100644 --- a/pcbnew/dialogs/dialog_text_properties.cpp +++ b/pcbnew/dialogs/dialog_text_properties.cpp @@ -249,8 +249,8 @@ bool DIALOG_TEXT_PROPERTIES::TransferDataToWindow() if( m_item->Type() == PCB_FP_TEXT_T && m_fpText ) { - MODULE* footprint = dynamic_cast( m_fpText->GetParent() ); - wxString msg; + FOOTPRINT* footprint = dynamic_cast( m_fpText->GetParent() ); + wxString msg; if( footprint ) { diff --git a/pcbnew/dialogs/dialog_unused_pad_layers.cpp b/pcbnew/dialogs/dialog_unused_pad_layers.cpp index 50ad8e9006..f17fdf374f 100644 --- a/pcbnew/dialogs/dialog_unused_pad_layers.cpp +++ b/pcbnew/dialogs/dialog_unused_pad_layers.cpp @@ -103,7 +103,7 @@ bool DIALOG_UNUSED_PAD_LAYERS::TransferDataFromWindow() if( item->Type() == PCB_FOOTPRINT_T && m_rbScope->GetSelection() == SCOPE_PADS ) { - MODULE* footprint = static_cast( item ); + FOOTPRINT* footprint = static_cast( item ); for( PAD* pad : footprint->Pads() ) { @@ -125,7 +125,7 @@ bool DIALOG_UNUSED_PAD_LAYERS::TransferDataFromWindow() { if( m_rbScope->GetSelection() == SCOPE_PADS ) { - for( MODULE* footprint : m_frame->GetBoard()->Footprints() ) + for( FOOTPRINT* footprint : m_frame->GetBoard()->Footprints() ) { m_commit.Modify( footprint ); diff --git a/pcbnew/drc/drc_engine.cpp b/pcbnew/drc/drc_engine.cpp index 90f21106eb..120ec147c7 100644 --- a/pcbnew/drc/drc_engine.cpp +++ b/pcbnew/drc/drc_engine.cpp @@ -365,7 +365,7 @@ void DRC_ENGINE::loadImplicitRules() keepoutZones.push_back( zone ); } - for( MODULE* footprint : m_board->Footprints() ) + for( FOOTPRINT* footprint : m_board->Footprints() ) { 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() ) zone->CacheBoundingBox(); - for( MODULE* footprint : m_board->Footprints() ) + for( FOOTPRINT* footprint : m_board->Footprints() ) { for( ZONE* zone : footprint->Zones() ) zone->CacheBoundingBox(); diff --git a/pcbnew/drc/drc_test_provider.cpp b/pcbnew/drc/drc_test_provider.cpp index 451b550f91..4bc05e720d 100644 --- a/pcbnew/drc/drc_test_provider.cpp +++ b/pcbnew/drc/drc_test_provider.cpp @@ -228,7 +228,7 @@ int DRC_TEST_PROVIDER::forEachGeometryItem( const std::vector& aTypes, } } - for( MODULE* footprint : brd->Footprints() ) + for( FOOTPRINT* footprint : brd->Footprints() ) { if( typeMask[ PCB_FP_TEXT_T ] ) { diff --git a/pcbnew/drc/drc_test_provider_copper_clearance.cpp b/pcbnew/drc/drc_test_provider_copper_clearance.cpp index 0dc4cbc496..0f5dd96cc3 100644 --- a/pcbnew/drc/drc_test_provider_copper_clearance.cpp +++ b/pcbnew/drc/drc_test_provider_copper_clearance.cpp @@ -127,7 +127,7 @@ bool DRC_TEST_PROVIDER_COPPER_CLEARANCE::Run() m_zones.push_back( zone ); } - for( MODULE* footprint : m_board->Footprints() ) + for( FOOTPRINT* footprint : m_board->Footprints() ) { for( ZONE* zone : footprint->Zones() ) { @@ -513,14 +513,14 @@ void DRC_TEST_PROVIDER_COPPER_CLEARANCE::testPadClearances( ) size_t count = 0; - for( MODULE* footprint : m_board->Footprints() ) + for( FOOTPRINT* footprint : m_board->Footprints() ) count += footprint->Pads().size(); reportAux( "Testing %d pads...", count ); int ii = 0; - for( MODULE* footprint : m_board->Footprints() ) + for( FOOTPRINT* footprint : m_board->Footprints() ) { for( PAD* pad : footprint->Pads() ) { diff --git a/pcbnew/drc/drc_test_provider_courtyard_clearance.cpp b/pcbnew/drc/drc_test_provider_courtyard_clearance.cpp index a57a61d580..b6838ef6f8 100644 --- a/pcbnew/drc/drc_test_provider_courtyard_clearance.cpp +++ b/pcbnew/drc/drc_test_provider_courtyard_clearance.cpp @@ -82,7 +82,7 @@ void DRC_TEST_PROVIDER_COURTYARD_CLEARANCE::testFootprintCourtyardDefinitions() int ii = 0; - for( MODULE* footprint : m_board->Footprints() ) + for( FOOTPRINT* footprint : m_board->Footprints() ) { if( !reportProgress( ii++, m_board->Footprints().size(), delta ) ) return; @@ -136,7 +136,7 @@ void DRC_TEST_PROVIDER_COURTYARD_CLEARANCE::testOverlappingComponentCourtyards() if( m_drcEngine->IsErrorLimitExceeded( DRCE_OVERLAPPING_FOOTPRINTS) ) break; - MODULE* footprint = *it1; + FOOTPRINT* footprint = *it1; SHAPE_POLY_SET& footprintFront = footprint->GetPolyCourtyardFront(); 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++ ) { - MODULE* test = *it2; + FOOTPRINT* test = *it2; SHAPE_POLY_SET& testFront = test->GetPolyCourtyardFront(); SHAPE_POLY_SET& testBack = test->GetPolyCourtyardBack(); SHAPE_POLY_SET intersection; diff --git a/pcbnew/drc/drc_test_provider_hole_clearance.cpp b/pcbnew/drc/drc_test_provider_hole_clearance.cpp index 95fec7bf2c..abeccbedf3 100644 --- a/pcbnew/drc/drc_test_provider_hole_clearance.cpp +++ b/pcbnew/drc/drc_test_provider_hole_clearance.cpp @@ -196,7 +196,7 @@ bool DRC_TEST_PROVIDER_HOLE_CLEARANCE::Run() via->SetFlags( SKIP_STRUCT ); } - for( MODULE* footprint : m_board->Footprints() ) + for( FOOTPRINT* footprint : m_board->Footprints() ) { for( PAD* pad : footprint->Pads() ) { diff --git a/pcbnew/drc/drc_test_provider_hole_size.cpp b/pcbnew/drc/drc_test_provider_hole_size.cpp index 3df1ac237b..1b7a68fc86 100644 --- a/pcbnew/drc/drc_test_provider_hole_size.cpp +++ b/pcbnew/drc/drc_test_provider_hole_size.cpp @@ -81,7 +81,7 @@ bool DRC_TEST_PROVIDER_HOLE_SIZE::Run() 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 ) ) break; diff --git a/pcbnew/drc/drc_test_provider_lvs.cpp b/pcbnew/drc/drc_test_provider_lvs.cpp index 3a73c8c78d..0a8af24cfa 100644 --- a/pcbnew/drc/drc_test_provider_lvs.cpp +++ b/pcbnew/drc/drc_test_provider_lvs.cpp @@ -80,15 +80,15 @@ void DRC_TEST_PROVIDER_LVS::testFootprints( NETLIST& aNetlist ) { 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; }; - auto footprints = std::set( compare ); + auto footprints = std::set( compare ); // Search for duplicate footprints on the board - for( MODULE* footprint : board->Footprints() ) + for( FOOTPRINT* footprint : board->Footprints() ) { if( m_drcEngine->IsErrorLimitExceeded( DRCE_DUPLICATE_FOOTPRINT ) ) break; @@ -108,7 +108,7 @@ void DRC_TEST_PROVIDER_LVS::testFootprints( NETLIST& aNetlist ) for( unsigned ii = 0; ii < aNetlist.GetCount(); ii++ ) { COMPONENT* component = aNetlist.GetComponent( ii ); - MODULE* footprint = board->FindModuleByReference( component->GetReference() ); + FOOTPRINT* footprint = board->FindFootprintByReference( component->GetReference()); 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. - for( MODULE* footprint : board->Footprints() ) + for( FOOTPRINT* footprint : board->Footprints() ) { if( m_drcEngine->IsErrorLimitExceeded( DRCE_EXTRA_FOOTPRINT ) ) break; diff --git a/pcbnew/drc/drc_test_provider_silk_clearance.cpp b/pcbnew/drc/drc_test_provider_silk_clearance.cpp index 7ec6d1c7e4..b42068c11f 100644 --- a/pcbnew/drc/drc_test_provider_silk_clearance.cpp +++ b/pcbnew/drc/drc_test_provider_silk_clearance.cpp @@ -167,8 +167,8 @@ bool DRC_TEST_PROVIDER_SILK_CLEARANCE::Run() if( refGraphic && testGraphic ) { - MODULE *refParentFP = dynamic_cast( refGraphic->GetParent() ); - MODULE *testParentFP = dynamic_cast( testGraphic->GetParent() ); + FOOTPRINT *refParentFP = dynamic_cast( refGraphic->GetParent() ); + FOOTPRINT *testParentFP = dynamic_cast( testGraphic->GetParent() ); if( refParentFP == testParentFP ) // also true when both are nullptr return true; diff --git a/pcbnew/edit.cpp b/pcbnew/edit.cpp index 9ef0248da3..cecd936645 100644 --- a/pcbnew/edit.cpp +++ b/pcbnew/edit.cpp @@ -131,7 +131,7 @@ void PCB_EDIT_FRAME::OnEditItemRequest( BOARD_ITEM* aItem ) break; case PCB_FOOTPRINT_T: - ShowFootprintPropertiesDialog( static_cast( aItem ) ); + ShowFootprintPropertiesDialog( static_cast( aItem ) ); break; case PCB_TARGET_T: diff --git a/pcbnew/exporters/export_d356.cpp b/pcbnew/exporters/export_d356.cpp index 720624e0a4..b0b480f872 100644 --- a/pcbnew/exporters/export_d356.cpp +++ b/pcbnew/exporters/export_d356.cpp @@ -94,7 +94,7 @@ static void build_pad_testpoints( BOARD *aPcb, std::vector & aRecor { wxPoint origin = aPcb->GetDesignSettings().m_AuxOrigin; - for( MODULE* footprint : aPcb->Footprints() ) + for( FOOTPRINT* footprint : aPcb->Footprints() ) { for( PAD* pad : footprint->Pads() ) { diff --git a/pcbnew/exporters/export_footprint_associations.cpp b/pcbnew/exporters/export_footprint_associations.cpp index 1509b638ac..43ecc25b93 100644 --- a/pcbnew/exporters/export_footprint_associations.cpp +++ b/pcbnew/exporters/export_footprint_associations.cpp @@ -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() ) ); - for( MODULE* fp : aBrd->Footprints() ) + for( FOOTPRINT* fp : aBrd->Footprints() ) { fprintf( cmpFile, "\nBeginCmp\n" ); fprintf( cmpFile, "TimeStamp = %s\n", TO_UTF8( fp->m_Uuid.AsString() ) ); diff --git a/pcbnew/exporters/export_footprints_placefile.cpp b/pcbnew/exporters/export_footprints_placefile.cpp index e9c96d62a1..89b0d45286 100644 --- a/pcbnew/exporters/export_footprints_placefile.cpp +++ b/pcbnew/exporters/export_footprints_placefile.cpp @@ -35,7 +35,7 @@ class LIST_MOD // An helper class used to build a list of useful footprints. { 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_Value; // Its schematic value 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 std::vector list; - for( MODULE* footprint : m_board->Footprints() ) + for( FOOTPRINT* footprint : m_board->Footprints() ) { if( m_side != PCB_BOTH_SIDES ) { @@ -303,18 +303,18 @@ std::string PLACE_FILE_EXPORTER::GenReportData() buffer += "$EndBOARD\n\n"; - std::vector sortedFootprints; + std::vector sortedFootprints; - for( MODULE* footprint : m_board->Footprints() ) + for( FOOTPRINT* footprint : m_board->Footprints() ) sortedFootprints.push_back( footprint ); std::sort( sortedFootprints.begin(), sortedFootprints.end(), - []( MODULE* a, MODULE* b ) -> bool + []( FOOTPRINT* a, FOOTPRINT* b ) -> bool { return StrNumCmp( a->GetReference(), b->GetReference(), true ) < 0; }); - for( MODULE* footprint : sortedFootprints ) + for( FOOTPRINT* footprint : sortedFootprints ) { wxString ref = footprint->Reference().GetShownText(); diff --git a/pcbnew/exporters/export_gencad.cpp b/pcbnew/exporters/export_gencad.cpp index 9011208a81..f9449df47d 100644 --- a/pcbnew/exporters/export_gencad.cpp +++ b/pcbnew/exporters/export_gencad.cpp @@ -53,7 +53,7 @@ static void CreateRoutesSection( FILE* aFile, BOARD* aPcb ); static void CreateSignalsSection( FILE* aFile, BOARD* aPcb ); static void CreateShapesSection( 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 @@ -181,10 +181,10 @@ static bool storeOriginCoords; static int GencadOffsetX, GencadOffsetY; // Association between shape names (using shapeName index) and components -static std::map componentShapes; +static std::map componentShapes; static std::map shapeNames; -static const wxString getShapeName( MODULE* aFootprint ) +static const wxString getShapeName( FOOTPRINT* aFootprint ) { static const wxString invalid( "invalid" ); @@ -275,7 +275,7 @@ void PCB_EDIT_FRAME::ExportToGenCAD( wxCommandEvent& aEvent ) */ BOARD* pcb = GetBoard(); - for( MODULE* footprint : pcb->Footprints() ) + for( FOOTPRINT* footprint : pcb->Footprints() ) { footprint->SetFlag( 0 ); @@ -311,7 +311,7 @@ void PCB_EDIT_FRAME::ExportToGenCAD( wxCommandEvent& aEvent ) fclose( file ); // Undo the footprints modifications (flipped footprints) - for( MODULE* footprint : pcb->Footprints() ) + for( FOOTPRINT* footprint : pcb->Footprints() ) { 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 -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 - | HASH_FLAGS::HASH_ROT | HASH_FLAGS::HASH_LAYER; + | HASH_FLAGS::HASH_ROT | HASH_FLAGS::HASH_LAYER; - - for( auto i : aFootprint->GraphicalItems() ) + for( BOARD_ITEM* i : aFootprint->GraphicalItems() ) ret += hash_eda( i, flags ); - for( auto i : aFootprint->Pads() ) + for( PAD* i : aFootprint->Pads() ) ret += hash_eda( i, flags ); return ret; @@ -694,7 +693,7 @@ static void CreateShapesSection( FILE* aFile, BOARD* aPcb ) fputs( "$SHAPES\n", aFile ); - for( MODULE* footprint : aPcb->Footprints() ) + for( FOOTPRINT* footprint : aPcb->Footprints() ) { if( !individualShapes ) { @@ -705,7 +704,7 @@ static void CreateShapesSection( FILE* aFile, BOARD* aPcb ) wxString shapeName = footprint->GetFPID().Format(); auto shapeIt = shapes.find( shapeName ); - size_t modHash = hashModule( footprint ); + size_t modHash = hashFootprint( footprint ); if( shapeIt != shapes.end() ) { @@ -807,7 +806,7 @@ static void CreateComponentsSection( FILE* aFile, BOARD* aPcb ) int cu_count = aPcb->GetCopperLayerCount(); - for( MODULE* footprint : aPcb->Footprints() ) + for( FOOTPRINT* footprint : aPcb->Footprints() ) { const char* mirror; const char* flip; @@ -898,7 +897,7 @@ static void CreateSignalsSection( FILE* aFile, BOARD* aPcb ) fputs( TO_UTF8( msg ), aFile ); fputs( "\n", aFile ); - for( MODULE* footprint : aPcb->Footprints() ) + for( FOOTPRINT* footprint : aPcb->Footprints() ) { for( PAD* pad : footprint->Pads() ) { @@ -1065,7 +1064,7 @@ static void CreateDevicesSection( FILE* aFile, BOARD* aPcb ) if( !newDevice ) // do not repeat device definitions continue; - const MODULE* footprint = componentShape.first; + const FOOTPRINT* footprint = componentShape.first; 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 * 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; diff --git a/pcbnew/exporters/export_hyperlynx.cpp b/pcbnew/exporters/export_hyperlynx.cpp index b33cc87d3e..b494a8df27 100644 --- a/pcbnew/exporters/export_hyperlynx.cpp +++ b/pcbnew/exporters/export_hyperlynx.cpp @@ -383,7 +383,7 @@ bool HYPERLYNX_EXPORTER::writeDevices() { m_out->Print( 0, "{DEVICES\n" ); - for( MODULE* footprint : m_board->Footprints() ) + for( FOOTPRINT* footprint : m_board->Footprints() ) { wxString ref = footprint->GetReference(); wxString layerName = m_board->GetLayerName( footprint->GetLayer() ); @@ -402,7 +402,7 @@ bool HYPERLYNX_EXPORTER::writeDevices() bool HYPERLYNX_EXPORTER::writePadStacks() { - for( MODULE* footprint : m_board->Footprints() ) + for( FOOTPRINT* footprint : m_board->Footprints() ) { for( PAD* pad : footprint->Pads() ) { @@ -546,9 +546,9 @@ const std::vector HYPERLYNX_EXPORTER::collectNetObjects( int netcod 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 ) ) rv.push_back( pad ); diff --git a/pcbnew/exporters/export_idf.cpp b/pcbnew/exporters/export_idf.cpp index 340770e52d..90d4fc9bbc 100644 --- a/pcbnew/exporters/export_idf.cpp +++ b/pcbnew/exporters/export_idf.cpp @@ -273,7 +273,7 @@ UseBoundingBox: * compiles data for the PLACEMENT section and compiles data for * 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 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 ); // Output the drill holes and footprint (library) data. - for( MODULE* footprint : aPcb->Footprints() ) + for( FOOTPRINT* footprint : aPcb->Footprints() ) idf_export_footprint( aPcb, footprint, idfBoard ); if( !idfBoard.WriteFile( aFullFileName, idfUnit, false ) ) diff --git a/pcbnew/exporters/export_vrml.cpp b/pcbnew/exporters/export_vrml.cpp index e74d239512..2255c0ffb5 100644 --- a/pcbnew/exporters/export_vrml.cpp +++ b/pcbnew/exporters/export_vrml.cpp @@ -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(); 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 ) { if( !aModel.m_plainPCB ) @@ -1655,7 +1655,7 @@ bool PCB_EDIT_FRAME::ExportVRML_File( const wxString& aFullFileName, double aMMt output_file << " children [\n"; // Export footprints - for( MODULE* footprint : pcb->Footprints() ) + for( FOOTPRINT* footprint : pcb->Footprints() ) export_vrml_footprint( model3d, pcb, footprint, &output_file ); // write out the board and all layers @@ -1669,7 +1669,7 @@ bool PCB_EDIT_FRAME::ExportVRML_File( const wxString& aFullFileName, double aMMt else { // Export footprints - for( MODULE* footprint : pcb->Footprints() ) + for( FOOTPRINT* footprint : pcb->Footprints() ) export_vrml_footprint( model3d, pcb, footprint, NULL ); // write out the board and all layers diff --git a/pcbnew/exporters/gendrill_file_writer_base.cpp b/pcbnew/exporters/gendrill_file_writer_base.cpp index 4c7f35d907..08df5c54c1 100644 --- a/pcbnew/exporters/gendrill_file_writer_base.cpp +++ b/pcbnew/exporters/gendrill_file_writer_base.cpp @@ -119,7 +119,7 @@ void GENDRILL_WRITER_BASE::buildHolesList( DRILL_LAYER_PAIR aLayerPair, if( aLayerPair == DRILL_LAYER_PAIR( F_Cu, B_Cu ) ) { // add holes for thru hole pads - for( MODULE* footprint : m_pcb->Footprints() ) + for( FOOTPRINT* footprint : m_pcb->Footprints() ) { for( PAD* pad : footprint->Pads() ) { diff --git a/pcbnew/exporters/gerber_jobfile_writer.cpp b/pcbnew/exporters/gerber_jobfile_writer.cpp index b96d96b155..7dd5285570 100644 --- a/pcbnew/exporters/gerber_jobfile_writer.cpp +++ b/pcbnew/exporters/gerber_jobfile_writer.cpp @@ -464,7 +464,7 @@ void GERBER_JOBFILE_WRITER::addJSONDesignRules() int minPadClearanceOuter = defaultNC.GetClearance(); int minPadClearanceInner = defaultNC.GetClearance(); - for( MODULE* footprint : m_pcb->Footprints() ) + for( FOOTPRINT* footprint : m_pcb->Footprints() ) { for( PAD* pad : footprint->Pads() ) { diff --git a/pcbnew/exporters/gerber_placefile_writer.cpp b/pcbnew/exporters/gerber_placefile_writer.cpp index 916b383b63..427bfbcaef 100644 --- a/pcbnew/exporters/gerber_placefile_writer.cpp +++ b/pcbnew/exporters/gerber_placefile_writer.cpp @@ -65,9 +65,9 @@ int PLACEFILE_GERBER_WRITER::CreatePlaceFile( wxString& aFullFilename, PCB_LAYER m_offset = m_pcb->GetDesignSettings().m_AuxOrigin; // Collect footprints on the right layer - std::vector fp_list; + std::vector fp_list; - for( MODULE* footprint : m_pcb->Footprints() ) + for( FOOTPRINT* footprint : m_pcb->Footprints() ) { if( footprint->GetAttributes() & FP_EXCLUDE_FROM_POS_FILES ) continue; @@ -124,7 +124,7 @@ int PLACEFILE_GERBER_WRITER::CreatePlaceFile( wxString& aFullFilename, PCB_LAYER bool allowUtf8 = true; // 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: GBR_METADATA gbr_metadata; @@ -299,7 +299,7 @@ int PLACEFILE_GERBER_WRITER::CreatePlaceFile( wxString& aFullFilename, PCB_LAYER brd_plotter.PlotBoardGraphicItems(); // Draw footprint other graphic items: - for( MODULE* footprint : fp_list ) + for( FOOTPRINT* footprint : fp_list ) { for( BOARD_ITEM* item : footprint->GraphicalItems() ) { @@ -324,7 +324,7 @@ double PLACEFILE_GERBER_WRITER::mapRotationAngle( double aAngle ) } -void PLACEFILE_GERBER_WRITER::findPads1( std::vector& aPadList, MODULE* aFootprint ) const +void PLACEFILE_GERBER_WRITER::findPads1( std::vector& aPadList, FOOTPRINT* aFootprint ) const { // Fint the pad "1" or pad "A1" // this is possible only if only one pad is found diff --git a/pcbnew/exporters/gerber_placefile_writer.h b/pcbnew/exporters/gerber_placefile_writer.h index fc1ad9ffc5..9ad00a8ed1 100644 --- a/pcbnew/exporters/gerber_placefile_writer.h +++ b/pcbnew/exporters/gerber_placefile_writer.h @@ -30,7 +30,7 @@ #include class BOARD; -class MODULE; +class FOOTPRINT; class PAD; /** @@ -101,7 +101,7 @@ private: * @param aPadList is the list to fill * @param aFootprint is the footprint to test */ - void findPads1( std::vector& aPadList, MODULE* aFootprint ) const; + void findPads1( std::vector& aPadList, FOOTPRINT* aFootprint ) const; }; #endif // #ifndef PLACEFILE_GERBER_WRITER_H diff --git a/pcbnew/files.cpp b/pcbnew/files.cpp index 367c801f53..c08afa51d0 100644 --- a/pcbnew/files.cpp +++ b/pcbnew/files.cpp @@ -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 - for( MODULE* footprint : GetBoard()->Footprints() ) + for( FOOTPRINT* footprint : GetBoard()->Footprints() ) { LIB_ID libId = footprint->GetFPID(); diff --git a/pcbnew/footprint.cpp b/pcbnew/footprint.cpp index c4c1484efd..b133a863ae 100644 --- a/pcbnew/footprint.cpp +++ b/pcbnew/footprint.cpp @@ -39,7 +39,7 @@ #include -MODULE::MODULE( BOARD* parent ) : +FOOTPRINT::FOOTPRINT( BOARD* parent ) : BOARD_ITEM_CONTAINER((BOARD_ITEM*) parent, PCB_FOOTPRINT_T ), 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 ) { 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 ) { *this = std::move( aFootprint ); } -MODULE::~MODULE() +FOOTPRINT::~FOOTPRINT() { // Clean up the owned elements delete m_reference; @@ -200,7 +200,7 @@ MODULE::~MODULE() } -MODULE& MODULE::operator=( MODULE&& aOther ) +FOOTPRINT& FOOTPRINT::operator=( FOOTPRINT&& 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 ); @@ -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( "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" ) ) ) { @@ -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. // 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() ) { @@ -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() ) { @@ -561,13 +561,13 @@ void MODULE::Remove( BOARD_ITEM* aBoardItem ) } -void MODULE::CalculateBoundingBox() +void FOOTPRINT::CalculateBoundingBox() { m_boundingBox = GetFootprintRect(); } -double MODULE::GetArea( int aPadding ) const +double FOOTPRINT::GetArea( int aPadding ) const { double w = std::abs( static_cast( m_boundingBox.GetWidth() ) ) + aPadding; double h = std::abs( static_cast( 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; @@ -601,13 +601,13 @@ EDA_RECT MODULE::GetFootprintRect() const } -EDA_RECT MODULE::GetFpPadsLocalBbox() const +EDA_RECT FOOTPRINT::GetFpPadsLocalBbox() const { EDA_RECT area; // We want the bounding box of the footprint pads at rot 0, not flipped // Create such a image: - MODULE dummy( *this ); + FOOTPRINT dummy( *this ); 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 ); } -const EDA_RECT MODULE::GetBoundingBox( bool aIncludeInvisibleText ) const +const EDA_RECT FOOTPRINT::GetBoundingBox( bool aIncludeInvisibleText ) const { 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 * 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; + double orientation = GetOrientationRadians(); + FOOTPRINT temp = *this; - double orientation = GetOrientationRadians(); - - MODULE temp = *this; temp.SetOrientation( 0.0 ); BOX2I area = temp.GetFootprintRect(); @@ -722,7 +721,7 @@ SHAPE_POLY_SET MODULE::GetBoundingPoly() const } -void MODULE::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector& aList ) +void FOOTPRINT::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector& aList ) { wxString msg, msg2; @@ -790,20 +789,20 @@ void MODULE::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vectorHitTest( 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 ) { @@ -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 ) { @@ -871,7 +870,7 @@ PAD* MODULE::GetPad( const wxPoint& aPosition, LSET aLayerMask ) } -PAD* MODULE::GetTopLeftPad() +PAD* FOOTPRINT::GetTopLeftPad() { 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 ) 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 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 ) return; @@ -955,7 +954,7 @@ void MODULE::Add3DModel( FP_3DMODEL* a3DModel ) // 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; 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 ) 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; 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(); @@ -1051,19 +1050,19 @@ wxString MODULE::GetSelectMenuText( EDA_UNITS aUnits ) const } -BITMAP_DEF MODULE::GetMenuImage() const +BITMAP_DEF FOOTPRINT::GetMenuImage() const { 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& aFunction ) const +void FOOTPRINT::RunOnChildren( const std::function& aFunction ) const { try { @@ -1084,12 +1083,12 @@ void MODULE::RunOnChildren( const std::function& aFunction ) } 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 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; 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 : ( 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(); @@ -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 ); @@ -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 // 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; SetPosition( newpos ); } -void MODULE::Rotate( const wxPoint& aRotCentre, double aAngle ) +void FOOTPRINT::Rotate( const wxPoint& aRotCentre, double aAngle ) { double orientation = GetOrientation(); 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: 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; @@ -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 * 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 @@ -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( dupe->m_Uuid ) = KIID(); 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; 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 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(); @@ -1614,7 +1613,7 @@ static void addRect( SHAPE_POLY_SET& aPolySet, wxRect aRect ) 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(); SHAPE_POLY_SET coveredRegion; @@ -1669,7 +1668,7 @@ double MODULE::CoverageRatio( const GENERAL_COLLECTOR& aCollector ) const } -std::shared_ptr MODULE::GetEffectiveShape( PCB_LAYER_ID aLayer ) const +std::shared_ptr FOOTPRINT::GetEffectiveShape( PCB_LAYER_ID aLayer ) const { std::shared_ptr shape = std::make_shared(); @@ -1693,7 +1692,7 @@ std::shared_ptr MODULE::GetEffectiveShape( PCB_LAYER_ID aLayer ) const } -void MODULE::BuildPolyCourtyards() +void FOOTPRINT::BuildPolyCourtyards() { m_poly_courtyard_front.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 ); - std::swap( *((MODULE*) this), *((MODULE*) aImage) ); + std::swap( *((FOOTPRINT*) this), *((FOOTPRINT*) aImage) ); } -bool MODULE::HasThroughHolePads() const +bool FOOTPRINT::HasThroughHolePads() const { 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() ) 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() ) return StrNumCmp( aFirst->GetName(), aSecond->GetName() ) < 0; @@ -1816,37 +1816,37 @@ static struct MODULE_DESC fpLayers.Add( LSET::Name( B_Cu ), B_Cu ); PROPERTY_MANAGER& propMgr = PROPERTY_MANAGER::Instance(); - REGISTER_TYPE( MODULE ); - propMgr.AddTypeCast( new TYPE_CAST ); - propMgr.AddTypeCast( new TYPE_CAST ); - propMgr.InheritsAfter( TYPE_HASH( MODULE ), TYPE_HASH( BOARD_ITEM ) ); - propMgr.InheritsAfter( TYPE_HASH( MODULE ), TYPE_HASH( BOARD_ITEM_CONTAINER ) ); + REGISTER_TYPE( FOOTPRINT ); + propMgr.AddTypeCast( new TYPE_CAST ); + propMgr.AddTypeCast( new TYPE_CAST ); + propMgr.InheritsAfter( TYPE_HASH( FOOTPRINT ), TYPE_HASH( BOARD_ITEM ) ); + propMgr.InheritsAfter( TYPE_HASH( FOOTPRINT ), TYPE_HASH( BOARD_ITEM_CONTAINER ) ); - auto layer = new PROPERTY_ENUM( _HKI( "Layer" ), - &MODULE::SetLayer, &MODULE::GetLayer ); + auto layer = new PROPERTY_ENUM( _HKI( "Layer" ), + &FOOTPRINT::SetLayer, &FOOTPRINT::GetLayer ); layer->SetChoices( fpLayers ); propMgr.ReplaceProperty( TYPE_HASH( BOARD_ITEM ), _HKI( "Layer" ), layer ); - propMgr.AddProperty( new PROPERTY( _HKI( "Reference" ), - &MODULE::SetReference, &MODULE::GetReference ) ); - propMgr.AddProperty( new PROPERTY( _HKI( "Value" ), - &MODULE::SetValue, &MODULE::GetValue ) ); - propMgr.AddProperty( new PROPERTY( _HKI( "Orientation" ), - &MODULE::SetOrientationDegrees, &MODULE::GetOrientationDegrees, + propMgr.AddProperty( new PROPERTY( _HKI( "Reference" ), + &FOOTPRINT::SetReference, &FOOTPRINT::GetReference ) ); + propMgr.AddProperty( new PROPERTY( _HKI( "Value" ), + &FOOTPRINT::SetValue, &FOOTPRINT::GetValue ) ); + propMgr.AddProperty( new PROPERTY( _HKI( "Orientation" ), + &FOOTPRINT::SetOrientationDegrees, &FOOTPRINT::GetOrientationDegrees, PROPERTY_DISPLAY::DEGREE ) ); - propMgr.AddProperty( new PROPERTY( _HKI( "Local Clearance" ), - &MODULE::SetLocalClearance, &MODULE::GetLocalClearance, + propMgr.AddProperty( new PROPERTY( _HKI( "Local Clearance" ), + &FOOTPRINT::SetLocalClearance, &FOOTPRINT::GetLocalClearance, PROPERTY_DISPLAY::DISTANCE ) ); - propMgr.AddProperty( new PROPERTY( _HKI( "Local Solderpaste Margin" ), - &MODULE::SetLocalSolderPasteMargin, &MODULE::GetLocalSolderPasteMargin, + propMgr.AddProperty( new PROPERTY( _HKI( "Local Solderpaste Margin" ), + &FOOTPRINT::SetLocalSolderPasteMargin, &FOOTPRINT::GetLocalSolderPasteMargin, PROPERTY_DISPLAY::DISTANCE ) ); - propMgr.AddProperty( new PROPERTY( _HKI( "Local Solderpaste Margin Ratio" ), - &MODULE::SetLocalSolderPasteMarginRatio, &MODULE::GetLocalSolderPasteMarginRatio ) ); - propMgr.AddProperty( new PROPERTY( _HKI( "Thermal Width" ), - &MODULE::SetThermalWidth, &MODULE::GetThermalWidth, + propMgr.AddProperty( new PROPERTY( _HKI( "Local Solderpaste Margin Ratio" ), + &FOOTPRINT::SetLocalSolderPasteMarginRatio, &FOOTPRINT::GetLocalSolderPasteMarginRatio ) ); + propMgr.AddProperty( new PROPERTY( _HKI( "Thermal Width" ), + &FOOTPRINT::SetThermalWidth, &FOOTPRINT::GetThermalWidth, PROPERTY_DISPLAY::DISTANCE ) ); - propMgr.AddProperty( new PROPERTY( _HKI( "Thermal Gap" ), - &MODULE::SetThermalGap, &MODULE::GetThermalGap, + propMgr.AddProperty( new PROPERTY( _HKI( "Thermal Gap" ), + &FOOTPRINT::SetThermalGap, &FOOTPRINT::GetThermalGap, PROPERTY_DISPLAY::DISTANCE ) ); // TODO zone connection, FPID? } diff --git a/pcbnew/footprint.h b/pcbnew/footprint.h index e6490143f4..a1f6a32f6d 100644 --- a/pcbnew/footprint.h +++ b/pcbnew/footprint.h @@ -101,23 +101,23 @@ public: DECL_DEQ_FOR_SWIG( PADS, PAD* ) DECL_DEQ_FOR_SWIG( DRAWINGS, BOARD_ITEM* ) DECL_VEC_FOR_SWIG( FP_ZONES, FP_ZONE* ) -DECL_VEC_FOR_SWIG( MODULE_GROUPS, PCB_GROUP* ) -DECL_DEQ_FOR_SWIG( MODULES, MODULE* ) +DECL_VEC_FOR_SWIG( FP_GROUPS, PCB_GROUP* ) +DECL_DEQ_FOR_SWIG( FOOTPRINTS, FOOTPRINT* ) -class MODULE : public BOARD_ITEM_CONTAINER +class FOOTPRINT : public BOARD_ITEM_CONTAINER { 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 - MODULE( MODULE&& aFootprint ); + FOOTPRINT( FOOTPRINT&& aFootprint ); - ~MODULE(); + ~FOOTPRINT(); - MODULE& operator=( const MODULE& aOther ); - MODULE& operator=( MODULE&& aOther ); + FOOTPRINT& operator=( const FOOTPRINT& aOther ); + FOOTPRINT& operator=( FOOTPRINT&& aOther ); static inline bool ClassOf( const EDA_ITEM* aItem ) { @@ -187,8 +187,8 @@ public: FP_ZONES& Zones() { return m_fp_zones; } const FP_ZONES& Zones() const { return m_fp_zones; } - MODULE_GROUPS& Groups() { return m_fp_groups; } - const MODULE_GROUPS& Groups() const { return m_fp_groups; } + FP_GROUPS& Groups() { return m_fp_groups; } + const FP_GROUPS& Groups() const { return m_fp_groups; } bool HasThroughHolePads() const; @@ -694,7 +694,7 @@ private: DRAWINGS m_drawings; // BOARD_ITEMs for drawings on the board, owned by pointer. PADS m_pads; // PAD 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. wxPoint m_pos; // Position of footprint on the board in internal units. diff --git a/pcbnew/footprint_edit_frame.cpp b/pcbnew/footprint_edit_frame.cpp index 91a81350ff..759fb65ea1 100644 --- a/pcbnew/footprint_edit_frame.cpp +++ b/pcbnew/footprint_edit_frame.cpp @@ -374,7 +374,7 @@ LIB_ID FOOTPRINT_EDIT_FRAME::GetTargetFPID() const LIB_ID FOOTPRINT_EDIT_FRAME::GetLoadedFPID() const { - MODULE* footprint = GetBoard()->GetFirstFootprint(); + FOOTPRINT* footprint = GetBoard()->GetFirstFootprint(); if( footprint ) return LIB_ID( footprint->GetFPID().GetLibNickname(), m_footprintNameWhenLoaded ); @@ -394,7 +394,7 @@ void FOOTPRINT_EDIT_FRAME::ClearModify() bool FOOTPRINT_EDIT_FRAME::IsCurrentFPFromBoard() const { - MODULE* footprint = GetBoard()->GetFirstFootprint(); + FOOTPRINT* footprint = GetBoard()->GetFirstFootprint(); return ( footprint && footprint->GetLink() != niluuid ); } @@ -423,7 +423,7 @@ void FOOTPRINT_EDIT_FRAME::restoreLastFootprint() id.SetLibNickname( libNickname ); id.SetLibItemName( footprintName ); - MODULE* footprint = loadFootprint( id ); + FOOTPRINT* footprint = loadFootprint( id ); if( 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(); @@ -542,7 +542,7 @@ MAGNETIC_SETTINGS* FOOTPRINT_EDIT_FRAME::GetMagneticItemsSettings() const BOX2I FOOTPRINT_EDIT_FRAME::GetDocumentExtents( bool aIncludeAllVisible ) const { - MODULE* footprint = GetBoard()->GetFirstFootprint(); + FOOTPRINT* footprint = GetBoard()->GetFirstFootprint(); if( footprint ) { @@ -653,8 +653,8 @@ void FOOTPRINT_EDIT_FRAME::OnUpdateSaveFootprintToBoard( wxUpdateUIEvent& aEvent { PCB_EDIT_FRAME* frame = (PCB_EDIT_FRAME*) Kiway().Player( FRAME_PCB_EDITOR, false ); - MODULE* editorFootprint = GetBoard()->GetFirstFootprint(); - bool canInsert = frame && editorFootprint && editorFootprint->GetLink() == niluuid; + FOOTPRINT* editorFootprint = GetBoard()->GetFirstFootprint(); + bool canInsert = frame && editorFootprint && editorFootprint->GetLink() == niluuid; // If the source was deleted, the footprint can inserted but not updated in the board. if( frame && editorFootprint && editorFootprint->GetLink() != niluuid ) @@ -663,7 +663,7 @@ void FOOTPRINT_EDIT_FRAME::OnUpdateSaveFootprintToBoard( wxUpdateUIEvent& aEvent canInsert = true; // search if the source footprint was not deleted: - for( MODULE* candidate : mainpcb->Footprints() ) + for( FOOTPRINT* candidate : mainpcb->Footprints() ) { if( editorFootprint->GetLink() == candidate->m_Uuid ) { @@ -714,10 +714,10 @@ void FOOTPRINT_EDIT_FRAME::OnModify() void FOOTPRINT_EDIT_FRAME::updateTitle() { - wxString title; - LIB_ID fpid = GetLoadedFPID(); - MODULE* footprint = GetBoard()->GetFirstFootprint(); - bool writable = true; + wxString title; + LIB_ID fpid = GetLoadedFPID(); + FOOTPRINT* footprint = GetBoard()->GetFirstFootprint(); + bool writable = true; if( IsCurrentFPFromBoard() ) { diff --git a/pcbnew/footprint_edit_frame.h b/pcbnew/footprint_edit_frame.h index 20b9c86456..1bbbabd2e4 100644 --- a/pcbnew/footprint_edit_frame.h +++ b/pcbnew/footprint_edit_frame.h @@ -44,7 +44,7 @@ class FOOTPRINT_EDIT_FRAME : public PCB_BASE_EDIT_FRAME wxObjectDataPtr m_adapter; - std::unique_ptr m_revertModule; + std::unique_ptr m_revertModule; wxString m_footprintNameWhenLoaded; int m_defaultLibWidth; @@ -180,10 +180,10 @@ public: * @param aFootprint = the given footprint * @return : true if OK, false if abort */ - bool SaveFootprint( MODULE* aFootprint ); - bool SaveFootprintAs( MODULE* aFootprint ); + bool SaveFootprint( FOOTPRINT* aFootprint ); + bool SaveFootprintAs( FOOTPRINT* aFootprint ); bool SaveFootprintToBoard( bool aAddNew ); - bool SaveFootprintInLibrary( MODULE* aFootprint, const wxString& aLibraryName ); + bool SaveFootprintInLibrary( FOOTPRINT* aFootprint, const wxString& aLibraryName ); bool RevertFootprint(); /** @@ -221,7 +221,7 @@ public: /** * Create a file containing only one footprint. */ - void ExportFootprint( MODULE* aFootprint ); + void ExportFootprint( FOOTPRINT* aFootprint ); /** * Read a file containing only one footprint. @@ -229,7 +229,7 @@ public: * The import function can also read gpcb footprint file, in Newlib format. * (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. @@ -238,14 +238,14 @@ public: * footprint reference. * @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. * * @return the selected footprint or nullptr */ - MODULE* SelectFootprintFromBoard( BOARD* aPcb ); + FOOTPRINT* SelectFootprintFromBoard( BOARD* aPcb ); /** * 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, * 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. @@ -347,7 +347,7 @@ protected: /** * Run the Footprint Properties dialog and handle changes made in it. */ - void editFootprintProperties( MODULE* aFootprint ); + void editFootprintProperties( FOOTPRINT* aFootprint ); void setupUIConditions() override; }; diff --git a/pcbnew/footprint_editor_utils.cpp b/pcbnew/footprint_editor_utils.cpp index ed35aaa66a..d8ad1de04a 100644 --- a/pcbnew/footprint_editor_utils.cpp +++ b/pcbnew/footprint_editor_utils.cpp @@ -50,7 +50,7 @@ void FOOTPRINT_EDIT_FRAME::LoadFootprintFromLibrary( LIB_ID aFPID) { bool is_last_fp_from_brd = IsCurrentFPFromBoard(); - MODULE* footprint = LoadFootprint( aFPID ); + FOOTPRINT* footprint = LoadFootprint( aFPID ); if( !footprint ) return; @@ -122,7 +122,7 @@ void FOOTPRINT_EDIT_FRAME::SaveFootprintToBoard( wxCommandEvent& event ) class BASIC_FOOTPRINT_INFO : public FOOTPRINT_INFO { public: - BASIC_FOOTPRINT_INFO( MODULE* aFootprint ) + BASIC_FOOTPRINT_INFO( FOOTPRINT* aFootprint ) { m_nickname = aFootprint->GetFPID().GetLibNickname().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(); @@ -164,11 +164,11 @@ void FOOTPRINT_EDIT_FRAME::OnEditItemRequest( BOARD_ITEM* aItem ) switch( aItem->Type() ) { case PCB_PAD_T: - ShowPadPropertiesDialog( static_cast( aItem )); + ShowPadPropertiesDialog( static_cast( aItem ) ); break; case PCB_FOOTPRINT_T: - editFootprintProperties( (MODULE*) aItem ); + editFootprintProperties( static_cast( aItem ) ); GetCanvas()->Refresh(); break; diff --git a/pcbnew/footprint_info_impl.cpp b/pcbnew/footprint_info_impl.cpp index 459158ae25..b8f4bc3510 100644 --- a/pcbnew/footprint_info_impl.cpp +++ b/pcbnew/footprint_info_impl.cpp @@ -46,7 +46,7 @@ void FOOTPRINT_INFO_IMPL::load() 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 { diff --git a/pcbnew/footprint_libraries_utils.cpp b/pcbnew/footprint_libraries_utils.cpp index fccb264a05..c4a41d6d8e 100644 --- a/pcbnew/footprint_libraries_utils.cpp +++ b/pcbnew/footprint_libraries_utils.cpp @@ -148,9 +148,9 @@ static IO_MGR::PCB_FILE_T detect_file_type( FILE* aFile, const wxFileName& aFile * @param aFileType - type of the file * @param aName - name of the footprint */ -static MODULE* parse_module_with_plugin( const wxFileName& aFileName, - IO_MGR::PCB_FILE_T aFileType, - const wxString& aName ) +static FOOTPRINT* parse_module_with_plugin( const wxFileName& aFileName, + IO_MGR::PCB_FILE_T aFileType, + const wxString& aName ) { wxString path; @@ -176,7 +176,7 @@ static MODULE* parse_module_with_plugin( const wxFileName& aFileName, * Parse a KICAD footprint. * @param aFileName - file name to parse */ -static MODULE* parse_module_kicad( const wxFileName& aFileName ) +static FOOTPRINT* parse_module_kicad( const wxFileName& aFileName ) { wxString fcontents; PCB_IO pcb_io; @@ -187,7 +187,7 @@ static MODULE* parse_module_kicad( const wxFileName& aFileName ) f.ReadAll( &fcontents ); - return dynamic_cast( pcb_io.Parse( fcontents ) ); + return dynamic_cast( 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 aName - footprint name */ -MODULE* try_load_footprint( const wxFileName& aFileName, IO_MGR::PCB_FILE_T aFileType, - const wxString& aName ) +FOOTPRINT* try_load_footprint( const wxFileName& aFileName, IO_MGR::PCB_FILE_T aFileType, + const wxString& aName ) { - MODULE* footprint; + FOOTPRINT* footprint; 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; FOOTPRINT_EDITOR_SETTINGS* cfg = GetSettings(); @@ -260,7 +260,7 @@ MODULE* FOOTPRINT_EDIT_FRAME::ImportFootprint( const wxString& aName ) return NULL; } - MODULE* footprint = NULL; + FOOTPRINT* footprint = NULL; 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; FOOTPRINT_EDITOR_SETTINGS* cfg = GetSettings(); @@ -621,7 +621,7 @@ void PCB_EDIT_FRAME::ExportFootprintsToLibrary( bool aStoreInNewLib, const wxStr wxString footprintName; auto resetReference = - []( MODULE* aFootprint ) + []( FOOTPRINT* aFootprint ) { aFootprint->SetReference( "REF**" ); }; @@ -638,7 +638,7 @@ void PCB_EDIT_FRAME::ExportFootprintsToLibrary( bool aStoreInNewLib, const wxStr prj.SetRString( PROJECT::PCB_LIB_NICKNAME, nickname ); - for( MODULE* footprint : GetBoard()->Footprints() ) + for( FOOTPRINT* footprint : GetBoard()->Footprints() ) { try { @@ -646,7 +646,7 @@ void PCB_EDIT_FRAME::ExportFootprintsToLibrary( bool aStoreInNewLib, const wxStr if( !footprint->GetFPID().GetLibItemName().empty() ) // Handle old boards. { - MODULE* fpCopy = static_cast( footprint->Duplicate() ); + FOOTPRINT* fpCopy = static_cast( footprint->Duplicate() ); resetReference( fpCopy ); 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; PLUGIN::RELEASER pi( IO_MGR::PluginFind( piType ) ); - for( MODULE* footprint : GetBoard()->Footprints() ) + for( FOOTPRINT* footprint : GetBoard()->Footprints() ) { try { if( !footprint->GetFPID().GetLibItemName().empty() ) // Handle old boards. { - MODULE* fpCopy = static_cast( footprint->Duplicate() ); + FOOTPRINT* fpCopy = static_cast( footprint->Duplicate() ); resetReference( 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 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 ) { try @@ -794,9 +794,9 @@ bool FOOTPRINT_EDIT_FRAME::SaveFootprintToBoard( bool aAddNew ) return false; } - BOARD* mainpcb = pcbframe->GetBoard(); - MODULE* sourceFootprint = NULL; - MODULE* editorFootprint = GetBoard()->GetFirstFootprint(); + BOARD* mainpcb = pcbframe->GetBoard(); + FOOTPRINT* sourceFootprint = NULL; + FOOTPRINT* editorFootprint = GetBoard()->GetFirstFootprint(); // Search the old footprint (source) if exists // Because this source could be deleted when editing the main board... @@ -804,7 +804,7 @@ bool FOOTPRINT_EDIT_FRAME::SaveFootprintToBoard( bool aAddNew ) { sourceFootprint = nullptr; - for( MODULE* candidate : mainpcb->Footprints() ) + for( FOOTPRINT* candidate : mainpcb->Footprints() ) { if( editorFootprint->GetLink() == candidate->m_Uuid ) { @@ -825,7 +825,7 @@ bool FOOTPRINT_EDIT_FRAME::SaveFootprintToBoard( bool aAddNew ) BOARD_COMMIT commit( pcbframe ); // Create the "new" footprint - MODULE* newFootprint = new MODULE( *editorFootprint ); + FOOTPRINT* newFootprint = new FOOTPRINT( *editorFootprint ); const_cast( newFootprint->m_Uuid ) = KIID(); 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 ) return false; @@ -906,7 +906,7 @@ bool FOOTPRINT_EDIT_FRAME::SaveFootprintAs( MODULE* aFootprint ) bNameSizer->Add( nameTextCtrl, 1, wxALIGN_CENTER_VERTICAL|wxALL, 5 ); wxTextValidator nameValidator( wxFILTER_EXCLUDE_CHAR_LIST ); - nameValidator.SetCharExcludes( MODULE::StringLibNameInvalidChars( false ) ); + nameValidator.SetCharExcludes( FOOTPRINT::StringLibNameInvalidChars( false ) ); nameTextCtrl->SetValidator( nameValidator ); wxSizer* mainSizer = dlg.GetSizer(); @@ -1000,7 +1000,7 @@ bool FOOTPRINT_EDIT_FRAME::RevertFootprint() if( ConfirmRevertDialog( this, msg ) ) { Clear_Pcb( false ); - AddFootprintToBoard( (MODULE*) m_revertModule->Clone()); + AddFootprintToBoard( (FOOTPRINT*) m_revertModule->Clone()); 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; @@ -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 - MODULE* footprint = new MODULE( GetBoard() ); + FOOTPRINT* footprint = new FOOTPRINT( GetBoard() ); // Update parameters: timestamp ... footprint->SetLastEditTime(); diff --git a/pcbnew/footprint_preview_panel.cpp b/pcbnew/footprint_preview_panel.cpp index 3d4b90f723..324dd3de88 100644 --- a/pcbnew/footprint_preview_panel.cpp +++ b/pcbnew/footprint_preview_panel.cpp @@ -327,7 +327,7 @@ void FOOTPRINT_PREVIEW_PANEL::CacheFootprint( const LIB_ID& aFPID ) } -void FOOTPRINT_PREVIEW_PANEL::renderFootprint( std::shared_ptr aFootprint ) +void FOOTPRINT_PREVIEW_PANEL::renderFootprint( std::shared_ptr aFootprint ) { if( m_currentFootprint ) { diff --git a/pcbnew/footprint_preview_panel.h b/pcbnew/footprint_preview_panel.h index e83f091c57..4952c9e40f 100644 --- a/pcbnew/footprint_preview_panel.h +++ b/pcbnew/footprint_preview_panel.h @@ -37,7 +37,7 @@ #include -class MODULE; +class FOOTPRINT; class KIWAY; class IO_MGR; class BOARD; @@ -76,9 +76,9 @@ public: private: struct CACHE_ENTRY { - LIB_ID fpid; - std::shared_ptr footprint; - FOOTPRINT_STATUS status; + LIB_ID fpid; + std::shared_ptr footprint; + FOOTPRINT_STATUS status; }; /** @@ -98,7 +98,7 @@ private: void OnLoaderThreadUpdate( wxCommandEvent& aEvent ); - void renderFootprint( std::shared_ptr aFootprint ); + void renderFootprint( std::shared_ptr aFootprint ); private: FP_LOADER_THREAD* m_loader; @@ -108,9 +108,9 @@ private: std::unique_ptr m_dummyBoard; std::unique_ptr m_displayOptions; - std::shared_ptr m_currentFootprint; - LIB_ID m_currentFPID; - bool m_footprintDisplayed; + std::shared_ptr m_currentFootprint; + LIB_ID m_currentFPID; + bool m_footprintDisplayed; }; #endif diff --git a/pcbnew/footprint_viewer_frame.cpp b/pcbnew/footprint_viewer_frame.cpp index 8ea0ccee01..8ef59009d1 100644 --- a/pcbnew/footprint_viewer_frame.cpp +++ b/pcbnew/footprint_viewer_frame.cpp @@ -663,7 +663,7 @@ void FOOTPRINT_VIEWER_FRAME::ClickOnFootprintList( wxCommandEvent& aEvent ) // Delete the current footprint (MUST reset tools first) GetToolManager()->ResetTools( TOOL_BASE::MODEL_RELOAD ); - GetBoard()->DeleteAllModules(); + GetBoard()->DeleteAllFootprints(); LIB_ID id; id.SetLibNickname( getCurNickname() ); @@ -733,7 +733,7 @@ void FOOTPRINT_VIEWER_FRAME::AddFootprintToPCB( wxCommandEvent& aEvent ) BOARD_COMMIT commit( pcbframe ); // Create the "new" footprint - MODULE* newFootprint = (MODULE*) GetBoard()->GetFirstFootprint()->Duplicate(); + FOOTPRINT* newFootprint = (FOOTPRINT*) GetBoard()->GetFirstFootprint()->Duplicate(); newFootprint->SetParent( pcbframe->GetBoard() ); newFootprint->SetLink( 0 ); @@ -1027,10 +1027,10 @@ void FOOTPRINT_VIEWER_FRAME::SelectAndViewFootprint( int aMode ) setCurFootprintName( m_fpList->GetString((unsigned) selection ) ); // Delete the current footprint - GetBoard()->DeleteAllModules(); + GetBoard()->DeleteAllFootprints(); - MODULE* footprint = Prj().PcbFootprintLibs()->FootprintLoad( getCurNickname(), - getCurFootprintName() ); + FOOTPRINT* footprint = Prj().PcbFootprintLibs()->FootprintLoad( getCurNickname(), + getCurFootprintName() ); if( footprint ) GetBoard()->Add( footprint, ADD_MODE::APPEND ); diff --git a/pcbnew/footprint_wizard.h b/pcbnew/footprint_wizard.h index 0d04094ee7..f5a5cada44 100644 --- a/pcbnew/footprint_wizard.h +++ b/pcbnew/footprint_wizard.h @@ -151,7 +151,7 @@ public: * @param aMessage a wxString to store messages (if any) generated by the * footprint generator */ - virtual MODULE* GetFootprint( wxString* aMessage ) = 0; + virtual FOOTPRINT* GetFootprint( wxString* aMessage ) = 0; /** * Function GetObject diff --git a/pcbnew/footprint_wizard_frame.h b/pcbnew/footprint_wizard_frame.h index 9c96d344ee..198206d1b7 100644 --- a/pcbnew/footprint_wizard_frame.h +++ b/pcbnew/footprint_wizard_frame.h @@ -80,7 +80,7 @@ public: ///> @copydoc PCB_BASE_FRAME::GetModel() BOARD_ITEM_CONTAINER* GetModel() const override; - MODULE* GetBuiltFootprint(); + FOOTPRINT* GetBuiltFootprint(); /** * Reload the Python plugins if they are newer than diff --git a/pcbnew/footprint_wizard_frame_functions.cpp b/pcbnew/footprint_wizard_frame_functions.cpp index ce16fd31a7..a56cd7ed93 100644 --- a/pcbnew/footprint_wizard_frame_functions.cpp +++ b/pcbnew/footprint_wizard_frame_functions.cpp @@ -99,11 +99,11 @@ void FOOTPRINT_WIZARD_FRAME::ReloadFootprint() m_toolManager->ResetTools( TOOL_BASE::MODEL_RELOAD ); // Delete the current footprint - GetBoard()->DeleteAllModules(); + GetBoard()->DeleteAllFootprints(); // Creates the footprint - wxString msg; - MODULE* footprint = footprintWizard->GetFootprint( &msg ); + wxString msg; + FOOTPRINT* footprint = footprintWizard->GetFootprint( &msg ); DisplayBuildMessage( msg ); 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 ); if( footprintWizard && m_modal_ret_val ) { - wxString msg; - MODULE * footprint = footprintWizard->GetFootprint( &msg ); + wxString msg; + FOOTPRINT* footprint = footprintWizard->GetFootprint( &msg ); DisplayBuildMessage( msg ); return footprint; diff --git a/pcbnew/fp_shape.cpp b/pcbnew/fp_shape.cpp index bce8d302fb..e7dbd3b936 100644 --- a/pcbnew/fp_shape.cpp +++ b/pcbnew/fp_shape.cpp @@ -35,7 +35,7 @@ #include -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 ) { m_Shape = aShape; @@ -51,7 +51,7 @@ FP_SHAPE::~FP_SHAPE() void FP_SHAPE::SetLocalCoord() { - MODULE* fp = (MODULE*) m_Parent; + FOOTPRINT* fp = (FOOTPRINT*) m_Parent; if( fp == NULL ) { @@ -79,7 +79,7 @@ void FP_SHAPE::SetLocalCoord() void FP_SHAPE::SetDrawCoord() { - MODULE* fp = (MODULE*) m_Parent; + FOOTPRINT* fp = (FOOTPRINT*) m_Parent; m_Start = m_Start0; m_End = m_End0; @@ -109,9 +109,8 @@ void FP_SHAPE::SetDrawCoord() // see class_edge_mod.h void FP_SHAPE::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector& aList ) { - wxString msg; - - MODULE* fp = (MODULE*) m_Parent; + wxString msg; + FOOTPRINT* fp = (FOOTPRINT*) m_Parent; if( !fp ) return; diff --git a/pcbnew/fp_shape.h b/pcbnew/fp_shape.h index 6a0bacb88a..2304422390 100644 --- a/pcbnew/fp_shape.h +++ b/pcbnew/fp_shape.h @@ -39,7 +39,7 @@ class MSG_PANEL_ITEM; class FP_SHAPE : public PCB_SHAPE { 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=. // The ones generated by the compiler are adequate. diff --git a/pcbnew/fp_text.cpp b/pcbnew/fp_text.cpp index 8625250383..fac0fe5e48 100644 --- a/pcbnew/fp_text.cpp +++ b/pcbnew/fp_text.cpp @@ -31,11 +31,11 @@ #include #include -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 ), EDA_TEXT() { - MODULE* parentFootprint = static_cast( m_Parent ); + FOOTPRINT* parentFootprint = static_cast( m_Parent ); m_Type = text_type; m_keepUpright = true; @@ -197,7 +197,7 @@ int FP_TEXT::GetLength() const void FP_TEXT::SetDrawCoord() { - const MODULE* parentFootprint = static_cast( m_Parent ); + const FOOTPRINT* parentFootprint = static_cast( m_Parent ); SetTextPos( m_Pos0 ); @@ -216,7 +216,7 @@ void FP_TEXT::SetDrawCoord() void FP_TEXT::SetLocalCoord() { - const MODULE* parentFootprint = static_cast( m_Parent ); + const FOOTPRINT* parentFootprint = static_cast( m_Parent ); if( parentFootprint ) { @@ -246,8 +246,8 @@ const EDA_RECT FP_TEXT::GetBoundingBox() const double FP_TEXT::GetDrawRotation() const { - MODULE* parentFootprint = (MODULE*) m_Parent; - double rotation = GetTextAngle(); + FOOTPRINT* parentFootprint = static_cast( m_Parent ); + double rotation = GetTextAngle(); if( parentFootprint ) rotation += parentFootprint->GetOrientation(); @@ -273,7 +273,7 @@ double FP_TEXT::GetDrawRotation() const // see class_text_mod.h void FP_TEXT::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector& aList ) { - MODULE* parentFootprint = (MODULE*) m_Parent; + FOOTPRINT* parentFootprint = static_cast( m_Parent ); if( parentFootprint == NULL ) // Happens in modedit, and for new texts return; @@ -331,17 +331,17 @@ wxString FP_TEXT::GetSelectMenuText( EDA_UNITS aUnits ) const { case TEXT_is_REFERENCE: return wxString::Format( _( "Reference '%s'" ), - static_cast( GetParent() )->GetReference() ); + static_cast( GetParent() )->GetReference() ); case TEXT_is_VALUE: return wxString::Format( _( "Value '%s' of %s" ), GetShownText(), - static_cast( GetParent() )->GetReference() ); + static_cast( GetParent() )->GetReference() ); default: return wxString::Format( _( "Footprint Text '%s' of %s" ), ShortenedShownText(), - static_cast( GetParent() )->GetReference() ); + static_cast( GetParent() )->GetReference() ); } } @@ -421,7 +421,7 @@ double FP_TEXT::ViewGetLOD( int aLayer, KIGFX::VIEW* aView ) const wxString FP_TEXT::GetShownText( int aDepth ) const { - const MODULE* parentFootprint = static_cast( GetParent() ); + const FOOTPRINT* parentFootprint = static_cast( GetParent() ); wxASSERT( parentFootprint ); const BOARD* board = parentFootprint->GetBoard(); diff --git a/pcbnew/fp_text.h b/pcbnew/fp_text.h index 0b3cda16a3..1e692e5ee4 100644 --- a/pcbnew/fp_text.h +++ b/pcbnew/fp_text.h @@ -30,7 +30,7 @@ class LINE_READER; class EDA_RECT; -class MODULE; +class FOOTPRINT; class MSG_PANEL_ITEM; class PCB_BASE_FRAME; class SHAPE; @@ -52,7 +52,7 @@ public: 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=. // The ones generated by the compiler are adequate. diff --git a/pcbnew/generate_footprint_info.cpp b/pcbnew/generate_footprint_info.cpp index b0a6ca5c95..2486a4d9bc 100644 --- a/pcbnew/generate_footprint_info.cpp +++ b/pcbnew/generate_footprint_info.cpp @@ -49,7 +49,7 @@ class FOOTPRINT_INFO_GENERATOR wxString m_html; FP_LIB_TABLE* m_fp_lib_table; LIB_ID const m_lib_id; - MODULE* m_footprint; + FOOTPRINT* m_footprint; public: FOOTPRINT_INFO_GENERATOR( FP_LIB_TABLE* aFpLibTable, LIB_ID const& aLibId ) diff --git a/pcbnew/graphics_cleaner.cpp b/pcbnew/graphics_cleaner.cpp index 79734266e6..ac0487f610 100644 --- a/pcbnew/graphics_cleaner.cpp +++ b/pcbnew/graphics_cleaner.cpp @@ -31,10 +31,10 @@ #include -GRAPHICS_CLEANER::GRAPHICS_CLEANER( DRAWINGS& aDrawings, MODULE* aParentModule, +GRAPHICS_CLEANER::GRAPHICS_CLEANER( DRAWINGS& aDrawings, FOOTPRINT* aParentFootprint, BOARD_COMMIT& aCommit ) : m_drawings( aDrawings ), - m_parentModule( aParentModule ), + m_parentFootprint( aParentFootprint ), m_commit( aCommit ), m_dryRun( true ), m_itemsList( nullptr ) @@ -42,7 +42,8 @@ GRAPHICS_CLEANER::GRAPHICS_CLEANER( DRAWINGS& aDrawings, MODULE* aParentModule, } -void GRAPHICS_CLEANER::CleanupBoard( bool aDryRun, std::vector >* aItemsList, +void GRAPHICS_CLEANER::CleanupBoard( bool aDryRun, + std::vector>* aItemsList, bool aMergeRects, bool aDeleteRedundant ) { m_dryRun = aDryRun; @@ -300,8 +301,8 @@ void GRAPHICS_CLEANER::mergeRects() { PCB_SHAPE* rect; - if( m_parentModule ) - rect = new FP_SHAPE( m_parentModule ); + if( m_parentFootprint ) + rect = new FP_SHAPE( m_parentFootprint ); else rect = new PCB_SHAPE(); diff --git a/pcbnew/graphics_cleaner.h b/pcbnew/graphics_cleaner.h index 7630d77356..00fe39f6dc 100644 --- a/pcbnew/graphics_cleaner.h +++ b/pcbnew/graphics_cleaner.h @@ -26,7 +26,7 @@ #include -class MODULE; +class FOOTPRINT; class BOARD_COMMIT; class CLEANUP_ITEM; @@ -35,15 +35,15 @@ class CLEANUP_ITEM; class GRAPHICS_CLEANER { public: - GRAPHICS_CLEANER( DRAWINGS& aDrawings, MODULE* aParentModule, BOARD_COMMIT& aCommit ); + GRAPHICS_CLEANER( DRAWINGS& aDrawings, FOOTPRINT* aParentFootprint, BOARD_COMMIT& aCommit ); /** * the cleanup function. * @param aMergeRects = merge for segments forming a rectangle into a rect * @param aDeleteRedundant = true to delete null graphics and duplicated graphics */ - void CleanupBoard( bool aDryRun, std::vector >* aItemsList, bool aMergeRects, - bool aDeleteRedundant ); + void CleanupBoard( bool aDryRun, std::vector >* aItemsList, + bool aMergeRects, bool aDeleteRedundant ); private: bool isNullSegment( PCB_SHAPE* aShape ); @@ -54,7 +54,7 @@ private: private: DRAWINGS& m_drawings; - MODULE* m_parentModule; // nullptr if not in ModEdit + FOOTPRINT* m_parentFootprint; // nullptr if not in Footprint Editor BOARD_COMMIT& m_commit; bool m_dryRun; std::vector >* m_itemsList; diff --git a/pcbnew/import_gfx/graphics_importer_pcbnew.h b/pcbnew/import_gfx/graphics_importer_pcbnew.h index ccc17aa9d2..08a47dd90d 100644 --- a/pcbnew/import_gfx/graphics_importer_pcbnew.h +++ b/pcbnew/import_gfx/graphics_importer_pcbnew.h @@ -32,7 +32,7 @@ class BOARD_ITEM; class BOARD; -class MODULE; +class FOOTPRINT; class PCB_SHAPE; class EDA_TEXT; @@ -119,7 +119,7 @@ protected: class GRAPHICS_IMPORTER_FOOTPRINT : public GRAPHICS_IMPORTER_PCBNEW { public: - GRAPHICS_IMPORTER_FOOTPRINT( MODULE* aFootprint ) + GRAPHICS_IMPORTER_FOOTPRINT( FOOTPRINT* aFootprint ) : m_footprint( aFootprint ) { } @@ -128,7 +128,7 @@ protected: std::unique_ptr createDrawing() override; std::pair, EDA_TEXT*> createText() override; - MODULE* m_footprint; + FOOTPRINT* m_footprint; }; #endif /* GRAPHICS_IMPORTER_PCBNEW */ diff --git a/pcbnew/invoke_pcb_dialog.h b/pcbnew/invoke_pcb_dialog.h index 45f6e17301..c0c7f40036 100644 --- a/pcbnew/invoke_pcb_dialog.h +++ b/pcbnew/invoke_pcb_dialog.h @@ -49,7 +49,7 @@ class wxSize; class wxString; class BOARD; -class MODULE; +class FOOTPRINT; // Often this is not used in the prototypes, since wxFrame is good enough and would // represent maximum information hiding. diff --git a/pcbnew/io_mgr.h b/pcbnew/io_mgr.h index 6ac684f1b8..84c24bfc9a 100644 --- a/pcbnew/io_mgr.h +++ b/pcbnew/io_mgr.h @@ -34,7 +34,7 @@ class BOARD; class PLUGIN; -class MODULE; +class FOOTPRINT; class PROPERTIES; @@ -408,17 +408,17 @@ public: * @throw IO_ERROR if the library cannot be found or read. No exception * is thrown in the case where aFootprintName cannot be found. */ - virtual MODULE* FootprintLoad( const wxString& aLibraryPath, const wxString& aFootprintName, - const PROPERTIES* aProperties = NULL ); + virtual FOOTPRINT* FootprintLoad( const wxString& aLibraryPath, const wxString& aFootprintName, + const PROPERTIES* aProperties = NULL ); /** * Function GetEnumeratedFootprint * a version of FootprintLoad() for use after FootprintEnumerate() for more efficient * cache management. */ - virtual const MODULE* GetEnumeratedFootprint( const wxString& aLibraryPath, - const wxString& aFootprintName, - const PROPERTIES* aProperties = NULL ); + virtual const FOOTPRINT* GetEnumeratedFootprint( const wxString& aLibraryPath, + const wxString& aFootprintName, + const PROPERTIES* aProperties = NULL ); /** * Function FootprintExists @@ -446,8 +446,8 @@ public: * * @throw IO_ERROR if there is a problem saving. */ - virtual void FootprintSave( const wxString& aLibraryPath, const MODULE* aFootprint, - const PROPERTIES* aProperties = NULL ); + virtual void FootprintSave( const wxString& aLibraryPath, const FOOTPRINT* aFootprint, + const PROPERTIES* aProperties = NULL ); /** * Function FootprintDelete diff --git a/pcbnew/kicad_clipboard.cpp b/pcbnew/kicad_clipboard.cpp index 1abc6fae95..6583264b91 100644 --- a/pcbnew/kicad_clipboard.cpp +++ b/pcbnew/kicad_clipboard.cpp @@ -81,9 +81,9 @@ void CLIPBOARD_IO::SaveSelection( const PCBNEW_SELECTION& aSelected, bool isModE if( aSelected.Size() == 1 && aSelected.Front()->Type() == PCB_FOOTPRINT_T ) { // make the footprint safe to transfer to other pcbs - const MODULE* footprint = static_cast( aSelected.Front() ); + const FOOTPRINT* footprint = static_cast( aSelected.Front() ); // Do not modify existing board - MODULE newFootprint( *footprint ); + FOOTPRINT newFootprint( *footprint ); for( PAD* pad : newFootprint.Pads() ) pad->SetNetCode( 0 ); @@ -98,7 +98,7 @@ void CLIPBOARD_IO::SaveSelection( const PCBNEW_SELECTION& aSelected, bool isModE } else if( isModEdit ) { - MODULE partialFootprint( m_board ); + FOOTPRINT partialFootprint( m_board ); for( const EDA_ITEM* item : aSelected ) { @@ -136,8 +136,8 @@ void CLIPBOARD_IO::SaveSelection( const PCBNEW_SELECTION& aSelected, bool isModE } // Set the new relative internal local coordinates of copied items - MODULE* editedFootprint = m_board->Footprints().front(); - wxPoint moveVector = partialFootprint.GetPosition() + editedFootprint->GetPosition(); + FOOTPRINT* editedFootprint = m_board->Footprints().front(); + wxPoint moveVector = partialFootprint.GetPosition() + editedFootprint->GetPosition(); partialFootprint.MoveAnchorPosition( moveVector ); @@ -173,9 +173,9 @@ void CLIPBOARD_IO::SaveSelection( const PCBNEW_SELECTION& aSelected, bool isModE else if( item->Type() == PCB_FP_TEXT_T ) { // Convert to PCB_TEXT_T - MODULE* footprint = static_cast( item->GetParent() ); - FP_TEXT* fp_text = static_cast( item ); - PCB_TEXT* pcb_text = new PCB_TEXT( m_board ); + FOOTPRINT* footprint = static_cast( item->GetParent() ); + FP_TEXT* fp_text = static_cast( item ); + PCB_TEXT* pcb_text = new PCB_TEXT( m_board ); if( fp_text->GetText() == "${VALUE}" ) pcb_text->SetText( footprint->GetValue() ); @@ -191,8 +191,8 @@ void CLIPBOARD_IO::SaveSelection( const PCBNEW_SELECTION& aSelected, bool isModE else if( item->Type() == PCB_PAD_T ) { // Create a parent to own the copied pad - MODULE* footprint = new MODULE( m_board ); - PAD* pad = (PAD*) item->Clone(); + FOOTPRINT* footprint = new FOOTPRINT( m_board ); + PAD* pad = (PAD*) item->Clone(); footprint->SetPosition( pad->GetPosition() ); pad->SetPos0( wxPoint() ); diff --git a/pcbnew/kicad_clipboard.h b/pcbnew/kicad_clipboard.h index 90bc37978e..76940188d7 100644 --- a/pcbnew/kicad_clipboard.h +++ b/pcbnew/kicad_clipboard.h @@ -42,7 +42,7 @@ class CLIPBOARD_PARSER : public PCB_PARSER public: CLIPBOARD_PARSER( LINE_READER* aReader = NULL ): PCB_PARSER( aReader ) {}; - MODULE* parseMODULE( wxArrayString* aInitialComments ) + FOOTPRINT* parseMODULE( wxArrayString* aInitialComments ) { return PCB_PARSER::parseMODULE( aInitialComments ); } diff --git a/pcbnew/load_select_footprint.cpp b/pcbnew/load_select_footprint.cpp index 165295a532..80f9bcb636 100644 --- a/pcbnew/load_select_footprint.cpp +++ b/pcbnew/load_select_footprint.cpp @@ -77,11 +77,11 @@ static void AddFootprintToHistory( const wxString& aName ) #include -bool FOOTPRINT_EDIT_FRAME::LoadFootprintFromBoard( MODULE* aFootprint ) +bool FOOTPRINT_EDIT_FRAME::LoadFootprintFromBoard( FOOTPRINT* aFootprint ) { bool is_last_fp_from_brd = IsCurrentFPFromBoard(); - MODULE* newFootprint = nullptr; + FOOTPRINT* newFootprint = nullptr; PCB_EDIT_FRAME* frame = (PCB_EDIT_FRAME*) Kiway().Player( FRAME_PCB_EDITOR, false ); if( frame == NULL ) // happens if no board editor opened @@ -101,7 +101,7 @@ bool FOOTPRINT_EDIT_FRAME::LoadFootprintFromBoard( MODULE* aFootprint ) if( !Clear_Pcb( true ) ) return false; - newFootprint = (MODULE*) aFootprint->Duplicate(); + newFootprint = (FOOTPRINT*) aFootprint->Duplicate(); newFootprint->SetParent( GetBoard() ); newFootprint->SetLink( aFootprint->m_Uuid ); @@ -191,12 +191,12 @@ wxString PCB_BASE_FRAME::SelectFootprintFromLibBrowser() } -MODULE* PCB_BASE_FRAME::SelectFootprintFromLibTree( LIB_ID aPreselect ) +FOOTPRINT* PCB_BASE_FRAME::SelectFootprintFromLibTree( LIB_ID aPreselect ) { FP_LIB_TABLE* fpTable = Prj().PcbFootprintLibs(); wxString footprintName; LIB_ID fpid; - MODULE* footprint = nullptr; + FOOTPRINT* footprint = nullptr; static wxString lastComponentName; @@ -283,9 +283,9 @@ MODULE* PCB_BASE_FRAME::SelectFootprintFromLibTree( LIB_ID aPreselect ) } -MODULE* PCB_BASE_FRAME::LoadFootprint( const LIB_ID& aFootprintId ) +FOOTPRINT* PCB_BASE_FRAME::LoadFootprint( const LIB_ID& aFootprintId ) { - MODULE* footprint = NULL; + FOOTPRINT* footprint = NULL; try { @@ -299,13 +299,13 @@ MODULE* PCB_BASE_FRAME::LoadFootprint( const LIB_ID& aFootprintId ) } -MODULE* PCB_BASE_FRAME::loadFootprint( const LIB_ID& aFootprintId ) +FOOTPRINT* PCB_BASE_FRAME::loadFootprint( const LIB_ID& aFootprintId ) { FP_LIB_TABLE* fptbl = Prj().PcbFootprintLibs(); wxCHECK_MSG( fptbl, NULL, wxT( "Cannot look up LIB_ID in NULL FP_LIB_TABLE." ) ); - MODULE *footprint = nullptr; + FOOTPRINT *footprint = nullptr; try { footprint = fptbl->FootprintLoadWithOptionalNickname( aFootprintId ); @@ -323,7 +323,7 @@ MODULE* PCB_BASE_FRAME::loadFootprint( const LIB_ID& aFootprintId ) } -MODULE* FOOTPRINT_EDIT_FRAME::SelectFootprintFromBoard( BOARD* aPcb ) +FOOTPRINT* FOOTPRINT_EDIT_FRAME::SelectFootprintFromBoard( BOARD* aPcb ) { static wxString oldName; // Save name of last footprint selected. @@ -331,7 +331,7 @@ MODULE* FOOTPRINT_EDIT_FRAME::SelectFootprintFromBoard( BOARD* aPcb ) wxString msg; wxArrayString listnames; - for( MODULE* footprint : aPcb->Footprints() ) + for( FOOTPRINT* footprint : aPcb->Footprints() ) listnames.Add( footprint->GetReference() ); msg.Printf( _( "Footprints [%u items]" ), (unsigned) listnames.GetCount() ); @@ -395,7 +395,7 @@ bool FOOTPRINT_EDIT_FRAME::SaveLibraryAs( const wxString& aLibraryPath ) for( unsigned i = 0; i < footprints.size(); ++i ) { - const MODULE* footprint = cur->GetEnumeratedFootprint( curLibPath, footprints[i] ); + const FOOTPRINT* footprint = cur->GetEnumeratedFootprint( curLibPath, footprints[i] ); dst->FootprintSave( dstLibPath, footprint ); msg = wxString::Format( _( "Footprint \"%s\" saved" ), footprints[i] ); @@ -419,13 +419,13 @@ bool FOOTPRINT_EDIT_FRAME::SaveLibraryAs( const wxString& aLibraryPath ) } -static MODULE* s_FootprintInitialCopy = NULL; // Copy of footprint for abort/undo command +static FOOTPRINT* s_FootprintInitialCopy = NULL; // Copy of footprint for abort/undo command static PICKED_ITEMS_LIST s_PickedList; // A pick-list to save initial footprint // and dragged tracks -MODULE* PCB_BASE_FRAME::GetFootprintFromBoardByReference() +FOOTPRINT* PCB_BASE_FRAME::GetFootprintFromBoardByReference() { wxString footprintName; wxArrayString fplist; @@ -458,7 +458,7 @@ MODULE* PCB_BASE_FRAME::GetFootprintFromBoardByReference() } -void PCB_BASE_FRAME::PlaceFootprint( MODULE* aFootprint, bool aRecreateRatsnest ) +void PCB_BASE_FRAME::PlaceFootprint( FOOTPRINT* aFootprint, bool aRecreateRatsnest ) { if( aFootprint == 0 ) return; diff --git a/pcbnew/microwave/microwave_footprint.cpp b/pcbnew/microwave/microwave_footprint.cpp index 08603be5bf..8006b6cdf4 100644 --- a/pcbnew/microwave/microwave_footprint.cpp +++ b/pcbnew/microwave/microwave_footprint.cpp @@ -29,14 +29,15 @@ #include -MODULE* MICROWAVE_TOOL::createFootprint( MICROWAVE_FOOTPRINT_SHAPE aFootprintShape ) +FOOTPRINT* MICROWAVE_TOOL::createFootprint( MICROWAVE_FOOTPRINT_SHAPE aFootprintShape ) { - int oX; - PAD* pad; - MODULE* footprint; - wxString msg, cmp_name; - int pad_count = 2; - int angle = 0; + int oX; + PAD* pad; + FOOTPRINT* footprint; + wxString msg; + wxString cmp_name; + int pad_count = 2; + int angle = 0; PCB_EDIT_FRAME& editFrame = *getEditFrame(); @@ -181,12 +182,12 @@ MODULE* MICROWAVE_TOOL::createFootprint( MICROWAVE_FOOTPRINT_SHAPE aFootprintSha } -MODULE* MICROWAVE_TOOL::createBaseFootprint( const wxString& aValue, - int aTextSize, int aPadCount ) +FOOTPRINT* MICROWAVE_TOOL::createBaseFootprint( const wxString& aValue, + int aTextSize, int aPadCount ) { PCB_EDIT_FRAME& editFrame = *getEditFrame(); - MODULE* footprint = editFrame.CreateNewFootprint( aValue ); + FOOTPRINT* footprint = editFrame.CreateNewFootprint( aValue ); if( aTextSize > 0 ) { diff --git a/pcbnew/microwave/microwave_inductor.cpp b/pcbnew/microwave/microwave_inductor.cpp index 3926b29e44..14dadb2449 100644 --- a/pcbnew/microwave/microwave_inductor.cpp +++ b/pcbnew/microwave/microwave_inductor.cpp @@ -303,7 +303,7 @@ void MICROWAVE_TOOL::createInductorBetween( const VECTOR2I& aStart, const VECTOR wxString errorMessage; - auto inductorFP = std::unique_ptr( createMicrowaveInductor( pattern, errorMessage ) ); + auto inductorFP = std::unique_ptr( createMicrowaveInductor( pattern, errorMessage ) ); // on any error, report if we can if ( !inductorFP || !errorMessage.IsEmpty() ) @@ -323,8 +323,8 @@ void MICROWAVE_TOOL::createInductorBetween( const VECTOR2I& aStart, const VECTOR } -MODULE* MICROWAVE_TOOL::createMicrowaveInductor( MICROWAVE_INDUCTOR_PATTERN& aInductorPattern, - wxString& aErrorMessage ) +FOOTPRINT* MICROWAVE_TOOL::createMicrowaveInductor( MICROWAVE_INDUCTOR_PATTERN& aInductorPattern, + wxString& aErrorMessage ) { /* Build a microwave inductor footprint. * - Length Mself.lng @@ -413,7 +413,7 @@ MODULE* MICROWAVE_TOOL::createMicrowaveInductor( MICROWAVE_INDUCTOR_PATTERN& aIn if( ( cmpdlg.ShowModal() != wxID_OK ) || msg.IsEmpty() ) return nullptr; // Aborted by user - MODULE* footprint = editFrame.CreateNewFootprint( msg ); + FOOTPRINT* footprint = editFrame.CreateNewFootprint( msg ); footprint->SetFPID( LIB_ID( wxEmptyString, wxT( "mw_inductor" ) ) ); footprint->SetAttributes( FP_EXCLUDE_FROM_POS_FILES | FP_EXCLUDE_FROM_BOM ); diff --git a/pcbnew/microwave/microwave_polygon.cpp b/pcbnew/microwave/microwave_polygon.cpp index 4525a1fcd9..7bafd04693 100644 --- a/pcbnew/microwave/microwave_polygon.cpp +++ b/pcbnew/microwave/microwave_polygon.cpp @@ -238,14 +238,14 @@ void MWAVE_POLYGONAL_SHAPE_DLG::ReadDataShapeDescr( wxCommandEvent& event ) } -MODULE* MICROWAVE_TOOL::createPolygonShape() +FOOTPRINT* MICROWAVE_TOOL::createPolygonShape() { - PAD* pad1; - PAD* pad2; - MODULE* footprint; - wxString cmp_name; - int pad_count = 2; - FP_SHAPE* shape; + PAD* pad1; + PAD* pad2; + FOOTPRINT* footprint; + wxString cmp_name; + int pad_count = 2; + FP_SHAPE* shape; PCB_EDIT_FRAME& editFrame = *getEditFrame(); diff --git a/pcbnew/microwave/microwave_tool.cpp b/pcbnew/microwave/microwave_tool.cpp index d06d020bb4..22ee39bd6c 100644 --- a/pcbnew/microwave/microwave_tool.cpp +++ b/pcbnew/microwave/microwave_tool.cpp @@ -73,13 +73,13 @@ int MICROWAVE_TOOL::addMicrowaveFootprint( const TOOL_EVENT& aEvent ) case MICROWAVE_FOOTPRINT_SHAPE::GAP: case MICROWAVE_FOOTPRINT_SHAPE::STUB: case MICROWAVE_FOOTPRINT_SHAPE::STUB_ARC: - return std::unique_ptr( m_tool->createFootprint( m_itemType ) ); + return std::unique_ptr( m_tool->createFootprint( m_itemType ) ); case MICROWAVE_FOOTPRINT_SHAPE::FUNCTION_SHAPE: - return std::unique_ptr( m_tool->createPolygonShape() ); + return std::unique_ptr( m_tool->createPolygonShape() ); default: - return std::unique_ptr(); + return std::unique_ptr(); }; } diff --git a/pcbnew/microwave/microwave_tool.h b/pcbnew/microwave/microwave_tool.h index 83231e8989..7dc1e8fe87 100644 --- a/pcbnew/microwave/microwave_tool.h +++ b/pcbnew/microwave/microwave_tool.h @@ -86,14 +86,14 @@ private: * @param aComponentShape is the component to create * @return the new footprint */ - MODULE* createFootprint( MICROWAVE_FOOTPRINT_SHAPE aFootprintShape ); + FOOTPRINT* createFootprint( MICROWAVE_FOOTPRINT_SHAPE aFootprintShape ); - MODULE* createPolygonShape(); + FOOTPRINT* createPolygonShape(); /** * Creates an S-shaped coil footprint for microwave applications. */ - MODULE* createMicrowaveInductor( MICROWAVE_INDUCTOR_PATTERN& aPattern, wxString& aErrorMessage ); + FOOTPRINT* createMicrowaveInductor( MICROWAVE_INDUCTOR_PATTERN& aPattern, wxString& aErrorMessage ); /** * Create a basic footprint for micro wave applications. @@ -106,7 +106,7 @@ private: * @param aPadCount is number of pads * @return the new footprint */ - MODULE* createBaseFootprint( const wxString& aValue, int aTextSize, int aPadCount ); + FOOTPRINT* createBaseFootprint( const wxString& aValue, int aTextSize, int aPadCount ); }; diff --git a/pcbnew/netinfo_item.cpp b/pcbnew/netinfo_item.cpp index 968828fda8..4b3ef15c11 100644 --- a/pcbnew/netinfo_item.cpp +++ b/pcbnew/netinfo_item.cpp @@ -88,9 +88,9 @@ void NETINFO_ITEM::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vectorFootprints() ) + for( FOOTPRINT* footprint : board->Footprints() ) { - for( PAD* pad : mod->Pads() ) + for( PAD* pad : footprint->Pads() ) { if( pad->GetNetCode() == GetNet() ) { diff --git a/pcbnew/netinfo_list.cpp b/pcbnew/netinfo_list.cpp index 0dec294e5b..24f628655a 100644 --- a/pcbnew/netinfo_list.cpp +++ b/pcbnew/netinfo_list.cpp @@ -218,7 +218,7 @@ void NETINFO_MAPPING::Update() nets.insert( track->GetNetCode() ); // footprints/pads - for( MODULE* footprint : m_board->Footprints() ) + for( FOOTPRINT* footprint : m_board->Footprints() ) { for( PAD* pad : footprint->Pads() ) nets.insert( pad->GetNetCode() ); diff --git a/pcbnew/netlist_reader/board_netlist_updater.cpp b/pcbnew/netlist_reader/board_netlist_updater.cpp index f755e862c1..8b2be73747 100644 --- a/pcbnew/netlist_reader/board_netlist_updater.cpp +++ b/pcbnew/netlist_reader/board_netlist_updater.cpp @@ -137,7 +137,7 @@ wxPoint BOARD_NETLIST_UPDATER::estimateComponentInsertionPosition() } -MODULE* BOARD_NETLIST_UPDATER::addNewComponent( COMPONENT* aComponent ) +FOOTPRINT* BOARD_NETLIST_UPDATER::addNewComponent( COMPONENT* aComponent ) { wxString msg; @@ -151,7 +151,7 @@ MODULE* BOARD_NETLIST_UPDATER::addNewComponent( COMPONENT* aComponent ) return nullptr; } - MODULE* footprint = m_frame->LoadFootprint( aComponent->GetFPID() ); + FOOTPRINT* footprint = m_frame->LoadFootprint( aComponent->GetFPID() ); if( footprint == nullptr ) { @@ -193,8 +193,8 @@ MODULE* BOARD_NETLIST_UPDATER::addNewComponent( COMPONENT* aComponent ) } -MODULE* BOARD_NETLIST_UPDATER::replaceComponent( NETLIST& aNetlist, MODULE* aPcbComponent, - COMPONENT* aNewComponent ) +FOOTPRINT* BOARD_NETLIST_UPDATER::replaceComponent( NETLIST& aNetlist, FOOTPRINT* aPcbComponent, + COMPONENT* aNewComponent ) { wxString msg; @@ -208,7 +208,7 @@ MODULE* BOARD_NETLIST_UPDATER::replaceComponent( NETLIST& aNetlist, MODULE* aPcb return nullptr; } - MODULE* newFootprint = m_frame->LoadFootprint( aNewComponent->GetFPID() ); + FOOTPRINT* newFootprint = m_frame->LoadFootprint( aNewComponent->GetFPID() ); if( newFootprint == nullptr ) { @@ -240,14 +240,15 @@ MODULE* BOARD_NETLIST_UPDATER::replaceComponent( NETLIST& aNetlist, MODULE* aPcb } -bool BOARD_NETLIST_UPDATER::updateComponentParameters( MODULE* aPcbComponent, +bool BOARD_NETLIST_UPDATER::updateComponentParameters( FOOTPRINT* aPcbComponent, COMPONENT* aNewComponent ) { wxString msg; // Create a copy only if the footprint has not been added during this update - MODULE* copy = m_commit.GetStatus( aPcbComponent ) ? nullptr : (MODULE*) aPcbComponent->Clone(); - bool changed = false; + FOOTPRINT* copy = m_commit.GetStatus( aPcbComponent ) ? nullptr + : (FOOTPRINT*) aPcbComponent->Clone(); + bool changed = false; // Test for reference designator field change. if( aPcbComponent->GetReference() != aNewComponent->GetReference() ) @@ -345,14 +346,15 @@ bool BOARD_NETLIST_UPDATER::updateComponentParameters( MODULE* aPcbComponent, } -bool BOARD_NETLIST_UPDATER::updateComponentPadConnections( MODULE* aPcbComponent, +bool BOARD_NETLIST_UPDATER::updateComponentPadConnections( FOOTPRINT* aPcbComponent, COMPONENT* aNewComponent ) { wxString msg; // Create a copy only if the footprint has not been added during this update - MODULE* copy = m_commit.GetStatus( aPcbComponent ) ? nullptr : (MODULE*) aPcbComponent->Clone(); - bool changed = false; + FOOTPRINT* copy = m_commit.GetStatus( aPcbComponent ) ? nullptr + : (FOOTPRINT*) aPcbComponent->Clone(); + bool changed = false; // At this point, the component footprint is updated. Now update the nets. for( PAD* pad : aPcbComponent->Pads() ) @@ -624,7 +626,7 @@ bool BOARD_NETLIST_UPDATER::deleteUnusedComponents( NETLIST& aNetlist ) wxString msg; const COMPONENT* component; - for( MODULE* footprint : m_board->Footprints() ) + for( FOOTPRINT* footprint : m_board->Footprints() ) { if(( footprint->GetAttributes() & FP_BOARD_ONLY ) > 0 ) continue; @@ -751,7 +753,7 @@ bool BOARD_NETLIST_UPDATER::testConnectivity( NETLIST& aNetlist ) for( int i = 0; i < (int) aNetlist.GetCount(); i++ ) { const COMPONENT* component = aNetlist.GetComponent( i ); - MODULE* footprint = m_board->FindModuleByReference( component->GetReference() ); + FOOTPRINT* footprint = m_board->FindFootprintByReference( component->GetReference() ); if( footprint == NULL ) // It can be missing in partial designs continue; @@ -785,7 +787,8 @@ bool BOARD_NETLIST_UPDATER::UpdateNetlist( NETLIST& aNetlist ) m_errorCount = 0; m_warningCount = 0; m_newFootprintsCount = 0; - MODULE* lastPreexistingFootprint = m_board->Footprints().empty() ? NULL : m_board->Footprints().back(); + FOOTPRINT* lastPreexistingFootprint = m_board->Footprints().empty() ? NULL + : m_board->Footprints().back(); cacheCopperZoneConnections(); @@ -803,7 +806,7 @@ bool BOARD_NETLIST_UPDATER::UpdateNetlist( NETLIST& aNetlist ) { COMPONENT* component = aNetlist.GetComponent( i ); int matchCount = 0; - MODULE* tmp; + FOOTPRINT* tmp; if( component->GetProperties().count( "exclude_from_board" ) ) continue; @@ -813,7 +816,7 @@ bool BOARD_NETLIST_UPDATER::UpdateNetlist( NETLIST& aNetlist ) component->GetFPID().Format().wx_str() ); m_reporter->Report( msg, RPT_SEVERITY_INFO ); - for( MODULE* footprint : m_board->Footprints() ) + for( FOOTPRINT* footprint : m_board->Footprints() ) { bool match = false; diff --git a/pcbnew/netlist_reader/board_netlist_updater.h b/pcbnew/netlist_reader/board_netlist_updater.h index 60d91de165..c139d52df7 100644 --- a/pcbnew/netlist_reader/board_netlist_updater.h +++ b/pcbnew/netlist_reader/board_netlist_updater.h @@ -38,7 +38,7 @@ class BOARD; class REPORTER; class NETLIST; class COMPONENT; -class MODULE; +class FOOTPRINT; class PCB_EDIT_FRAME; #include @@ -128,7 +128,7 @@ public: m_lookupByTimestamp = aEnabled; } - std::vector GetAddedComponents() const + std::vector GetAddedComponents() const { return m_addedComponents; } @@ -141,14 +141,24 @@ private: wxString getPinFunction( PAD* aPad ); wxPoint estimateComponentInsertionPosition(); - MODULE* addNewComponent( COMPONENT* aComponent ); - MODULE* replaceComponent( NETLIST& aNetlist, MODULE* aPcbComponent, COMPONENT* aNewComponent ); - bool updateComponentParameters( MODULE* aPcbComponent, COMPONENT* aNewComponent ); - bool updateComponentPadConnections( MODULE* aPcbComponent, COMPONENT* aNewComponent ); + + FOOTPRINT* addNewComponent( COMPONENT* aComponent ); + + FOOTPRINT* replaceComponent( NETLIST& aNetlist, FOOTPRINT* aPcbComponent, + COMPONENT* aNewComponent ); + + bool updateComponentParameters( FOOTPRINT* aPcbComponent, COMPONENT* aNewComponent ); + + bool updateComponentPadConnections( FOOTPRINT* aPcbComponent, COMPONENT* aNewComponent ); + void cacheCopperZoneConnections(); + bool updateCopperZoneNets( NETLIST& aNetlist ); + bool deleteUnusedComponents( NETLIST& aNetlist ); + bool deleteSinglePadNets(); + bool testConnectivity( NETLIST& aNetlist ); PCB_EDIT_FRAME* m_frame; @@ -160,7 +170,7 @@ private: std::map m_oldToNewNets; std::map m_padNets; std::map m_padPinFunctions; - std::vector m_addedComponents; + std::vector m_addedComponents; std::map m_addedNets; bool m_deleteSinglePadNets; diff --git a/pcbnew/netlist_reader/netlist.cpp b/pcbnew/netlist_reader/netlist.cpp index a5c54229cd..9008df3257 100644 --- a/pcbnew/netlist_reader/netlist.cpp +++ b/pcbnew/netlist_reader/netlist.cpp @@ -48,7 +48,7 @@ using namespace std::placeholders; #include // LAST_PATH_TYPE -extern void SpreadFootprints( std::vector* aFootprints, wxPoint aSpreadAreaPosition ); +extern void SpreadFootprints( std::vector* aFootprints, wxPoint aSpreadAreaPosition ); bool PCB_EDIT_FRAME::ReadNetlistFromFile( const wxString &aFilename, NETLIST& aNetlist, @@ -99,7 +99,7 @@ void PCB_EDIT_FRAME::OnNetlistChanged( BOARD_NETLIST_UPDATER& aUpdater, bool* aR for( auto track : board->Tracks() ) GetCanvas()->GetView()->Update( track ); - std::vector newFootprints = aUpdater.GetAddedComponents(); + std::vector newFootprints = aUpdater.GetAddedComponents(); // Spread new footprints. wxPoint areaPosition = (wxPoint) GetCanvas()->GetViewControls()->GetCursorPosition(); @@ -112,7 +112,7 @@ void PCB_EDIT_FRAME::OnNetlistChanged( BOARD_NETLIST_UPDATER& aUpdater, bool* aR // Start drag command for new footprints if( !newFootprints.empty() ) { - for( MODULE* footprint : newFootprints ) + for( FOOTPRINT* footprint : newFootprints ) GetToolManager()->RunAction( PCB_ACTIONS::selectItem, true, footprint ); *aRunDragCommand = true; @@ -134,8 +134,8 @@ void PCB_EDIT_FRAME::LoadFootprints( NETLIST& aNetlist, REPORTER& aReporter ) wxString msg; LIB_ID lastFPID; COMPONENT* component; - MODULE* footprint = nullptr; - MODULE* fpOnBoard; + FOOTPRINT* footprint = nullptr; + FOOTPRINT* fpOnBoard; if( aNetlist.IsEmpty() || Prj().PcbFootprintLibs()->IsEmpty() ) return; @@ -159,9 +159,9 @@ void PCB_EDIT_FRAME::LoadFootprints( NETLIST& aNetlist, REPORTER& aReporter ) // Check if component footprint is already on BOARD and only load the footprint from // the library if it's needed. Nickname can be blank. if( aNetlist.IsFindByTimeStamp() ) - fpOnBoard = m_pcb->FindModuleByPath( aNetlist.GetComponent( ii )->GetPath() ); + fpOnBoard = m_pcb->FindFootprintByPath( aNetlist.GetComponent( ii )->GetPath() ); else - fpOnBoard = m_pcb->FindModuleByReference( aNetlist.GetComponent( ii )->GetReference() ); + fpOnBoard = m_pcb->FindFootprintByReference( aNetlist.GetComponent( ii )->GetReference() ); bool footprintMisMatch = fpOnBoard && fpOnBoard->GetFPID() != component->GetFPID(); @@ -222,11 +222,11 @@ void PCB_EDIT_FRAME::LoadFootprints( NETLIST& aNetlist, REPORTER& aReporter ) if( !footprint ) continue; // Footprint does not exist in any library. - footprint = new MODULE( *footprint ); + footprint = new FOOTPRINT( *footprint ); const_cast( footprint->m_Uuid ) = KIID(); } if( footprint ) - component->SetModule( footprint ); + component->SetFootprint( footprint ); } } diff --git a/pcbnew/netlist_reader/pcb_netlist.cpp b/pcbnew/netlist_reader/pcb_netlist.cpp index 371c5744cd..33e22af7fb 100644 --- a/pcbnew/netlist_reader/pcb_netlist.cpp +++ b/pcbnew/netlist_reader/pcb_netlist.cpp @@ -37,7 +37,7 @@ int COMPONENT_NET::Format( OUTPUTFORMATTER* aOut, int aNestLevel, int aCtl ) } -void COMPONENT::SetModule( MODULE* aFootprint ) +void COMPONENT::SetFootprint( FOOTPRINT* aFootprint ) { m_footprint.reset( aFootprint ); diff --git a/pcbnew/netlist_reader/pcb_netlist.h b/pcbnew/netlist_reader/pcb_netlist.h index 623e41e9df..761b846fe7 100644 --- a/pcbnew/netlist_reader/pcb_netlist.h +++ b/pcbnew/netlist_reader/pcb_netlist.h @@ -102,8 +102,8 @@ class COMPONENT /// this one is a copy of the netlist footprint assignment LIB_ID m_altFpid; - /// The #MODULE loaded for #m_fpid. - std::unique_ptr< MODULE > m_footprint; + /// The #FOOTPRINT loaded for #m_fpid. + std::unique_ptr< FOOTPRINT > m_footprint; /// Component-specific properties found in the netlist. std::map m_properties; @@ -167,12 +167,12 @@ public: void SetPinCount( int aPinCount ) { m_pinCount = aPinCount; } int GetPinCount() const { return m_pinCount; } - MODULE* GetModule( bool aRelease = false ) + FOOTPRINT* GetFootprint( bool aRelease = false ) { return ( aRelease ) ? m_footprint.release() : m_footprint.get(); } - void SetModule( MODULE* aFootprint ); + void SetFootprint( FOOTPRINT* aFootprint ); bool IsLibSource( const wxString& aLibrary, const wxString& aName ) const { diff --git a/pcbnew/pad.cpp b/pcbnew/pad.cpp index d6b125c1b7..f01c46707e 100644 --- a/pcbnew/pad.cpp +++ b/pcbnew/pad.cpp @@ -45,7 +45,7 @@ #include -PAD::PAD( MODULE* parent ) : +PAD::PAD( FOOTPRINT* parent ) : BOARD_CONNECTED_ITEM( parent, PCB_PAD_T ) { m_size.x = m_size.y = Mils2iu( 60 ); // Default pad size 60 mils. @@ -477,7 +477,7 @@ const EDA_RECT PAD::GetBoundingBox() const void PAD::SetDrawCoord() { - MODULE* parentFootprint = (MODULE*) m_Parent; + FOOTPRINT* parentFootprint = static_cast( m_Parent ); m_pos = m_pos0; @@ -495,7 +495,7 @@ void PAD::SetDrawCoord() void PAD::SetLocalCoord() { - MODULE* parentFootprint = (MODULE*) m_Parent; + FOOTPRINT* parentFootprint = static_cast( m_Parent ); if( parentFootprint == NULL ) { @@ -658,7 +658,7 @@ int PAD::GetSolderMaskMargin() const int margin = m_localSolderMaskMargin; - MODULE* parentFootprint = GetParent(); + FOOTPRINT* parentFootprint = GetParent(); if( parentFootprint ) { @@ -704,7 +704,7 @@ wxSize PAD::GetSolderPasteMargin() const int margin = m_localSolderPasteMargin; double mratio = m_localSolderPasteMarginRatio; - MODULE* parentFootprint = GetParent(); + FOOTPRINT* parentFootprint = GetParent(); if( parentFootprint ) { @@ -742,7 +742,7 @@ wxSize PAD::GetSolderPasteMargin() const ZONE_CONNECTION PAD::GetEffectiveZoneConnection( wxString* aSource ) const { - MODULE* parentFootprint = GetParent(); + FOOTPRINT* parentFootprint = GetParent(); if( m_zoneConnection == ZONE_CONNECTION::INHERITED && parentFootprint ) { @@ -763,7 +763,7 @@ ZONE_CONNECTION PAD::GetEffectiveZoneConnection( wxString* aSource ) const int PAD::GetEffectiveThermalSpokeWidth( wxString* aSource ) const { - MODULE* parentFootprint = GetParent(); + FOOTPRINT* parentFootprint = GetParent(); if( m_thermalWidth == 0 && parentFootprint ) { @@ -782,7 +782,7 @@ int PAD::GetEffectiveThermalSpokeWidth( wxString* aSource ) const int PAD::GetEffectiveThermalGap( wxString* aSource ) const { - MODULE* parentFootprint = GetParent(); + FOOTPRINT* parentFootprint = GetParent(); if( m_thermalGap == 0 && parentFootprint ) { @@ -805,7 +805,7 @@ void PAD::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector& wxString msg, msg2; BOARD* board = GetBoard(); BOARD_DESIGN_SETTINGS& bds = board->GetDesignSettings(); - MODULE* parentFootprint = (MODULE*) m_Parent; + FOOTPRINT* parentFootprint = static_cast( m_Parent ); if( parentFootprint ) aList.emplace_back( _( "Footprint" ), parentFootprint->GetReference(), DARKCYAN ); @@ -1238,9 +1238,9 @@ const BOX2I PAD::ViewBBox() const } -MODULE* PAD::GetParent() const +FOOTPRINT* PAD::GetParent() const { - return dynamic_cast( m_Parent ); + return dynamic_cast( m_Parent ); } @@ -1332,7 +1332,7 @@ void PAD::SwapData( BOARD_ITEM* aImage ) { assert( aImage->Type() == PCB_PAD_T ); - std::swap( *((MODULE*) this), *((MODULE*) aImage) ); + std::swap( *((FOOTPRINT*) this), *((FOOTPRINT*) aImage) ); } diff --git a/pcbnew/pad.h b/pcbnew/pad.h index ae0af97a24..be392f0370 100644 --- a/pcbnew/pad.h +++ b/pcbnew/pad.h @@ -47,7 +47,7 @@ enum CUST_PAD_SHAPE_IN_ZONE class LINE_READER; class EDA_3D_CANVAS; -class MODULE; +class FOOTPRINT; class FP_SHAPE; class TRACK; @@ -59,7 +59,7 @@ namespace KIGFX class PAD : public BOARD_CONNECTED_ITEM { public: - PAD( MODULE* parent ); + PAD( FOOTPRINT* parent ); // Copy constructor & operator= are needed because the list of basic shapes // must be duplicated in copy. @@ -103,7 +103,7 @@ public: return false; } - MODULE* GetParent() const; + FOOTPRINT* GetParent() const; /** * Imports the pad settings from aMasterPad. diff --git a/pcbnew/pcb_base_frame.cpp b/pcbnew/pcb_base_frame.cpp index 4be3836f24..402df2ca8d 100644 --- a/pcbnew/pcb_base_frame.cpp +++ b/pcbnew/pcb_base_frame.cpp @@ -152,7 +152,7 @@ void PCB_BASE_FRAME::SetBoard( BOARD* aBoard ) } -void PCB_BASE_FRAME::AddFootprintToBoard( MODULE* aFootprint ) +void PCB_BASE_FRAME::AddFootprintToBoard( FOOTPRINT* aFootprint ) { if( aFootprint ) { @@ -191,17 +191,19 @@ void PCB_BASE_FRAME::FocusOnItem( BOARD_ITEM* aItem ) if( lastItem->Type() == PCB_FOOTPRINT_T ) { - static_cast( lastItem )->RunOnChildren( [&]( BOARD_ITEM* child ) - { - child->ClearBrightened(); - } ); + static_cast( lastItem )->RunOnChildren( + [&]( BOARD_ITEM* child ) + { + child->ClearBrightened(); + } ); } else if( lastItem->Type() == PCB_GROUP_T ) { - static_cast( lastItem )->RunOnChildren( [&]( BOARD_ITEM* child ) - { - child->ClearBrightened(); - } ); + static_cast( lastItem )->RunOnChildren( + [&]( BOARD_ITEM* child ) + { + child->ClearBrightened(); + } ); } GetCanvas()->GetView()->Update( lastItem ); @@ -215,17 +217,19 @@ void PCB_BASE_FRAME::FocusOnItem( BOARD_ITEM* aItem ) if( aItem->Type() == PCB_FOOTPRINT_T ) { - static_cast( aItem )->RunOnChildren( [&]( BOARD_ITEM* child ) - { - child->SetBrightened(); - }); + static_cast( aItem )->RunOnChildren( + [&]( BOARD_ITEM* child ) + { + child->SetBrightened(); + }); } else if( aItem->Type() == PCB_GROUP_T ) { - static_cast( aItem )->RunOnChildren( [&] ( BOARD_ITEM* child ) - { - child->SetBrightened(); - }); + static_cast( aItem )->RunOnChildren( + [&]( BOARD_ITEM* child ) + { + child->SetBrightened(); + }); } GetCanvas()->GetView()->Update( aItem ); diff --git a/pcbnew/pcb_draw_panel_gal.cpp b/pcbnew/pcb_draw_panel_gal.cpp index fdffbe7a2f..45b1eda4e6 100644 --- a/pcbnew/pcb_draw_panel_gal.cpp +++ b/pcbnew/pcb_draw_panel_gal.cpp @@ -197,7 +197,7 @@ void PCB_DRAW_PANEL_GAL::DisplayBoard( BOARD* aBoard ) m_view->Add( track ); // Load footprints and its additional elements - for( MODULE* footprint : aBoard->Footprints() ) + for( FOOTPRINT* footprint : aBoard->Footprints() ) m_view->Add( footprint ); // DRC markers diff --git a/pcbnew/pcb_edit_frame.cpp b/pcbnew/pcb_edit_frame.cpp index e759933bcd..86a6b81f4e 100644 --- a/pcbnew/pcb_edit_frame.cpp +++ b/pcbnew/pcb_edit_frame.cpp @@ -1513,7 +1513,7 @@ void PCB_EDIT_FRAME::PythonSyncProjectName() } -void PCB_EDIT_FRAME::ShowFootprintPropertiesDialog( MODULE* aFootprint ) +void PCB_EDIT_FRAME::ShowFootprintPropertiesDialog( FOOTPRINT* aFootprint ) { if( aFootprint == NULL ) return; @@ -1568,10 +1568,10 @@ void PCB_EDIT_FRAME::ShowFootprintPropertiesDialog( MODULE* aFootprint ) } -int PCB_EDIT_FRAME::ShowExchangeFootprintsDialog( MODULE* aFootprint, bool updateMode, - bool selectedMode ) +int PCB_EDIT_FRAME::ShowExchangeFootprintsDialog( FOOTPRINT* aFootprint, bool aUpdateMode, + bool aSelectedMode ) { - DIALOG_EXCHANGE_FOOTPRINTS dialog( this, aFootprint, updateMode, selectedMode ); + DIALOG_EXCHANGE_FOOTPRINTS dialog( this, aFootprint, aUpdateMode, aSelectedMode ); return dialog.ShowQuasiModal(); } diff --git a/pcbnew/pcb_edit_frame.h b/pcbnew/pcb_edit_frame.h index 0ffc8f7057..3fecded846 100644 --- a/pcbnew/pcb_edit_frame.h +++ b/pcbnew/pcb_edit_frame.h @@ -36,7 +36,7 @@ class PCB_SCREEN; class BOARD; class BOARD_COMMIT; class BOARD_ITEM_CONTAINER; -class MODULE; +class FOOTPRINT; class TRACK; class VIA; class PAD; @@ -734,9 +734,9 @@ public: bool ImportSpecctraSession( const wxString& aFullFilename ); // Footprint editing (see also PCB_BASE_FRAME) - void ShowFootprintPropertiesDialog( MODULE* aFootprint ); + void ShowFootprintPropertiesDialog( FOOTPRINT* aFootprint ); - int ShowExchangeFootprintsDialog( MODULE* aFootprint, bool updateMode, bool selectedMode ); + int ShowExchangeFootprintsDialog( FOOTPRINT* aFootprint, bool aUpdateMode, bool aSelectedMode ); /** * Function Exchange_Module @@ -747,7 +747,7 @@ public: * @param aNew = footprint to put * @param aCommit = commit that should store the changes */ - void ExchangeFootprint( MODULE* aExisting, MODULE* aNew, BOARD_COMMIT& aCommit, + void ExchangeFootprint( FOOTPRINT* aExisting, FOOTPRINT* aNew, BOARD_COMMIT& aCommit, bool deleteExtraTexts = true, bool resetTextLayers = true, bool resetTextEffects = true, bool resetFabricationAttrs = true, bool reset3DModels = true ); diff --git a/pcbnew/pcb_expr_evaluator.cpp b/pcbnew/pcb_expr_evaluator.cpp index 9d3a96c106..49c7ade5f2 100644 --- a/pcbnew/pcb_expr_evaluator.cpp +++ b/pcbnew/pcb_expr_evaluator.cpp @@ -149,22 +149,22 @@ static void insideCourtyard( LIBEVAL::CONTEXT* aCtx, void* self ) PCB_EXPR_VAR_REF* vref = static_cast( self ); BOARD_ITEM* item = vref ? vref->GetObject( aCtx ) : nullptr; - MODULE* footprint = nullptr; + FOOTPRINT* footprint = nullptr; if( !item ) return; if( arg->AsString() == "A" ) { - footprint = dynamic_cast( context->GetItem( 0 ) ); + footprint = dynamic_cast( context->GetItem( 0 ) ); } else if( arg->AsString() == "B" ) { - footprint = dynamic_cast( context->GetItem( 1 ) ); + footprint = dynamic_cast( context->GetItem( 1 ) ); } else { - for( MODULE* candidate : item->GetBoard()->Footprints() ) + for( FOOTPRINT* candidate : item->GetBoard()->Footprints() ) { if( candidate->GetReference().Matches( arg->AsString() ) ) { @@ -248,7 +248,7 @@ static void insideArea( LIBEVAL::CONTEXT* aCtx, void* self ) if( item->Type() == PCB_FOOTPRINT_T ) { - MODULE* footprint = static_cast( item ); + FOOTPRINT* footprint = static_cast( item ); if( ( footprint->GetFlags() & MALFORMED_COURTYARD ) != 0 ) { @@ -322,7 +322,7 @@ static void insideArea( LIBEVAL::CONTEXT* aCtx, void* self ) } } - for( MODULE* footprint : item->GetBoard()->Footprints() ) + for( FOOTPRINT* footprint : item->GetBoard()->Footprints() ) { for( ZONE* candidate : footprint->Zones() ) { @@ -353,7 +353,7 @@ static void insideArea( LIBEVAL::CONTEXT* aCtx, void* self ) } } - for( MODULE* footprint : item->GetBoard()->Footprints() ) + for( FOOTPRINT* footprint : item->GetBoard()->Footprints() ) { for( ZONE* candidate : footprint->Zones() ) { diff --git a/pcbnew/pcb_painter.cpp b/pcbnew/pcb_painter.cpp index 61d5b47817..fb4757093d 100644 --- a/pcbnew/pcb_painter.cpp +++ b/pcbnew/pcb_painter.cpp @@ -440,7 +440,7 @@ bool PCB_PAINTER::Draw( const VIEW_ITEM* aItem, int aLayer ) break; case PCB_FOOTPRINT_T: - draw( static_cast( item ), aLayer ); + draw( static_cast( item ), aLayer ); break; case PCB_GROUP_T: @@ -1195,7 +1195,7 @@ void PCB_PAINTER::draw( const PCB_SHAPE* aShape, int aLayer ) m_gal->Save(); - if( MODULE* parentFootprint = aShape->GetParentFootprint() ) + if( FOOTPRINT* parentFootprint = aShape->GetParentFootprint() ) { m_gal->Translate( parentFootprint->GetPosition() ); m_gal->Rotate( -parentFootprint->GetOrientationRadians() ); @@ -1299,7 +1299,7 @@ void PCB_PAINTER::draw( const FP_TEXT* aText, int aLayer ) } -void PCB_PAINTER::draw( const MODULE* aFootprint, int aLayer ) +void PCB_PAINTER::draw( const FOOTPRINT* aFootprint, int aLayer ) { if( aLayer == LAYER_ANCHOR ) { diff --git a/pcbnew/pcb_painter.h b/pcbnew/pcb_painter.h index c8a3c3299a..5a0f5ce92e 100644 --- a/pcbnew/pcb_painter.h +++ b/pcbnew/pcb_painter.h @@ -43,7 +43,7 @@ class TRACK; class PAD; class PCB_SHAPE; class PCB_GROUP; -class MODULE; +class FOOTPRINT; class ZONE; class PCB_TEXT; class FP_TEXT; @@ -288,7 +288,7 @@ protected: void draw( const PCB_SHAPE* aSegment, int aLayer ); void draw( const PCB_TEXT* aText, int aLayer ); void draw( const FP_TEXT* aText, int aLayer ); - void draw( const MODULE* aFootprint, int aLayer ); + void draw( const FOOTPRINT* aFootprint, int aLayer ); void draw( const PCB_GROUP* aGroup, int aLayer ); void draw( const ZONE* aZone, int aLayer ); void draw( const DIMENSION_BASE* aDimension, int aLayer ); diff --git a/pcbnew/pcb_shape.cpp b/pcbnew/pcb_shape.cpp index 8d90be1ca3..c071ece0ec 100644 --- a/pcbnew/pcb_shape.cpp +++ b/pcbnew/pcb_shape.cpp @@ -454,12 +454,12 @@ void PCB_SHAPE::SetAngle( double aAngle, bool aUpdateEnd ) } -MODULE* PCB_SHAPE::GetParentFootprint() const +FOOTPRINT* PCB_SHAPE::GetParentFootprint() const { if( !m_Parent || m_Parent->Type() != PCB_FOOTPRINT_T ) return NULL; - return (MODULE*) m_Parent; + return (FOOTPRINT*) m_Parent; } @@ -580,7 +580,7 @@ const EDA_RECT PCB_SHAPE::GetBoundingBox() const if( m_Poly.IsEmpty() ) break; - MODULE* parentFootprint = GetParentFootprint(); + FOOTPRINT* parentFootprint = GetParentFootprint(); bbox = EDA_RECT(); // re-init for merging for( auto iter = m_Poly.CIterate(); iter; iter++ ) @@ -942,9 +942,9 @@ const BOX2I PCB_SHAPE::ViewBBox() const std::vector PCB_SHAPE::GetRectCorners() const { std::vector pts; - MODULE* parentFootprint = GetParentFootprint(); - wxPoint topLeft = GetStart(); - wxPoint botRight = GetEnd(); + FOOTPRINT* parentFootprint = GetParentFootprint(); + wxPoint topLeft = GetStart(); + wxPoint botRight = GetEnd(); // Un-rotate rect topLeft and botRight if( parentFootprint && KiROUND( parentFootprint->GetOrientation() ) % 900 != 0 ) diff --git a/pcbnew/pcb_shape.h b/pcbnew/pcb_shape.h index 5a34d89a1a..ade288fbaf 100644 --- a/pcbnew/pcb_shape.h +++ b/pcbnew/pcb_shape.h @@ -36,7 +36,7 @@ class LINE_READER; class EDA_DRAW_FRAME; -class MODULE; +class FOOTPRINT; class MSG_PANEL_ITEM; @@ -223,7 +223,7 @@ public: * belong to a footprint. * @return MODULE* - pointer to the parent footprint or NULL. */ - MODULE* GetParentFootprint() const; + FOOTPRINT* GetParentFootprint() const; // Accessors: const std::vector& GetBezierPoints() const { return m_BezierPoints; } diff --git a/pcbnew/pcb_text.cpp b/pcbnew/pcb_text.cpp index dc7ace44a6..2b2ce62203 100644 --- a/pcbnew/pcb_text.cpp +++ b/pcbnew/pcb_text.cpp @@ -69,9 +69,9 @@ wxString PCB_TEXT::GetShownText( int aDepth ) const if( refItem && refItem->Type() == PCB_FOOTPRINT_T ) { - MODULE* refModule = static_cast( refItem ); + FOOTPRINT* refFP = static_cast( refItem ); - if( refModule->ResolveTextVar( &remainder, aDepth + 1 ) ) + if( refFP->ResolveTextVar( &remainder, aDepth + 1 ) ) { *token = remainder; return true; diff --git a/pcbnew/pcb_view.cpp b/pcbnew/pcb_view.cpp index 86be631934..3dc269c67a 100644 --- a/pcbnew/pcb_view.cpp +++ b/pcbnew/pcb_view.cpp @@ -62,7 +62,7 @@ void PCB_VIEW::Add( KIGFX::VIEW_ITEM* aItem, int aDrawPriority ) if( item->Type() == PCB_FOOTPRINT_T ) { - MODULE* footprint = static_cast( item ); + FOOTPRINT* footprint = static_cast( item ); footprint->RunOnChildren( [this]( BOARD_ITEM* aChild ) { VIEW::Add( aChild ); @@ -80,7 +80,7 @@ void PCB_VIEW::Remove( KIGFX::VIEW_ITEM* aItem ) if( item->Type() == PCB_FOOTPRINT_T ) { - MODULE* footprint = static_cast( item ); + FOOTPRINT* footprint = static_cast( item ); footprint->RunOnChildren( [this]( BOARD_ITEM* aChild ) { VIEW::Remove( aChild ); @@ -97,12 +97,12 @@ void PCB_VIEW::Update( const KIGFX::VIEW_ITEM* aItem, int aUpdateFlags ) const if( item->Type() == PCB_FOOTPRINT_T ) { - const MODULE* mod = static_cast( item ); + const FOOTPRINT* footprint = static_cast( item ); - mod->RunOnChildren( [this, aUpdateFlags] ( BOARD_ITEM* aModItem ) - { - VIEW::Update( aModItem, aUpdateFlags ); - } ); + footprint->RunOnChildren( [this, aUpdateFlags]( BOARD_ITEM* aModItem ) + { + VIEW::Update( aModItem, aUpdateFlags ); + } ); } VIEW::Update( item, aUpdateFlags ); diff --git a/pcbnew/pcbplot.h b/pcbnew/pcbplot.h index 3bf367b00e..e9c81af082 100644 --- a/pcbnew/pcbplot.h +++ b/pcbnew/pcbplot.h @@ -42,7 +42,7 @@ class PCB_TEXT; class PAD; class PCB_SHAPE; class DIMENSION_BASE; -class MODULE; +class FOOTPRINT; class FP_SHAPE; class PCB_TARGET; class FP_TEXT; @@ -90,7 +90,7 @@ public: // Basic functions to plot a board item void SetLayerSet( LSET aLayerMask ) { m_layerMask = aLayerMask; } - void PlotFootprintGraphicItems( MODULE* aModule ); + void PlotFootprintGraphicItems( FOOTPRINT* aFootprint ); void PlotFootprintGraphicItem( FP_SHAPE* aShape ); void PlotFootprintTextItem( FP_TEXT* aText, COLOR4D aColor ); @@ -98,7 +98,7 @@ public: * Reference, Value, and other fields are plotted only if the corresponding option is enabled. * Invisible text fields are plotted only if PlotInvisibleText option is set. */ - void PlotFootprintTextItems( MODULE* aModule ); + void PlotFootprintTextItems( FOOTPRINT* aFootprint ); void PlotDimension( DIMENSION_BASE* Dimension ); void PlotPcbTarget( PCB_TARGET* PtMire ); diff --git a/pcbnew/plot_board_layers.cpp b/pcbnew/plot_board_layers.cpp index 45559ce8a3..d3d19ebdd7 100644 --- a/pcbnew/plot_board_layers.cpp +++ b/pcbnew/plot_board_layers.cpp @@ -219,15 +219,15 @@ void PlotStandardLayer( BOARD *aBoard, PLOTTER* aPlotter, LSET aLayerMask, itemplotter.PlotBoardGraphicItems(); // Draw footprint texts: - for( MODULE* footprint : aBoard->Footprints() ) + for( FOOTPRINT* footprint : aBoard->Footprints() ) itemplotter.PlotFootprintTextItems( footprint ); // Draw footprint other graphic items: - for( MODULE* footprint : aBoard->Footprints() ) + for( FOOTPRINT* footprint : aBoard->Footprints() ) itemplotter.PlotFootprintGraphicItems( footprint ); // Plot footprint pads - for( MODULE* footprint : aBoard->Footprints() ) + for( FOOTPRINT* footprint : aBoard->Footprints() ) { aPlotter->StartBlock( NULL ); @@ -632,7 +632,7 @@ void PlotLayerOutlines( BOARD* aBoard, PLOTTER* aPlotter, LSET aLayerMask, int smallDrill = (aPlotOpt.GetDrillMarksType() == PCB_PLOT_PARAMS::SMALL_DRILL_SHAPE) ? SMALL_DRILL : INT_MAX; - for( MODULE* footprint : aBoard->Footprints() ) + for( FOOTPRINT* footprint : aBoard->Footprints() ) { for( PAD* pad : footprint->Pads() ) { @@ -727,7 +727,7 @@ void PlotSolderMaskLayer( BOARD *aBoard, PLOTTER* aPlotter, LSET aLayerMask, itemplotter.PlotBoardGraphicItems(); - for( MODULE* footprint : aBoard->Footprints() ) + for( FOOTPRINT* footprint : aBoard->Footprints() ) { for( BOARD_ITEM* item : footprint->GraphicalItems() ) { @@ -757,7 +757,7 @@ void PlotSolderMaskLayer( BOARD *aBoard, PLOTTER* aPlotter, LSET aLayerMask, #endif { // Plot pads - for( MODULE* footprint : aBoard->Footprints() ) + for( FOOTPRINT* footprint : aBoard->Footprints() ) { // add shapes with their exact mask layer size in initialPolys footprint->TransformPadsWithClearanceToPolygon( initialPolys, layer, 0, maxError, diff --git a/pcbnew/plot_brditems_plotter.cpp b/pcbnew/plot_brditems_plotter.cpp index eb5064c9b7..9a08d03026 100644 --- a/pcbnew/plot_brditems_plotter.cpp +++ b/pcbnew/plot_brditems_plotter.cpp @@ -285,9 +285,9 @@ void BRDITEMS_PLOTTER::PlotPad( PAD* aPad, COLOR4D aColor, OUTLINE_MODE aPlotMod } -void BRDITEMS_PLOTTER::PlotFootprintTextItems( MODULE* aModule ) +void BRDITEMS_PLOTTER::PlotFootprintTextItems( FOOTPRINT* aFootprint ) { - FP_TEXT* textItem = &aModule->Reference(); + FP_TEXT* textItem = &aFootprint->Reference(); LAYER_NUM textLayer = textItem->GetLayer(); // Reference and value are specfic items, not in graphic items list @@ -297,7 +297,7 @@ void BRDITEMS_PLOTTER::PlotFootprintTextItems( MODULE* aModule ) PlotFootprintTextItem( textItem, getColor( textLayer )); } - textItem = &aModule->Value(); + textItem = &aFootprint->Value(); textLayer = textItem->GetLayer(); if( GetPlotValue() && m_layerMask[textLayer] @@ -306,7 +306,7 @@ void BRDITEMS_PLOTTER::PlotFootprintTextItems( MODULE* aModule ) PlotFootprintTextItem( textItem, getColor( textLayer )); } - for( BOARD_ITEM* item : aModule->GraphicalItems() ) + for( BOARD_ITEM* item : aFootprint->GraphicalItems() ) { textItem = dyn_cast( item ); @@ -395,7 +395,7 @@ void BRDITEMS_PLOTTER::PlotFootprintTextItem( FP_TEXT* aTextMod, COLOR4D aColor GBR_METADATA gbr_metadata; gbr_metadata.SetNetAttribType( GBR_NETLIST_METADATA::GBR_NETINFO_CMP ); - MODULE* parent = static_cast ( aTextMod->GetParent() ); + FOOTPRINT* parent = static_cast ( aTextMod->GetParent() ); gbr_metadata.SetCmpReference( parent->GetReference() ); m_plotter->SetCurrentLineWidth( thickness ); @@ -514,9 +514,9 @@ void BRDITEMS_PLOTTER::PlotPcbTarget( PCB_TARGET* aMire ) // Plot footprints graphic items (outlines) -void BRDITEMS_PLOTTER::PlotFootprintGraphicItems( MODULE* aModule ) +void BRDITEMS_PLOTTER::PlotFootprintGraphicItems( FOOTPRINT* aFootprint ) { - for( BOARD_ITEM* item : aModule->GraphicalItems() ) + for( BOARD_ITEM* item : aFootprint->GraphicalItems() ) { FP_SHAPE* edge = dynamic_cast( item ); @@ -540,7 +540,7 @@ void BRDITEMS_PLOTTER::PlotFootprintGraphicItem( FP_SHAPE* aShape ) GBR_METADATA gbr_metadata; gbr_metadata.SetNetAttribType( GBR_NETLIST_METADATA::GBR_NETINFO_CMP ); - MODULE* parent = static_cast ( aShape->GetParent() ); + FOOTPRINT* parent = static_cast ( aShape->GetParent() ); gbr_metadata.SetCmpReference( parent->GetReference() ); bool isOnCopperLayer = ( m_layerMask & LSET::AllCuMask() ).any(); @@ -622,7 +622,7 @@ void BRDITEMS_PLOTTER::PlotFootprintGraphicItem( FP_SHAPE* aShape ) // We must compute board coordinates from m_PolyList which are relative to the parent // position at orientation 0 - MODULE *parentFootprint = aShape->GetParentFootprint(); + FOOTPRINT *parentFootprint = aShape->GetParentFootprint(); std::vector cornerList; diff --git a/pcbnew/plugin.cpp b/pcbnew/plugin.cpp index 4b79d44725..402bc92afb 100644 --- a/pcbnew/plugin.cpp +++ b/pcbnew/plugin.cpp @@ -73,9 +73,9 @@ void PLUGIN::PrefetchLib( const wxString& aLibraryPath, const PROPERTIES* aPrope } -const MODULE* PLUGIN::GetEnumeratedFootprint( const wxString& aLibraryPath, - const wxString& aFootprintName, - const PROPERTIES* aProperties ) +const FOOTPRINT* PLUGIN::GetEnumeratedFootprint( const wxString& aLibraryPath, + const wxString& aFootprintName, + const PROPERTIES* aProperties ) { // default implementation return FootprintLoad( aLibraryPath, aFootprintName, aProperties ); @@ -90,8 +90,8 @@ bool PLUGIN::FootprintExists( const wxString& aLibraryPath, const wxString& aFoo } -MODULE* PLUGIN::FootprintLoad( const wxString& aLibraryPath, const wxString& aFootprintName, - const PROPERTIES* aProperties ) +FOOTPRINT* PLUGIN::FootprintLoad( const wxString& aLibraryPath, const wxString& aFootprintName, + const PROPERTIES* aProperties ) { // not pure virtual so that plugins only have to implement subset of the PLUGIN interface. not_implemented( this, __FUNCTION__ ); @@ -99,7 +99,7 @@ MODULE* PLUGIN::FootprintLoad( const wxString& aLibraryPath, const wxString& aFo } -void PLUGIN::FootprintSave( const wxString& aLibraryPath, const MODULE* aFootprint, +void PLUGIN::FootprintSave( const wxString& aLibraryPath, const FOOTPRINT* aFootprint, const PROPERTIES* aProperties ) { // not pure virtual so that plugins only have to implement subset of the PLUGIN interface. diff --git a/pcbnew/plugins/altium/altium_pcb.cpp b/pcbnew/plugins/altium/altium_pcb.cpp index bde2ef91ac..88ffaa652e 100644 --- a/pcbnew/plugins/altium/altium_pcb.cpp +++ b/pcbnew/plugins/altium/altium_pcb.cpp @@ -126,7 +126,7 @@ PCB_SHAPE* ALTIUM_PCB::HelperCreateAndAddDrawsegment( uint16_t aComponent ) m_components.size() ) ); } - MODULE* footprint = m_components.at( aComponent ); + FOOTPRINT* footprint = m_components.at( aComponent ); PCB_SHAPE* fpShape = new FP_SHAPE( footprint ); footprint->Add( fpShape, ADD_MODE::APPEND ); @@ -304,7 +304,7 @@ ALTIUM_PCB::~ALTIUM_PCB() } void ALTIUM_PCB::Parse( const CFB::CompoundFileReader& aReader, - const std::map& aFileMapping ) + const std::map& aFileMapping ) { // this vector simply declares in which order which functions to call. const std::vector> parserOrder = { @@ -399,10 +399,9 @@ void ALTIUM_PCB::Parse( const CFB::CompoundFileReader& aReader, const auto& mappedDirectory = aFileMapping.find( directory ); if( mappedDirectory == aFileMapping.end() ) { - wxASSERT_MSG( !isRequired, - wxString::Format( - "Altium Directory of kind %d was expected, but no mapping is present in the code", - directory ) ); + wxASSERT_MSG( !isRequired, wxString::Format( "Altium Directory of kind %d was expected, " + "but no mapping is present in the code", + directory ) ); continue; } @@ -446,7 +445,7 @@ void ALTIUM_PCB::Parse( const CFB::CompoundFileReader& aReader, } // Finish Board by recalculating footprint boundingboxes - for( MODULE* footprint : m_board->Footprints() ) + for( FOOTPRINT* footprint : m_board->Footprints() ) footprint->CalculateBoundingBox(); // Otherwise we cannot save the imported board @@ -504,8 +503,8 @@ const ARULE6* ALTIUM_PCB::GetRuleDefault( ALTIUM_RULE_KIND aKind ) const return nullptr; } -void ALTIUM_PCB::ParseFileHeader( - const CFB::CompoundFileReader& aReader, const CFB::COMPOUND_FILE_ENTRY* aEntry ) +void ALTIUM_PCB::ParseFileHeader( const CFB::CompoundFileReader& aReader, + const CFB::COMPOUND_FILE_ENTRY* aEntry ) { ALTIUM_PARSER reader( aReader, aEntry ); @@ -523,8 +522,8 @@ void ALTIUM_PCB::ParseFileHeader( //} } -void ALTIUM_PCB::ParseBoard6Data( - const CFB::CompoundFileReader& aReader, const CFB::COMPOUND_FILE_ENTRY* aEntry ) +void ALTIUM_PCB::ParseBoard6Data( const CFB::CompoundFileReader& aReader, + const CFB::COMPOUND_FILE_ENTRY* aEntry ) { ALTIUM_PARSER reader( aReader, aEntry ); @@ -703,8 +702,8 @@ void ALTIUM_PCB::HelperCreateBoardOutline( const std::vector& aV } } -void ALTIUM_PCB::ParseClasses6Data( - const CFB::CompoundFileReader& aReader, const CFB::COMPOUND_FILE_ENTRY* aEntry ) +void ALTIUM_PCB::ParseClasses6Data( const CFB::CompoundFileReader& aReader, + const CFB::COMPOUND_FILE_ENTRY* aEntry ) { ALTIUM_PARSER reader( aReader, aEntry ); @@ -739,8 +738,8 @@ void ALTIUM_PCB::ParseClasses6Data( m_board->m_LegacyNetclassesLoaded = true; } -void ALTIUM_PCB::ParseComponents6Data( - const CFB::CompoundFileReader& aReader, const CFB::COMPOUND_FILE_ENTRY* aEntry ) +void ALTIUM_PCB::ParseComponents6Data( const CFB::CompoundFileReader& aReader, + const CFB::COMPOUND_FILE_ENTRY* aEntry ) { ALTIUM_PARSER reader( aReader, aEntry ); @@ -749,7 +748,7 @@ void ALTIUM_PCB::ParseComponents6Data( { ACOMPONENT6 elem( reader ); - MODULE* footprint = new MODULE( m_board ); + FOOTPRINT* footprint = new FOOTPRINT( m_board ); m_board->Add( footprint, ADD_MODE::APPEND ); m_components.emplace_back( footprint ); @@ -782,8 +781,8 @@ void ALTIUM_PCB::ParseComponents6Data( } -void ALTIUM_PCB::ParseComponentsBodies6Data( - const CFB::CompoundFileReader& aReader, const CFB::COMPOUND_FILE_ENTRY* aEntry ) +void ALTIUM_PCB::ParseComponentsBodies6Data( const CFB::CompoundFileReader& aReader, + const CFB::COMPOUND_FILE_ENTRY* aEntry ) { ALTIUM_PARSER reader( aReader, aEntry ); @@ -816,7 +815,7 @@ void ALTIUM_PCB::ParseComponentsBodies6Data( elem.modelId ) ); } - MODULE* footprint = m_components.at( elem.component ); + FOOTPRINT* footprint = m_components.at( elem.component ); const wxPoint& fpPosition = footprint->GetPosition(); FP_3DMODEL modelSettings; @@ -865,9 +864,9 @@ void ALTIUM_PCB::HelperParseDimensions6Linear( const ADIMENSION6& aElem ) if( klayer == UNDEFINED_LAYER ) { - wxLogWarning( wxString::Format( - _( "Dimension on Altium layer %d has no KiCad equivalent. Put it on Eco1_User instead" ), - aElem.layer ) ); + wxLogWarning( wxString::Format( _( "Dimension on Altium layer %d has no KiCad equivalent. " + "Put it on Eco1_User instead" ), + aElem.layer ) ); klayer = Eco1_User; } @@ -942,9 +941,9 @@ void ALTIUM_PCB::HelperParseDimensions6Leader( const ADIMENSION6& aElem ) PCB_LAYER_ID klayer = GetKicadLayer( aElem.layer ); if( klayer == UNDEFINED_LAYER ) { - wxLogWarning( wxString::Format( - _( "Dimension on Altium layer %d has no KiCad equivalent. Put it on Eco1_User instead" ), - aElem.layer ) ); + wxLogWarning( wxString::Format( _( "Dimension on Altium layer %d has no KiCad equivalent. " + "Put it on Eco1_User instead" ), + aElem.layer ) ); klayer = Eco1_User; } @@ -1020,9 +1019,9 @@ void ALTIUM_PCB::HelperParseDimensions6Datum( const ADIMENSION6& aElem ) PCB_LAYER_ID klayer = GetKicadLayer( aElem.layer ); if( klayer == UNDEFINED_LAYER ) { - wxLogWarning( wxString::Format( - _( "Dimension on Altium layer %d has no KiCad equivalent. Put it on Eco1_User instead" ), - aElem.layer ) ); + wxLogWarning( wxString::Format( _( "Dimension on Altium layer %d has no KiCad equivalent. " + "Put it on Eco1_User instead" ), + aElem.layer ) ); klayer = Eco1_User; } @@ -1043,9 +1042,9 @@ void ALTIUM_PCB::HelperParseDimensions6Center( const ADIMENSION6& aElem ) PCB_LAYER_ID klayer = GetKicadLayer( aElem.layer ); if( klayer == UNDEFINED_LAYER ) { - wxLogWarning( wxString::Format( - _( "Dimension on Altium layer %d has no KiCad equivalent. Put it on Eco1_User instead" ), - aElem.layer ) ); + wxLogWarning( wxString::Format( _( "Dimension on Altium layer %d has no KiCad equivalent. " + "Put it on Eco1_User instead" ), + aElem.layer ) ); klayer = Eco1_User; } @@ -1061,8 +1060,8 @@ void ALTIUM_PCB::HelperParseDimensions6Center( const ADIMENSION6& aElem ) } -void ALTIUM_PCB::ParseDimensions6Data( - const CFB::CompoundFileReader& aReader, const CFB::COMPOUND_FILE_ENTRY* aEntry ) +void ALTIUM_PCB::ParseDimensions6Data( const CFB::CompoundFileReader& aReader, + const CFB::COMPOUND_FILE_ENTRY* aEntry ) { ALTIUM_PARSER reader( aReader, aEntry ); @@ -1099,7 +1098,7 @@ void ALTIUM_PCB::ParseDimensions6Data( void ALTIUM_PCB::ParseModelsData( const CFB::CompoundFileReader& aReader, - const CFB::COMPOUND_FILE_ENTRY* aEntry, const wxString aRootDir ) + const CFB::COMPOUND_FILE_ENTRY* aEntry, const wxString aRootDir ) { ALTIUM_PARSER reader( aReader, aEntry ); @@ -1175,8 +1174,8 @@ void ALTIUM_PCB::ParseModelsData( const CFB::CompoundFileReader& aReader, } -void ALTIUM_PCB::ParseNets6Data( - const CFB::CompoundFileReader& aReader, const CFB::COMPOUND_FILE_ENTRY* aEntry ) +void ALTIUM_PCB::ParseNets6Data( const CFB::CompoundFileReader& aReader, + const CFB::COMPOUND_FILE_ENTRY* aEntry ) { ALTIUM_PARSER reader( aReader, aEntry ); @@ -1194,8 +1193,8 @@ void ALTIUM_PCB::ParseNets6Data( } } -void ALTIUM_PCB::ParsePolygons6Data( - const CFB::CompoundFileReader& aReader, const CFB::COMPOUND_FILE_ENTRY* aEntry ) +void ALTIUM_PCB::ParsePolygons6Data( const CFB::CompoundFileReader& aReader, + const CFB::COMPOUND_FILE_ENTRY* aEntry ) { ALTIUM_PARSER reader( aReader, aEntry ); @@ -1206,9 +1205,9 @@ void ALTIUM_PCB::ParsePolygons6Data( PCB_LAYER_ID klayer = GetKicadLayer( elem.layer ); if( klayer == UNDEFINED_LAYER ) { - wxLogWarning( wxString::Format( - _( "Polygon on Altium layer %d has no KiCad equivalent. Ignore it instead" ), - elem.layer ) ); + wxLogWarning( wxString::Format( _( "Polygon on Altium layer %d has no KiCad equivalent. " + "Ignore it instead" ), + elem.layer ) ); m_polygons.emplace_back( nullptr ); continue; } @@ -1218,9 +1217,10 @@ void ALTIUM_PCB::ParsePolygons6Data( if( linechain.PointCount() < 2 ) { - wxLogError( wxString::Format( - _( "Polygon has only %d point extracted from %ld vertices. At least 2 points are required." ), - linechain.PointCount(), elem.vertices.size() ) ); + wxLogError( wxString::Format( _( "Polygon has only %d point extracted from %ld vertices. " + "At least 2 points are required." ), + linechain.PointCount(), + elem.vertices.size() ) ); m_polygons.emplace_back( nullptr ); continue; } @@ -1321,8 +1321,8 @@ void ALTIUM_PCB::ParsePolygons6Data( } } -void ALTIUM_PCB::ParseRules6Data( - const CFB::CompoundFileReader& aReader, const CFB::COMPOUND_FILE_ENTRY* aEntry ) +void ALTIUM_PCB::ParseRules6Data( const CFB::CompoundFileReader& aReader, + const CFB::COMPOUND_FILE_ENTRY* aEntry ) { ALTIUM_PARSER reader( aReader, aEntry ); @@ -1337,7 +1337,10 @@ void ALTIUM_PCB::ParseRules6Data( for( auto&& val : m_rules ) { std::sort( val.second.begin(), val.second.end(), - []( const auto& lhs, const auto& rhs ) { return lhs.priority < rhs.priority; } ); + []( const auto& lhs, const auto& rhs ) + { + return lhs.priority < rhs.priority; + } ); } if( reader.GetRemainingBytes() != 0 ) @@ -1346,8 +1349,8 @@ void ALTIUM_PCB::ParseRules6Data( } } -void ALTIUM_PCB::ParseBoardRegionsData( - const CFB::CompoundFileReader& aReader, const CFB::COMPOUND_FILE_ENTRY* aEntry ) +void ALTIUM_PCB::ParseBoardRegionsData( const CFB::CompoundFileReader& aReader, + const CFB::COMPOUND_FILE_ENTRY* aEntry ) { ALTIUM_PARSER reader( aReader, aEntry ); @@ -1364,8 +1367,8 @@ void ALTIUM_PCB::ParseBoardRegionsData( } } -void ALTIUM_PCB::ParseShapeBasedRegions6Data( - const CFB::CompoundFileReader& aReader, const CFB::COMPOUND_FILE_ENTRY* aEntry ) +void ALTIUM_PCB::ParseShapeBasedRegions6Data( const CFB::CompoundFileReader& aReader, + const CFB::COMPOUND_FILE_ENTRY* aEntry ) { ALTIUM_PARSER reader( aReader, aEntry ); @@ -1413,9 +1416,9 @@ void ALTIUM_PCB::ParseShapeBasedRegions6Data( PCB_LAYER_ID klayer = GetKicadLayer( elem.layer ); if( klayer == UNDEFINED_LAYER ) { - wxLogWarning( wxString::Format( - _( "Zone on Altium layer %d has no KiCad equivalent. Put it on Eco1_User instead" ), - elem.layer ) ); + wxLogWarning( wxString::Format( _( "Zone on Altium layer %d has no KiCad " + "equivalent. Put it on Eco1_User instead" ), + elem.layer ) ); klayer = Eco1_User; } zone->SetLayer( klayer ); @@ -1431,9 +1434,9 @@ void ALTIUM_PCB::ParseShapeBasedRegions6Data( PCB_LAYER_ID klayer = GetKicadLayer( elem.layer ); if( klayer == UNDEFINED_LAYER ) { - wxLogWarning( wxString::Format( - _( "Polygon on Altium layer %d has no KiCad equivalent. Put it on Eco1_User instead" ), - elem.layer ) ); + wxLogWarning( wxString::Format( _( "Polygon on Altium layer %d has no KiCad " + "equivalent. Put it on Eco1_User instead" ), + elem.layer ) ); klayer = Eco1_User; } @@ -1442,9 +1445,10 @@ void ALTIUM_PCB::ParseShapeBasedRegions6Data( if( linechain.PointCount() < 2 ) { - wxLogError( wxString::Format( - _( "Polygon has only %d point extracted from %ld vertices. At least 2 points are required." ), - linechain.PointCount(), elem.vertices.size() ) ); + wxLogError( wxString::Format( _( "Polygon has only %d point extracted from %ld " + "vertices. At least 2 points are required." ), + linechain.PointCount(), + elem.vertices.size() ) ); continue; } @@ -1459,9 +1463,10 @@ void ALTIUM_PCB::ParseShapeBasedRegions6Data( } else { - wxLogError( wxString::Format( - "Ignore polygon shape of kind %d on layer %s, because not implemented yet", - elem.kind, LSET::Name( GetKicadLayer( elem.layer ) ) ) ); + wxLogError( wxString::Format( "Ignore polygon shape of kind %d on layer %s, because " + "not implemented yet", + elem.kind, + LSET::Name( GetKicadLayer( elem.layer ) ) ) ); } } @@ -1471,8 +1476,8 @@ void ALTIUM_PCB::ParseShapeBasedRegions6Data( } } -void ALTIUM_PCB::ParseRegions6Data( - const CFB::CompoundFileReader& aReader, const CFB::COMPOUND_FILE_ENTRY* aEntry ) +void ALTIUM_PCB::ParseRegions6Data( const CFB::CompoundFileReader& aReader, + const CFB::COMPOUND_FILE_ENTRY* aEntry ) { ALTIUM_PARSER reader( aReader, aEntry ); @@ -1588,9 +1593,9 @@ void ALTIUM_PCB::ParseArcs6Data( const CFB::CompoundFileReader& aReader, PCB_LAYER_ID klayer = GetKicadLayer( elem.layer ); if( klayer == UNDEFINED_LAYER ) { - wxLogWarning( wxString::Format( - _( "Arc Keepout on Altium layer %d has no KiCad equivalent. Put it on Eco1_User instead" ), - elem.layer ) ); + wxLogWarning( wxString::Format( _( "Arc Keepout on Altium layer %d has no " + "KiCad equivalent. Put it on Eco1_User instead" ), + elem.layer ) ); klayer = Eco1_User; } zone->SetLayer( klayer ); @@ -1607,9 +1612,9 @@ void ALTIUM_PCB::ParseArcs6Data( const CFB::CompoundFileReader& aReader, if( klayer == UNDEFINED_LAYER ) { - wxLogWarning( wxString::Format( - _( "Arc on Altium layer %d has no KiCad equivalent. Put it on Eco1_User instead" ), - elem.layer ) ); + wxLogWarning( wxString::Format( _( "Arc on Altium layer %d has no KiCad equivalent. " + "Put it on Eco1_User instead" ), + elem.layer ) ); klayer = Eco1_User; } @@ -1680,11 +1685,11 @@ void ALTIUM_PCB::ParsePads6Data( const CFB::CompoundFileReader& aReader, } // Create Pad - MODULE* footprint = nullptr; + FOOTPRINT* footprint = nullptr; if( elem.component == ALTIUM_COMPONENT_NONE ) { - footprint = new MODULE( m_board ); // We cannot add a pad directly into the PCB + footprint = new FOOTPRINT( m_board ); // We cannot add a pad directly into the PCB m_board->Add( footprint, ADD_MODE::APPEND ); footprint->SetPosition( elem.position ); } @@ -1742,9 +1747,10 @@ void ALTIUM_PCB::ParsePads6Data( const CFB::CompoundFileReader& aReader, break; case ALTIUM_PAD_HOLE_SHAPE::SQUARE: - wxLogWarning( wxString::Format( - _( "Pad '%s' of Footprint %s has a square hole. KiCad does not support this yet" ), - elem.name, footprint->GetReference() ) ); + wxLogWarning( wxString::Format( _( "Pad '%s' of Footprint %s has a square hole. " + "KiCad does not support this yet" ), + elem.name, + footprint->GetReference() ) ); pad->SetDrillShape( PAD_DRILL_SHAPE_T::PAD_DRILL_SHAPE_CIRCLE ); pad->SetDrillSize( wxSize( elem.holesize, elem.holesize ) ); // Workaround // TODO: elem.sizeAndShape->slotsize was 0 in testfile. Either use holesize in this case or rect holes have a different id @@ -1763,9 +1769,12 @@ void ALTIUM_PCB::ParsePads6Data( const CFB::CompoundFileReader& aReader, { if( normalizedSlotrotation != 90. && normalizedSlotrotation != 270. ) { - wxLogWarning( wxString::Format( - _( "Pad '%s' of Footprint %s has a hole-rotation of %f degree. KiCad only supports 90 degree angles" ), - elem.name, footprint->GetReference(), normalizedSlotrotation ) ); + wxLogWarning( wxString::Format( _( "Pad '%s' of Footprint %s has a " + "hole-rotation of %f degree. KiCad " + "only supports 90 degree angles" ), + elem.name, + footprint->GetReference(), + normalizedSlotrotation ) ); } pad->SetDrillSize( wxSize( elem.holesize, elem.sizeAndShape->slotsize ) ); @@ -2217,8 +2226,8 @@ void ALTIUM_PCB::ParseTracks6Data( const CFB::CompoundFileReader& aReader, } } -void ALTIUM_PCB::ParseTexts6Data( - const CFB::CompoundFileReader& aReader, const CFB::COMPOUND_FILE_ENTRY* aEntry ) +void ALTIUM_PCB::ParseTexts6Data( const CFB::CompoundFileReader& aReader, + const CFB::COMPOUND_FILE_ENTRY* aEntry ) { ALTIUM_PARSER reader( aReader, aEntry ); @@ -2255,8 +2264,8 @@ void ALTIUM_PCB::ParseTexts6Data( m_components.size() ) ); } - MODULE* footprint = m_components.at( elem.component ); - FP_TEXT* fpText; + FOOTPRINT* footprint = m_components.at( elem.component ); + FP_TEXT* fpText; if( elem.isDesignator ) { @@ -2301,12 +2310,12 @@ void ALTIUM_PCB::ParseTexts6Data( if( elem.component != ALTIUM_COMPONENT_NONE ) { - FP_TEXT* fpText = dynamic_cast( tx ); + FP_TEXT* fpText = dynamic_cast( tx ); + FOOTPRINT* parentFootprint = static_cast( fpText->GetParent() ); if( fpText ) { - double orientation = - static_cast( fpText->GetParent() )->GetOrientation(); + double orientation = parentFootprint->GetOrientation(); fpText->SetTextAngle( fpText->GetTextAngle() - orientation ); fpText->SetLocalCoord(); } diff --git a/pcbnew/plugins/altium/altium_pcb.h b/pcbnew/plugins/altium/altium_pcb.h index bae3ecdaee..9e767b9b6e 100644 --- a/pcbnew/plugins/altium/altium_pcb.h +++ b/pcbnew/plugins/altium/altium_pcb.h @@ -83,7 +83,7 @@ enum class ALTIUM_PCB_DIR class BOARD; class PCB_SHAPE; -class MODULE; +class FOOTPRINT; class ZONE; @@ -183,7 +183,7 @@ private: void HelperDrawsegmentSetLocalCoord( PCB_SHAPE* aShape, uint16_t aComponent ); BOARD* m_board; - std::vector m_components; + std::vector m_components; std::vector m_polygons; std::map m_models; size_t m_num_nets; diff --git a/pcbnew/plugins/cadstar/cadstar_pcb_archive_loader.cpp b/pcbnew/plugins/cadstar/cadstar_pcb_archive_loader.cpp index b73c6c292b..83d4c37018 100644 --- a/pcbnew/plugins/cadstar/cadstar_pcb_archive_loader.cpp +++ b/pcbnew/plugins/cadstar/cadstar_pcb_archive_loader.cpp @@ -608,7 +608,7 @@ void CADSTAR_PCB_ARCHIVE_LOADER::loadComponentLibrary() wxString fpName = component.ReferenceName + ( ( component.Alternate.size() > 0 ) ? ( wxT( " (" ) + component.Alternate + wxT( ")" ) ) : wxT( "" ) ); - MODULE* footprint = new MODULE( mBoard ); + FOOTPRINT* footprint = new FOOTPRINT( mBoard ); footprint->SetPosition( getKiCadPoint( component.Origin ) ); LIB_ID libID; @@ -626,7 +626,7 @@ void CADSTAR_PCB_ARCHIVE_LOADER::loadComponentLibrary() void CADSTAR_PCB_ARCHIVE_LOADER::loadLibraryFigures( const SYMDEF_PCB& aComponent, - MODULE* aFootprint ) + FOOTPRINT* aFootprint ) { for( std::pair figPair : aComponent.Figures ) { @@ -643,7 +643,7 @@ void CADSTAR_PCB_ARCHIVE_LOADER::loadLibraryFigures( const SYMDEF_PCB& aComponen } -void CADSTAR_PCB_ARCHIVE_LOADER::loadLibraryCoppers( const SYMDEF_PCB& aComponent, MODULE* aFootprint ) +void CADSTAR_PCB_ARCHIVE_LOADER::loadLibraryCoppers( const SYMDEF_PCB& aComponent, FOOTPRINT* aFootprint ) { for( COMPONENT_COPPER compCopper : aComponent.ComponentCoppers ) { @@ -659,7 +659,7 @@ void CADSTAR_PCB_ARCHIVE_LOADER::loadLibraryCoppers( const SYMDEF_PCB& aComponen void CADSTAR_PCB_ARCHIVE_LOADER::loadLibraryAreas( const SYMDEF_PCB& aComponent, - MODULE* aFootprint ) + FOOTPRINT* aFootprint ) { for( std::pair areaPair : aComponent.ComponentAreas ) { @@ -705,7 +705,7 @@ void CADSTAR_PCB_ARCHIVE_LOADER::loadLibraryAreas( const SYMDEF_PCB& aComponent, void CADSTAR_PCB_ARCHIVE_LOADER::loadLibraryPads( const SYMDEF_PCB& aComponent, - MODULE* aFootprint ) + FOOTPRINT* aFootprint ) { for( std::pair padPair : aComponent.ComponentPads ) { @@ -716,7 +716,7 @@ void CADSTAR_PCB_ARCHIVE_LOADER::loadLibraryPads( const SYMDEF_PCB& aComponent, } -PAD* CADSTAR_PCB_ARCHIVE_LOADER::getKiCadPad( const COMPONENT_PAD& aCadstarPad, MODULE* aParent ) +PAD* CADSTAR_PCB_ARCHIVE_LOADER::getKiCadPad( const COMPONENT_PAD& aCadstarPad, FOOTPRINT* aParent ) { PADCODE csPadcode = getPadCode( aCadstarPad.PadCodeID ); @@ -1203,7 +1203,7 @@ void CADSTAR_PCB_ARCHIVE_LOADER::loadComponents() } // copy constructor to clone the footprint from the library - MODULE* footprint = new MODULE( *fpIter->second ); + FOOTPRINT* footprint = new FOOTPRINT( *fpIter->second ); const_cast( footprint->m_Uuid ) = KIID(); mBoard->Add( footprint, ADD_MODE::APPEND ); @@ -1582,27 +1582,28 @@ void CADSTAR_PCB_ARCHIVE_LOADER::loadNets() for( std::pair pinPair : net.Pins ) { NET_PCB::PIN pin = pinPair.second; - MODULE* m = getModuleFromCadstarID( pin.ComponentID ); + FOOTPRINT* footprint = getFootprintFromCadstarID( pin.ComponentID ); - if( m == nullptr ) + if( footprint == nullptr ) { wxLogWarning( wxString::Format( _( "The net '%s' references component ID '%s' which does not exist. " "This has been ignored." ), netnameForErrorReporting, pin.ComponentID ) ); } - else if( ( pin.PadID - (long) 1 ) > m->Pads().size() ) + else if( ( pin.PadID - (long) 1 ) > footprint->Pads().size() ) { - wxLogWarning( wxString::Format( - _( "The net '%s' references non-existent pad index '%d' in component '%s'. " - "This has been ignored." ), - netnameForErrorReporting, pin.PadID, m->GetReference() ) ); + wxLogWarning( wxString::Format( _( "The net '%s' references non-existent pad index" + " '%d' in component '%s'. This has been ignored." ), + netnameForErrorReporting, + pin.PadID, + footprint->GetReference() ) ); } else { // The below works because we have added the pads in the correct order to the // footprint and the PAD_ID in Cadstar is a sequential, numerical ID - m->Pads().at( pin.PadID - (long) 1 )->SetNet( getKiCadNet( net.ID ) ); + footprint->Pads().at( pin.PadID - (long) 1 )->SetNet( getKiCadNet( net.ID ) ); } } } @@ -1610,7 +1611,7 @@ void CADSTAR_PCB_ARCHIVE_LOADER::loadNets() void CADSTAR_PCB_ARCHIVE_LOADER::loadComponentAttributes( const COMPONENT& aComponent, - MODULE* aFootprint ) + FOOTPRINT* aFootprint ) { for( std::pair attrPair : aComponent.AttributeValues ) { @@ -1867,10 +1868,16 @@ void CADSTAR_PCB_ARCHIVE_LOADER::drawCadstarText( const TEXT& aCadstarText, void CADSTAR_PCB_ARCHIVE_LOADER::drawCadstarShape( const SHAPE& aCadstarShape, - const PCB_LAYER_ID& aKiCadLayer, const int& aLineThickness, const wxString& aShapeName, - BOARD_ITEM_CONTAINER* aContainer, const GROUP_ID& aCadstarGroupID, - const wxPoint& aMoveVector, const double& aRotationAngle, const double& aScalingFactor, - const wxPoint& aTransformCentre, const bool& aMirrorInvert ) + const PCB_LAYER_ID& aKiCadLayer, + const int& aLineThickness, + const wxString& aShapeName, + BOARD_ITEM_CONTAINER* aContainer, + const GROUP_ID& aCadstarGroupID, + const wxPoint& aMoveVector, + const double& aRotationAngle, + const double& aScalingFactor, + const wxPoint& aTransformCentre, + const bool& aMirrorInvert ) { switch( aCadstarShape.Type ) { @@ -1896,8 +1903,10 @@ void CADSTAR_PCB_ARCHIVE_LOADER::drawCadstarShape( const SHAPE& aCadstarShape, { PCB_SHAPE* shape; - if( isModule( aContainer ) ) - shape = new FP_SHAPE( (MODULE*) aContainer, S_POLYGON ); + if( isFootprint( aContainer ) ) + { + shape = new FP_SHAPE( (FOOTPRINT*) aContainer, S_POLYGON ); + } else { shape = new PCB_SHAPE( aContainer ); @@ -1919,16 +1928,21 @@ void CADSTAR_PCB_ARCHIVE_LOADER::drawCadstarShape( const SHAPE& aCadstarShape, void CADSTAR_PCB_ARCHIVE_LOADER::drawCadstarCutoutsAsSegments( const std::vector& aCutouts, - const PCB_LAYER_ID& aKiCadLayer, const int& aLineThickness, - BOARD_ITEM_CONTAINER* aContainer, const GROUP_ID& aCadstarGroupID, - const wxPoint& aMoveVector, const double& aRotationAngle, const double& aScalingFactor, - const wxPoint& aTransformCentre, const bool& aMirrorInvert ) + const PCB_LAYER_ID& aKiCadLayer, + const int& aLineThickness, + BOARD_ITEM_CONTAINER* aContainer, + const GROUP_ID& aCadstarGroupID, + const wxPoint& aMoveVector, + const double& aRotationAngle, + const double& aScalingFactor, + const wxPoint& aTransformCentre, + const bool& aMirrorInvert ) { for( CUTOUT cutout : aCutouts ) { drawCadstarVerticesAsSegments( cutout.Vertices, aKiCadLayer, aLineThickness, aContainer, - aCadstarGroupID, aMoveVector, aRotationAngle, aScalingFactor, aTransformCentre, - aMirrorInvert ); + aCadstarGroupID, aMoveVector, aRotationAngle, aScalingFactor, + aTransformCentre, aMirrorInvert ); } } @@ -2009,9 +2023,9 @@ PCB_SHAPE* CADSTAR_PCB_ARCHIVE_LOADER::getDrawSegmentFromVertex( const POINT& aC case VERTEX_TYPE::POINT: - if( isModule( aContainer ) ) + if( isFootprint( aContainer ) ) { - ds = new FP_SHAPE( static_cast( aContainer ), S_SEGMENT ); + ds = new FP_SHAPE( static_cast( aContainer ), S_SEGMENT ); } else { @@ -2031,9 +2045,9 @@ PCB_SHAPE* CADSTAR_PCB_ARCHIVE_LOADER::getDrawSegmentFromVertex( const POINT& aC case VERTEX_TYPE::ANTICLOCKWISE_SEMICIRCLE: case VERTEX_TYPE::ANTICLOCKWISE_ARC: - if( isModule( aContainer ) ) + if( isFootprint( aContainer ) ) { - ds = new FP_SHAPE((MODULE*) aContainer, S_ARC ); + ds = new FP_SHAPE((FOOTPRINT*) aContainer, S_ARC ); } else { @@ -2075,7 +2089,7 @@ PCB_SHAPE* CADSTAR_PCB_ARCHIVE_LOADER::getDrawSegmentFromVertex( const POINT& aC if( aMoveVector != wxPoint{ 0, 0 } ) ds->Move( aMoveVector ); - if( isModule( aContainer ) && ds != nullptr ) + if( isFootprint( aContainer ) && ds != nullptr ) static_cast( ds )->SetLocalCoord(); if( !aCadstarGroupID.IsEmpty() ) @@ -2089,7 +2103,7 @@ ZONE* CADSTAR_PCB_ARCHIVE_LOADER::getZoneFromCadstarShape( const SHAPE& aCadstar const int& aLineThickness, BOARD_ITEM_CONTAINER* aParentContainer ) { - ZONE* zone = new ZONE( aParentContainer, isModule( aParentContainer ) ); + ZONE* zone = new ZONE( aParentContainer, isFootprint( aParentContainer ) ); if( aCadstarShape.Type == SHAPE_TYPE::HATCHED ) { @@ -2113,15 +2127,23 @@ ZONE* CADSTAR_PCB_ARCHIVE_LOADER::getZoneFromCadstarShape( const SHAPE& aCadstar SHAPE_POLY_SET CADSTAR_PCB_ARCHIVE_LOADER::getPolySetFromCadstarShape( const SHAPE& aCadstarShape, - const int& aLineThickness, BOARD_ITEM_CONTAINER* aContainer, const wxPoint& aMoveVector, - const double& aRotationAngle, const double& aScalingFactor, const wxPoint& aTransformCentre, - const bool& aMirrorInvert ) + const int& aLineThickness, + BOARD_ITEM_CONTAINER* aContainer, + const wxPoint& aMoveVector, + const double& aRotationAngle, + const double& aScalingFactor, + const wxPoint& aTransformCentre, + const bool& aMirrorInvert ) { GROUP_ID noGroup = wxEmptyString; - std::vector outlineSegments = - getDrawSegmentsFromVertices( aCadstarShape.Vertices, aContainer, noGroup, aMoveVector, - aRotationAngle, aScalingFactor, aTransformCentre, aMirrorInvert ); + std::vector outlineSegments = getDrawSegmentsFromVertices( aCadstarShape.Vertices, + aContainer, noGroup, + aMoveVector, + aRotationAngle, + aScalingFactor, + aTransformCentre, + aMirrorInvert ); SHAPE_POLY_SET polySet( getLineChainFromDrawsegments( outlineSegments ) ); @@ -2131,9 +2153,13 @@ SHAPE_POLY_SET CADSTAR_PCB_ARCHIVE_LOADER::getPolySetFromCadstarShape( const SHA for( CUTOUT cutout : aCadstarShape.Cutouts ) { - std::vector cutoutSeg = - getDrawSegmentsFromVertices( cutout.Vertices, aContainer, noGroup, aMoveVector, - aRotationAngle, aScalingFactor, aTransformCentre, aMirrorInvert ); + std::vector cutoutSeg = getDrawSegmentsFromVertices( cutout.Vertices, + aContainer, noGroup, + aMoveVector, + aRotationAngle, + aScalingFactor, + aTransformCentre, + aMirrorInvert ); polySet.AddHole( getLineChainFromDrawsegments( cutoutSeg ) ); @@ -2143,8 +2169,7 @@ SHAPE_POLY_SET CADSTAR_PCB_ARCHIVE_LOADER::getPolySetFromCadstarShape( const SHA } if( aLineThickness > 0 ) - polySet.Inflate( - aLineThickness / 2, 32, SHAPE_POLY_SET::CORNER_STRATEGY::ROUND_ALL_CORNERS ); + polySet.Inflate( aLineThickness / 2, 32, SHAPE_POLY_SET::CORNER_STRATEGY::ROUND_ALL_CORNERS ); //Make a new polyset with no holes //TODO: Using strictly simple to be safe, but need to find out if PM_FAST works okay @@ -2166,8 +2191,7 @@ SHAPE_POLY_SET CADSTAR_PCB_ARCHIVE_LOADER::getPolySetFromCadstarShape( const SHA } -SHAPE_LINE_CHAIN CADSTAR_PCB_ARCHIVE_LOADER::getLineChainFromDrawsegments( - const std::vector aDrawsegments ) +SHAPE_LINE_CHAIN CADSTAR_PCB_ARCHIVE_LOADER::getLineChainFromDrawsegments( const std::vector aDrawsegments ) { SHAPE_LINE_CHAIN lineChain; @@ -2288,7 +2312,7 @@ std::vector CADSTAR_PCB_ARCHIVE_LOADER::makeTracksFromDrawsegments( void CADSTAR_PCB_ARCHIVE_LOADER::addAttribute( const ATTRIBUTE_LOCATION& aCadstarAttrLoc, const ATTRIBUTE_ID& aCadstarAttributeID, - MODULE* aFootprint, + FOOTPRINT* aFootprint, const wxString& aAttributeValue ) { FP_TEXT* txt; @@ -2639,8 +2663,7 @@ void CADSTAR_PCB_ARCHIVE_LOADER::checkAndLogHatchCode( const HATCHCODE_ID& aCads } -MODULE* CADSTAR_PCB_ARCHIVE_LOADER::getModuleFromCadstarID( - const COMPONENT_ID& aCadstarComponentID ) +FOOTPRINT* CADSTAR_PCB_ARCHIVE_LOADER::getFootprintFromCadstarID( const COMPONENT_ID& aCadstarComponentID ) { if( mComponentMap.find( aCadstarComponentID ) == mComponentMap.end() ) return nullptr; @@ -2690,7 +2713,7 @@ NETINFO_ITEM* CADSTAR_PCB_ARCHIVE_LOADER::getKiCadNet( const NET_ID& aCadstarNet NET_PCB::PIN firstPin = ( *csNet.Pins.begin() ).second; //we should have already loaded the component with loadComponents() : - MODULE* m = getModuleFromCadstarID( firstPin.ComponentID ); + FOOTPRINT* m = getFootprintFromCadstarID( firstPin.ComponentID ); newName = wxT( "Net-(" ); newName << m->Reference().GetText(); newName << "-Pad" << wxString::Format( "%ld", firstPin.PadID ) << ")"; diff --git a/pcbnew/plugins/cadstar/cadstar_pcb_archive_loader.h b/pcbnew/plugins/cadstar/cadstar_pcb_archive_loader.h index e42f8700b3..8b14ea35da 100644 --- a/pcbnew/plugins/cadstar/cadstar_pcb_archive_loader.h +++ b/pcbnew/plugins/cadstar/cadstar_pcb_archive_loader.h @@ -54,12 +54,12 @@ public: ~CADSTAR_PCB_ARCHIVE_LOADER() { - for( std::pair libItem : mLibraryMap ) + for( std::pair libItem : mLibraryMap ) { - MODULE* mod = libItem.second; + FOOTPRINT* footprint = libItem.second; - if( mod ) - delete mod; + if( footprint ) + delete footprint; } } @@ -76,18 +76,18 @@ private: ::BOARD* mBoard; std::map mLayermap; ///< Map between Cadstar and KiCad Layers. ///< Populated by loadBoardStackup(). - std::map mLibraryMap; ///< Map between Cadstar and KiCad + std::map mLibraryMap; ///< Map between Cadstar and KiCad ///< components in the library. Populated ///< by loadComponentLibrary(). Owns the - ///< MODULE objects. - std::map mGroupMap; ///< Map between Cadstar and KiCad + ///< FOOTPRINT objects. + std::map mGroupMap; ///< Map between Cadstar and KiCad ///< groups. Does NOT ownthe PCB_GROUP ///< objects (these should have been ///< loaded to mBoard). - std::map mComponentMap; ///< Map between Cadstar and KiCad + std::map mComponentMap; ///< Map between Cadstar and KiCad ///< components on the board. Does NOT own - ///< the MODULE objects (these should have - ///< been loaded to mBoard). + ///< the FOOTPRINT objects (these should + ///< have been loaded to mBoard). std::map mNetMap; ///< Map between Cadstar and KiCad Nets std::map mNetClassMap; ///< Map between Cadstar and KiCad classes std::map mCopperLayers; ///< Map of CADSTAR Physical layers to @@ -133,11 +133,11 @@ private: const PCB_LAYER_ID& aKiCadLayer ); void logBoardStackupMessage( const wxString& aCadstarLayerName, const PCB_LAYER_ID& aKiCadLayer ); - void loadLibraryFigures( const SYMDEF_PCB& aComponent, MODULE* aFootprint ); - void loadLibraryCoppers( const SYMDEF_PCB& aComponent, MODULE* aFootprint ); - void loadLibraryAreas( const SYMDEF_PCB& aComponent, MODULE* aFootprint ); - void loadLibraryPads( const SYMDEF_PCB& aComponent, MODULE* aFootprint ); - void loadComponentAttributes( const COMPONENT& aComponent, MODULE* aFootprint ); + void loadLibraryFigures( const SYMDEF_PCB& aComponent, FOOTPRINT* aFootprint ); + void loadLibraryCoppers( const SYMDEF_PCB& aComponent, FOOTPRINT* aFootprint ); + void loadLibraryAreas( const SYMDEF_PCB& aComponent, FOOTPRINT* aFootprint ); + void loadLibraryPads( const SYMDEF_PCB& aComponent, FOOTPRINT* aFootprint ); + void loadComponentAttributes( const COMPONENT& aComponent, FOOTPRINT* aFootprint ); void loadNetTracks( const NET_ID& aCadstarNetID, const NET_PCB::ROUTE& aCadstarRoute ); void loadNetVia( const NET_ID& aCadstarNetID, const NET_PCB::VIA& aCadstarVia ); void checkAndLogHatchCode( const HATCHCODE_ID& aCadstarHatchcodeID ); @@ -283,7 +283,7 @@ private: * @brief * @param aCadstarShape * @param aLineThickness Thickness of line to draw with - * @param aParentContainer Parent object (e.g. mBoard or a MODULE pointer) + * @param aParentContainer Parent object (e.g. BOARD or FOOTPRINT pointer) * @return Pointer to ZONE. Caller owns the object. */ ZONE* getZoneFromCadstarShape( const SHAPE& aCadstarShape, const int& aLineThickness, @@ -342,7 +342,7 @@ private: * @param aAttributeValue */ void addAttribute( const ATTRIBUTE_LOCATION& aCadstarAttrLoc, - const ATTRIBUTE_ID& aCadstarAttributeID, MODULE* aFootprint, + const ATTRIBUTE_ID& aCadstarAttributeID, FOOTPRINT* aFootprint, const wxString& aAttributeValue ); //Helper Functions for obtaining CADSTAR elements in the parsed structures @@ -361,8 +361,8 @@ private: // Helper Functions for obtaining individual elements as KiCad elements: double getHatchCodeAngleDegrees( const HATCHCODE_ID& aCadstarHatchcodeID ); - PAD* getKiCadPad( const COMPONENT_PAD& aCadstarPad, MODULE* aParent ); - MODULE* getModuleFromCadstarID( const COMPONENT_ID& aCadstarComponentID ); + PAD* getKiCadPad( const COMPONENT_PAD& aCadstarPad, FOOTPRINT* aParent ); + FOOTPRINT* getFootprintFromCadstarID( const COMPONENT_ID& aCadstarComponentID ); int getKiCadHatchCodeThickness( const HATCHCODE_ID& aCadstarHatchcodeID ); int getKiCadHatchCodeGap( const HATCHCODE_ID& aCadstarHatchcodeID ); PCB_GROUP* getKiCadGroup( const GROUP_ID& aCadstarGroupID ); @@ -448,9 +448,9 @@ private: LSET getKiCadLayerSet( const LAYER_ID& aCadstarLayerID ); - bool isModule( BOARD_ITEM_CONTAINER* aContainer ) + bool isFootprint( BOARD_ITEM_CONTAINER* aContainer ) { - return aContainer && aContainer->GetClass() == wxT( "MODULE" ); + return aContainer && aContainer->Type() == PCB_FOOTPRINT_T; } diff --git a/pcbnew/plugins/eagle/eagle_plugin.cpp b/pcbnew/plugins/eagle/eagle_plugin.cpp index 4e785c9c8b..1f20e5d144 100644 --- a/pcbnew/plugins/eagle/eagle_plugin.cpp +++ b/pcbnew/plugins/eagle/eagle_plugin.cpp @@ -77,10 +77,6 @@ Load() TODO's using namespace std; -typedef MODULE_MAP::iterator MODULE_ITER; -typedef MODULE_MAP::const_iterator MODULE_CITER; - - /// Parse an eagle distance which is either mm, or mils if there is "mil" suffix. /// Return is in BIU. static int parseEagle( const wxString& aDistance ) @@ -835,10 +831,10 @@ void EAGLE_PLUGIN::loadPlain( wxXmlNode* aGraphics ) { m_xpath->push( "hole" ); - // Fabricate a MODULE with a single PAD_ATTRIB_NPTH pad. + // Fabricate a FOOTPRINT with a single PAD_ATTRIB_NPTH pad. // Use m_hole_count to gen up a unique name. - MODULE* footprint = new MODULE( m_board ); + FOOTPRINT* footprint = new FOOTPRINT( m_board ); m_board->Add( footprint, ADD_MODE::APPEND ); footprint->SetReference( wxString::Format( "@HOLE%d", m_hole_count++ ) ); footprint->Reference().SetVisible( false ); @@ -927,8 +923,8 @@ void EAGLE_PLUGIN::loadLibrary( wxXmlNode* aLib, const wxString* aLibName ) m_xpath->push( "packages" ); - // Create a MODULE for all the eagle packages, for use later via a copy constructor - // to instantiate needed footprints in our BOARD. Save the MODULE templates in + // Create a FOOTPRINT for all the eagle packages, for use later via a copy constructor + // to instantiate needed footprints in our BOARD. Save the FOOTPRINT templates in // a MODULE_MAP using a single lookup key consisting of libname+pkgname. // Get the first package and iterate @@ -945,10 +941,10 @@ void EAGLE_PLUGIN::loadLibrary( wxXmlNode* aLib, const wxString* aLibName ) wxString key = aLibName ? makeKey( *aLibName, pack_ref ) : pack_ref; - MODULE* m = makeModule( package, pack_ref ); + FOOTPRINT* m = makeFootprint( package, pack_ref ); - // add the templating MODULE to the MODULE template factory "m_templates" - std::pair r = m_templates.insert( {key, m} ); + // add the templating FOOTPRINT to the FOOTPRINT template factory "m_templates" + std::pair r = m_templates.insert( {key, m} ); if( !r.second /* && !( m_props && m_props->Value( "ignore_duplicates" ) ) */ ) { @@ -1026,21 +1022,22 @@ void EAGLE_PLUGIN::loadElements( wxXmlNode* aElements ) wxString pkg_key = makeKey( e.library, e.package ); - MODULE_CITER mi = m_templates.find( pkg_key ); + FOOTPRINT_MAP::const_iterator it = m_templates.find( pkg_key ); - if( mi == m_templates.end() ) + if( it == m_templates.end() ) { wxString emsg = wxString::Format( _( "No \"%s\" package in library \"%s\"" ), - FROM_UTF8( e.package.c_str() ), FROM_UTF8( e.library.c_str() ) ); + FROM_UTF8( e.package.c_str() ), + FROM_UTF8( e.library.c_str() ) ); THROW_IO_ERROR( emsg ); } - MODULE* m = static_cast( mi->second->Duplicate() ); + FOOTPRINT* footprint = static_cast( it->second->Duplicate() ); - m_board->Add( m, ADD_MODE::APPEND ); + m_board->Add( footprint, ADD_MODE::APPEND ); // update the nets within the pads of the clone - for( PAD* pad : m->Pads() ) + for( PAD* pad : footprint->Pads() ) { wxString pn_key = makeKey( e.name, pad->GetName() ); @@ -1054,37 +1051,37 @@ void EAGLE_PLUGIN::loadElements( wxXmlNode* aElements ) refanceNamePresetInPackageLayout = true; valueNamePresetInPackageLayout = true; - m->SetPosition( wxPoint( kicad_x( e.x ), kicad_y( e.y ) ) ); + footprint->SetPosition( wxPoint( kicad_x( e.x ), kicad_y( e.y ) ) ); // Is >NAME field set in package layout ? - if( m->GetReference().size() == 0 ) + if( footprint->GetReference().size() == 0 ) { - m->Reference().SetVisible( false ); // No so no show + footprint->Reference().SetVisible( false ); // No so no show refanceNamePresetInPackageLayout = false; } // Is >VALUE field set in package layout - if( m->GetValue().size() == 0 ) + if( footprint->GetValue().size() == 0 ) { - m->Value().SetVisible( false ); // No so no show + footprint->Value().SetVisible( false ); // No so no show valueNamePresetInPackageLayout = false; } - m->SetReference( FROM_UTF8( e.name.c_str() ) ); - m->SetValue( FROM_UTF8( e.value.c_str() ) ); + footprint->SetReference( FROM_UTF8( e.name.c_str() ) ); + footprint->SetValue( FROM_UTF8( e.value.c_str() ) ); if( !e.smashed ) { // Not smashed so show NAME & VALUE if( valueNamePresetInPackageLayout ) - m->Value().SetVisible( true ); // Only if place holder in package layout + footprint->Value().SetVisible( true ); // Only if place holder in package layout if( refanceNamePresetInPackageLayout ) - m->Reference().SetVisible( true ); // Only if place holder in package layout + footprint->Reference().SetVisible( true ); // Only if place holder in package layout } else if( *e.smashed == true ) { // Smashed so set default to no show for NAME and VALUE - m->Value().SetVisible( false ); - m->Reference().SetVisible( false ); + footprint->Value().SetVisible( false ); + footprint->Reference().SetVisible( false ); // initialize these to default values in case the elements are not present. m_xpath->push( "attribute", "name" ); @@ -1131,43 +1128,43 @@ void EAGLE_PLUGIN::loadElements( wxXmlNode* aElements ) reference.Prepend( "UNK" ); nameAttr->name = reference; - m->SetReference( reference ); + footprint->SetReference( reference ); if( refanceNamePresetInPackageLayout ) - m->Reference().SetVisible( true ); + footprint->Reference().SetVisible( true ); break; } case EATTR::NAME : if( refanceNamePresetInPackageLayout ) { - m->SetReference( "NAME" ); - m->Reference().SetVisible( true ); + footprint->SetReference( "NAME" ); + footprint->Reference().SetVisible( true ); } break; case EATTR::BOTH : if( refanceNamePresetInPackageLayout ) - m->Reference().SetVisible( true ); + footprint->Reference().SetVisible( true ); nameAttr->name = nameAttr->name + " = " + e.name; - m->SetReference( "NAME = " + e.name ); + footprint->SetReference( "NAME = " + e.name ); break; case EATTR::Off : - m->Reference().SetVisible( false ); + footprint->Reference().SetVisible( false ); break; default: nameAttr->name = e.name; if( refanceNamePresetInPackageLayout ) - m->Reference().SetVisible( true ); + footprint->Reference().SetVisible( true ); } } else // No display, so default is visible, and show value of NAME - m->Reference().SetVisible( true ); + footprint->Reference().SetVisible( true ); } else if( a.name == "VALUE" ) { @@ -1181,43 +1178,43 @@ void EAGLE_PLUGIN::loadElements( wxXmlNode* aElements ) { case EATTR::VALUE : valueAttr->value = opt_wxString( e.value ); - m->SetValue( e.value ); + footprint->SetValue( e.value ); if( valueNamePresetInPackageLayout ) - m->Value().SetVisible( true ); + footprint->Value().SetVisible( true ); break; case EATTR::NAME : if( valueNamePresetInPackageLayout ) - m->Value().SetVisible( true ); + footprint->Value().SetVisible( true ); - m->SetValue( "VALUE" ); + footprint->SetValue( "VALUE" ); break; case EATTR::BOTH : if( valueNamePresetInPackageLayout ) - m->Value().SetVisible( true ); + footprint->Value().SetVisible( true ); valueAttr->value = opt_wxString( "VALUE = " + e.value ); - m->SetValue( "VALUE = " + e.value ); + footprint->SetValue( "VALUE = " + e.value ); break; case EATTR::Off : - m->Value().SetVisible( false ); + footprint->Value().SetVisible( false ); break; default: valueAttr->value = opt_wxString( e.value ); if( valueNamePresetInPackageLayout ) - m->Value().SetVisible( true ); + footprint->Value().SetVisible( true ); } } else { // No display, so default is visible, and show value of NAME - m->Value().SetVisible( true ); + footprint->Value().SetVisible( true ); } } @@ -1228,11 +1225,11 @@ void EAGLE_PLUGIN::loadElements( wxXmlNode* aElements ) m_xpath->pop(); // "attribute" } - orientModuleAndText( m, e, nameAttr, valueAttr ); + orientFootprintAndText( footprint, e, nameAttr, valueAttr ); // Set the local coordinates for the footprint text items - m->Reference().SetLocalCoord(); - m->Value().SetLocalCoord(); + footprint->Reference().SetLocalCoord(); + footprint->Value().SetLocalCoord(); // Get next element element = element->GetNext(); @@ -1387,8 +1384,8 @@ ZONE* EAGLE_PLUGIN::loadPolygon( wxXmlNode* aPolyNode ) } -void EAGLE_PLUGIN::orientModuleAndText( MODULE* aFootprint, const EELEMENT& e, - const EATTR* aNameAttr, const EATTR* aValueAttr ) +void EAGLE_PLUGIN::orientFootprintAndText( FOOTPRINT* aFootprint, const EELEMENT& e, + const EATTR* aNameAttr, const EATTR* aValueAttr ) { if( e.rot ) { @@ -1404,13 +1401,13 @@ void EAGLE_PLUGIN::orientModuleAndText( MODULE* aFootprint, const EELEMENT& e, } } - orientModuleText( aFootprint, e, &aFootprint->Reference(), aNameAttr ); - orientModuleText( aFootprint, e, &aFootprint->Value(), aValueAttr ); + orientFPText( aFootprint, e, &aFootprint->Reference(), aNameAttr ); + orientFPText( aFootprint, e, &aFootprint->Value(), aValueAttr ); } -void EAGLE_PLUGIN::orientModuleText( MODULE* aFootprint, const EELEMENT& e, FP_TEXT* aFPText, - const EATTR* aAttr ) +void EAGLE_PLUGIN::orientFPText( FOOTPRINT* aFootprint, const EELEMENT& e, FP_TEXT* aFPText, + const EATTR* aAttr ) { // Smashed part ? if( aAttr ) @@ -1543,9 +1540,9 @@ void EAGLE_PLUGIN::orientModuleText( MODULE* aFootprint, const EELEMENT& e, FP_T } -MODULE* EAGLE_PLUGIN::makeModule( wxXmlNode* aPackage, const wxString& aPkgName ) +FOOTPRINT* EAGLE_PLUGIN::makeFootprint( wxXmlNode* aPackage, const wxString& aPkgName ) { - std::unique_ptr m = std::make_unique( m_board ); + std::unique_ptr m = std::make_unique( m_board ); LIB_ID fpID; fpID.Parse( aPkgName, LIB_ID::ID_PCB, true ); @@ -1592,7 +1589,7 @@ MODULE* EAGLE_PLUGIN::makeModule( wxXmlNode* aPackage, const wxString& aPkgName } -void EAGLE_PLUGIN::packageWire( MODULE* aFootprint, wxXmlNode* aTree ) const +void EAGLE_PLUGIN::packageWire( FOOTPRINT* aFootprint, wxXmlNode* aTree ) const { EWIRE w( aTree ); PCB_LAYER_ID layer = kicad_layer( w.layer ); @@ -1666,7 +1663,7 @@ void EAGLE_PLUGIN::packageWire( MODULE* aFootprint, wxXmlNode* aTree ) const } -void EAGLE_PLUGIN::packagePad( MODULE* aFootprint, wxXmlNode* aTree ) +void EAGLE_PLUGIN::packagePad( FOOTPRINT* aFootprint, wxXmlNode* aTree ) { // this is thru hole technology here, no SMDs EPAD e( aTree ); @@ -1768,7 +1765,7 @@ void EAGLE_PLUGIN::packagePad( MODULE* aFootprint, wxXmlNode* aTree ) } -void EAGLE_PLUGIN::packageText( MODULE* aFootprint, wxXmlNode* aTree ) const +void EAGLE_PLUGIN::packageText( FOOTPRINT* aFootprint, wxXmlNode* aTree ) const { ETEXT t( aTree ); PCB_LAYER_ID layer = kicad_layer( t.layer ); @@ -1879,7 +1876,7 @@ void EAGLE_PLUGIN::packageText( MODULE* aFootprint, wxXmlNode* aTree ) const } -void EAGLE_PLUGIN::packageRectangle( MODULE* aFootprint, wxXmlNode* aTree ) const +void EAGLE_PLUGIN::packageRectangle( FOOTPRINT* aFootprint, wxXmlNode* aTree ) const { ERECT r( aTree ); @@ -1948,7 +1945,7 @@ void EAGLE_PLUGIN::packageRectangle( MODULE* aFootprint, wxXmlNode* aTree ) cons } -void EAGLE_PLUGIN::packagePolygon( MODULE* aFootprint, wxXmlNode* aTree ) const +void EAGLE_PLUGIN::packagePolygon( FOOTPRINT* aFootprint, wxXmlNode* aTree ) const { EPOLYGON p( aTree ); @@ -2051,7 +2048,7 @@ void EAGLE_PLUGIN::packagePolygon( MODULE* aFootprint, wxXmlNode* aTree ) const } } -void EAGLE_PLUGIN::packageCircle( MODULE* aFootprint, wxXmlNode* aTree ) const +void EAGLE_PLUGIN::packageCircle( FOOTPRINT* aFootprint, wxXmlNode* aTree ) const { ECIRCLE e( aTree ); @@ -2134,7 +2131,7 @@ void EAGLE_PLUGIN::packageCircle( MODULE* aFootprint, wxXmlNode* aTree ) const } -void EAGLE_PLUGIN::packageHole( MODULE* aFootprint, wxXmlNode* aTree, bool aCenter ) const +void EAGLE_PLUGIN::packageHole( FOOTPRINT* aFootprint, wxXmlNode* aTree, bool aCenter ) const { EHOLE e( aTree ); @@ -2173,7 +2170,7 @@ void EAGLE_PLUGIN::packageHole( MODULE* aFootprint, wxXmlNode* aTree, bool aCent } -void EAGLE_PLUGIN::packageSMD( MODULE* aFootprint, wxXmlNode* aTree ) const +void EAGLE_PLUGIN::packageSMD( FOOTPRINT* aFootprint, wxXmlNode* aTree ) const { ESMD e( aTree ); PCB_LAYER_ID layer = kicad_layer( e.layer ); @@ -2265,7 +2262,7 @@ void EAGLE_PLUGIN::transferPad( const EPAD_COMMON& aEaglePad, PAD* aPad ) const if( aEaglePad.thermals && !*aEaglePad.thermals ) aPad->SetZoneConnection( ZONE_CONNECTION::FULL ); - MODULE* footprint = aPad->GetParent(); + FOOTPRINT* footprint = aPad->GetParent(); wxCHECK( footprint, /* void */ ); RotatePoint( &padPos, footprint->GetOrientation() ); aPad->SetPosition( padPos + footprint->GetPosition() ); @@ -2639,7 +2636,7 @@ std::tuple EAGLE_PLUGIN::defaultKicadLayer( int aEagle // Packages show the future chip pins on SMD parts using layer 51. // This is an area slightly smaller than the PAD/SMD copper area. - // Carry those visual aids into the MODULE on the fabrication layer, + // Carry those visual aids into the FOOTPRINT on the fabrication layer, // not silkscreen. This is perhaps not perfect, but there is not a lot // of other suitable paired layers case EAGLE_LAYER::TDOCU: @@ -2836,7 +2833,7 @@ void EAGLE_PLUGIN::FootprintEnumerate( wxArrayString& aFootprintNames, const wxS // Some of the files may have been parsed correctly so we want to add the valid files to // the library. - for( MODULE_CITER it = m_templates.begin(); it != m_templates.end(); ++it ) + for( FOOTPRINT_MAP::const_iterator it = m_templates.begin(); it != m_templates.end(); ++it ) aFootprintNames.Add( FROM_UTF8( it->first.c_str() ) ); if( !errorMsg.IsEmpty() && !aBestEfforts ) @@ -2844,18 +2841,19 @@ void EAGLE_PLUGIN::FootprintEnumerate( wxArrayString& aFootprintNames, const wxS } -MODULE* EAGLE_PLUGIN::FootprintLoad( const wxString& aLibraryPath, const wxString& aFootprintName, - const PROPERTIES* aProperties ) +FOOTPRINT* EAGLE_PLUGIN::FootprintLoad( const wxString& aLibraryPath, + const wxString& aFootprintName, + const PROPERTIES* aProperties ) { init( aProperties ); cacheLib( aLibraryPath ); - MODULE_CITER mi = m_templates.find( aFootprintName ); + FOOTPRINT_MAP::const_iterator it = m_templates.find( aFootprintName ); - if( mi == m_templates.end() ) + if( it == m_templates.end() ) return NULL; // Return a copy of the template - return (MODULE*) mi->second->Duplicate(); + return (FOOTPRINT*) it->second->Duplicate(); } @@ -2864,10 +2862,10 @@ void EAGLE_PLUGIN::FootprintLibOptions( PROPERTIES* aListToAppendTo ) const PLUGIN::FootprintLibOptions( aListToAppendTo ); /* - (*aListToAppendTo)["ignore_duplicates"] = UTF8( _( - "Ignore duplicately named footprints within the same Eagle library. " - "Only the first similarly named footprint will be loaded." - )); + (*aListToAppendTo)["ignore_duplicates"] = UTF8( _( "Ignore duplicately named footprints within " + "the same Eagle library. " + "Only the first similarly named footprint " + "will be loaded." ) ); */ } @@ -2879,7 +2877,8 @@ void EAGLE_PLUGIN::Save( const wxString& aFileName, BOARD* aBoard, const PROPERT } -void EAGLE_PLUGIN::FootprintSave( const wxString& aLibraryPath, const MODULE* aFootprint, const PROPERTIES* aProperties ) +void EAGLE_PLUGIN::FootprintSave( const wxString& aLibraryPath, const FOOTPRINT* aFootprint, + const PROPERTIES* aProperties ) { } diff --git a/pcbnew/plugins/eagle/eagle_plugin.h b/pcbnew/plugins/eagle/eagle_plugin.h index 7f94454039..efb1343851 100644 --- a/pcbnew/plugins/eagle/eagle_plugin.h +++ b/pcbnew/plugins/eagle/eagle_plugin.h @@ -38,10 +38,10 @@ class PAD; class FP_TEXT; class ZONE; -typedef std::map MODULE_MAP; -typedef std::vector ZONES; -typedef std::map NET_MAP; -typedef NET_MAP::const_iterator NET_MAP_CITER; +typedef std::map FOOTPRINT_MAP; +typedef std::vector ZONES; +typedef std::map NET_MAP; +typedef NET_MAP::const_iterator NET_MAP_CITER; /// subset of eagle.drawing.board.designrules in the XML document @@ -132,8 +132,8 @@ public: void FootprintEnumerate( wxArrayString& aFootprintNames, const wxString& aLibraryPath, bool aBestEfforts, const PROPERTIES* aProperties = NULL) override; - MODULE* FootprintLoad( const wxString& aLibraryPath, const wxString& aFootprintName, - const PROPERTIES* aProperties = NULL ) override; + FOOTPRINT* FootprintLoad( const wxString& aLibraryPath, const wxString& aFootprintName, + const PROPERTIES* aProperties = NULL ) override; long long GetLibraryTimestamp( const wxString& aLibraryPath ) const override { @@ -183,25 +183,25 @@ private: typedef std::vector ELAYERS; typedef ELAYERS::const_iterator EITER; - int m_cu_map[17]; ///< map eagle to kicad, cu layers only. - std::map m_eagleLayers; ///< Eagle layers data stored by the layer number - std::map m_eagleLayersIds; ///< Eagle layers id stored by the layer name - std::map m_layer_map; ///< Mapping of Eagle layers to KiCAD layers + int m_cu_map[17]; ///< map eagle to kicad, cu layers only. + std::map m_eagleLayers; ///< Eagle layer data stored by layer number + std::map m_eagleLayersIds; ///< Eagle layer ids stored by layer name + std::map m_layer_map; ///< Map of Eagle layers to KiCAD layers - ERULES* m_rules; ///< Eagle design rules. - XPATH* m_xpath; ///< keeps track of what we are working on within + ERULES* m_rules; ///< Eagle design rules. + XPATH* m_xpath; ///< keeps track of what we are working on within ///< XML document during a Load(). - int m_hole_count; ///< generates unique footprint names from eagle "hole"s. + int m_hole_count; ///< generates unique footprint names from eagle "hole"s. - NET_MAP m_pads_to_nets; ///< net list + NET_MAP m_pads_to_nets; ///< net list - MODULE_MAP m_templates; ///< is part of a MODULE factory that operates + FOOTPRINT_MAP m_templates; ///< is part of a MODULE factory that operates ///< using copy construction. ///< lookup key is either libname.packagename or simply ///< packagename if FootprintLoad() or FootprintEnumberate() - const PROPERTIES* m_props; ///< passed via Save() or Load(), no ownership, may be NULL. + const PROPERTIES* m_props; ///< passed via Save() or Load(), no ownership, may be NULL. BOARD* m_board; ///< which BOARD is being worked on, no ownership here int m_min_trace; ///< smallest trace we find on Load(), in BIU. @@ -276,10 +276,11 @@ private: */ ZONE* loadPolygon( wxXmlNode* aPolyNode ); - void orientModuleAndText( MODULE* aFootprint, const EELEMENT& e, const EATTR* aNameAttr, - const EATTR* aValueAttr ); + void orientFootprintAndText( FOOTPRINT* aFootprint, const EELEMENT& e, const EATTR* aNameAttr, + const EATTR* aValueAttr ); - void orientModuleText( MODULE* aFootprint, const EELEMENT& e, FP_TEXT* aFPText, const EATTR* a ); + void orientFPText( FOOTPRINT* aFootprint, const EELEMENT& e, FP_TEXT* aFPText, + const EATTR* aAttr ); /// move the BOARD into the center of the page @@ -289,14 +290,14 @@ private: * Function makeModule * creates a MODULE from an Eagle package. */ - MODULE* makeModule( wxXmlNode* aPackage, const wxString& aPkgName ); + FOOTPRINT* makeFootprint( wxXmlNode* aPackage, const wxString& aPkgName ); - void packageWire( MODULE* aFootprint, wxXmlNode* aTree ) const; - void packagePad( MODULE* aFootprint, wxXmlNode* aTree ); - void packageText( MODULE* aFootprint, wxXmlNode* aTree ) const; - void packageRectangle( MODULE* aFootprint, wxXmlNode* aTree ) const; - void packagePolygon( MODULE* aFootprint, wxXmlNode* aTree ) const; - void packageCircle( MODULE* aFootprint, wxXmlNode* aTree ) const; + void packageWire( FOOTPRINT* aFootprint, wxXmlNode* aTree ) const; + void packagePad( FOOTPRINT* aFootprint, wxXmlNode* aTree ); + void packageText( FOOTPRINT* aFootprint, wxXmlNode* aTree ) const; + void packageRectangle( FOOTPRINT* aFootprint, wxXmlNode* aTree ) const; + void packagePolygon( FOOTPRINT* aFootprint, wxXmlNode* aTree ) const; + void packageCircle( FOOTPRINT* aFootprint, wxXmlNode* aTree ) const; /** * Function packageHole @@ -305,8 +306,8 @@ private: * @parameter aCenter - If true, center the hole in the footprint and * offset the footprint position */ - void packageHole( MODULE* aFootprint, wxXmlNode* aTree, bool aCenter ) const; - void packageSMD( MODULE* aFootprint, wxXmlNode* aTree ) const; + void packageHole( FOOTPRINT* aFootprint, wxXmlNode* aTree, bool aCenter ) const; + void packageSMD( FOOTPRINT* aFootprint, wxXmlNode* aTree ) const; ///> Handles common pad properties void transferPad( const EPAD_COMMON& aEaglePad, PAD* aPad ) const; diff --git a/pcbnew/plugins/geda/gpcb_plugin.cpp b/pcbnew/plugins/geda/gpcb_plugin.cpp index 11693c0a97..49d375ea80 100644 --- a/pcbnew/plugins/geda/gpcb_plugin.cpp +++ b/pcbnew/plugins/geda/gpcb_plugin.cpp @@ -107,41 +107,41 @@ static inline long parseInt( const wxString& aValue, double aScalar ) */ class GPCB_FPL_CACHE_ITEM { - WX_FILENAME m_filename; ///< The the full file name and path of the footprint to cache. - std::unique_ptr m_footprint; + WX_FILENAME m_filename; ///< The the full file name and path of the footprint to cache. + std::unique_ptr m_footprint; public: - GPCB_FPL_CACHE_ITEM( MODULE* aFootprint, const WX_FILENAME& aFileName ); + GPCB_FPL_CACHE_ITEM( FOOTPRINT* aFootprint, const WX_FILENAME& aFileName ); WX_FILENAME GetFileName() const { return m_filename; } - MODULE* GetFootprint() const { return m_footprint.get(); } + FOOTPRINT* GetFootprint() const { return m_footprint.get(); } }; -GPCB_FPL_CACHE_ITEM::GPCB_FPL_CACHE_ITEM( MODULE* aFootprint, const WX_FILENAME& aFileName ) : +GPCB_FPL_CACHE_ITEM::GPCB_FPL_CACHE_ITEM( FOOTPRINT* aFootprint, const WX_FILENAME& aFileName ) : m_filename( aFileName ), m_footprint( aFootprint ) { } -typedef boost::ptr_map< std::string, GPCB_FPL_CACHE_ITEM > MODULE_MAP; -typedef MODULE_MAP::iterator MODULE_ITER; -typedef MODULE_MAP::const_iterator MODULE_CITER; +typedef boost::ptr_map< std::string, GPCB_FPL_CACHE_ITEM > FOOTPRINT_MAP; +typedef FOOTPRINT_MAP::iterator MODULE_ITER; +typedef FOOTPRINT_MAP::const_iterator MODULE_CITER; class GPCB_FPL_CACHE { GPCB_PLUGIN* m_owner; ///< Plugin object that owns the cache. wxFileName m_lib_path; ///< The path of the library. - MODULE_MAP m_footprints; ///< Map of footprint file name to MODULE*. + FOOTPRINT_MAP m_footprints; ///< Map of footprint file name to MODULE*. bool m_cache_dirty; ///< Stored separately because it's expensive to check ///< m_cache_timestamp against all the files. long long m_cache_timestamp; ///< A hash of the timestamps for all the footprint ///< files. - MODULE* parseMODULE( LINE_READER* aLineReader ); + FOOTPRINT* parseMODULE( LINE_READER* aLineReader ); /** * Function testFlags @@ -178,7 +178,7 @@ public: wxString GetPath() const { return m_lib_path.GetPath(); } bool IsWritable() const { return m_lib_path.IsOk() && m_lib_path.IsDirWritable(); } - MODULE_MAP& GetModules() { return m_footprints; } + FOOTPRINT_MAP& GetModules() { return m_footprints; } // Most all functions in this class throw IO_ERROR exceptions. There are no // error codes nor user interface calls from here, nor in any PLUGIN. @@ -252,9 +252,8 @@ void GPCB_FPL_CACHE::Load() { // reader now owns fp, will close on exception or return FILE_LINE_READER reader( fn.GetFullPath() ); - std::string name = TO_UTF8( fn.GetName() ); - MODULE* footprint = parseMODULE( &reader ); + FOOTPRINT* footprint = parseMODULE( &reader ); // The footprint name is the file name without the extension. footprint->SetFPID( LIB_ID( wxEmptyString, fn.GetName() ) ); @@ -310,7 +309,7 @@ long long GPCB_FPL_CACHE::GetTimestamp( const wxString& aLibPath ) } -MODULE* GPCB_FPL_CACHE::parseMODULE( LINE_READER* aLineReader ) +FOOTPRINT* GPCB_FPL_CACHE::parseMODULE( LINE_READER* aLineReader ) { #define TEXT_DEFAULT_SIZE ( 40*IU_PER_MILS ) #define OLD_GPCB_UNIT_CONV IU_PER_MILS @@ -318,12 +317,12 @@ MODULE* GPCB_FPL_CACHE::parseMODULE( LINE_READER* aLineReader ) // Old version unit = 1 mil, so conv_unit is 10 or 0.1 #define NEW_GPCB_UNIT_CONV ( 0.01*IU_PER_MILS ) - int paramCnt; - double conv_unit = NEW_GPCB_UNIT_CONV; // GPCB unit = 0.01 mils and Pcbnew 0.1 - wxPoint textPos; - wxString msg; - wxArrayString parameters; - std::unique_ptr footprint = std::make_unique( nullptr ); + int paramCnt; + double conv_unit = NEW_GPCB_UNIT_CONV; // GPCB unit = 0.01 mils and Pcbnew 0.1 + wxPoint textPos; + wxString msg; + wxArrayString parameters; + std::unique_ptr footprint = std::make_unique( nullptr ); if( aLineReader->ReadLine() == NULL ) @@ -905,10 +904,10 @@ void GPCB_PLUGIN::FootprintEnumerate( wxArrayString& aFootprintNames, const wxSt } -const MODULE* GPCB_PLUGIN::getFootprint( const wxString& aLibraryPath, - const wxString& aFootprintName, - const PROPERTIES* aProperties, - bool checkModified ) +const FOOTPRINT* GPCB_PLUGIN::getFootprint( const wxString& aLibraryPath, + const wxString& aFootprintName, + const PROPERTIES* aProperties, + bool checkModified ) { LOCALE_IO toggle; // toggles on, then off, the C locale. @@ -916,7 +915,7 @@ const MODULE* GPCB_PLUGIN::getFootprint( const wxString& aLibraryPath, validateCache( aLibraryPath, checkModified ); - const MODULE_MAP& mods = m_cache->GetModules(); + const FOOTPRINT_MAP& mods = m_cache->GetModules(); MODULE_CITER it = mods.find( TO_UTF8( aFootprintName ) ); @@ -929,19 +928,20 @@ const MODULE* GPCB_PLUGIN::getFootprint( const wxString& aLibraryPath, } -const MODULE* GPCB_PLUGIN::GetEnumeratedFootprint( const wxString& aLibraryPath, - const wxString& aFootprintName, - const PROPERTIES* aProperties ) +const FOOTPRINT* GPCB_PLUGIN::GetEnumeratedFootprint( const wxString& aLibraryPath, + const wxString& aFootprintName, + const PROPERTIES* aProperties ) { return getFootprint( aLibraryPath, aFootprintName, aProperties, false ); } -MODULE* GPCB_PLUGIN::FootprintLoad( const wxString& aLibraryPath, const wxString& aFootprintName, - const PROPERTIES* aProperties ) +FOOTPRINT* GPCB_PLUGIN::FootprintLoad( const wxString& aLibraryPath, + const wxString& aFootprintName, + const PROPERTIES* aProperties ) { - const MODULE* footprint = getFootprint( aLibraryPath, aFootprintName, aProperties, true ); - return footprint ? (MODULE*) footprint->Duplicate() : nullptr; + const FOOTPRINT* footprint = getFootprint( aLibraryPath, aFootprintName, aProperties, true ); + return footprint ? (FOOTPRINT*) footprint->Duplicate() : nullptr; } diff --git a/pcbnew/plugins/geda/gpcb_plugin.h b/pcbnew/plugins/geda/gpcb_plugin.h index a1bda236a5..b5ee46c5d7 100644 --- a/pcbnew/plugins/geda/gpcb_plugin.h +++ b/pcbnew/plugins/geda/gpcb_plugin.h @@ -65,12 +65,12 @@ public: void FootprintEnumerate( wxArrayString& aFootprintNames, const wxString& aLibraryPath, bool aBestEfforts, const PROPERTIES* aProperties = NULL ) override; - const MODULE* GetEnumeratedFootprint( const wxString& aLibraryPath, - const wxString& aFootprintName, - const PROPERTIES* aProperties = NULL ) override; + const FOOTPRINT* GetEnumeratedFootprint( const wxString& aLibraryPath, + const wxString& aFootprintName, + const PROPERTIES* aProperties = NULL ) override; - MODULE* FootprintLoad( const wxString& aLibraryPath, const wxString& aFootprintName, - const PROPERTIES* aProperties = NULL ) override; + FOOTPRINT* FootprintLoad( const wxString& aLibraryPath, const wxString& aFootprintName, + const PROPERTIES* aProperties = NULL ) override; void FootprintDelete( const wxString& aLibraryPath, const wxString& aFootprintName, const PROPERTIES* aProperties = NULL ) override; @@ -102,8 +102,8 @@ protected: private: void validateCache( const wxString& aLibraryPath, bool checkModified = true ); - const MODULE* getFootprint( const wxString& aLibraryPath, const wxString& aFootprintName, - const PROPERTIES* aProperties, bool checkModified ); + const FOOTPRINT* getFootprint( const wxString& aLibraryPath, const wxString& aFootprintName, + const PROPERTIES* aProperties, bool checkModified ); void init( const PROPERTIES* aProperties ); }; diff --git a/pcbnew/plugins/kicad/kicad_plugin.cpp b/pcbnew/plugins/kicad/kicad_plugin.cpp index e4beac9c62..c03c42d9be 100644 --- a/pcbnew/plugins/kicad/kicad_plugin.cpp +++ b/pcbnew/plugins/kicad/kicad_plugin.cpp @@ -60,26 +60,26 @@ using namespace PCB_KEYS_T; */ class FP_CACHE_ITEM { - WX_FILENAME m_filename; - std::unique_ptr m_footprint; + WX_FILENAME m_filename; + std::unique_ptr m_footprint; public: - FP_CACHE_ITEM( MODULE* aFootprint, const WX_FILENAME& aFileName ); + FP_CACHE_ITEM( FOOTPRINT* aFootprint, const WX_FILENAME& aFileName ); const WX_FILENAME& GetFileName() const { return m_filename; } - const MODULE* GetModule() const { return m_footprint.get(); } + const FOOTPRINT* GetModule() const { return m_footprint.get(); } }; -FP_CACHE_ITEM::FP_CACHE_ITEM( MODULE* aFootprint, const WX_FILENAME& aFileName ) : +FP_CACHE_ITEM::FP_CACHE_ITEM( FOOTPRINT* aFootprint, const WX_FILENAME& aFileName ) : m_filename( aFileName ), m_footprint( aFootprint ) { } -typedef boost::ptr_map< wxString, FP_CACHE_ITEM > MODULE_MAP; -typedef MODULE_MAP::iterator MODULE_ITER; -typedef MODULE_MAP::const_iterator MODULE_CITER; +typedef boost::ptr_map< wxString, FP_CACHE_ITEM > FOOTPRINT_MAP; +typedef FOOTPRINT_MAP::iterator MODULE_ITER; +typedef FOOTPRINT_MAP::const_iterator MODULE_CITER; class FP_CACHE @@ -87,7 +87,7 @@ class FP_CACHE PCB_IO* m_owner; // Plugin object that owns the cache. wxFileName m_lib_path; // The path of the library. wxString m_lib_raw_path; // For quick comparisons. - MODULE_MAP m_modules; // Map of footprint file name per MODULE*. + FOOTPRINT_MAP m_modules; // Map of footprint file name per MODULE*. bool m_cache_dirty; // Stored separately because it's expensive to check // m_cache_timestamp against all the files. @@ -97,10 +97,13 @@ class FP_CACHE public: FP_CACHE( PCB_IO* aOwner, const wxString& aLibraryPath ); - wxString GetPath() const { return m_lib_raw_path; } - bool IsWritable() const { return m_lib_path.IsOk() && m_lib_path.IsDirWritable(); } - bool Exists() const { return m_lib_path.IsOk() && m_lib_path.DirExists(); } - MODULE_MAP& GetModules() { return m_modules; } + wxString GetPath() const { return m_lib_raw_path; } + + bool IsWritable() const { return m_lib_path.IsOk() && m_lib_path.IsDirWritable(); } + + bool Exists() const { return m_lib_path.IsOk() && m_lib_path.DirExists(); } + + FOOTPRINT_MAP& GetModules() { return m_modules; } // Most all functions in this class throw IO_ERROR exceptions. There are no // error codes nor user interface calls from here, nor in any PLUGIN. @@ -111,7 +114,7 @@ public: * * @param aFootprint if set, save only this module, otherwise, save the full library */ - void Save( MODULE* aFootprint = NULL ); + void Save( FOOTPRINT* aFootprint = NULL ); void Load(); @@ -154,7 +157,7 @@ FP_CACHE::FP_CACHE( PCB_IO* aOwner, const wxString& aLibraryPath ) } -void FP_CACHE::Save( MODULE* aFootprint ) +void FP_CACHE::Save( FOOTPRINT* aFootprint ) { m_cache_timestamp = 0; @@ -258,8 +261,8 @@ void FP_CACHE::Load() m_owner->m_parser->SetLineReader( &reader ); - MODULE* footprint = (MODULE*) m_owner->m_parser->Parse(); - wxString fpName = fn.GetName(); + FOOTPRINT* footprint = (FOOTPRINT*) m_owner->m_parser->Parse(); + wxString fpName = fn.GetName(); footprint->SetFPID( LIB_ID( wxEmptyString, fpName ) ); m_modules.insert( fpName, new FP_CACHE_ITEM( footprint, fn ) ); @@ -412,7 +415,7 @@ void PCB_IO::Format( BOARD_ITEM* aItem, int aNestLevel ) const break; case PCB_FOOTPRINT_T: - format( static_cast( aItem ), aNestLevel ); + format( static_cast( aItem ), aNestLevel ); break; case PCB_PAD_T: @@ -949,7 +952,7 @@ void PCB_IO::format( PCB_TARGET* aTarget, int aNestLevel ) const } -void PCB_IO::format( MODULE* aFootprint, int aNestLevel ) const +void PCB_IO::format( FOOTPRINT* aFootprint, int aNestLevel ) const { if( !( m_ctl & CTL_OMIT_INITIAL_COMMENTS ) ) { @@ -1077,10 +1080,10 @@ void PCB_IO::format( MODULE* aFootprint, int aNestLevel ) const Format((BOARD_ITEM*) &aFootprint->Reference(), aNestLevel + 1 ); Format((BOARD_ITEM*) &aFootprint->Value(), aNestLevel + 1 ); - std::set sorted_pads( aFootprint->Pads().begin(), - aFootprint->Pads().end() ); - std::set sorted_drawings( aFootprint->GraphicalItems().begin(), - aFootprint->GraphicalItems().end() ); + std::set sorted_pads( aFootprint->Pads().begin(), + aFootprint->Pads().end() ); + std::set sorted_drawings( aFootprint->GraphicalItems().begin(), + aFootprint->GraphicalItems().end() ); std::set sorted_zones( aFootprint->Zones().begin(), aFootprint->Zones().end() ); std::set sorted_groups( aFootprint->Groups().begin(), @@ -1603,7 +1606,7 @@ void PCB_IO::format( FP_TEXT* aText, int aNestLevel ) const // but internally the angle is held relative to its parent footprint. parent // may be NULL when saving a footprint outside a BOARD. double orient = aText->GetTextAngle(); - MODULE* parent = (MODULE*) aText->GetParent(); + FOOTPRINT* parent = (FOOTPRINT*) aText->GetParent(); if( parent ) { @@ -2155,10 +2158,10 @@ void PCB_IO::FootprintEnumerate( wxArrayString& aFootprintNames, const wxString& } -const MODULE* PCB_IO::getFootprint( const wxString& aLibraryPath, - const wxString& aFootprintName, - const PROPERTIES* aProperties, - bool checkModified ) +const FOOTPRINT* PCB_IO::getFootprint( const wxString& aLibraryPath, + const wxString& aFootprintName, + const PROPERTIES* aProperties, + bool checkModified ) { LOCALE_IO toggle; // toggles on, then off, the C locale. @@ -2173,7 +2176,7 @@ const MODULE* PCB_IO::getFootprint( const wxString& aLibraryPath, // do nothing with the error } - const MODULE_MAP& mods = m_cache->GetModules(); + const FOOTPRINT_MAP& mods = m_cache->GetModules(); MODULE_CITER it = mods.find( aFootprintName ); @@ -2184,9 +2187,9 @@ const MODULE* PCB_IO::getFootprint( const wxString& aLibraryPath, } -const MODULE* PCB_IO::GetEnumeratedFootprint( const wxString& aLibraryPath, - const wxString& aFootprintName, - const PROPERTIES* aProperties ) +const FOOTPRINT* PCB_IO::GetEnumeratedFootprint( const wxString& aLibraryPath, + const wxString& aFootprintName, + const PROPERTIES* aProperties ) { return getFootprint( aLibraryPath, aFootprintName, aProperties, false ); } @@ -2208,15 +2211,15 @@ bool PCB_IO::FootprintExists( const wxString& aLibraryPath, const wxString& aFoo } -MODULE* PCB_IO::FootprintLoad( const wxString& aLibraryPath, const wxString& aFootprintName, - const PROPERTIES* aProperties ) +FOOTPRINT* PCB_IO::FootprintLoad( const wxString& aLibraryPath, const wxString& aFootprintName, + const PROPERTIES* aProperties ) { - const MODULE* footprint = getFootprint( aLibraryPath, aFootprintName, aProperties, true ); - return footprint ? (MODULE*) footprint->Duplicate() : nullptr; + const FOOTPRINT* footprint = getFootprint( aLibraryPath, aFootprintName, aProperties, true ); + return footprint ? (FOOTPRINT*) footprint->Duplicate() : nullptr; } -void PCB_IO::FootprintSave( const wxString& aLibraryPath, const MODULE* aFootprint, +void PCB_IO::FootprintSave( const wxString& aLibraryPath, const FOOTPRINT* aFootprint, const PROPERTIES* aProperties ) { LOCALE_IO toggle; // toggles on, then off, the C locale. @@ -2252,7 +2255,7 @@ void PCB_IO::FootprintSave( const wxString& aLibraryPath, const MODULE* aFootpri wxString footprintName = aFootprint->GetFPID().GetLibItemName(); - MODULE_MAP& mods = m_cache->GetModules(); + FOOTPRINT_MAP& mods = m_cache->GetModules(); // Quietly overwrite module and delete module file from path for any by same name. wxFileName fn( aLibraryPath, aFootprint->GetFPID().GetLibItemName(), @@ -2298,25 +2301,25 @@ void PCB_IO::FootprintSave( const wxString& aLibraryPath, const MODULE* aFootpri } // I need my own copy for the cache - MODULE* module = static_cast( aFootprint->Clone() ); + FOOTPRINT* footprint = static_cast( aFootprint->Clone() ); // It should have no parent, orientation should be zero, and it should be on the front layer. - module->SetParent( nullptr ); - module->SetOrientation( 0 ); + footprint->SetParent( nullptr ); + footprint->SetOrientation( 0 ); - if( module->GetLayer() != F_Cu ) + if( footprint->GetLayer() != F_Cu ) { - auto cfg = dynamic_cast( Kiface().KifaceSettings() ); + PCBNEW_SETTINGS* cfg = dynamic_cast( Kiface().KifaceSettings() ); if( cfg ) - module->Flip( module->GetPosition(), cfg->m_FlipLeftRight ); + footprint->Flip( footprint->GetPosition(), cfg->m_FlipLeftRight ); else - module->Flip( module->GetPosition(), false ); + footprint->Flip( footprint->GetPosition(), false ); } wxLogTrace( traceKicadPcbPlugin, wxT( "Creating s-expr footprint file '%s'." ), fullPath ); - mods.insert( footprintName, new FP_CACHE_ITEM( module, WX_FILENAME( fn.GetPath(), fullName ) ) ); - m_cache->Save( module ); + mods.insert( footprintName, new FP_CACHE_ITEM( footprint, WX_FILENAME( fn.GetPath(), fullName ) ) ); + m_cache->Save( footprint ); } diff --git a/pcbnew/plugins/kicad/kicad_plugin.h b/pcbnew/plugins/kicad/kicad_plugin.h index 3115f9cb82..ca083f3906 100644 --- a/pcbnew/plugins/kicad/kicad_plugin.h +++ b/pcbnew/plugins/kicad/kicad_plugin.h @@ -155,17 +155,17 @@ public: void FootprintEnumerate( wxArrayString& aFootprintNames, const wxString& aLibraryPath, bool aBestEfforts, const PROPERTIES* aProperties = NULL ) override; - const MODULE* GetEnumeratedFootprint( const wxString& aLibraryPath, - const wxString& aFootprintName, - const PROPERTIES* aProperties = NULL ) override; + const FOOTPRINT* GetEnumeratedFootprint( const wxString& aLibraryPath, + const wxString& aFootprintName, + const PROPERTIES* aProperties = NULL ) override; bool FootprintExists( const wxString& aLibraryPath, const wxString& aFootprintName, const PROPERTIES* aProperties = NULL ) override; - MODULE* FootprintLoad( const wxString& aLibraryPath, const wxString& aFootprintName, - const PROPERTIES* aProperties = NULL ) override; + FOOTPRINT* FootprintLoad( const wxString& aLibraryPath, const wxString& aFootprintName, + const PROPERTIES* aProperties = NULL ) override; - void FootprintSave( const wxString& aLibraryPath, const MODULE* aFootprint, + void FootprintSave( const wxString& aLibraryPath, const FOOTPRINT* aFootprint, const PROPERTIES* aProperties = NULL ) override; void FootprintDelete( const wxString& aLibraryPath, const wxString& aFootprintName, @@ -232,8 +232,8 @@ protected: void validateCache( const wxString& aLibraryPath, bool checkModified = true ); - const MODULE* getFootprint( const wxString& aLibraryPath, const wxString& aFootprintName, - const PROPERTIES* aProperties, bool checkModified ); + const FOOTPRINT* getFootprint( const wxString& aLibraryPath, const wxString& aFootprintName, + const PROPERTIES* aProperties, bool checkModified ); void init( const PROPERTIES* aProperties ); @@ -268,7 +268,7 @@ private: void format( PCB_TARGET* aTarget, int aNestLevel = 0 ) const; - void format( MODULE* aFootprint, int aNestLevel = 0 ) const; + void format( FOOTPRINT* aFootprint, int aNestLevel = 0 ) const; void format( PAD* aPad, int aNestLevel = 0 ) const; diff --git a/pcbnew/plugins/kicad/pcb_parser.cpp b/pcbnew/plugins/kicad/pcb_parser.cpp index 434b20d206..5160f6483b 100644 --- a/pcbnew/plugins/kicad/pcb_parser.cpp +++ b/pcbnew/plugins/kicad/pcb_parser.cpp @@ -490,9 +490,9 @@ BOARD_ITEM* PCB_PARSER::Parse() m_groupInfos.clear(); - // MODULEs can be prefixed with an initial block of single line comments and these - // are kept for Format() so they round trip in s-expression form. BOARDs might - // eventually do the same, but currently do not. + // FOOTPRINTS can be prefixed with an initial block of single line comments and these are + // kept for Format() so they round trip in s-expression form. BOARDs might eventually do + // the same, but currently do not. std::unique_ptr initial_comments( ReadCommentLines() ); token = CurTok(); @@ -746,7 +746,7 @@ void PCB_PARSER::resolveGroups( BOARD_ITEM* aParent ) } else if( aParent->Type() == PCB_FOOTPRINT_T ) { - static_cast( aParent )->RunOnChildren( + static_cast( aParent )->RunOnChildren( [&]( BOARD_ITEM* child ) { if( child->m_Uuid == aId ) @@ -771,7 +771,7 @@ void PCB_PARSER::resolveGroups( BOARD_ITEM* aParent ) const_cast( group->m_Uuid ) = aGrp.uuid; if( aGrp.parent->Type() == PCB_FOOTPRINT_T ) - static_cast( aGrp.parent )->Add( group ); + static_cast( aGrp.parent )->Add( group ); else static_cast( aGrp.parent )->Add( group ); } @@ -1735,8 +1735,8 @@ void PCB_PARSER::parseSetup() break; case T_mod_text_size: // note: legacy (pre-6.0) token - designSettings.m_TextSize[ LAYER_CLASS_SILK ].x = parseBoardUnits( "module text width" ); - designSettings.m_TextSize[ LAYER_CLASS_SILK ].y = parseBoardUnits( "module text height" ); + designSettings.m_TextSize[ LAYER_CLASS_SILK ].x = parseBoardUnits( "footprint text width" ); + designSettings.m_TextSize[ LAYER_CLASS_SILK ].y = parseBoardUnits( "footprint text height" ); m_board->m_LegacyDesignSettingsLoaded = true; NeedRIGHT(); break; @@ -2761,7 +2761,7 @@ DIMENSION_BASE* PCB_PARSER::parseDIMENSION() } -MODULE* PCB_PARSER::parseMODULE( wxArrayString* aInitialComments ) +FOOTPRINT* PCB_PARSER::parseMODULE( wxArrayString* aInitialComments ) { try { @@ -2777,10 +2777,10 @@ MODULE* PCB_PARSER::parseMODULE( wxArrayString* aInitialComments ) } -MODULE* PCB_PARSER::parseMODULE_unchecked( wxArrayString* aInitialComments ) +FOOTPRINT* PCB_PARSER::parseMODULE_unchecked( wxArrayString* aInitialComments ) { wxCHECK_MSG( CurTok() == T_module, NULL, - wxT( "Cannot parse " ) + GetTokenString( CurTok() ) + wxT( " as MODULE." ) ); + wxT( "Cannot parse " ) + GetTokenString( CurTok() ) + wxT( " as FOOTPRINT." ) ); wxString name; wxPoint pt; @@ -2788,11 +2788,11 @@ MODULE* PCB_PARSER::parseMODULE_unchecked( wxArrayString* aInitialComments ) LIB_ID fpid; int attributes = 0; - std::unique_ptr module = std::make_unique( m_board ); + std::unique_ptr footprint = std::make_unique( m_board ); std::map properties; - module->SetInitialComments( aInitialComments ); + footprint->SetInitialComments( aInitialComments ); token = NextTok(); @@ -2818,7 +2818,7 @@ MODULE* PCB_PARSER::parseMODULE_unchecked( wxArrayString* aInitialComments ) { case T_version: { - // Theoretically a module nested in a PCB could declare its own version, though + // Theoretically a footprint nested in a PCB could declare its own version, though // as of writing this comment we don't do that. Just in case, take the greater // version. int this_version = parseInt( FromUTF8().mb_str( wxConvUTF8 ) ); @@ -2829,11 +2829,11 @@ MODULE* PCB_PARSER::parseMODULE_unchecked( wxArrayString* aInitialComments ) } case T_locked: - module->SetLocked( true ); + footprint->SetLocked( true ); break; case T_placed: - module->SetIsPlaced( true ); + footprint->SetIsPlaced( true ); break; case T_layer: @@ -2842,31 +2842,31 @@ MODULE* PCB_PARSER::parseMODULE_unchecked( wxArrayString* aInitialComments ) // but because we can find some stupid layer in file, ensure a // acceptable layer is set for the footprint PCB_LAYER_ID layer = parseBoardItemLayer(); - module->SetLayer( layer == B_Cu ? B_Cu : F_Cu ); + footprint->SetLayer( layer == B_Cu ? B_Cu : F_Cu ); } NeedRIGHT(); break; case T_tedit: - module->SetLastEditTime( parseHex() ); + footprint->SetLastEditTime( parseHex() ); NeedRIGHT(); break; case T_tstamp: NextTok(); - const_cast( module->m_Uuid ) = CurStrToKIID(); + const_cast( footprint->m_Uuid ) = CurStrToKIID(); NeedRIGHT(); break; case T_at: pt.x = parseBoardUnits( "X coordinate" ); pt.y = parseBoardUnits( "Y coordinate" ); - module->SetPosition( pt ); + footprint->SetPosition( pt ); token = NextTok(); if( token == T_NUMBER ) { - module->SetOrientation( parseDouble() * 10.0 ); + footprint->SetOrientation( parseDouble() * 10.0 ); NeedRIGHT(); } else if( token != T_RIGHT ) @@ -2878,13 +2878,13 @@ MODULE* PCB_PARSER::parseMODULE_unchecked( wxArrayString* aInitialComments ) case T_descr: NeedSYMBOLorNUMBER(); // some symbols can be 0508, so a number is also a symbol here - module->SetDescription( FromUTF8() ); + footprint->SetDescription( FromUTF8() ); NeedRIGHT(); break; case T_tags: NeedSYMBOLorNUMBER(); // some symbols can be 0508, so a number is also a symbol here - module->SetKeywords( FromUTF8() ); + footprint->SetKeywords( FromUTF8() ); NeedRIGHT(); break; @@ -2894,54 +2894,54 @@ MODULE* PCB_PARSER::parseMODULE_unchecked( wxArrayString* aInitialComments ) case T_path: NeedSYMBOLorNUMBER(); // Paths can be numerical so a number is also a symbol here - module->SetPath( KIID_PATH( FromUTF8() ) ); + footprint->SetPath( KIID_PATH( FromUTF8() ) ); NeedRIGHT(); break; case T_autoplace_cost90: - module->SetPlacementCost90( parseInt( "auto place cost at 90 degrees" ) ); + footprint->SetPlacementCost90( parseInt( "auto place cost at 90 degrees" ) ); NeedRIGHT(); break; case T_autoplace_cost180: - module->SetPlacementCost180( parseInt( "auto place cost at 180 degrees" ) ); + footprint->SetPlacementCost180( parseInt( "auto place cost at 180 degrees" ) ); NeedRIGHT(); break; case T_solder_mask_margin: - module->SetLocalSolderMaskMargin( parseBoardUnits( "local solder mask margin value" ) ); + footprint->SetLocalSolderMaskMargin( parseBoardUnits( "local solder mask margin value" ) ); NeedRIGHT(); break; case T_solder_paste_margin: - module->SetLocalSolderPasteMargin( + footprint->SetLocalSolderPasteMargin( parseBoardUnits( "local solder paste margin value" ) ); NeedRIGHT(); break; case T_solder_paste_ratio: - module->SetLocalSolderPasteMarginRatio( + footprint->SetLocalSolderPasteMarginRatio( parseDouble( "local solder paste margin ratio value" ) ); NeedRIGHT(); break; case T_clearance: - module->SetLocalClearance( parseBoardUnits( "local clearance value" ) ); + footprint->SetLocalClearance( parseBoardUnits( "local clearance value" ) ); NeedRIGHT(); break; case T_zone_connect: - module->SetZoneConnection( (ZONE_CONNECTION) parseInt( "zone connection value" ) ); + footprint->SetZoneConnection((ZONE_CONNECTION) parseInt( "zone connection value" ) ); NeedRIGHT(); break; case T_thermal_width: - module->SetThermalWidth( parseBoardUnits( "thermal width value" ) ); + footprint->SetThermalWidth( parseBoardUnits( "thermal width value" ) ); NeedRIGHT(); break; case T_thermal_gap: - module->SetThermalGap( parseBoardUnits( "thermal gap value" ) ); + footprint->SetThermalGap( parseBoardUnits( "thermal gap value" ) ); NeedRIGHT(); break; @@ -2984,28 +2984,28 @@ MODULE* PCB_PARSER::parseMODULE_unchecked( wxArrayString* aInitialComments ) case T_fp_text: { FP_TEXT* text = parseFP_TEXT(); - text->SetParent( module.get() ); + text->SetParent( footprint.get() ); double orientation = text->GetTextAngle(); - orientation -= module->GetOrientation(); + orientation -= footprint->GetOrientation(); text->SetTextAngle( orientation ); text->SetDrawCoord(); switch( text->GetType() ) { case FP_TEXT::TEXT_is_REFERENCE: - module->Reference() = *text; - const_cast( module->Reference().m_Uuid ) = text->m_Uuid; + footprint->Reference() = *text; + const_cast( footprint->Reference().m_Uuid ) = text->m_Uuid; delete text; break; case FP_TEXT::TEXT_is_VALUE: - module->Value() = *text; - const_cast( module->Value().m_Uuid ) = text->m_Uuid; + footprint->Value() = *text; + const_cast( footprint->Value().m_Uuid ) = text->m_Uuid; delete text; break; default: - module->Add( text, ADD_MODE::APPEND ); + footprint->Add( text, ADD_MODE::APPEND ); } } break; @@ -3017,9 +3017,9 @@ MODULE* PCB_PARSER::parseMODULE_unchecked( wxArrayString* aInitialComments ) // Drop 0 and NaN angles as these can corrupt/crash the schematic if( std::isnormal( shape->GetAngle() ) ) { - shape->SetParent( module.get() ); + shape->SetParent( footprint.get() ); shape->SetDrawCoord(); - module->Add( shape, ADD_MODE::APPEND ); + footprint->Add( shape, ADD_MODE::APPEND ); } else delete shape; @@ -3033,36 +3033,36 @@ MODULE* PCB_PARSER::parseMODULE_unchecked( wxArrayString* aInitialComments ) case T_fp_poly: { FP_SHAPE* shape = parseFP_SHAPE(); - shape->SetParent( module.get() ); + shape->SetParent( footprint.get() ); shape->SetDrawCoord(); - module->Add( shape, ADD_MODE::APPEND ); + footprint->Add( shape, ADD_MODE::APPEND ); } break; case T_pad: { - PAD* pad = parsePAD( module.get() ); + PAD* pad = parsePAD( footprint.get() ); pt = pad->GetPos0(); - RotatePoint( &pt, module->GetOrientation() ); - pad->SetPosition( pt + module->GetPosition() ); - module->Add( pad, ADD_MODE::APPEND ); + RotatePoint( &pt, footprint->GetOrientation() ); + pad->SetPosition( pt + footprint->GetPosition() ); + footprint->Add( pad, ADD_MODE::APPEND ); } break; case T_model: - module->Add3DModel( parse3DModel() ); + footprint->Add3DModel( parse3DModel() ); break; case T_zone: { - ZONE* zone = parseZONE( module.get() ); - module->Add( zone, ADD_MODE::APPEND ); + ZONE* zone = parseZONE( footprint.get() ); + footprint->Add( zone, ADD_MODE::APPEND ); } break; case T_group: - parseGROUP( module.get() ); + parseGROUP( footprint.get() ); break; default: @@ -3084,10 +3084,10 @@ MODULE* PCB_PARSER::parseMODULE_unchecked( wxArrayString* aInitialComments ) if( m_requiredVersion < 20200826 && attributes == 0 ) attributes |= FP_THROUGH_HOLE; - module->SetAttributes( attributes ); + footprint->SetAttributes( attributes ); - module->SetFPID( fpid ); - module->SetProperties( properties ); + footprint->SetFPID( fpid ); + footprint->SetProperties( properties ); // We want to calculate the bounding box in most cases except // if the advanced config is set and its a general footprint load @@ -3096,10 +3096,10 @@ MODULE* PCB_PARSER::parseMODULE_unchecked( wxArrayString* aInitialComments ) if( !ADVANCED_CFG::GetCfg().m_SkipBoundingBoxOnFpLoad || m_board != nullptr || reader->GetSource().Contains( "clipboard" ) ) { - module->CalculateBoundingBox(); + footprint->CalculateBoundingBox(); } - return module.release(); + return footprint.release(); } @@ -3412,7 +3412,7 @@ FP_SHAPE* PCB_PARSER::parseFP_SHAPE() } -PAD* PCB_PARSER::parsePAD( MODULE* aParent ) +PAD* PCB_PARSER::parsePAD( FOOTPRINT* aParent ) { wxCHECK_MSG( CurTok() == T_pad, NULL, wxT( "Cannot parse " ) + GetTokenString( CurTok() ) + wxT( " as PAD." ) ); @@ -4002,7 +4002,7 @@ void PCB_PARSER::parseGROUP( BOARD_ITEM* aParent ) while( ( token = NextTok() ) != T_RIGHT ) { // This token is the Uuid of the item in the group. - // Since groups are serialized at the end of the file/module, the Uuid should already + // Since groups are serialized at the end of the file/footprint, the Uuid should already // have been seen and exist in the board. KIID uuid( CurStr() ); groupInfo.memberUuids.push_back( uuid ); @@ -4276,16 +4276,16 @@ ZONE* PCB_PARSER::parseZONE( BOARD_ITEM_CONTAINER* aParent ) // bigger scope since each filled_polygon is concatenated in here std::map pts; - bool inModule = false; + bool inFootprint = false; PCB_LAYER_ID filledLayer; bool addedFilledPolygons = false; - if( dynamic_cast( aParent ) ) // The zone belongs a footprint - inModule = true; + if( dynamic_cast( aParent ) ) // The zone belongs a footprint + inFootprint = true; std::unique_ptr zone; - if( inModule ) + if( inFootprint ) zone = std::make_unique( aParent ); else zone = std::make_unique( aParent ); diff --git a/pcbnew/plugins/kicad/pcb_parser.h b/pcbnew/plugins/kicad/pcb_parser.h index 340f5021dc..710ad450ea 100644 --- a/pcbnew/plugins/kicad/pcb_parser.h +++ b/pcbnew/plugins/kicad/pcb_parser.h @@ -52,7 +52,7 @@ class FP_SHAPE; class FP_TEXT; class PCB_TEXT; class TRACK; -class MODULE; +class FOOTPRINT; class PCB_GROUP; class PCB_TARGET; class VIA; @@ -170,10 +170,10 @@ class PCB_PARSER : public PCB_LEXER * Function parseMODULE_unchecked * Parse a module, but do not replace PARSE_ERROR with FUTURE_FORMAT_ERROR automatically. */ - MODULE* parseMODULE_unchecked( wxArrayString* aInitialComments = 0 ); + FOOTPRINT* parseMODULE_unchecked( wxArrayString* aInitialComments = 0 ); FP_TEXT* parseFP_TEXT(); FP_SHAPE* parseFP_SHAPE(); - PAD* parsePAD( MODULE* aParent = NULL ); + PAD* parsePAD( FOOTPRINT* aParent = NULL ); // Parse only the (option ...) inside a pad description bool parsePAD_option( PAD* aPad ); ARC* parseARC(); @@ -388,7 +388,7 @@ public: * or NULL. If not NULL, then caller has given ownership of a wxArrayString to * this function and care must be taken to delete it even on exception. */ - MODULE* parseMODULE( wxArrayString* aInitialComments = 0 ); + FOOTPRINT* parseMODULE( wxArrayString* aInitialComments = 0 ); /** * Return whether a version number, if any was parsed, was too recent diff --git a/pcbnew/plugins/legacy/legacy_plugin.cpp b/pcbnew/plugins/legacy/legacy_plugin.cpp index 662a53939d..8253ca3dec 100644 --- a/pcbnew/plugins/legacy/legacy_plugin.cpp +++ b/pcbnew/plugins/legacy/legacy_plugin.cpp @@ -81,23 +81,17 @@ #include #include #include -#include <3d_cache/3d_info.h> #include #include #include #include -#include #include #include // for KiROUND -#include typedef LEGACY_PLUGIN::BIU BIU; #define VERSION_ERROR_FORMAT _( "File \"%s\" is format version: %d.\nI only support format version <= %d.\nPlease upgrade Pcbnew to load this file." ) -#define UNKNOWN_GRAPHIC_FORMAT _( "unknown graphic type: %d") -#define UNKNOWN_PAD_FORMAT _( "unknown pad type: %d") -#define UNKNOWN_PAD_ATTRIBUTE _( "unknown pad attribute: %d" ) typedef unsigned LEG_MASK; @@ -434,7 +428,7 @@ void LEGACY_PLUGIN::loadAllSections( bool doAppend ) if( TESTLINE( "$MODULE" ) ) { - std::unique_ptr module = std::make_unique( m_board ); + std::unique_ptr footprint = std::make_unique( m_board ); LIB_ID fpid; std::string fpName = StrPurge( line + SZ( "$MODULE" ) ); @@ -446,10 +440,10 @@ void LEGACY_PLUGIN::loadAllSections( bool doAppend ) if( !fpName.empty() ) fpid.Parse( fpName, LIB_ID::ID_PCB, true ); - module->SetFPID( fpid ); + footprint->SetFPID( fpid ); - loadFOOTPRINT( module.get()); - m_board->Add( module.release(), ADD_MODE::APPEND ); + loadFOOTPRINT( footprint.get()); + m_board->Add( footprint.release(), ADD_MODE::APPEND ); } else if( TESTLINE( "$DRAWSEGMENT" ) ) @@ -1178,7 +1172,7 @@ void LEGACY_PLUGIN::loadSETUP() } -void LEGACY_PLUGIN::loadFOOTPRINT( MODULE* aFootprint ) +void LEGACY_PLUGIN::loadFOOTPRINT( FOOTPRINT* aFootprint ) { char* line; @@ -1396,7 +1390,7 @@ void LEGACY_PLUGIN::loadFOOTPRINT( MODULE* aFootprint ) } -void LEGACY_PLUGIN::loadPAD( MODULE* aFootprint ) +void LEGACY_PLUGIN::loadPAD( FOOTPRINT* aFootprint ) { std::unique_ptr pad = std::make_unique( aFootprint ); char* line; @@ -1631,7 +1625,7 @@ void LEGACY_PLUGIN::loadPAD( MODULE* aFootprint ) } -void LEGACY_PLUGIN::loadFP_SHAPE( MODULE* aFootprint ) +void LEGACY_PLUGIN::loadFP_SHAPE( FOOTPRINT* aFootprint ) { PCB_SHAPE_TYPE_T shape; char* line = m_reader->Line(); // obtain current (old) line @@ -1822,7 +1816,7 @@ void LEGACY_PLUGIN::loadMODULE_TEXT( FP_TEXT* aText ) aText->SetPos0( wxPoint( pos0_x, pos0_y ) ); aText->SetTextSize( wxSize( size0_x, size0_y ) ); - orient -= ( static_cast( aText->GetParent() ) )->GetOrientation(); + orient -= ( static_cast( aText->GetParent() ) )->GetOrientation(); aText->SetTextAngle( orient ); @@ -1859,7 +1853,7 @@ void LEGACY_PLUGIN::loadMODULE_TEXT( FP_TEXT* aText ) } -void LEGACY_PLUGIN::load3D( MODULE* aFootprint ) +void LEGACY_PLUGIN::load3D( FOOTPRINT* aFootprint ) { FP_3DMODEL t3D; @@ -3017,7 +3011,7 @@ void LEGACY_PLUGIN::init( const PROPERTIES* aProperties ) } -void LEGACY_PLUGIN::SaveFP3DModels( const MODULE* aFootprint ) const +void LEGACY_PLUGIN::SaveFP3DModels( const FOOTPRINT* aFootprint ) const { auto sM = aFootprint->Models().begin(); auto eM = aFootprint->Models().end(); @@ -3093,9 +3087,9 @@ void LEGACY_PLUGIN::SaveFP3DModels( const MODULE* aFootprint ) const #include #include -typedef boost::ptr_map< std::string, MODULE > MODULE_MAP; -typedef MODULE_MAP::iterator MODULE_ITER; -typedef MODULE_MAP::const_iterator MODULE_CITER; +typedef boost::ptr_map< std::string, FOOTPRINT > FOOTPRINT_MAP; +typedef FOOTPRINT_MAP::iterator MODULE_ITER; +typedef FOOTPRINT_MAP::const_iterator MODULE_CITER; /** @@ -3106,9 +3100,9 @@ typedef MODULE_MAP::const_iterator MODULE_CITER; */ struct LP_CACHE { - LEGACY_PLUGIN* m_owner; // my owner, I need its LEGACY_PLUGIN::loadMODULE() + LEGACY_PLUGIN* m_owner; // my owner, I need its LEGACY_PLUGIN::loadFOOTPRINT() wxString m_lib_path; - MODULE_MAP m_modules; // map or tuple of footprint_name vs. MODULE* + FOOTPRINT_MAP m_footprints; // map or tuple of footprint_name vs. FOOTPRINT* bool m_writable; bool m_cache_dirty; // Stored separately because it's expensive to check @@ -3243,7 +3237,7 @@ void LP_CACHE::LoadModules( LINE_READER* aReader ) // test first for the $MODULE, even before reading because of INDEX bug. if( TESTLINE( "$MODULE" ) ) { - std::unique_ptr module = std::make_unique( m_owner->m_board ); + std::unique_ptr fp_ptr = std::make_unique( m_owner->m_board ); std::string footprintName = StrPurge( line + SZ( "$MODULE" ) ); @@ -3252,11 +3246,11 @@ void LP_CACHE::LoadModules( LINE_READER* aReader ) ReplaceIllegalFileNameChars( &footprintName ); // set the footprint name first thing, so exceptions can use name. - module->SetFPID( LIB_ID( wxEmptyString, footprintName ) ); + fp_ptr->SetFPID( LIB_ID( wxEmptyString, footprintName ) ); - m_owner->loadFOOTPRINT( module.get()); + m_owner->loadFOOTPRINT( fp_ptr.get()); - MODULE* m = module.release(); // exceptions after this are not expected. + FOOTPRINT* fp = fp_ptr.release(); // exceptions after this are not expected. // Not sure why this is asserting on debug builds. The debugger shows the // strings are the same. If it's not really needed maybe it can be removed. @@ -3275,11 +3269,11 @@ void LP_CACHE::LoadModules( LINE_READER* aReader ) */ - MODULE_CITER it = m_modules.find( footprintName ); + MODULE_CITER it = m_footprints.find( footprintName ); - if( it == m_modules.end() ) // footprintName is not present in cache yet. + if( it == m_footprints.end() ) // footprintName is not present in cache yet. { - std::pair r = m_modules.insert( footprintName, m ); + std::pair r = m_footprints.insert( footprintName, fp ); wxASSERT_MSG( r.second, wxT( "error doing cache insert using guaranteed unique name" ) ); (void) r; @@ -3301,14 +3295,14 @@ void LP_CACHE::LoadModules( LINE_READER* aReader ) sprintf( buf, "%d", version++ ); newName += buf; - it = m_modules.find( newName ); + it = m_footprints.find( newName ); - if( it == m_modules.end() ) + if( it == m_footprints.end() ) { nameOK = true; - m->SetFPID( LIB_ID( wxEmptyString, newName ) ); - std::pair r = m_modules.insert( newName, m ); + fp->SetFPID( LIB_ID( wxEmptyString, newName ) ); + std::pair r = m_footprints.insert( newName, fp ); wxASSERT_MSG( r.second, wxT( "error doing cache insert using guaranteed unique name" ) ); (void) r; @@ -3359,7 +3353,7 @@ void LEGACY_PLUGIN::FootprintEnumerate( wxArrayString& aFootprintNames, const wx // Some of the files may have been parsed correctly so we want to add the valid files to // the library. - for( MODULE_CITER it = m_cache->m_modules.begin(); it != m_cache->m_modules.end(); ++it ) + for( MODULE_CITER it = m_cache->m_footprints.begin(); it != m_cache->m_footprints.end(); ++it ) aFootprintNames.Add( FROM_UTF8( it->first.c_str() ) ); if( !errorMsg.IsEmpty() && !aBestEfforts ) @@ -3367,8 +3361,9 @@ void LEGACY_PLUGIN::FootprintEnumerate( wxArrayString& aFootprintNames, const wx } -MODULE* LEGACY_PLUGIN::FootprintLoad( const wxString& aLibraryPath, - const wxString& aFootprintName, const PROPERTIES* aProperties ) +FOOTPRINT* LEGACY_PLUGIN::FootprintLoad( const wxString& aLibraryPath, + const wxString& aFootprintName, + const PROPERTIES* aProperties ) { LOCALE_IO toggle; // toggles on, then off, the C locale. @@ -3376,11 +3371,11 @@ MODULE* LEGACY_PLUGIN::FootprintLoad( const wxString& aLibraryPath, cacheLib( aLibraryPath ); - const MODULE_MAP& mods = m_cache->m_modules; + const FOOTPRINT_MAP& footprints = m_cache->m_footprints; - MODULE_CITER it = mods.find( TO_UTF8( aFootprintName ) ); + MODULE_CITER it = footprints.find( TO_UTF8( aFootprintName ) ); - if( it == mods.end() ) + if( it == footprints.end() ) { /* THROW_IO_ERROR( wxString::Format( _( "No \"%s\" footprint in library \"%s\"" ), @@ -3391,7 +3386,7 @@ MODULE* LEGACY_PLUGIN::FootprintLoad( const wxString& aLibraryPath, } // Return copy of already loaded MODULE - return (MODULE*) it->second->Duplicate(); + return (FOOTPRINT*) it->second->Duplicate(); } diff --git a/pcbnew/plugins/legacy/legacy_plugin.h b/pcbnew/plugins/legacy/legacy_plugin.h index 0a7dc18f7a..f38c296226 100644 --- a/pcbnew/plugins/legacy/legacy_plugin.h +++ b/pcbnew/plugins/legacy/legacy_plugin.h @@ -39,7 +39,7 @@ #define FOOTPRINT_LIBRARY_HEADER_CNT 18 class PCB_TARGET; -class MODULE; +class FOOTPRINT; class TRACK; class NETCLASS; class NETCLASSES; @@ -82,8 +82,8 @@ public: void FootprintEnumerate( wxArrayString& aFootprintNames, const wxString& aLibraryPath, bool aBestEfforts, const PROPERTIES* aProperties = NULL ) override; - MODULE* FootprintLoad( const wxString& aLibraryPath, const wxString& aFootprintName, - const PROPERTIES* aProperties = NULL ) override; + FOOTPRINT* FootprintLoad( const wxString& aLibraryPath, const wxString& aFootprintName, + const PROPERTIES* aProperties = NULL ) override; bool FootprintLibDelete( const wxString& aLibraryPath, const PROPERTIES* aProperties = NULL ) override; @@ -102,7 +102,7 @@ public: void SetReader( LINE_READER* aReader ) { m_reader = aReader; } void SetFilePtr( FILE* aFile ) { m_fp = aFile; } - void SaveFP3DModels( const MODULE* aFootprint ) const; + void SaveFP3DModels( const FOOTPRINT* aFootprint ) const; // return the new .kicad_pcb layer id from the old (legacy) layer id static PCB_LAYER_ID leg_layer2new( int cu_count, LAYER_NUM aLayerNum ); @@ -111,23 +111,23 @@ public: protected: - int m_cu_count; + int m_cu_count; - wxString m_error; ///< for throwing exceptions - BOARD* m_board; ///< which BOARD, no ownership here - const PROPERTIES* m_props; ///< passed via Save() or Load(), no ownership, may be NULL. + wxString m_error; ///< for throwing exceptions + BOARD* m_board; ///< which BOARD, no ownership here + const PROPERTIES* m_props; ///< passed via Save() or Load(), no ownership, may be NULL. - LINE_READER* m_reader; ///< no ownership here. - FILE* m_fp; ///< no ownership here. + LINE_READER* m_reader; ///< no ownership here. + FILE* m_fp; ///< no ownership here. - wxString m_field; ///< reused to stuff MODULE fields. - int m_loading_format_version; ///< which BOARD_FORMAT_VERSION am I Load()ing? - LP_CACHE* m_cache; - bool m_showLegacyZoneWarning; + wxString m_field; ///< reused to stuff MODULE fields. + int m_loading_format_version; ///< which BOARD_FORMAT_VERSION am I Load()ing? + LP_CACHE* m_cache; + bool m_showLegacyZoneWarning; - NETINFO_MAPPING* m_mapping; ///< mapping for net codes, so only not empty nets + NETINFO_MAPPING* m_mapping; ///< mapping for net codes, so only not empty nets ///< are stored with consecutive integers as net codes - std::vector m_netCodes; ///< net codes mapping for boards being loaded + std::vector m_netCodes; ///< net codes mapping for boards being loaded /// initialize PLUGIN like a constructor would, and futz with fresh BOARD if needed. void init( const PROPERTIES* aProperties ); @@ -190,16 +190,16 @@ protected: void loadSETUP(); void loadSHEET(); - void load3D( MODULE* aFootprint ); - void loadPAD( MODULE* aFootprint ); + void load3D( FOOTPRINT* aFootprint ); + void loadPAD( FOOTPRINT* aFootprint ); void loadMODULE_TEXT( FP_TEXT* aText ); - void loadFP_SHAPE( MODULE* aFootprint ); + void loadFP_SHAPE( FOOTPRINT* aFootprint ); void loadPCB_LINE(); void loadNETINFO_ITEM(); void loadPCB_TEXT(); void loadNETCLASS(); - void loadFOOTPRINT( MODULE* aFootprint ); + void loadFOOTPRINT( FOOTPRINT* aFootprint ); /** * Function loadTrackList diff --git a/pcbnew/plugins/pcad/pcb_arc.cpp b/pcbnew/plugins/pcad/pcb_arc.cpp index 4d167407a9..564eff3df1 100644 --- a/pcbnew/plugins/pcad/pcb_arc.cpp +++ b/pcbnew/plugins/pcad/pcb_arc.cpp @@ -40,10 +40,10 @@ namespace PCAD2KICAD { PCB_ARC::PCB_ARC( PCB_CALLBACKS* aCallbacks, BOARD* aBoard ) : PCB_COMPONENT( aCallbacks, aBoard ) { m_objType = wxT( 'A' ); - m_startX = 0; - m_startY = 0; - m_angle = 0; - m_width = 0; + m_StartX = 0; + m_StartY = 0; + m_Angle = 0; + m_Width = 0; } @@ -68,7 +68,7 @@ void PCB_ARC::Parse( XNODE* aNode, if( FindNode( aNode, wxT( "width" ) ) ) SetWidth( FindNode( aNode, wxT( "width" ) )->GetNodeContent(), - aDefaultMeasurementUnit, &m_width, aActualConversion ); + aDefaultMeasurementUnit, &m_Width, aActualConversion ); if( aNode->GetName() == wxT( "triplePointArc" ) ) { @@ -85,7 +85,7 @@ void PCB_ARC::Parse( XNODE* aNode, if( lNode ) SetPosition( lNode->GetNodeContent(), aDefaultMeasurementUnit, - &m_startX, &m_startY, aActualConversion ); + &m_StartX, &m_StartY, aActualConversion ); // end point if( lNode ) @@ -95,17 +95,17 @@ void PCB_ARC::Parse( XNODE* aNode, SetPosition( lNode->GetNodeContent(), aDefaultMeasurementUnit, &endX, &endY, aActualConversion ); - if( m_startX == endX && m_startY == endY ) + if( m_StartX == endX && m_StartY == endY ) { - m_angle = 3600; + m_Angle = 3600; } else { - double alpha1 = ArcTangente( m_startY - m_positionY, m_startX - m_positionX ); + double alpha1 = ArcTangente( m_StartY - m_positionY, m_StartX - m_positionX ); double alpha2 = ArcTangente( endY - m_positionY, endX - m_positionX ); - m_angle = alpha1 - alpha2; + m_Angle = alpha1 - alpha2; - NORMALIZE_ANGLE_POS( m_angle ); + NORMALIZE_ANGLE_POS( m_Angle ); } } else if( aNode->GetName() == wxT( "arc" ) ) @@ -128,10 +128,10 @@ void PCB_ARC::Parse( XNODE* aNode, lNode = FindNode( aNode, wxT( "sweepAngle" ) ); if( lNode ) - m_angle = StrToInt1Units( lNode->GetNodeContent() ); + m_Angle = StrToInt1Units( lNode->GetNodeContent() ); - m_startX = m_positionX + KiROUND( cosdecideg( r, a ) ); - m_startY = m_positionY - KiROUND( sindecideg( r, a ) ); + m_StartX = m_positionX + KiROUND( cosdecideg( r, a ) ); + m_StartY = m_positionY - KiROUND( sindecideg( r, a ) ); } } @@ -140,8 +140,8 @@ void PCB_ARC::SetPosOffset( int aX_offs, int aY_offs ) { PCB_COMPONENT::SetPosOffset( aX_offs, aY_offs ); - m_startX += aX_offs; - m_startY += aY_offs; + m_StartX += aX_offs; + m_StartY += aY_offs; } @@ -149,28 +149,28 @@ void PCB_ARC::Flip() { PCB_COMPONENT::Flip(); - m_startX = -m_startX; - m_angle = -m_angle; + m_StartX = -m_StartX; + m_Angle = -m_Angle; m_KiCadLayer = FlipLayer( m_KiCadLayer ); } -void PCB_ARC::AddToFootprint( MODULE* aModule ) +void PCB_ARC::AddToFootprint( FOOTPRINT* aFootprint ) { if( IsNonCopperLayer( m_KiCadLayer ) ) { - FP_SHAPE* arc = new FP_SHAPE( aModule, ( IsCircle() ? S_CIRCLE : S_ARC ) ); - aModule->Add( arc ); + FP_SHAPE* arc = new FP_SHAPE( aFootprint, ( IsCircle() ? S_CIRCLE : S_ARC ) ); + aFootprint->Add( arc ); arc->m_Start0 = wxPoint( m_positionX, m_positionY ); - arc->m_End0 = wxPoint( m_startX, m_startY ); + arc->m_End0 = wxPoint( m_StartX, m_StartY ); // Setting angle will set m_ThirdPoint0, so must be done after setting // m_Start0 and m_End0 - arc->SetAngle( -m_angle ); + arc->SetAngle( -m_Angle ); - arc->SetWidth( m_width ); + arc->SetWidth( m_Width ); arc->SetLayer( m_KiCadLayer ); arc->SetDrawCoord(); @@ -187,15 +187,15 @@ void PCB_ARC::AddToBoard() arc->SetShape( IsCircle() ? S_CIRCLE : S_ARC ); arc->SetLayer( m_KiCadLayer ); arc->SetStart( wxPoint( m_positionX, m_positionY ) ); - arc->SetEnd( wxPoint( m_startX, m_startY ) ); - arc->SetAngle( -m_angle ); - arc->SetWidth( m_width ); + arc->SetEnd( wxPoint( m_StartX, m_StartY ) ); + arc->SetAngle( -m_Angle ); + arc->SetWidth( m_Width ); } bool PCB_ARC::IsCircle() { - return ( m_angle == 3600 ); + return ( m_Angle == 3600 ); } } // namespace PCAD2KICAD diff --git a/pcbnew/plugins/pcad/pcb_arc.h b/pcbnew/plugins/pcad/pcb_arc.h index 5936bff3e3..ccf9cfa65c 100644 --- a/pcbnew/plugins/pcad/pcb_arc.h +++ b/pcbnew/plugins/pcad/pcb_arc.h @@ -39,26 +39,26 @@ namespace PCAD2KICAD { class PCB_ARC : public PCB_COMPONENT { public: - int m_startX; - int m_startY; - double m_angle; - int m_width; + int m_StartX; + int m_StartY; + double m_Angle; + int m_Width; PCB_ARC( PCB_CALLBACKS* aCallbacks, BOARD* aBoard ); ~PCB_ARC(); - virtual void Parse( XNODE* aNode, - int aLayer, - const wxString& aDefaultMeasurementUnit, - const wxString& aActualConversion ); + virtual void Parse( XNODE* aNode, int aLayer, const wxString& aDefaultMeasurementUnit, + const wxString& aActualConversion ); - virtual void SetPosOffset( int aX_offs, int aY_offs ) override; - virtual void Flip() override; - void AddToFootprint( MODULE* aModule ) override; - void AddToBoard() override; + virtual void SetPosOffset( int aX_offs, int aY_offs ) override; + + virtual void Flip() override; + + void AddToFootprint( FOOTPRINT* aFootprint ) override; + void AddToBoard() override; private: - bool IsCircle(); + bool IsCircle(); }; } // namespace PCAD2KICAD diff --git a/pcbnew/plugins/pcad/pcb_component.cpp b/pcbnew/plugins/pcad/pcb_component.cpp index 975bed8a72..456003f2c1 100644 --- a/pcbnew/plugins/pcad/pcb_component.cpp +++ b/pcbnew/plugins/pcad/pcb_component.cpp @@ -61,7 +61,7 @@ PCB_COMPONENT::~PCB_COMPONENT() } -void PCB_COMPONENT::AddToFootprint( MODULE* aModule ) +void PCB_COMPONENT::AddToFootprint( FOOTPRINT* aFootprint ) { } diff --git a/pcbnew/plugins/pcad/pcb_component.h b/pcbnew/plugins/pcad/pcb_component.h index 1dc6f74321..d072b684f3 100644 --- a/pcbnew/plugins/pcad/pcb_component.h +++ b/pcbnew/plugins/pcad/pcb_component.h @@ -64,7 +64,7 @@ public: virtual void SetPosOffset( int aX_offs, int aY_offs ); virtual void Flip(); - virtual void AddToFootprint( MODULE* aModule ); + virtual void AddToFootprint( FOOTPRINT* aFootprint ); virtual void AddToBoard() = 0; PCB_LAYER_ID GetKiCadLayer() { return m_callbacks->GetKiCadLayer( m_PCadLayer ); } diff --git a/pcbnew/plugins/pcad/pcb_line.cpp b/pcbnew/plugins/pcad/pcb_line.cpp index 934a0add75..6b6158c9f5 100644 --- a/pcbnew/plugins/pcad/pcb_line.cpp +++ b/pcbnew/plugins/pcad/pcb_line.cpp @@ -115,12 +115,12 @@ void PCB_LINE::Flip() } -void PCB_LINE::AddToFootprint( MODULE* aModule ) +void PCB_LINE::AddToFootprint( FOOTPRINT* aFootprint ) { if( IsNonCopperLayer( m_KiCadLayer ) ) { - FP_SHAPE* segment = new FP_SHAPE( aModule, S_SEGMENT ); - aModule->Add( segment ); + FP_SHAPE* segment = new FP_SHAPE( aFootprint, S_SEGMENT ); + aFootprint->Add( segment ); segment->m_Start0 = wxPoint( m_positionX, m_positionY ); segment->m_End0 = wxPoint( m_toX, m_toY ); diff --git a/pcbnew/plugins/pcad/pcb_line.h b/pcbnew/plugins/pcad/pcb_line.h index 71b16a13d3..2e0e0fa8ae 100644 --- a/pcbnew/plugins/pcad/pcb_line.h +++ b/pcbnew/plugins/pcad/pcb_line.h @@ -47,14 +47,15 @@ public: PCB_LINE( PCB_CALLBACKS* aCallbacks, BOARD* aBoard ); ~PCB_LINE(); - virtual void Parse( XNODE* aNode, - int aLayer, - const wxString& aDefaultMeasurementUnit, - const wxString& aActualConversion ); - virtual void SetPosOffset( int aX_offs, int aY_offs ) override; - virtual void Flip() override; - void AddToFootprint( MODULE* aModule ) override; - void AddToBoard() override; + virtual void Parse( XNODE* aNode, int aLayer, const wxString& aDefaultMeasurementUnit, + const wxString& aActualConversion ); + + virtual void SetPosOffset( int aX_offs, int aY_offs ) override; + + virtual void Flip() override; + + void AddToFootprint( FOOTPRINT* aFootprint ) override; + void AddToBoard() override; }; } // namespace PCAD2KICAD diff --git a/pcbnew/plugins/pcad/pcb_module.cpp b/pcbnew/plugins/pcad/pcb_module.cpp index 3f18c05095..a922adcc25 100644 --- a/pcbnew/plugins/pcad/pcb_module.cpp +++ b/pcbnew/plugins/pcad/pcb_module.cpp @@ -478,7 +478,7 @@ wxString PCB_MODULE::ModuleLayer( int aMirror ) wxString result; // ///NOT ! {IntToStr(KiCadLayer)} NOT ! - // / MODULES ARE HARD PLACED ON COMPONENT OR COPPER LAYER. + // / FOOTPRINTs ARE HARD PLACED ON COMPONENT OR COPPER LAYER. // / IsFLIPPED--> MIRROR attribute is decision Point!!! if( aMirror == 0 ) @@ -502,7 +502,7 @@ void PCB_MODULE::AddToBoard() CorrectTextPosition( &m_value ); RotatePoint( &m_value.correctedPositionX, &m_value.correctedPositionY, (double) -m_rotation ); - MODULE* module = new MODULE( m_board ); + FOOTPRINT* module = new FOOTPRINT( m_board ); m_board->Add( module, ADD_MODE::APPEND ); module->SetPosition( wxPoint( m_positionX, m_positionY ) ); diff --git a/pcbnew/plugins/pcad/pcb_pad.cpp b/pcbnew/plugins/pcad/pcb_pad.cpp index 9f7ee46378..ee6121219a 100644 --- a/pcbnew/plugins/pcad/pcb_pad.cpp +++ b/pcbnew/plugins/pcad/pcb_pad.cpp @@ -186,7 +186,7 @@ void PCB_PAD::Flip() } -void PCB_PAD::AddToFootprint( MODULE* aFootprint, int aRotation, bool aEncapsulatedPad ) +void PCB_PAD::AddToFootprint( FOOTPRINT* aFootprint, int aRotation, bool aEncapsulatedPad ) { PCB_PAD_SHAPE* padShape; wxString padShapeName = wxT( "Ellipse" ); @@ -359,7 +359,7 @@ void PCB_PAD::AddToBoard() } else // pad { - MODULE* module = new MODULE( m_board ); + FOOTPRINT* module = new FOOTPRINT( m_board ); m_board->Add( module, ADD_MODE::APPEND ); m_name.text = m_defaultPinDes; diff --git a/pcbnew/plugins/pcad/pcb_pad.h b/pcbnew/plugins/pcad/pcb_pad.h index 5bf664802c..52250ae96c 100644 --- a/pcbnew/plugins/pcad/pcb_pad.h +++ b/pcbnew/plugins/pcad/pcb_pad.h @@ -49,12 +49,12 @@ public: virtual void Flip() override; - void AddToFootprint( MODULE* aFootprint ) override + void AddToFootprint( FOOTPRINT* aFootprint ) override { AddToFootprint( aFootprint, 0, true ); } - void AddToFootprint( MODULE* aFootprint, int aRotation, bool aEncapsulatedPad ); + void AddToFootprint( FOOTPRINT* aFootprint, int aRotation, bool aEncapsulatedPad ); void AddToBoard() override; diff --git a/pcbnew/plugins/pcad/pcb_polygon.cpp b/pcbnew/plugins/pcad/pcb_polygon.cpp index b17084bad5..45be499af6 100644 --- a/pcbnew/plugins/pcad/pcb_polygon.cpp +++ b/pcbnew/plugins/pcad/pcb_polygon.cpp @@ -160,7 +160,7 @@ bool PCB_POLYGON::Parse( XNODE* aNode, } -void PCB_POLYGON::AddToFootprint( MODULE* aFootprint ) +void PCB_POLYGON::AddToFootprint( FOOTPRINT* aFootprint ) { if( IsNonCopperLayer( m_KiCadLayer ) ) { diff --git a/pcbnew/plugins/pcad/pcb_polygon.h b/pcbnew/plugins/pcad/pcb_polygon.h index ead5525a32..817b09f3b7 100644 --- a/pcbnew/plugins/pcad/pcb_polygon.h +++ b/pcbnew/plugins/pcad/pcb_polygon.h @@ -58,7 +58,7 @@ public: virtual void Flip() override; - void AddToFootprint( MODULE* aFootprint ) override; + void AddToFootprint( FOOTPRINT* aFootprint ) override; void AddToBoard() override; diff --git a/pcbnew/plugins/pcad/pcb_text.cpp b/pcbnew/plugins/pcad/pcb_text.cpp index 6917b367d3..bef9451511 100644 --- a/pcbnew/plugins/pcad/pcb_text.cpp +++ b/pcbnew/plugins/pcad/pcb_text.cpp @@ -89,7 +89,7 @@ void PCB_TEXT::Parse( XNODE* aNode, int aLayer, const wxString& aDefaultMeasurem } -void PCB_TEXT::AddToFootprint( MODULE* aFootprint ) +void PCB_TEXT::AddToFootprint( FOOTPRINT* aFootprint ) { } diff --git a/pcbnew/plugins/pcad/pcb_text.h b/pcbnew/plugins/pcad/pcb_text.h index 29d3068e3e..41d000d120 100644 --- a/pcbnew/plugins/pcad/pcb_text.h +++ b/pcbnew/plugins/pcad/pcb_text.h @@ -47,7 +47,7 @@ public: virtual void Parse( XNODE* aNode, int aLayer, const wxString& aDefaultMeasurementUnit, const wxString& aActualConversion ); - void AddToFootprint( MODULE* aFootprint ) override; + void AddToFootprint( FOOTPRINT* aFootprint ) override; void AddToBoard() override; diff --git a/pcbnew/router/pns_kicad_iface.cpp b/pcbnew/router/pns_kicad_iface.cpp index 801d313a0a..f489be2f32 100644 --- a/pcbnew/router/pns_kicad_iface.cpp +++ b/pcbnew/router/pns_kicad_iface.cpp @@ -19,7 +19,6 @@ * with this program. If not, see . */ -#include #include #include #include @@ -1186,9 +1185,9 @@ void PNS_KICAD_IFACE_BASE::SyncWorld( PNS::NODE *aWorld ) syncZone( aWorld, zone, boardOutline ); } - for( MODULE* module : m_board->Footprints() ) + for( FOOTPRINT* footprint : m_board->Footprints() ) { - for( PAD* pad : module->Pads() ) + for( PAD* pad : footprint->Pads() ) { if( std::unique_ptr solid = syncPad( pad ) ) aWorld->Add( std::move( solid ) ); @@ -1196,16 +1195,16 @@ void PNS_KICAD_IFACE_BASE::SyncWorld( PNS::NODE *aWorld ) worstPadClearance = std::max( worstPadClearance, pad->GetLocalClearance() ); } - syncTextItem( aWorld, &module->Reference(), module->Reference().GetLayer() ); - syncTextItem( aWorld, &module->Value(), module->Value().GetLayer() ); + syncTextItem( aWorld, &footprint->Reference(), footprint->Reference().GetLayer() ); + syncTextItem( aWorld, &footprint->Value(), footprint->Value().GetLayer() ); - for( FP_ZONE* zone : module->Zones() ) + for( FP_ZONE* zone : footprint->Zones() ) syncZone( aWorld, zone, boardOutline ); - if( module->IsNetTie() ) + if( footprint->IsNetTie() ) continue; - for( BOARD_ITEM* mgitem : module->GraphicalItems() ) + for( BOARD_ITEM* mgitem : footprint->GraphicalItems() ) { if( mgitem->Type() == PCB_FP_SHAPE_T ) { @@ -1355,7 +1354,7 @@ void PNS_KICAD_IFACE::RemoveItem( PNS::ITEM* aItem ) PAD* pad = static_cast( parent ); VECTOR2I pos = static_cast( aItem )->Pos(); - m_moduleOffsets[ pad ].p_old = pos; + m_fpOffsets[ pad ].p_old = pos; return; } @@ -1423,7 +1422,7 @@ void PNS_KICAD_IFACE::AddItem( PNS::ITEM* aItem ) PAD* pad = static_cast( aItem->Parent() ); VECTOR2I pos = static_cast( aItem )->Pos(); - m_moduleOffsets[ pad ].p_new = pos; + m_fpOffsets[ pad ].p_new = pos; return; } @@ -1444,14 +1443,14 @@ void PNS_KICAD_IFACE::AddItem( PNS::ITEM* aItem ) void PNS_KICAD_IFACE::Commit() { - std::set processedMods; + std::set processedMods; EraseView(); - for( auto mo : m_moduleOffsets ) + for( auto fpOffset : m_fpOffsets ) { - auto offset = mo.second.p_new - mo.second.p_old; - auto mod = mo.first->GetParent(); + auto offset = fpOffset.second.p_new - fpOffset.second.p_old; + auto mod = fpOffset.first->GetParent(); VECTOR2I p_orig = mod->GetPosition(); VECTOR2I p_new = p_orig + offset; @@ -1464,7 +1463,7 @@ void PNS_KICAD_IFACE::Commit() mod->SetPosition( wxPoint( p_new.x, p_new.y )); } - m_moduleOffsets.clear(); + m_fpOffsets.clear(); m_commit->Push( _( "Interactive Router" ) ); m_commit = std::make_unique( m_tool ); diff --git a/pcbnew/router/pns_kicad_iface.h b/pcbnew/router/pns_kicad_iface.h index 9f47ad5f30..c03c715b7a 100644 --- a/pcbnew/router/pns_kicad_iface.h +++ b/pcbnew/router/pns_kicad_iface.h @@ -33,7 +33,7 @@ class BOARD; class BOARD_COMMIT; class PCB_DISPLAY_OPTIONS; class PCB_TOOL_BASE; -class MODULE; +class FOOTPRINT; class PAD; namespace PNS @@ -132,7 +132,7 @@ private: VECTOR2I p_old, p_new; }; - std::map m_moduleOffsets; + std::map m_fpOffsets; KIGFX::VIEW* m_view; KIGFX::VIEW_GROUP* m_previewItems; std::unordered_set m_hiddenItems; diff --git a/pcbnew/router/router_tool.cpp b/pcbnew/router/router_tool.cpp index 0a032887a8..5770950cc8 100644 --- a/pcbnew/router/router_tool.cpp +++ b/pcbnew/router/router_tool.cpp @@ -1461,13 +1461,13 @@ int ROUTER_TOOL::InlineDrag( const TOOL_EVENT& aEvent ) PNS::ITEM* startItem = nullptr; PNS::ITEM_SET itemsToDrag; - const MODULE* module = nullptr; + const FOOTPRINT* footprint = nullptr; if( item->Type() == PCB_FOOTPRINT_T ) { - module = static_cast(item); + footprint = static_cast(item); - for( const PAD* pad : module->Pads() ) + for( const PAD* pad : footprint->Pads() ) { PNS::ITEM* solid = m_router->GetWorld()->FindItemByParent( pad ); @@ -1538,14 +1538,14 @@ int ROUTER_TOOL::InlineDrag( const TOOL_EVENT& aEvent ) updateEndItem( *evt ); m_router->Move( m_endSnapPoint, m_endItem ); - if( module ) + if( footprint ) { VECTOR2I offset = m_endSnapPoint - p; BOARD_ITEM* previewItem; view()->ClearPreview(); - for( BOARD_ITEM* drawing : module->GraphicalItems() ) + for( BOARD_ITEM* drawing : footprint->GraphicalItems() ) { previewItem = static_cast( drawing->Clone() ); @@ -1563,17 +1563,17 @@ int ROUTER_TOOL::InlineDrag( const TOOL_EVENT& aEvent ) view()->Hide( drawing, true ); } - previewItem = static_cast( module->Reference().Clone() ); + previewItem = static_cast( footprint->Reference().Clone() ); previewItem->Move( offset ); view()->AddToPreview( previewItem ); - view()->Hide( &module->Reference() ); + view()->Hide( &footprint->Reference() ); - previewItem = static_cast( module->Value().Clone() ); + previewItem = static_cast( footprint->Value().Clone() ); previewItem->Move( offset ); view()->AddToPreview( previewItem ); - view()->Hide( &module->Value() ); + view()->Hide( &footprint->Value() ); - for( ZONE* zone : module->Zones() ) + for( ZONE* zone : footprint->Zones() ) { previewItem = static_cast( zone->Clone() ); previewItem->Move( offset ); @@ -1601,15 +1601,15 @@ int ROUTER_TOOL::InlineDrag( const TOOL_EVENT& aEvent ) } } - if( module ) + if( footprint ) { - for( BOARD_ITEM* drawing : module->GraphicalItems() ) + for( BOARD_ITEM* drawing : footprint->GraphicalItems() ) view()->Hide( drawing, false ); - view()->Hide( &module->Reference(), false ); - view()->Hide( &module->Value(), false ); + view()->Hide( &footprint->Reference(), false ); + view()->Hide( &footprint->Value(), false ); - for( ZONE* zone : module->Zones() ) + for( ZONE* zone : footprint->Zones() ) view()->Hide( zone, false ); view()->ClearPreview(); diff --git a/pcbnew/specctra_import_export/specctra.h b/pcbnew/specctra_import_export/specctra.h index cbdd0d64f6..5108c63572 100644 --- a/pcbnew/specctra_import_export/specctra.h +++ b/pcbnew/specctra_import_export/specctra.h @@ -42,7 +42,7 @@ class BOARD; class TRACK; class VIA; class NETCLASS; -class MODULE; +class FOOTPRINT; class SHAPE_POLY_SET; typedef DSN::T DSN_T; @@ -3768,7 +3768,7 @@ class SPECCTRA_DB : public SPECCTRA_LEXER * @param aFootprint The MODULE from which to build the IMAGE. * @return IMAGE* - not tested for duplication yet. */ - IMAGE* makeIMAGE( BOARD* aBoard, MODULE* aFootprint ); + IMAGE* makeIMAGE( BOARD* aBoard, FOOTPRINT* aFootprint ); /** * Function makePADSTACK diff --git a/pcbnew/specctra_import_export/specctra_export.cpp b/pcbnew/specctra_import_export/specctra_export.cpp index 909167a6c0..6a85922c04 100644 --- a/pcbnew/specctra_import_export/specctra_export.cpp +++ b/pcbnew/specctra_import_export/specctra_export.cpp @@ -92,7 +92,7 @@ bool PCB_EDIT_FRAME::ExportSpecctraFile( const wxString& aFullFilename ) LOCALE_IO toggle; // Switch the locale to standard C - // DSN Images (=KiCad MODULES and pads) must be presented from the + // DSN Images (=KiCad FOOTPRINTs and PADs) must be presented from the // top view. So we temporarily flip any modules which are on the back // side of the board to the front, and record this in the MODULE's flag field. db.FlipMODULEs( GetBoard() ); @@ -593,14 +593,14 @@ PADSTACK* SPECCTRA_DB::makePADSTACK( BOARD* aBoard, PAD* aPad ) typedef std::map PINMAP; -IMAGE* SPECCTRA_DB::makeIMAGE( BOARD* aBoard, MODULE* aFootprint ) +IMAGE* SPECCTRA_DB::makeIMAGE( BOARD* aBoard, FOOTPRINT* aFootprint ) { PINMAP pinmap; wxString padName; PCB_TYPE_COLLECTOR fpItems; - // get all the MODULE's pads. + // get all the FOOTPRINT's pads. fpItems.Collect( aFootprint, scanPADs ); IMAGE* image = new IMAGE(0); @@ -904,22 +904,23 @@ void SPECCTRA_DB::FromBOARD( BOARD* aBoard ) for( int i=0; iGetReference() == wxEmptyString ) + if( footprint->GetReference() == wxEmptyString ) { THROW_IO_ERROR( wxString::Format( _( "Symbol with value of \"%s\" has empty reference id." ), - module->GetValue() ) ); + footprint->GetValue() ) ); } // if we cannot insert OK, that means the reference has been seen before. - STRINGSET_PAIR refpair = refs.insert( TO_UTF8( module->GetReference() ) ); + STRINGSET_PAIR refpair = refs.insert( TO_UTF8( footprint->GetReference() ) ); + if( !refpair.second ) // insert failed { THROW_IO_ERROR( wxString::Format( _( "Multiple symbols have identical reference IDs of \"%s\"." ), - module->GetReference() ) ); + footprint->GetReference() ) ); } } } @@ -1337,11 +1338,11 @@ void SPECCTRA_DB::FromBOARD( BOARD* aBoard ) for( int m = 0; mGetReference() ); + componentId = TO_UTF8( footprint->GetReference() ); // create a net list entry for all the actual pins in the image // for the current module. location of this code is critical @@ -1387,15 +1388,15 @@ void SPECCTRA_DB::FromBOARD( BOARD* aBoard ) comp->places.push_back( place ); - place->SetRotation( module->GetOrientationDegrees() ); - place->SetVertex( mapPt( module->GetPosition() ) ); + place->SetRotation( footprint->GetOrientationDegrees() ); + place->SetVertex( mapPt( footprint->GetPosition() ) ); place->component_id = componentId; - place->part_number = TO_UTF8( module->GetValue() ); + place->part_number = TO_UTF8( footprint->GetValue() ); // module is flipped from bottom side, set side to T_back - if( module->GetFlag() ) + if( footprint->GetFlag() ) { - double angle = 180.0 - module->GetOrientationDegrees(); + double angle = 180.0 - footprint->GetOrientationDegrees(); NORMALIZE_ANGLE_DEGREES_POS( angle ); place->SetRotation( angle ); @@ -1732,7 +1733,7 @@ void SPECCTRA_DB::exportNETCLASS( const NETCLASSPTR& aNetClass, BOARD* aBoard ) void SPECCTRA_DB::FlipMODULEs( BOARD* aBoard ) { - // DSN Images (=KiCad MODULES and pads) must be presented from the + // DSN Images (=KiCad FOOTPRINTs and PADs) must be presented from the // top view. // Note: to export footprints, the footprints must be flipped around the X axis, // otherwise the rotation angle is not good @@ -1755,7 +1756,7 @@ void SPECCTRA_DB::RevertMODULEs( BOARD* aBoard ) if( !modulesAreFlipped ) return; - // DSN Images (=KiCad MODULES and pads) must be presented from the + // DSN Images (=KiCad FOOTPRINTs and PADs) must be presented from the // top view. Restore those that were flipped. // Note: to export footprints, the footprints were flipped around the X axis, for( auto module : aBoard->Footprints() ) diff --git a/pcbnew/specctra_import_export/specctra_import.cpp b/pcbnew/specctra_import_export/specctra_import.cpp index 2fd6b96f0d..51e2f247ca 100644 --- a/pcbnew/specctra_import_export/specctra_import.cpp +++ b/pcbnew/specctra_import_export/specctra_import.cpp @@ -349,10 +349,10 @@ void SPECCTRA_DB::FromSESSION( BOARD* aBoard ) { PLACE* place = &places[i]; // '&' even though places[] holds a pointer! - wxString reference = FROM_UTF8( place->component_id.c_str() ); - MODULE* module = aBoard->FindModuleByReference( reference ); + wxString reference = FROM_UTF8( place->component_id.c_str() ); + FOOTPRINT* footprint = aBoard->FindFootprintByReference( reference ); - if( !module ) + if( !footprint ) { THROW_IO_ERROR( wxString::Format( _( "Reference '%s' not found." ), reference ) ); @@ -365,32 +365,32 @@ void SPECCTRA_DB::FromSESSION( BOARD* aBoard ) wxASSERT( resolution ); wxPoint newPos = mapPt( place->vertex, resolution ); - module->SetPosition( newPos ); + footprint->SetPosition( newPos ); if( place->side == T_front ) { // convert from degrees to tenths of degrees used in KiCad. int orientation = KiROUND( place->rotation * 10.0 ); - if( module->GetLayer() != F_Cu ) + if( footprint->GetLayer() != F_Cu ) { // module is on copper layer (back) - module->Flip( module->GetPosition(), false ); + footprint->Flip( footprint->GetPosition(), false ); } - module->SetOrientation( orientation ); + footprint->SetOrientation( orientation ); } else if( place->side == T_back ) { int orientation = KiROUND( (place->rotation + 180.0) * 10.0 ); - if( module->GetLayer() != B_Cu ) + if( footprint->GetLayer() != B_Cu ) { // module is on component layer (front) - module->Flip( module->GetPosition(), false ); + footprint->Flip( footprint->GetPosition(), false ); } - module->SetOrientation( orientation ); + footprint->SetOrientation( orientation ); } else { diff --git a/pcbnew/swig/board.i b/pcbnew/swig/board.i index a7decb4139..e9ebb20a15 100644 --- a/pcbnew/swig/board.i +++ b/pcbnew/swig/board.i @@ -111,7 +111,7 @@ HANDLE_EXCEPTIONS(BOARD::TracksInNetBetweenPoints) except: self.this = this - def GetModules(self): return self.Modules() + def GetFootprints(self): return self.Footprints() def GetDrawings(self): return self.Drawings() def GetTracks(self): return self.Tracks() diff --git a/pcbnew/swig/board_connected_item.i b/pcbnew/swig/board_connected_item.i index 8eaa0b52b7..90a65fe905 100644 --- a/pcbnew/swig/board_connected_item.i +++ b/pcbnew/swig/board_connected_item.i @@ -42,7 +42,7 @@ switch( aItem->Type() ) { case PCB_PAD_T: obj = SWIG_NewPointerObj( SWIG_as_voidptr(aItem), - SWIGTYPE_p_D_PAD, + SWIGTYPE_p_PAD, 0 | 0 ); break; diff --git a/pcbnew/swig/board_item.i b/pcbnew/swig/board_item.i index a2cb848e50..591c7f11e9 100644 --- a/pcbnew/swig/board_item.i +++ b/pcbnew/swig/board_item.i @@ -52,7 +52,7 @@ class ALIGNED_DIMENSION; class ORTHOGONAL_DIMENSION; class LEADER; class CENTER_DIMENSION; -class MODULE; +class FOOTPRINT; class PCB_GROUP; class FP_TEXT; class PCB_SHAPE; @@ -77,7 +77,7 @@ static ALIGNED_DIMENSION* Cast_to_ALIGNED_DIMENSION( BOARD_ITEM* ); static ORTHOGONAL_DIMENSION* Cast_to_ORTHOGONAL_DIMENSION( BOARD_ITEM* ); static LEADER* Cast_to_LEADER( BOARD_ITEM* ); static CENTER_DIMENSION* Cast_to_CENTER_DIMENSION( BOARD_ITEM* ); -static MODULE* Cast_to_MODULE( BOARD_ITEM* ); +static FOOTPRINT* Cast_to_FOOTPRINT( BOARD_ITEM* ); static PCB_GROUP* Cast_to_PCB_GROUP( BOARD_ITEM* ); static FP_TEXT* Cast_to_FP_TEXT( BOARD_ITEM* ); static PCB_SHAPE* Cast_to_PCB_SHAPE( BOARD_ITEM* ); @@ -102,7 +102,7 @@ static ALIGNED_DIMENSION* Cast_to_ALIGNED_DIMENSION( BOARD_ITEM* ); static ORTHOGONAL_DIMENSION* Cast_to_ORTHOGONAL_DIMENSION( BOARD_ITEM* ); static LEADER* Cast_to_LEADER( BOARD_ITEM* ); static CENTER_DIMENSION* Cast_to_CENTER_DIMENSION( BOARD_ITEM* ); -static MODULE* Cast_to_MODULE( BOARD_ITEM* ); +static FOOTPRINT* Cast_to_FOOTPRINT( BOARD_ITEM* ); static PCB_GROUP* Cast_to_PCB_GROUP( BOARD_ITEM* ); static FP_TEXT* Cast_to_FP_TEXT( BOARD_ITEM* ); static PCB_SHAPE* Cast_to_PCB_SHAPE( BOARD_ITEM* ); @@ -185,22 +185,22 @@ static PCB_TARGET* Cast_to_PCB_TARGET( BOARD_ITEM* ); // classes and therefore will C++ compile due to the respective headers which will go into // the %header section. See section 5.6.2 of SWIG 3.0 documentation. %wrapper %{ -static PCB_TEXT* Cast_to_PCB_TEXT( BOARD_ITEM* self ) { return dynamic_cast(self); } +static PCB_TEXT* Cast_to_PCB_TEXT( BOARD_ITEM* self ) { return dynamic_cast(self); } static ALIGNED_DIMENSION* Cast_to_ALIGNED_DIMENSION( BOARD_ITEM* self ) { return dynamic_cast(self); } static ORTHOGONAL_DIMENSION* Cast_to_ORTHOGONAL_DIMENSION( BOARD_ITEM* self ) { return dynamic_cast(self); } static LEADER* Cast_to_LEADER( BOARD_ITEM* self ) { return dynamic_cast(self); } static CENTER_DIMENSION* Cast_to_CENTER_DIMENSION( BOARD_ITEM* self ) { return dynamic_cast(self); } -static MODULE* Cast_to_MODULE( BOARD_ITEM* self ) { return dynamic_cast(self); } +static FOOTPRINT* Cast_to_FOOTPRINT( BOARD_ITEM* self ) { return dynamic_cast(self); } static PCB_GROUP* Cast_to_PCB_GROUP( BOARD_ITEM* self ) { return dynamic_cast(self); } static FP_TEXT* Cast_to_FP_TEXT( BOARD_ITEM* self ) { return dynamic_cast(self); } static PCB_SHAPE* Cast_to_PCB_SHAPE( BOARD_ITEM* self ) { return dynamic_cast(self); } static MARKER_PCB* Cast_to_MARKER_PCB( BOARD_ITEM* self ) { return dynamic_cast(self); } static BOARD* Cast_to_BOARD( BOARD_ITEM* self ) { return dynamic_cast(self); } -static FP_SHAPE* Cast_to_FP_SHAPE( BOARD_ITEM* self ) { return dynamic_cast(self); } -static PAD* Cast_to_PAD( BOARD_ITEM* self ) { return dynamic_cast( self); } +static FP_SHAPE* Cast_to_FP_SHAPE( BOARD_ITEM* self ) { return dynamic_cast(self); } +static PAD* Cast_to_PAD( BOARD_ITEM* self ) { return dynamic_cast(self); } static TRACK* Cast_to_TRACK( BOARD_ITEM* self ) { return dynamic_cast(self); } static VIA* Cast_to_VIA( BOARD_ITEM* self ) { return dynamic_cast(self); } -static ZONE* Cast_to_ZONE( BOARD_ITEM* self ) { return dynamic_cast( self); } -static FP_ZONE* Cast_to_FP_ZONE( BOARD_ITEM* self ) { return dynamic_cast( self); } +static ZONE* Cast_to_ZONE( BOARD_ITEM* self ) { return dynamic_cast(self); } +static FP_ZONE* Cast_to_FP_ZONE( BOARD_ITEM* self ) { return dynamic_cast(self); } static PCB_TARGET* Cast_to_PCB_TARGET( BOARD_ITEM* self ) { return dynamic_cast(self); } %} diff --git a/pcbnew/swig/footprint.i b/pcbnew/swig/footprint.i index 0fa7b74ada..e21075d3a6 100644 --- a/pcbnew/swig/footprint.i +++ b/pcbnew/swig/footprint.i @@ -34,24 +34,24 @@ %include footprint.h %feature("flatnested", ""); -%rename(Get) operator MODULE*; +%rename(Get) operator FOOTPRINT*; %{ #include %} -%template(MODULE_3D_SETTINGS_List) std::list; +%template(FP_3DMODLE_List) std::list; // BOARD_ITEM_CONTAINER's interface functions will be implemented by SWIG // automatically and inherited by the python wrapper class. -%extend MODULE +%extend FOOTPRINT { %pythoncode %{ #def SaveToLibrary(self,filename): - # return SaveModuleToLibrary(filename,self) + # return SaveFootprintToLibrary(filename,self) # # add function, clears the thisown to avoid python from deleting @@ -124,16 +124,17 @@ %{ // called from pcbnew/swig/pcbnew_footprint_wizards.cpp -MODULE* PyModule_to_MODULE(PyObject *obj0) +MODULE* PyFootprint_to_FOOTPRINT(PyObject *obj0) { void* argp; - int res1 = SWIG_ConvertPtr(obj0, &argp,SWIGTYPE_p_MODULE, 0 | 0 ); + int res1 = SWIG_ConvertPtr(obj0, &argp,SWIGTYPE_p_FOOTPRINT, 0 | 0 ); + if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "Converting object to MODULE*"); + SWIG_exception_fail(SWIG_ArgError(res1), "Converting object to FOOTPRINT*"); } - return (MODULE*) argp; + return ( FOOTPRINT *) argp; fail: return NULL; diff --git a/pcbnew/swig/pad.i b/pcbnew/swig/pad.i index eb49ff24a5..af1421f987 100644 --- a/pcbnew/swig/pad.i +++ b/pcbnew/swig/pad.i @@ -3,29 +3,29 @@ %include pad_shapes.h %include pad.h -%rename(Get) operator D_PAD*; +%rename(Get) operator PAD*; %{ #include %} -%extend D_PAD +%extend PAD { %pythoncode %{ - # SetPadName() is the old name for D_PAD::SetName() + # SetPadName() is the old name for PAD::SetName() # define it for compatibility def SetPadName(self, aName): return self.SetName(aName) - # GetPadName() is the old name for D_PAD::GetName() + # GetPadName() is the old name for PAD::GetName() # define it for compatibility def GetPadName(self): return self.GetName() # AddPrimitive() is the old name for D_PAD::AddPrimitivePoly(), - # D_PAD::AddPrimitiveSegment(), D_PAD::AddPrimitiveCircle(), - # D_PAD::AddPrimitiveArc(), D_PAD::AddPrimitiveCurve() + # PAD::AddPrimitiveSegment(), PAD::AddPrimitiveCircle(), + # PAD::AddPrimitiveArc(), PAD::AddPrimitiveCurve() # define it for compatibility def AddPrimitive(self, *args): if len(args) == 2: diff --git a/pcbnew/swig/pcbnew.i b/pcbnew/swig/pcbnew.i index 150788cabd..9504d6be12 100644 --- a/pcbnew/swig/pcbnew.i +++ b/pcbnew/swig/pcbnew.i @@ -53,7 +53,7 @@ // ignore a couple of items that generate warnings from swig built code %ignore BOARD_ITEM::ZeroOffset; -%ignore D_PAD::m_PadSketchModePenSize; +%ignore PAD::m_PadSketchModePenSize; class BASE_SET {}; %ignore BASE_SET; diff --git a/pcbnew/swig/pcbnew_action_plugins.cpp b/pcbnew/swig/pcbnew_action_plugins.cpp index 06c1dacc76..1aa4961b5e 100644 --- a/pcbnew/swig/pcbnew_action_plugins.cpp +++ b/pcbnew/swig/pcbnew_action_plugins.cpp @@ -217,7 +217,7 @@ void PCB_EDIT_FRAME::RunActionPlugin( ACTION_PLUGIN* aActionPlugin ) } // Append footprints: - for( MODULE* item : currentPcb->Modules() ) + for( FOOTPRINT* item : currentPcb->Footprints() ) { ITEM_PICKER picker( nullptr, item, UNDO_REDO::CHANGED ); itemsList.PushItem( picker ); @@ -274,7 +274,7 @@ void PCB_EDIT_FRAME::RunActionPlugin( ACTION_PLUGIN* aActionPlugin ) currItemList.insert( item ); // Append footprints: - for( MODULE* item : currentPcb->Modules() ) + for( FOOTPRINT* item : currentPcb->Footprints() ) currItemList.insert( item ); // Append drawings @@ -304,7 +304,7 @@ void PCB_EDIT_FRAME::RunActionPlugin( ACTION_PLUGIN* aActionPlugin ) } // Find new footprints - for( MODULE* item : currentPcb->Modules() ) + for( FOOTPRINT* item : currentPcb->Footprints() ) { if( !oldBuffer->ContainsItem( item ) ) { diff --git a/pcbnew/swig/pcbnew_footprint_wizards.cpp b/pcbnew/swig/pcbnew_footprint_wizards.cpp index 20e2005e40..3c93a722b9 100644 --- a/pcbnew/swig/pcbnew_footprint_wizards.cpp +++ b/pcbnew/swig/pcbnew_footprint_wizards.cpp @@ -342,10 +342,10 @@ void PYTHON_FOOTPRINT_WIZARD::ResetParameters() // this is a SWIG function declaration -from module.i -MODULE* PyModule_to_MODULE( PyObject* obj0 ); +FOOTPRINT* PyFootprint_to_FOOTPRINT( PyObject* obj0 ); -MODULE* PYTHON_FOOTPRINT_WIZARD::GetFootprint( wxString * aMessages ) +FOOTPRINT* PYTHON_FOOTPRINT_WIZARD::GetFootprint( wxString * aMessages ) { PyLOCK lock; @@ -365,9 +365,9 @@ MODULE* PYTHON_FOOTPRINT_WIZARD::GetFootprint( wxString * aMessages ) PyErr_Clear(); } - MODULE* mod = PyModule_to_MODULE( obj ); + FOOTPRINT* footprint = PyFootprint_to_FOOTPRINT( obj ); - return mod; + return footprint; } diff --git a/pcbnew/swig/pcbnew_footprint_wizards.h b/pcbnew/swig/pcbnew_footprint_wizards.h index f102e832b3..bbe188bf20 100644 --- a/pcbnew/swig/pcbnew_footprint_wizards.h +++ b/pcbnew/swig/pcbnew_footprint_wizards.h @@ -43,8 +43,7 @@ class PYTHON_FOOTPRINT_WIZARD : public FOOTPRINT_WIZARD PyObject* m_PyWizard; PyObject* CallMethod( const char* aMethod, PyObject* aArglist = NULL ); wxString CallRetStrMethod( const char* aMethod, PyObject* aArglist = NULL ); - wxArrayString CallRetArrayStrMethod( const char* aMethod, - PyObject* aArglist = NULL ); + wxArrayString CallRetArrayStrMethod( const char* aMethod, PyObject* aArglist = NULL ); public: PYTHON_FOOTPRINT_WIZARD( PyObject* wizard ); @@ -61,7 +60,7 @@ public: wxArrayString GetParameterErrors( int aPage ) override; // must return an empty string or an error description: wxString SetParameterValues( int aPage, wxArrayString& aValues ) override; - MODULE* GetFootprint( wxString * aMessages ) override; + FOOTPRINT* GetFootprint( wxString * aMessages ) override; void* GetObject() override; wxArrayString GetParameterHints( int aPage ) override; wxArrayString GetParameterDesignators( int aPage = 0) override; diff --git a/pcbnew/text_mod_grid_table.h b/pcbnew/text_mod_grid_table.h index c3aa8944a4..406c85846f 100644 --- a/pcbnew/text_mod_grid_table.h +++ b/pcbnew/text_mod_grid_table.h @@ -30,7 +30,7 @@ #include -class MODULE; +class FOOTPRINT; class PCB_BASE_FRAME; enum TEXT_MOD_COL_ORDER diff --git a/pcbnew/tools/convert_tool.cpp b/pcbnew/tools/convert_tool.cpp index 64e0c0f8ab..cf1adb3529 100644 --- a/pcbnew/tools/convert_tool.cpp +++ b/pcbnew/tools/convert_tool.cpp @@ -118,7 +118,7 @@ bool CONVERT_TOOL::Init() int CONVERT_TOOL::LinesToPoly( const TOOL_EVENT& aEvent ) { - MODULE* parentFootprint = nullptr; + FOOTPRINT* parentFootprint = nullptr; auto& selection = m_selectionTool->RequestSelection( []( const VECTOR2I& aPt, GENERAL_COLLECTOR& aCollector, SELECTION_TOOL* sTool ) @@ -473,7 +473,7 @@ int CONVERT_TOOL::PolyToLines( const TOOL_EVENT& aEvent ) BOARD_COMMIT commit( m_frame ); FOOTPRINT_EDIT_FRAME* fpEditor = dynamic_cast( m_frame ); - MODULE* footprint = nullptr; + FOOTPRINT* footprint = nullptr; if( fpEditor ) footprint = fpEditor->GetBoard()->GetFirstFootprint(); diff --git a/pcbnew/tools/drawing_tool.cpp b/pcbnew/tools/drawing_tool.cpp index 05b8d69498..a98d08380e 100644 --- a/pcbnew/tools/drawing_tool.cpp +++ b/pcbnew/tools/drawing_tool.cpp @@ -235,7 +235,7 @@ int DRAWING_TOOL::DrawLine( const TOOL_EVENT& aEvent ) if( m_isFootprintEditor && !m_frame->GetModel() ) return 0; - MODULE* parentFootprint = dynamic_cast( m_frame->GetModel() ); + FOOTPRINT* parentFootprint = dynamic_cast( m_frame->GetModel() ); PCB_SHAPE* line = m_isFootprintEditor ? new FP_SHAPE( parentFootprint ) : new PCB_SHAPE; BOARD_COMMIT commit( m_frame ); SCOPED_DRAW_MODE scopedDrawMode( m_mode, MODE::LINE ); @@ -281,7 +281,7 @@ int DRAWING_TOOL::DrawRectangle( const TOOL_EVENT& aEvent ) if( m_isFootprintEditor && !m_frame->GetModel() ) return 0; - MODULE* parentFootprint = dynamic_cast( m_frame->GetModel() ); + FOOTPRINT* parentFootprint = dynamic_cast( m_frame->GetModel() ); PCB_SHAPE* rect = m_isFootprintEditor ? new FP_SHAPE( parentFootprint ) : new PCB_SHAPE; BOARD_COMMIT commit( m_frame ); SCOPED_DRAW_MODE scopedDrawMode( m_mode, MODE::RECTANGLE ); @@ -325,7 +325,7 @@ int DRAWING_TOOL::DrawCircle( const TOOL_EVENT& aEvent ) if( m_isFootprintEditor && !m_frame->GetModel() ) return 0; - MODULE* parentFootprint = dynamic_cast( m_frame->GetModel() ); + FOOTPRINT* parentFootprint = dynamic_cast( m_frame->GetModel() ); PCB_SHAPE* circle = m_isFootprintEditor ? new FP_SHAPE( parentFootprint ) : new PCB_SHAPE; BOARD_COMMIT commit( m_frame ); SCOPED_DRAW_MODE scopedDrawMode( m_mode, MODE::CIRCLE ); @@ -369,7 +369,7 @@ int DRAWING_TOOL::DrawArc( const TOOL_EVENT& aEvent ) if( m_isFootprintEditor && !m_frame->GetModel() ) return 0; - MODULE* parentFootprint = dynamic_cast( m_frame->GetModel() ); + FOOTPRINT* parentFootprint = dynamic_cast( m_frame->GetModel() ); PCB_SHAPE* arc = m_isFootprintEditor ? new FP_SHAPE( parentFootprint ) : new PCB_SHAPE; BOARD_COMMIT commit( m_frame ); SCOPED_DRAW_MODE scopedDrawMode( m_mode, MODE::ARC ); @@ -501,7 +501,7 @@ int DRAWING_TOOL::PlaceText( const TOOL_EVENT& aEvent ) // Init the new item attributes if( m_isFootprintEditor ) { - FP_TEXT* fpText = new FP_TEXT( (MODULE*) m_frame->GetModel() ); + FP_TEXT* fpText = new FP_TEXT( (FOOTPRINT*) m_frame->GetModel() ); fpText->SetLayer( layer ); fpText->SetTextSize( dsnSettings.GetTextSize( layer ) ); @@ -1197,13 +1197,13 @@ int DRAWING_TOOL::SetAnchor( const TOOL_EVENT& aEvent ) if( evt->IsClick( BUT_LEFT ) ) { - MODULE* module = (MODULE*) m_frame->GetModel(); + FOOTPRINT* footprint = (FOOTPRINT*) m_frame->GetModel(); BOARD_COMMIT commit( m_frame ); - commit.Modify( module ); + commit.Modify( footprint ); // set the new relative internal local coordinates of footprint items - wxPoint moveVector = module->GetPosition() - (wxPoint) cursorPos; - module->MoveAnchorPosition( moveVector ); + wxPoint moveVector = footprint->GetPosition() - (wxPoint) cursorPos; + footprint->MoveAnchorPosition( moveVector ); commit.Push( _( "Move the footprint reference anchor" ) ); @@ -2135,9 +2135,9 @@ int DRAWING_TOOL::DrawVia( const TOOL_EVENT& aEvent ) return true; } - if( MODULE* mod = dyn_cast( item ) ) + if( FOOTPRINT* footprint = dynamic_cast( item ) ) { - for( PAD* pad : mod->Pads() ) + for( PAD* pad : footprint->Pads() ) { for( PCB_LAYER_ID layer : pad->GetLayerSet().Seq() ) { @@ -2173,7 +2173,7 @@ int DRAWING_TOOL::DrawVia( const TOOL_EVENT& aEvent ) const wxPoint position = aVia->GetPosition(); const LSET lset = aVia->GetLayerSet(); - for( MODULE* footprint : m_board->Footprints() ) + for( FOOTPRINT* footprint : m_board->Footprints() ) { for( PAD* pad : footprint->Pads() ) { diff --git a/pcbnew/tools/edit_tool.cpp b/pcbnew/tools/edit_tool.cpp index a667da6aec..613ca440f9 100644 --- a/pcbnew/tools/edit_tool.cpp +++ b/pcbnew/tools/edit_tool.cpp @@ -75,38 +75,38 @@ void EditToolSelectionFilter( GENERAL_COLLECTOR& aCollector, int aFlags, } else if( item->Type() == PCB_FP_ZONE_T ) { - MODULE* mod = static_cast( item->GetParent() ); + FOOTPRINT* fp = static_cast( item->GetParent() ); // case 1: handle locking - if( ( aFlags & EXCLUDE_LOCKED ) && mod && mod->IsLocked() ) + if( ( aFlags & EXCLUDE_LOCKED ) && fp && fp->IsLocked() ) { aCollector.Remove( item ); } // case 2: selection contains both the module and its pads - remove the pads - if( !( aFlags & INCLUDE_PADS_AND_MODULES ) && mod && aCollector.HasItem( mod ) ) + if( !( aFlags & INCLUDE_PADS_AND_MODULES ) && fp && aCollector.HasItem( fp ) ) aCollector.Remove( item ); } else if( item->Type() == PCB_PAD_T ) { - MODULE* mod = static_cast( item->GetParent() ); + FOOTPRINT* fp = static_cast( item->GetParent() ); // case 1: handle locking - if( ( aFlags & EXCLUDE_LOCKED ) && mod && mod->IsLocked() ) + if( ( aFlags & EXCLUDE_LOCKED ) && fp && fp->IsLocked() ) { aCollector.Remove( item ); } - else if( ( aFlags & EXCLUDE_LOCKED_PADS ) && mod && mod->PadsLocked() ) + else if( ( aFlags & EXCLUDE_LOCKED_PADS ) && fp && fp->PadsLocked() ) { // Pad locking is considerably "softer" than item locking aCollector.Remove( item ); - if( !mod->IsLocked() && !aCollector.HasItem( mod ) ) - aCollector.Append( mod ); + if( !fp->IsLocked() && !aCollector.HasItem( fp ) ) + aCollector.Append( fp ); } // case 2: selection contains both the module and its pads - remove the pads - if( !( aFlags & INCLUDE_PADS_AND_MODULES ) && mod && aCollector.HasItem( mod ) ) + if( !( aFlags & INCLUDE_PADS_AND_MODULES ) && fp && aCollector.HasItem( fp ) ) aCollector.Remove( item ); } else if( ( aFlags & EXCLUDE_TRANSIENTS ) && item->Type() == PCB_MARKER_T ) @@ -233,7 +233,7 @@ bool EDIT_TOOL::Init() int EDIT_TOOL::GetAndPlace( const TOOL_EVENT& aEvent ) { SELECTION_TOOL* selectionTool = m_toolMgr->GetTool(); - MODULE* fp = getEditFrame()->GetFootprintFromBoardByReference(); + FOOTPRINT* fp = getEditFrame()->GetFootprintFromBoardByReference(); if( fp ) { @@ -390,7 +390,7 @@ int EDIT_TOOL::doMoveSelection( TOOL_EVENT aEvent, bool aPickReference ) for( EDA_ITEM* item : selection ) { BOARD_ITEM* boardItem = dynamic_cast( item ); - MODULE* footprint = dynamic_cast( item ); + FOOTPRINT* footprint = dynamic_cast( item ); if( boardItem ) sel_items.push_back( boardItem ); @@ -1278,8 +1278,8 @@ int EDIT_TOOL::Remove( const TOOL_EVENT& aEvent ) { case PCB_FP_TEXT_T: { - FP_TEXT* text = static_cast( item ); - MODULE* parent = static_cast( item->GetParent() ); + FP_TEXT* text = static_cast( item ); + FOOTPRINT* parent = static_cast( item->GetParent() ); if( text->GetType() == FP_TEXT::TEXT_is_DIVERS ) { @@ -1292,8 +1292,8 @@ int EDIT_TOOL::Remove( const TOOL_EVENT& aEvent ) case PCB_PAD_T: { - PAD* pad = static_cast( item ); - MODULE* parent = static_cast( item->GetParent() ); + PAD* pad = static_cast( item ); + FOOTPRINT* parent = static_cast( item->GetParent() ); m_commit->Modify( parent ); getView()->Remove( pad ); @@ -1303,8 +1303,8 @@ int EDIT_TOOL::Remove( const TOOL_EVENT& aEvent ) case PCB_FP_ZONE_T: { - FP_ZONE* zone = static_cast( item ); - MODULE* parent = static_cast( item->GetParent() ); + FP_ZONE* zone = static_cast( item ); + FOOTPRINT* parent = static_cast( item->GetParent() ); m_commit->Modify( parent ); getView()->Remove( zone ); @@ -1566,7 +1566,7 @@ int EDIT_TOOL::Duplicate( const TOOL_EVENT& aEvent ) if( m_isFootprintEditor ) { - MODULE* parentFootprint = editFrame->GetBoard()->GetFirstFootprint(); + FOOTPRINT* parentFootprint = editFrame->GetBoard()->GetFirstFootprint(); dupe_item = parentFootprint->DuplicateItem( orig_item ); if( increment && item->Type() == PCB_PAD_T @@ -1581,7 +1581,7 @@ int EDIT_TOOL::Duplicate( const TOOL_EVENT& aEvent ) } else if( orig_item->GetParent() && orig_item->GetParent()->Type() == PCB_FOOTPRINT_T ) { - MODULE* parentFootprint = static_cast( orig_item->GetParent() ); + FOOTPRINT* parentFootprint = static_cast( orig_item->GetParent() ); m_commit->Modify( parentFootprint ); dupe_item = parentFootprint->DuplicateItem( orig_item, true /* add to parent */ ); diff --git a/pcbnew/tools/footprint_editor_tools.cpp b/pcbnew/tools/footprint_editor_tools.cpp index a5a5f151df..9b494c6cb2 100644 --- a/pcbnew/tools/footprint_editor_tools.cpp +++ b/pcbnew/tools/footprint_editor_tools.cpp @@ -126,8 +126,8 @@ bool FOOTPRINT_EDITOR_TOOLS::Init() int FOOTPRINT_EDITOR_TOOLS::NewFootprint( const TOOL_EVENT& aEvent ) { - LIB_ID selected = m_frame->GetTreeFPID(); - MODULE* newFootprint = m_frame->CreateNewFootprint( wxEmptyString ); + LIB_ID selected = m_frame->GetTreeFPID(); + FOOTPRINT* newFootprint = m_frame->CreateNewFootprint( wxEmptyString ); if( !newFootprint ) return 0; @@ -189,7 +189,7 @@ int FOOTPRINT_EDITOR_TOOLS::CreateFootprint( const TOOL_EVENT& aEvent ) if( wizard->ShowModal( NULL, m_frame ) ) { // Creates the new footprint from python script wizard - MODULE* newFootprint = wizard->GetBuiltFootprint(); + FOOTPRINT* newFootprint = wizard->GetBuiltFootprint(); if( newFootprint ) // i.e. if create module command is OK { @@ -279,7 +279,7 @@ int FOOTPRINT_EDITOR_TOOLS::SaveAs( const TOOL_EVENT& aEvent ) else { // Save Selected Footprint As - MODULE* footprint = m_frame->LoadFootprint( m_frame->GetTargetFPID() ); + FOOTPRINT* footprint = m_frame->LoadFootprint( m_frame->GetTargetFPID() ); if( footprint && m_frame->SaveFootprintAs( footprint ) ) m_frame->SyncLibraryTree( true ); @@ -302,7 +302,7 @@ int FOOTPRINT_EDITOR_TOOLS::CutCopyFootprint( const TOOL_EVENT& aEvent ) LIB_ID fpID = m_frame->GetTreeFPID(); if( fpID == m_frame->GetLoadedFPID() ) - m_copiedFootprint.reset( new MODULE( *m_frame->GetBoard()->GetFirstFootprint() ) ); + m_copiedFootprint.reset( new FOOTPRINT( *m_frame->GetBoard()->GetFirstFootprint() ) ); else m_copiedFootprint.reset( m_frame->LoadFootprint( fpID ) ); @@ -371,8 +371,8 @@ int FOOTPRINT_EDITOR_TOOLS::ImportFootprint( const TOOL_EVENT& aEvent ) int FOOTPRINT_EDITOR_TOOLS::ExportFootprint( const TOOL_EVENT& aEvent ) { - LIB_ID fpID = m_frame->GetTreeFPID(); - MODULE* fp; + LIB_ID fpID = m_frame->GetTreeFPID(); + FOOTPRINT* fp; if( !fpID.IsValid() ) fp = m_frame->GetBoard()->GetFirstFootprint(); @@ -428,7 +428,7 @@ int FOOTPRINT_EDITOR_TOOLS::ToggleFootprintTree( const TOOL_EVENT& aEvent ) int FOOTPRINT_EDITOR_TOOLS::Properties( const TOOL_EVENT& aEvent ) { - MODULE* footprint = m_frame->GetBoard()->GetFirstFootprint(); + FOOTPRINT* footprint = m_frame->GetBoard()->GetFirstFootprint(); if( footprint ) { diff --git a/pcbnew/tools/footprint_editor_tools.h b/pcbnew/tools/footprint_editor_tools.h index 18ffe8c68d..aadc521e61 100644 --- a/pcbnew/tools/footprint_editor_tools.h +++ b/pcbnew/tools/footprint_editor_tools.h @@ -79,10 +79,10 @@ private: void setTransitions() override; private: - FOOTPRINT_EDIT_FRAME* m_frame; + FOOTPRINT_EDIT_FRAME* m_frame; // A private clipboard for cut/copy/past of an entire footprint - std::unique_ptr m_copiedFootprint; + std::unique_ptr m_copiedFootprint; }; #endif diff --git a/pcbnew/tools/global_edit_tool.cpp b/pcbnew/tools/global_edit_tool.cpp index d37cddc139..9865cce44c 100644 --- a/pcbnew/tools/global_edit_tool.cpp +++ b/pcbnew/tools/global_edit_tool.cpp @@ -59,7 +59,7 @@ bool GLOBAL_EDIT_TOOL::Init() int GLOBAL_EDIT_TOOL::ExchangeFootprints( const TOOL_EVENT& aEvent ) { PCBNEW_SELECTION& selection = m_selectionTool->GetSelection(); - MODULE* footprint = nullptr; + FOOTPRINT* footprint = nullptr; bool updateMode = false; bool currentMode = false; @@ -67,7 +67,7 @@ int GLOBAL_EDIT_TOOL::ExchangeFootprints( const TOOL_EVENT& aEvent ) selection = m_selectionTool->RequestSelection( EDIT_TOOL::FootprintFilter ); if( !selection.Empty() ) - footprint = selection.FirstOfKind(); + footprint = selection.FirstOfKind(); if( aEvent.IsAction( &PCB_ACTIONS::updateFootprint ) ) { diff --git a/pcbnew/tools/grid_helper.cpp b/pcbnew/tools/grid_helper.cpp index a103a6fb0a..ef9599ffee 100644 --- a/pcbnew/tools/grid_helper.cpp +++ b/pcbnew/tools/grid_helper.cpp @@ -515,7 +515,7 @@ void GRID_HELPER::computeAnchors( BOARD_ITEM* aItem, const VECTOR2I& aRefPos, bo { case PCB_FOOTPRINT_T: { - MODULE* footprint = static_cast( aItem ); + FOOTPRINT* footprint = static_cast( aItem ); for( PAD* pad : footprint->Pads() ) { diff --git a/pcbnew/tools/group_tool.cpp b/pcbnew/tools/group_tool.cpp index 58ac530e58..27dfb0ef1e 100644 --- a/pcbnew/tools/group_tool.cpp +++ b/pcbnew/tools/group_tool.cpp @@ -355,7 +355,7 @@ int GROUP_TOOL::Group( const TOOL_EVENT& aEvent ) if( m_isFootprintEditor ) { - MODULE* parentFootprint = board->GetFirstFootprint(); + FOOTPRINT* parentFootprint = board->GetFirstFootprint(); m_frame->SaveCopyInUndoList( parentFootprint, UNDO_REDO::CHANGED ); @@ -413,7 +413,7 @@ int GROUP_TOOL::Ungroup( const TOOL_EVENT& aEvent ) { if( m_isFootprintEditor ) { - MODULE* parentFootprint = board->GetFirstFootprint(); + FOOTPRINT* parentFootprint = board->GetFirstFootprint(); m_frame->SaveCopyInUndoList( parentFootprint, UNDO_REDO::CHANGED ); diff --git a/pcbnew/tools/pad_tool.cpp b/pcbnew/tools/pad_tool.cpp index 9de25fa0ac..bc3485d887 100644 --- a/pcbnew/tools/pad_tool.cpp +++ b/pcbnew/tools/pad_tool.cpp @@ -142,7 +142,7 @@ int PAD_TOOL::copyPadSettings( const TOOL_EVENT& aEvent ) // can only copy from a single pad if( selection.Size() == 1 ) { - auto item = selection[0]; + EDA_ITEM* item = selection[0]; if( item->Type() == PCB_PAD_T ) { @@ -163,24 +163,24 @@ static void doPushPadProperties( BOARD& board, const PAD& aSrcPad, BOARD_COMMIT& bool aPadLayerFilter, bool aPadTypeFilter ) { - const MODULE* moduleRef = aSrcPad.GetParent(); + const FOOTPRINT* refFootprint = aSrcPad.GetParent(); - double pad_orient = aSrcPad.GetOrientation() - moduleRef->GetOrientation(); + double pad_orient = aSrcPad.GetOrientation() - refFootprint->GetOrientation(); - for( auto module : board.Footprints() ) + for( FOOTPRINT* footprint : board.Footprints() ) { - if( !aSameFootprints && ( module != moduleRef ) ) + if( !aSameFootprints && ( footprint != refFootprint ) ) continue; - if( module->GetFPID() != moduleRef->GetFPID() ) + if( footprint->GetFPID() != refFootprint->GetFPID() ) continue; - for( auto pad : module->Pads() ) + for( auto pad : footprint->Pads() ) { if( aPadShapeFilter && ( pad->GetShape() != aSrcPad.GetShape() ) ) continue; - double currpad_orient = pad->GetOrientation() - module->GetOrientation(); + double currpad_orient = pad->GetOrientation() - footprint->GetOrientation(); if( aPadOrientFilter && ( currpad_orient != pad_orient ) ) continue; @@ -211,19 +211,19 @@ int PAD_TOOL::pushPadSettings( const TOOL_EVENT& aEvent ) { auto& selTool = *m_toolMgr->GetTool(); const auto& selection = selTool.GetSelection(); - PAD* srcPad; + PAD* srcPad; if( selection.Size() == 1 && selection[0]->Type() == PCB_PAD_T ) srcPad = static_cast( selection[0] ); else return 0; - MODULE* module = srcPad->GetParent(); + FOOTPRINT* footprint = srcPad->GetParent(); - if( !module ) + if( !footprint ) return 0; - frame()->SetMsgPanel( module ); + frame()->SetMsgPanel( footprint ); DIALOG_PUSH_PAD_PROPERTIES dlg( frame() ); int dialogRet = dlg.ShowModal(); diff --git a/pcbnew/tools/pcb_editor_control.cpp b/pcbnew/tools/pcb_editor_control.cpp index 770aa54eae..e7d2470e51 100644 --- a/pcbnew/tools/pcb_editor_control.cpp +++ b/pcbnew/tools/pcb_editor_control.cpp @@ -411,13 +411,13 @@ int PCB_EDITOR_CONTROL::RepairBoard( const TOOL_EVENT& aEvent ) // Footprint IDs are the most important, so give them the first crack at "claiming" a // particular KIID. - for( MODULE* footprint : board()->Footprints() ) + for( FOOTPRINT* footprint : board()->Footprints() ) processItem( footprint ); // After that the principal use is for DRC marker pointers, which are most likely to pads // or tracks. - for( MODULE* footprint : board()->Footprints() ) + for( FOOTPRINT* footprint : board()->Footprints() ) { for( PAD* pad : footprint->Pads() ) processItem( pad ); @@ -428,7 +428,7 @@ int PCB_EDITOR_CONTROL::RepairBoard( const TOOL_EVENT& aEvent ) // From here out I don't think order matters much. - for( MODULE* footprint : board()->Footprints() ) + for( FOOTPRINT* footprint : board()->Footprints() ) { processItem( &footprint->Reference() ); processItem( &footprint->Value() ); @@ -758,10 +758,10 @@ int PCB_EDITOR_CONTROL::ViaSizeDec( const TOOL_EVENT& aEvent ) int PCB_EDITOR_CONTROL::PlaceModule( const TOOL_EVENT& aEvent ) { - MODULE* fp = aEvent.Parameter(); + FOOTPRINT* fp = aEvent.Parameter(); KIGFX::VIEW_CONTROLS* controls = getViewControls(); - BOARD_COMMIT commit( m_frame ); - BOARD* board = getModel(); + BOARD_COMMIT commit( m_frame ); + BOARD* board = getModel(); m_toolMgr->RunAction( PCB_ACTIONS::selectionClear, true ); controls->ShowCursor( true ); @@ -1255,7 +1255,7 @@ int PCB_EDITOR_CONTROL::EditFpInFpEditor( const TOOL_EVENT& aEvent ) if( selection.Empty() ) return 0; - MODULE* fp = selection.FirstOfKind(); + FOOTPRINT* fp = selection.FirstOfKind(); if( !fp ) return 0; diff --git a/pcbnew/tools/pcb_inspection_tool.cpp b/pcbnew/tools/pcb_inspection_tool.cpp index 68606b0408..59c1a6fd6c 100644 --- a/pcbnew/tools/pcb_inspection_tool.cpp +++ b/pcbnew/tools/pcb_inspection_tool.cpp @@ -403,12 +403,12 @@ int PCB_INSPECTION_TOOL::InspectConstraints( const TOOL_EVENT& aEvent ) for( ZONE* zone : m_frame->GetBoard()->Zones() ) zone->CacheBoundingBox(); - for( MODULE* module : m_frame->GetBoard()->Footprints() ) + for( FOOTPRINT* footprint : m_frame->GetBoard()->Footprints() ) { - for( ZONE* zone : module->Zones() ) + for( ZONE* zone : footprint->Zones() ) zone->CacheBoundingBox(); - module->BuildPolyCourtyards(); + footprint->BuildPolyCourtyards(); } if( item->Type() == PCB_TRACE_T ) @@ -862,7 +862,7 @@ int PCB_INSPECTION_TOOL::LocalRatsnestTool( const TOOL_EVENT& aEvent ) if( selection.Empty() ) { // Clear the previous local ratsnest if we click off all items - for( MODULE* fp : board->Footprints() ) + for( FOOTPRINT* fp : board->Footprints() ) { for( PAD* pad : fp->Pads() ) pad->SetLocalRatsnestVisible( opt.m_ShowGlobalRatsnest ); @@ -876,7 +876,7 @@ int PCB_INSPECTION_TOOL::LocalRatsnestTool( const TOOL_EVENT& aEvent ) { pad->SetLocalRatsnestVisible( !pad->GetLocalRatsnestVisible() ); } - else if( MODULE* fp = dyn_cast( item) ) + else if( FOOTPRINT* fp = dyn_cast( item) ) { if( !fp->Pads().empty() ) { @@ -899,7 +899,7 @@ int PCB_INSPECTION_TOOL::LocalRatsnestTool( const TOOL_EVENT& aEvent ) { if( aCondition != PCBNEW_PICKER_TOOL::END_ACTIVATE ) { - for( MODULE* fp : board->Footprints() ) + for( FOOTPRINT* fp : board->Footprints() ) { for( PAD* pad : fp->Pads() ) pad->SetLocalRatsnestVisible( opt.m_ShowGlobalRatsnest ); @@ -973,7 +973,7 @@ void PCB_INSPECTION_TOOL::calculateSelectionRatsnest( const VECTOR2I& aDelta ) if( item->Type() == PCB_FOOTPRINT_T ) { - for( PAD* pad : static_cast( item )->Pads() ) + for( PAD* pad : static_cast( item )->Pads() ) { if( pad->GetLocalRatsnestVisible() || displayOptions().m_ShowModuleRatsnest ) items.push_back( pad ); diff --git a/pcbnew/tools/pcb_tool_base.cpp b/pcbnew/tools/pcb_tool_base.cpp index 0836a0b144..1d9a756306 100644 --- a/pcbnew/tools/pcb_tool_base.cpp +++ b/pcbnew/tools/pcb_tool_base.cpp @@ -71,7 +71,7 @@ void PCB_TOOL_BASE::doInteractiveItemPlacement( const std::string& aTool, if( newItem->Type() == PCB_FOOTPRINT_T ) { - MODULE* fp = dyn_cast( newItem.get() ); + FOOTPRINT* fp = dyn_cast( newItem.get() ); // footprints have more drawable parts fp->RunOnChildren( std::bind( &KIGFX::VIEW_GROUP::Add, &preview, _1 ) ); diff --git a/pcbnew/tools/pcb_tool_base.h b/pcbnew/tools/pcb_tool_base.h index ca969ca0e8..3c5399cab3 100644 --- a/pcbnew/tools/pcb_tool_base.h +++ b/pcbnew/tools/pcb_tool_base.h @@ -159,7 +159,7 @@ protected: BOARD* board() const { return getModel(); } - MODULE* footprint() const + FOOTPRINT* footprint() const { return board()->GetFirstFootprint(); } diff --git a/pcbnew/tools/pcb_viewer_tools.cpp b/pcbnew/tools/pcb_viewer_tools.cpp index 30196533eb..9ac141216f 100644 --- a/pcbnew/tools/pcb_viewer_tools.cpp +++ b/pcbnew/tools/pcb_viewer_tools.cpp @@ -98,7 +98,7 @@ int PCB_VIEWER_TOOLS::ShowPadNumbers( const TOOL_EVENT& aEvent ) Flip( opts.m_DisplayPadNum ); frame()->SetDisplayOptions( opts ); - for( MODULE* fp : board()->Footprints() ) + for( FOOTPRINT* fp : board()->Footprints() ) { for( PAD* pad : fp->Pads() ) view()->Update( pad, KIGFX::GEOMETRY ); @@ -117,7 +117,7 @@ int PCB_VIEWER_TOOLS::PadDisplayMode( const TOOL_EVENT& aEvent ) Flip( opts.m_DisplayPadFill ); frame()->SetDisplayOptions( opts ); - for( MODULE* fp : board()->Footprints() ) + for( FOOTPRINT* fp : board()->Footprints() ) { for( PAD* pad : fp->Pads() ) view()->Update( pad, KIGFX::GEOMETRY ); @@ -136,7 +136,7 @@ int PCB_VIEWER_TOOLS::GraphicOutlines( const TOOL_EVENT& aEvent ) Flip( opts.m_DisplayGraphicsFill ); frame()->SetDisplayOptions( opts ); - for( MODULE* fp : board()->Footprints() ) + for( FOOTPRINT* fp : board()->Footprints() ) { for( BOARD_ITEM* item : fp->GraphicalItems() ) { @@ -166,7 +166,7 @@ int PCB_VIEWER_TOOLS::TextOutlines( const TOOL_EVENT& aEvent ) Flip( opts.m_DisplayTextFill ); frame()->SetDisplayOptions( opts ); - for( MODULE* fp : board()->Footprints() ) + for( FOOTPRINT* fp : board()->Footprints() ) { view()->Update( &fp->Reference(), KIGFX::GEOMETRY ); view()->Update( &fp->Value(), KIGFX::GEOMETRY ); diff --git a/pcbnew/tools/pcb_viewer_tools.h b/pcbnew/tools/pcb_viewer_tools.h index b443c7d3d8..807144ee25 100644 --- a/pcbnew/tools/pcb_viewer_tools.h +++ b/pcbnew/tools/pcb_viewer_tools.h @@ -110,7 +110,7 @@ protected: return getModel(); } - MODULE* module() const + FOOTPRINT* footprint() const { return board()->GetFirstFootprint(); } diff --git a/pcbnew/tools/pcbnew_control.cpp b/pcbnew/tools/pcbnew_control.cpp index f2013eb421..76d7d058c5 100644 --- a/pcbnew/tools/pcbnew_control.cpp +++ b/pcbnew/tools/pcbnew_control.cpp @@ -539,10 +539,10 @@ int PCBNEW_CONTROL::DeleteItemCursor( const TOOL_EVENT& aEvent ) } -void pasteFootprintItemsToFootprintEditor( MODULE* aClipFootprint, BOARD* aBoard, +void pasteFootprintItemsToFootprintEditor( FOOTPRINT* aClipFootprint, BOARD* aBoard, std::vector& aPastedItems ) { - MODULE* editorFootprint = aBoard->GetFirstFootprint(); + FOOTPRINT* editorFootprint = aBoard->GetFirstFootprint(); aClipFootprint->SetParent( aBoard ); @@ -666,10 +666,10 @@ int PCBNEW_CONTROL::Paste( const TOOL_EVENT& aEvent ) if( isFootprintEditor ) { - MODULE* editorFootprint = board()->GetFirstFootprint(); + FOOTPRINT* editorFootprint = board()->GetFirstFootprint(); std::vector pastedItems; - for( MODULE* clipFootprint : clipBoard->Footprints() ) + for( FOOTPRINT* clipFootprint : clipBoard->Footprints() ) pasteFootprintItemsToFootprintEditor( clipFootprint, board(), pastedItems ); for( BOARD_ITEM* clipDrawItem : clipBoard->Drawings() ) @@ -718,7 +718,7 @@ int PCBNEW_CONTROL::Paste( const TOOL_EVENT& aEvent ) case PCB_FOOTPRINT_T: { - MODULE* clipFootprint = static_cast( clipItem ); + FOOTPRINT* clipFootprint = static_cast( clipItem ); std::vector pastedItems; if( isFootprintEditor ) @@ -888,7 +888,7 @@ int PCBNEW_CONTROL::placeBoardItems( std::vector& aItems, bool aIsN case PCB_FOOTPRINT_T: // Update the module path with the new KIID path if the module is new if( aIsNew ) - static_cast( item )->SetPath( KIID_PATH() ); + static_cast( item )->SetPath( KIID_PATH() ); break; @@ -1075,7 +1075,7 @@ int PCBNEW_CONTROL::UpdateMessagePanel( const TOOL_EVENT& aEvent ) } else if( auto editFrame = dynamic_cast( m_frame ) ) { - MODULE* footprint = static_cast( editFrame->GetModel() ); + FOOTPRINT* footprint = static_cast( editFrame->GetModel() ); if( !footprint ) return 0; diff --git a/pcbnew/tools/pcbnew_selection.cpp b/pcbnew/tools/pcbnew_selection.cpp index 4fd465e404..195ee1a554 100644 --- a/pcbnew/tools/pcbnew_selection.cpp +++ b/pcbnew/tools/pcbnew_selection.cpp @@ -97,7 +97,7 @@ const KIGFX::VIEW_GROUP::ITEMS PCBNEW_SELECTION::updateDrawList() const if( item->Type() == PCB_FOOTPRINT_T ) { - MODULE* footprint = static_cast( item ); + FOOTPRINT* footprint = static_cast( item ); footprint->RunOnChildren( [&]( BOARD_ITEM* bitem ) { addItem( bitem ); @@ -117,7 +117,7 @@ const KIGFX::VIEW_GROUP::ITEMS PCBNEW_SELECTION::updateDrawList() const addItem( item ); #if 0 - for( auto item : m_items ) + for( EDA_ITEM* item : m_items ) { items.push_back( item ); diff --git a/pcbnew/tools/placement_tool.cpp b/pcbnew/tools/placement_tool.cpp index 99f05cb96f..13e5634acd 100644 --- a/pcbnew/tools/placement_tool.cpp +++ b/pcbnew/tools/placement_tool.cpp @@ -97,7 +97,7 @@ ALIGNMENT_RECTS GetBoundingBoxes( const T &sel ) BOARD_ITEM* boardItem = static_cast( item ); if( item->Type() == PCB_FOOTPRINT_T ) - rects.emplace_back( std::make_pair( boardItem, static_cast( item )->GetFootprintRect() ) ); + rects.emplace_back( std::make_pair( boardItem, static_cast( item )->GetFootprintRect() ) ); else rects.emplace_back( std::make_pair( boardItem, item->GetBoundingBox() ) ); } diff --git a/pcbnew/tools/selection_tool.cpp b/pcbnew/tools/selection_tool.cpp index e66e822beb..eb01bfc15f 100644 --- a/pcbnew/tools/selection_tool.cpp +++ b/pcbnew/tools/selection_tool.cpp @@ -780,14 +780,14 @@ SELECTION_LOCK_FLAGS SELECTION_TOOL::CheckLock() switch( item->Type() ) { case PCB_FOOTPRINT_T: - if( static_cast( item )->IsLocked() ) + if( static_cast( item )->IsLocked() ) containsLocked = true; break; case PCB_FP_SHAPE_T: case PCB_FP_TEXT_T: case PCB_FP_ZONE_T: - if( static_cast( item->GetParent() )->IsLocked() ) + if( static_cast( item->GetParent() )->IsLocked() ) containsLocked = true; break; @@ -1170,30 +1170,30 @@ int SELECTION_TOOL::selectNet( const TOOL_EVENT& aEvent ) void SELECTION_TOOL::selectAllItemsOnSheet( wxString& aSheetPath ) { - std::list modList; + std::list footprintList; // store all footprints that are on that sheet path - for( MODULE* module : board()->Footprints() ) + for( FOOTPRINT* footprint : board()->Footprints() ) { - if( module == nullptr ) + if( footprint == nullptr ) continue; - wxString footprint_path = module->GetPath().AsString().BeforeLast('/'); + wxString footprint_path = footprint->GetPath().AsString().BeforeLast('/'); if( aSheetPath.IsEmpty() ) aSheetPath += '/'; if( footprint_path == aSheetPath ) - modList.push_back( module ); + footprintList.push_back( footprint ); } //Generate a list of all pads, and of all nets they belong to. std::list netcodeList; std::list padList; - for( MODULE* mmod : modList ) + for( FOOTPRINT* footprint : footprintList ) { - for( PAD* pad : mmod->Pads() ) + for( PAD* pad : footprint->Pads() ) { if( pad->IsConnected() ) { @@ -1222,7 +1222,7 @@ void SELECTION_TOOL::selectAllItemsOnSheet( wxString& aSheetPath ) { for( BOARD_CONNECTED_ITEM* mitem : board()->GetConnectivity()->GetNetItems( netCode, padType ) ) { - if( mitem->Type() == PCB_PAD_T && !alg::contains( modList, mitem->GetParent() ) ) + if( mitem->Type() == PCB_PAD_T && !alg::contains( footprintList, mitem->GetParent() ) ) { // if we cannot find the module of the pad in the modList // then we can assume that that module is not located in the same @@ -1251,7 +1251,7 @@ void SELECTION_TOOL::selectAllItemsOnSheet( wxString& aSheetPath ) localConnectionList.push_back( item ); } - for( BOARD_ITEM* i : modList ) + for( BOARD_ITEM* i : footprintList ) { if( i != NULL ) select( i ); @@ -1320,15 +1320,15 @@ int SELECTION_TOOL::selectSameSheet( const TOOL_EVENT& aEvent ) if( item->Type() != PCB_FOOTPRINT_T ) return 0; - auto mod = dynamic_cast( item ); + FOOTPRINT* footprint = dynamic_cast( item ); - if( mod->GetPath().empty() ) + if( footprint->GetPath().empty() ) return 0; ClearSelection( true /*quiet mode*/ ); // get the sheet path only. - wxString sheetPath = mod->GetPath().AsString().BeforeLast( '/' ); + wxString sheetPath = footprint->GetPath().AsString().BeforeLast( '/' ); if( sheetPath.IsEmpty() ) sheetPath += '/'; @@ -1402,7 +1402,7 @@ static bool itemIsIncludedByFilter( const BOARD_ITEM& aItem, const BOARD& aBoard { case PCB_FOOTPRINT_T: { - const MODULE& footprint = static_cast( aItem ); + const FOOTPRINT& footprint = static_cast( aItem ); include = aFilterOptions.includeModules; @@ -1795,10 +1795,10 @@ BOARD_ITEM* SELECTION_TOOL::pickSmallestComponent( GENERAL_COLLECTOR* aCollector for( int i = 0; i < count; ++i ) { - MODULE* module = (MODULE*) ( *aCollector )[i]; + FOOTPRINT* footprint = (FOOTPRINT*) ( *aCollector )[i]; - int lx = module->GetFootprintRect().GetWidth(); - int ly = module->GetFootprintRect().GetHeight(); + int lx = footprint->GetFootprintRect().GetWidth(); + int ly = footprint->GetFootprintRect().GetHeight(); int lmin = std::min( lx, ly ); @@ -1883,21 +1883,21 @@ bool SELECTION_TOOL::Selectable( const BOARD_ITEM* aItem, bool checkVisibilityOn // Allow selection of footprints if some part of the footprint is visible. - MODULE* module = const_cast( static_cast( aItem ) ); + FOOTPRINT* footprint = const_cast( static_cast( aItem ) ); - for( BOARD_ITEM* item : module->GraphicalItems() ) + for( BOARD_ITEM* item : footprint->GraphicalItems() ) { if( Selectable( item, true ) ) return true; } - for( PAD* pad : module->Pads() ) + for( PAD* pad : footprint->Pads() ) { if( Selectable( pad, true ) ) return true; } - for( ZONE* zone : module->Zones() ) + for( ZONE* zone : footprint->Zones() ) { if( Selectable( zone, true ) ) return true; @@ -2011,9 +2011,9 @@ void SELECTION_TOOL::select( BOARD_ITEM* aItem ) if( aItem->Type() == PCB_PAD_T ) { - MODULE* module = static_cast( aItem->GetParent() ); + FOOTPRINT* footprint = static_cast( aItem->GetParent() ); - if( m_selection.Contains( module ) ) + if( m_selection.Contains( footprint ) ) return; } @@ -2067,7 +2067,7 @@ void SELECTION_TOOL::highlightInternal( BOARD_ITEM* aItem, int aMode, // all the parts that make the module, not the module itself if( aItem->Type() == PCB_FOOTPRINT_T ) { - static_cast( aItem )->RunOnChildren( + static_cast( aItem )->RunOnChildren( [&]( BOARD_ITEM* aChild ) { highlightInternal( aChild, aMode, aSelectionViewGroup, true ); @@ -2125,7 +2125,7 @@ void SELECTION_TOOL::unhighlightInternal( BOARD_ITEM* aItem, int aMode, // highlight all the parts that make the module, not the module itself if( aItem->Type() == PCB_FOOTPRINT_T ) { - static_cast( aItem )->RunOnChildren( + static_cast( aItem )->RunOnChildren( [&]( BOARD_ITEM* aChild ) { unhighlightInternal( aChild, aMode, aSelectionViewGroup, true ); @@ -2164,7 +2164,7 @@ bool SELECTION_TOOL::selectionContains( const VECTOR2I& aPoint ) const static EDA_RECT getRect( const BOARD_ITEM* aItem ) { if( aItem->Type() == PCB_FOOTPRINT_T ) - return static_cast( aItem )->GetFootprintRect(); + return static_cast( aItem )->GetFootprintRect(); return aItem->GetBoundingBox(); } @@ -2419,7 +2419,7 @@ void SELECTION_TOOL::GuessSelectionCandidates( GENERAL_COLLECTOR& aCollector, { if( PAD* pad = dyn_cast( aCollector[i] ) ) { - MODULE* parent = pad->GetParent(); + FOOTPRINT* parent = pad->GetParent(); double ratio = calcRatio( calcArea( pad ), calcArea( parent ) ); // when pad area is small compared to the parent footprint, @@ -2444,35 +2444,43 @@ void SELECTION_TOOL::GuessSelectionCandidates( GENERAL_COLLECTOR& aCollector, if( aCollector.CountType( PCB_FOOTPRINT_T ) > 0 ) { double maxArea = calcMaxArea( aCollector, PCB_FOOTPRINT_T ); - BOX2D viewportD = getView()->GetViewport(); - BOX2I viewport( VECTOR2I( viewportD.GetPosition() ), VECTOR2I( viewportD.GetSize() ) ); + BOX2D viewportD = getView()->GetViewport(); + BOX2I viewport( VECTOR2I( viewportD.GetPosition() ), VECTOR2I( viewportD.GetSize() ) ); double maxCoverRatio = footprintMaxCoverRatio; - // MODULE::CoverageRatio() doesn't take zone handles & borders into account so just + // FOOTPRINT::CoverageRatio() doesn't take zone handles & borders into account so just // use a more aggressive cutoff point if zones are involved. if( aCollector.CountType( PCB_ZONE_T ) ) maxCoverRatio /= 2; for( int i = 0; i < aCollector.GetCount(); ++i ) { - if( MODULE* mod = dyn_cast( aCollector[i] ) ) + if( FOOTPRINT* footprint = dyn_cast( aCollector[i] ) ) { // filter out components larger than the viewport - if( mod->ViewBBox().GetHeight() > viewport.GetHeight() || - mod->ViewBBox().GetWidth() > viewport.GetWidth() ) - rejected.insert( mod ); + if( footprint->ViewBBox().GetHeight() > viewport.GetHeight() + || footprint->ViewBBox().GetWidth() > viewport.GetWidth() ) + { + rejected.insert( footprint ); + } // footprints completely covered with other features have no other // means of selection, so must be kept - else if( mod->CoverageRatio( aCollector ) > maxCoverRatio ) - rejected.erase( mod ); + else if( footprint->CoverageRatio( aCollector ) > maxCoverRatio ) + { + rejected.erase( footprint ); + } // if a footprint is much smaller than the largest overlapping // footprint then it should be considered for selection - else if( calcRatio( calcArea( mod ), maxArea ) <= footprintToFootprintMinRatio ) + else if( calcRatio( calcArea( footprint ), maxArea ) <= footprintToFootprintMinRatio ) + { continue; + } // reject ALL OTHER footprints if there's still something else left // to select else if( hasNonModules ) - rejected.insert( mod ); + { + rejected.insert( footprint ); + } } } } @@ -2559,7 +2567,7 @@ void SELECTION_TOOL::GuessSelectionCandidates( GENERAL_COLLECTOR& aCollector, for( int j = 0; j < aCollector.GetCount(); ++j ) { - if( MODULE* footprint = dyn_cast( aCollector[j] ) ) + if( FOOTPRINT* footprint = dyn_cast( aCollector[j] ) ) { double ratio = calcRatio( maxArea, footprint->GetFootprintRect().GetArea() ); diff --git a/pcbnew/tools/zone_create_helper.cpp b/pcbnew/tools/zone_create_helper.cpp index ab6ca01309..04c59753c8 100644 --- a/pcbnew/tools/zone_create_helper.cpp +++ b/pcbnew/tools/zone_create_helper.cpp @@ -234,7 +234,7 @@ void ZONE_CREATE_HELPER::commitZone( std::unique_ptr aZone ) if( graphicPolygonsLayers.Contains( m_params.m_layer ) ) { - auto poly = m_tool.m_isFootprintEditor ? new FP_SHAPE((MODULE *) parent ) + auto poly = m_tool.m_isFootprintEditor ? new FP_SHAPE( (FOOTPRINT *) parent ) : new PCB_SHAPE(); poly->SetShape ( S_POLYGON ); poly->SetLayer( m_params.m_layer ); @@ -248,7 +248,7 @@ void ZONE_CREATE_HELPER::commitZone( std::unique_ptr aZone ) for( auto seg = outline->CIterateSegments( 0 ); seg; seg++ ) { - auto* new_seg = m_tool.m_isFootprintEditor ? new FP_SHAPE((MODULE *) parent ) + auto* new_seg = m_tool.m_isFootprintEditor ? new FP_SHAPE( (FOOTPRINT *) parent ) : new PCB_SHAPE(); new_seg->SetShape( S_SEGMENT ); new_seg->SetLayer( m_params.m_layer ); diff --git a/pcbnew/undo_redo.cpp b/pcbnew/undo_redo.cpp index 01197ac171..5f2b64a344 100644 --- a/pcbnew/undo_redo.cpp +++ b/pcbnew/undo_redo.cpp @@ -118,7 +118,7 @@ static bool TestForExistingItem( BOARD* aPcb, BOARD_ITEM* aItem ) return true; } - for( MODULE* item : aPcb->Footprints() ) + for( FOOTPRINT* item : aPcb->Footprints() ) { if( aItem == static_cast( item ) ) return true; @@ -222,8 +222,8 @@ void PCB_BASE_EDIT_FRAME::SaveCopyInUndoList( const PICKED_ITEMS_LIST& aItemsLis if( !found ) { // Create a clean copy of the parent footprint - MODULE* orig = static_cast( item ); - MODULE* clone = new MODULE( *orig ); + FOOTPRINT* orig = static_cast( item ); + FOOTPRINT* clone = new FOOTPRINT( *orig ); clone->SetParent( GetBoard() ); // Clear current flags (which can be temporary set by a current edit command) diff --git a/pcbnew/zone_filler.cpp b/pcbnew/zone_filler.cpp index e026a4daeb..3e3ab04253 100644 --- a/pcbnew/zone_filler.cpp +++ b/pcbnew/zone_filler.cpp @@ -119,7 +119,7 @@ bool ZONE_FILLER::Fill( std::vector& aZones, bool aCheck, wxWindow* aPare m_worstClearance = std::max( m_worstClearance, zone->GetLocalClearance() ); } - for( MODULE* footprint : m_board->Footprints() ) + for( FOOTPRINT* footprint : m_board->Footprints() ) { for( PAD* pad : footprint->Pads() ) { @@ -615,7 +615,7 @@ void ZONE_FILLER::knockoutThermalReliefs( const ZONE* aZone, PCB_LAYER_ID aLayer { SHAPE_POLY_SET holes; - for( MODULE* footprint : m_board->Footprints() ) + for( FOOTPRINT* footprint : m_board->Footprints() ) { for( PAD* pad : footprint->Pads() ) { @@ -729,7 +729,7 @@ void ZONE_FILLER::buildCopperItemClearances( const ZONE* aZone, PCB_LAYER_ID aLa } }; - for( MODULE* footprint : m_board->Footprints() ) + for( FOOTPRINT* footprint : m_board->Footprints() ) { for( PAD* pad : footprint->Pads() ) { @@ -818,7 +818,7 @@ void ZONE_FILLER::buildCopperItemClearances( const ZONE* aZone, PCB_LAYER_ID aLa } }; - for( MODULE* footprint : m_board->Footprints() ) + for( FOOTPRINT* footprint : m_board->Footprints() ) { knockoutGraphicClearance( &footprint->Reference() ); knockoutGraphicClearance( &footprint->Value() ); @@ -895,7 +895,7 @@ void ZONE_FILLER::buildCopperItemClearances( const ZONE* aZone, PCB_LAYER_ID aLa } } - for( MODULE* footprint : m_board->Footprints() ) + for( FOOTPRINT* footprint : m_board->Footprints() ) { for( ZONE* otherZone : footprint->Zones() ) { @@ -947,7 +947,7 @@ void ZONE_FILLER::subtractHigherPriorityZones( const ZONE* aZone, PCB_LAYER_ID a } } - for( MODULE* footprint : m_board->Footprints() ) + for( FOOTPRINT* footprint : m_board->Footprints() ) { for( ZONE* otherZone : footprint->Zones() ) { @@ -1248,7 +1248,7 @@ void ZONE_FILLER::buildThermalSpokes( const ZONE* aZone, PCB_LAYER_ID aLayer, // us avoid the question. int epsilon = KiROUND( IU_PER_MM * 0.04 ); // about 1.5 mil - for( MODULE* footprint : m_board->Footprints() ) + for( FOOTPRINT* footprint : m_board->Footprints() ) { for( PAD* pad : footprint->Pads() ) { @@ -1530,7 +1530,7 @@ bool ZONE_FILLER::addHatchFillTypeOnZone( const ZONE* aZone, PCB_LAYER_ID aLayer } } - for( MODULE* footprint : m_board->Footprints() ) + for( FOOTPRINT* footprint : m_board->Footprints() ) { for( PAD* pad : footprint->Pads() ) { diff --git a/qa/pcbnew/drc/test_drc_courtyard_invalid.cpp b/qa/pcbnew/drc/test_drc_courtyard_invalid.cpp index 1148cd176b..536e367f47 100644 --- a/qa/pcbnew/drc/test_drc_courtyard_invalid.cpp +++ b/qa/pcbnew/drc/test_drc_courtyard_invalid.cpp @@ -45,15 +45,13 @@ BOOST_FIXTURE_TEST_SUITE( DrcCourtyardInvalid, COURTYARD_TEST_FIXTURE ) /* - * A simple mock module with a set of courtyard rectangles and some other - * information + * A simple mock footprint with a set of courtyard rectangles and some other information */ -struct COURTYARD_INVALID_TEST_MODULE +struct COURTYARD_INVALID_TEST_FP { - - std::string m_refdes; /// Module Ref-Des (for identifying DRC errors) + std::string m_refdes; /// Footprint Ref-Des (for identifying DRC errors) std::vector m_segs; /// List of segments that will be placed on the courtyard - VECTOR2I m_pos; /// Module position + VECTOR2I m_pos; /// Footprint position }; @@ -74,9 +72,9 @@ std::ostream& operator<<( std::ostream& os, const COURTYARD_INVALID_INFO& aInval struct COURTYARD_INVALID_CASE { - std::string m_case_name; - std::vector m_mods; - std::vector m_exp_errors; + std::string m_case_name; + std::vector m_mods; + std::vector m_exp_errors; }; @@ -136,10 +134,10 @@ static const std::vector courtyard_invalid_cases = { 0, 0 }, }, }, - { // one error: the module has malformed courtyard + { // one error: the footprint has malformed courtyard { "U1", - DRCE_MALFORMED_COURTYARD, + DRCE_MALFORMED_COURTYARD, }, }, }, @@ -175,10 +173,10 @@ static const std::vector courtyard_invalid_cases = { 0, 0 }, }, }, - { // one error: the second module has malformed courtyard + { // one error: the second footprint has malformed courtyard { "U2", - DRCE_MALFORMED_COURTYARD, + DRCE_MALFORMED_COURTYARD, }, }, }, @@ -187,41 +185,41 @@ static const std::vector courtyard_invalid_cases = /** - * Construct a #MODULE to use in a courtyard test from a #COURTYARD_TEST_MODULE + * Construct a #FOOTPRINT to use in a courtyard test from a #COURTYARD_TEST_FP * definition. */ -std::unique_ptr MakeInvalidCourtyardTestModule( BOARD& aBoard, - const COURTYARD_INVALID_TEST_MODULE& aMod ) +std::unique_ptr MakeInvalidCourtyardTestFP( BOARD& aBoard, + const COURTYARD_INVALID_TEST_FP& aFPDef ) { - auto module = std::make_unique( &aBoard ); + std::unique_ptr footprint = std::make_unique( &aBoard ); - for( const auto& seg : aMod.m_segs ) + for( const SEG& seg : aFPDef.m_segs ) { const PCB_LAYER_ID layer = F_CrtYd; // aRect.m_front ? F_CrtYd : B_CrtYd; const int width = Millimeter2iu( 0.1 ); - KI_TEST::DrawSegment( *module, seg, width, layer ); + KI_TEST::DrawSegment( *footprint, seg, width, layer ); } - module->SetReference( aMod.m_refdes ); + footprint->SetReference( aFPDef.m_refdes ); // As of 2019-01-17, this has to go after adding the courtyards, // or all the poly sets are empty when DRC'd - module->SetPosition( (wxPoint) aMod.m_pos ); + footprint->SetPosition( (wxPoint) aFPDef.m_pos ); - return module; + return footprint; } -std::unique_ptr MakeBoard( const std::vector& aMods ) +std::unique_ptr MakeBoard( const std::vector& aTestFPDefs ) { auto board = std::make_unique(); - for( const auto& mod : aMods ) + for( const COURTYARD_INVALID_TEST_FP& fpDef : aTestFPDefs ) { - auto module = MakeInvalidCourtyardTestModule( *board, mod ); + std::unique_ptr footprint = MakeInvalidCourtyardTestFP( *board, fpDef ); - board->Add( module.release() ); + board->Add( footprint.release() ); } return board; @@ -235,7 +233,7 @@ static bool InvalidMatchesExpected( BOARD& aBoard, const MARKER_PCB& aMarker, const COURTYARD_INVALID_INFO& aInvalid ) { auto reporter = std::static_pointer_cast( aMarker.GetRCItem() ); - const MODULE* item_a = dynamic_cast( aBoard.GetItem( reporter->GetMainItemID() ) ); + const FOOTPRINT* item_a = dynamic_cast( aBoard.GetItem( reporter->GetMainItemID() ) ); // This one is more than just a mis-match! if( reporter->GetAuxItemID() != niluuid ) diff --git a/qa/pcbnew/drc/test_drc_courtyard_overlap.cpp b/qa/pcbnew/drc/test_drc_courtyard_overlap.cpp index de19ab8110..572d0ab52f 100644 --- a/qa/pcbnew/drc/test_drc_courtyard_overlap.cpp +++ b/qa/pcbnew/drc/test_drc_courtyard_overlap.cpp @@ -50,10 +50,9 @@ struct RECT_DEFINITION /* - * A simple mock module with a set of courtyard rectangles and some other - * information + * A simple mock footprint with a set of courtyard rectangles and some other information */ -struct COURTYARD_TEST_MODULE +struct COURTYARD_TEST_FP { std::string m_refdes; std::vector m_rects; @@ -85,65 +84,57 @@ std::ostream& operator<<( std::ostream& os, const COURTYARD_COLLISION& aColl ) */ struct COURTYARD_OVERLAP_TEST_CASE { - std::string m_case_name; - - // The footprint in the test case - std::vector m_mods; - - // The expected number of collisions - std::vector m_collisions; + std::string m_case_name; + std::vector m_fpDefs; // The footprint in the test case + std::vector m_collisions; // The expected number of collisions }; /** - * Add a rectangular courtyard outline to a module. + * Add a rectangular courtyard outline to a footprint. */ -void AddRectCourtyard( MODULE& aMod, const RECT_DEFINITION& aRect ) +void AddRectCourtyard( FOOTPRINT& aFootprint, const RECT_DEFINITION& aRect ) { const PCB_LAYER_ID layer = aRect.m_front ? F_CrtYd : B_CrtYd; const int width = Millimeter2iu( 0.1 ); - KI_TEST::DrawRect( aMod, aRect.m_centre, aRect.m_size, aRect.m_corner_rad, width, layer ); + KI_TEST::DrawRect( aFootprint, aRect.m_centre, aRect.m_size, aRect.m_corner_rad, width, layer ); } /** - * Construct a #MODULE to use in a courtyard test from a #COURTYARD_TEST_MODULE - * definition. + * Construct a #FOOTPRINT to use in a courtyard test from a #COURTYARD_TEST_FP definition. */ -std::unique_ptr MakeCourtyardTestModule( BOARD& aBoard, const COURTYARD_TEST_MODULE& aMod ) +std::unique_ptr MakeCourtyardTestFP( BOARD& aBoard, const COURTYARD_TEST_FP& aFPDef ) { - auto module = std::make_unique( &aBoard ); + std::unique_ptr footprint = std::make_unique( &aBoard ); - for( const auto& rect : aMod.m_rects ) - { - AddRectCourtyard( *module, rect ); - } + for( const RECT_DEFINITION& rect : aFPDef.m_rects ) + AddRectCourtyard( *footprint, rect ); - module->SetReference( aMod.m_refdes ); + footprint->SetReference( aFPDef.m_refdes ); - // As of 2019-01-17, this has to go after adding the courtyards, - // or all the poly sets are empty when DRC'd - module->SetPosition( (wxPoint) aMod.m_pos ); + // This has to go after adding the courtyards, or all the poly sets are empty when DRC'd + footprint->SetPosition( (wxPoint) aFPDef.m_pos ); - return module; + return footprint; } /** * Make a board for courtyard testing. * - * @param aMods the list of module definitions to add to the board + * @param aFPDefs the list of footprint definitions to add to the board */ -std::unique_ptr MakeBoard( const std::vector& aMods ) +std::unique_ptr MakeBoard( const std::vector& aFPDefs ) { - auto board = std::make_unique(); + std::unique_ptr board = std::make_unique(); - for( const auto& mod : aMods ) + for( const COURTYARD_TEST_FP& fpDef : aFPDefs ) { - auto module = MakeCourtyardTestModule( *board, mod ); + std::unique_ptr footprint = MakeCourtyardTestFP( *board, fpDef ); - board->Add( module.release() ); + board->Add( footprint.release() ); } return board; @@ -220,7 +211,7 @@ static std::vector courtyard_cases = { true, }, }, - { Millimeter2iu( 3 ), Millimeter2iu( 1 ) }, // One module is far from the other + { Millimeter2iu( 3 ), Millimeter2iu( 1 ) }, // One footprint is far from the other }, }, {}, // no collisions @@ -398,8 +389,8 @@ static bool CollisionMatchesExpected( BOARD& aBoard, const MARKER_PCB& aMarker, { auto reporter = std::static_pointer_cast( aMarker.GetRCItem() ); - const MODULE* item_a = dynamic_cast( aBoard.GetItem( reporter->GetMainItemID() ) ); - const MODULE* item_b = dynamic_cast( aBoard.GetItem( reporter->GetAuxItemID() ) ); + const FOOTPRINT* item_a = dynamic_cast( aBoard.GetItem( reporter->GetMainItemID() ) ); + const FOOTPRINT* item_b = dynamic_cast( aBoard.GetItem( reporter->GetAuxItemID() ) ); // cant' find the items! if( !item_a || !item_b ) @@ -448,7 +439,7 @@ static void CheckCollisionsMatchExpected( BOARD& aBoard, static void DoCourtyardOverlapTest( const COURTYARD_OVERLAP_TEST_CASE& aCase, const KI_TEST::BOARD_DUMPER& aDumper ) { - auto board = MakeBoard( aCase.m_mods ); + auto board = MakeBoard( aCase.m_fpDefs ); // Dump if env var set aDumper.DumpBoardToFile( *board, aCase.m_case_name ); diff --git a/qa/pcbnew/test_array_pad_name_provider.cpp b/qa/pcbnew/test_array_pad_name_provider.cpp index 3863fb2a15..b516ea9cd2 100644 --- a/qa/pcbnew/test_array_pad_name_provider.cpp +++ b/qa/pcbnew/test_array_pad_name_provider.cpp @@ -38,20 +38,20 @@ /** * Make a module with a given list of named pads */ -static std::unique_ptr ModuleWithPads( const std::vector aNames ) +static std::unique_ptr ModuleWithPads( const std::vector aNames ) { - auto module = std::make_unique( nullptr ); + std::unique_ptr footprint = std::make_unique( nullptr ); - for( const auto& name : aNames ) + for( const wxString& name : aNames ) { - std::unique_ptr pad = std::make_unique( module.get() ); + std::unique_ptr pad = std::make_unique( footprint.get() ); pad->SetName( name ); - module->Add( pad.release() ); + footprint->Add( pad.release() ); } - return module; + return footprint; } /** @@ -141,7 +141,7 @@ BOOST_AUTO_TEST_CASE( ModuleCases ) { BOOST_TEST_CONTEXT( c.m_case_name ) { - std::unique_ptr module; + std::unique_ptr module; if( c.m_using_module ) { diff --git a/qa/pcbnew/test_pad_naming.cpp b/qa/pcbnew/test_pad_naming.cpp index c4eeda2050..1cdddc5153 100644 --- a/qa/pcbnew/test_pad_naming.cpp +++ b/qa/pcbnew/test_pad_naming.cpp @@ -29,13 +29,15 @@ struct PAD_FIXTURE { - PAD_FIXTURE() : m_board(), m_module( &m_board ) + PAD_FIXTURE() : + m_board(), + m_footprint( &m_board ) { } PAD MakeNPTH() { - PAD pad( &m_module ); + PAD pad( &m_footprint ); pad.SetAttribute( PAD_ATTRIB_NPTH ); pad.SetLayerSet( PAD::UnplatedHoleMask() ); @@ -45,7 +47,7 @@ struct PAD_FIXTURE PAD MakeAperture() { - PAD pad( &m_module ); + PAD pad( &m_footprint ); pad.SetAttribute( PAD_ATTRIB_PTH ); pad.SetLayerSet( PAD::ApertureMask() ); @@ -55,7 +57,7 @@ struct PAD_FIXTURE PAD MakeSmd() { - PAD pad( &m_module ); + PAD pad( &m_footprint ); pad.SetAttribute( PAD_ATTRIB_SMD ); pad.SetLayerSet( PAD::SMDMask() ); @@ -63,8 +65,8 @@ struct PAD_FIXTURE return pad; } - BOARD m_board; - MODULE m_module; + BOARD m_board; + FOOTPRINT m_footprint; }; diff --git a/qa/pcbnew_utils/board_construction_utils.cpp b/qa/pcbnew_utils/board_construction_utils.cpp index 45cfeb2a94..abb069fba5 100644 --- a/qa/pcbnew_utils/board_construction_utils.cpp +++ b/qa/pcbnew_utils/board_construction_utils.cpp @@ -32,9 +32,9 @@ namespace KI_TEST { -void DrawSegment( MODULE& aMod, const SEG& aSeg, int aWidth, PCB_LAYER_ID aLayer ) +void DrawSegment( FOOTPRINT& aFootprint, const SEG& aSeg, int aWidth, PCB_LAYER_ID aLayer ) { - auto seg = std::make_unique( &aMod, S_SEGMENT ); + auto seg = std::make_unique( &aFootprint, S_SEGMENT ); seg->SetStart0( (wxPoint) aSeg.A ); seg->SetEnd0( (wxPoint) aSeg.B ); @@ -42,24 +42,24 @@ void DrawSegment( MODULE& aMod, const SEG& aSeg, int aWidth, PCB_LAYER_ID aLayer seg->SetWidth( aWidth ); seg->SetLayer( aLayer ); - aMod.Add( seg.release() ); + aFootprint.Add( seg.release() ); } -void DrawPolyline( - MODULE& aMod, const std::vector& aPts, int aWidth, PCB_LAYER_ID aLayer ) +void DrawPolyline( FOOTPRINT& aFootprint, const std::vector& aPts, int aWidth, + PCB_LAYER_ID aLayer ) { for( unsigned i = 0; i < aPts.size() - 1; ++i ) { - DrawSegment( aMod, { aPts[i], aPts[i + 1] }, aWidth, aLayer ); + DrawSegment( aFootprint, { aPts[i], aPts[i + 1] }, aWidth, aLayer ); } } -void DrawArc( MODULE& aMod, const VECTOR2I& aCentre, const VECTOR2I& aStart, double aAngle, - int aWidth, PCB_LAYER_ID aLayer ) +void DrawArc( FOOTPRINT& aFootprint, const VECTOR2I& aCentre, const VECTOR2I& aStart, + double aAngle, int aWidth, PCB_LAYER_ID aLayer ) { - auto seg = std::make_unique( &aMod, S_ARC ); + auto seg = std::make_unique( &aFootprint, S_ARC ); seg->SetStart0( (wxPoint) aCentre ); seg->SetEnd0( (wxPoint) aStart ); @@ -68,12 +68,12 @@ void DrawArc( MODULE& aMod, const VECTOR2I& aCentre, const VECTOR2I& aStart, dou seg->SetWidth( aWidth ); seg->SetLayer( aLayer ); - aMod.Add( seg.release() ); + aFootprint.Add( seg.release() ); } -void DrawRect( MODULE& aMod, const VECTOR2I& aPos, const VECTOR2I& aSize, int aRadius, int aWidth, - PCB_LAYER_ID aLayer ) +void DrawRect( FOOTPRINT& aFootprint, const VECTOR2I& aPos, const VECTOR2I& aSize, int aRadius, + int aWidth, PCB_LAYER_ID aLayer ) { const auto x_r = aPos.x + aSize.x / 2; const auto x_l = aPos.x - aSize.x / 2; @@ -88,22 +88,22 @@ void DrawRect( MODULE& aMod, const VECTOR2I& aPos, const VECTOR2I& aSize, int aR // If non-zero (could be zero if it's a stadium shape) if( xin_l != xin_r ) { - DrawSegment( aMod, { { xin_l, y_t }, { xin_r, y_t } }, aWidth, aLayer ); - DrawSegment( aMod, { { xin_l, y_b }, { xin_r, y_b } }, aWidth, aLayer ); + DrawSegment( aFootprint, { { xin_l, y_t }, { xin_r, y_t } }, aWidth, aLayer ); + DrawSegment( aFootprint, { { xin_l, y_b }, { xin_r, y_b } }, aWidth, aLayer ); } if( yin_b != yin_t ) { - DrawSegment( aMod, { { x_l, yin_b }, { x_l, yin_t } }, aWidth, aLayer ); - DrawSegment( aMod, { { x_r, yin_b }, { x_r, yin_t } }, aWidth, aLayer ); + DrawSegment( aFootprint, { { x_l, yin_b }, { x_l, yin_t } }, aWidth, aLayer ); + DrawSegment( aFootprint, { { x_r, yin_b }, { x_r, yin_t } }, aWidth, aLayer ); } if( aRadius > 0 ) { - DrawArc( aMod, { xin_r, yin_t }, { x_r, yin_t }, 90, aWidth, aLayer ); - DrawArc( aMod, { xin_l, yin_t }, { xin_l, y_t }, 90, aWidth, aLayer ); - DrawArc( aMod, { xin_l, yin_b }, { x_l, yin_b }, 90, aWidth, aLayer ); - DrawArc( aMod, { xin_r, yin_b }, { xin_r, y_b }, 90, aWidth, aLayer ); + DrawArc( aFootprint, { xin_r, yin_t }, { x_r, yin_t }, 90, aWidth, aLayer ); + DrawArc( aFootprint, { xin_l, yin_t }, { xin_l, y_t }, 90, aWidth, aLayer ); + DrawArc( aFootprint, { xin_l, yin_b }, { x_l, yin_b }, 90, aWidth, aLayer ); + DrawArc( aFootprint, { xin_r, yin_b }, { xin_r, y_b }, 90, aWidth, aLayer ); } } diff --git a/qa/pcbnew_utils/include/pcbnew_utils/board_construction_utils.h b/qa/pcbnew_utils/include/pcbnew_utils/board_construction_utils.h index fa0229e75f..07559747e7 100644 --- a/qa/pcbnew_utils/include/pcbnew_utils/board_construction_utils.h +++ b/qa/pcbnew_utils/include/pcbnew_utils/board_construction_utils.h @@ -34,7 +34,7 @@ #include #include -class MODULE; +class FOOTPRINT; class SEG; @@ -48,7 +48,7 @@ namespace KI_TEST * @param aWidth The width of the segment * @param aLayer The layer to draw on */ -void DrawSegment( MODULE& aMod, const SEG& aSeg, int aWidth, PCB_LAYER_ID aLayer ); +void DrawSegment( FOOTPRINT& aFootprint, const SEG& aSeg, int aWidth, PCB_LAYER_ID aLayer ); /** * Draw a polyline - a set of linked segments @@ -57,8 +57,8 @@ void DrawSegment( MODULE& aMod, const SEG& aSeg, int aWidth, PCB_LAYER_ID aLayer * @param aWidth The width of the segments * @param aLayer The layer to draw on */ -void DrawPolyline( - MODULE& aMod, const std::vector& aPts, int aWidth, PCB_LAYER_ID aLayer ); +void DrawPolyline( FOOTPRINT& aFootprint, const std::vector& aPts, int aWidth, + PCB_LAYER_ID aLayer ); /** * Draw an arc on a module @@ -69,8 +69,8 @@ void DrawPolyline( * @param aWidth The width of the arc segment * @param aLayer The layer to draw on */ -void DrawArc( MODULE& aMod, const VECTOR2I& aCentre, const VECTOR2I& aStart, double aAngle, - int aWidth, PCB_LAYER_ID aLayer ); +void DrawArc( FOOTPRINT& aFootprint, const VECTOR2I& aCentre, const VECTOR2I& aStart, + double aAngle, int aWidth, PCB_LAYER_ID aLayer ); /** * Draw a rectangle on a module @@ -81,8 +81,8 @@ void DrawArc( MODULE& aMod, const VECTOR2I& aCentre, const VECTOR2I& aStart, dou * @param aWidth Line width * @param aLayer Layer to draw on */ -void DrawRect( MODULE& aMod, const VECTOR2I& aPos, const VECTOR2I& aSize, int aRadius, int aWidth, - PCB_LAYER_ID aLayer ); +void DrawRect( FOOTPRINT& aFootprint, const VECTOR2I& aPos, const VECTOR2I& aSize, int aRadius, + int aWidth, PCB_LAYER_ID aLayer ); } // namespace KI_TEST diff --git a/qa/qa_utils/mocks.cpp b/qa/qa_utils/mocks.cpp index 8a2050febb..a8d39a338a 100644 --- a/qa/qa_utils/mocks.cpp +++ b/qa/qa_utils/mocks.cpp @@ -198,7 +198,7 @@ DIALOG_FIND_BASE::~DIALOG_FIND_BASE() } -MODULE* PCB_BASE_FRAME::GetFootprintFromBoardByReference() +FOOTPRINT* PCB_BASE_FRAME::GetFootprintFromBoardByReference() { return nullptr; }