From 3451ac3088719611c2e4ca823ce7317cc0c7ed2e Mon Sep 17 00:00:00 2001 From: Jeff Young Date: Fri, 13 Nov 2020 12:21:02 +0000 Subject: [PATCH] PCB_MODULE_T -> PCB_FOOTPRINT_T --- 3d-viewer/3d_canvas/eda_3d_canvas.cpp | 2 +- common/eda_item.cpp | 2 +- common/hash_eda.cpp | 184 +++++++++--------- include/core/typeinfo.h | 2 +- pcbnew/array_creator.cpp | 4 +- pcbnew/autorouter/autoplace_tool.cpp | 2 +- pcbnew/board.cpp | 12 +- pcbnew/board_commit.cpp | 18 +- pcbnew/collectors.cpp | 22 +-- pcbnew/connectivity/connectivity_algo.cpp | 40 ++-- pcbnew/connectivity/connectivity_data.cpp | 6 +- pcbnew/cross-probing.cpp | 2 +- pcbnew/dialogs/dialog_board_reannotate.cpp | 2 +- .../dialogs/dialog_track_via_properties.cpp | 2 +- pcbnew/dialogs/dialog_unused_pad_layers.cpp | 2 +- pcbnew/drc/drc_engine.cpp | 2 +- pcbnew/drc/drc_test_provider.cpp | 4 +- pcbnew/edit.cpp | 2 +- pcbnew/footprint.cpp | 10 +- pcbnew/footprint.h | 2 +- pcbnew/footprint_editor_utils.cpp | 2 +- pcbnew/fp_text.cpp | 2 +- pcbnew/kicad_clipboard.cpp | 2 +- pcbnew/pad.cpp | 2 +- pcbnew/pcb_base_frame.cpp | 4 +- pcbnew/pcb_edit_frame.cpp | 2 +- pcbnew/pcb_expr_evaluator.cpp | 4 +- pcbnew/pcb_group.cpp | 4 +- pcbnew/pcb_painter.cpp | 2 +- pcbnew/pcb_shape.cpp | 2 +- pcbnew/pcb_text.cpp | 2 +- pcbnew/pcb_view.cpp | 25 +-- pcbnew/plugins/kicad/kicad_plugin.cpp | 2 +- pcbnew/plugins/kicad/pcb_parser.cpp | 4 +- pcbnew/router/router_tool.cpp | 14 +- .../specctra_export.cpp | 2 +- pcbnew/tools/edit_tool.cpp | 14 +- pcbnew/tools/grid_helper.cpp | 20 +- pcbnew/tools/pcb_inspection_tool.cpp | 9 +- pcbnew/tools/pcb_tool_base.cpp | 6 +- pcbnew/tools/pcbnew_control.cpp | 4 +- pcbnew/tools/pcbnew_selection.cpp | 60 +++--- pcbnew/tools/pcbnew_selection.h | 2 +- pcbnew/tools/placement_tool.cpp | 2 +- pcbnew/tools/point_editor.cpp | 2 +- pcbnew/tools/selection_tool.cpp | 78 ++++---- pcbnew/tools/zone_create_helper.cpp | 2 +- pcbnew/undo_redo.cpp | 4 +- 48 files changed, 297 insertions(+), 303 deletions(-) diff --git a/3d-viewer/3d_canvas/eda_3d_canvas.cpp b/3d-viewer/3d_canvas/eda_3d_canvas.cpp index 84905e84bb..04df94f543 100644 --- a/3d-viewer/3d_canvas/eda_3d_canvas.cpp +++ b/3d-viewer/3d_canvas/eda_3d_canvas.cpp @@ -761,7 +761,7 @@ void EDA_3D_CANVAS::OnMouseMove( wxMouseEvent &event ) } break; - case PCB_MODULE_T: + case PCB_FOOTPRINT_T: { MODULE* footprint = dynamic_cast( intersectedBoardItem ); diff --git a/common/eda_item.cpp b/common/eda_item.cpp index c4a3fa4f59..c0dfcbf817 100644 --- a/common/eda_item.cpp +++ b/common/eda_item.cpp @@ -258,7 +258,7 @@ static struct EDA_ITEM_DESC .Map( NOT_USED, wxT( "" ) ) .Map( SCREEN_T, _HKI( "Screen" ) ) - .Map( PCB_MODULE_T, _HKI( "Footprint" ) ) + .Map( PCB_FOOTPRINT_T, _HKI( "Footprint" ) ) .Map( PCB_PAD_T, _HKI( "Pad" ) ) .Map( PCB_SHAPE_T, _HKI( "Graphic Shape" ) ) .Map( PCB_TEXT_T, _HKI( "Board Text" ) ) diff --git a/common/hash_eda.cpp b/common/hash_eda.cpp index 23a877bd61..e798d4a8b3 100644 --- a/common/hash_eda.cpp +++ b/common/hash_eda.cpp @@ -52,120 +52,120 @@ size_t hash_eda( const EDA_ITEM* aItem, int aFlags ) switch( aItem->Type() ) { - case PCB_MODULE_T: - { - const MODULE* footprint = static_cast( aItem ); + case PCB_FOOTPRINT_T: + { + const MODULE* footprint = static_cast( aItem ); - ret = hash_board_item( footprint, aFlags ); + ret = hash_board_item( footprint, aFlags ); - if( aFlags & HASH_POS ) - hash_combine( ret, footprint->GetPosition().x, footprint->GetPosition().y ); + if( aFlags & HASH_POS ) + hash_combine( ret, footprint->GetPosition().x, footprint->GetPosition().y ); - if( aFlags & HASH_ROT ) - hash_combine( ret, footprint->GetOrientation() ); + if( aFlags & HASH_ROT ) + hash_combine( ret, footprint->GetOrientation() ); - for( BOARD_ITEM* item : footprint->GraphicalItems() ) - hash_combine( ret, hash_eda( item, aFlags ) ); + for( BOARD_ITEM* item : footprint->GraphicalItems() ) + hash_combine( ret, hash_eda( item, aFlags ) ); - for( PAD* pad : footprint->Pads() ) - hash_combine( ret, hash_eda( static_cast( pad ), aFlags ) ); - } + for( PAD* pad : footprint->Pads() ) + hash_combine( ret, hash_eda( static_cast( pad ), aFlags ) ); + } break; case PCB_PAD_T: + { + const PAD* pad = static_cast( aItem ); + + ret = hash{}( pad->GetShape() << 16 ); + hash_combine( ret, pad->GetDrillShape() << 18 ); + hash_combine( ret, pad->GetSize().x << 8 ); + hash_combine( ret, pad->GetSize().y << 9 ); + hash_combine( ret, pad->GetOffset().x << 6 ); + hash_combine( ret, pad->GetOffset().y << 7 ); + hash_combine( ret, pad->GetDelta().x << 4 ); + hash_combine( ret, pad->GetDelta().y << 5 ); + + hash_combine( ret, hash_board_item( pad, aFlags ) ); + + if( aFlags & HASH_POS ) { - const PAD* pad = static_cast( aItem ); - - ret = hash{}( pad->GetShape() << 16 ); - hash_combine( ret, pad->GetDrillShape() << 18 ); - hash_combine( ret, pad->GetSize().x << 8 ); - hash_combine( ret, pad->GetSize().y << 9 ); - hash_combine( ret, pad->GetOffset().x << 6 ); - hash_combine( ret, pad->GetOffset().y << 7 ); - hash_combine( ret, pad->GetDelta().x << 4 ); - hash_combine( ret, pad->GetDelta().y << 5 ); - - hash_combine( ret, hash_board_item( pad, aFlags ) ); - - if( aFlags & HASH_POS ) - { - if( aFlags & REL_COORD ) - hash_combine( ret, pad->GetPos0().x, pad->GetPos0().y ); - else - hash_combine( ret, pad->GetPosition().x, pad->GetPosition().y ); - } - - if( aFlags & HASH_ROT ) - hash_combine( ret, pad->GetOrientation() ); - - if( aFlags & HASH_NET ) - hash_combine( ret, pad->GetNetCode() ); + if( aFlags & REL_COORD ) + hash_combine( ret, pad->GetPos0().x, pad->GetPos0().y ); + else + hash_combine( ret, pad->GetPosition().x, pad->GetPosition().y ); } + + if( aFlags & HASH_ROT ) + hash_combine( ret, pad->GetOrientation() ); + + if( aFlags & HASH_NET ) + hash_combine( ret, pad->GetNetCode() ); + } break; case PCB_FP_TEXT_T: + { + const FP_TEXT* text = static_cast( aItem ); + + if( !( aFlags & HASH_REF ) && text->GetType() == FP_TEXT::TEXT_is_REFERENCE ) + break; + + if( !( aFlags & HASH_VALUE ) && text->GetType() == FP_TEXT::TEXT_is_VALUE ) + break; + + ret = hash_board_item( text, aFlags ); + hash_combine( ret, text->GetText().ToStdString() ); + hash_combine( ret, text->IsItalic() ); + hash_combine( ret, text->IsBold() ); + hash_combine( ret, text->IsMirrored() ); + hash_combine( ret, text->GetTextWidth() ); + hash_combine( ret, text->GetTextHeight() ); + hash_combine( ret, text->GetHorizJustify() ); + hash_combine( ret, text->GetVertJustify() ); + + if( aFlags & HASH_POS ) { - const FP_TEXT* text = static_cast( aItem ); - - if( !( aFlags & HASH_REF ) && text->GetType() == FP_TEXT::TEXT_is_REFERENCE ) - break; - - if( !( aFlags & HASH_VALUE ) && text->GetType() == FP_TEXT::TEXT_is_VALUE ) - break; - - ret = hash_board_item( text, aFlags ); - hash_combine( ret, text->GetText().ToStdString() ); - hash_combine( ret, text->IsItalic() ); - hash_combine( ret, text->IsBold() ); - hash_combine( ret, text->IsMirrored() ); - hash_combine( ret, text->GetTextWidth() ); - hash_combine( ret, text->GetTextHeight() ); - hash_combine( ret, text->GetHorizJustify() ); - hash_combine( ret, text->GetVertJustify() ); - - if( aFlags & HASH_POS ) - { - if( aFlags & REL_COORD ) - hash_combine( ret, text->GetPos0().x, text->GetPos0().y ); - else - hash_combine( ret, text->GetPosition().x, text->GetPosition().y ); - } - - if( aFlags & HASH_ROT ) - hash_combine( ret, text->GetTextAngle() ); + if( aFlags & REL_COORD ) + hash_combine( ret, text->GetPos0().x, text->GetPos0().y ); + else + hash_combine( ret, text->GetPosition().x, text->GetPosition().y ); } + + if( aFlags & HASH_ROT ) + hash_combine( ret, text->GetTextAngle() ); + } break; case PCB_FP_SHAPE_T: + { + const FP_SHAPE* segment = static_cast( aItem ); + ret = hash_board_item( segment, aFlags ); + hash_combine( ret, segment->GetType() ); + hash_combine( ret, segment->GetShape() ); + hash_combine( ret, segment->GetWidth() ); + hash_combine( ret, segment->GetRadius() ); + + if( aFlags & HASH_POS ) { - const FP_SHAPE* segment = static_cast( aItem ); - ret = hash_board_item( segment, aFlags ); - hash_combine( ret, segment->GetType() ); - hash_combine( ret, segment->GetShape() ); - hash_combine( ret, segment->GetWidth() ); - hash_combine( ret, segment->GetRadius() ); - - if( aFlags & HASH_POS ) + if( aFlags & REL_COORD ) { - if( aFlags & REL_COORD ) - { - hash_combine( ret, segment->GetStart0().x ); - hash_combine( ret, segment->GetStart0().y ); - hash_combine( ret, segment->GetEnd0().x ); - hash_combine( ret, segment->GetEnd0().y ); - } - else - { - hash_combine( ret, segment->GetStart().x ); - hash_combine( ret, segment->GetStart().y ); - hash_combine( ret, segment->GetEnd().x ); - hash_combine( ret, segment->GetEnd().y ); - } + hash_combine( ret, segment->GetStart0().x ); + hash_combine( ret, segment->GetStart0().y ); + hash_combine( ret, segment->GetEnd0().x ); + hash_combine( ret, segment->GetEnd0().y ); + } + else + { + hash_combine( ret, segment->GetStart().x ); + hash_combine( ret, segment->GetStart().y ); + hash_combine( ret, segment->GetEnd().x ); + hash_combine( ret, segment->GetEnd().y ); } - - if( aFlags & HASH_ROT ) - hash_combine( ret, segment->GetAngle() ); } + + if( aFlags & HASH_ROT ) + hash_combine( ret, segment->GetAngle() ); + } break; default: diff --git a/include/core/typeinfo.h b/include/core/typeinfo.h index fd1da36eef..7af5ccc935 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_MODULE_T, ///< class MODULE, a footprint + PCB_FOOTPRINT_T, ///< class MODULE, 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/pcbnew/array_creator.cpp b/pcbnew/array_creator.cpp index ad0494eb2a..df260b6227 100644 --- a/pcbnew/array_creator.cpp +++ b/pcbnew/array_creator.cpp @@ -106,7 +106,7 @@ void ARRAY_CREATOR::Invoke() { switch( item->Type() ) { - case PCB_MODULE_T: + case PCB_FOOTPRINT_T: case PCB_TEXT_T: case PCB_SHAPE_T: case PCB_TRACE_T: @@ -145,7 +145,7 @@ void ARRAY_CREATOR::Invoke() // it this state, reset the selected stated of aItem: this_item->ClearSelected(); - if( this_item->Type() == PCB_MODULE_T ) + if( this_item->Type() == PCB_FOOTPRINT_T ) { static_cast( this_item )->RunOnChildren( [&]( BOARD_ITEM* aItem ) diff --git a/pcbnew/autorouter/autoplace_tool.cpp b/pcbnew/autorouter/autoplace_tool.cpp index 9a76043a8b..e4ec8e7481 100644 --- a/pcbnew/autorouter/autoplace_tool.cpp +++ b/pcbnew/autorouter/autoplace_tool.cpp @@ -106,7 +106,7 @@ int AUTOPLACE_TOOL::autoplaceSelected( const TOOL_EVENT& aEvent ) for( EDA_ITEM* item : selection() ) { - if( item->Type() == PCB_MODULE_T ) + if( item->Type() == PCB_FOOTPRINT_T ) footprints.push_back( static_cast( item ) ); } diff --git a/pcbnew/board.cpp b/pcbnew/board.cpp index 0236080214..c4d491e57f 100644 --- a/pcbnew/board.cpp +++ b/pcbnew/board.cpp @@ -253,7 +253,7 @@ void BOARD::Move( const wxPoint& aMoveVector ) // overload // PCB_FP_TEXT_T, Can't be at board level // PCB_FP_SHAPE_T, Can't be at board level // PCB_FP_ZONE_T, Can't be at board level - PCB_MODULE_T, + PCB_FOOTPRINT_T, PCB_ZONE_T, EOT }; @@ -596,7 +596,7 @@ void BOARD::Add( BOARD_ITEM* aBoardItem, ADD_MODE aMode ) break; - case PCB_MODULE_T: + case PCB_FOOTPRINT_T: if( aMode == ADD_MODE::APPEND ) m_footprints.push_back((MODULE*) aBoardItem ); else @@ -676,7 +676,7 @@ void BOARD::Remove( BOARD_ITEM* aBoardItem ) } ) ); break; - case PCB_MODULE_T: + case PCB_FOOTPRINT_T: m_footprints.erase( std::remove_if( m_footprints.begin(), m_footprints.end(), [aBoardItem]( BOARD_ITEM* aItem ) { @@ -955,7 +955,7 @@ wxString BOARD::ConvertKIIDsToCrossReferences( const wxString& aSource ) wxString ref = token.BeforeFirst( ':', &remainder ); BOARD_ITEM* refItem = GetItem( KIID( ref ) ); - if( refItem && refItem->Type() == PCB_MODULE_T ) + if( refItem && refItem->Type() == PCB_FOOTPRINT_T ) token = static_cast( refItem )->GetReference() + ":" + remainder; } @@ -1115,7 +1115,7 @@ SEARCH_RESULT BOARD::Visit( INSPECTOR inspector, void* testData, const KICAD_T s * pass it on to each footprint's Visit() function via IterateForward( m_footprints, ... ). */ - case PCB_MODULE_T: + case PCB_FOOTPRINT_T: case PCB_PAD_T: case PCB_FP_TEXT_T: case PCB_FP_SHAPE_T: @@ -1129,7 +1129,7 @@ SEARCH_RESULT BOARD::Visit( INSPECTOR inspector, void* testData, const KICAD_T s { switch( stype = *++p ) { - case PCB_MODULE_T: + case PCB_FOOTPRINT_T: case PCB_PAD_T: case PCB_FP_TEXT_T: case PCB_FP_SHAPE_T: diff --git a/pcbnew/board_commit.cpp b/pcbnew/board_commit.cpp index 7ac040d8b5..a8ba66fc9b 100644 --- a/pcbnew/board_commit.cpp +++ b/pcbnew/board_commit.cpp @@ -60,11 +60,11 @@ COMMIT& BOARD_COMMIT::Stage( EDA_ITEM* aItem, CHANGE_TYPE aChangeType ) { // if aItem belongs a footprint, the full footprint will be saved // because undo/redo does not handle "sub items" modifications - if( aItem && aItem->Type() != PCB_MODULE_T && aChangeType == CHT_MODIFY ) + if( aItem && aItem->Type() != PCB_FOOTPRINT_T && aChangeType == CHT_MODIFY ) { EDA_ITEM* item = aItem->GetParent(); - if( item && item->Type() == PCB_MODULE_T ) // means aItem belongs a footprint + if( item && item->Type() == PCB_FOOTPRINT_T ) // means aItem belongs a footprint aItem = item; } @@ -106,7 +106,7 @@ void BOARD_COMMIT::Push( const wxString& aMessage, bool aCreateUndoEntry, bool a if( m_isFootprintEditor ) { // Be sure that we are storing a footprint - if( ent.m_item->Type() != PCB_MODULE_T ) + if( ent.m_item->Type() != PCB_FOOTPRINT_T ) ent.m_item = ent.m_item->GetParent(); // We have not saved the footprint yet, so let's create an entry @@ -118,8 +118,8 @@ void BOARD_COMMIT::Push( const wxString& aMessage, bool aCreateUndoEntry, bool a ent.m_copy = ent.m_item->Clone(); } - wxASSERT( ent.m_item->Type() == PCB_MODULE_T ); - wxASSERT( ent.m_copy->Type() == PCB_MODULE_T ); + wxASSERT( ent.m_item->Type() == PCB_FOOTPRINT_T ); + wxASSERT( ent.m_copy->Type() == PCB_FOOTPRINT_T ); if( aCreateUndoEntry ) { @@ -141,7 +141,7 @@ void BOARD_COMMIT::Push( const wxString& aMessage, bool aCreateUndoEntry, bool a if( m_isFootprintEditor ) { // footprints inside footprints are not supported yet - wxASSERT( boardItem->Type() != PCB_MODULE_T ); + wxASSERT( boardItem->Type() != PCB_FOOTPRINT_T ); boardItem->SetParent( board->Footprints().front() ); @@ -153,7 +153,7 @@ void BOARD_COMMIT::Push( const wxString& aMessage, bool aCreateUndoEntry, bool a boardItem->Type() == PCB_FP_ZONE_T ) { wxASSERT( boardItem->GetParent() && - boardItem->GetParent()->Type() == PCB_MODULE_T ); + boardItem->GetParent()->Type() == PCB_FOOTPRINT_T ); } else { @@ -205,7 +205,7 @@ void BOARD_COMMIT::Push( const wxString& aMessage, bool aCreateUndoEntry, bool a if( !( changeFlags & CHT_DONE ) ) { MODULE* footprint = static_cast( boardItem->GetParent() ); - wxASSERT( footprint && footprint->Type() == PCB_MODULE_T ); + wxASSERT( footprint && footprint->Type() == PCB_FOOTPRINT_T ); footprint->Delete( boardItem ); } @@ -231,7 +231,7 @@ void BOARD_COMMIT::Push( const wxString& aMessage, bool aCreateUndoEntry, bool a break; - case PCB_MODULE_T: + case PCB_FOOTPRINT_T: { // No support for nested footprints (yet) wxASSERT( !m_isFootprintEditor ); diff --git a/pcbnew/collectors.cpp b/pcbnew/collectors.cpp index 2f0d185e1a..a2c6161c12 100644 --- a/pcbnew/collectors.cpp +++ b/pcbnew/collectors.cpp @@ -60,7 +60,7 @@ const KICAD_T GENERAL_COLLECTOR::AllBoardItems[] = { PCB_ARC_T, // in m_tracks PCB_PAD_T, // in footprints PCB_FP_TEXT_T, // in footprints - PCB_MODULE_T, // in m_footprints + PCB_FOOTPRINT_T, // in m_footprints PCB_GROUP_T, // in m_groups PCB_ZONE_T, // in m_zones EOT @@ -79,7 +79,7 @@ const KICAD_T GENERAL_COLLECTOR::BoardLevelItems[] = { PCB_VIA_T, PCB_ARC_T, PCB_TRACE_T, - PCB_MODULE_T, + PCB_FOOTPRINT_T, PCB_GROUP_T, PCB_ZONE_T, EOT @@ -100,7 +100,7 @@ const KICAD_T GENERAL_COLLECTOR::AllButZones[] = { PCB_ARC_T, PCB_PAD_T, PCB_FP_TEXT_T, - PCB_MODULE_T, + PCB_FOOTPRINT_T, PCB_GROUP_T, PCB_ZONE_T, // if it is visible on screen, it should be selectable EOT @@ -108,14 +108,14 @@ const KICAD_T GENERAL_COLLECTOR::AllButZones[] = { const KICAD_T GENERAL_COLLECTOR::Modules[] = { - PCB_MODULE_T, + PCB_FOOTPRINT_T, EOT }; const KICAD_T GENERAL_COLLECTOR::PadsOrModules[] = { PCB_PAD_T, - PCB_MODULE_T, + PCB_FOOTPRINT_T, EOT }; @@ -130,7 +130,7 @@ const KICAD_T GENERAL_COLLECTOR::PadsOrTracks[] = { const KICAD_T GENERAL_COLLECTOR::ModulesAndTheirItems[] = { - PCB_MODULE_T, + PCB_FOOTPRINT_T, PCB_FP_TEXT_T, PCB_FP_SHAPE_T, PCB_PAD_T, @@ -159,7 +159,7 @@ const KICAD_T GENERAL_COLLECTOR::Tracks[] = { const KICAD_T GENERAL_COLLECTOR::LockableItems[] = { - PCB_MODULE_T, + PCB_FOOTPRINT_T, PCB_GROUP_T, // Can a group be locked? PCB_TRACE_T, PCB_ARC_T, @@ -243,7 +243,7 @@ SEARCH_RESULT GENERAL_COLLECTOR::Inspect( EDA_ITEM* testItem, void* testData ) } break; - case PCB_MODULE_T: + case PCB_FOOTPRINT_T: { MODULE* footprint = (MODULE*) item; @@ -372,7 +372,7 @@ SEARCH_RESULT GENERAL_COLLECTOR::Inspect( EDA_ITEM* testItem, void* testData ) shape = static_cast( item ); break; - case PCB_MODULE_T: + case PCB_FOOTPRINT_T: footprint = static_cast( item ); break; @@ -477,7 +477,7 @@ SEARCH_RESULT GENERAL_COLLECTOR::Inspect( EDA_ITEM* testItem, void* testData ) goto exit; } } - else if( item->Type() == PCB_MODULE_T ) + else if( item->Type() == PCB_FOOTPRINT_T ) { if( footprint->HitTest( m_refPos, accuracy ) && footprint->HitTestAccurate( m_refPos, accuracy ) ) @@ -551,7 +551,7 @@ SEARCH_RESULT GENERAL_COLLECTOR::Inspect( EDA_ITEM* testItem, void* testData ) goto exit; } } - else if( item->Type() == PCB_MODULE_T ) + else if( item->Type() == PCB_FOOTPRINT_T ) { if( footprint->HitTest( m_refPos, accuracy ) && footprint->HitTestAccurate( m_refPos, accuracy ) ) diff --git a/pcbnew/connectivity/connectivity_algo.cpp b/pcbnew/connectivity/connectivity_algo.cpp index 0ef858c910..88fe7d9607 100644 --- a/pcbnew/connectivity/connectivity_algo.cpp +++ b/pcbnew/connectivity/connectivity_algo.cpp @@ -45,8 +45,8 @@ bool CN_CONNECTIVITY_ALGO::Remove( BOARD_ITEM* aItem ) switch( aItem->Type() ) { - case PCB_MODULE_T: - for( auto pad : static_cast( aItem ) -> Pads() ) + case PCB_FOOTPRINT_T: + for( PAD* pad : static_cast( aItem )->Pads() ) { m_itemMap[pad].MarkItemsAsInvalid(); m_itemMap.erase( pad ); @@ -100,7 +100,7 @@ void CN_CONNECTIVITY_ALGO::markItemNetAsDirty( const BOARD_ITEM* aItem ) } else { - if( aItem->Type() == PCB_MODULE_T ) + if( aItem->Type() == PCB_FOOTPRINT_T ) { auto mod = static_cast ( aItem ); @@ -121,12 +121,11 @@ bool CN_CONNECTIVITY_ALGO::Add( BOARD_ITEM* aItem ) switch( aItem->Type() ) { case PCB_NETINFO_T: - { - MarkNetAsDirty( static_cast( aItem )->GetNet() ); - break; - } - case PCB_MODULE_T: - for( auto pad : static_cast( aItem ) -> Pads() ) + MarkNetAsDirty( static_cast( aItem )->GetNet() ); + break; + + case PCB_FOOTPRINT_T: + for( PAD* pad : static_cast( aItem )->Pads() ) { if( m_itemMap.find( pad ) != m_itemMap.end() ) return false; @@ -141,35 +140,27 @@ bool CN_CONNECTIVITY_ALGO::Add( BOARD_ITEM* aItem ) return false; add( m_itemList, static_cast( aItem ) ); - break; case PCB_TRACE_T: - { if( m_itemMap.find( aItem ) != m_itemMap.end() ) return false; add( m_itemList, static_cast( aItem ) ); - break; - } case PCB_ARC_T: - { if( m_itemMap.find( aItem ) != m_itemMap.end() ) return false; add( m_itemList, static_cast( aItem ) ); - break; - } case PCB_VIA_T: if( m_itemMap.find( aItem ) != m_itemMap.end() ) return false; add( m_itemList, static_cast( aItem ) ); - break; case PCB_ZONE_T: @@ -186,9 +177,8 @@ bool CN_CONNECTIVITY_ALGO::Add( BOARD_ITEM* aItem ) for( CN_ITEM* zitem : m_itemList.Add( zone, layer ) ) m_itemMap[zone].Link( zitem ); } - - break; } + break; default: return false; @@ -299,9 +289,9 @@ void CN_CONNECTIVITY_ALGO::searchConnections() const CN_CONNECTIVITY_ALGO::CLUSTERS CN_CONNECTIVITY_ALGO::SearchClusters( CLUSTER_SEARCH_MODE aMode ) { constexpr KICAD_T types[] = { PCB_TRACE_T, PCB_ARC_T, PCB_PAD_T, PCB_VIA_T, PCB_ZONE_T, - PCB_MODULE_T, EOT }; + PCB_FOOTPRINT_T, EOT }; constexpr KICAD_T no_zones[] = { PCB_TRACE_T, PCB_ARC_T, PCB_PAD_T, PCB_VIA_T, - PCB_MODULE_T, EOT }; + PCB_FOOTPRINT_T, EOT }; if( aMode == CSM_PROPAGATE ) return SearchClusters( aMode, no_zones, -1 ); @@ -474,15 +464,11 @@ void CN_CONNECTIVITY_ALGO::Build( const std::vector& aItems ) Add( item ); break; - case PCB_MODULE_T: - { - for( auto pad : static_cast( item )->Pads() ) - { + case PCB_FOOTPRINT_T: + for( PAD* pad : static_cast( item )->Pads() ) Add( pad ); - } break; - } default: break; diff --git a/pcbnew/connectivity/connectivity_data.cpp b/pcbnew/connectivity/connectivity_data.cpp index 24b077ac9e..e8c47ba751 100644 --- a/pcbnew/connectivity/connectivity_data.cpp +++ b/pcbnew/connectivity/connectivity_data.cpp @@ -223,7 +223,7 @@ void CONNECTIVITY_DATA::BlockRatsnestItems( const std::vector& aIte for( auto item : aItems ) { - if( item->Type() == PCB_MODULE_T ) + if( item->Type() == PCB_FOOTPRINT_T ) { for( auto pad : static_cast(item)->Pads() ) citems.push_back( pad ); @@ -654,7 +654,7 @@ RN_NET* CONNECTIVITY_DATA::GetRatsnestForNet( int aNet ) void CONNECTIVITY_DATA::MarkItemNetAsDirty( BOARD_ITEM *aItem ) { - if (aItem->Type() == PCB_MODULE_T) + if ( aItem->Type() == PCB_FOOTPRINT_T) { for ( auto pad : static_cast( aItem )->Pads() ) { @@ -683,7 +683,7 @@ const std::vector CONNECTIVITY_DATA::GetRatsnestForItems( std::vectorType() == PCB_MODULE_T ) + if( item->Type() == PCB_FOOTPRINT_T ) { auto component = static_cast( item ); diff --git a/pcbnew/cross-probing.cpp b/pcbnew/cross-probing.cpp index 85666a6cb2..7596854365 100644 --- a/pcbnew/cross-probing.cpp +++ b/pcbnew/cross-probing.cpp @@ -409,7 +409,7 @@ std::string FormatProbeItem( BOARD_ITEM* aItem ) switch( aItem->Type() ) { - case PCB_MODULE_T: + case PCB_FOOTPRINT_T: footprint = (MODULE*) aItem; return StrPrintf( "$PART: \"%s\"", TO_UTF8( footprint->GetReference() ) ); diff --git a/pcbnew/dialogs/dialog_board_reannotate.cpp b/pcbnew/dialogs/dialog_board_reannotate.cpp index 5541dcda6d..f9ffb8ae36 100644 --- a/pcbnew/dialogs/dialog_board_reannotate.cpp +++ b/pcbnew/dialogs/dialog_board_reannotate.cpp @@ -716,7 +716,7 @@ bool DIALOG_BOARD_REANNOTATE::BuildFootprintList( std::vector& aBadR for( EDA_ITEM* item : m_selection ) { //Get the timestamps of selected footprints - if( item->Type() == PCB_MODULE_T ) + if( item->Type() == PCB_FOOTPRINT_T ) selected.push_back( item->m_Uuid ); } } diff --git a/pcbnew/dialogs/dialog_track_via_properties.cpp b/pcbnew/dialogs/dialog_track_via_properties.cpp index 37e8cee5eb..110f1eca28 100644 --- a/pcbnew/dialogs/dialog_track_via_properties.cpp +++ b/pcbnew/dialogs/dialog_track_via_properties.cpp @@ -372,7 +372,7 @@ bool DIALOG_TRACK_VIA_PROPERTIES::TransferDataFromWindow() for( EDA_ITEM* item : m_items ) { - const KICAD_T ourTypes[] = { PCB_TRACE_T, PCB_PAD_T, PCB_VIA_T, PCB_MODULE_T, EOT }; + const KICAD_T ourTypes[] = { PCB_TRACE_T, PCB_PAD_T, PCB_VIA_T, PCB_FOOTPRINT_T, EOT }; auto connectedItems = connectivity->GetConnectedItems( static_cast( item ), ourTypes, true ); for ( BOARD_CONNECTED_ITEM* citem : connectedItems ) diff --git a/pcbnew/dialogs/dialog_unused_pad_layers.cpp b/pcbnew/dialogs/dialog_unused_pad_layers.cpp index 9b2409a723..50ad8e9006 100644 --- a/pcbnew/dialogs/dialog_unused_pad_layers.cpp +++ b/pcbnew/dialogs/dialog_unused_pad_layers.cpp @@ -101,7 +101,7 @@ bool DIALOG_UNUSED_PAD_LAYERS::TransferDataFromWindow() via->SetKeepTopBottom( m_cbPreservePads->IsChecked() ); } - if( item->Type() == PCB_MODULE_T && m_rbScope->GetSelection() == SCOPE_PADS ) + if( item->Type() == PCB_FOOTPRINT_T && m_rbScope->GetSelection() == SCOPE_PADS ) { MODULE* footprint = static_cast( item ); diff --git a/pcbnew/drc/drc_engine.cpp b/pcbnew/drc/drc_engine.cpp index 8f21f2f000..90f21106eb 100644 --- a/pcbnew/drc/drc_engine.cpp +++ b/pcbnew/drc/drc_engine.cpp @@ -824,7 +824,7 @@ DRC_CONSTRAINT DRC_ENGINE::EvalRulesForItems( DRC_CONSTRAINT_TYPE_T aConstraintI case PCB_TRACE_T: mask = DRC_DISALLOW_TRACKS; break; case PCB_ARC_T: mask = DRC_DISALLOW_TRACKS; break; case PCB_PAD_T: mask = DRC_DISALLOW_PADS; break; - case PCB_MODULE_T: mask = DRC_DISALLOW_FOOTPRINTS; break; + case PCB_FOOTPRINT_T: mask = DRC_DISALLOW_FOOTPRINTS; break; case PCB_SHAPE_T: mask = DRC_DISALLOW_GRAPHICS; break; case PCB_FP_SHAPE_T: mask = DRC_DISALLOW_GRAPHICS; break; case PCB_TEXT_T: mask = DRC_DISALLOW_TEXTS; break; diff --git a/pcbnew/drc/drc_test_provider.cpp b/pcbnew/drc/drc_test_provider.cpp index 5d833ae288..451b550f91 100644 --- a/pcbnew/drc/drc_test_provider.cpp +++ b/pcbnew/drc/drc_test_provider.cpp @@ -136,7 +136,7 @@ int DRC_TEST_PROVIDER::forEachGeometryItem( const std::vector& aTypes, { for( int i = 0; i < MAX_STRUCT_TYPE_ID; i++ ) { - if( i != PCB_MODULE_T && i != PCB_GROUP_T ) + if( i != PCB_FOOTPRINT_T && i != PCB_GROUP_T ) { s_allBasicItems.push_back( (KICAD_T) i ); @@ -298,7 +298,7 @@ int DRC_TEST_PROVIDER::forEachGeometryItem( const std::vector& aTypes, } } - if( typeMask[ PCB_MODULE_T ] ) + if( typeMask[ PCB_FOOTPRINT_T ] ) { if( !aFunc( footprint ) ) return n; diff --git a/pcbnew/edit.cpp b/pcbnew/edit.cpp index 32aed10327..9ef0248da3 100644 --- a/pcbnew/edit.cpp +++ b/pcbnew/edit.cpp @@ -130,7 +130,7 @@ void PCB_EDIT_FRAME::OnEditItemRequest( BOARD_ITEM* aItem ) ShowPadPropertiesDialog( static_cast( aItem ) ); break; - case PCB_MODULE_T: + case PCB_FOOTPRINT_T: ShowFootprintPropertiesDialog( static_cast( aItem ) ); break; diff --git a/pcbnew/footprint.cpp b/pcbnew/footprint.cpp index e703a7d79b..c4c1484efd 100644 --- a/pcbnew/footprint.cpp +++ b/pcbnew/footprint.cpp @@ -40,8 +40,8 @@ MODULE::MODULE( BOARD* parent ) : - BOARD_ITEM_CONTAINER( (BOARD_ITEM*) parent, PCB_MODULE_T ), - m_initial_comments( 0 ) + BOARD_ITEM_CONTAINER((BOARD_ITEM*) parent, PCB_FOOTPRINT_T ), + m_initial_comments( 0 ) { m_attributes = 0; m_Layer = F_Cu; @@ -972,7 +972,7 @@ SEARCH_RESULT MODULE::Visit( INSPECTOR inspector, void* testData, const KICAD_T switch( stype ) { - case PCB_MODULE_T: + case PCB_FOOTPRINT_T: result = inspector( this, testData ); // inspect me ++p; break; @@ -1543,7 +1543,7 @@ BOARD_ITEM* MODULE::DuplicateItem( const BOARD_ITEM* aItem, bool aAddToFootprint new_item = static_cast( aItem )->DeepDuplicate(); break; - case PCB_MODULE_T: + case PCB_FOOTPRINT_T: // Ignore the footprint itself break; @@ -1743,7 +1743,7 @@ void MODULE::BuildPolyCourtyards() void MODULE::SwapData( BOARD_ITEM* aImage ) { - assert( aImage->Type() == PCB_MODULE_T ); + assert( aImage->Type() == PCB_FOOTPRINT_T ); std::swap( *((MODULE*) this), *((MODULE*) aImage) ); } diff --git a/pcbnew/footprint.h b/pcbnew/footprint.h index 099b1bedbd..e6490143f4 100644 --- a/pcbnew/footprint.h +++ b/pcbnew/footprint.h @@ -121,7 +121,7 @@ public: static inline bool ClassOf( const EDA_ITEM* aItem ) { - return aItem && PCB_MODULE_T == aItem->Type(); + return aItem && aItem->Type() == PCB_FOOTPRINT_T; } ///> @copydoc BOARD_ITEM_CONTAINER::Add() diff --git a/pcbnew/footprint_editor_utils.cpp b/pcbnew/footprint_editor_utils.cpp index 2b143040e0..ed35aaa66a 100644 --- a/pcbnew/footprint_editor_utils.cpp +++ b/pcbnew/footprint_editor_utils.cpp @@ -167,7 +167,7 @@ void FOOTPRINT_EDIT_FRAME::OnEditItemRequest( BOARD_ITEM* aItem ) ShowPadPropertiesDialog( static_cast( aItem )); break; - case PCB_MODULE_T: + case PCB_FOOTPRINT_T: editFootprintProperties( (MODULE*) aItem ); GetCanvas()->Refresh(); break; diff --git a/pcbnew/fp_text.cpp b/pcbnew/fp_text.cpp index da29e0e826..8625250383 100644 --- a/pcbnew/fp_text.cpp +++ b/pcbnew/fp_text.cpp @@ -45,7 +45,7 @@ FP_TEXT::FP_TEXT( MODULE* aParentFootprint, TEXT_TYPE text_type ) : SetLayer( F_SilkS ); // Set position and give a default layer if a valid parent footprint exists - if( parentFootprint && ( parentFootprint->Type() == PCB_MODULE_T ) ) + if( parentFootprint && parentFootprint->Type() == PCB_FOOTPRINT_T ) { SetTextPos( parentFootprint->GetPosition() ); diff --git a/pcbnew/kicad_clipboard.cpp b/pcbnew/kicad_clipboard.cpp index e291c3fc7b..1abc6fae95 100644 --- a/pcbnew/kicad_clipboard.cpp +++ b/pcbnew/kicad_clipboard.cpp @@ -78,7 +78,7 @@ void CLIPBOARD_IO::SaveSelection( const PCBNEW_SELECTION& aSelected, bool isModE // Prepare net mapping that assures that net codes saved in a file are consecutive integers m_mapping->SetBoard( m_board ); - if( aSelected.Size() == 1 && aSelected.Front()->Type() == PCB_MODULE_T ) + 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() ); diff --git a/pcbnew/pad.cpp b/pcbnew/pad.cpp index 15655e265e..d6b125c1b7 100644 --- a/pcbnew/pad.cpp +++ b/pcbnew/pad.cpp @@ -53,7 +53,7 @@ PAD::PAD( MODULE* parent ) : m_orient = 0; // Pad rotation in 1/10 degrees. m_lengthPadToDie = 0; - if( m_Parent && m_Parent->Type() == PCB_MODULE_T ) + if( m_Parent && m_Parent->Type() == PCB_FOOTPRINT_T ) { m_pos = GetParent()->GetPosition(); } diff --git a/pcbnew/pcb_base_frame.cpp b/pcbnew/pcb_base_frame.cpp index 8737459ebc..4be3836f24 100644 --- a/pcbnew/pcb_base_frame.cpp +++ b/pcbnew/pcb_base_frame.cpp @@ -189,7 +189,7 @@ void PCB_BASE_FRAME::FocusOnItem( BOARD_ITEM* aItem ) { lastItem->ClearBrightened(); - if( lastItem->Type() == PCB_MODULE_T ) + if( lastItem->Type() == PCB_FOOTPRINT_T ) { static_cast( lastItem )->RunOnChildren( [&]( BOARD_ITEM* child ) { @@ -213,7 +213,7 @@ void PCB_BASE_FRAME::FocusOnItem( BOARD_ITEM* aItem ) { aItem->SetBrightened(); - if( aItem->Type() == PCB_MODULE_T ) + if( aItem->Type() == PCB_FOOTPRINT_T ) { static_cast( aItem )->RunOnChildren( [&]( BOARD_ITEM* child ) { diff --git a/pcbnew/pcb_edit_frame.cpp b/pcbnew/pcb_edit_frame.cpp index 8d1f144462..e759933bcd 100644 --- a/pcbnew/pcb_edit_frame.cpp +++ b/pcbnew/pcb_edit_frame.cpp @@ -632,7 +632,7 @@ void PCB_EDIT_FRAME::setupUIConditions() mgr->SetConditions( PCB_ACTIONS::selectConnection, ENABLE( SELECTION_CONDITIONS::OnlyTypes( GENERAL_COLLECTOR::Tracks ) ) ); mgr->SetConditions( PCB_ACTIONS::selectSameSheet, - ENABLE( SELECTION_CONDITIONS::OnlyType( PCB_MODULE_T ) ) ); + ENABLE( SELECTION_CONDITIONS::OnlyType( PCB_FOOTPRINT_T ) ) ); SELECTION_CONDITION singleZoneCond = SELECTION_CONDITIONS::Count( 1 ) && diff --git a/pcbnew/pcb_expr_evaluator.cpp b/pcbnew/pcb_expr_evaluator.cpp index 8a93844af3..9d3a96c106 100644 --- a/pcbnew/pcb_expr_evaluator.cpp +++ b/pcbnew/pcb_expr_evaluator.cpp @@ -246,7 +246,7 @@ static void insideArea( LIBEVAL::CONTEXT* aCtx, void* self ) return false; } - if( item->Type() == PCB_MODULE_T ) + if( item->Type() == PCB_FOOTPRINT_T ) { MODULE* footprint = static_cast( item ); @@ -395,7 +395,7 @@ static void memberOf( LIBEVAL::CONTEXT* aCtx, void* self ) PCB_GROUP* group = item->GetParentGroup(); - if( !group && item->GetParent() && item->GetParent()->Type() == PCB_MODULE_T ) + if( !group && item->GetParent() && item->GetParent()->Type() == PCB_FOOTPRINT_T ) group = item->GetParent()->GetParentGroup(); while( group ) diff --git a/pcbnew/pcb_group.cpp b/pcbnew/pcb_group.cpp index f26949e8c8..ef05681dba 100644 --- a/pcbnew/pcb_group.cpp +++ b/pcbnew/pcb_group.cpp @@ -73,7 +73,7 @@ PCB_GROUP* PCB_GROUP::TopLevelGroup( BOARD_ITEM* item, PCB_GROUP* scope ) { PCB_GROUP* candidate = item->GetParentGroup(); - if( !candidate && item->GetParent() && item->GetParent()->Type() == PCB_MODULE_T ) + if( !candidate && item->GetParent() && item->GetParent()->Type() == PCB_FOOTPRINT_T ) candidate = item->GetParent()->GetParentGroup(); while( candidate && candidate->GetParentGroup() && candidate->GetParentGroup() != scope ) @@ -85,7 +85,7 @@ PCB_GROUP* PCB_GROUP::TopLevelGroup( BOARD_ITEM* item, PCB_GROUP* scope ) bool PCB_GROUP::WithinScope( BOARD_ITEM* item, PCB_GROUP* scope ) { - if( item->GetParent() && item->GetParent()->Type() == PCB_MODULE_T ) + if( item->GetParent() && item->GetParent()->Type() == PCB_FOOTPRINT_T ) item = item->GetParent(); for( PCB_GROUP* parent = item->GetParentGroup(); parent; parent = parent->GetParentGroup() ) diff --git a/pcbnew/pcb_painter.cpp b/pcbnew/pcb_painter.cpp index 9291b54355..61d5b47817 100644 --- a/pcbnew/pcb_painter.cpp +++ b/pcbnew/pcb_painter.cpp @@ -439,7 +439,7 @@ bool PCB_PAINTER::Draw( const VIEW_ITEM* aItem, int aLayer ) draw( static_cast( item ), aLayer ); break; - case PCB_MODULE_T: + case PCB_FOOTPRINT_T: draw( static_cast( item ), aLayer ); break; diff --git a/pcbnew/pcb_shape.cpp b/pcbnew/pcb_shape.cpp index 1e73765b29..8d90be1ca3 100644 --- a/pcbnew/pcb_shape.cpp +++ b/pcbnew/pcb_shape.cpp @@ -456,7 +456,7 @@ void PCB_SHAPE::SetAngle( double aAngle, bool aUpdateEnd ) MODULE* PCB_SHAPE::GetParentFootprint() const { - if( !m_Parent || m_Parent->Type() != PCB_MODULE_T ) + if( !m_Parent || m_Parent->Type() != PCB_FOOTPRINT_T ) return NULL; return (MODULE*) m_Parent; diff --git a/pcbnew/pcb_text.cpp b/pcbnew/pcb_text.cpp index f0fc4bf419..dc7ace44a6 100644 --- a/pcbnew/pcb_text.cpp +++ b/pcbnew/pcb_text.cpp @@ -67,7 +67,7 @@ wxString PCB_TEXT::GetShownText( int aDepth ) const wxString ref = token->BeforeFirst( ':', &remainder ); BOARD_ITEM* refItem = board->GetItem( KIID( ref ) ); - if( refItem && refItem->Type() == PCB_MODULE_T ) + if( refItem && refItem->Type() == PCB_FOOTPRINT_T ) { MODULE* refModule = static_cast( refItem ); diff --git a/pcbnew/pcb_view.cpp b/pcbnew/pcb_view.cpp index 67da0cbbb5..86be631934 100644 --- a/pcbnew/pcb_view.cpp +++ b/pcbnew/pcb_view.cpp @@ -60,13 +60,13 @@ void PCB_VIEW::Add( KIGFX::VIEW_ITEM* aItem, int aDrawPriority ) { auto item = static_cast( aItem ); - if( item->Type() == PCB_MODULE_T ) + if( item->Type() == PCB_FOOTPRINT_T ) { - auto mod = static_cast( item ); - mod->RunOnChildren( [this] ( BOARD_ITEM* aModItem ) - { - VIEW::Add( aModItem ); - } ); + MODULE* footprint = static_cast( item ); + footprint->RunOnChildren( [this]( BOARD_ITEM* aChild ) + { + VIEW::Add( aChild ); + } ); } VIEW::Add( item, aDrawPriority ); @@ -78,12 +78,13 @@ void PCB_VIEW::Remove( KIGFX::VIEW_ITEM* aItem ) auto item = static_cast( aItem ); - if( item->Type() == PCB_MODULE_T ) + if( item->Type() == PCB_FOOTPRINT_T ) { - auto mod = static_cast( item ); - mod->RunOnChildren([this] ( BOARD_ITEM* aModItem ) { - VIEW::Remove( aModItem ); - } ); + MODULE* footprint = static_cast( item ); + footprint->RunOnChildren( [this]( BOARD_ITEM* aChild ) + { + VIEW::Remove( aChild ); + } ); } VIEW::Remove( item ); @@ -94,7 +95,7 @@ void PCB_VIEW::Update( const KIGFX::VIEW_ITEM* aItem, int aUpdateFlags ) const { const BOARD_ITEM* item = static_cast( aItem ); - if( item->Type() == PCB_MODULE_T ) + if( item->Type() == PCB_FOOTPRINT_T ) { const MODULE* mod = static_cast( item ); diff --git a/pcbnew/plugins/kicad/kicad_plugin.cpp b/pcbnew/plugins/kicad/kicad_plugin.cpp index 64b6536fee..e4beac9c62 100644 --- a/pcbnew/plugins/kicad/kicad_plugin.cpp +++ b/pcbnew/plugins/kicad/kicad_plugin.cpp @@ -411,7 +411,7 @@ void PCB_IO::Format( BOARD_ITEM* aItem, int aNestLevel ) const format( static_cast( aItem ), aNestLevel ); break; - case PCB_MODULE_T: + case PCB_FOOTPRINT_T: format( static_cast( aItem ), aNestLevel ); break; diff --git a/pcbnew/plugins/kicad/pcb_parser.cpp b/pcbnew/plugins/kicad/pcb_parser.cpp index bc31ae9596..434b20d206 100644 --- a/pcbnew/plugins/kicad/pcb_parser.cpp +++ b/pcbnew/plugins/kicad/pcb_parser.cpp @@ -744,7 +744,7 @@ void PCB_PARSER::resolveGroups( BOARD_ITEM* aParent ) { aItem = static_cast( aParent )->GetItem( aId ); } - else if( aParent->Type() == PCB_MODULE_T ) + else if( aParent->Type() == PCB_FOOTPRINT_T ) { static_cast( aParent )->RunOnChildren( [&]( BOARD_ITEM* child ) @@ -770,7 +770,7 @@ void PCB_PARSER::resolveGroups( BOARD_ITEM* aParent ) group->SetName( aGrp.name ); const_cast( group->m_Uuid ) = aGrp.uuid; - if( aGrp.parent->Type() == PCB_MODULE_T ) + if( aGrp.parent->Type() == PCB_FOOTPRINT_T ) static_cast( aGrp.parent )->Add( group ); else static_cast( aGrp.parent )->Add( group ); diff --git a/pcbnew/router/router_tool.cpp b/pcbnew/router/router_tool.cpp index 40d64729d0..0a032887a8 100644 --- a/pcbnew/router/router_tool.cpp +++ b/pcbnew/router/router_tool.cpp @@ -1422,8 +1422,12 @@ bool ROUTER_TOOL::CanInlineDrag() { const BOARD_ITEM* item = static_cast( selection.Front() ); - if( item->Type() == PCB_TRACE_T || item->Type() == PCB_VIA_T || item->Type() == PCB_MODULE_T ) + if( item->Type() == PCB_TRACE_T + || item->Type() == PCB_VIA_T + || item->Type() == PCB_FOOTPRINT_T ) + { return true; + } } return false; @@ -1442,8 +1446,12 @@ int ROUTER_TOOL::InlineDrag( const TOOL_EVENT& aEvent ) const BOARD_ITEM* item = static_cast( selection.Front() ); - if( item->Type() != PCB_TRACE_T && item->Type() != PCB_VIA_T && item->Type() != PCB_MODULE_T ) + if( item->Type() != PCB_TRACE_T + && item->Type() != PCB_VIA_T + && item->Type() != PCB_FOOTPRINT_T ) + { return 0; + } Activate(); @@ -1455,7 +1463,7 @@ int ROUTER_TOOL::InlineDrag( const TOOL_EVENT& aEvent ) PNS::ITEM_SET itemsToDrag; const MODULE* module = nullptr; - if( item->Type() == PCB_MODULE_T ) + if( item->Type() == PCB_FOOTPRINT_T ) { module = static_cast(item); diff --git a/pcbnew/specctra_import_export/specctra_export.cpp b/pcbnew/specctra_import_export/specctra_export.cpp index 5df9c4b479..909167a6c0 100644 --- a/pcbnew/specctra_import_export/specctra_export.cpp +++ b/pcbnew/specctra_import_export/specctra_export.cpp @@ -892,7 +892,7 @@ void SPECCTRA_DB::FromBOARD( BOARD* aBoard ) { PCB_TYPE_COLLECTOR items; - static const KICAD_T scanMODULEs[] = { PCB_MODULE_T, EOT }; + static const KICAD_T scanMODULEs[] = { PCB_FOOTPRINT_T, EOT }; // Not all boards are exportable. Check that all reference Ids are unique. // Unless they are unique, we cannot import the session file which comes diff --git a/pcbnew/tools/edit_tool.cpp b/pcbnew/tools/edit_tool.cpp index 3907f59753..a667da6aec 100644 --- a/pcbnew/tools/edit_tool.cpp +++ b/pcbnew/tools/edit_tool.cpp @@ -164,8 +164,8 @@ bool EDIT_TOOL::Init() return m_isFootprintEditor; }; - auto singleFootprintCondition = SELECTION_CONDITIONS::OnlyType( PCB_MODULE_T ) - && SELECTION_CONDITIONS::Count( 1 ); + auto singleFootprintCondition = SELECTION_CONDITIONS::OnlyType( PCB_FOOTPRINT_T ) + && SELECTION_CONDITIONS::Count( 1 ); auto noActiveToolCondition = [ this ] ( const SELECTION& aSelection ) @@ -460,7 +460,7 @@ int EDIT_TOOL::doMoveSelection( TOOL_EVENT aEvent, bool aPickReference ) if( !item->GetParent() || !item->GetParent()->IsSelected() ) static_cast( item )->Move( movement ); - if( item->Type() == PCB_MODULE_T ) + if( item->Type() == PCB_FOOTPRINT_T ) requestRedraw3Dview = true; } @@ -1365,7 +1365,7 @@ int EDIT_TOOL::Remove( const TOOL_EVENT& aEvent ) auto removeItem = [&]( BOARD_ITEM* bItem ) { - if( bItem->GetParent() && bItem->GetParent()->Type() == PCB_MODULE_T ) + if( bItem->GetParent() && bItem->GetParent()->Type() == PCB_FOOTPRINT_T ) { m_commit->Modify( bItem->GetParent() ); getView()->Remove( group ); @@ -1579,7 +1579,7 @@ int EDIT_TOOL::Duplicate( const TOOL_EVENT& aEvent ) static_cast( dupe_item )->SetName( padName ); } } - else if( orig_item->GetParent() && orig_item->GetParent()->Type() == PCB_MODULE_T ) + else if( orig_item->GetParent() && orig_item->GetParent()->Type() == PCB_FOOTPRINT_T ) { MODULE* parentFootprint = static_cast( orig_item->GetParent() ); @@ -1590,7 +1590,7 @@ int EDIT_TOOL::Duplicate( const TOOL_EVENT& aEvent ) { switch( orig_item->Type() ) { - case PCB_MODULE_T: + case PCB_FOOTPRINT_T: case PCB_TEXT_T: case PCB_SHAPE_T: case PCB_TRACE_T: @@ -1706,7 +1706,7 @@ void EDIT_TOOL::FootprintFilter( const VECTOR2I&, GENERAL_COLLECTOR& aCollector, { BOARD_ITEM* item = static_cast( aCollector[i] ); - if( item->Type() != PCB_MODULE_T ) + if( item->Type() != PCB_FOOTPRINT_T ) aCollector.Remove( i ); } } diff --git a/pcbnew/tools/grid_helper.cpp b/pcbnew/tools/grid_helper.cpp index 6942e493d3..a103a6fb0a 100644 --- a/pcbnew/tools/grid_helper.cpp +++ b/pcbnew/tools/grid_helper.cpp @@ -513,26 +513,26 @@ void GRID_HELPER::computeAnchors( BOARD_ITEM* aItem, const VECTOR2I& aRefPos, bo switch( aItem->Type() ) { - case PCB_MODULE_T: + case PCB_FOOTPRINT_T: { - MODULE* mod = static_cast( aItem ); + MODULE* footprint = static_cast( aItem ); - for( PAD* pad : mod->Pads() ) + for( PAD* pad : footprint->Pads() ) { - // Getting pads from the module requires re-checking that the pad is shown + // Getting pads from the footprint requires re-checking that the pad is shown if( ( aFrom || m_magneticSettings->pads == MAGNETIC_OPTIONS::CAPTURE_ALWAYS ) - && pad->GetBoundingBox().Contains( wxPoint( aRefPos.x, aRefPos.y ) ) - && view->IsVisible( pad ) - && ( !isHighContrast || activeLayers.count( pad->GetLayer() ) ) - && pad->ViewGetLOD( pad->GetLayer(), view ) < view->GetScale() ) + && pad->GetBoundingBox().Contains( wxPoint( aRefPos.x, aRefPos.y ) ) + && view->IsVisible( pad ) + && ( !isHighContrast || activeLayers.count( pad->GetLayer() ) ) + && pad->ViewGetLOD( pad->GetLayer(), view ) < view->GetScale() ) { handlePadShape( pad ); break; } } - // if the cursor is not over a pad, then drag the module by its origin - addAnchor( mod->GetPosition(), ORIGIN | SNAPPABLE, mod ); + // if the cursor is not over a pad, then drag the footprint by its origin + addAnchor( footprint->GetPosition(), ORIGIN | SNAPPABLE, footprint ); break; } diff --git a/pcbnew/tools/pcb_inspection_tool.cpp b/pcbnew/tools/pcb_inspection_tool.cpp index b62e0791f0..68606b0408 100644 --- a/pcbnew/tools/pcb_inspection_tool.cpp +++ b/pcbnew/tools/pcb_inspection_tool.cpp @@ -620,9 +620,8 @@ int PCB_INSPECTION_TOOL::HighlightItem( const TOOL_EVENT& aEvent ) bool request3DviewRedraw = true; - if( item ) - if( item->Type() != PCB_MODULE_T ) - request3DviewRedraw = false; + if( item && item->Type() != PCB_FOOTPRINT_T ) + request3DviewRedraw = false; if( request3DviewRedraw ) m_frame->Redraw3Dview(); @@ -972,7 +971,7 @@ void PCB_INSPECTION_TOOL::calculateSelectionRatsnest( const VECTOR2I& aDelta ) { BOARD_ITEM* item = static_cast( queued_items[i] ); - if( item->Type() == PCB_MODULE_T ) + if( item->Type() == PCB_FOOTPRINT_T ) { for( PAD* pad : static_cast( item )->Pads() ) { @@ -1002,7 +1001,7 @@ void PCB_INSPECTION_TOOL::calculateSelectionRatsnest( const VECTOR2I& aDelta ) || aItem->Type() == PCB_PAD_T || aItem->Type() == PCB_ARC_T || aItem->Type() == PCB_ZONE_T - || aItem->Type() == PCB_MODULE_T + || aItem->Type() == PCB_FOOTPRINT_T || aItem->Type() == PCB_VIA_T ); } ) ) { diff --git a/pcbnew/tools/pcb_tool_base.cpp b/pcbnew/tools/pcb_tool_base.cpp index 7bb3ba43e2..0836a0b144 100644 --- a/pcbnew/tools/pcb_tool_base.cpp +++ b/pcbnew/tools/pcb_tool_base.cpp @@ -69,12 +69,12 @@ void PCB_TOOL_BASE::doInteractiveItemPlacement( const std::string& aTool, newItem->SetPosition( (wxPoint) aPosition ); preview.Add( newItem.get() ); - if( newItem->Type() == PCB_MODULE_T ) + if( newItem->Type() == PCB_FOOTPRINT_T ) { - auto module = dyn_cast( newItem.get() ); + MODULE* fp = dyn_cast( newItem.get() ); // footprints have more drawable parts - module->RunOnChildren( std::bind( &KIGFX::VIEW_GROUP::Add, &preview, _1 ) ); + fp->RunOnChildren( std::bind( &KIGFX::VIEW_GROUP::Add, &preview, _1 ) ); } } }; diff --git a/pcbnew/tools/pcbnew_control.cpp b/pcbnew/tools/pcbnew_control.cpp index be54a2b650..f2013eb421 100644 --- a/pcbnew/tools/pcbnew_control.cpp +++ b/pcbnew/tools/pcbnew_control.cpp @@ -716,7 +716,7 @@ int PCBNEW_CONTROL::Paste( const TOOL_EVENT& aEvent ) break; } - case PCB_MODULE_T: + case PCB_FOOTPRINT_T: { MODULE* clipFootprint = static_cast( clipItem ); std::vector pastedItems; @@ -885,7 +885,7 @@ int PCBNEW_CONTROL::placeBoardItems( std::vector& aItems, bool aIsN break; } - case PCB_MODULE_T: + 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() ); diff --git a/pcbnew/tools/pcbnew_selection.cpp b/pcbnew/tools/pcbnew_selection.cpp index 6afc95af56..4fd465e404 100644 --- a/pcbnew/tools/pcbnew_selection.cpp +++ b/pcbnew/tools/pcbnew_selection.cpp @@ -52,7 +52,7 @@ using namespace std::placeholders; -EDA_ITEM* PCBNEW_SELECTION::GetTopLeftItem( bool onlyModules ) const +EDA_ITEM* PCBNEW_SELECTION::GetTopLeftItem( bool aFootprintsOnly ) const { EDA_ITEM* topLeftItem = nullptr; @@ -63,7 +63,7 @@ EDA_ITEM* PCBNEW_SELECTION::GetTopLeftItem( bool onlyModules ) const { pnt = item->GetPosition(); - if( ( item->Type() != PCB_MODULE_T ) && onlyModules ) + if( ( item->Type() != PCB_FOOTPRINT_T ) && aFootprintsOnly ) { continue; } @@ -91,39 +91,51 @@ const KIGFX::VIEW_GROUP::ITEMS PCBNEW_SELECTION::updateDrawList() const std::vector items; std::function addItem; - addItem = [&]( EDA_ITEM* item ) { - items.push_back( item ); + addItem = [&]( EDA_ITEM* item ) + { + items.push_back( item ); - if( item->Type() == PCB_MODULE_T ) - { - MODULE* module = static_cast( item ); - module->RunOnChildren( [&] ( BOARD_ITEM* bitem ) { addItem( bitem ); } ); - } - else if( item->Type() == PCB_GROUP_T ) - { - PCB_GROUP* group = static_cast( item ); - group->RunOnChildren( [&] ( BOARD_ITEM* bitem ) { addItem( bitem ); } ); - } - }; + if( item->Type() == PCB_FOOTPRINT_T ) + { + MODULE* footprint = static_cast( item ); + footprint->RunOnChildren( [&]( BOARD_ITEM* bitem ) + { + addItem( bitem ); + } ); + } + else if( item->Type() == PCB_GROUP_T ) + { + PCB_GROUP* group = static_cast( item ); + group->RunOnChildren( [&]( BOARD_ITEM* bitem ) + { + addItem( bitem ); + } ); + } + }; - for( auto item : m_items ) - { + for( EDA_ITEM* item : m_items ) addItem( item ); - } + #if 0 for( auto item : m_items ) { items.push_back( item ); - if( item->Type() == PCB_MODULE_T ) + if( item->Type() == PCB_FOOTPRINT_T ) { - MODULE* module = static_cast( item ); - module->RunOnChildren( [&] ( BOARD_ITEM* bitem ) { items.push_back( bitem ); } ); + FOOTPRINT* footprint = static_cast( item ); + footprint->RunOnChildren( [&]( BOARD_ITEM* bitem ) + { + items.push_back( bitem ); + } ); } else if( item->Type() == PCB_GROUP_T ) { PCB_GROUP* group = static_cast( item ); - group->RunOnChildren( [&] ( BOARD_ITEM* bitem ) { items.push_back( bitem ); } ); + group->RunOnChildren( [&]( BOARD_ITEM* bitem ) + { + items.push_back( bitem ); + } ); } } #endif @@ -135,9 +147,9 @@ const LSET PCBNEW_SELECTION::GetSelectionLayers() { LSET retval; - for( auto item : m_items ) + for( EDA_ITEM* item : m_items ) { - if( auto board_item = dynamic_cast( item ) ) + if( BOARD_ITEM* board_item = dynamic_cast( item ) ) retval |= board_item->GetLayerSet(); } diff --git a/pcbnew/tools/pcbnew_selection.h b/pcbnew/tools/pcbnew_selection.h index b5d8b32353..833736b1e3 100644 --- a/pcbnew/tools/pcbnew_selection.h +++ b/pcbnew/tools/pcbnew_selection.h @@ -31,7 +31,7 @@ class PCBNEW_SELECTION : public SELECTION { public: - EDA_ITEM* GetTopLeftItem( bool onlyModules = false ) const override; + EDA_ITEM* GetTopLeftItem( bool aFootprintsOnly = false ) const override; const KIGFX::VIEW_GROUP::ITEMS updateDrawList() const override; diff --git a/pcbnew/tools/placement_tool.cpp b/pcbnew/tools/placement_tool.cpp index be3839e32a..99f05cb96f 100644 --- a/pcbnew/tools/placement_tool.cpp +++ b/pcbnew/tools/placement_tool.cpp @@ -96,7 +96,7 @@ ALIGNMENT_RECTS GetBoundingBoxes( const T &sel ) { BOARD_ITEM* boardItem = static_cast( item ); - if( item->Type() == PCB_MODULE_T ) + if( item->Type() == PCB_FOOTPRINT_T ) 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/point_editor.cpp b/pcbnew/tools/point_editor.cpp index 96ae9560fd..0462425ff2 100644 --- a/pcbnew/tools/point_editor.cpp +++ b/pcbnew/tools/point_editor.cpp @@ -2035,7 +2035,7 @@ int POINT_EDITOR::addCorner( const TOOL_EVENT& aEvent ) if( item->Type() == PCB_FP_SHAPE_T ) { FP_SHAPE* edge = static_cast( graphicItem ); - assert( edge->GetParent()->Type() == PCB_MODULE_T ); + assert( edge->GetParent()->Type() == PCB_FOOTPRINT_T ); newSegment = new FP_SHAPE( *edge ); } else diff --git a/pcbnew/tools/selection_tool.cpp b/pcbnew/tools/selection_tool.cpp index d4a4bb7491..e66e822beb 100644 --- a/pcbnew/tools/selection_tool.cpp +++ b/pcbnew/tools/selection_tool.cpp @@ -779,7 +779,7 @@ SELECTION_LOCK_FLAGS SELECTION_TOOL::CheckLock() { switch( item->Type() ) { - case PCB_MODULE_T: + case PCB_FOOTPRINT_T: if( static_cast( item )->IsLocked() ) containsLocked = true; break; @@ -1317,7 +1317,7 @@ int SELECTION_TOOL::selectSameSheet( const TOOL_EVENT& aEvent ) if( !item ) return 0; - if( item->Type() != PCB_MODULE_T ) + if( item->Type() != PCB_FOOTPRINT_T ) return 0; auto mod = dynamic_cast( item ); @@ -1400,59 +1400,50 @@ static bool itemIsIncludedByFilter( const BOARD_ITEM& aItem, const BOARD& aBoard { switch( aItem.Type() ) { - case PCB_MODULE_T: + case PCB_FOOTPRINT_T: { - const auto& module = static_cast( aItem ); + const MODULE& footprint = static_cast( aItem ); include = aFilterOptions.includeModules; if( include && !aFilterOptions.includeLockedModules ) - { - include = !module.IsLocked(); - } + include = !footprint.IsLocked(); break; } case PCB_TRACE_T: case PCB_ARC_T: - { include = aFilterOptions.includeTracks; break; - } + case PCB_VIA_T: - { include = aFilterOptions.includeVias; break; - } + case PCB_ZONE_T: - { include = aFilterOptions.includeZones; break; - } + case PCB_SHAPE_T: case PCB_TARGET_T: case PCB_DIM_ALIGNED_T: case PCB_DIM_CENTER_T: case PCB_DIM_ORTHOGONAL_T: case PCB_DIM_LEADER_T: - { if( layer == Edge_Cuts ) include = aFilterOptions.includeBoardOutlineLayer; else include = aFilterOptions.includeItemsOnTechLayers; break; - } + case PCB_TEXT_T: - { include = aFilterOptions.includePcbTexts; break; - } + default: - { // no filtering, just select it break; } - } } return include; @@ -1518,19 +1509,17 @@ bool SELECTION_TOOL::itemPassesFilter( BOARD_ITEM* aItem ) switch( aItem->Type() ) { - case PCB_MODULE_T: + case PCB_FOOTPRINT_T: if( !m_filter.footprints ) return false; break; case PCB_PAD_T: - { if( !m_filter.pads ) return false; break; - } case PCB_TRACE_T: case PCB_ARC_T: @@ -1554,9 +1543,9 @@ bool SELECTION_TOOL::itemPassesFilter( BOARD_ITEM* aItem ) { return false; } - - break; } + break; + case PCB_SHAPE_T: case PCB_TARGET_T: if( !m_filter.graphics ) @@ -1624,7 +1613,7 @@ void SELECTION_TOOL::RebuildSelection() EDA_ITEM* parent = item->GetParent(); // Flags on module children might be set only because the parent is selected. - if( parent && parent->Type() == PCB_MODULE_T && parent->IsSelected() ) + if( parent && parent->Type() == PCB_FOOTPRINT_T && parent->IsSelected() ) return SEARCH_RESULT::CONTINUE; highlight( (BOARD_ITEM*) item, SELECTED, &m_selection ); @@ -1796,7 +1785,7 @@ BOARD_ITEM* SELECTION_TOOL::pickSmallestComponent( GENERAL_COLLECTOR* aCollector for( int i = 0; i < count; ++i ) { - if( ( *aCollector )[i]->Type() != PCB_MODULE_T ) + if(( *aCollector )[i]->Type() != PCB_FOOTPRINT_T ) return NULL; } @@ -1859,7 +1848,7 @@ bool SELECTION_TOOL::Selectable( const BOARD_ITEM* aItem, bool checkVisibilityOn // Check to see if this keepout is part of a footprint // If it is, and we are not editing the footprint, it should not be selectable - bool zoneInFootprint = zone->GetParent() && zone->GetParent()->Type() == PCB_MODULE_T; + bool zoneInFootprint = zone->GetParent() && zone->GetParent()->Type() == PCB_FOOTPRINT_T; if( zoneInFootprint && !m_isFootprintEditor && !checkVisibilityOnly ) return false; @@ -1886,7 +1875,7 @@ bool SELECTION_TOOL::Selectable( const BOARD_ITEM* aItem, bool checkVisibilityOn return ( board()->GetVisibleLayers() & via->GetLayerSet() ).any(); } - case PCB_MODULE_T: + case PCB_FOOTPRINT_T: { // In modedit, we do not want to select the module itself. if( m_isFootprintEditor ) @@ -2076,7 +2065,7 @@ void SELECTION_TOOL::highlightInternal( BOARD_ITEM* aItem, int aMode, // footprints are treated in a special way - when they are highlighted, we have to highlight // all the parts that make the module, not the module itself - if( aItem->Type() == PCB_MODULE_T ) + if( aItem->Type() == PCB_FOOTPRINT_T ) { static_cast( aItem )->RunOnChildren( [&]( BOARD_ITEM* aChild ) @@ -2134,7 +2123,7 @@ void SELECTION_TOOL::unhighlightInternal( BOARD_ITEM* aItem, int aMode, // footprints are treated in a special way - when they are highlighted, we have to // highlight all the parts that make the module, not the module itself - if( aItem->Type() == PCB_MODULE_T ) + if( aItem->Type() == PCB_FOOTPRINT_T ) { static_cast( aItem )->RunOnChildren( [&]( BOARD_ITEM* aChild ) @@ -2174,7 +2163,7 @@ bool SELECTION_TOOL::selectionContains( const VECTOR2I& aPoint ) const static EDA_RECT getRect( const BOARD_ITEM* aItem ) { - if( aItem->Type() == PCB_MODULE_T ) + if( aItem->Type() == PCB_FOOTPRINT_T ) return static_cast( aItem )->GetFootprintRect(); return aItem->GetBoundingBox(); @@ -2359,7 +2348,7 @@ void SELECTION_TOOL::GuessSelectionCandidates( GENERAL_COLLECTOR& aCollector, double itemCommonRatio = calcRatio( commonArea, itemArea ); double txtCommonRatio = calcRatio( commonArea, textArea ); - if( item->Type() == PCB_MODULE_T ) + if( item->Type() == PCB_FOOTPRINT_T ) { // when text area is small compared to an overlapping footprint, // then it's a clear sign the text is the selection target @@ -2374,7 +2363,7 @@ void SELECTION_TOOL::GuessSelectionCandidates( GENERAL_COLLECTOR& aCollector, case PCB_PAD_T: case PCB_SHAPE_T: case PCB_VIA_T: - case PCB_MODULE_T: + case PCB_FOOTPRINT_T: if( areaRatio > textToFeatureMinRatio && txtCommonRatio < commonAreaRatio ) rejected.insert( txt ); break; @@ -2445,16 +2434,16 @@ void SELECTION_TOOL::GuessSelectionCandidates( GENERAL_COLLECTOR& aCollector, for( int i = 0; i < aCollector.GetCount(); ++i ) { - if( aCollector[i]->Type() != PCB_MODULE_T ) + if( aCollector[i]->Type() != PCB_FOOTPRINT_T ) { hasNonModules = true; break; } } - if( aCollector.CountType( PCB_MODULE_T ) > 0 ) + if( aCollector.CountType( PCB_FOOTPRINT_T ) > 0 ) { - double maxArea = calcMaxArea( aCollector, PCB_MODULE_T ); + double maxArea = calcMaxArea( aCollector, PCB_FOOTPRINT_T ); BOX2D viewportD = getView()->GetViewport(); BOX2I viewport( VECTOR2I( viewportD.GetPosition() ), VECTOR2I( viewportD.GetSize() ) ); double maxCoverRatio = footprintMaxCoverRatio; @@ -2504,7 +2493,7 @@ void SELECTION_TOOL::GuessSelectionCandidates( GENERAL_COLLECTOR& aCollector, BOARD_ITEM* item = aCollector[j]; double areaRatio = calcRatio( viaArea, calcArea( item ) ); - if( item->Type() == PCB_MODULE_T && areaRatio < padToFootprintMinRatio ) + if( item->Type() == PCB_FOOTPRINT_T && areaRatio < padToFootprintMinRatio ) rejected.insert( item ); if( item->Type() == PCB_PAD_T && areaRatio < viaToPadMinRatio ) @@ -2570,12 +2559,15 @@ void SELECTION_TOOL::GuessSelectionCandidates( GENERAL_COLLECTOR& aCollector, for( int j = 0; j < aCollector.GetCount(); ++j ) { - if( MODULE* mod = dyn_cast( aCollector[j] ) ) + if( MODULE* footprint = dyn_cast( aCollector[j] ) ) { - double ratio = calcRatio( maxArea, mod->GetFootprintRect().GetArea() ); + double ratio = calcRatio( maxArea, footprint->GetFootprintRect().GetArea() ); - if( ratio < padToFootprintMinRatio && calcCommonArea( maxTrack, mod ) < commonAreaRatio ) - rejected.insert( mod ); + if( ratio < padToFootprintMinRatio + && calcCommonArea( maxTrack, footprint ) < commonAreaRatio ) + { + rejected.insert( footprint ); + } } } } @@ -2583,9 +2575,7 @@ void SELECTION_TOOL::GuessSelectionCandidates( GENERAL_COLLECTOR& aCollector, if( (unsigned) aCollector.GetCount() > rejected.size() ) // do not remove everything { for( BOARD_ITEM* item : rejected ) - { aCollector.Transfer( item ); - } } } @@ -2622,9 +2612,7 @@ void SELECTION_TOOL::FilterCollectorForGroups( GENERAL_COLLECTOR& aCollector ) c for( BOARD_ITEM* item : toAdd ) { if( !aCollector.HasItem( item ) ) - { aCollector.Append( item ); - } } } diff --git a/pcbnew/tools/zone_create_helper.cpp b/pcbnew/tools/zone_create_helper.cpp index 6e2a5517c8..ab6ca01309 100644 --- a/pcbnew/tools/zone_create_helper.cpp +++ b/pcbnew/tools/zone_create_helper.cpp @@ -102,7 +102,7 @@ std::unique_ptr ZONE_CREATE_HELPER::createNewZone( bool aKeepout ) // The new zone is a ZONE if created in the board editor and a FP_ZONE if created in the // footprint editor - wxASSERT( !m_tool.m_isFootprintEditor || ( parent->Type() == PCB_MODULE_T ) ); + wxASSERT( !m_tool.m_isFootprintEditor || ( parent->Type() == PCB_FOOTPRINT_T ) ); std::unique_ptr newZone = m_tool.m_isFootprintEditor ? std::make_unique( parent ) : diff --git a/pcbnew/undo_redo.cpp b/pcbnew/undo_redo.cpp index b1addbe969..01197ac171 100644 --- a/pcbnew/undo_redo.cpp +++ b/pcbnew/undo_redo.cpp @@ -202,7 +202,7 @@ void PCB_BASE_EDIT_FRAME::SaveCopyInUndoList( const PICKED_ITEMS_LIST& aItemsLis BOARD_ITEM* item = dynamic_cast( aItemsList.GetPickedItem( ii ) ); // For items belonging to footprints, we need to save state of the parent footprint - if( item && item->GetParent() && item->GetParent()->Type() == PCB_MODULE_T ) + if( item && item->GetParent() && item->GetParent()->Type() == PCB_FOOTPRINT_T ) { item = item->GetParent(); @@ -435,7 +435,7 @@ void PCB_BASE_EDIT_FRAME::PutDataInPreviousState( PICKED_ITEMS_LIST* aList, bool // see if we must rebuild ratsnets and pointers lists switch( eda_item->Type() ) { - case PCB_MODULE_T: + case PCB_FOOTPRINT_T: case PCB_GROUP_T: deep_reBuild_ratsnest = true; // Pointers on pads can be invalid KI_FALLTHROUGH;