PCB_MODULE_T -> PCB_FOOTPRINT_T

This commit is contained in:
Jeff Young 2020-11-13 12:21:02 +00:00
parent 63a54d003e
commit 3451ac3088
48 changed files with 297 additions and 303 deletions

View File

@ -761,7 +761,7 @@ void EDA_3D_CANVAS::OnMouseMove( wxMouseEvent &event )
} }
break; break;
case PCB_MODULE_T: case PCB_FOOTPRINT_T:
{ {
MODULE* footprint = dynamic_cast<MODULE *>( intersectedBoardItem ); MODULE* footprint = dynamic_cast<MODULE *>( intersectedBoardItem );

View File

@ -258,7 +258,7 @@ static struct EDA_ITEM_DESC
.Map( NOT_USED, wxT( "<not used>" ) ) .Map( NOT_USED, wxT( "<not used>" ) )
.Map( SCREEN_T, _HKI( "Screen" ) ) .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_PAD_T, _HKI( "Pad" ) )
.Map( PCB_SHAPE_T, _HKI( "Graphic Shape" ) ) .Map( PCB_SHAPE_T, _HKI( "Graphic Shape" ) )
.Map( PCB_TEXT_T, _HKI( "Board Text" ) ) .Map( PCB_TEXT_T, _HKI( "Board Text" ) )

View File

@ -52,120 +52,120 @@ size_t hash_eda( const EDA_ITEM* aItem, int aFlags )
switch( aItem->Type() ) switch( aItem->Type() )
{ {
case PCB_MODULE_T: case PCB_FOOTPRINT_T:
{ {
const MODULE* footprint = static_cast<const MODULE*>( aItem ); const MODULE* footprint = static_cast<const MODULE*>( aItem );
ret = hash_board_item( footprint, aFlags ); ret = hash_board_item( footprint, aFlags );
if( aFlags & HASH_POS ) if( aFlags & HASH_POS )
hash_combine( ret, footprint->GetPosition().x, footprint->GetPosition().y ); hash_combine( ret, footprint->GetPosition().x, footprint->GetPosition().y );
if( aFlags & HASH_ROT ) if( aFlags & HASH_ROT )
hash_combine( ret, footprint->GetOrientation() ); hash_combine( ret, footprint->GetOrientation() );
for( BOARD_ITEM* item : footprint->GraphicalItems() ) for( BOARD_ITEM* item : footprint->GraphicalItems() )
hash_combine( ret, hash_eda( item, aFlags ) ); hash_combine( ret, hash_eda( item, aFlags ) );
for( PAD* pad : footprint->Pads() ) for( PAD* pad : footprint->Pads() )
hash_combine( ret, hash_eda( static_cast<EDA_ITEM*>( pad ), aFlags ) ); hash_combine( ret, hash_eda( static_cast<EDA_ITEM*>( pad ), aFlags ) );
} }
break; break;
case PCB_PAD_T: case PCB_PAD_T:
{
const PAD* pad = static_cast<const PAD*>( aItem );
ret = hash<int>{}( 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<const PAD*>( aItem ); if( aFlags & REL_COORD )
hash_combine( ret, pad->GetPos0().x, pad->GetPos0().y );
ret = hash<int>{}( pad->GetShape() << 16 ); else
hash_combine( ret, pad->GetDrillShape() << 18 ); hash_combine( ret, pad->GetPosition().x, pad->GetPosition().y );
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 & HASH_ROT )
hash_combine( ret, pad->GetOrientation() );
if( aFlags & HASH_NET )
hash_combine( ret, pad->GetNetCode() );
}
break; break;
case PCB_FP_TEXT_T: case PCB_FP_TEXT_T:
{
const FP_TEXT* text = static_cast<const FP_TEXT*>( 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<const FP_TEXT*>( aItem ); if( aFlags & REL_COORD )
hash_combine( ret, text->GetPos0().x, text->GetPos0().y );
if( !( aFlags & HASH_REF ) && text->GetType() == FP_TEXT::TEXT_is_REFERENCE ) else
break; hash_combine( ret, text->GetPosition().x, text->GetPosition().y );
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 & HASH_ROT )
hash_combine( ret, text->GetTextAngle() );
}
break; break;
case PCB_FP_SHAPE_T: case PCB_FP_SHAPE_T:
{
const FP_SHAPE* segment = static_cast<const FP_SHAPE*>( 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<const FP_SHAPE*>( aItem ); if( aFlags & REL_COORD )
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 ) hash_combine( ret, segment->GetStart0().x );
{ hash_combine( ret, segment->GetStart0().y );
hash_combine( ret, segment->GetStart0().x ); hash_combine( ret, segment->GetEnd0().x );
hash_combine( ret, segment->GetStart0().y ); hash_combine( ret, segment->GetEnd0().y );
hash_combine( ret, segment->GetEnd0().x ); }
hash_combine( ret, segment->GetEnd0().y ); else
} {
else hash_combine( ret, segment->GetStart().x );
{ hash_combine( ret, segment->GetStart().y );
hash_combine( ret, segment->GetStart().x ); hash_combine( ret, segment->GetEnd().x );
hash_combine( ret, segment->GetStart().y ); hash_combine( ret, segment->GetEnd().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; break;
default: default:

View File

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

View File

@ -106,7 +106,7 @@ void ARRAY_CREATOR::Invoke()
{ {
switch( item->Type() ) switch( item->Type() )
{ {
case PCB_MODULE_T: case PCB_FOOTPRINT_T:
case PCB_TEXT_T: case PCB_TEXT_T:
case PCB_SHAPE_T: case PCB_SHAPE_T:
case PCB_TRACE_T: case PCB_TRACE_T:
@ -145,7 +145,7 @@ void ARRAY_CREATOR::Invoke()
// it this state, reset the selected stated of aItem: // it this state, reset the selected stated of aItem:
this_item->ClearSelected(); this_item->ClearSelected();
if( this_item->Type() == PCB_MODULE_T ) if( this_item->Type() == PCB_FOOTPRINT_T )
{ {
static_cast<MODULE*>( this_item )->RunOnChildren( static_cast<MODULE*>( this_item )->RunOnChildren(
[&]( BOARD_ITEM* aItem ) [&]( BOARD_ITEM* aItem )

View File

@ -106,7 +106,7 @@ int AUTOPLACE_TOOL::autoplaceSelected( const TOOL_EVENT& aEvent )
for( EDA_ITEM* item : selection() ) for( EDA_ITEM* item : selection() )
{ {
if( item->Type() == PCB_MODULE_T ) if( item->Type() == PCB_FOOTPRINT_T )
footprints.push_back( static_cast<MODULE*>( item ) ); footprints.push_back( static_cast<MODULE*>( item ) );
} }

View File

@ -253,7 +253,7 @@ void BOARD::Move( const wxPoint& aMoveVector ) // overload
// PCB_FP_TEXT_T, Can't be at board level // PCB_FP_TEXT_T, Can't be at board level
// PCB_FP_SHAPE_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_FP_ZONE_T, Can't be at board level
PCB_MODULE_T, PCB_FOOTPRINT_T,
PCB_ZONE_T, PCB_ZONE_T,
EOT EOT
}; };
@ -596,7 +596,7 @@ void BOARD::Add( BOARD_ITEM* aBoardItem, ADD_MODE aMode )
break; break;
case PCB_MODULE_T: case PCB_FOOTPRINT_T:
if( aMode == ADD_MODE::APPEND ) if( aMode == ADD_MODE::APPEND )
m_footprints.push_back((MODULE*) aBoardItem ); m_footprints.push_back((MODULE*) aBoardItem );
else else
@ -676,7 +676,7 @@ void BOARD::Remove( BOARD_ITEM* aBoardItem )
} ) ); } ) );
break; break;
case PCB_MODULE_T: case PCB_FOOTPRINT_T:
m_footprints.erase( std::remove_if( m_footprints.begin(), m_footprints.end(), m_footprints.erase( std::remove_if( m_footprints.begin(), m_footprints.end(),
[aBoardItem]( BOARD_ITEM* aItem ) [aBoardItem]( BOARD_ITEM* aItem )
{ {
@ -955,7 +955,7 @@ wxString BOARD::ConvertKIIDsToCrossReferences( const wxString& aSource )
wxString ref = token.BeforeFirst( ':', &remainder ); wxString ref = token.BeforeFirst( ':', &remainder );
BOARD_ITEM* refItem = GetItem( KIID( ref ) ); BOARD_ITEM* refItem = GetItem( KIID( ref ) );
if( refItem && refItem->Type() == PCB_MODULE_T ) if( refItem && refItem->Type() == PCB_FOOTPRINT_T )
token = static_cast<MODULE*>( refItem )->GetReference() + ":" + remainder; token = static_cast<MODULE*>( 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, ... ). * 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_PAD_T:
case PCB_FP_TEXT_T: case PCB_FP_TEXT_T:
case PCB_FP_SHAPE_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 ) switch( stype = *++p )
{ {
case PCB_MODULE_T: case PCB_FOOTPRINT_T:
case PCB_PAD_T: case PCB_PAD_T:
case PCB_FP_TEXT_T: case PCB_FP_TEXT_T:
case PCB_FP_SHAPE_T: case PCB_FP_SHAPE_T:

View File

@ -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 // if aItem belongs a footprint, the full footprint will be saved
// because undo/redo does not handle "sub items" modifications // 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(); 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; aItem = item;
} }
@ -106,7 +106,7 @@ void BOARD_COMMIT::Push( const wxString& aMessage, bool aCreateUndoEntry, bool a
if( m_isFootprintEditor ) if( m_isFootprintEditor )
{ {
// Be sure that we are storing a footprint // 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(); ent.m_item = ent.m_item->GetParent();
// We have not saved the footprint yet, so let's create an entry // 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(); ent.m_copy = ent.m_item->Clone();
} }
wxASSERT( ent.m_item->Type() == PCB_MODULE_T ); wxASSERT( ent.m_item->Type() == PCB_FOOTPRINT_T );
wxASSERT( ent.m_copy->Type() == PCB_MODULE_T ); wxASSERT( ent.m_copy->Type() == PCB_FOOTPRINT_T );
if( aCreateUndoEntry ) if( aCreateUndoEntry )
{ {
@ -141,7 +141,7 @@ void BOARD_COMMIT::Push( const wxString& aMessage, bool aCreateUndoEntry, bool a
if( m_isFootprintEditor ) if( m_isFootprintEditor )
{ {
// footprints inside footprints are not supported yet // footprints inside footprints are not supported yet
wxASSERT( boardItem->Type() != PCB_MODULE_T ); wxASSERT( boardItem->Type() != PCB_FOOTPRINT_T );
boardItem->SetParent( board->Footprints().front() ); 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 ) boardItem->Type() == PCB_FP_ZONE_T )
{ {
wxASSERT( boardItem->GetParent() && wxASSERT( boardItem->GetParent() &&
boardItem->GetParent()->Type() == PCB_MODULE_T ); boardItem->GetParent()->Type() == PCB_FOOTPRINT_T );
} }
else else
{ {
@ -205,7 +205,7 @@ void BOARD_COMMIT::Push( const wxString& aMessage, bool aCreateUndoEntry, bool a
if( !( changeFlags & CHT_DONE ) ) if( !( changeFlags & CHT_DONE ) )
{ {
MODULE* footprint = static_cast<MODULE*>( boardItem->GetParent() ); MODULE* footprint = static_cast<MODULE*>( boardItem->GetParent() );
wxASSERT( footprint && footprint->Type() == PCB_MODULE_T ); wxASSERT( footprint && footprint->Type() == PCB_FOOTPRINT_T );
footprint->Delete( boardItem ); footprint->Delete( boardItem );
} }
@ -231,7 +231,7 @@ void BOARD_COMMIT::Push( const wxString& aMessage, bool aCreateUndoEntry, bool a
break; break;
case PCB_MODULE_T: case PCB_FOOTPRINT_T:
{ {
// No support for nested footprints (yet) // No support for nested footprints (yet)
wxASSERT( !m_isFootprintEditor ); wxASSERT( !m_isFootprintEditor );

View File

@ -60,7 +60,7 @@ const KICAD_T GENERAL_COLLECTOR::AllBoardItems[] = {
PCB_ARC_T, // in m_tracks PCB_ARC_T, // in m_tracks
PCB_PAD_T, // in footprints PCB_PAD_T, // in footprints
PCB_FP_TEXT_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_GROUP_T, // in m_groups
PCB_ZONE_T, // in m_zones PCB_ZONE_T, // in m_zones
EOT EOT
@ -79,7 +79,7 @@ const KICAD_T GENERAL_COLLECTOR::BoardLevelItems[] = {
PCB_VIA_T, PCB_VIA_T,
PCB_ARC_T, PCB_ARC_T,
PCB_TRACE_T, PCB_TRACE_T,
PCB_MODULE_T, PCB_FOOTPRINT_T,
PCB_GROUP_T, PCB_GROUP_T,
PCB_ZONE_T, PCB_ZONE_T,
EOT EOT
@ -100,7 +100,7 @@ const KICAD_T GENERAL_COLLECTOR::AllButZones[] = {
PCB_ARC_T, PCB_ARC_T,
PCB_PAD_T, PCB_PAD_T,
PCB_FP_TEXT_T, PCB_FP_TEXT_T,
PCB_MODULE_T, PCB_FOOTPRINT_T,
PCB_GROUP_T, PCB_GROUP_T,
PCB_ZONE_T, // if it is visible on screen, it should be selectable PCB_ZONE_T, // if it is visible on screen, it should be selectable
EOT EOT
@ -108,14 +108,14 @@ const KICAD_T GENERAL_COLLECTOR::AllButZones[] = {
const KICAD_T GENERAL_COLLECTOR::Modules[] = { const KICAD_T GENERAL_COLLECTOR::Modules[] = {
PCB_MODULE_T, PCB_FOOTPRINT_T,
EOT EOT
}; };
const KICAD_T GENERAL_COLLECTOR::PadsOrModules[] = { const KICAD_T GENERAL_COLLECTOR::PadsOrModules[] = {
PCB_PAD_T, PCB_PAD_T,
PCB_MODULE_T, PCB_FOOTPRINT_T,
EOT EOT
}; };
@ -130,7 +130,7 @@ const KICAD_T GENERAL_COLLECTOR::PadsOrTracks[] = {
const KICAD_T GENERAL_COLLECTOR::ModulesAndTheirItems[] = { const KICAD_T GENERAL_COLLECTOR::ModulesAndTheirItems[] = {
PCB_MODULE_T, PCB_FOOTPRINT_T,
PCB_FP_TEXT_T, PCB_FP_TEXT_T,
PCB_FP_SHAPE_T, PCB_FP_SHAPE_T,
PCB_PAD_T, PCB_PAD_T,
@ -159,7 +159,7 @@ const KICAD_T GENERAL_COLLECTOR::Tracks[] = {
const KICAD_T GENERAL_COLLECTOR::LockableItems[] = { const KICAD_T GENERAL_COLLECTOR::LockableItems[] = {
PCB_MODULE_T, PCB_FOOTPRINT_T,
PCB_GROUP_T, // Can a group be locked? PCB_GROUP_T, // Can a group be locked?
PCB_TRACE_T, PCB_TRACE_T,
PCB_ARC_T, PCB_ARC_T,
@ -243,7 +243,7 @@ SEARCH_RESULT GENERAL_COLLECTOR::Inspect( EDA_ITEM* testItem, void* testData )
} }
break; break;
case PCB_MODULE_T: case PCB_FOOTPRINT_T:
{ {
MODULE* footprint = (MODULE*) item; MODULE* footprint = (MODULE*) item;
@ -372,7 +372,7 @@ SEARCH_RESULT GENERAL_COLLECTOR::Inspect( EDA_ITEM* testItem, void* testData )
shape = static_cast<FP_SHAPE*>( item ); shape = static_cast<FP_SHAPE*>( item );
break; break;
case PCB_MODULE_T: case PCB_FOOTPRINT_T:
footprint = static_cast<MODULE*>( item ); footprint = static_cast<MODULE*>( item );
break; break;
@ -477,7 +477,7 @@ SEARCH_RESULT GENERAL_COLLECTOR::Inspect( EDA_ITEM* testItem, void* testData )
goto exit; goto exit;
} }
} }
else if( item->Type() == PCB_MODULE_T ) else if( item->Type() == PCB_FOOTPRINT_T )
{ {
if( footprint->HitTest( m_refPos, accuracy ) if( footprint->HitTest( m_refPos, accuracy )
&& footprint->HitTestAccurate( m_refPos, accuracy ) ) && footprint->HitTestAccurate( m_refPos, accuracy ) )
@ -551,7 +551,7 @@ SEARCH_RESULT GENERAL_COLLECTOR::Inspect( EDA_ITEM* testItem, void* testData )
goto exit; goto exit;
} }
} }
else if( item->Type() == PCB_MODULE_T ) else if( item->Type() == PCB_FOOTPRINT_T )
{ {
if( footprint->HitTest( m_refPos, accuracy ) if( footprint->HitTest( m_refPos, accuracy )
&& footprint->HitTestAccurate( m_refPos, accuracy ) ) && footprint->HitTestAccurate( m_refPos, accuracy ) )

View File

@ -45,8 +45,8 @@ bool CN_CONNECTIVITY_ALGO::Remove( BOARD_ITEM* aItem )
switch( aItem->Type() ) switch( aItem->Type() )
{ {
case PCB_MODULE_T: case PCB_FOOTPRINT_T:
for( auto pad : static_cast<MODULE*>( aItem ) -> Pads() ) for( PAD* pad : static_cast<MODULE*>( aItem )->Pads() )
{ {
m_itemMap[pad].MarkItemsAsInvalid(); m_itemMap[pad].MarkItemsAsInvalid();
m_itemMap.erase( pad ); m_itemMap.erase( pad );
@ -100,7 +100,7 @@ void CN_CONNECTIVITY_ALGO::markItemNetAsDirty( const BOARD_ITEM* aItem )
} }
else else
{ {
if( aItem->Type() == PCB_MODULE_T ) if( aItem->Type() == PCB_FOOTPRINT_T )
{ {
auto mod = static_cast <const MODULE*>( aItem ); auto mod = static_cast <const MODULE*>( aItem );
@ -121,12 +121,11 @@ bool CN_CONNECTIVITY_ALGO::Add( BOARD_ITEM* aItem )
switch( aItem->Type() ) switch( aItem->Type() )
{ {
case PCB_NETINFO_T: case PCB_NETINFO_T:
{ MarkNetAsDirty( static_cast<NETINFO_ITEM*>( aItem )->GetNet() );
MarkNetAsDirty( static_cast<NETINFO_ITEM*>( aItem )->GetNet() ); break;
break;
} case PCB_FOOTPRINT_T:
case PCB_MODULE_T: for( PAD* pad : static_cast<MODULE*>( aItem )->Pads() )
for( auto pad : static_cast<MODULE*>( aItem ) -> Pads() )
{ {
if( m_itemMap.find( pad ) != m_itemMap.end() ) if( m_itemMap.find( pad ) != m_itemMap.end() )
return false; return false;
@ -141,35 +140,27 @@ bool CN_CONNECTIVITY_ALGO::Add( BOARD_ITEM* aItem )
return false; return false;
add( m_itemList, static_cast<PAD*>( aItem ) ); add( m_itemList, static_cast<PAD*>( aItem ) );
break; break;
case PCB_TRACE_T: case PCB_TRACE_T:
{
if( m_itemMap.find( aItem ) != m_itemMap.end() ) if( m_itemMap.find( aItem ) != m_itemMap.end() )
return false; return false;
add( m_itemList, static_cast<TRACK*>( aItem ) ); add( m_itemList, static_cast<TRACK*>( aItem ) );
break; break;
}
case PCB_ARC_T: case PCB_ARC_T:
{
if( m_itemMap.find( aItem ) != m_itemMap.end() ) if( m_itemMap.find( aItem ) != m_itemMap.end() )
return false; return false;
add( m_itemList, static_cast<ARC*>( aItem ) ); add( m_itemList, static_cast<ARC*>( aItem ) );
break; break;
}
case PCB_VIA_T: case PCB_VIA_T:
if( m_itemMap.find( aItem ) != m_itemMap.end() ) if( m_itemMap.find( aItem ) != m_itemMap.end() )
return false; return false;
add( m_itemList, static_cast<VIA*>( aItem ) ); add( m_itemList, static_cast<VIA*>( aItem ) );
break; break;
case PCB_ZONE_T: 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 ) ) for( CN_ITEM* zitem : m_itemList.Add( zone, layer ) )
m_itemMap[zone].Link( zitem ); m_itemMap[zone].Link( zitem );
} }
break;
} }
break;
default: default:
return false; return false;
@ -299,9 +289,9 @@ void CN_CONNECTIVITY_ALGO::searchConnections()
const CN_CONNECTIVITY_ALGO::CLUSTERS CN_CONNECTIVITY_ALGO::SearchClusters( CLUSTER_SEARCH_MODE aMode ) 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, 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, 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 ) if( aMode == CSM_PROPAGATE )
return SearchClusters( aMode, no_zones, -1 ); return SearchClusters( aMode, no_zones, -1 );
@ -474,15 +464,11 @@ void CN_CONNECTIVITY_ALGO::Build( const std::vector<BOARD_ITEM*>& aItems )
Add( item ); Add( item );
break; break;
case PCB_MODULE_T: case PCB_FOOTPRINT_T:
{ for( PAD* pad : static_cast<MODULE*>( item )->Pads() )
for( auto pad : static_cast<MODULE*>( item )->Pads() )
{
Add( pad ); Add( pad );
}
break; break;
}
default: default:
break; break;

View File

@ -223,7 +223,7 @@ void CONNECTIVITY_DATA::BlockRatsnestItems( const std::vector<BOARD_ITEM*>& aIte
for( auto item : aItems ) for( auto item : aItems )
{ {
if( item->Type() == PCB_MODULE_T ) if( item->Type() == PCB_FOOTPRINT_T )
{ {
for( auto pad : static_cast<MODULE*>(item)->Pads() ) for( auto pad : static_cast<MODULE*>(item)->Pads() )
citems.push_back( pad ); citems.push_back( pad );
@ -654,7 +654,7 @@ RN_NET* CONNECTIVITY_DATA::GetRatsnestForNet( int aNet )
void CONNECTIVITY_DATA::MarkItemNetAsDirty( BOARD_ITEM *aItem ) void CONNECTIVITY_DATA::MarkItemNetAsDirty( BOARD_ITEM *aItem )
{ {
if (aItem->Type() == PCB_MODULE_T) if ( aItem->Type() == PCB_FOOTPRINT_T)
{ {
for ( auto pad : static_cast<MODULE*>( aItem )->Pads() ) for ( auto pad : static_cast<MODULE*>( aItem )->Pads() )
{ {
@ -683,7 +683,7 @@ const std::vector<CN_EDGE> CONNECTIVITY_DATA::GetRatsnestForItems( std::vector<B
for( auto item : aItems ) for( auto item : aItems )
{ {
if( item->Type() == PCB_MODULE_T ) if( item->Type() == PCB_FOOTPRINT_T )
{ {
auto component = static_cast<MODULE*>( item ); auto component = static_cast<MODULE*>( item );

View File

@ -409,7 +409,7 @@ std::string FormatProbeItem( BOARD_ITEM* aItem )
switch( aItem->Type() ) switch( aItem->Type() )
{ {
case PCB_MODULE_T: case PCB_FOOTPRINT_T:
footprint = (MODULE*) aItem; footprint = (MODULE*) aItem;
return StrPrintf( "$PART: \"%s\"", TO_UTF8( footprint->GetReference() ) ); return StrPrintf( "$PART: \"%s\"", TO_UTF8( footprint->GetReference() ) );

View File

@ -716,7 +716,7 @@ bool DIALOG_BOARD_REANNOTATE::BuildFootprintList( std::vector<RefDesInfo>& aBadR
for( EDA_ITEM* item : m_selection ) for( EDA_ITEM* item : m_selection )
{ {
//Get the timestamps of selected footprints //Get the timestamps of selected footprints
if( item->Type() == PCB_MODULE_T ) if( item->Type() == PCB_FOOTPRINT_T )
selected.push_back( item->m_Uuid ); selected.push_back( item->m_Uuid );
} }
} }

View File

@ -372,7 +372,7 @@ bool DIALOG_TRACK_VIA_PROPERTIES::TransferDataFromWindow()
for( EDA_ITEM* item : m_items ) 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<BOARD_CONNECTED_ITEM*>( item ), ourTypes, true ); auto connectedItems = connectivity->GetConnectedItems( static_cast<BOARD_CONNECTED_ITEM*>( item ), ourTypes, true );
for ( BOARD_CONNECTED_ITEM* citem : connectedItems ) for ( BOARD_CONNECTED_ITEM* citem : connectedItems )

View File

@ -101,7 +101,7 @@ bool DIALOG_UNUSED_PAD_LAYERS::TransferDataFromWindow()
via->SetKeepTopBottom( m_cbPreservePads->IsChecked() ); 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<MODULE*>( item ); MODULE* footprint = static_cast<MODULE*>( item );

View File

@ -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_TRACE_T: mask = DRC_DISALLOW_TRACKS; break;
case PCB_ARC_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_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_SHAPE_T: mask = DRC_DISALLOW_GRAPHICS; break;
case PCB_FP_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; case PCB_TEXT_T: mask = DRC_DISALLOW_TEXTS; break;

View File

@ -136,7 +136,7 @@ int DRC_TEST_PROVIDER::forEachGeometryItem( const std::vector<KICAD_T>& aTypes,
{ {
for( int i = 0; i < MAX_STRUCT_TYPE_ID; i++ ) 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 ); s_allBasicItems.push_back( (KICAD_T) i );
@ -298,7 +298,7 @@ int DRC_TEST_PROVIDER::forEachGeometryItem( const std::vector<KICAD_T>& aTypes,
} }
} }
if( typeMask[ PCB_MODULE_T ] ) if( typeMask[ PCB_FOOTPRINT_T ] )
{ {
if( !aFunc( footprint ) ) if( !aFunc( footprint ) )
return n; return n;

View File

@ -130,7 +130,7 @@ void PCB_EDIT_FRAME::OnEditItemRequest( BOARD_ITEM* aItem )
ShowPadPropertiesDialog( static_cast<PAD*>( aItem ) ); ShowPadPropertiesDialog( static_cast<PAD*>( aItem ) );
break; break;
case PCB_MODULE_T: case PCB_FOOTPRINT_T:
ShowFootprintPropertiesDialog( static_cast<MODULE*>( aItem ) ); ShowFootprintPropertiesDialog( static_cast<MODULE*>( aItem ) );
break; break;

View File

@ -40,8 +40,8 @@
MODULE::MODULE( BOARD* parent ) : MODULE::MODULE( BOARD* parent ) :
BOARD_ITEM_CONTAINER( (BOARD_ITEM*) parent, PCB_MODULE_T ), BOARD_ITEM_CONTAINER((BOARD_ITEM*) parent, PCB_FOOTPRINT_T ),
m_initial_comments( 0 ) m_initial_comments( 0 )
{ {
m_attributes = 0; m_attributes = 0;
m_Layer = F_Cu; m_Layer = F_Cu;
@ -972,7 +972,7 @@ SEARCH_RESULT MODULE::Visit( INSPECTOR inspector, void* testData, const KICAD_T
switch( stype ) switch( stype )
{ {
case PCB_MODULE_T: case PCB_FOOTPRINT_T:
result = inspector( this, testData ); // inspect me result = inspector( this, testData ); // inspect me
++p; ++p;
break; break;
@ -1543,7 +1543,7 @@ BOARD_ITEM* MODULE::DuplicateItem( const BOARD_ITEM* aItem, bool aAddToFootprint
new_item = static_cast<const PCB_GROUP*>( aItem )->DeepDuplicate(); new_item = static_cast<const PCB_GROUP*>( aItem )->DeepDuplicate();
break; break;
case PCB_MODULE_T: case PCB_FOOTPRINT_T:
// Ignore the footprint itself // Ignore the footprint itself
break; break;
@ -1743,7 +1743,7 @@ void MODULE::BuildPolyCourtyards()
void MODULE::SwapData( BOARD_ITEM* aImage ) void MODULE::SwapData( BOARD_ITEM* aImage )
{ {
assert( aImage->Type() == PCB_MODULE_T ); assert( aImage->Type() == PCB_FOOTPRINT_T );
std::swap( *((MODULE*) this), *((MODULE*) aImage) ); std::swap( *((MODULE*) this), *((MODULE*) aImage) );
} }

View File

@ -121,7 +121,7 @@ public:
static inline bool ClassOf( const EDA_ITEM* aItem ) 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() ///> @copydoc BOARD_ITEM_CONTAINER::Add()

View File

@ -167,7 +167,7 @@ void FOOTPRINT_EDIT_FRAME::OnEditItemRequest( BOARD_ITEM* aItem )
ShowPadPropertiesDialog( static_cast<PAD*>( aItem )); ShowPadPropertiesDialog( static_cast<PAD*>( aItem ));
break; break;
case PCB_MODULE_T: case PCB_FOOTPRINT_T:
editFootprintProperties( (MODULE*) aItem ); editFootprintProperties( (MODULE*) aItem );
GetCanvas()->Refresh(); GetCanvas()->Refresh();
break; break;

View File

@ -45,7 +45,7 @@ FP_TEXT::FP_TEXT( MODULE* aParentFootprint, TEXT_TYPE text_type ) :
SetLayer( F_SilkS ); SetLayer( F_SilkS );
// Set position and give a default layer if a valid parent footprint exists // 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() ); SetTextPos( parentFootprint->GetPosition() );

View File

@ -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 // Prepare net mapping that assures that net codes saved in a file are consecutive integers
m_mapping->SetBoard( m_board ); 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 // make the footprint safe to transfer to other pcbs
const MODULE* footprint = static_cast<MODULE*>( aSelected.Front() ); const MODULE* footprint = static_cast<MODULE*>( aSelected.Front() );

View File

@ -53,7 +53,7 @@ PAD::PAD( MODULE* parent ) :
m_orient = 0; // Pad rotation in 1/10 degrees. m_orient = 0; // Pad rotation in 1/10 degrees.
m_lengthPadToDie = 0; 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(); m_pos = GetParent()->GetPosition();
} }

View File

@ -189,7 +189,7 @@ void PCB_BASE_FRAME::FocusOnItem( BOARD_ITEM* aItem )
{ {
lastItem->ClearBrightened(); lastItem->ClearBrightened();
if( lastItem->Type() == PCB_MODULE_T ) if( lastItem->Type() == PCB_FOOTPRINT_T )
{ {
static_cast<MODULE*>( lastItem )->RunOnChildren( [&]( BOARD_ITEM* child ) static_cast<MODULE*>( lastItem )->RunOnChildren( [&]( BOARD_ITEM* child )
{ {
@ -213,7 +213,7 @@ void PCB_BASE_FRAME::FocusOnItem( BOARD_ITEM* aItem )
{ {
aItem->SetBrightened(); aItem->SetBrightened();
if( aItem->Type() == PCB_MODULE_T ) if( aItem->Type() == PCB_FOOTPRINT_T )
{ {
static_cast<MODULE*>( aItem )->RunOnChildren( [&]( BOARD_ITEM* child ) static_cast<MODULE*>( aItem )->RunOnChildren( [&]( BOARD_ITEM* child )
{ {

View File

@ -632,7 +632,7 @@ void PCB_EDIT_FRAME::setupUIConditions()
mgr->SetConditions( PCB_ACTIONS::selectConnection, mgr->SetConditions( PCB_ACTIONS::selectConnection,
ENABLE( SELECTION_CONDITIONS::OnlyTypes( GENERAL_COLLECTOR::Tracks ) ) ); ENABLE( SELECTION_CONDITIONS::OnlyTypes( GENERAL_COLLECTOR::Tracks ) ) );
mgr->SetConditions( PCB_ACTIONS::selectSameSheet, 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 ) && SELECTION_CONDITION singleZoneCond = SELECTION_CONDITIONS::Count( 1 ) &&

View File

@ -246,7 +246,7 @@ static void insideArea( LIBEVAL::CONTEXT* aCtx, void* self )
return false; return false;
} }
if( item->Type() == PCB_MODULE_T ) if( item->Type() == PCB_FOOTPRINT_T )
{ {
MODULE* footprint = static_cast<MODULE*>( item ); MODULE* footprint = static_cast<MODULE*>( item );
@ -395,7 +395,7 @@ static void memberOf( LIBEVAL::CONTEXT* aCtx, void* self )
PCB_GROUP* group = item->GetParentGroup(); 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(); group = item->GetParent()->GetParentGroup();
while( group ) while( group )

View File

@ -73,7 +73,7 @@ PCB_GROUP* PCB_GROUP::TopLevelGroup( BOARD_ITEM* item, PCB_GROUP* scope )
{ {
PCB_GROUP* candidate = item->GetParentGroup(); 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(); candidate = item->GetParent()->GetParentGroup();
while( candidate && candidate->GetParentGroup() && candidate->GetParentGroup() != scope ) 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 ) 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(); item = item->GetParent();
for( PCB_GROUP* parent = item->GetParentGroup(); parent; parent = parent->GetParentGroup() ) for( PCB_GROUP* parent = item->GetParentGroup(); parent; parent = parent->GetParentGroup() )

View File

@ -439,7 +439,7 @@ bool PCB_PAINTER::Draw( const VIEW_ITEM* aItem, int aLayer )
draw( static_cast<const FP_TEXT*>( item ), aLayer ); draw( static_cast<const FP_TEXT*>( item ), aLayer );
break; break;
case PCB_MODULE_T: case PCB_FOOTPRINT_T:
draw( static_cast<const MODULE*>( item ), aLayer ); draw( static_cast<const MODULE*>( item ), aLayer );
break; break;

View File

@ -456,7 +456,7 @@ void PCB_SHAPE::SetAngle( double aAngle, bool aUpdateEnd )
MODULE* PCB_SHAPE::GetParentFootprint() const 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 NULL;
return (MODULE*) m_Parent; return (MODULE*) m_Parent;

View File

@ -67,7 +67,7 @@ wxString PCB_TEXT::GetShownText( int aDepth ) const
wxString ref = token->BeforeFirst( ':', &remainder ); wxString ref = token->BeforeFirst( ':', &remainder );
BOARD_ITEM* refItem = board->GetItem( KIID( ref ) ); 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<MODULE*>( refItem ); MODULE* refModule = static_cast<MODULE*>( refItem );

View File

@ -60,13 +60,13 @@ void PCB_VIEW::Add( KIGFX::VIEW_ITEM* aItem, int aDrawPriority )
{ {
auto item = static_cast<BOARD_ITEM*>( aItem ); auto item = static_cast<BOARD_ITEM*>( aItem );
if( item->Type() == PCB_MODULE_T ) if( item->Type() == PCB_FOOTPRINT_T )
{ {
auto mod = static_cast<MODULE*>( item ); MODULE* footprint = static_cast<MODULE*>( item );
mod->RunOnChildren( [this] ( BOARD_ITEM* aModItem ) footprint->RunOnChildren( [this]( BOARD_ITEM* aChild )
{ {
VIEW::Add( aModItem ); VIEW::Add( aChild );
} ); } );
} }
VIEW::Add( item, aDrawPriority ); VIEW::Add( item, aDrawPriority );
@ -78,12 +78,13 @@ void PCB_VIEW::Remove( KIGFX::VIEW_ITEM* aItem )
auto item = static_cast<BOARD_ITEM*>( aItem ); auto item = static_cast<BOARD_ITEM*>( aItem );
if( item->Type() == PCB_MODULE_T ) if( item->Type() == PCB_FOOTPRINT_T )
{ {
auto mod = static_cast<MODULE*>( item ); MODULE* footprint = static_cast<MODULE*>( item );
mod->RunOnChildren([this] ( BOARD_ITEM* aModItem ) { footprint->RunOnChildren( [this]( BOARD_ITEM* aChild )
VIEW::Remove( aModItem ); {
} ); VIEW::Remove( aChild );
} );
} }
VIEW::Remove( item ); 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<const BOARD_ITEM*>( aItem ); const BOARD_ITEM* item = static_cast<const BOARD_ITEM*>( aItem );
if( item->Type() == PCB_MODULE_T ) if( item->Type() == PCB_FOOTPRINT_T )
{ {
const MODULE* mod = static_cast<const MODULE*>( item ); const MODULE* mod = static_cast<const MODULE*>( item );

View File

@ -411,7 +411,7 @@ void PCB_IO::Format( BOARD_ITEM* aItem, int aNestLevel ) const
format( static_cast<PCB_TARGET*>( aItem ), aNestLevel ); format( static_cast<PCB_TARGET*>( aItem ), aNestLevel );
break; break;
case PCB_MODULE_T: case PCB_FOOTPRINT_T:
format( static_cast<MODULE*>( aItem ), aNestLevel ); format( static_cast<MODULE*>( aItem ), aNestLevel );
break; break;

View File

@ -744,7 +744,7 @@ void PCB_PARSER::resolveGroups( BOARD_ITEM* aParent )
{ {
aItem = static_cast<BOARD*>( aParent )->GetItem( aId ); aItem = static_cast<BOARD*>( aParent )->GetItem( aId );
} }
else if( aParent->Type() == PCB_MODULE_T ) else if( aParent->Type() == PCB_FOOTPRINT_T )
{ {
static_cast<MODULE*>( aParent )->RunOnChildren( static_cast<MODULE*>( aParent )->RunOnChildren(
[&]( BOARD_ITEM* child ) [&]( BOARD_ITEM* child )
@ -770,7 +770,7 @@ void PCB_PARSER::resolveGroups( BOARD_ITEM* aParent )
group->SetName( aGrp.name ); group->SetName( aGrp.name );
const_cast<KIID&>( group->m_Uuid ) = aGrp.uuid; const_cast<KIID&>( group->m_Uuid ) = aGrp.uuid;
if( aGrp.parent->Type() == PCB_MODULE_T ) if( aGrp.parent->Type() == PCB_FOOTPRINT_T )
static_cast<MODULE*>( aGrp.parent )->Add( group ); static_cast<MODULE*>( aGrp.parent )->Add( group );
else else
static_cast<BOARD*>( aGrp.parent )->Add( group ); static_cast<BOARD*>( aGrp.parent )->Add( group );

View File

@ -1422,8 +1422,12 @@ bool ROUTER_TOOL::CanInlineDrag()
{ {
const BOARD_ITEM* item = static_cast<const BOARD_ITEM*>( selection.Front() ); const BOARD_ITEM* item = static_cast<const BOARD_ITEM*>( 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 true;
}
} }
return false; return false;
@ -1442,8 +1446,12 @@ int ROUTER_TOOL::InlineDrag( const TOOL_EVENT& aEvent )
const BOARD_ITEM* item = static_cast<const BOARD_ITEM*>( selection.Front() ); const BOARD_ITEM* item = static_cast<const BOARD_ITEM*>( 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; return 0;
}
Activate(); Activate();
@ -1455,7 +1463,7 @@ int ROUTER_TOOL::InlineDrag( const TOOL_EVENT& aEvent )
PNS::ITEM_SET itemsToDrag; PNS::ITEM_SET itemsToDrag;
const MODULE* module = nullptr; const MODULE* module = nullptr;
if( item->Type() == PCB_MODULE_T ) if( item->Type() == PCB_FOOTPRINT_T )
{ {
module = static_cast<const MODULE*>(item); module = static_cast<const MODULE*>(item);

View File

@ -892,7 +892,7 @@ void SPECCTRA_DB::FromBOARD( BOARD* aBoard )
{ {
PCB_TYPE_COLLECTOR items; 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. // Not all boards are exportable. Check that all reference Ids are unique.
// Unless they are unique, we cannot import the session file which comes // Unless they are unique, we cannot import the session file which comes

View File

@ -164,8 +164,8 @@ bool EDIT_TOOL::Init()
return m_isFootprintEditor; return m_isFootprintEditor;
}; };
auto singleFootprintCondition = SELECTION_CONDITIONS::OnlyType( PCB_MODULE_T ) auto singleFootprintCondition = SELECTION_CONDITIONS::OnlyType( PCB_FOOTPRINT_T )
&& SELECTION_CONDITIONS::Count( 1 ); && SELECTION_CONDITIONS::Count( 1 );
auto noActiveToolCondition = auto noActiveToolCondition =
[ this ] ( const SELECTION& aSelection ) [ this ] ( const SELECTION& aSelection )
@ -460,7 +460,7 @@ int EDIT_TOOL::doMoveSelection( TOOL_EVENT aEvent, bool aPickReference )
if( !item->GetParent() || !item->GetParent()->IsSelected() ) if( !item->GetParent() || !item->GetParent()->IsSelected() )
static_cast<BOARD_ITEM*>( item )->Move( movement ); static_cast<BOARD_ITEM*>( item )->Move( movement );
if( item->Type() == PCB_MODULE_T ) if( item->Type() == PCB_FOOTPRINT_T )
requestRedraw3Dview = true; requestRedraw3Dview = true;
} }
@ -1365,7 +1365,7 @@ int EDIT_TOOL::Remove( const TOOL_EVENT& aEvent )
auto removeItem = [&]( BOARD_ITEM* bItem ) 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() ); m_commit->Modify( bItem->GetParent() );
getView()->Remove( group ); getView()->Remove( group );
@ -1579,7 +1579,7 @@ int EDIT_TOOL::Duplicate( const TOOL_EVENT& aEvent )
static_cast<PAD*>( dupe_item )->SetName( padName ); static_cast<PAD*>( 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<MODULE*>( orig_item->GetParent() ); MODULE* parentFootprint = static_cast<MODULE*>( orig_item->GetParent() );
@ -1590,7 +1590,7 @@ int EDIT_TOOL::Duplicate( const TOOL_EVENT& aEvent )
{ {
switch( orig_item->Type() ) switch( orig_item->Type() )
{ {
case PCB_MODULE_T: case PCB_FOOTPRINT_T:
case PCB_TEXT_T: case PCB_TEXT_T:
case PCB_SHAPE_T: case PCB_SHAPE_T:
case PCB_TRACE_T: case PCB_TRACE_T:
@ -1706,7 +1706,7 @@ void EDIT_TOOL::FootprintFilter( const VECTOR2I&, GENERAL_COLLECTOR& aCollector,
{ {
BOARD_ITEM* item = static_cast<BOARD_ITEM*>( aCollector[i] ); BOARD_ITEM* item = static_cast<BOARD_ITEM*>( aCollector[i] );
if( item->Type() != PCB_MODULE_T ) if( item->Type() != PCB_FOOTPRINT_T )
aCollector.Remove( i ); aCollector.Remove( i );
} }
} }

View File

@ -513,26 +513,26 @@ void GRID_HELPER::computeAnchors( BOARD_ITEM* aItem, const VECTOR2I& aRefPos, bo
switch( aItem->Type() ) switch( aItem->Type() )
{ {
case PCB_MODULE_T: case PCB_FOOTPRINT_T:
{ {
MODULE* mod = static_cast<MODULE*>( aItem ); MODULE* footprint = static_cast<MODULE*>( 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 ) if( ( aFrom || m_magneticSettings->pads == MAGNETIC_OPTIONS::CAPTURE_ALWAYS )
&& pad->GetBoundingBox().Contains( wxPoint( aRefPos.x, aRefPos.y ) ) && pad->GetBoundingBox().Contains( wxPoint( aRefPos.x, aRefPos.y ) )
&& view->IsVisible( pad ) && view->IsVisible( pad )
&& ( !isHighContrast || activeLayers.count( pad->GetLayer() ) ) && ( !isHighContrast || activeLayers.count( pad->GetLayer() ) )
&& pad->ViewGetLOD( pad->GetLayer(), view ) < view->GetScale() ) && pad->ViewGetLOD( pad->GetLayer(), view ) < view->GetScale() )
{ {
handlePadShape( pad ); handlePadShape( pad );
break; break;
} }
} }
// if the cursor is not over a pad, then drag the module by its origin // if the cursor is not over a pad, then drag the footprint by its origin
addAnchor( mod->GetPosition(), ORIGIN | SNAPPABLE, mod ); addAnchor( footprint->GetPosition(), ORIGIN | SNAPPABLE, footprint );
break; break;
} }

View File

@ -620,9 +620,8 @@ int PCB_INSPECTION_TOOL::HighlightItem( const TOOL_EVENT& aEvent )
bool request3DviewRedraw = true; bool request3DviewRedraw = true;
if( item ) if( item && item->Type() != PCB_FOOTPRINT_T )
if( item->Type() != PCB_MODULE_T ) request3DviewRedraw = false;
request3DviewRedraw = false;
if( request3DviewRedraw ) if( request3DviewRedraw )
m_frame->Redraw3Dview(); m_frame->Redraw3Dview();
@ -972,7 +971,7 @@ void PCB_INSPECTION_TOOL::calculateSelectionRatsnest( const VECTOR2I& aDelta )
{ {
BOARD_ITEM* item = static_cast<BOARD_ITEM*>( queued_items[i] ); BOARD_ITEM* item = static_cast<BOARD_ITEM*>( queued_items[i] );
if( item->Type() == PCB_MODULE_T ) if( item->Type() == PCB_FOOTPRINT_T )
{ {
for( PAD* pad : static_cast<MODULE*>( item )->Pads() ) for( PAD* pad : static_cast<MODULE*>( item )->Pads() )
{ {
@ -1002,7 +1001,7 @@ void PCB_INSPECTION_TOOL::calculateSelectionRatsnest( const VECTOR2I& aDelta )
|| aItem->Type() == PCB_PAD_T || aItem->Type() == PCB_PAD_T
|| aItem->Type() == PCB_ARC_T || aItem->Type() == PCB_ARC_T
|| aItem->Type() == PCB_ZONE_T || aItem->Type() == PCB_ZONE_T
|| aItem->Type() == PCB_MODULE_T || aItem->Type() == PCB_FOOTPRINT_T
|| aItem->Type() == PCB_VIA_T ); || aItem->Type() == PCB_VIA_T );
} ) ) } ) )
{ {

View File

@ -69,12 +69,12 @@ void PCB_TOOL_BASE::doInteractiveItemPlacement( const std::string& aTool,
newItem->SetPosition( (wxPoint) aPosition ); newItem->SetPosition( (wxPoint) aPosition );
preview.Add( newItem.get() ); preview.Add( newItem.get() );
if( newItem->Type() == PCB_MODULE_T ) if( newItem->Type() == PCB_FOOTPRINT_T )
{ {
auto module = dyn_cast<MODULE*>( newItem.get() ); MODULE* fp = dyn_cast<MODULE*>( newItem.get() );
// footprints have more drawable parts // 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 ) );
} }
} }
}; };

View File

@ -716,7 +716,7 @@ int PCBNEW_CONTROL::Paste( const TOOL_EVENT& aEvent )
break; break;
} }
case PCB_MODULE_T: case PCB_FOOTPRINT_T:
{ {
MODULE* clipFootprint = static_cast<MODULE*>( clipItem ); MODULE* clipFootprint = static_cast<MODULE*>( clipItem );
std::vector<BOARD_ITEM*> pastedItems; std::vector<BOARD_ITEM*> pastedItems;
@ -885,7 +885,7 @@ int PCBNEW_CONTROL::placeBoardItems( std::vector<BOARD_ITEM*>& aItems, bool aIsN
break; break;
} }
case PCB_MODULE_T: case PCB_FOOTPRINT_T:
// Update the module path with the new KIID path if the module is new // Update the module path with the new KIID path if the module is new
if( aIsNew ) if( aIsNew )
static_cast<MODULE*>( item )->SetPath( KIID_PATH() ); static_cast<MODULE*>( item )->SetPath( KIID_PATH() );

View File

@ -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; EDA_ITEM* topLeftItem = nullptr;
@ -63,7 +63,7 @@ EDA_ITEM* PCBNEW_SELECTION::GetTopLeftItem( bool onlyModules ) const
{ {
pnt = item->GetPosition(); pnt = item->GetPosition();
if( ( item->Type() != PCB_MODULE_T ) && onlyModules ) if( ( item->Type() != PCB_FOOTPRINT_T ) && aFootprintsOnly )
{ {
continue; continue;
} }
@ -91,39 +91,51 @@ const KIGFX::VIEW_GROUP::ITEMS PCBNEW_SELECTION::updateDrawList() const
std::vector<VIEW_ITEM*> items; std::vector<VIEW_ITEM*> items;
std::function<void ( EDA_ITEM* )> addItem; std::function<void ( EDA_ITEM* )> addItem;
addItem = [&]( EDA_ITEM* item ) { addItem = [&]( EDA_ITEM* item )
items.push_back( item ); {
items.push_back( item );
if( item->Type() == PCB_MODULE_T ) if( item->Type() == PCB_FOOTPRINT_T )
{ {
MODULE* module = static_cast<MODULE*>( item ); MODULE* footprint = static_cast<MODULE*>( item );
module->RunOnChildren( [&] ( BOARD_ITEM* bitem ) { addItem( bitem ); } ); footprint->RunOnChildren( [&]( BOARD_ITEM* bitem )
} {
else if( item->Type() == PCB_GROUP_T ) addItem( bitem );
{ } );
PCB_GROUP* group = static_cast<PCB_GROUP*>( item ); }
group->RunOnChildren( [&] ( BOARD_ITEM* bitem ) { addItem( bitem ); } ); else if( item->Type() == PCB_GROUP_T )
} {
}; PCB_GROUP* group = static_cast<PCB_GROUP*>( item );
group->RunOnChildren( [&]( BOARD_ITEM* bitem )
{
addItem( bitem );
} );
}
};
for( auto item : m_items ) for( EDA_ITEM* item : m_items )
{
addItem( item ); addItem( item );
}
#if 0 #if 0
for( auto item : m_items ) for( auto item : m_items )
{ {
items.push_back( item ); items.push_back( item );
if( item->Type() == PCB_MODULE_T ) if( item->Type() == PCB_FOOTPRINT_T )
{ {
MODULE* module = static_cast<MODULE*>( item ); FOOTPRINT* footprint = static_cast<FOOTPRINT*>( item );
module->RunOnChildren( [&] ( BOARD_ITEM* bitem ) { items.push_back( bitem ); } ); footprint->RunOnChildren( [&]( BOARD_ITEM* bitem )
{
items.push_back( bitem );
} );
} }
else if( item->Type() == PCB_GROUP_T ) else if( item->Type() == PCB_GROUP_T )
{ {
PCB_GROUP* group = static_cast<PCB_GROUP*>( item ); PCB_GROUP* group = static_cast<PCB_GROUP*>( item );
group->RunOnChildren( [&] ( BOARD_ITEM* bitem ) { items.push_back( bitem ); } ); group->RunOnChildren( [&]( BOARD_ITEM* bitem )
{
items.push_back( bitem );
} );
} }
} }
#endif #endif
@ -135,9 +147,9 @@ const LSET PCBNEW_SELECTION::GetSelectionLayers()
{ {
LSET retval; LSET retval;
for( auto item : m_items ) for( EDA_ITEM* item : m_items )
{ {
if( auto board_item = dynamic_cast<BOARD_ITEM*>( item ) ) if( BOARD_ITEM* board_item = dynamic_cast<BOARD_ITEM*>( item ) )
retval |= board_item->GetLayerSet(); retval |= board_item->GetLayerSet();
} }

View File

@ -31,7 +31,7 @@
class PCBNEW_SELECTION : public SELECTION class PCBNEW_SELECTION : public SELECTION
{ {
public: 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; const KIGFX::VIEW_GROUP::ITEMS updateDrawList() const override;

View File

@ -96,7 +96,7 @@ ALIGNMENT_RECTS GetBoundingBoxes( const T &sel )
{ {
BOARD_ITEM* boardItem = static_cast<BOARD_ITEM*>( item ); BOARD_ITEM* boardItem = static_cast<BOARD_ITEM*>( item );
if( item->Type() == PCB_MODULE_T ) if( item->Type() == PCB_FOOTPRINT_T )
rects.emplace_back( std::make_pair( boardItem, static_cast<MODULE*>( item )->GetFootprintRect() ) ); rects.emplace_back( std::make_pair( boardItem, static_cast<MODULE*>( item )->GetFootprintRect() ) );
else else
rects.emplace_back( std::make_pair( boardItem, item->GetBoundingBox() ) ); rects.emplace_back( std::make_pair( boardItem, item->GetBoundingBox() ) );

View File

@ -2035,7 +2035,7 @@ int POINT_EDITOR::addCorner( const TOOL_EVENT& aEvent )
if( item->Type() == PCB_FP_SHAPE_T ) if( item->Type() == PCB_FP_SHAPE_T )
{ {
FP_SHAPE* edge = static_cast<FP_SHAPE*>( graphicItem ); FP_SHAPE* edge = static_cast<FP_SHAPE*>( graphicItem );
assert( edge->GetParent()->Type() == PCB_MODULE_T ); assert( edge->GetParent()->Type() == PCB_FOOTPRINT_T );
newSegment = new FP_SHAPE( *edge ); newSegment = new FP_SHAPE( *edge );
} }
else else

View File

@ -779,7 +779,7 @@ SELECTION_LOCK_FLAGS SELECTION_TOOL::CheckLock()
{ {
switch( item->Type() ) switch( item->Type() )
{ {
case PCB_MODULE_T: case PCB_FOOTPRINT_T:
if( static_cast<MODULE*>( item )->IsLocked() ) if( static_cast<MODULE*>( item )->IsLocked() )
containsLocked = true; containsLocked = true;
break; break;
@ -1317,7 +1317,7 @@ int SELECTION_TOOL::selectSameSheet( const TOOL_EVENT& aEvent )
if( !item ) if( !item )
return 0; return 0;
if( item->Type() != PCB_MODULE_T ) if( item->Type() != PCB_FOOTPRINT_T )
return 0; return 0;
auto mod = dynamic_cast<MODULE*>( item ); auto mod = dynamic_cast<MODULE*>( item );
@ -1400,59 +1400,50 @@ static bool itemIsIncludedByFilter( const BOARD_ITEM& aItem, const BOARD& aBoard
{ {
switch( aItem.Type() ) switch( aItem.Type() )
{ {
case PCB_MODULE_T: case PCB_FOOTPRINT_T:
{ {
const auto& module = static_cast<const MODULE&>( aItem ); const MODULE& footprint = static_cast<const MODULE&>( aItem );
include = aFilterOptions.includeModules; include = aFilterOptions.includeModules;
if( include && !aFilterOptions.includeLockedModules ) if( include && !aFilterOptions.includeLockedModules )
{ include = !footprint.IsLocked();
include = !module.IsLocked();
}
break; break;
} }
case PCB_TRACE_T: case PCB_TRACE_T:
case PCB_ARC_T: case PCB_ARC_T:
{
include = aFilterOptions.includeTracks; include = aFilterOptions.includeTracks;
break; break;
}
case PCB_VIA_T: case PCB_VIA_T:
{
include = aFilterOptions.includeVias; include = aFilterOptions.includeVias;
break; break;
}
case PCB_ZONE_T: case PCB_ZONE_T:
{
include = aFilterOptions.includeZones; include = aFilterOptions.includeZones;
break; break;
}
case PCB_SHAPE_T: case PCB_SHAPE_T:
case PCB_TARGET_T: case PCB_TARGET_T:
case PCB_DIM_ALIGNED_T: case PCB_DIM_ALIGNED_T:
case PCB_DIM_CENTER_T: case PCB_DIM_CENTER_T:
case PCB_DIM_ORTHOGONAL_T: case PCB_DIM_ORTHOGONAL_T:
case PCB_DIM_LEADER_T: case PCB_DIM_LEADER_T:
{
if( layer == Edge_Cuts ) if( layer == Edge_Cuts )
include = aFilterOptions.includeBoardOutlineLayer; include = aFilterOptions.includeBoardOutlineLayer;
else else
include = aFilterOptions.includeItemsOnTechLayers; include = aFilterOptions.includeItemsOnTechLayers;
break; break;
}
case PCB_TEXT_T: case PCB_TEXT_T:
{
include = aFilterOptions.includePcbTexts; include = aFilterOptions.includePcbTexts;
break; break;
}
default: default:
{
// no filtering, just select it // no filtering, just select it
break; break;
} }
}
} }
return include; return include;
@ -1518,19 +1509,17 @@ bool SELECTION_TOOL::itemPassesFilter( BOARD_ITEM* aItem )
switch( aItem->Type() ) switch( aItem->Type() )
{ {
case PCB_MODULE_T: case PCB_FOOTPRINT_T:
if( !m_filter.footprints ) if( !m_filter.footprints )
return false; return false;
break; break;
case PCB_PAD_T: case PCB_PAD_T:
{
if( !m_filter.pads ) if( !m_filter.pads )
return false; return false;
break; break;
}
case PCB_TRACE_T: case PCB_TRACE_T:
case PCB_ARC_T: case PCB_ARC_T:
@ -1554,9 +1543,9 @@ bool SELECTION_TOOL::itemPassesFilter( BOARD_ITEM* aItem )
{ {
return false; return false;
} }
break;
} }
break;
case PCB_SHAPE_T: case PCB_SHAPE_T:
case PCB_TARGET_T: case PCB_TARGET_T:
if( !m_filter.graphics ) if( !m_filter.graphics )
@ -1624,7 +1613,7 @@ void SELECTION_TOOL::RebuildSelection()
EDA_ITEM* parent = item->GetParent(); EDA_ITEM* parent = item->GetParent();
// Flags on module children might be set only because the parent is selected. // 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; return SEARCH_RESULT::CONTINUE;
highlight( (BOARD_ITEM*) item, SELECTED, &m_selection ); 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 ) for( int i = 0; i < count; ++i )
{ {
if( ( *aCollector )[i]->Type() != PCB_MODULE_T ) if(( *aCollector )[i]->Type() != PCB_FOOTPRINT_T )
return NULL; 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 // 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 // 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 ) if( zoneInFootprint && !m_isFootprintEditor && !checkVisibilityOnly )
return false; return false;
@ -1886,7 +1875,7 @@ bool SELECTION_TOOL::Selectable( const BOARD_ITEM* aItem, bool checkVisibilityOn
return ( board()->GetVisibleLayers() & via->GetLayerSet() ).any(); 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. // In modedit, we do not want to select the module itself.
if( m_isFootprintEditor ) 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 // 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 // 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<MODULE*>( aItem )->RunOnChildren( static_cast<MODULE*>( aItem )->RunOnChildren(
[&]( BOARD_ITEM* aChild ) [&]( 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 // 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 // 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<MODULE*>( aItem )->RunOnChildren( static_cast<MODULE*>( aItem )->RunOnChildren(
[&]( BOARD_ITEM* aChild ) [&]( BOARD_ITEM* aChild )
@ -2174,7 +2163,7 @@ bool SELECTION_TOOL::selectionContains( const VECTOR2I& aPoint ) const
static EDA_RECT getRect( const BOARD_ITEM* aItem ) static EDA_RECT getRect( const BOARD_ITEM* aItem )
{ {
if( aItem->Type() == PCB_MODULE_T ) if( aItem->Type() == PCB_FOOTPRINT_T )
return static_cast<const MODULE*>( aItem )->GetFootprintRect(); return static_cast<const MODULE*>( aItem )->GetFootprintRect();
return aItem->GetBoundingBox(); return aItem->GetBoundingBox();
@ -2359,7 +2348,7 @@ void SELECTION_TOOL::GuessSelectionCandidates( GENERAL_COLLECTOR& aCollector,
double itemCommonRatio = calcRatio( commonArea, itemArea ); double itemCommonRatio = calcRatio( commonArea, itemArea );
double txtCommonRatio = calcRatio( commonArea, textArea ); 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, // when text area is small compared to an overlapping footprint,
// then it's a clear sign the text is the selection target // 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_PAD_T:
case PCB_SHAPE_T: case PCB_SHAPE_T:
case PCB_VIA_T: case PCB_VIA_T:
case PCB_MODULE_T: case PCB_FOOTPRINT_T:
if( areaRatio > textToFeatureMinRatio && txtCommonRatio < commonAreaRatio ) if( areaRatio > textToFeatureMinRatio && txtCommonRatio < commonAreaRatio )
rejected.insert( txt ); rejected.insert( txt );
break; break;
@ -2445,16 +2434,16 @@ void SELECTION_TOOL::GuessSelectionCandidates( GENERAL_COLLECTOR& aCollector,
for( int i = 0; i < aCollector.GetCount(); ++i ) for( int i = 0; i < aCollector.GetCount(); ++i )
{ {
if( aCollector[i]->Type() != PCB_MODULE_T ) if( aCollector[i]->Type() != PCB_FOOTPRINT_T )
{ {
hasNonModules = true; hasNonModules = true;
break; 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(); BOX2D viewportD = getView()->GetViewport();
BOX2I viewport( VECTOR2I( viewportD.GetPosition() ), VECTOR2I( viewportD.GetSize() ) ); BOX2I viewport( VECTOR2I( viewportD.GetPosition() ), VECTOR2I( viewportD.GetSize() ) );
double maxCoverRatio = footprintMaxCoverRatio; double maxCoverRatio = footprintMaxCoverRatio;
@ -2504,7 +2493,7 @@ void SELECTION_TOOL::GuessSelectionCandidates( GENERAL_COLLECTOR& aCollector,
BOARD_ITEM* item = aCollector[j]; BOARD_ITEM* item = aCollector[j];
double areaRatio = calcRatio( viaArea, calcArea( item ) ); 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 ); rejected.insert( item );
if( item->Type() == PCB_PAD_T && areaRatio < viaToPadMinRatio ) 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 ) for( int j = 0; j < aCollector.GetCount(); ++j )
{ {
if( MODULE* mod = dyn_cast<MODULE*>( aCollector[j] ) ) if( MODULE* footprint = dyn_cast<MODULE*>( aCollector[j] ) )
{ {
double ratio = calcRatio( maxArea, mod->GetFootprintRect().GetArea() ); double ratio = calcRatio( maxArea, footprint->GetFootprintRect().GetArea() );
if( ratio < padToFootprintMinRatio && calcCommonArea( maxTrack, mod ) < commonAreaRatio ) if( ratio < padToFootprintMinRatio
rejected.insert( mod ); && 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 if( (unsigned) aCollector.GetCount() > rejected.size() ) // do not remove everything
{ {
for( BOARD_ITEM* item : rejected ) for( BOARD_ITEM* item : rejected )
{
aCollector.Transfer( item ); aCollector.Transfer( item );
}
} }
} }
@ -2622,9 +2612,7 @@ void SELECTION_TOOL::FilterCollectorForGroups( GENERAL_COLLECTOR& aCollector ) c
for( BOARD_ITEM* item : toAdd ) for( BOARD_ITEM* item : toAdd )
{ {
if( !aCollector.HasItem( item ) ) if( !aCollector.HasItem( item ) )
{
aCollector.Append( item ); aCollector.Append( item );
}
} }
} }

View File

@ -102,7 +102,7 @@ std::unique_ptr<ZONE> 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 // The new zone is a ZONE if created in the board editor and a FP_ZONE if created in the
// footprint editor // 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<ZONE> newZone = m_tool.m_isFootprintEditor ? std::unique_ptr<ZONE> newZone = m_tool.m_isFootprintEditor ?
std::make_unique<FP_ZONE>( parent ) : std::make_unique<FP_ZONE>( parent ) :

View File

@ -202,7 +202,7 @@ void PCB_BASE_EDIT_FRAME::SaveCopyInUndoList( const PICKED_ITEMS_LIST& aItemsLis
BOARD_ITEM* item = dynamic_cast<BOARD_ITEM*>( aItemsList.GetPickedItem( ii ) ); BOARD_ITEM* item = dynamic_cast<BOARD_ITEM*>( aItemsList.GetPickedItem( ii ) );
// For items belonging to footprints, we need to save state of the parent footprint // 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(); 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 // see if we must rebuild ratsnets and pointers lists
switch( eda_item->Type() ) switch( eda_item->Type() )
{ {
case PCB_MODULE_T: case PCB_FOOTPRINT_T:
case PCB_GROUP_T: case PCB_GROUP_T:
deep_reBuild_ratsnest = true; // Pointers on pads can be invalid deep_reBuild_ratsnest = true; // Pointers on pads can be invalid
KI_FALLTHROUGH; KI_FALLTHROUGH;