From b1cdcca9e6770e0396243ecbf9d94b31bd2ae4e2 Mon Sep 17 00:00:00 2001 From: Jeff Young Date: Mon, 19 Jun 2023 23:53:25 +0100 Subject: [PATCH] Use hypertext link for Edit Ingored Tests in both ERC and DRC. Fixes https://gitlab.com/kicad/code/kicad/-/issues/15010 --- eeschema/dialogs/dialog_erc.cpp | 15 +-- eeschema/dialogs/dialog_erc.h | 2 +- eeschema/dialogs/dialog_erc_base.cpp | 19 +++- eeschema/dialogs/dialog_erc_base.fbp | 143 +++++++++++++++++++++------ eeschema/dialogs/dialog_erc_base.h | 4 +- pcbnew/dialogs/dialog_drc.cpp | 2 + pcbnew/dialogs/dialog_drc_base.cpp | 13 ++- pcbnew/dialogs/dialog_drc_base.fbp | 34 ++++++- 8 files changed, 180 insertions(+), 52 deletions(-) diff --git a/eeschema/dialogs/dialog_erc.cpp b/eeschema/dialogs/dialog_erc.cpp index 184a3cd1d8..7c3c26cb51 100644 --- a/eeschema/dialogs/dialog_erc.cpp +++ b/eeschema/dialogs/dialog_erc.cpp @@ -394,6 +394,8 @@ void DIALOG_ERC::OnRunERCClick( wxCommandEvent& event ) } } + m_ignoredList->SetColumnWidth( 0, m_ignoredList->GetParent()->GetClientSize().x - 20 ); + Raise(); m_runningResultsBook->ChangeSelection( 0 ); // Display the "Tests Running..." tab @@ -911,18 +913,9 @@ void DIALOG_ERC::ExcludeMarker( SCH_MARKER* aMarker ) } -void DIALOG_ERC::OnIgnoreItemRClick( wxListEvent& event ) +void DIALOG_ERC::OnEditViolationSeverities( wxHyperlinkEvent& aEvent ) { - wxMenu menu; - - menu.Append( 1, _( "Edit ignored violations..." ), _( "Open the Schematic Setup... dialog" ) ); - - switch( GetPopupMenuSelectionFromUser( menu ) ) - { - case 1: - m_parent->ShowSchematicSetupDialog( _( "Violation Severity" ) ); - break; - } + m_parent->ShowSchematicSetupDialog( _( "Violation Severity" ) ); } diff --git a/eeschema/dialogs/dialog_erc.h b/eeschema/dialogs/dialog_erc.h index 42e051c518..3bc539bbfa 100644 --- a/eeschema/dialogs/dialog_erc.h +++ b/eeschema/dialogs/dialog_erc.h @@ -79,7 +79,7 @@ private: void OnERCItemSelected( wxDataViewEvent& aEvent ) override; void OnERCItemDClick( wxDataViewEvent& aEvent ) override; void OnERCItemRClick( wxDataViewEvent& aEvent ) override; - void OnIgnoreItemRClick( wxListEvent& event ) override; + void OnEditViolationSeverities( wxHyperlinkEvent& aEvent ) override; void OnLinkClicked( wxHtmlLinkEvent& event ) override; diff --git a/eeschema/dialogs/dialog_erc_base.cpp b/eeschema/dialogs/dialog_erc_base.cpp index 2ed3c4e9f2..37feadc8a4 100644 --- a/eeschema/dialogs/dialog_erc_base.cpp +++ b/eeschema/dialogs/dialog_erc_base.cpp @@ -58,7 +58,7 @@ DIALOG_ERC_BASE::DIALOG_ERC_BASE( wxWindow* parent, wxWindowID id, const wxStrin bSizer10->Fit( m_panelMessages ); m_runningNotebook->AddPage( m_panelMessages, _("Tests Running..."), true ); - bSizer14->Add( m_runningNotebook, 1, wxEXPAND | wxALL, 5 ); + bSizer14->Add( m_runningNotebook, 1, wxEXPAND, 5 ); running->SetSizer( bSizer14 ); @@ -78,7 +78,10 @@ DIALOG_ERC_BASE::DIALOG_ERC_BASE( wxWindow* parent, wxWindowID id, const wxStrin m_markerDataView->SetToolTip( _("Click on items to highlight them on the board.") ); m_markerDataView->SetMinSize( wxSize( 640,260 ) ); - bViolationsSizer->Add( m_markerDataView, 2, wxBOTTOM|wxEXPAND|wxLEFT|wxRIGHT, 5 ); + bViolationsSizer->Add( m_markerDataView, 2, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 ); + + + bViolationsSizer->Add( 0, 8, 0, wxEXPAND, 5 ); violationsPanel->SetSizer( bViolationsSizer ); @@ -90,7 +93,13 @@ DIALOG_ERC_BASE::DIALOG_ERC_BASE( wxWindow* parent, wxWindowID id, const wxStrin 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 ); + bSizer15->Add( m_ignoredList, 1, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 ); + + m_violationSeveritiesLink = new wxHyperlinkCtrl( m_panelIgnored, wxID_ANY, _("Edit ignored tests"), wxEmptyString, wxDefaultPosition, wxDefaultSize, wxHL_DEFAULT_STYLE ); + bSizer15->Add( m_violationSeveritiesLink, 0, wxBOTTOM|wxRIGHT|wxLEFT, 5 ); + + + bSizer15->Add( 0, 8, 0, wxEXPAND, 5 ); m_panelIgnored->SetSizer( bSizer15 ); @@ -191,7 +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::OnIgnoreItemRClick ), 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 ); m_showWarnings->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_ERC_BASE::OnSeverity ), NULL, this ); @@ -211,7 +220,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::OnIgnoreItemRClick ), 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 ); m_showWarnings->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_ERC_BASE::OnSeverity ), NULL, this ); diff --git a/eeschema/dialogs/dialog_erc_base.fbp b/eeschema/dialogs/dialog_erc_base.fbp index a8dcc95bb9..fe82138e40 100644 --- a/eeschema/dialogs/dialog_erc_base.fbp +++ b/eeschema/dialogs/dialog_erc_base.fbp @@ -122,20 +122,20 @@ - + 5 wxEXPAND|wxALL 1 - + bMainSizer wxVERTICAL none - + 5 wxEXPAND|wxTOP|wxRIGHT 1 - + 1 1 1 @@ -186,10 +186,10 @@ - + a page 0 - + 1 1 1 @@ -240,14 +240,14 @@ wxTAB_TRAVERSAL - + bSizer14 wxVERTICAL none 5 - wxEXPAND | wxALL + wxEXPAND 1 1 @@ -504,10 +504,10 @@ - + a page 1 - + 1 1 1 @@ -558,16 +558,16 @@ wxTAB_TRAVERSAL - + bSizer13 wxVERTICAL none - + 5 wxEXPAND 1 - + 1 1 1 @@ -620,11 +620,11 @@ - + Violations (%s) 0 - + 1 1 1 @@ -675,14 +675,14 @@ wxTAB_TRAVERSAL - + bViolationsSizer wxVERTICAL none 5 - wxBOTTOM|wxEXPAND|wxLEFT|wxRIGHT + wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT 2 @@ -710,14 +710,24 @@ OnERCItemSelected + + 5 + wxEXPAND + 0 + + 8 + protected + 0 + + - + Ignored Tests (%s) 0 - + 1 1 1 @@ -768,16 +778,16 @@ wxTAB_TRAVERSAL - + bSizer15 wxVERTICAL none - + 5 - wxALL|wxEXPAND + wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT 1 - + 1 1 1 @@ -833,7 +843,80 @@ - OnIgnoreItemRClick + + + + 5 + wxBOTTOM|wxRIGHT|wxLEFT + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + + wxID_ANY + Edit ignored tests + + 0 + + + 0 + + 1 + m_violationSeveritiesLink + + 1 + + + protected + 1 + + Resizable + 1 + + wxHL_DEFAULT_STYLE + ; ; forward_declare + 0 + + + + + + + OnEditViolationSeverities + + + + 5 + wxEXPAND + 0 + + 8 + protected + 0 @@ -846,20 +929,20 @@ - + 5 wxEXPAND|wxRIGHT|wxLEFT 0 - + bSizer11 wxVERTICAL none - + 5 wxEXPAND|wxALL 0 - + bSeveritySizer wxHORIZONTAL @@ -1471,11 +1554,11 @@ - + 10 wxEXPAND|wxLEFT 0 - + m_buttonsSizer wxHORIZONTAL diff --git a/eeschema/dialogs/dialog_erc_base.h b/eeschema/dialogs/dialog_erc_base.h index dd5b3d9e29..92592fd3e8 100644 --- a/eeschema/dialogs/dialog_erc_base.h +++ b/eeschema/dialogs/dialog_erc_base.h @@ -30,6 +30,7 @@ class WX_INFOBAR; #include #include #include +#include #include #include #include @@ -62,6 +63,7 @@ class DIALOG_ERC_BASE : public DIALOG_SHIM wxDataViewCtrl* m_markerDataView; wxPanel* m_panelIgnored; wxListCtrl* m_ignoredList; + wxHyperlinkCtrl* m_violationSeveritiesLink; wxStaticText* m_showLabel; wxCheckBox* m_showAll; wxCheckBox* m_showErrors; @@ -84,7 +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 OnIgnoreItemRClick( 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(); } virtual void OnDeleteOneClick( wxCommandEvent& event ) { event.Skip(); } diff --git a/pcbnew/dialogs/dialog_drc.cpp b/pcbnew/dialogs/dialog_drc.cpp index 32f87e262d..24c5be1cb3 100644 --- a/pcbnew/dialogs/dialog_drc.cpp +++ b/pcbnew/dialogs/dialog_drc.cpp @@ -286,6 +286,8 @@ void DIALOG_DRC::OnRunDRCClick( wxCommandEvent& aEvent ) } } + m_ignoredList->SetColumnWidth( 0, m_ignoredList->GetParent()->GetClientSize().x - 20 ); + Raise(); m_runningResultsBook->ChangeSelection( 0 ); // Display the "Tests Running..." tab diff --git a/pcbnew/dialogs/dialog_drc_base.cpp b/pcbnew/dialogs/dialog_drc_base.cpp index bd484a297d..d864854566 100644 --- a/pcbnew/dialogs/dialog_drc_base.cpp +++ b/pcbnew/dialogs/dialog_drc_base.cpp @@ -76,7 +76,7 @@ DIALOG_DRC_BASE::DIALOG_DRC_BASE( wxWindow* parent, wxWindowID id, const wxStrin bSizer10->Fit( m_panelMessages ); m_runningNotebook->AddPage( m_panelMessages, _("Tests Running..."), true ); - bSizer14->Add( m_runningNotebook, 1, wxEXPAND | wxALL, 5 ); + bSizer14->Add( m_runningNotebook, 1, wxEXPAND, 5 ); running->SetSizer( bSizer14 ); @@ -101,6 +101,9 @@ DIALOG_DRC_BASE::DIALOG_DRC_BASE( wxWindow* parent, wxWindowID id, const wxStrin bSizerViolationsBox->Add( m_markerDataView, 1, wxALL|wxEXPAND, 5 ); + bSizerViolationsBox->Add( 0, 8, 0, wxEXPAND, 5 ); + + m_panelViolations->SetSizer( bSizerViolationsBox ); m_panelViolations->Layout(); bSizerViolationsBox->Fit( m_panelViolations ); @@ -113,6 +116,9 @@ DIALOG_DRC_BASE::DIALOG_DRC_BASE( wxWindow* parent, wxWindowID id, const wxStrin bSizerUnconnectedBox->Add( m_unconnectedDataView, 1, wxALL|wxEXPAND, 5 ); + bSizerUnconnectedBox->Add( 0, 8, 0, wxEXPAND, 5 ); + + m_panelUnconnectedItems->SetSizer( bSizerUnconnectedBox ); m_panelUnconnectedItems->Layout(); bSizerUnconnectedBox->Fit( m_panelUnconnectedItems ); @@ -125,6 +131,9 @@ DIALOG_DRC_BASE::DIALOG_DRC_BASE( wxWindow* parent, wxWindowID id, const wxStrin bSizerFootprintsBox->Add( m_footprintsDataView, 1, wxALL|wxEXPAND, 5 ); + bSizerFootprintsBox->Add( 0, 8, 0, wxEXPAND, 5 ); + + m_panelFootprintWarnings->SetSizer( bSizerFootprintsBox ); m_panelFootprintWarnings->Layout(); bSizerFootprintsBox->Fit( m_panelFootprintWarnings ); @@ -140,7 +149,7 @@ DIALOG_DRC_BASE::DIALOG_DRC_BASE( wxWindow* parent, wxWindowID id, const wxStrin bSizer15->Add( m_violationSeveritiesLink, 0, wxBOTTOM|wxRIGHT|wxLEFT, 5 ); - bSizer15->Add( 0, 5, 0, wxEXPAND, 5 ); + bSizer15->Add( 0, 7, 0, wxEXPAND, 5 ); m_panelIgnored->SetSizer( bSizer15 ); diff --git a/pcbnew/dialogs/dialog_drc_base.fbp b/pcbnew/dialogs/dialog_drc_base.fbp index eea18055f0..0fa03b1c9b 100644 --- a/pcbnew/dialogs/dialog_drc_base.fbp +++ b/pcbnew/dialogs/dialog_drc_base.fbp @@ -404,7 +404,7 @@ none 5 - wxEXPAND | wxALL + wxEXPAND 1 1 @@ -868,6 +868,16 @@ OnDRCItemSelected + + 5 + wxEXPAND + 0 + + 8 + protected + 0 + + @@ -961,6 +971,16 @@ OnDRCItemSelected + + 5 + wxEXPAND + 0 + + 8 + protected + 0 + + @@ -1054,6 +1074,16 @@ OnDRCItemSelected + + 5 + wxEXPAND + 0 + + 8 + protected + 0 + + @@ -1248,7 +1278,7 @@ wxEXPAND 0 - 5 + 7 protected 0