Pointer safety for ERC/DRC dialogs.
Also makes the "Edit ingored violations" easier to find. Fixes https://gitlab.com/kicad/code/kicad/issues/12308
This commit is contained in:
parent
2bcfe5e42c
commit
63386ba64d
|
@ -180,22 +180,19 @@ RC_TREE_MODEL::RC_TREE_MODEL( EDA_DRAW_FRAME* aParentFrame, wxDataViewCtrl* aVie
|
|||
m_severities( 0 ),
|
||||
m_rcItemsProvider( nullptr )
|
||||
{
|
||||
m_view->GetMainWindow()->Connect( wxEVT_SIZE,
|
||||
wxSizeEventHandler( RC_TREE_MODEL::onSizeView ),
|
||||
m_view->GetMainWindow()->Connect( wxEVT_SIZE, wxSizeEventHandler( RC_TREE_MODEL::onSizeView ),
|
||||
nullptr, this );
|
||||
}
|
||||
|
||||
|
||||
RC_TREE_MODEL::~RC_TREE_MODEL()
|
||||
{
|
||||
delete m_rcItemsProvider;
|
||||
|
||||
for( RC_TREE_NODE* topLevelNode : m_tree )
|
||||
delete topLevelNode;
|
||||
}
|
||||
|
||||
|
||||
void RC_TREE_MODEL::rebuildModel( RC_ITEMS_PROVIDER* aProvider, int aSeverities )
|
||||
void RC_TREE_MODEL::rebuildModel( std::shared_ptr<RC_ITEMS_PROVIDER> aProvider, int aSeverities )
|
||||
{
|
||||
wxWindowUpdateLocker updateLock( m_view );
|
||||
|
||||
|
@ -213,11 +210,7 @@ void RC_TREE_MODEL::rebuildModel( RC_ITEMS_PROVIDER* aProvider, int aSeverities
|
|||
|
||||
BeforeReset();
|
||||
|
||||
if( aProvider != m_rcItemsProvider )
|
||||
{
|
||||
delete m_rcItemsProvider;
|
||||
m_rcItemsProvider = aProvider;
|
||||
}
|
||||
m_rcItemsProvider = aProvider;
|
||||
|
||||
if( aSeverities != m_severities )
|
||||
m_severities = aSeverities;
|
||||
|
@ -292,15 +285,9 @@ void RC_TREE_MODEL::rebuildModel( RC_ITEMS_PROVIDER* aProvider, int aSeverities
|
|||
}
|
||||
|
||||
|
||||
void RC_TREE_MODEL::SetProvider( RC_ITEMS_PROVIDER* aProvider )
|
||||
void RC_TREE_MODEL::Update( std::shared_ptr<RC_ITEMS_PROVIDER> aProvider, int aSeverities )
|
||||
{
|
||||
rebuildModel( aProvider, m_severities );
|
||||
}
|
||||
|
||||
|
||||
void RC_TREE_MODEL::SetSeverities( int aSeverities )
|
||||
{
|
||||
rebuildModel( m_rcItemsProvider, aSeverities );
|
||||
rebuildModel( aProvider, aSeverities );
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
*
|
||||
* Copyright (C) 2015 Jean-Pierre Charras, jp.charras at wanadoo.fr
|
||||
* Copyright (C) 2012 Wayne Stambaugh <stambaughw@gmail.com>
|
||||
* 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
|
||||
|
@ -29,7 +29,6 @@
|
|||
#include <schematic.h>
|
||||
#include <project.h>
|
||||
#include <kiface_base.h>
|
||||
#include <bitmaps.h>
|
||||
#include <reporter.h>
|
||||
#include <wildcards_and_files_ext.h>
|
||||
#include <sch_marker.h>
|
||||
|
@ -64,10 +63,11 @@ DIALOG_ERC::DIALOG_ERC( SCH_EDIT_FRAME* parent ) :
|
|||
DIALOG_ERC_BASE( parent ),
|
||||
PROGRESS_REPORTER_BASE( 1 ),
|
||||
m_parent( parent ),
|
||||
m_markerTreeModel( nullptr ),
|
||||
m_running( false ),
|
||||
m_ercRun( false ),
|
||||
m_centerMarkerOnIdle( nullptr ),
|
||||
m_severities( RPT_SEVERITY_ERROR | RPT_SEVERITY_WARNING )
|
||||
m_severities( 0 )
|
||||
{
|
||||
m_currentSchematic = &parent->Schematic();
|
||||
|
||||
|
@ -78,12 +78,11 @@ DIALOG_ERC::DIALOG_ERC( SCH_EDIT_FRAME* parent ) :
|
|||
|
||||
m_messages->SetImmediateMode();
|
||||
|
||||
m_markerProvider = new SHEETLIST_ERC_ITEMS_PROVIDER( &m_parent->Schematic() );
|
||||
m_markerProvider = std::make_shared<SHEETLIST_ERC_ITEMS_PROVIDER>( &m_parent->Schematic() );
|
||||
|
||||
m_markerTreeModel = new RC_TREE_MODEL( parent, m_markerDataView );
|
||||
m_markerDataView->AssociateModel( m_markerTreeModel );
|
||||
|
||||
m_markerTreeModel->SetSeverities( m_severities );
|
||||
m_markerTreeModel->SetProvider( m_markerProvider );
|
||||
m_markerTreeModel->Update( m_markerProvider, m_severities );
|
||||
|
||||
m_ignoredList->InsertColumn( 0, wxEmptyString, wxLIST_FORMAT_LEFT, DEFAULT_SINGLE_COL_WIDTH );
|
||||
|
||||
|
@ -540,8 +539,8 @@ void DIALOG_ERC::testErc()
|
|||
|
||||
m_parent->ResolveERCExclusions();
|
||||
|
||||
// Display diags:
|
||||
m_markerTreeModel->SetProvider( m_markerProvider );
|
||||
// Update marker list:
|
||||
m_markerTreeModel->Update( m_markerProvider, m_severities );
|
||||
|
||||
// Display new markers from the current screen:
|
||||
for( SCH_ITEM* marker : m_parent->GetScreen()->Items().OfType( SCH_MARKER_T ) )
|
||||
|
@ -720,7 +719,7 @@ void DIALOG_ERC::OnERCItemRClick( wxDataViewEvent& aEvent )
|
|||
}
|
||||
|
||||
// Rebuild model and view
|
||||
static_cast<RC_TREE_MODEL*>( aEvent.GetModel() )->SetProvider( m_markerProvider );
|
||||
static_cast<RC_TREE_MODEL*>( aEvent.GetModel() )->Update( m_markerProvider, m_severities );
|
||||
modified = true;
|
||||
break;
|
||||
|
||||
|
@ -736,7 +735,7 @@ void DIALOG_ERC::OnERCItemRClick( wxDataViewEvent& aEvent )
|
|||
}
|
||||
|
||||
// Rebuild model and view
|
||||
static_cast<RC_TREE_MODEL*>( aEvent.GetModel() )->SetProvider( m_markerProvider );
|
||||
static_cast<RC_TREE_MODEL*>( aEvent.GetModel() )->Update( m_markerProvider, m_severities );
|
||||
modified = true;
|
||||
break;
|
||||
|
||||
|
@ -751,7 +750,7 @@ void DIALOG_ERC::OnERCItemRClick( wxDataViewEvent& aEvent )
|
|||
ScreenList.DeleteMarkers( MARKER_BASE::MARKER_ERC, rcItem->GetErrorCode() );
|
||||
|
||||
// Rebuild model and view
|
||||
static_cast<RC_TREE_MODEL*>( aEvent.GetModel() )->SetProvider( m_markerProvider );
|
||||
static_cast<RC_TREE_MODEL*>( aEvent.GetModel() )->Update( m_markerProvider, m_severities );
|
||||
modified = true;
|
||||
}
|
||||
break;
|
||||
|
@ -891,14 +890,7 @@ void DIALOG_ERC::OnSeverity( wxCommandEvent& aEvent )
|
|||
|
||||
syncCheckboxes();
|
||||
|
||||
// Set the provider's severity levels through the TreeModel so that the old tree
|
||||
// can be torn down before the severity changes.
|
||||
//
|
||||
// It's not clear this is required, but we've had a lot of issues with wxDataView
|
||||
// being cranky on various platforms.
|
||||
|
||||
m_markerTreeModel->SetSeverities( m_severities );
|
||||
|
||||
m_markerTreeModel->Update( m_markerProvider, m_severities );
|
||||
updateDisplayedCounts();
|
||||
}
|
||||
|
||||
|
|
|
@ -102,8 +102,8 @@ private:
|
|||
wxString m_violationsTitleTemplate;
|
||||
wxString m_ignoredTitleTemplate;
|
||||
|
||||
RC_ITEMS_PROVIDER* m_markerProvider;
|
||||
RC_TREE_MODEL* m_markerTreeModel;
|
||||
std::shared_ptr<RC_ITEMS_PROVIDER> m_markerProvider;
|
||||
RC_TREE_MODEL* m_markerTreeModel; // wx reference-counted ptr
|
||||
|
||||
bool m_running;
|
||||
bool m_ercRun;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2020 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
* Copyright (C) 2020-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
|
||||
|
@ -136,10 +136,15 @@ public:
|
|||
void SetErrorCode( int aCode ) { m_errorCode = aCode; }
|
||||
|
||||
/**
|
||||
* Return the error message of a RC_ITEM.
|
||||
* @return the error message describing the specific details of a RC_ITEM. For instance,
|
||||
* "Clearance violation (netclass '100ohm' clearance 0.4000mm; actual 0.3200mm)"
|
||||
*/
|
||||
virtual wxString GetErrorMessage() const;
|
||||
|
||||
/**
|
||||
* @return the error text for the class of error of this RC_ITEM represents. For instance,
|
||||
* "Clearance violation".
|
||||
*/
|
||||
wxString GetErrorText() const
|
||||
{
|
||||
return wxGetTranslation( m_errorTitle );
|
||||
|
@ -216,10 +221,7 @@ public:
|
|||
|
||||
~RC_TREE_MODEL();
|
||||
|
||||
void SetProvider( RC_ITEMS_PROVIDER* aProvider );
|
||||
void SetSeverities( int aSeverities );
|
||||
|
||||
int GetDRCItemCount() const { return m_tree.size(); }
|
||||
void Update( std::shared_ptr<RC_ITEMS_PROVIDER> aProvider, int aSeverities );
|
||||
|
||||
void ExpandAll();
|
||||
|
||||
|
@ -274,15 +276,15 @@ public:
|
|||
void DeleteItems( bool aCurrentOnly, bool aIncludeExclusions, bool aDeep );
|
||||
|
||||
private:
|
||||
void rebuildModel( RC_ITEMS_PROVIDER* aProvider, int aSeverities );
|
||||
void rebuildModel( std::shared_ptr<RC_ITEMS_PROVIDER> aProvider, int aSeverities );
|
||||
void onSizeView( wxSizeEvent& aEvent );
|
||||
|
||||
EDA_DRAW_FRAME* m_editFrame;
|
||||
wxDataViewCtrl* m_view;
|
||||
int m_severities;
|
||||
RC_ITEMS_PROVIDER* m_rcItemsProvider; // I own this, but not its contents
|
||||
EDA_DRAW_FRAME* m_editFrame;
|
||||
wxDataViewCtrl* m_view;
|
||||
int m_severities;
|
||||
std::shared_ptr<RC_ITEMS_PROVIDER> m_rcItemsProvider;
|
||||
|
||||
std::vector<RC_TREE_NODE*> m_tree; // I own this
|
||||
std::vector<RC_TREE_NODE*> m_tree; // I own this
|
||||
};
|
||||
|
||||
#endif // RC_ITEM_H
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2020 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
* Copyright (C) 2020-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
|
||||
|
@ -39,8 +39,6 @@ DIALOG_CLEANUP_GRAPHICS::DIALOG_CLEANUP_GRAPHICS( PCB_BASE_FRAME* aParent,
|
|||
m_changesTreeModel = new RC_TREE_MODEL( m_parentFrame, m_changesDataView );
|
||||
m_changesDataView->AssociateModel( m_changesTreeModel );
|
||||
|
||||
m_changesTreeModel->SetSeverities( RPT_SEVERITY_ACTION );
|
||||
|
||||
if( aIsFootprintEditor )
|
||||
SetupStandardButtons( { { wxID_OK, _( "Update Footprint" ) } } );
|
||||
else
|
||||
|
@ -94,7 +92,7 @@ void DIALOG_CLEANUP_GRAPHICS::doCleanup( bool aDryRun )
|
|||
m_parentFrame->GetToolManager()->RunAction( PCB_ACTIONS::selectionClear, true );
|
||||
|
||||
// ... and to keep the treeModel from trying to refresh a deleted item
|
||||
m_changesTreeModel->SetProvider( nullptr );
|
||||
m_changesTreeModel->Update( nullptr, RPT_SEVERITY_ACTION );
|
||||
}
|
||||
|
||||
m_items.clear();
|
||||
|
@ -107,8 +105,8 @@ void DIALOG_CLEANUP_GRAPHICS::doCleanup( bool aDryRun )
|
|||
|
||||
if( aDryRun )
|
||||
{
|
||||
RC_ITEMS_PROVIDER* provider = new VECTOR_CLEANUP_ITEMS_PROVIDER( &m_items );
|
||||
m_changesTreeModel->SetProvider( provider );
|
||||
m_changesTreeModel->Update( std::make_shared<VECTOR_CLEANUP_ITEMS_PROVIDER>( &m_items ),
|
||||
RPT_SEVERITY_ACTION );
|
||||
}
|
||||
else if( !commit.Empty() )
|
||||
{
|
||||
|
|
|
@ -50,8 +50,6 @@ DIALOG_CLEANUP_TRACKS_AND_VIAS::DIALOG_CLEANUP_TRACKS_AND_VIAS( PCB_EDIT_FRAME*
|
|||
m_changesTreeModel = new RC_TREE_MODEL( m_parentFrame, m_changesDataView );
|
||||
m_changesDataView->AssociateModel( m_changesTreeModel );
|
||||
|
||||
m_changesTreeModel->SetSeverities( RPT_SEVERITY_ACTION );
|
||||
|
||||
setupOKButtonLabel();
|
||||
|
||||
m_sdbSizer->SetSizeHints( this );
|
||||
|
@ -123,7 +121,7 @@ void DIALOG_CLEANUP_TRACKS_AND_VIAS::doCleanup( bool aDryRun )
|
|||
m_parentFrame->GetToolManager()->RunAction( PCB_ACTIONS::selectionClear, true );
|
||||
|
||||
// ... and to keep the treeModel from trying to refresh a deleted item
|
||||
m_changesTreeModel->SetProvider( nullptr );
|
||||
m_changesTreeModel->Update( nullptr, RPT_SEVERITY_ACTION );
|
||||
}
|
||||
|
||||
m_items.clear();
|
||||
|
@ -152,8 +150,8 @@ void DIALOG_CLEANUP_TRACKS_AND_VIAS::doCleanup( bool aDryRun )
|
|||
|
||||
if( aDryRun )
|
||||
{
|
||||
RC_ITEMS_PROVIDER* provider = new VECTOR_CLEANUP_ITEMS_PROVIDER( &m_items );
|
||||
m_changesTreeModel->SetProvider( provider );
|
||||
m_changesTreeModel->Update( std::make_shared<VECTOR_CLEANUP_ITEMS_PROVIDER>( &m_items ),
|
||||
RPT_SEVERITY_ACTION );
|
||||
}
|
||||
else if( !commit.Empty() )
|
||||
{
|
||||
|
|
|
@ -69,12 +69,9 @@ DIALOG_DRC::DIALOG_DRC( PCB_EDIT_FRAME* aEditorFrame, wxWindow* aParent ) :
|
|||
m_cancelled( false ),
|
||||
m_drcRun( false ),
|
||||
m_footprintTestsRun( false ),
|
||||
m_markersProvider( nullptr ),
|
||||
m_markersTreeModel( nullptr ),
|
||||
m_unconnectedItemsProvider( nullptr ),
|
||||
m_unconnectedTreeModel( nullptr ),
|
||||
m_footprintWarningsProvider( nullptr ),
|
||||
m_footprintWarningsTreeModel( nullptr ),
|
||||
m_fpWarningsTreeModel( nullptr ),
|
||||
m_centerMarkerOnIdle( nullptr ),
|
||||
m_severities( RPT_SEVERITY_ERROR | RPT_SEVERITY_WARNING )
|
||||
{
|
||||
|
@ -85,14 +82,30 @@ DIALOG_DRC::DIALOG_DRC( PCB_EDIT_FRAME* aEditorFrame, wxWindow* aParent ) :
|
|||
|
||||
m_messages->SetImmediateMode();
|
||||
|
||||
PCBNEW_SETTINGS* cfg = m_frame->GetPcbNewSettings();
|
||||
m_severities = cfg->m_DrcDialog.severities;
|
||||
|
||||
m_markersProvider = std::make_shared<DRC_ITEMS_PROVIDER>( m_currentBoard,
|
||||
MARKER_BASE::MARKER_DRC,
|
||||
MARKER_BASE::MARKER_DRAWING_SHEET );
|
||||
|
||||
m_ratsnestProvider = std::make_shared<DRC_ITEMS_PROVIDER>( m_currentBoard,
|
||||
MARKER_BASE::MARKER_RATSNEST );
|
||||
|
||||
m_fpWarningsProvider = std::make_shared<DRC_ITEMS_PROVIDER>( m_currentBoard,
|
||||
MARKER_BASE::MARKER_PARITY );
|
||||
|
||||
m_markersTreeModel = new RC_TREE_MODEL( m_frame, m_markerDataView );
|
||||
m_markerDataView->AssociateModel( m_markersTreeModel );
|
||||
m_markersTreeModel->Update( m_markersProvider, m_severities );
|
||||
|
||||
m_unconnectedTreeModel = new RC_TREE_MODEL( m_frame, m_unconnectedDataView );
|
||||
m_unconnectedDataView->AssociateModel( m_unconnectedTreeModel );
|
||||
m_unconnectedTreeModel->Update( m_ratsnestProvider, m_severities );
|
||||
|
||||
m_footprintWarningsTreeModel = new RC_TREE_MODEL( m_frame, m_footprintsDataView );
|
||||
m_footprintsDataView->AssociateModel( m_footprintWarningsTreeModel );
|
||||
m_fpWarningsTreeModel = new RC_TREE_MODEL( m_frame, m_footprintsDataView );
|
||||
m_footprintsDataView->AssociateModel( m_fpWarningsTreeModel );
|
||||
m_fpWarningsTreeModel->Update( m_fpWarningsProvider, m_severities );
|
||||
|
||||
m_ignoredList->InsertColumn( 0, wxEmptyString, wxLIST_FORMAT_LEFT, DEFAULT_SINGLE_COL_WIDTH );
|
||||
|
||||
|
@ -118,19 +131,12 @@ DIALOG_DRC::DIALOG_DRC( PCB_EDIT_FRAME* aEditorFrame, wxWindow* aParent ) :
|
|||
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();
|
||||
|
@ -164,6 +170,8 @@ DIALOG_DRC::~DIALOG_DRC()
|
|||
settings->m_DrcDialog.severities = m_severities;
|
||||
|
||||
m_markersTreeModel->DecRef();
|
||||
m_unconnectedTreeModel->DecRef();
|
||||
m_fpWarningsTreeModel->DecRef();
|
||||
}
|
||||
|
||||
|
||||
|
@ -325,26 +333,12 @@ void DIALOG_DRC::OnRunDRCClick( wxCommandEvent& aEvent )
|
|||
}
|
||||
|
||||
|
||||
void DIALOG_DRC::SetMarkersProvider( RC_ITEMS_PROVIDER* aProvider )
|
||||
void DIALOG_DRC::UpdateData()
|
||||
{
|
||||
m_markersProvider = aProvider;
|
||||
m_markersTreeModel->SetProvider( m_markersProvider );
|
||||
updateDisplayedCounts();
|
||||
}
|
||||
m_markersTreeModel->Update( m_markersProvider, m_severities );
|
||||
m_unconnectedTreeModel->Update( m_ratsnestProvider, m_severities );
|
||||
m_fpWarningsTreeModel->Update( m_fpWarningsProvider, m_severities );
|
||||
|
||||
|
||||
void DIALOG_DRC::SetRatsnestProvider( class RC_ITEMS_PROVIDER * aProvider )
|
||||
{
|
||||
m_unconnectedItemsProvider = aProvider;
|
||||
m_unconnectedTreeModel->SetProvider( m_unconnectedItemsProvider );
|
||||
updateDisplayedCounts();
|
||||
}
|
||||
|
||||
|
||||
void DIALOG_DRC::SetFootprintsProvider( RC_ITEMS_PROVIDER* aProvider )
|
||||
{
|
||||
m_footprintWarningsProvider = aProvider;
|
||||
m_footprintWarningsTreeModel->SetProvider( m_footprintWarningsProvider );
|
||||
updateDisplayedCounts();
|
||||
}
|
||||
|
||||
|
@ -704,7 +698,7 @@ void DIALOG_DRC::OnDRCItemRClick( wxDataViewEvent& aEvent )
|
|||
}
|
||||
|
||||
// Rebuild model and view
|
||||
static_cast<RC_TREE_MODEL*>( aEvent.GetModel() )->SetProvider( m_markersProvider );
|
||||
static_cast<RC_TREE_MODEL*>( aEvent.GetModel() )->Update( m_markersProvider, m_severities );
|
||||
modified = true;
|
||||
break;
|
||||
}
|
||||
|
@ -720,7 +714,7 @@ void DIALOG_DRC::OnDRCItemRClick( wxDataViewEvent& aEvent )
|
|||
}
|
||||
|
||||
// Rebuild model and view
|
||||
static_cast<RC_TREE_MODEL*>( aEvent.GetModel() )->SetProvider( m_markersProvider );
|
||||
static_cast<RC_TREE_MODEL*>( aEvent.GetModel() )->Update( m_markersProvider, m_severities );
|
||||
modified = true;
|
||||
break;
|
||||
}
|
||||
|
@ -744,7 +738,7 @@ void DIALOG_DRC::OnDRCItemRClick( wxDataViewEvent& aEvent )
|
|||
}
|
||||
|
||||
// Rebuild model and view
|
||||
static_cast<RC_TREE_MODEL*>( aEvent.GetModel() )->SetProvider( m_markersProvider );
|
||||
static_cast<RC_TREE_MODEL*>( aEvent.GetModel() )->Update( m_markersProvider, m_severities );
|
||||
modified = true;
|
||||
break;
|
||||
|
||||
|
@ -758,7 +752,7 @@ void DIALOG_DRC::OnDRCItemRClick( wxDataViewEvent& aEvent )
|
|||
}
|
||||
|
||||
// Rebuild model and view
|
||||
static_cast<RC_TREE_MODEL*>( aEvent.GetModel() )->SetProvider( m_markersProvider );
|
||||
static_cast<RC_TREE_MODEL*>( aEvent.GetModel() )->Update( m_markersProvider, m_severities );
|
||||
modified = true;
|
||||
break;
|
||||
|
||||
|
@ -788,7 +782,7 @@ void DIALOG_DRC::OnDRCItemRClick( wxDataViewEvent& aEvent )
|
|||
m_frame->GetCanvas()->RedrawRatsnest();
|
||||
|
||||
// Rebuild model and view
|
||||
static_cast<RC_TREE_MODEL*>( aEvent.GetModel() )->SetProvider( m_markersProvider );
|
||||
static_cast<RC_TREE_MODEL*>( aEvent.GetModel() )->Update( m_markersProvider, m_severities );
|
||||
modified = true;
|
||||
break;
|
||||
}
|
||||
|
@ -807,18 +801,9 @@ void DIALOG_DRC::OnDRCItemRClick( wxDataViewEvent& aEvent )
|
|||
}
|
||||
|
||||
|
||||
void DIALOG_DRC::OnIgnoreItemRClick( wxListEvent& event )
|
||||
void DIALOG_DRC::OnEditViolationSeverities( wxHyperlinkEvent& aEvent )
|
||||
{
|
||||
wxMenu menu;
|
||||
|
||||
menu.Append( 1, _( "Edit ignored violations..." ), _( "Open the Board Setup... dialog" ) );
|
||||
|
||||
switch( GetPopupMenuSelectionFromUser( menu ) )
|
||||
{
|
||||
case 1:
|
||||
m_frame->ShowBoardSetupDialog( _( "Violation Severity" ) );
|
||||
break;
|
||||
}
|
||||
m_frame->ShowBoardSetupDialog( _( "Violation Severity" ) );
|
||||
}
|
||||
|
||||
|
||||
|
@ -843,18 +828,7 @@ void DIALOG_DRC::OnSeverity( wxCommandEvent& aEvent )
|
|||
m_severities &= ~flag;
|
||||
|
||||
syncCheckboxes();
|
||||
|
||||
// Set the provider's severity levels through the TreeModel so that the old tree
|
||||
// can be torn down before the severity changes.
|
||||
//
|
||||
// It's not clear this is required, but we've had a lot of issues with wxDataView
|
||||
// being cranky on various platforms.
|
||||
|
||||
m_markersTreeModel->SetSeverities( m_severities );
|
||||
m_unconnectedTreeModel->SetSeverities( m_severities );
|
||||
m_footprintWarningsTreeModel->SetSeverities( m_severities );
|
||||
|
||||
updateDisplayedCounts();
|
||||
UpdateData();
|
||||
}
|
||||
|
||||
|
||||
|
@ -950,7 +924,7 @@ void DIALOG_DRC::PrevMarker()
|
|||
{
|
||||
case 0: m_markersTreeModel->PrevMarker(); break;
|
||||
case 1: m_unconnectedTreeModel->PrevMarker(); break;
|
||||
case 2: m_footprintWarningsTreeModel->PrevMarker(); break;
|
||||
case 2: m_fpWarningsTreeModel->PrevMarker(); break;
|
||||
case 3: break;
|
||||
}
|
||||
}
|
||||
|
@ -965,7 +939,7 @@ void DIALOG_DRC::NextMarker()
|
|||
{
|
||||
case 0: m_markersTreeModel->NextMarker(); break;
|
||||
case 1: m_unconnectedTreeModel->NextMarker(); break;
|
||||
case 2: m_footprintWarningsTreeModel->NextMarker(); break;
|
||||
case 2: m_fpWarningsTreeModel->NextMarker(); break;
|
||||
case 3: break;
|
||||
}
|
||||
}
|
||||
|
@ -1028,7 +1002,7 @@ void DIALOG_DRC::deleteAllMarkers( bool aIncludeExclusions )
|
|||
|
||||
m_markersTreeModel->DeleteItems( false, aIncludeExclusions, false );
|
||||
m_unconnectedTreeModel->DeleteItems( false, aIncludeExclusions, false );
|
||||
m_footprintWarningsTreeModel->DeleteItems( false, aIncludeExclusions, false );
|
||||
m_fpWarningsTreeModel->DeleteItems( false, aIncludeExclusions, false );
|
||||
|
||||
m_frame->GetBoard()->DeleteMARKERs( true, aIncludeExclusions );
|
||||
}
|
||||
|
@ -1069,25 +1043,25 @@ bool DIALOG_DRC::writeReport( const wxString& aFullFileName )
|
|||
fprintf( fp, "%s", TO_UTF8( item->ShowReport( units, severity, itemMap ) ) );
|
||||
}
|
||||
|
||||
count = m_unconnectedItemsProvider->GetCount();
|
||||
count = m_ratsnestProvider->GetCount();
|
||||
|
||||
fprintf( fp, "\n** Found %d unconnected pads **\n", count );
|
||||
|
||||
for( int i = 0; i < count; ++i )
|
||||
{
|
||||
const std::shared_ptr<RC_ITEM>& item = m_unconnectedItemsProvider->GetItem( i );
|
||||
const std::shared_ptr<RC_ITEM>& item = m_ratsnestProvider->GetItem( i );
|
||||
SEVERITY severity = bds.GetSeverity( item->GetErrorCode() );
|
||||
|
||||
fprintf( fp, "%s", TO_UTF8( item->ShowReport( units, severity, itemMap ) ) );
|
||||
}
|
||||
|
||||
count = m_footprintWarningsProvider->GetCount();
|
||||
count = m_fpWarningsProvider->GetCount();
|
||||
|
||||
fprintf( fp, "\n** Found %d Footprint errors **\n", count );
|
||||
|
||||
for( int i = 0; i < count; ++i )
|
||||
{
|
||||
const std::shared_ptr<RC_ITEM>& item = m_footprintWarningsProvider->GetItem( i );
|
||||
const std::shared_ptr<RC_ITEM>& item = m_fpWarningsProvider->GetItem( i );
|
||||
SEVERITY severity = bds.GetSeverity( item->GetErrorCode() );
|
||||
|
||||
fprintf( fp, "%s", TO_UTF8( item->ShowReport( units, severity, itemMap ) ) );
|
||||
|
@ -1120,7 +1094,7 @@ void DIALOG_DRC::OnDeleteOneClick( wxCommandEvent& aEvent )
|
|||
}
|
||||
else if( m_Notebook->GetSelection() == 2 )
|
||||
{
|
||||
m_footprintWarningsTreeModel->DeleteCurrentItem( true );
|
||||
m_fpWarningsTreeModel->DeleteCurrentItem( true );
|
||||
}
|
||||
|
||||
updateDisplayedCounts();
|
||||
|
@ -1136,11 +1110,11 @@ void DIALOG_DRC::OnDeleteAllClick( wxCommandEvent& aEvent )
|
|||
if( m_markersProvider )
|
||||
numExcluded += m_markersProvider->GetCount( RPT_SEVERITY_EXCLUSION );
|
||||
|
||||
if( m_unconnectedItemsProvider )
|
||||
numExcluded += m_unconnectedItemsProvider->GetCount( RPT_SEVERITY_EXCLUSION );
|
||||
if( m_ratsnestProvider )
|
||||
numExcluded += m_ratsnestProvider->GetCount( RPT_SEVERITY_EXCLUSION );
|
||||
|
||||
if( m_footprintWarningsProvider )
|
||||
numExcluded += m_footprintWarningsProvider->GetCount( RPT_SEVERITY_EXCLUSION );
|
||||
if( m_fpWarningsProvider )
|
||||
numExcluded += m_fpWarningsProvider->GetCount( RPT_SEVERITY_EXCLUSION );
|
||||
|
||||
if( numExcluded > 0 )
|
||||
{
|
||||
|
@ -1188,20 +1162,20 @@ void DIALOG_DRC::updateDisplayedCounts()
|
|||
numExcluded += m_markersProvider->GetCount( RPT_SEVERITY_EXCLUSION );
|
||||
}
|
||||
|
||||
if( m_unconnectedItemsProvider )
|
||||
if( m_ratsnestProvider )
|
||||
{
|
||||
numUnconnected += m_unconnectedItemsProvider->GetCount();
|
||||
numErrors += m_unconnectedItemsProvider->GetCount( RPT_SEVERITY_ERROR );
|
||||
numWarnings += m_unconnectedItemsProvider->GetCount( RPT_SEVERITY_WARNING );
|
||||
numExcluded += m_unconnectedItemsProvider->GetCount( RPT_SEVERITY_EXCLUSION );
|
||||
numUnconnected += m_ratsnestProvider->GetCount();
|
||||
numErrors += m_ratsnestProvider->GetCount( RPT_SEVERITY_ERROR );
|
||||
numWarnings += m_ratsnestProvider->GetCount( RPT_SEVERITY_WARNING );
|
||||
numExcluded += m_ratsnestProvider->GetCount( RPT_SEVERITY_EXCLUSION );
|
||||
}
|
||||
|
||||
if( m_footprintTestsRun && m_footprintWarningsProvider )
|
||||
if( m_footprintTestsRun && m_fpWarningsProvider )
|
||||
{
|
||||
numFootprints += m_footprintWarningsProvider->GetCount();
|
||||
numErrors += m_footprintWarningsProvider->GetCount( RPT_SEVERITY_ERROR );
|
||||
numWarnings += m_footprintWarningsProvider->GetCount( RPT_SEVERITY_WARNING );
|
||||
numExcluded += m_footprintWarningsProvider->GetCount( RPT_SEVERITY_EXCLUSION );
|
||||
numFootprints += m_fpWarningsProvider->GetCount();
|
||||
numErrors += m_fpWarningsProvider->GetCount( RPT_SEVERITY_ERROR );
|
||||
numWarnings += m_fpWarningsProvider->GetCount( RPT_SEVERITY_WARNING );
|
||||
numExcluded += m_fpWarningsProvider->GetCount( RPT_SEVERITY_EXCLUSION );
|
||||
}
|
||||
|
||||
bool errorsOverflowed = false;
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
*
|
||||
* Copyright (C) 2011 Jean-Pierre Charras, jean-pierre.charras@ujf-grenoble.fr
|
||||
* Copyright (C) 2009 Dick Hollenbeck, dick@softplc.com
|
||||
* Copyright (C) 2004-2020 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
* Copyright (C) 2004-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
|
||||
|
@ -48,12 +48,22 @@ public:
|
|||
DIALOG_DRC( PCB_EDIT_FRAME* aEditorFrame, wxWindow* aParent );
|
||||
~DIALOG_DRC();
|
||||
|
||||
/**
|
||||
* Called after running DRC. It's main function is prevent showing potentially-false-0
|
||||
* counts before DRC has been run.
|
||||
*/
|
||||
void SetDrcRun() { m_drcRun = true; }
|
||||
|
||||
/**
|
||||
* Called after running Footprint Tests. It's main function is to update the Footprint
|
||||
* Warnings tab title.
|
||||
*/
|
||||
void SetFootprintTestsRun() { m_footprintTestsRun = true; }
|
||||
|
||||
void SetMarkersProvider( RC_ITEMS_PROVIDER* aProvider );
|
||||
void SetRatsnestProvider( RC_ITEMS_PROVIDER* aProvider );
|
||||
void SetFootprintsProvider( RC_ITEMS_PROVIDER* aProvider );
|
||||
/**
|
||||
* Rebuild the contents of the violation tabs based on the current markers and severties.
|
||||
*/
|
||||
void UpdateData();
|
||||
|
||||
void PrevMarker();
|
||||
void NextMarker();
|
||||
|
@ -64,8 +74,7 @@ public:
|
|||
private:
|
||||
/**
|
||||
* Function writeReport
|
||||
* outputs the MARKER items and unconnecte DRC_ITEMs with commentary to an
|
||||
* open text file.
|
||||
* outputs the MARKER items with commentary to an open text file.
|
||||
* @param aFullFileName The text filename to write the report to.
|
||||
* @return true if OK, false on error
|
||||
*/
|
||||
|
@ -77,7 +86,7 @@ private:
|
|||
void OnDRCItemSelected( wxDataViewEvent& aEvent ) override;
|
||||
void OnDRCItemDClick( wxDataViewEvent& aEvent ) override;
|
||||
void OnDRCItemRClick( wxDataViewEvent& aEvent ) override;
|
||||
void OnIgnoreItemRClick( wxListEvent& event ) override;
|
||||
void OnEditViolationSeverities( wxHyperlinkEvent& aEvent ) override;
|
||||
|
||||
void OnSeverity( wxCommandEvent& aEvent ) override;
|
||||
void OnSaveReport( wxCommandEvent& aEvent ) override;
|
||||
|
@ -92,7 +101,7 @@ private:
|
|||
void OnCancelClick( wxCommandEvent& aEvent ) override;
|
||||
void OnClose( wxCloseEvent& event ) override;
|
||||
|
||||
// Updates data which can be modified outside the dialog
|
||||
// Updates data which can be modified outside the dialog.
|
||||
void OnActivateDlg( wxActivateEvent& aEvent ) override;
|
||||
|
||||
void OnChangingNotebookPage( wxNotebookEvent& aEvent ) override;
|
||||
|
@ -120,18 +129,17 @@ private:
|
|||
wxString m_footprintsTitleTemplate;
|
||||
wxString m_ignoredTitleTemplate;
|
||||
|
||||
RC_ITEMS_PROVIDER* m_markersProvider;
|
||||
RC_TREE_MODEL* m_markersTreeModel;
|
||||
std::shared_ptr<RC_ITEMS_PROVIDER> m_markersProvider;
|
||||
std::shared_ptr<RC_ITEMS_PROVIDER> m_ratsnestProvider;
|
||||
std::shared_ptr<RC_ITEMS_PROVIDER> m_fpWarningsProvider;
|
||||
|
||||
RC_ITEMS_PROVIDER* m_unconnectedItemsProvider;
|
||||
RC_TREE_MODEL* m_unconnectedTreeModel;
|
||||
RC_TREE_MODEL* m_markersTreeModel; // wx reference-counted ptr
|
||||
RC_TREE_MODEL* m_unconnectedTreeModel; // wx reference-counted ptr
|
||||
RC_TREE_MODEL* m_fpWarningsTreeModel; // wx reference-counted ptr
|
||||
|
||||
RC_ITEMS_PROVIDER* m_footprintWarningsProvider;
|
||||
RC_TREE_MODEL* m_footprintWarningsTreeModel;
|
||||
const PCB_MARKER* m_centerMarkerOnIdle;
|
||||
|
||||
const PCB_MARKER* m_centerMarkerOnIdle;
|
||||
|
||||
int m_severities; // A mask of SEVERITY flags
|
||||
int m_severities; // A mask of SEVERITY flags
|
||||
};
|
||||
|
||||
#endif // _DIALOG_DRC_H_
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
///////////////////////////////////////////////////////////////////////////
|
||||
// C++ code generated with wxFormBuilder (version Oct 26 2018)
|
||||
// C++ code generated with wxFormBuilder (version 3.10.1-0-g8feb16b)
|
||||
// http://www.wxformbuilder.org/
|
||||
//
|
||||
// PLEASE DO *NOT* EDIT THIS FILE!
|
||||
|
@ -136,6 +136,12 @@ DIALOG_DRC_BASE::DIALOG_DRC_BASE( wxWindow* parent, wxWindowID id, const wxStrin
|
|||
m_ignoredList = new wxListCtrl( m_panelIgnored, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLC_NO_HEADER|wxLC_REPORT );
|
||||
bSizer15->Add( m_ignoredList, 1, wxALL|wxEXPAND, 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, 5, 0, wxEXPAND, 5 );
|
||||
|
||||
|
||||
m_panelIgnored->SetSizer( bSizer15 );
|
||||
m_panelIgnored->Layout();
|
||||
|
@ -240,7 +246,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::OnIgnoreItemRClick ), 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 );
|
||||
m_showWarnings->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_DRC_BASE::OnSeverity ), NULL, this );
|
||||
|
@ -268,7 +274,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::OnIgnoreItemRClick ), 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 );
|
||||
m_showWarnings->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_DRC_BASE::OnSeverity ), NULL, this );
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
|
||||
<wxFormBuilder_Project>
|
||||
<FileVersion major="1" minor="15" />
|
||||
<FileVersion major="1" minor="16" />
|
||||
<object class="Project" expanded="1">
|
||||
<property name="class_decoration"></property>
|
||||
<property name="code_generation">C++</property>
|
||||
|
@ -14,6 +14,7 @@
|
|||
<property name="file">dialog_drc_base</property>
|
||||
<property name="first_id">1000</property>
|
||||
<property name="help_provider">none</property>
|
||||
<property name="image_path_wrapper_function_name"></property>
|
||||
<property name="indent_with_spaces"></property>
|
||||
<property name="internationalize">1</property>
|
||||
<property name="name">dialog_drc_base</property>
|
||||
|
@ -25,6 +26,7 @@
|
|||
<property name="skip_php_events">1</property>
|
||||
<property name="skip_python_events">1</property>
|
||||
<property name="ui_table">UI</property>
|
||||
<property name="use_array_enum">0</property>
|
||||
<property name="use_enum">0</property>
|
||||
<property name="use_microsoft_bom">0</property>
|
||||
<object class="Dialog" expanded="1">
|
||||
|
@ -50,6 +52,7 @@
|
|||
<property name="subclass">DIALOG_SHIM; dialog_shim.h</property>
|
||||
<property name="title">Design Rules Checker</property>
|
||||
<property name="tooltip"></property>
|
||||
<property name="two_step_creation">0</property>
|
||||
<property name="window_extra_style"></property>
|
||||
<property name="window_name"></property>
|
||||
<property name="window_style"></property>
|
||||
|
@ -1174,7 +1177,80 @@
|
|||
<property name="window_extra_style"></property>
|
||||
<property name="window_name"></property>
|
||||
<property name="window_style"></property>
|
||||
<event name="OnListItemRightClick">OnIgnoreItemRClick</event>
|
||||
</object>
|
||||
</object>
|
||||
<object class="sizeritem" expanded="1">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxBOTTOM|wxRIGHT|wxLEFT</property>
|
||||
<property name="proportion">0</property>
|
||||
<object class="wxHyperlinkCtrl" 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="hover_color"></property>
|
||||
<property name="id">wxID_ANY</property>
|
||||
<property name="label">Edit ignored tests</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_violationSeveritiesLink</property>
|
||||
<property name="normal_color"></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">wxHL_DEFAULT_STYLE</property>
|
||||
<property name="subclass">; ; forward_declare</property>
|
||||
<property name="toolbar_pane">0</property>
|
||||
<property name="tooltip"></property>
|
||||
<property name="url"></property>
|
||||
<property name="visited_color"></property>
|
||||
<property name="window_extra_style"></property>
|
||||
<property name="window_name"></property>
|
||||
<property name="window_style"></property>
|
||||
<event name="OnHyperlink">OnEditViolationSeverities</event>
|
||||
</object>
|
||||
</object>
|
||||
<object class="sizeritem" expanded="1">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxEXPAND</property>
|
||||
<property name="proportion">0</property>
|
||||
<object class="spacer" expanded="1">
|
||||
<property name="height">5</property>
|
||||
<property name="permission">protected</property>
|
||||
<property name="width">0</property>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
|
@ -1745,6 +1821,7 @@
|
|||
<property name="aui_name"></property>
|
||||
<property name="aui_position"></property>
|
||||
<property name="aui_row"></property>
|
||||
<property name="auth_needed">0</property>
|
||||
<property name="best_size"></property>
|
||||
<property name="bg"></property>
|
||||
<property name="bitmap"></property>
|
||||
|
@ -1889,6 +1966,7 @@
|
|||
<property name="aui_name"></property>
|
||||
<property name="aui_position"></property>
|
||||
<property name="aui_row"></property>
|
||||
<property name="auth_needed">0</property>
|
||||
<property name="best_size"></property>
|
||||
<property name="bg"></property>
|
||||
<property name="bitmap"></property>
|
||||
|
@ -1962,6 +2040,7 @@
|
|||
<property name="aui_name"></property>
|
||||
<property name="aui_position"></property>
|
||||
<property name="aui_row"></property>
|
||||
<property name="auth_needed">0</property>
|
||||
<property name="best_size"></property>
|
||||
<property name="bg"></property>
|
||||
<property name="bitmap"></property>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
///////////////////////////////////////////////////////////////////////////
|
||||
// C++ code generated with wxFormBuilder (version Oct 26 2018)
|
||||
// C++ code generated with wxFormBuilder (version 3.10.1-0-g8feb16b)
|
||||
// http://www.wxformbuilder.org/
|
||||
//
|
||||
// PLEASE DO *NOT* EDIT THIS FILE!
|
||||
|
@ -29,6 +29,7 @@ class WX_HTML_REPORT_BOX;
|
|||
#include <wx/notebook.h>
|
||||
#include <wx/dataview.h>
|
||||
#include <wx/listctrl.h>
|
||||
#include <wx/hyperlink.h>
|
||||
#include <wx/simplebook.h>
|
||||
#include <wx/stattext.h>
|
||||
#include <widgets/number_badge.h>
|
||||
|
@ -67,6 +68,7 @@ class DIALOG_DRC_BASE : public DIALOG_SHIM
|
|||
wxDataViewCtrl* m_footprintsDataView;
|
||||
wxPanel* m_panelIgnored;
|
||||
wxListCtrl* m_ignoredList;
|
||||
wxHyperlinkCtrl* m_violationSeveritiesLink;
|
||||
wxStaticText* m_showLabel;
|
||||
wxCheckBox* m_showAll;
|
||||
wxCheckBox* m_showErrors;
|
||||
|
@ -84,7 +86,7 @@ class DIALOG_DRC_BASE : public DIALOG_SHIM
|
|||
wxButton* m_sdbSizerOK;
|
||||
wxButton* m_sdbSizerCancel;
|
||||
|
||||
// Virtual event handlers, overide them in your derived class
|
||||
// Virtual event handlers, override them in your derived class
|
||||
virtual void OnActivateDlg( wxActivateEvent& event ) { event.Skip(); }
|
||||
virtual void OnClose( wxCloseEvent& event ) { event.Skip(); }
|
||||
virtual void OnErrorLinkClicked( wxHtmlLinkEvent& event ) { event.Skip(); }
|
||||
|
@ -92,7 +94,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 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(); }
|
||||
|
@ -104,6 +106,7 @@ class DIALOG_DRC_BASE : public DIALOG_SHIM
|
|||
public:
|
||||
|
||||
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();
|
||||
|
||||
};
|
||||
|
|
|
@ -42,15 +42,15 @@ DIALOG_FOOTPRINT_CHECKER::DIALOG_FOOTPRINT_CHECKER( FOOTPRINT_EDIT_FRAME* aParen
|
|||
DIALOG_FOOTPRINT_CHECKER_BASE( aParent ),
|
||||
m_frame( aParent ),
|
||||
m_checksRun( false ),
|
||||
m_centerMarkerOnIdle( nullptr ),
|
||||
m_severities( RPT_SEVERITY_ERROR | RPT_SEVERITY_WARNING )
|
||||
m_severities( RPT_SEVERITY_ERROR | RPT_SEVERITY_WARNING ),
|
||||
m_centerMarkerOnIdle( nullptr )
|
||||
{
|
||||
m_markersProvider = new DRC_ITEMS_PROVIDER( m_frame->GetBoard(), MARKER_BASE::MARKER_DRC );
|
||||
m_markersProvider = std::make_shared<DRC_ITEMS_PROVIDER>( m_frame->GetBoard(),
|
||||
MARKER_BASE::MARKER_DRC );
|
||||
|
||||
m_markersTreeModel = new RC_TREE_MODEL( m_frame, m_markersDataView );
|
||||
m_markersDataView->AssociateModel( m_markersTreeModel );
|
||||
|
||||
m_markersTreeModel->SetSeverities( -1 );
|
||||
m_markersTreeModel->SetProvider( m_markersProvider );
|
||||
m_markersTreeModel->Update( m_markersProvider, m_severities );
|
||||
|
||||
if( m_frame->GetBoard()->GetFirstFootprint() == g_lastFootprint )
|
||||
{
|
||||
|
@ -109,8 +109,6 @@ void DIALOG_FOOTPRINT_CHECKER::runChecks()
|
|||
FOOTPRINT* footprint = board->GetFirstFootprint();
|
||||
wxString msg;
|
||||
|
||||
SetMarkersProvider( new DRC_ITEMS_PROVIDER( board, MARKER_BASE::MARKER_DRC ) );
|
||||
|
||||
deleteAllMarkers();
|
||||
|
||||
if( !footprint )
|
||||
|
@ -182,23 +180,13 @@ void DIALOG_FOOTPRINT_CHECKER::runChecks()
|
|||
|
||||
m_checksRun = true;
|
||||
|
||||
SetMarkersProvider( new DRC_ITEMS_PROVIDER( board, MARKER_BASE::MARKER_DRC ) );
|
||||
m_markersTreeModel->Update( m_markersProvider, m_severities );
|
||||
updateDisplayedCounts();
|
||||
|
||||
refreshEditor();
|
||||
}
|
||||
|
||||
|
||||
void DIALOG_FOOTPRINT_CHECKER::SetMarkersProvider( RC_ITEMS_PROVIDER* aProvider )
|
||||
{
|
||||
// TreeModel owns the provider, not us
|
||||
// delete m_markersProvider;
|
||||
|
||||
m_markersProvider = aProvider;
|
||||
m_markersTreeModel->SetProvider( aProvider );
|
||||
updateDisplayedCounts();
|
||||
}
|
||||
|
||||
|
||||
void DIALOG_FOOTPRINT_CHECKER::SelectMarker( const PCB_MARKER* aMarker )
|
||||
{
|
||||
m_markersTreeModel->SelectMarker( aMarker );
|
||||
|
@ -353,14 +341,7 @@ void DIALOG_FOOTPRINT_CHECKER::OnSeverity( wxCommandEvent& aEvent )
|
|||
|
||||
syncCheckboxes();
|
||||
|
||||
// Set the provider's severity levels through the TreeModel so that the old tree
|
||||
// can be torn down before the severity changes.
|
||||
//
|
||||
// It's not clear this is required, but we've had a lot of issues with wxDataView
|
||||
// being cranky on various platforms.
|
||||
|
||||
m_markersTreeModel->SetSeverities( m_severities );
|
||||
|
||||
m_markersTreeModel->Update( m_markersProvider, m_severities );
|
||||
updateDisplayedCounts();
|
||||
}
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2010-2014 Jean-Pierre Charras, jean-pierre.charras at wanadoo.fr
|
||||
* Copyright (C) 1992-2019 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
|
||||
|
@ -38,8 +38,6 @@ public:
|
|||
DIALOG_FOOTPRINT_CHECKER( FOOTPRINT_EDIT_FRAME* aParent );
|
||||
~DIALOG_FOOTPRINT_CHECKER();
|
||||
|
||||
void SetMarkersProvider( RC_ITEMS_PROVIDER* aProvider );
|
||||
|
||||
void SelectMarker( const PCB_MARKER* aMarker );
|
||||
|
||||
private:
|
||||
|
@ -68,15 +66,14 @@ private:
|
|||
bool TransferDataFromWindow() override;
|
||||
|
||||
private:
|
||||
FOOTPRINT_EDIT_FRAME* m_frame;
|
||||
bool m_checksRun;
|
||||
FOOTPRINT_EDIT_FRAME* m_frame;
|
||||
bool m_checksRun;
|
||||
|
||||
RC_TREE_MODEL* m_markersTreeModel;
|
||||
RC_ITEMS_PROVIDER* m_markersProvider;
|
||||
int m_severities;
|
||||
std::shared_ptr<RC_ITEMS_PROVIDER> m_markersProvider;
|
||||
RC_TREE_MODEL* m_markersTreeModel;
|
||||
|
||||
const PCB_MARKER* m_centerMarkerOnIdle;
|
||||
|
||||
int m_severities;
|
||||
const PCB_MARKER* m_centerMarkerOnIdle;
|
||||
};
|
||||
|
||||
#endif // DIALOG_FOOTPRINT_CHECKER_H
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2020-2021 KiCad Developers, see change_log.txt for contributors.
|
||||
* Copyright (C) 2020-2022 KiCad Developers, see change_log.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
|
||||
|
@ -31,7 +31,6 @@
|
|||
#include <kiface_base.h>
|
||||
#include <dialog_drc.h>
|
||||
#include <board_commit.h>
|
||||
#include <zone.h>
|
||||
#include <board_design_settings.h>
|
||||
#include <progress_reporter.h>
|
||||
#include <drc/drc_engine.h>
|
||||
|
@ -209,16 +208,8 @@ void DRC_TOOL::updatePointers()
|
|||
|
||||
m_editFrame->ResolveDRCExclusions();
|
||||
|
||||
if( m_drcDialog ) // Use dialog list boxes only in DRC_TOOL dialog
|
||||
{
|
||||
m_drcDialog->SetMarkersProvider( new DRC_ITEMS_PROVIDER( m_pcb,
|
||||
MARKER_BASE::MARKER_DRC,
|
||||
MARKER_BASE::MARKER_DRAWING_SHEET ) );
|
||||
m_drcDialog->SetRatsnestProvider( new DRC_ITEMS_PROVIDER( m_pcb,
|
||||
MARKER_BASE::MARKER_RATSNEST ) );
|
||||
m_drcDialog->SetFootprintsProvider( new DRC_ITEMS_PROVIDER( m_pcb,
|
||||
MARKER_BASE::MARKER_PARITY ) );
|
||||
}
|
||||
if( m_drcDialog )
|
||||
m_drcDialog->UpdateData();
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -648,9 +648,6 @@ int FOOTPRINT_EDITOR_CONTROL::CheckFootprint( const TOOL_EVENT& aEvent )
|
|||
}
|
||||
else // The dialog is just not visible (because the user has double clicked on an error item)
|
||||
{
|
||||
m_checkerDialog->SetMarkersProvider( new DRC_ITEMS_PROVIDER( m_frame->GetBoard(),
|
||||
MARKER_BASE::MARKER_DRC ) );
|
||||
|
||||
m_checkerDialog->Show( true );
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue