Bring ERC & DRC dialogs into parity.

Fixes https://gitlab.com/kicad/code/kicad/issues/9350
This commit is contained in:
Jeff Young 2022-01-22 21:34:01 +00:00
parent f8d6bf4cc9
commit 29841ba315
14 changed files with 1534 additions and 825 deletions

View File

@ -49,6 +49,12 @@
#include <string_utils.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_ERC::DIALOG_ERC( SCH_EDIT_FRAME* parent ) :
DIALOG_ERC_BASE( parent ),
PROGRESS_REPORTER_BASE( 1 ),
@ -70,18 +76,30 @@ DIALOG_ERC::DIALOG_ERC( SCH_EDIT_FRAME* parent ) :
m_markerTreeModel->SetSeverities( m_severities );
m_markerTreeModel->SetProvider( m_markerProvider );
syncCheckboxes();
updateDisplayedCounts();
m_ignoredList->InsertColumn( 0, wxEmptyString, wxLIST_FORMAT_LEFT, DEFAULT_SINGLE_COL_WIDTH );
m_notebook->SetSelection( 0 );
SetupStandardButtons( { { wxID_OK, _( "Run ERC" ) },
{ wxID_CANCEL, _( "Close" ) } } );
m_violationsTitleTemplate = m_notebook->GetPageText( 0 );
m_ignoredTitleTemplate = m_notebook->GetPageText( 1 );
m_errorsBadge->SetMaximumNumber( 999 );
m_warningsBadge->SetMaximumNumber( 999 );
m_exclusionsBadge->SetMaximumNumber( 999 );
UpdateAnnotationWarning();
Layout();
SetFocus();
syncCheckboxes();
updateDisplayedCounts();
// Now all widgets have the size fixed, call FinishDialogSettings
finishDialogSettings();
}
@ -178,11 +196,32 @@ void DIALOG_ERC::updateDisplayedCounts()
numExcluded += m_markerProvider->GetCount( RPT_SEVERITY_EXCLUSION );
}
if( !m_ercRun )
wxString msg;
if( m_ercRun )
{
numErrors = -1;
numWarnings = -1;
msg.sprintf( m_violationsTitleTemplate, m_markerProvider->GetCount() );
m_notebook->SetPageText( 0, msg );
msg.sprintf( m_ignoredTitleTemplate, m_ignoredList->GetItemCount() );
m_notebook->SetPageText( 1, msg );
}
else
{
msg = m_violationsTitleTemplate;
msg.Replace( wxT( "(%d)" ), wxEmptyString );
m_notebook->SetPageText( 0, msg );
msg = m_ignoredTitleTemplate;
msg.Replace( wxT( "(%d)" ), wxEmptyString );
m_notebook->SetPageText( 1, msg );
}
if( !m_ercRun && numErrors == 0 )
numErrors = -1;
if( !m_ercRun && numWarnings == 0 )
numWarnings = -1;
m_errorsBadge->UpdateNumber( numErrors, RPT_SEVERITY_ERROR );
m_warningsBadge->UpdateNumber( numWarnings, RPT_SEVERITY_WARNING );
@ -190,9 +229,26 @@ void DIALOG_ERC::updateDisplayedCounts()
}
void DIALOG_ERC::OnDeleteOneClick( wxCommandEvent& aEvent )
{
if( m_notebook->GetSelection() == 0 )
{
// Clear the selection. It may be the selected ERC marker.
m_parent->GetToolManager()->RunAction( EE_ACTIONS::clearSelection, true );
m_markerTreeModel->DeleteCurrentItem( true );
// redraw the schematic
redrawDrawPanel();
}
updateDisplayedCounts();
}
/* Delete the old ERC markers, over the whole hierarchy
*/
void DIALOG_ERC::OnEraseDrcMarkersClick( wxCommandEvent& event )
void DIALOG_ERC::OnDeleteAllClick( wxCommandEvent& event )
{
bool includeExclusions = false;
int numExcluded = 0;
@ -216,9 +272,11 @@ void DIALOG_ERC::OnEraseDrcMarkersClick( wxCommandEvent& event )
deleteAllMarkers( includeExclusions );
// redraw the schematic
redrawDrawPanel();
m_ercRun = false;
updateDisplayedCounts();
m_parent->GetCanvas()->Refresh();
}
@ -275,14 +333,29 @@ void DIALOG_ERC::OnRunERCClick( wxCommandEvent& event )
m_parent->RecordERCExclusions();
deleteAllMarkers( true );
m_notebook->ChangeSelection( 0 ); // Display the "Tests Running..." tab
std::vector<std::reference_wrapper<RC_ITEM>> violations = ERC_ITEM::GetItemsWithSeverities();
m_ignoredList->DeleteAllItems();
for( std::reference_wrapper<RC_ITEM>& item : violations )
{
if( sch->ErcSettings().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
m_messages->Clear();
wxYield(); // Allow time slice to refresh Messages
wxYield(); // Allow time slice to refresh Messages
m_running = true;
m_sdbSizer1Cancel->SetLabel( _( "Cancel" ) );
m_sdbSizer1OK->Enable( false );
m_buttondelmarkers->Enable( false );
m_deleteOneMarker->Enable( false );
m_deleteAllMarkers->Enable( false );
m_saveReport->Enable( false );
sch->GetSheets().AnnotatePowerSymbols();
@ -311,7 +384,7 @@ void DIALOG_ERC::OnRunERCClick( wxCommandEvent& event )
if( m_cancelled )
m_messages->Report( _( "-------- ERC cancelled by user.<br><br>" ), RPT_SEVERITY_INFO );
else
m_messages->Report( _( "ERC completed.<br><br>" ), RPT_SEVERITY_INFO );
m_messages->Report( _( "Done.<br><br>" ), RPT_SEVERITY_INFO );
Raise();
wxYield(); // Allow time slice to refresh Messages
@ -319,17 +392,19 @@ void DIALOG_ERC::OnRunERCClick( wxCommandEvent& event )
m_running = false;
m_sdbSizer1Cancel->SetLabel( _( "Close" ) );
m_sdbSizer1OK->Enable( true );
m_buttondelmarkers->Enable( true );
m_deleteOneMarker->Enable( true );
m_deleteAllMarkers->Enable( true );
m_saveReport->Enable( true );
if( !m_cancelled )
{
wxMilliSleep( 500 );
m_notebook->ChangeSelection( 1 );
m_runningResultsBook->ChangeSelection( 1 );
KIPLATFORM::UI::ForceFocus( m_markerDataView );
}
m_ercRun = true;
redrawDrawPanel();
updateDisplayedCounts();
}
@ -654,19 +729,25 @@ void DIALOG_ERC::OnERCItemRClick( wxDataViewEvent& aEvent )
void DIALOG_ERC::PrevMarker()
{
if( m_notebook->GetSelection() != 1 )
m_notebook->SetSelection( 1 );
if( m_notebook->IsShown() )
{
if( m_notebook->GetSelection() != 0 )
m_notebook->SetSelection( 0 );
m_markerTreeModel->PrevMarker();
m_markerTreeModel->PrevMarker();
}
}
void DIALOG_ERC::NextMarker()
{
if( m_notebook->GetSelection() != 1 )
m_notebook->SetSelection( 1 );
if( m_notebook->IsShown() )
{
if( m_notebook->GetSelection() != 0 )
m_notebook->SetSelection( 0 );
m_markerTreeModel->NextMarker();
m_markerTreeModel->NextMarker();
}
}
@ -677,7 +758,7 @@ void DIALOG_ERC::ExcludeMarker( SCH_MARKER* aMarker )
if( marker != nullptr )
m_markerTreeModel->SelectMarker( marker );
if( m_notebook->GetSelection() != 1 )
if( m_notebook->GetSelection() != 0 )
return;
RC_TREE_NODE* node = RC_TREE_MODEL::ToNode( m_markerDataView->GetCurrentItem() );
@ -703,6 +784,21 @@ void DIALOG_ERC::ExcludeMarker( SCH_MARKER* aMarker )
}
void DIALOG_ERC::OnIgnoreItemRClick( wxListEvent& event )
{
wxMenu menu;
menu.Append( 1, _( "Edit ignored violations..." ), _( "Open the Schematic Setup... dialog" ) );
switch( GetPopupMenuSelectionFromUser( menu ) )
{
case 1:
m_parent->ShowSchematicSetupDialog( _( "Violation Severity" ) );
break;
}
}
void DIALOG_ERC::OnSeverity( wxCommandEvent& aEvent )
{
int flag = 0;

View File

@ -2,7 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2007 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 1992-2021 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 1992-2022 KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@ -68,10 +68,13 @@ private:
// from DIALOG_ERC_BASE:
void OnCloseErcDialog( wxCloseEvent& event ) override;
void OnRunERCClick( wxCommandEvent& event ) override;
void OnEraseDrcMarkersClick( wxCommandEvent& event ) override;
void OnDeleteOneClick( wxCommandEvent& event ) override;
void OnDeleteAllClick( wxCommandEvent& event ) override;
void OnERCItemSelected( wxDataViewEvent& aEvent ) override;
void OnERCItemDClick( wxDataViewEvent& aEvent ) override;
void OnERCItemRClick( wxDataViewEvent& aEvent ) override;
void OnIgnoreItemRClick( wxListEvent& event ) override;
void OnLinkClicked( wxHtmlLinkEvent& event ) override;
void OnSeverity( wxCommandEvent& aEvent ) override;
@ -92,6 +95,9 @@ private:
private:
SCH_EDIT_FRAME* m_parent;
wxString m_violationsTitleTemplate;
wxString m_ignoredTitleTemplate;
RC_ITEMS_PROVIDER* m_markerProvider;
RC_TREE_MODEL* m_markerTreeModel;

View File

@ -20,6 +20,8 @@ DIALOG_ERC_BASE::DIALOG_ERC_BASE( wxWindow* parent, wxWindowID id, const wxStrin
bSizer1 = new wxBoxSizer( wxVERTICAL );
m_infoBar = new WX_INFOBAR( this );
m_infoBar->SetShowHideEffects( wxSHOW_EFFECT_NONE, wxSHOW_EFFECT_NONE );
m_infoBar->SetEffectDuration( 500 );
m_infoBar->Hide();
bSizer1->Add( m_infoBar, 0, wxEXPAND, 5 );
@ -27,19 +29,47 @@ DIALOG_ERC_BASE::DIALOG_ERC_BASE( wxWindow* parent, wxWindowID id, const wxStrin
wxBoxSizer* bMainSizer;
bMainSizer = new wxBoxSizer( wxVERTICAL );
m_notebook = new wxNotebook( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 );
messagesPanel = new wxPanel( m_notebook, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
wxBoxSizer* bMessagesSizer;
bMessagesSizer = new wxBoxSizer( wxVERTICAL );
m_runningResultsBook = new wxSimplebook( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 );
running = new wxPanel( m_runningResultsBook, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
wxBoxSizer* bSizer14;
bSizer14 = new wxBoxSizer( wxVERTICAL );
m_messages = new WX_HTML_REPORT_BOX( messagesPanel, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxHW_SCROLLBAR_AUTO );
bMessagesSizer->Add( m_messages, 1, wxEXPAND|wxBOTTOM|wxLEFT, 5 );
m_runningNotebook = new wxNotebook( running, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 );
m_panelMessages = new wxPanel( m_runningNotebook, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
wxBoxSizer* bSizer10;
bSizer10 = new wxBoxSizer( wxVERTICAL );
m_messages = new WX_HTML_REPORT_BOX( m_panelMessages, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxHW_SCROLLBAR_AUTO );
bSizer10->Add( m_messages, 1, wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 5 );
wxBoxSizer* bGaugeMargins;
bGaugeMargins = new wxBoxSizer( wxVERTICAL );
m_gauge = new wxGauge( m_panelMessages, wxID_ANY, 1000, wxDefaultPosition, wxDefaultSize, wxGA_HORIZONTAL );
m_gauge->SetValue( 0 );
bGaugeMargins->Add( m_gauge, 0, wxALL|wxEXPAND, 5 );
messagesPanel->SetSizer( bMessagesSizer );
messagesPanel->Layout();
bMessagesSizer->Fit( messagesPanel );
m_notebook->AddPage( messagesPanel, _("Messages"), true );
bSizer10->Add( bGaugeMargins, 0, wxEXPAND|wxRIGHT|wxLEFT, 5 );
m_panelMessages->SetSizer( bSizer10 );
m_panelMessages->Layout();
bSizer10->Fit( m_panelMessages );
m_runningNotebook->AddPage( m_panelMessages, _("Tests Running..."), true );
bSizer14->Add( m_runningNotebook, 1, wxEXPAND | wxALL, 5 );
running->SetSizer( bSizer14 );
running->Layout();
bSizer14->Fit( running );
m_runningResultsBook->AddPage( running, _("a page"), false );
results = new wxPanel( m_runningResultsBook, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
wxBoxSizer* bSizer13;
bSizer13 = new wxBoxSizer( wxVERTICAL );
m_notebook = new wxNotebook( results, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 );
violationsPanel = new wxPanel( m_notebook, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
wxBoxSizer* bViolationsSizer;
bViolationsSizer = new wxBoxSizer( wxVERTICAL );
@ -54,16 +84,39 @@ DIALOG_ERC_BASE::DIALOG_ERC_BASE( wxWindow* parent, wxWindowID id, const wxStrin
violationsPanel->SetSizer( bViolationsSizer );
violationsPanel->Layout();
bViolationsSizer->Fit( violationsPanel );
m_notebook->AddPage( violationsPanel, _("Violations"), false );
m_notebook->AddPage( violationsPanel, _("Violations (%d)"), false );
m_panelIgnored = new wxPanel( m_notebook, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
wxBoxSizer* bSizer15;
bSizer15 = new wxBoxSizer( wxVERTICAL );
bMainSizer->Add( m_notebook, 1, wxEXPAND, 5 );
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, 5 );
results->SetSizer( bSizer13 );
results->Layout();
bSizer13->Fit( results );
m_runningResultsBook->AddPage( results, _("a page"), true );
bMainSizer->Add( m_runningResultsBook, 1, wxEXPAND|wxTOP|wxRIGHT, 5 );
wxBoxSizer* bSizer11;
bSizer11 = new wxBoxSizer( wxVERTICAL );
wxBoxSizer* bSeveritySizer;
bSeveritySizer = new wxBoxSizer( wxHORIZONTAL );
m_showLabel = new wxStaticText( this, wxID_ANY, _("Show:"), wxDefaultPosition, wxDefaultSize, 0 );
m_showLabel->Wrap( -1 );
bSeveritySizer->Add( m_showLabel, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 5 );
bSeveritySizer->Add( m_showLabel, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT, 5 );
m_showAll = new wxCheckBox( this, wxID_ANY, _("All"), wxDefaultPosition, wxDefaultSize, 0 );
bSeveritySizer->Add( m_showAll, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 5 );
@ -96,18 +149,24 @@ DIALOG_ERC_BASE::DIALOG_ERC_BASE( wxWindow* parent, wxWindowID id, const wxStrin
bSeveritySizer->Add( m_saveReport, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 5 );
bMainSizer->Add( bSeveritySizer, 0, wxBOTTOM|wxEXPAND|wxLEFT|wxRIGHT|wxTOP, 5 );
bSizer11->Add( bSeveritySizer, 0, wxEXPAND|wxALL, 5 );
bSizer1->Add( bMainSizer, 1, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 8 );
bMainSizer->Add( bSizer11, 0, wxEXPAND|wxRIGHT|wxLEFT, 5 );
bSizer1->Add( bMainSizer, 1, wxEXPAND|wxBOTTOM|wxLEFT, 5 );
m_staticline1 = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL );
bSizer1->Add( m_staticline1, 0, wxEXPAND|wxLEFT|wxRIGHT, 5 );
bSizer1->Add( m_staticline1, 0, wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 5 );
m_buttonsSizer = new wxBoxSizer( wxHORIZONTAL );
m_buttondelmarkers = new wxButton( this, ID_ERASE_DRC_MARKERS, _("Delete Markers"), wxDefaultPosition, wxDefaultSize, 0 );
m_buttonsSizer->Add( m_buttondelmarkers, 0, wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL, 8 );
m_deleteOneMarker = new wxButton( this, wxID_ANY, _("Delete Marker"), wxDefaultPosition, wxDefaultSize, 0 );
m_buttonsSizer->Add( m_deleteOneMarker, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
m_deleteAllMarkers = new wxButton( this, ID_ERASE_DRC_MARKERS, _("Delete All Markers"), wxDefaultPosition, wxDefaultSize, 0 );
m_buttonsSizer->Add( m_deleteAllMarkers, 0, wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL, 8 );
m_buttonsSizer->Add( 0, 0, 1, wxEXPAND, 5 );
@ -122,7 +181,7 @@ DIALOG_ERC_BASE::DIALOG_ERC_BASE( wxWindow* parent, wxWindowID id, const wxStrin
m_buttonsSizer->Add( m_sdbSizer1, 0, wxEXPAND|wxALL, 5 );
bSizer1->Add( m_buttonsSizer, 0, wxEXPAND|wxLEFT, 5 );
bSizer1->Add( m_buttonsSizer, 0, wxEXPAND|wxLEFT, 10 );
this->SetSizer( bSizer1 );
@ -135,12 +194,14 @@ 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::OnIgnoreItemRClick ), 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 );
m_showWarnings->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_ERC_BASE::OnSeverity ), NULL, this );
m_showExclusions->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_ERC_BASE::OnSeverity ), NULL, this );
m_saveReport->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_ERC_BASE::OnSaveReport ), NULL, this );
m_buttondelmarkers->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_ERC_BASE::OnEraseDrcMarkersClick ), NULL, this );
m_deleteOneMarker->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_ERC_BASE::OnDeleteOneClick ), NULL, this );
m_deleteAllMarkers->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_ERC_BASE::OnDeleteAllClick ), NULL, this );
m_sdbSizer1Cancel->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_ERC_BASE::OnCancelClick ), NULL, this );
m_sdbSizer1OK->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_ERC_BASE::OnRunERCClick ), NULL, this );
}
@ -153,12 +214,14 @@ 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::OnIgnoreItemRClick ), 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 );
m_showWarnings->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_ERC_BASE::OnSeverity ), NULL, this );
m_showExclusions->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_ERC_BASE::OnSeverity ), NULL, this );
m_saveReport->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_ERC_BASE::OnSaveReport ), NULL, this );
m_buttondelmarkers->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_ERC_BASE::OnEraseDrcMarkersClick ), NULL, this );
m_deleteOneMarker->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_ERC_BASE::OnDeleteOneClick ), NULL, this );
m_deleteAllMarkers->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_ERC_BASE::OnDeleteAllClick ), NULL, this );
m_sdbSizer1Cancel->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_ERC_BASE::OnCancelClick ), NULL, this );
m_sdbSizer1OK->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_ERC_BASE::OnRunERCClick ), NULL, this );

File diff suppressed because it is too large Load Diff

View File

@ -21,13 +21,16 @@ class WX_INFOBAR;
#include <wx/settings.h>
#include <wx/string.h>
#include <wx/html/htmlwin.h>
#include <wx/gauge.h>
#include <wx/sizer.h>
#include <wx/panel.h>
#include <wx/bitmap.h>
#include <wx/image.h>
#include <wx/icon.h>
#include <wx/dataview.h>
#include <wx/notebook.h>
#include <wx/dataview.h>
#include <wx/listctrl.h>
#include <wx/simplebook.h>
#include <wx/stattext.h>
#include <wx/checkbox.h>
#include <widgets/number_badge.h>
@ -48,11 +51,18 @@ class DIALOG_ERC_BASE : public DIALOG_SHIM
protected:
WX_INFOBAR* m_infoBar;
wxNotebook* m_notebook;
wxPanel* messagesPanel;
wxSimplebook* m_runningResultsBook;
wxPanel* running;
wxNotebook* m_runningNotebook;
wxPanel* m_panelMessages;
WX_HTML_REPORT_BOX* m_messages;
wxGauge* m_gauge;
wxPanel* results;
wxNotebook* m_notebook;
wxPanel* violationsPanel;
wxDataViewCtrl* m_markerDataView;
wxPanel* m_panelIgnored;
wxListCtrl* m_ignoredList;
wxStaticText* m_showLabel;
wxCheckBox* m_showAll;
wxCheckBox* m_showErrors;
@ -64,7 +74,8 @@ class DIALOG_ERC_BASE : public DIALOG_SHIM
wxButton* m_saveReport;
wxStaticLine* m_staticline1;
wxBoxSizer* m_buttonsSizer;
wxButton* m_buttondelmarkers;
wxButton* m_deleteOneMarker;
wxButton* m_deleteAllMarkers;
wxStdDialogButtonSizer* m_sdbSizer1;
wxButton* m_sdbSizer1OK;
wxButton* m_sdbSizer1Cancel;
@ -75,9 +86,11 @@ 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 OnIgnoreItemRClick( wxListEvent& event ) { event.Skip(); }
virtual void OnSeverity( wxCommandEvent& event ) { event.Skip(); }
virtual void OnSaveReport( wxCommandEvent& event ) { event.Skip(); }
virtual void OnEraseDrcMarkersClick( wxCommandEvent& event ) { event.Skip(); }
virtual void OnDeleteOneClick( wxCommandEvent& event ) { event.Skip(); }
virtual void OnDeleteAllClick( wxCommandEvent& event ) { event.Skip(); }
virtual void OnCancelClick( wxCommandEvent& event ) { event.Skip(); }
virtual void OnRunERCClick( wxCommandEvent& event ) { event.Skip(); }

View File

@ -343,7 +343,7 @@ int SHEETLIST_ERC_ITEMS_PROVIDER::GetCount( int aSeverity ) const
else
markerSeverity = settings.GetSeverity( aMarker->GetRCItem()->GetErrorCode() );
if( markerSeverity == aSeverity )
if( ( markerSeverity & aSeverity ) > 0 )
count++;
} );

View File

@ -51,6 +51,13 @@ SCH_MARKER::SCH_MARKER( std::shared_ptr<ERC_ITEM> aItem, const VECTOR2I& aPos )
}
SCH_MARKER::~SCH_MARKER()
{
if( m_rcItem )
m_rcItem->SetParent( nullptr );
}
EDA_ITEM* SCH_MARKER::Clone() const
{
return new SCH_MARKER( *this );

View File

@ -35,6 +35,8 @@ class SCH_MARKER : public SCH_ITEM, public MARKER_BASE
public:
SCH_MARKER( std::shared_ptr<ERC_ITEM> aItem, const VECTOR2I& aPos );
~SCH_MARKER();
// Do not create a copy constructor. The one generated by the compiler is adequate.
static inline bool ClassOf( const EDA_ITEM* aItem )

View File

@ -97,7 +97,28 @@ DIALOG_DRC::DIALOG_DRC( PCB_EDIT_FRAME* aEditorFrame, wxWindow* aParent ) :
SetupStandardButtons( { { wxID_OK, _( "Run DRC" ) },
{ wxID_CANCEL, _( "Close" ) } } );
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 );
m_severities = cfg->m_DrcDialog.severities;
m_markersTreeModel->SetSeverities( m_severities );
m_unconnectedTreeModel->SetSeverities( m_severities );
m_footprintWarningsTreeModel->SetSeverities( m_severities );
Layout(); // adding the units above expanded Clearance text, now resize.
SetFocus();
syncCheckboxes();
finishDialogSettings();
@ -136,31 +157,7 @@ void DIALOG_DRC::OnActivateDlg( wxActivateEvent& aEvent )
}
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 );
m_severities = cfg->m_DrcDialog.severities;
m_markersTreeModel->SetSeverities( m_severities );
m_unconnectedTreeModel->SetSeverities( m_severities );
m_footprintWarningsTreeModel->SetSeverities( m_severities );
Layout(); // adding the units above expanded Clearance text, now resize.
SetFocus();
}
// PROGRESS_REPORTER calls
bool DIALOG_DRC::updateUI()
{

View File

@ -71,7 +71,6 @@ private:
*/
bool writeReport( const wxString& aFullFileName );
void initValues();
void syncCheckboxes();
void updateDisplayedCounts();

View File

@ -48,7 +48,7 @@
<property name="size">-1,-1</property>
<property name="style">wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER</property>
<property name="subclass">DIALOG_SHIM; dialog_shim.h</property>
<property name="title">DRC Control</property>
<property name="title">Design Rules Checker</property>
<property name="tooltip"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>

View File

@ -103,7 +103,7 @@ class DIALOG_DRC_BASE : public DIALOG_SHIM
public:
DIALOG_DRC_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("DRC Control"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
DIALOG_DRC_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Design Rules Checker"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
~DIALOG_DRC_BASE();
};

View File

@ -417,7 +417,7 @@ int DRC_ITEMS_PROVIDER::GetCount( int aSeverity ) const
if( marker->GetMarkerType() != m_markerType )
continue;
if( marker->GetSeverity() == aSeverity )
if( ( marker->GetSeverity() & aSeverity ) > 0 )
count++;
}

View File

@ -42,6 +42,7 @@ class PCB_MARKER : public BOARD_ITEM, public MARKER_BASE
{
public:
PCB_MARKER( std::shared_ptr<RC_ITEM> aItem, const VECTOR2I& aPos, PCB_LAYER_ID aLayer = F_Cu );
~PCB_MARKER();
static inline bool ClassOf( const EDA_ITEM* aItem )