ADDED: ability to remove ignored tests from ERC/DRC list.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/17681
This commit is contained in:
Jeff Young 2024-05-13 17:09:30 +01:00
parent b934914c59
commit 255a7d6f06
10 changed files with 3885 additions and 3721 deletions

View File

@ -64,9 +64,10 @@ wxDEFINE_EVENT( EDA_EVT_CLOSE_ERC_DIALOG, wxCommandEvent );
static int DEFAULT_SINGLE_COL_WIDTH = 660;
static SCHEMATIC* g_lastERCSchematic = nullptr;
static bool g_lastERCRun = false;
static std::vector<wxString> g_lastERCIgnored;
static SCHEMATIC* g_lastERCSchematic = nullptr;
static bool g_lastERCRun = false;
static std::vector<std::pair<wxString, int>> g_lastERCIgnored;
DIALOG_ERC::DIALOG_ERC( SCH_EDIT_FRAME* parent ) :
@ -101,8 +102,15 @@ DIALOG_ERC::DIALOG_ERC( SCH_EDIT_FRAME* parent ) :
{
m_ercRun = g_lastERCRun;
for( const wxString& str : g_lastERCIgnored )
m_ignoredList->InsertItem( m_ignoredList->GetItemCount(), str );
for( const auto& [ str, code ] : g_lastERCIgnored )
{
wxListItem listItem;
listItem.SetId( m_ignoredList->GetItemCount() );
listItem.SetText( str );
listItem.SetData( code );
m_ignoredList->InsertItem( listItem );
}
}
m_notebook->SetSelection( 0 );
@ -139,7 +147,10 @@ DIALOG_ERC::~DIALOG_ERC()
g_lastERCIgnored.clear();
for( int ii = 0; ii < m_ignoredList->GetItemCount(); ++ii )
g_lastERCIgnored.push_back( m_ignoredList->GetItemText( ii ) );
{
g_lastERCIgnored.push_back( { m_ignoredList->GetItemText( ii ),
m_ignoredList->GetItemData( ii ) } );
}
EESCHEMA_SETTINGS* settings = dynamic_cast<EESCHEMA_SETTINGS*>( Kiface().KifaceSettings() );
wxASSERT( settings );
@ -394,8 +405,12 @@ void DIALOG_ERC::OnRunERCClick( wxCommandEvent& event )
{
if( sch->ErcSettings().GetSeverity( item.get().GetErrorCode() ) == RPT_SEVERITY_IGNORE )
{
m_ignoredList->InsertItem( m_ignoredList->GetItemCount(),
wxT( "" ) + item.get().GetErrorText() );
wxListItem listItem;
listItem.SetId( m_ignoredList->GetItemCount() );
listItem.SetText( wxT( "" ) + item.get().GetErrorText() );
listItem.SetData( item.get().GetErrorCode() );
m_ignoredList->InsertItem( listItem );
}
}
@ -795,6 +810,13 @@ void DIALOG_ERC::OnERCItemRClick( wxDataViewEvent& aEvent )
if( rcItem->GetErrorCode() == ERCE_PIN_TO_PIN_ERROR )
settings.SetSeverity( ERCE_PIN_TO_PIN_WARNING, RPT_SEVERITY_IGNORE );
wxListItem listItem;
listItem.SetId( m_ignoredList->GetItemCount() );
listItem.SetText( wxT( "" ) + rcItem->GetErrorText() );
listItem.SetData( rcItem->GetErrorCode() );
m_ignoredList->InsertItem( listItem );
// Clear the selection before deleting markers. It may be some selected ERC markers.
// Deleting a selected marker without deselecting it first generates a crash
m_parent->GetToolManager()->RunAction( EE_ACTIONS::clearSelection );
@ -830,6 +852,34 @@ void DIALOG_ERC::OnERCItemRClick( wxDataViewEvent& aEvent )
}
void DIALOG_ERC::OnIgnoredItemRClick( wxListEvent& event )
{
ERC_SETTINGS& settings = m_parent->Schematic().ErcSettings();
int errorCode = (int) event.m_item.GetData();
wxMenu menu;
menu.Append( RPT_SEVERITY_ERROR, _( "Error" ), wxEmptyString, wxITEM_CHECK );
menu.Append( RPT_SEVERITY_WARNING, _( "Warning" ), wxEmptyString, wxITEM_CHECK );
menu.Append( RPT_SEVERITY_IGNORE, _( "Ignore" ), wxEmptyString, wxITEM_CHECK );
menu.Check( settings.GetSeverity( errorCode ), true );
int severity = GetPopupMenuSelectionFromUser( menu );
if( severity > 0 )
{
if( settings.GetSeverity( errorCode ) != severity )
{
settings.SetSeverity( errorCode, (SEVERITY) severity );
updateDisplayedCounts();
redrawDrawPanel();
m_parent->OnModify();
}
}
}
void DIALOG_ERC::PrevMarker()
{
if( m_notebook->IsShown() )

View File

@ -77,6 +77,7 @@ private:
void OnERCItemSelected( wxDataViewEvent& aEvent ) override;
void OnERCItemDClick( wxDataViewEvent& aEvent ) override;
void OnERCItemRClick( wxDataViewEvent& aEvent ) override;
void OnIgnoredItemRClick( wxListEvent& aEvent ) override;
void OnEditViolationSeverities( wxHyperlinkEvent& aEvent ) override;
void OnLinkClicked( wxHtmlLinkEvent& event ) override;

View File

@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version 3.10.1-0-g8feb16b)
// C++ code generated with wxFormBuilder (version 4.0.0-0-g0efcecf)
// http://www.wxformbuilder.org/
//
// PLEASE DO *NOT* EDIT THIS FILE!
@ -200,6 +200,7 @@ DIALOG_ERC_BASE::DIALOG_ERC_BASE( wxWindow* parent, wxWindowID id, const wxStrin
m_markerDataView->Connect( wxEVT_COMMAND_DATAVIEW_ITEM_ACTIVATED, wxDataViewEventHandler( DIALOG_ERC_BASE::OnERCItemDClick ), NULL, this );
m_markerDataView->Connect( wxEVT_COMMAND_DATAVIEW_ITEM_CONTEXT_MENU, wxDataViewEventHandler( DIALOG_ERC_BASE::OnERCItemRClick ), NULL, this );
m_markerDataView->Connect( wxEVT_COMMAND_DATAVIEW_SELECTION_CHANGED, wxDataViewEventHandler( DIALOG_ERC_BASE::OnERCItemSelected ), NULL, this );
m_ignoredList->Connect( wxEVT_COMMAND_LIST_ITEM_RIGHT_CLICK, wxListEventHandler( DIALOG_ERC_BASE::OnIgnoredItemRClick ), NULL, this );
m_violationSeveritiesLink->Connect( wxEVT_COMMAND_HYPERLINK, wxHyperlinkEventHandler( DIALOG_ERC_BASE::OnEditViolationSeverities ), NULL, this );
m_showAll->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_ERC_BASE::OnSeverity ), NULL, this );
m_showErrors->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_ERC_BASE::OnSeverity ), NULL, this );
@ -220,6 +221,7 @@ DIALOG_ERC_BASE::~DIALOG_ERC_BASE()
m_markerDataView->Disconnect( wxEVT_COMMAND_DATAVIEW_ITEM_ACTIVATED, wxDataViewEventHandler( DIALOG_ERC_BASE::OnERCItemDClick ), NULL, this );
m_markerDataView->Disconnect( wxEVT_COMMAND_DATAVIEW_ITEM_CONTEXT_MENU, wxDataViewEventHandler( DIALOG_ERC_BASE::OnERCItemRClick ), NULL, this );
m_markerDataView->Disconnect( wxEVT_COMMAND_DATAVIEW_SELECTION_CHANGED, wxDataViewEventHandler( DIALOG_ERC_BASE::OnERCItemSelected ), NULL, this );
m_ignoredList->Disconnect( wxEVT_COMMAND_LIST_ITEM_RIGHT_CLICK, wxListEventHandler( DIALOG_ERC_BASE::OnIgnoredItemRClick ), NULL, this );
m_violationSeveritiesLink->Disconnect( wxEVT_COMMAND_HYPERLINK, wxHyperlinkEventHandler( DIALOG_ERC_BASE::OnEditViolationSeverities ), NULL, this );
m_showAll->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_ERC_BASE::OnSeverity ), NULL, this );
m_showErrors->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_ERC_BASE::OnSeverity ), NULL, this );

File diff suppressed because it is too large Load Diff

View File

@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version 3.10.1-0-g8feb16b)
// C++ code generated with wxFormBuilder (version 4.0.0-0-g0efcecf)
// http://www.wxformbuilder.org/
//
// PLEASE DO *NOT* EDIT THIS FILE!
@ -86,6 +86,7 @@ class DIALOG_ERC_BASE : public DIALOG_SHIM
virtual void OnERCItemDClick( wxDataViewEvent& event ) { event.Skip(); }
virtual void OnERCItemRClick( wxDataViewEvent& event ) { event.Skip(); }
virtual void OnERCItemSelected( wxDataViewEvent& event ) { event.Skip(); }
virtual void OnIgnoredItemRClick( wxListEvent& event ) { event.Skip(); }
virtual void OnEditViolationSeverities( wxHyperlinkEvent& event ) { event.Skip(); }
virtual void OnSeverity( wxCommandEvent& event ) { event.Skip(); }
virtual void OnSaveReport( wxCommandEvent& event ) { event.Skip(); }

View File

@ -61,10 +61,11 @@
// Use default column widths instead.
static int DEFAULT_SINGLE_COL_WIDTH = 660;
static BOARD* g_lastDRCBoard = nullptr;
static bool g_lastDRCRun = false;
static bool g_lastFootprintTestsRun = false;
static std::vector<wxString> g_lastIgnored;
static BOARD* g_lastDRCBoard = nullptr;
static bool g_lastDRCRun = false;
static bool g_lastFootprintTestsRun = false;
static std::vector<std::pair<wxString, int>> g_lastIgnored;
DIALOG_DRC::DIALOG_DRC( PCB_EDIT_FRAME* aEditorFrame, wxWindow* aParent ) :
@ -119,8 +120,15 @@ DIALOG_DRC::DIALOG_DRC( PCB_EDIT_FRAME* aEditorFrame, wxWindow* aParent ) :
m_drcRun = g_lastDRCRun;
m_footprintTestsRun = g_lastFootprintTestsRun;
for( const wxString& str : g_lastIgnored )
m_ignoredList->InsertItem( m_ignoredList->GetItemCount(), str );
for( const auto& [ str, code ] : g_lastIgnored )
{
wxListItem listItem;
listItem.SetId( m_ignoredList->GetItemCount() );
listItem.SetText( str );
listItem.SetData( code );
m_ignoredList->InsertItem( listItem );
}
}
m_Notebook->SetSelection( 0 );
@ -163,7 +171,10 @@ DIALOG_DRC::~DIALOG_DRC()
g_lastIgnored.clear();
for( int ii = 0; ii < m_ignoredList->GetItemCount(); ++ii )
g_lastIgnored.push_back( m_ignoredList->GetItemText( ii ) );
{
g_lastIgnored.push_back( { m_ignoredList->GetItemText( ii ),
m_ignoredList->GetItemData( ii ) } );
}
PCBNEW_SETTINGS* cfg = nullptr;
@ -315,8 +326,12 @@ void DIALOG_DRC::OnRunDRCClick( wxCommandEvent& aEvent )
{
if( bds().GetSeverity( item.get().GetErrorCode() ) == RPT_SEVERITY_IGNORE )
{
m_ignoredList->InsertItem( m_ignoredList->GetItemCount(),
wxT( "" ) + item.get().GetErrorText() );
wxListItem listItem;
listItem.SetId( m_ignoredList->GetItemCount() );
listItem.SetText( wxT( "" ) + item.get().GetErrorText() );
listItem.SetData( item.get().GetErrorCode() );
m_ignoredList->InsertItem( listItem );
}
}
@ -866,8 +881,12 @@ void DIALOG_DRC::OnDRCItemRClick( wxDataViewEvent& aEvent )
{
bds().m_DRCSeverities[ rcItem->GetErrorCode() ] = RPT_SEVERITY_IGNORE;
m_ignoredList->InsertItem( m_ignoredList->GetItemCount(),
wxT( "" ) + rcItem->GetErrorText() );
wxListItem listItem;
listItem.SetId( m_ignoredList->GetItemCount() );
listItem.SetText( wxT( "" ) + rcItem->GetErrorText() );
listItem.SetData( rcItem->GetErrorCode() );
m_ignoredList->InsertItem( listItem );
BOARD* board = m_frame->GetBoard();
@ -910,6 +929,33 @@ void DIALOG_DRC::OnDRCItemRClick( wxDataViewEvent& aEvent )
}
void DIALOG_DRC::OnIgnoredItemRClick( wxListEvent& event )
{
int errorCode = (int) event.m_item.GetData();
wxMenu menu;
menu.Append( RPT_SEVERITY_ERROR, _( "Error" ), wxEmptyString, wxITEM_CHECK );
menu.Append( RPT_SEVERITY_WARNING, _( "Warning" ), wxEmptyString, wxITEM_CHECK );
menu.Append( RPT_SEVERITY_IGNORE, _( "Ignore" ), wxEmptyString, wxITEM_CHECK );
menu.Check( bds().GetSeverity( errorCode ), true );
int severity = GetPopupMenuSelectionFromUser( menu );
if( severity > 0 )
{
if( bds().m_DRCSeverities[ errorCode ] != severity )
{
bds().m_DRCSeverities[ errorCode ] = (SEVERITY) severity;
updateDisplayedCounts();
refreshEditor();
m_frame->OnModify();
}
}
}
void DIALOG_DRC::OnEditViolationSeverities( wxHyperlinkEvent& aEvent )
{
m_frame->ShowBoardSetupDialog( _( "Violation Severity" ) );

View File

@ -79,6 +79,7 @@ private:
void OnDRCItemSelected( wxDataViewEvent& aEvent ) override;
void OnDRCItemDClick( wxDataViewEvent& aEvent ) override;
void OnDRCItemRClick( wxDataViewEvent& aEvent ) override;
void OnIgnoredItemRClick( wxListEvent& event ) override;
void OnEditViolationSeverities( wxHyperlinkEvent& aEvent ) override;
void OnSeverity( wxCommandEvent& aEvent ) override;

View File

@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version 3.10.1-0-g8feb16b)
// C++ code generated with wxFormBuilder (version 4.0.0-0-g0efcecf)
// http://www.wxformbuilder.org/
//
// PLEASE DO *NOT* EDIT THIS FILE!
@ -252,6 +252,7 @@ DIALOG_DRC_BASE::DIALOG_DRC_BASE( wxWindow* parent, wxWindowID id, const wxStrin
m_footprintsDataView->Connect( wxEVT_COMMAND_DATAVIEW_ITEM_ACTIVATED, wxDataViewEventHandler( DIALOG_DRC_BASE::OnDRCItemDClick ), NULL, this );
m_footprintsDataView->Connect( wxEVT_COMMAND_DATAVIEW_ITEM_CONTEXT_MENU, wxDataViewEventHandler( DIALOG_DRC_BASE::OnDRCItemRClick ), NULL, this );
m_footprintsDataView->Connect( wxEVT_COMMAND_DATAVIEW_SELECTION_CHANGED, wxDataViewEventHandler( DIALOG_DRC_BASE::OnDRCItemSelected ), NULL, this );
m_ignoredList->Connect( wxEVT_COMMAND_LIST_ITEM_RIGHT_CLICK, wxListEventHandler( DIALOG_DRC_BASE::OnIgnoredItemRClick ), NULL, this );
m_violationSeveritiesLink->Connect( wxEVT_COMMAND_HYPERLINK, wxHyperlinkEventHandler( DIALOG_DRC_BASE::OnEditViolationSeverities ), NULL, this );
m_showAll->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_DRC_BASE::OnSeverity ), NULL, this );
m_showErrors->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_DRC_BASE::OnSeverity ), NULL, this );
@ -280,6 +281,7 @@ DIALOG_DRC_BASE::~DIALOG_DRC_BASE()
m_footprintsDataView->Disconnect( wxEVT_COMMAND_DATAVIEW_ITEM_ACTIVATED, wxDataViewEventHandler( DIALOG_DRC_BASE::OnDRCItemDClick ), NULL, this );
m_footprintsDataView->Disconnect( wxEVT_COMMAND_DATAVIEW_ITEM_CONTEXT_MENU, wxDataViewEventHandler( DIALOG_DRC_BASE::OnDRCItemRClick ), NULL, this );
m_footprintsDataView->Disconnect( wxEVT_COMMAND_DATAVIEW_SELECTION_CHANGED, wxDataViewEventHandler( DIALOG_DRC_BASE::OnDRCItemSelected ), NULL, this );
m_ignoredList->Disconnect( wxEVT_COMMAND_LIST_ITEM_RIGHT_CLICK, wxListEventHandler( DIALOG_DRC_BASE::OnIgnoredItemRClick ), NULL, this );
m_violationSeveritiesLink->Disconnect( wxEVT_COMMAND_HYPERLINK, wxHyperlinkEventHandler( DIALOG_DRC_BASE::OnEditViolationSeverities ), NULL, this );
m_showAll->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_DRC_BASE::OnSeverity ), NULL, this );
m_showErrors->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_DRC_BASE::OnSeverity ), NULL, this );

File diff suppressed because it is too large Load Diff

View File

@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version 3.10.1-0-g8feb16b)
// C++ code generated with wxFormBuilder (version 4.0.0-0-g0efcecf)
// http://www.wxformbuilder.org/
//
// PLEASE DO *NOT* EDIT THIS FILE!
@ -92,6 +92,7 @@ class DIALOG_DRC_BASE : public DIALOG_SHIM
virtual void OnDRCItemDClick( wxDataViewEvent& event ) { event.Skip(); }
virtual void OnDRCItemRClick( wxDataViewEvent& event ) { event.Skip(); }
virtual void OnDRCItemSelected( wxDataViewEvent& event ) { event.Skip(); }
virtual void OnIgnoredItemRClick( wxListEvent& event ) { event.Skip(); }
virtual void OnEditViolationSeverities( wxHyperlinkEvent& event ) { event.Skip(); }
virtual void OnSeverity( wxCommandEvent& event ) { event.Skip(); }
virtual void OnSaveReport( wxCommandEvent& event ) { event.Skip(); }