diff --git a/eeschema/dialogs/dialog_erc.cpp b/eeschema/dialogs/dialog_erc.cpp index c8c0f0a532..f31a38daf0 100644 --- a/eeschema/dialogs/dialog_erc.cpp +++ b/eeschema/dialogs/dialog_erc.cpp @@ -696,13 +696,13 @@ void DIALOG_ERC::OnERCItemRClick( wxDataViewEvent& aEvent ) { menu.Append( 4, wxString::Format( _( "Change severity to Error for all '%s' violations" ), 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 { menu.Append( 5, wxString::Format( _( "Change severity to Warning for all '%s' violations" ), 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() ), diff --git a/pcbnew/dialogs/dialog_drc.cpp b/pcbnew/dialogs/dialog_drc.cpp index 050ea5adfb..f4b5b0d7cc 100644 --- a/pcbnew/dialogs/dialog_drc.cpp +++ b/pcbnew/dialogs/dialog_drc.cpp @@ -596,7 +596,7 @@ void DIALOG_DRC::OnDRCItemRClick( wxDataViewEvent& aEvent ) || rcItem->GetErrorCode() == DRCE_HOLE_CLEARANCE || 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 || 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_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(); diff --git a/pcbnew/tools/board_inspection_tool.cpp b/pcbnew/tools/board_inspection_tool.cpp index eaf011af48..d0fe03d6e4 100644 --- a/pcbnew/tools/board_inspection_tool.cpp +++ b/pcbnew/tools/board_inspection_tool.cpp @@ -246,6 +246,14 @@ void BOARD_INSPECTION_TOOL::InspectDRCError( const std::shared_ptr& aDR wxCHECK( m_frame, /* void */ ); + if( aDRCItem->GetErrorCode() == DRCE_LIB_FOOTPRINT_MISMATCH ) + { + if( FOOTPRINT* footprint = dynamic_cast( a ) ) + DiffFootprint( footprint ); + + return; + } + DIALOG_BOOK_REPORTER* dialog = m_frame->GetInspectDrcErrorDialog(); wxCHECK( dialog, /* void */ ); @@ -1343,21 +1351,24 @@ int BOARD_INSPECTION_TOOL::DiffFootprint( const TOOL_EVENT& aEvent ) }, false /* ignore locked flag */ ); - if( selection.Size() != 1 ) - { - m_frame->ShowInfoBarError( _( "Select a footprint to diff against its library " - "equivalent." ) ); - return 0; - } + if( selection.Size() == 1 ) + DiffFootprint( static_cast( selection.GetItem( 0 ) ) ); + else + m_frame->ShowInfoBarError( _( "Select a footprint to diff with its library equivalent." ) ); + return 0; +} + + +void BOARD_INSPECTION_TOOL::DiffFootprint( FOOTPRINT* aFootprint ) +{ DIALOG_BOOK_REPORTER* dialog = m_frame->GetFootprintDiffDialog(); - wxCHECK( dialog, 0 ); + wxCHECK( dialog, /* void */ ); dialog->DeleteAllPages(); - FOOTPRINT* footprint = static_cast( selection.GetItem( 0 ) ); - LIB_ID fpID = footprint->GetFPID(); + LIB_ID fpID = aFootprint->GetFPID(); wxString libName = fpID.GetLibNickname(); wxString fpName = fpID.GetLibItemName(); WX_HTML_REPORT_BOX* r = nullptr; @@ -1365,13 +1376,13 @@ int BOARD_INSPECTION_TOOL::DiffFootprint( const TOOL_EVENT& aEvent ) r = dialog->AddHTMLPage( _( "Summary" ) ); r->Report( wxS( "" ) + _( "Board vs library diff for:" ) + wxS( "" ) ); - r->Report( wxS( "
  • " ) + EscapeHTML( getItemDescription( footprint ) ) + wxS( "
  • " ) + r->Report( wxS( "
    • " ) + EscapeHTML( getItemDescription( aFootprint ) ) + wxS( "
    • " ) + wxS( "
    • " ) + _( "Library: " ) + EscapeHTML( libName ) + wxS( "
    • " ) + wxS( "
    • " ) + _( "Library item: " ) + EscapeHTML( fpName ) + wxS( "
    " ) ); r->Report( "" ); - PROJECT* project = footprint->GetBoard()->GetProject(); + PROJECT* project = aFootprint->GetBoard()->GetProject(); FP_LIB_TABLE* libTable = project->PcbFootprintLibs(); const LIB_TABLE_ROW* libTableRow = nullptr; @@ -1418,13 +1429,13 @@ int BOARD_INSPECTION_TOOL::DiffFootprint( const TOOL_EVENT& aEvent ) } else { - if( !footprint->FootprintNeedsUpdate( libFootprint.get(), r ) ) + if( !aFootprint->FootprintNeedsUpdate( libFootprint.get(), r ) ) r->Report( _( "No relevant differences detected." ) ); wxPanel* panel = dialog->AddBlankPage( _( "Visual" ) ); 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->Show( true ); - return 0; } diff --git a/pcbnew/tools/board_inspection_tool.h b/pcbnew/tools/board_inspection_tool.h index 67ffbbf4f2..c04bf4d2c7 100644 --- a/pcbnew/tools/board_inspection_tool.h +++ b/pcbnew/tools/board_inspection_tool.h @@ -90,6 +90,7 @@ public: int InspectConstraints( 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