Add quick DRC action for Diff Footprints.

Also makes the strings match the GUI better so people will know where
to find them later.

And fixes a couple of ERC items that referred to Board Setup (oops).
This commit is contained in:
Jeff Young 2023-03-13 23:35:07 +00:00
parent 283770fc45
commit 37b0a5a504
4 changed files with 33 additions and 18 deletions

View File

@ -696,13 +696,13 @@ void DIALOG_ERC::OnERCItemRClick( wxDataViewEvent& aEvent )
{ {
menu.Append( 4, wxString::Format( _( "Change severity to Error for all '%s' violations" ), menu.Append( 4, wxString::Format( _( "Change severity to Error for all '%s' violations" ),
rcItem->GetErrorText() ), rcItem->GetErrorText() ),
_( "Violation severities can also be edited in the Board Setup... dialog" ) ); _( "Violation severities can also be edited in the Schematic Setup... dialog" ) );
} }
else else
{ {
menu.Append( 5, wxString::Format( _( "Change severity to Warning for all '%s' violations" ), menu.Append( 5, wxString::Format( _( "Change severity to Warning for all '%s' violations" ),
rcItem->GetErrorText() ), rcItem->GetErrorText() ),
_( "Violation severities can also be edited in the Board Setup... dialog" ) ); _( "Violation severities can also be edited in the Schematic Setup... dialog" ) );
} }
menu.Append( 6, wxString::Format( _( "Ignore all '%s' violations" ), rcItem->GetErrorText() ), menu.Append( 6, wxString::Format( _( "Ignore all '%s' violations" ), rcItem->GetErrorText() ),

View File

@ -596,7 +596,7 @@ void DIALOG_DRC::OnDRCItemRClick( wxDataViewEvent& aEvent )
|| rcItem->GetErrorCode() == DRCE_HOLE_CLEARANCE || rcItem->GetErrorCode() == DRCE_HOLE_CLEARANCE
|| rcItem->GetErrorCode() == DRCE_DRILLED_HOLES_TOO_CLOSE ) || rcItem->GetErrorCode() == DRCE_DRILLED_HOLES_TOO_CLOSE )
{ {
menu.Append( 3, _( "Run clearance resolution tool..." ) ); menu.Append( 3, _( "Run Inspect > Clearance Resolution" ) );
} }
else if( rcItem->GetErrorCode() == DRCE_TEXT_HEIGHT else if( rcItem->GetErrorCode() == DRCE_TEXT_HEIGHT
|| rcItem->GetErrorCode() == DRCE_TEXT_THICKNESS || rcItem->GetErrorCode() == DRCE_TEXT_THICKNESS
@ -608,7 +608,11 @@ void DIALOG_DRC::OnDRCItemRClick( wxDataViewEvent& aEvent )
|| rcItem->GetErrorCode() == DRCE_MICROVIA_DRILL_OUT_OF_RANGE || rcItem->GetErrorCode() == DRCE_MICROVIA_DRILL_OUT_OF_RANGE
|| rcItem->GetErrorCode() == DRCE_CONNECTION_WIDTH ) || rcItem->GetErrorCode() == DRCE_CONNECTION_WIDTH )
{ {
menu.Append( 3, _( "Run constraints resolution tool..." ) ); menu.Append( 3, _( "Run Inspect > Constraints Resolution" ) );
}
else if( rcItem->GetErrorCode() == DRCE_LIB_FOOTPRINT_MISMATCH )
{
menu.Append( 3, _( "Run Inspect > Diff Footprint with Library" ) );
} }
menu.AppendSeparator(); menu.AppendSeparator();

View File

@ -246,6 +246,14 @@ void BOARD_INSPECTION_TOOL::InspectDRCError( const std::shared_ptr<RC_ITEM>& aDR
wxCHECK( m_frame, /* void */ ); wxCHECK( m_frame, /* void */ );
if( aDRCItem->GetErrorCode() == DRCE_LIB_FOOTPRINT_MISMATCH )
{
if( FOOTPRINT* footprint = dynamic_cast<FOOTPRINT*>( a ) )
DiffFootprint( footprint );
return;
}
DIALOG_BOOK_REPORTER* dialog = m_frame->GetInspectDrcErrorDialog(); DIALOG_BOOK_REPORTER* dialog = m_frame->GetInspectDrcErrorDialog();
wxCHECK( dialog, /* void */ ); wxCHECK( dialog, /* void */ );
@ -1343,21 +1351,24 @@ int BOARD_INSPECTION_TOOL::DiffFootprint( const TOOL_EVENT& aEvent )
}, },
false /* ignore locked flag */ ); false /* ignore locked flag */ );
if( selection.Size() != 1 ) if( selection.Size() == 1 )
{ DiffFootprint( static_cast<FOOTPRINT*>( selection.GetItem( 0 ) ) );
m_frame->ShowInfoBarError( _( "Select a footprint to diff against its library " else
"equivalent." ) ); m_frame->ShowInfoBarError( _( "Select a footprint to diff with its library equivalent." ) );
return 0;
}
return 0;
}
void BOARD_INSPECTION_TOOL::DiffFootprint( FOOTPRINT* aFootprint )
{
DIALOG_BOOK_REPORTER* dialog = m_frame->GetFootprintDiffDialog(); DIALOG_BOOK_REPORTER* dialog = m_frame->GetFootprintDiffDialog();
wxCHECK( dialog, 0 ); wxCHECK( dialog, /* void */ );
dialog->DeleteAllPages(); dialog->DeleteAllPages();
FOOTPRINT* footprint = static_cast<FOOTPRINT*>( selection.GetItem( 0 ) ); LIB_ID fpID = aFootprint->GetFPID();
LIB_ID fpID = footprint->GetFPID();
wxString libName = fpID.GetLibNickname(); wxString libName = fpID.GetLibNickname();
wxString fpName = fpID.GetLibItemName(); wxString fpName = fpID.GetLibItemName();
WX_HTML_REPORT_BOX* r = nullptr; WX_HTML_REPORT_BOX* r = nullptr;
@ -1365,13 +1376,13 @@ int BOARD_INSPECTION_TOOL::DiffFootprint( const TOOL_EVENT& aEvent )
r = dialog->AddHTMLPage( _( "Summary" ) ); r = dialog->AddHTMLPage( _( "Summary" ) );
r->Report( wxS( "<h7>" ) + _( "Board vs library diff for:" ) + wxS( "</h7>" ) ); r->Report( wxS( "<h7>" ) + _( "Board vs library diff for:" ) + wxS( "</h7>" ) );
r->Report( wxS( "<ul><li>" ) + EscapeHTML( getItemDescription( footprint ) ) + wxS( "</li>" ) r->Report( wxS( "<ul><li>" ) + EscapeHTML( getItemDescription( aFootprint ) ) + wxS( "</li>" )
+ wxS( "<li>" ) + _( "Library: " ) + EscapeHTML( libName ) + wxS( "</li>" ) + wxS( "<li>" ) + _( "Library: " ) + EscapeHTML( libName ) + wxS( "</li>" )
+ wxS( "<li>" ) + _( "Library item: " ) + EscapeHTML( fpName ) + wxS( "</li></ul>" ) ); + wxS( "<li>" ) + _( "Library item: " ) + EscapeHTML( fpName ) + wxS( "</li></ul>" ) );
r->Report( "" ); r->Report( "" );
PROJECT* project = footprint->GetBoard()->GetProject(); PROJECT* project = aFootprint->GetBoard()->GetProject();
FP_LIB_TABLE* libTable = project->PcbFootprintLibs(); FP_LIB_TABLE* libTable = project->PcbFootprintLibs();
const LIB_TABLE_ROW* libTableRow = nullptr; const LIB_TABLE_ROW* libTableRow = nullptr;
@ -1418,13 +1429,13 @@ int BOARD_INSPECTION_TOOL::DiffFootprint( const TOOL_EVENT& aEvent )
} }
else else
{ {
if( !footprint->FootprintNeedsUpdate( libFootprint.get(), r ) ) if( !aFootprint->FootprintNeedsUpdate( libFootprint.get(), r ) )
r->Report( _( "No relevant differences detected." ) ); r->Report( _( "No relevant differences detected." ) );
wxPanel* panel = dialog->AddBlankPage( _( "Visual" ) ); wxPanel* panel = dialog->AddBlankPage( _( "Visual" ) );
FOOTPRINT_DIFF_WIDGET* diff = constructDiffPanel( panel ); FOOTPRINT_DIFF_WIDGET* diff = constructDiffPanel( panel );
diff->DisplayDiff( footprint, libFootprint ); diff->DisplayDiff( aFootprint, libFootprint );
} }
} }
@ -1432,7 +1443,6 @@ int BOARD_INSPECTION_TOOL::DiffFootprint( const TOOL_EVENT& aEvent )
dialog->Raise(); dialog->Raise();
dialog->Show( true ); dialog->Show( true );
return 0;
} }

View File

@ -90,6 +90,7 @@ public:
int InspectConstraints( const TOOL_EVENT& aEvent ); int InspectConstraints( const TOOL_EVENT& aEvent );
int DiffFootprint( const TOOL_EVENT& aEvent ); int DiffFootprint( const TOOL_EVENT& aEvent );
void DiffFootprint( FOOTPRINT* aFootprint );
/** /**
* @return true if a net or nets to highlight have been set * @return true if a net or nets to highlight have been set