Report footprint parent of shape when in board editor.

While the user can't select these, we do report them
in DRC messages and the like, where it's handy to
know what they're from.
This commit is contained in:
Jeff Young 2024-06-14 23:15:43 +01:00
parent 8cddd40fc9
commit db9f0a0358
2 changed files with 106 additions and 33 deletions

View File

@ -1433,46 +1433,90 @@ wxString PAD::ShowPadAttr() const
wxString PAD::GetItemDescription( UNITS_PROVIDER* aUnitsProvider ) const
{
if( GetNumber().IsEmpty() )
FOOTPRINT* parentFP = nullptr;
if( EDA_DRAW_FRAME* frame = dynamic_cast<EDA_DRAW_FRAME*>( aUnitsProvider ) )
{
if( GetAttribute() == PAD_ATTRIB::SMD || GetAttribute() == PAD_ATTRIB::CONN )
if( frame->GetName() == PCB_EDIT_FRAME_NAME )
parentFP = GetParentFootprint();
}
if( GetAttribute() == PAD_ATTRIB::NPTH )
{
if( parentFP )
{
return wxString::Format( _( "Pad %s of %s on %s" ),
GetNetnameMsg(),
GetParentFootprint()->GetReference(),
layerMaskDescribe() );
}
else if( GetAttribute() == PAD_ATTRIB::NPTH )
{
return wxString::Format( _( "NPTH pad of %s" ), GetParentFootprint()->GetReference() );
return wxString::Format( _( "NPTH pad of %s" ),
parentFP->GetReference() );
}
else
{
return wxString::Format( _( "PTH pad %s of %s" ),
GetNetnameMsg(),
GetParentFootprint()->GetReference() );
return _( "NPTH pad" );
}
}
else if( GetNumber().IsEmpty() )
{
if( GetAttribute() == PAD_ATTRIB::SMD || GetAttribute() == PAD_ATTRIB::CONN )
{
if( parentFP )
{
return wxString::Format( _( "Pad %s of %s on %s" ),
GetNetnameMsg(),
parentFP->GetReference(),
layerMaskDescribe() );
}
else
{
return wxString::Format( _( "Pad on %s" ),
layerMaskDescribe() );
}
}
else
{
if( parentFP )
{
return wxString::Format( _( "PTH pad %s of %s" ),
GetNetnameMsg(),
parentFP->GetReference() );
}
else
{
return _( "PTH pad" );
}
}
}
else
{
if( GetAttribute() == PAD_ATTRIB::SMD || GetAttribute() == PAD_ATTRIB::CONN )
{
return wxString::Format( _( "Pad %s %s of %s on %s" ),
GetNumber(),
GetNetnameMsg(),
GetParentFootprint()->GetReference(),
layerMaskDescribe() );
}
else if( GetAttribute() == PAD_ATTRIB::NPTH )
{
return wxString::Format( _( "NPTH of %s" ), GetParentFootprint()->GetReference() );
if( parentFP )
{
return wxString::Format( _( "Pad %s %s of %s on %s" ),
GetNumber(),
GetNetnameMsg(),
parentFP->GetReference(),
layerMaskDescribe() );
}
else
{
return wxString::Format( _( "Pad %s on %s" ),
GetNumber(),
layerMaskDescribe() );
}
}
else
{
return wxString::Format( _( "PTH pad %s %s of %s" ),
GetNumber(),
GetNetnameMsg(),
GetParentFootprint()->GetReference() );
if( parentFP )
{
return wxString::Format( _( "PTH pad %s %s of %s" ),
GetNumber(),
GetNetnameMsg(),
parentFP->GetReference() );
}
else
{
return wxString::Format( _( "PTH pad %s" ),
GetNumber() );
}
}
}
}

View File

@ -699,18 +699,47 @@ void PCB_SHAPE::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_I
wxString PCB_SHAPE::GetItemDescription( UNITS_PROVIDER* aUnitsProvider ) const
{
FOOTPRINT* parentFP = nullptr;
if( EDA_DRAW_FRAME* frame = dynamic_cast<EDA_DRAW_FRAME*>( aUnitsProvider ) )
{
if( frame->GetName() == PCB_EDIT_FRAME_NAME )
parentFP = GetParentFootprint();
}
if( IsOnCopperLayer() )
{
return wxString::Format( _( "%s %s on %s" ),
GetFriendlyName(),
GetNetnameMsg(),
GetLayerName() );
if( parentFP )
{
return wxString::Format( _( "%s %s of %s on %s" ),
GetFriendlyName(),
GetNetnameMsg(),
parentFP->GetReference(),
GetLayerName() );
}
else
{
return wxString::Format( _( "%s %s on %s" ),
GetFriendlyName(),
GetNetnameMsg(),
GetLayerName() );
}
}
else
{
return wxString::Format( _( "%s on %s" ),
GetFriendlyName(),
GetLayerName() );
if( parentFP )
{
return wxString::Format( _( "%s of %s on %s" ),
GetFriendlyName(),
parentFP->GetReference(),
GetLayerName() );
}
else
{
return wxString::Format( _( "%s on %s" ),
GetFriendlyName(),
GetLayerName() );
}
}
}