Add Ignored Violations tab to DRC dialog.

Fixes https://gitlab.com/kicad/code/kicad/issues/7726
This commit is contained in:
Jeff Young 2021-07-11 22:47:19 +01:00
parent 2001d08186
commit 21eb928218
7 changed files with 211 additions and 9 deletions

View File

@ -47,6 +47,12 @@
#include <tools/board_inspection_tool.h>
#include <kiplatform/ui.h>
// wxWidgets spends *far* too long calcuating column widths (most of it, believe it or
// not, in repeatedly creating/destroying a wxDC to do the measurement in).
// Use default column widths instead.
static int DEFAULT_SINGLE_COL_WIDTH = 660;
DIALOG_DRC::DIALOG_DRC( PCB_EDIT_FRAME* aEditorFrame, wxWindow* aParent ) :
DIALOG_DRC_BASE( aParent ),
PROGRESS_REPORTER_BASE( 1 ),
@ -65,7 +71,7 @@ DIALOG_DRC::DIALOG_DRC( PCB_EDIT_FRAME* aEditorFrame, wxWindow* aParent ) :
{
SetName( DIALOG_DRC_WINDOW_NAME ); // Set a window name to be able to find it
m_frame = aEditorFrame;
m_frame = aEditorFrame;
m_currentBoard = m_frame->GetBoard();
m_messages->SetImmediateMode();
@ -79,6 +85,10 @@ DIALOG_DRC::DIALOG_DRC( PCB_EDIT_FRAME* aEditorFrame, wxWindow* aParent ) :
m_footprintWarningsTreeModel = new RC_TREE_MODEL( m_frame, m_footprintsDataView );
m_footprintsDataView->AssociateModel( m_footprintWarningsTreeModel );
m_ignoredList->InsertColumn( 0, wxEmptyString, wxLIST_FORMAT_LEFT, DEFAULT_SINGLE_COL_WIDTH );
m_Notebook->SetSelection( 0 );
if( Kiface().IsSingle() )
m_cbTestFootprints->Hide();
@ -133,13 +143,13 @@ void DIALOG_DRC::initValues()
m_markersTitleTemplate = m_Notebook->GetPageText( 0 );
m_unconnectedTitleTemplate = m_Notebook->GetPageText( 1 );
m_footprintsTitleTemplate = m_Notebook->GetPageText( 2 );
m_ignoredTitleTemplate = m_Notebook->GetPageText( 3 );
auto cfg = m_frame->GetPcbNewSettings();
m_cbRefillZones->SetValue( cfg->m_DrcDialog.refill_zones );
m_cbReportAllTrackErrors->SetValue( cfg->m_DrcDialog.test_all_track_errors );
if( !Kiface().IsSingle() )
m_cbTestFootprints->SetValue( cfg->m_DrcDialog.test_footprints );
@ -242,6 +252,18 @@ void DIALOG_DRC::OnRunDRCClick( wxCommandEvent& aEvent )
m_unconnectedTreeModel->DeleteItems( false, true, true );
m_footprintWarningsTreeModel->DeleteItems( false, true, true );
std::vector<std::reference_wrapper<RC_ITEM>> violations = DRC_ITEM::GetItemsWithSeverities();
m_ignoredList->DeleteAllItems();
for( std::reference_wrapper<RC_ITEM>& item : violations )
{
if( bds().GetSeverity( item.get().GetErrorCode() ) == RPT_SEVERITY_IGNORE )
{
m_ignoredList->InsertItem( m_ignoredList->GetItemCount(),
wxT( "" ) + item.get().GetErrorText() );
}
}
Raise();
m_runningResultsBook->ChangeSelection( 0 ); // Display the "Tests Running..." tab
@ -604,6 +626,21 @@ void DIALOG_DRC::OnDRCItemRClick( wxDataViewEvent& aEvent )
}
void DIALOG_DRC::OnIgnoreItemRClick( wxListEvent& event )
{
wxMenu menu;
menu.Append( 1, _( "Edit ignored violations..." ), _( "Open the Board Setup... dialog" ) );
switch( GetPopupMenuSelectionFromUser( menu ) )
{
case 1:
m_frame->ShowBoardSetupDialog( _( "Violation Severity" ) );
break;
}
}
void DIALOG_DRC::OnSeverity( wxCommandEvent& aEvent )
{
int flag = 0;
@ -733,6 +770,7 @@ void DIALOG_DRC::PrevMarker()
case 0: m_markersTreeModel->PrevMarker(); break;
case 1: m_unconnectedTreeModel->PrevMarker(); break;
case 2: m_footprintWarningsTreeModel->PrevMarker(); break;
case 3: break;
}
}
}
@ -747,6 +785,7 @@ void DIALOG_DRC::NextMarker()
case 0: m_markersTreeModel->NextMarker(); break;
case 1: m_unconnectedTreeModel->NextMarker(); break;
case 2: m_footprintWarningsTreeModel->NextMarker(); break;
case 3: break;
}
}
}
@ -995,7 +1034,11 @@ void DIALOG_DRC::updateDisplayedCounts()
msg = m_footprintsTitleTemplate;
msg.Replace( wxT( "%d" ), _( "not run" ) );
}
m_Notebook->SetPageText( 2, msg );
msg.sprintf( m_ignoredTitleTemplate, m_ignoredList->GetItemCount() );
m_Notebook->SetPageText( 3, msg );
}
else
{
@ -1010,6 +1053,10 @@ void DIALOG_DRC::updateDisplayedCounts()
msg = m_footprintsTitleTemplate;
msg.Replace( wxT( "(%d)" ), wxEmptyString );
m_Notebook->SetPageText( 2, msg );
msg = m_ignoredTitleTemplate;
msg.Replace( wxT( "(%d)" ), wxEmptyString );
m_Notebook->SetPageText( 3, msg );
}
// Update badges:

View File

@ -78,6 +78,7 @@ private:
void OnDRCItemSelected( wxDataViewEvent& aEvent ) override;
void OnDRCItemDClick( wxDataViewEvent& aEvent ) override;
void OnDRCItemRClick( wxDataViewEvent& aEvent ) override;
void OnIgnoreItemRClick( wxListEvent& event ) override;
void OnSeverity( wxCommandEvent& aEvent ) override;
void OnSaveReport( wxCommandEvent& aEvent ) override;
@ -118,6 +119,7 @@ private:
wxString m_markersTitleTemplate;
wxString m_unconnectedTitleTemplate;
wxString m_footprintsTitleTemplate;
wxString m_ignoredTitleTemplate;
RC_ITEMS_PROVIDER* m_markersProvider;
RC_TREE_MODEL* m_markersTreeModel;

View File

@ -88,6 +88,8 @@ DIALOG_DRC_BASE::DIALOG_DRC_BASE( wxWindow* parent, wxWindowID id, const wxStrin
bSizer13 = new wxBoxSizer( wxVERTICAL );
m_Notebook = new wxNotebook( results, ID_NOTEBOOK1, wxDefaultPosition, wxDefaultSize, 0 );
m_Notebook->SetMinSize( wxSize( 640,-1 ) );
m_panelViolations = new wxPanel( m_Notebook, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
wxBoxSizer* bSizerViolationsBox;
bSizerViolationsBox = new wxBoxSizer( wxVERTICAL );
@ -127,6 +129,18 @@ DIALOG_DRC_BASE::DIALOG_DRC_BASE( wxWindow* parent, wxWindowID id, const wxStrin
m_panelFootprintWarnings->Layout();
bSizerFootprintsBox->Fit( m_panelFootprintWarnings );
m_Notebook->AddPage( m_panelFootprintWarnings, _("Schematic Parity (%d)"), false );
m_panelIgnored = new wxPanel( m_Notebook, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
wxBoxSizer* bSizer15;
bSizer15 = new wxBoxSizer( wxVERTICAL );
m_ignoredList = new wxListCtrl( m_panelIgnored, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLC_NO_HEADER|wxLC_REPORT );
bSizer15->Add( m_ignoredList, 1, wxALL|wxEXPAND, 5 );
m_panelIgnored->SetSizer( bSizer15 );
m_panelIgnored->Layout();
bSizer15->Fit( m_panelIgnored );
m_Notebook->AddPage( m_panelIgnored, _("Ignored Tests (%d)"), false );
bSizer13->Add( m_Notebook, 1, wxEXPAND|wxRIGHT|wxLEFT, 5 );
@ -224,6 +238,7 @@ DIALOG_DRC_BASE::DIALOG_DRC_BASE( wxWindow* parent, wxWindowID id, const wxStrin
m_unconnectedDataView->Connect( wxEVT_COMMAND_DATAVIEW_SELECTION_CHANGED, wxDataViewEventHandler( DIALOG_DRC_BASE::OnDRCItemSelected ), NULL, this );
m_footprintsDataView->Connect( wxEVT_COMMAND_DATAVIEW_ITEM_ACTIVATED, wxDataViewEventHandler( DIALOG_DRC_BASE::OnDRCItemDClick ), 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::OnIgnoreItemRClick ), 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 );
m_showWarnings->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_DRC_BASE::OnSeverity ), NULL, this );
@ -249,6 +264,7 @@ DIALOG_DRC_BASE::~DIALOG_DRC_BASE()
m_unconnectedDataView->Disconnect( wxEVT_COMMAND_DATAVIEW_SELECTION_CHANGED, wxDataViewEventHandler( DIALOG_DRC_BASE::OnDRCItemSelected ), NULL, this );
m_footprintsDataView->Disconnect( wxEVT_COMMAND_DATAVIEW_ITEM_ACTIVATED, wxDataViewEventHandler( DIALOG_DRC_BASE::OnDRCItemDClick ), 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::OnIgnoreItemRClick ), 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 );
m_showWarnings->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_DRC_BASE::OnSeverity ), NULL, this );

View File

@ -755,7 +755,7 @@
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size">-1,-1</property>
<property name="minimum_size">640,-1</property>
<property name="moveable">1</property>
<property name="name">m_Notebook</property>
<property name="pane_border">1</property>
@ -868,11 +868,11 @@
</object>
</object>
</object>
<object class="notebookpage" expanded="0">
<object class="notebookpage" expanded="1">
<property name="bitmap"></property>
<property name="label">Unconnected Items (%d)</property>
<property name="select">0</property>
<object class="wxPanel" expanded="0">
<object class="wxPanel" expanded="1">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
@ -923,7 +923,7 @@
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style">wxTAB_TRAVERSAL</property>
<object class="wxBoxSizer" expanded="0">
<object class="wxBoxSizer" expanded="1">
<property name="minimum_size"></property>
<property name="name">bSizerUnconnectedBox</property>
<property name="orient">wxVERTICAL</property>
@ -1052,6 +1052,132 @@
</object>
</object>
</object>
<object class="notebookpage" expanded="1">
<property name="bitmap"></property>
<property name="label">Ignored Tests (%d)</property>
<property name="select">0</property>
<object class="wxPanel" expanded="1">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_panelIgnored</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
<property name="subclass">; ; forward_declare</property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style">wxTAB_TRAVERSAL</property>
<object class="wxBoxSizer" expanded="1">
<property name="minimum_size"></property>
<property name="name">bSizer15</property>
<property name="orient">wxVERTICAL</property>
<property name="permission">none</property>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxALL|wxEXPAND</property>
<property name="proportion">1</property>
<object class="wxListCtrl" expanded="1">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_ignoredList</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style">wxLC_NO_HEADER|wxLC_REPORT</property>
<property name="subclass">; ; forward_declare</property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnListItemRightClick">OnIgnoreItemRClick</event>
</object>
</object>
</object>
</object>
</object>
</object>
</object>
</object>

View File

@ -28,6 +28,7 @@ class WX_HTML_REPORT_BOX;
#include <wx/icon.h>
#include <wx/notebook.h>
#include <wx/dataview.h>
#include <wx/listctrl.h>
#include <wx/simplebook.h>
#include <wx/stattext.h>
#include <widgets/number_badge.h>
@ -64,6 +65,8 @@ class DIALOG_DRC_BASE : public DIALOG_SHIM
wxDataViewCtrl* m_unconnectedDataView;
wxPanel* m_panelFootprintWarnings;
wxDataViewCtrl* m_footprintsDataView;
wxPanel* m_panelIgnored;
wxListCtrl* m_ignoredList;
wxStaticText* m_showLabel;
wxCheckBox* m_showAll;
wxCheckBox* m_showErrors;
@ -89,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 OnIgnoreItemRClick( wxListEvent& event ) { event.Skip(); }
virtual void OnSeverity( wxCommandEvent& event ) { event.Skip(); }
virtual void OnSaveReport( wxCommandEvent& event ) { event.Skip(); }
virtual void OnDeleteOneClick( wxCommandEvent& event ) { event.Skip(); }

View File

@ -41,9 +41,10 @@
DRC_ITEM DRC_ITEM::heading_electrical( 0, _( "Electrical" ), "" );
DRC_ITEM DRC_ITEM::heading_DFM( 0, _( "Design For Manufacturing" ), "" );
DRC_ITEM DRC_ITEM::heading_DFM( 0, _( "Design for Manufacturing" ), "" );
DRC_ITEM DRC_ITEM::heading_schematic_parity( 0, _( "Schematic Parity" ), "" );
DRC_ITEM DRC_ITEM::heading_signal_integrity( 0, _( "Signal Integrity" ), "" );
DRC_ITEM DRC_ITEM::heading_readability( 0, _( "Readability" ), "" );
DRC_ITEM DRC_ITEM::heading_misc( 0, _( "Miscellaneous" ), "" );
DRC_ITEM DRC_ITEM::unconnectedItems( DRCE_UNCONNECTED_ITEMS,
@ -258,10 +259,14 @@ std::vector<std::reference_wrapper<RC_ITEM>> DRC_ITEM::allItemTypes( {
DRC_ITEM::diffPairGapOutOfRange,
DRC_ITEM::diffPairUncoupledLengthTooLong,
DRC_ITEM::heading_misc,
DRC_ITEM::itemsNotAllowed,
DRC_ITEM::heading_readability,
DRC_ITEM::silkOverlaps,
DRC_ITEM::silkMaskClearance,
DRC_ITEM::textHeightOutOfRange,
DRC_ITEM::textThicknessOutOfRange,
DRC_ITEM::heading_misc,
DRC_ITEM::itemsNotAllowed,
DRC_ITEM::zonesIntersect,
DRC_ITEM::zoneHasEmptyNet,
DRC_ITEM::padstack,
@ -271,6 +276,7 @@ std::vector<std::reference_wrapper<RC_ITEM>> DRC_ITEM::allItemTypes( {
DRC_ITEM::unresolvedVariable,
DRC_ITEM::footprintTypeMismatch,
DRC_ITEM::libFootprintIssues,
DRC_ITEM::footprintTHPadhasNoHole
} );

View File

@ -134,6 +134,7 @@ private:
static DRC_ITEM heading_DFM;
static DRC_ITEM heading_schematic_parity;
static DRC_ITEM heading_signal_integrity;
static DRC_ITEM heading_readability;
static DRC_ITEM heading_misc;
static DRC_ITEM unconnectedItems;