2011-10-31 20:29:46 +00:00
|
|
|
/*
|
|
|
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
|
|
|
*
|
2018-01-17 14:36:04 +00:00
|
|
|
* Copyright (C) 2018 Jean-Pierre Charras, jp.charras at wanadoo.fr
|
2016-09-08 18:17:37 +00:00
|
|
|
* Copyright (C) 2009-2016 Dick Hollenbeck, dick@softplc.com
|
2020-02-24 23:17:30 +00:00
|
|
|
* Copyright (C) 2004-2020 KiCad Developers, see AUTHORS.txt for contributors.
|
2011-10-31 20:29:46 +00:00
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
* of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, you may find one here:
|
|
|
|
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
|
|
|
* or you may search the http://www.gnu.org website for the version 2 license,
|
|
|
|
* or you may write to the Free Software Foundation, Inc.,
|
|
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
|
|
|
*/
|
2007-05-06 16:03:28 +00:00
|
|
|
|
2020-01-15 15:26:13 +00:00
|
|
|
#include <base_units.h>
|
2018-01-30 14:13:34 +00:00
|
|
|
#include <bitmaps.h>
|
2020-01-15 15:26:13 +00:00
|
|
|
#include <collectors.h>
|
|
|
|
#include <confirm.h>
|
2012-01-23 04:33:36 +00:00
|
|
|
#include <dialog_drc.h>
|
2020-01-15 15:26:13 +00:00
|
|
|
#include <fctsys.h>
|
|
|
|
#include <kiface_i.h>
|
2018-01-29 20:58:58 +00:00
|
|
|
#include <pcb_edit_frame.h>
|
2020-01-13 01:44:19 +00:00
|
|
|
#include <pcbnew_settings.h>
|
2020-01-15 15:26:13 +00:00
|
|
|
#include <pgm_base.h>
|
2018-01-28 09:35:33 +00:00
|
|
|
#include <tool/tool_manager.h>
|
|
|
|
#include <tools/pcb_actions.h>
|
2020-01-15 15:26:13 +00:00
|
|
|
#include <wildcards_and_files_ext.h>
|
2020-08-08 17:06:00 +00:00
|
|
|
#include <class_marker_pcb.h>
|
2020-02-24 23:17:30 +00:00
|
|
|
#include <wx/wupdlock.h>
|
2020-02-28 00:05:40 +00:00
|
|
|
#include <widgets/ui_common.h>
|
2020-04-07 00:31:39 +00:00
|
|
|
#include <pcb_layer_widget.h>
|
|
|
|
|
2020-02-27 22:00:14 +00:00
|
|
|
|
2020-03-16 11:05:01 +00:00
|
|
|
DIALOG_DRC::DIALOG_DRC( DRC* aTester, PCB_EDIT_FRAME* aEditorFrame, wxWindow* aParent ) :
|
|
|
|
DIALOG_DRC_BASE( aParent ),
|
2020-02-24 23:17:30 +00:00
|
|
|
m_trackMinWidth( aEditorFrame, m_MinWidthLabel, m_MinWidthCtrl, m_MinWidthUnits, true ),
|
|
|
|
m_viaMinSize( aEditorFrame, m_ViaMinLabel, m_ViaMinCtrl, m_ViaMinUnits, true ),
|
2020-02-28 00:05:40 +00:00
|
|
|
m_uviaMinSize( aEditorFrame, m_uViaMinLabel, m_uViaMinCtrl, m_uViaMinUnits, true ),
|
|
|
|
m_markersProvider( nullptr ),
|
|
|
|
m_markerTreeModel( nullptr ),
|
|
|
|
m_unconnectedItemsProvider( nullptr ),
|
|
|
|
m_unconnectedTreeModel( nullptr ),
|
|
|
|
m_footprintWarningsProvider( nullptr ),
|
|
|
|
m_footprintWarningsTreeModel( nullptr ),
|
2020-03-04 09:48:18 +00:00
|
|
|
m_severities( RPT_SEVERITY_ERROR | RPT_SEVERITY_WARNING )
|
2007-05-06 16:03:28 +00:00
|
|
|
{
|
2020-01-15 15:26:13 +00:00
|
|
|
SetName( DIALOG_DRC_WINDOW_NAME ); // Set a window name to be able to find it
|
2019-09-19 07:11:45 +00:00
|
|
|
|
2020-01-15 15:26:13 +00:00
|
|
|
m_tester = aTester;
|
|
|
|
m_brdEditor = aEditorFrame;
|
2016-07-27 12:53:45 +00:00
|
|
|
m_currentBoard = m_brdEditor->GetBoard();
|
2007-05-06 16:03:28 +00:00
|
|
|
|
2020-03-16 11:05:01 +00:00
|
|
|
m_markerTreeModel = new RC_TREE_MODEL( m_brdEditor, m_markerDataView );
|
2020-02-24 23:17:30 +00:00
|
|
|
m_markerDataView->AssociateModel( m_markerTreeModel );
|
|
|
|
|
2020-03-16 11:05:01 +00:00
|
|
|
m_unconnectedTreeModel = new RC_TREE_MODEL( m_brdEditor, m_unconnectedDataView );
|
2020-02-24 23:17:30 +00:00
|
|
|
m_unconnectedDataView->AssociateModel( m_unconnectedTreeModel );
|
|
|
|
|
2020-03-16 11:05:01 +00:00
|
|
|
m_footprintWarningsTreeModel = new RC_TREE_MODEL( m_brdEditor, m_footprintsDataView );
|
2020-02-28 00:05:40 +00:00
|
|
|
m_footprintsDataView->AssociateModel( m_footprintWarningsTreeModel );
|
2020-02-24 23:17:30 +00:00
|
|
|
|
2020-02-25 12:17:13 +00:00
|
|
|
m_Notebook->SetSelection( 0 );
|
|
|
|
|
2018-01-30 14:13:34 +00:00
|
|
|
// We use a sdbSizer here to get the order right, which is platform-dependent
|
|
|
|
m_sdbSizer1OK->SetLabel( _( "Run DRC" ) );
|
|
|
|
m_sdbSizer1Cancel->SetLabel( _( "Close" ) );
|
|
|
|
m_sizerButtons->Layout();
|
|
|
|
|
|
|
|
m_sdbSizer1OK->SetDefault();
|
|
|
|
|
2020-02-27 22:00:14 +00:00
|
|
|
initValues();
|
2020-02-28 00:05:40 +00:00
|
|
|
syncCheckboxes();
|
2016-06-15 17:00:30 +00:00
|
|
|
|
2016-07-02 14:13:10 +00:00
|
|
|
FinishDialogSettings();
|
2009-11-05 22:02:24 +00:00
|
|
|
}
|
|
|
|
|
2018-01-30 14:13:34 +00:00
|
|
|
|
2020-03-16 11:05:01 +00:00
|
|
|
DIALOG_DRC::~DIALOG_DRC()
|
2017-03-16 17:09:33 +00:00
|
|
|
{
|
2020-02-25 12:17:13 +00:00
|
|
|
m_brdEditor->FocusOnItem( nullptr );
|
2020-01-13 01:44:19 +00:00
|
|
|
|
2020-05-06 01:43:37 +00:00
|
|
|
PCBNEW_SETTINGS* settings = m_brdEditor->GetPcbNewSettings();
|
2020-02-25 12:17:13 +00:00
|
|
|
settings->m_DrcDialog.refill_zones = m_cbRefillZones->GetValue();
|
|
|
|
settings->m_DrcDialog.test_track_to_zone = m_cbReportAllTrackErrors->GetValue();
|
|
|
|
settings->m_DrcDialog.test_footprints = m_cbTestFootprints->GetValue();
|
2020-03-04 14:25:54 +00:00
|
|
|
settings->m_DrcDialog.severities = m_severities;
|
2020-02-24 23:17:30 +00:00
|
|
|
|
|
|
|
m_markerTreeModel->DecRef();
|
2017-03-16 17:09:33 +00:00
|
|
|
}
|
2009-11-05 22:02:24 +00:00
|
|
|
|
2018-01-30 14:13:34 +00:00
|
|
|
|
2020-03-16 11:05:01 +00:00
|
|
|
void DIALOG_DRC::OnActivateDlg( wxActivateEvent& aEvent )
|
2016-04-15 18:15:22 +00:00
|
|
|
{
|
2016-07-27 12:53:45 +00:00
|
|
|
if( m_currentBoard != m_brdEditor->GetBoard() )
|
2016-04-15 18:15:22 +00:00
|
|
|
{
|
|
|
|
// If m_currentBoard is not the current parent board,
|
|
|
|
// (for instance because a new board was loaded),
|
|
|
|
// close the dialog, because many pointers are now invalid
|
|
|
|
// in lists
|
|
|
|
SetReturnCode( wxID_CANCEL );
|
|
|
|
Close();
|
2016-07-28 12:07:35 +00:00
|
|
|
m_tester->DestroyDRCDialog( wxID_CANCEL );
|
2016-04-15 18:15:22 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
// updating data which can be modified outside the dialog (DRC parameters, units ...)
|
|
|
|
// because the dialog is not modal
|
2020-02-27 22:00:14 +00:00
|
|
|
displayDRCValues();
|
2020-02-28 00:05:40 +00:00
|
|
|
|
|
|
|
m_markerTreeModel->SetProvider( m_markersProvider );
|
|
|
|
m_unconnectedTreeModel->SetProvider( m_unconnectedItemsProvider );
|
|
|
|
m_footprintWarningsTreeModel->SetProvider( m_footprintWarningsProvider );
|
|
|
|
updateDisplayedCounts();
|
2016-04-15 18:15:22 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2020-03-16 11:05:01 +00:00
|
|
|
void DIALOG_DRC::displayDRCValues()
|
2016-04-15 18:15:22 +00:00
|
|
|
{
|
2020-05-15 23:25:33 +00:00
|
|
|
m_trackMinWidth.SetValue( bds().m_TrackMinWidth );
|
|
|
|
m_viaMinSize.SetValue( bds().m_ViasMinSize );
|
|
|
|
m_uviaMinSize.SetValue( bds().m_MicroViasMinSize );
|
2016-04-15 18:15:22 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2020-03-16 11:05:01 +00:00
|
|
|
void DIALOG_DRC::initValues()
|
2007-11-27 01:34:35 +00:00
|
|
|
{
|
2020-01-15 15:26:13 +00:00
|
|
|
m_markersTitleTemplate = m_Notebook->GetPageText( 0 );
|
2018-01-30 14:13:34 +00:00
|
|
|
m_unconnectedTitleTemplate = m_Notebook->GetPageText( 1 );
|
2020-01-15 15:26:13 +00:00
|
|
|
m_footprintsTitleTemplate = m_Notebook->GetPageText( 2 );
|
2009-06-27 06:26:41 +00:00
|
|
|
|
2020-02-27 22:00:14 +00:00
|
|
|
displayDRCValues();
|
2016-04-15 18:15:22 +00:00
|
|
|
|
2020-05-06 01:43:37 +00:00
|
|
|
auto cfg = m_brdEditor->GetPcbNewSettings();
|
2020-01-13 01:44:19 +00:00
|
|
|
|
|
|
|
m_cbRefillZones->SetValue( cfg->m_DrcDialog.refill_zones );
|
|
|
|
m_cbReportAllTrackErrors->SetValue( cfg->m_DrcDialog.test_track_to_zone );
|
|
|
|
m_cbTestFootprints->SetValue( cfg->m_DrcDialog.test_footprints );
|
2020-03-04 18:04:14 +00:00
|
|
|
|
2020-03-04 14:25:54 +00:00
|
|
|
m_severities = cfg->m_DrcDialog.severities;
|
2020-03-04 18:04:14 +00:00
|
|
|
m_markerTreeModel->SetSeverities( m_severities );
|
|
|
|
m_unconnectedTreeModel->SetSeverities( m_severities );
|
|
|
|
m_footprintWarningsTreeModel->SetSeverities( m_severities );
|
2017-03-16 17:09:33 +00:00
|
|
|
|
2020-01-15 15:26:13 +00:00
|
|
|
Layout(); // adding the units above expanded Clearance text, now resize.
|
2016-06-15 17:00:30 +00:00
|
|
|
|
2009-06-18 13:30:52 +00:00
|
|
|
SetFocus();
|
2007-05-06 16:03:28 +00:00
|
|
|
}
|
2007-12-03 05:14:51 +00:00
|
|
|
|
2019-05-14 22:07:34 +00:00
|
|
|
|
2020-03-16 11:05:01 +00:00
|
|
|
void DIALOG_DRC::setDRCParameters()
|
2009-10-06 18:58:51 +00:00
|
|
|
{
|
2020-05-15 23:25:33 +00:00
|
|
|
bds().m_TrackMinWidth = (int) m_trackMinWidth.GetValue();
|
|
|
|
bds().m_ViasMinSize = (int) m_viaMinSize.GetValue();
|
|
|
|
bds().m_MicroViasMinSize = (int) m_uviaMinSize.GetValue();
|
2009-10-06 18:58:51 +00:00
|
|
|
}
|
|
|
|
|
2007-12-03 05:14:51 +00:00
|
|
|
|
2020-02-28 00:05:40 +00:00
|
|
|
// Don't globally define this; different facilities use different definitions of "ALL"
|
2020-03-04 09:48:18 +00:00
|
|
|
static int RPT_SEVERITY_ALL = RPT_SEVERITY_WARNING | RPT_SEVERITY_ERROR | RPT_SEVERITY_EXCLUSION;
|
2020-02-28 00:05:40 +00:00
|
|
|
|
|
|
|
|
2020-03-16 11:05:01 +00:00
|
|
|
void DIALOG_DRC::syncCheckboxes()
|
2016-06-15 17:00:30 +00:00
|
|
|
{
|
2020-03-04 09:48:18 +00:00
|
|
|
m_showAll->SetValue( m_severities == RPT_SEVERITY_ALL );
|
|
|
|
m_showErrors->SetValue( m_severities & RPT_SEVERITY_ERROR );
|
|
|
|
m_showWarnings->SetValue( m_severities & RPT_SEVERITY_WARNING );
|
|
|
|
m_showExclusions->SetValue( m_severities & RPT_SEVERITY_EXCLUSION );
|
2016-06-15 17:00:30 +00:00
|
|
|
}
|
|
|
|
|
2018-02-10 20:17:11 +00:00
|
|
|
|
2020-03-16 11:05:01 +00:00
|
|
|
void DIALOG_DRC::OnRunDRCClick( wxCommandEvent& aEvent )
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
2020-02-27 22:00:14 +00:00
|
|
|
setDRCParameters();
|
2020-05-29 20:23:08 +00:00
|
|
|
m_tester->m_testTracksAgainstZones = m_cbReportTracksToZonesErrors->GetValue();
|
|
|
|
m_tester->m_refillZones = m_cbRefillZones->GetValue();
|
|
|
|
m_tester->m_reportAllTrackErrors = m_cbReportAllTrackErrors->GetValue();
|
|
|
|
m_tester->m_testFootprints = m_cbTestFootprints->GetValue();
|
2009-06-27 06:26:41 +00:00
|
|
|
|
2020-02-28 00:05:40 +00:00
|
|
|
m_brdEditor->RecordDRCExclusions();
|
2020-08-02 21:45:06 +00:00
|
|
|
deleteAllMarkers( true );
|
2007-12-03 05:14:51 +00:00
|
|
|
|
2007-12-05 14:17:10 +00:00
|
|
|
wxBeginBusyCursor();
|
2018-06-27 17:04:59 +00:00
|
|
|
wxWindowDisabler disabler;
|
2008-02-23 04:53:44 +00:00
|
|
|
|
2007-12-03 05:14:51 +00:00
|
|
|
// run all the tests, with no UI at this time.
|
2009-06-27 06:26:41 +00:00
|
|
|
m_Messages->Clear();
|
2020-01-15 15:26:13 +00:00
|
|
|
wxSafeYield(); // Allows time slice to refresh the Messages
|
|
|
|
m_tester->RunTests( m_Messages );
|
2020-02-28 00:05:40 +00:00
|
|
|
|
2020-01-15 15:26:13 +00:00
|
|
|
m_Notebook->ChangeSelection( 0 ); // display the "Problems/Markers" tab
|
2008-02-23 04:53:44 +00:00
|
|
|
|
2007-12-05 14:17:10 +00:00
|
|
|
wxEndBusyCursor();
|
2008-02-23 04:53:44 +00:00
|
|
|
|
2020-02-28 00:05:40 +00:00
|
|
|
refreshBoardEditor();
|
2020-04-07 00:31:39 +00:00
|
|
|
|
|
|
|
wxSafeYield();
|
|
|
|
Raise();
|
2020-02-28 00:05:40 +00:00
|
|
|
m_Notebook->GetPage( m_Notebook->GetSelection() )->SetFocus();
|
2007-06-05 12:10:51 +00:00
|
|
|
}
|
|
|
|
|
2007-12-03 21:28:56 +00:00
|
|
|
|
2020-03-16 11:05:01 +00:00
|
|
|
void DIALOG_DRC::SetMarkersProvider( RC_ITEMS_PROVIDER* aProvider )
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
2020-02-28 00:05:40 +00:00
|
|
|
m_markersProvider = aProvider;
|
|
|
|
m_markerTreeModel->SetProvider( m_markersProvider );
|
|
|
|
updateDisplayedCounts();
|
2007-06-05 12:10:51 +00:00
|
|
|
}
|
|
|
|
|
2007-12-03 05:14:51 +00:00
|
|
|
|
2020-03-16 11:05:01 +00:00
|
|
|
void DIALOG_DRC::SetUnconnectedProvider( class RC_ITEMS_PROVIDER * aProvider )
|
2007-08-02 07:42:58 +00:00
|
|
|
{
|
2020-02-28 00:05:40 +00:00
|
|
|
m_unconnectedItemsProvider = aProvider;
|
|
|
|
m_unconnectedTreeModel->SetProvider( m_unconnectedItemsProvider );
|
|
|
|
updateDisplayedCounts();
|
2007-08-02 07:42:58 +00:00
|
|
|
}
|
|
|
|
|
2007-10-03 15:21:13 +00:00
|
|
|
|
2020-03-16 11:05:01 +00:00
|
|
|
void DIALOG_DRC::SetFootprintsProvider( RC_ITEMS_PROVIDER* aProvider )
|
2007-10-03 15:21:13 +00:00
|
|
|
{
|
2020-02-28 00:05:40 +00:00
|
|
|
m_footprintWarningsProvider = aProvider;
|
|
|
|
m_footprintWarningsTreeModel->SetProvider( m_footprintWarningsProvider );
|
|
|
|
updateDisplayedCounts();
|
2007-11-27 01:34:35 +00:00
|
|
|
}
|
2007-10-03 15:21:13 +00:00
|
|
|
|
|
|
|
|
2020-03-16 11:05:01 +00:00
|
|
|
void DIALOG_DRC::OnDRCItemSelected( wxDataViewEvent& aEvent )
|
2007-11-27 01:34:35 +00:00
|
|
|
{
|
2020-03-16 11:05:01 +00:00
|
|
|
const KIID& itemID = RC_TREE_MODEL::ToUUID( aEvent.GetItem() );
|
|
|
|
BOARD_ITEM* item = m_brdEditor->GetBoard()->GetItem( itemID );
|
2020-04-07 00:31:39 +00:00
|
|
|
LSET visibleLayers = m_brdEditor->GetBoard()->GetVisibleLayers();
|
2020-02-24 23:17:30 +00:00
|
|
|
WINDOW_THAWER thawer( m_brdEditor );
|
2007-11-27 01:34:35 +00:00
|
|
|
|
2020-04-07 00:31:39 +00:00
|
|
|
if( item && ( item->GetLayerSet() & visibleLayers ) == 0 )
|
|
|
|
{
|
|
|
|
if( IsOK( this, wxString::Format( _( "Item not currently visible.\nShow the '%s' layer?" ),
|
|
|
|
item->GetLayerName() ) ) )
|
|
|
|
{
|
|
|
|
m_brdEditor->GetLayerManager()->SetLayerVisible( item->GetLayer(), true );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-02-24 23:17:30 +00:00
|
|
|
m_brdEditor->FocusOnItem( item );
|
|
|
|
m_brdEditor->GetCanvas()->Refresh();
|
2007-11-27 01:34:35 +00:00
|
|
|
|
2020-02-28 00:05:40 +00:00
|
|
|
aEvent.Skip();
|
2007-10-03 15:21:13 +00:00
|
|
|
}
|
|
|
|
|
2007-11-13 09:35:39 +00:00
|
|
|
|
2020-03-16 11:05:01 +00:00
|
|
|
void DIALOG_DRC::OnDRCItemDClick( wxDataViewEvent& aEvent )
|
2007-11-13 09:35:39 +00:00
|
|
|
{
|
2020-02-28 00:05:40 +00:00
|
|
|
if( aEvent.GetItem().IsOk() )
|
2007-11-27 01:34:35 +00:00
|
|
|
{
|
2020-03-16 11:05:01 +00:00
|
|
|
// turn control over to m_brdEditor, hide this DIALOG_DRC window,
|
2020-02-24 23:17:30 +00:00
|
|
|
// no destruction so we can preserve listbox cursor
|
|
|
|
if( !IsModal() )
|
|
|
|
Show( false );
|
2007-11-27 01:34:35 +00:00
|
|
|
}
|
|
|
|
|
2020-02-28 00:05:40 +00:00
|
|
|
aEvent.Skip();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2020-03-16 11:05:01 +00:00
|
|
|
void DIALOG_DRC::OnDRCItemRClick( wxDataViewEvent& aEvent )
|
2020-02-28 00:05:40 +00:00
|
|
|
{
|
2020-03-16 11:05:01 +00:00
|
|
|
RC_TREE_NODE* node = RC_TREE_MODEL::ToNode( aEvent.GetItem() );
|
2020-02-28 00:05:40 +00:00
|
|
|
|
|
|
|
if( !node )
|
|
|
|
return;
|
|
|
|
|
2020-03-16 11:05:01 +00:00
|
|
|
RC_ITEM* rcItem = node->m_RcItem;
|
2020-02-28 00:05:40 +00:00
|
|
|
wxString listName;
|
|
|
|
wxMenu menu;
|
2020-04-24 18:56:44 +00:00
|
|
|
wxString msg;
|
2020-02-28 00:05:40 +00:00
|
|
|
|
2020-05-15 23:25:33 +00:00
|
|
|
switch( bds().m_DRCSeverities[ rcItem->GetErrorCode() ] )
|
2020-02-28 00:05:40 +00:00
|
|
|
{
|
2020-03-04 09:48:18 +00:00
|
|
|
case RPT_SEVERITY_ERROR: listName = _( "errors" ); break;
|
|
|
|
case RPT_SEVERITY_WARNING: listName = _( "warnings" ); break;
|
2020-03-16 11:05:01 +00:00
|
|
|
default: listName = _( "appropriate" ); break;
|
2020-02-28 00:05:40 +00:00
|
|
|
}
|
|
|
|
|
2020-03-16 11:05:01 +00:00
|
|
|
if( rcItem->GetParent()->IsExcluded() )
|
2020-02-28 00:05:40 +00:00
|
|
|
{
|
|
|
|
menu.Append( 1, _( "Remove exclusion for this violation" ),
|
|
|
|
wxString::Format( _( "It will be placed back in the %s list" ), listName ) );
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
menu.Append( 2, _( "Exclude this violation" ),
|
|
|
|
wxString::Format( _( "It will be excluded from the %s list" ), listName ) );
|
|
|
|
}
|
|
|
|
|
|
|
|
menu.AppendSeparator();
|
|
|
|
|
2020-05-15 23:25:33 +00:00
|
|
|
if( bds().m_DRCSeverities[ rcItem->GetErrorCode() ] == RPT_SEVERITY_WARNING )
|
2020-02-28 00:05:40 +00:00
|
|
|
{
|
2020-04-24 18:56:44 +00:00
|
|
|
msg.Printf( _( "Change severity to Error for all '%s' violations" ),
|
2020-06-08 02:19:46 +00:00
|
|
|
rcItem->GetErrorText(),
|
2020-04-24 18:56:44 +00:00
|
|
|
_( "Violation severities can also be edited in the Board Setup... dialog" ) );
|
|
|
|
menu.Append( 3, msg );
|
2020-02-28 00:05:40 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2020-04-24 18:56:44 +00:00
|
|
|
msg.Printf( _( "Change severity to Warning for all '%s' violations" ),
|
2020-06-08 02:19:46 +00:00
|
|
|
rcItem->GetErrorText(),
|
2020-04-24 18:56:44 +00:00
|
|
|
_( "Violation severities can also be edited in the Board Setup... dialog" ) );
|
|
|
|
menu.Append( 4, msg );
|
2020-02-28 00:05:40 +00:00
|
|
|
}
|
|
|
|
|
2020-04-24 18:56:44 +00:00
|
|
|
msg.Printf( _( "Ignore all '%s' violations" ),
|
2020-06-08 02:19:46 +00:00
|
|
|
rcItem->GetErrorText(),
|
2020-04-24 18:56:44 +00:00
|
|
|
_( "Violations will not be checked or reported" ) );
|
|
|
|
menu.Append( 5, msg );
|
2020-02-28 00:05:40 +00:00
|
|
|
|
2020-03-04 21:51:39 +00:00
|
|
|
menu.AppendSeparator();
|
|
|
|
|
|
|
|
menu.Append( 6, _( "Edit violation severities..." ), _( "Open the Board Setup... dialog" ) );
|
|
|
|
|
2020-04-24 21:59:57 +00:00
|
|
|
bool modified = false;
|
|
|
|
|
2020-02-28 00:05:40 +00:00
|
|
|
switch( GetPopupMenuSelectionFromUser( menu ) )
|
|
|
|
{
|
|
|
|
case 1:
|
2020-08-08 17:06:00 +00:00
|
|
|
{
|
|
|
|
MARKER_PCB* marker = dynamic_cast<MARKER_PCB*>( node->m_RcItem->GetParent() );
|
|
|
|
|
|
|
|
marker->SetExcluded( false );
|
|
|
|
m_brdEditor->GetCanvas()->GetView()->Update( marker );
|
2020-02-28 00:05:40 +00:00
|
|
|
|
|
|
|
// Update view
|
2020-03-16 11:05:01 +00:00
|
|
|
static_cast<RC_TREE_MODEL*>( aEvent.GetModel() )->ValueChanged( node );
|
2020-04-24 21:59:57 +00:00
|
|
|
modified = true;
|
2020-08-08 17:06:00 +00:00
|
|
|
}
|
2020-02-28 00:05:40 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case 2:
|
2020-08-08 17:06:00 +00:00
|
|
|
{
|
|
|
|
MARKER_PCB* marker = dynamic_cast<MARKER_PCB*>( node->m_RcItem->GetParent() );
|
|
|
|
|
|
|
|
marker->SetExcluded( true );
|
|
|
|
m_brdEditor->GetCanvas()->GetView()->Update( marker );
|
2020-02-28 00:05:40 +00:00
|
|
|
|
|
|
|
// Update view
|
2020-03-04 09:48:18 +00:00
|
|
|
if( m_severities & RPT_SEVERITY_EXCLUSION )
|
2020-03-16 11:05:01 +00:00
|
|
|
static_cast<RC_TREE_MODEL*>( aEvent.GetModel() )->ValueChanged( node );
|
2020-02-28 00:05:40 +00:00
|
|
|
else
|
2020-03-16 11:05:01 +00:00
|
|
|
static_cast<RC_TREE_MODEL*>( aEvent.GetModel() )->DeleteCurrentItem( false );
|
2020-02-28 00:05:40 +00:00
|
|
|
|
2020-04-24 21:59:57 +00:00
|
|
|
modified = true;
|
2020-08-08 17:06:00 +00:00
|
|
|
}
|
2020-02-28 00:05:40 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case 3:
|
2020-05-15 23:25:33 +00:00
|
|
|
bds().m_DRCSeverities[ rcItem->GetErrorCode() ] = RPT_SEVERITY_ERROR;
|
2020-02-28 00:05:40 +00:00
|
|
|
|
2020-08-08 17:06:00 +00:00
|
|
|
for( MARKER_PCB* marker : m_brdEditor->GetBoard()->Markers() )
|
|
|
|
{
|
|
|
|
if( marker->GetRCItem()->GetErrorCode() == rcItem->GetErrorCode() )
|
|
|
|
m_brdEditor->GetCanvas()->GetView()->Update( marker );
|
|
|
|
}
|
|
|
|
|
2020-02-28 00:05:40 +00:00
|
|
|
// Rebuild model and view
|
2020-03-16 11:05:01 +00:00
|
|
|
static_cast<RC_TREE_MODEL*>( aEvent.GetModel() )->SetProvider( m_markersProvider );
|
2020-04-24 21:59:57 +00:00
|
|
|
modified = true;
|
2020-02-28 00:05:40 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case 4:
|
2020-05-15 23:25:33 +00:00
|
|
|
bds().m_DRCSeverities[ rcItem->GetErrorCode() ] = RPT_SEVERITY_WARNING;
|
2020-02-28 00:05:40 +00:00
|
|
|
|
2020-08-08 17:06:00 +00:00
|
|
|
for( MARKER_PCB* marker : m_brdEditor->GetBoard()->Markers() )
|
|
|
|
{
|
|
|
|
if( marker->GetRCItem()->GetErrorCode() == rcItem->GetErrorCode() )
|
|
|
|
m_brdEditor->GetCanvas()->GetView()->Update( marker );
|
|
|
|
}
|
|
|
|
|
2020-02-28 00:05:40 +00:00
|
|
|
// Rebuild model and view
|
2020-03-16 11:05:01 +00:00
|
|
|
static_cast<RC_TREE_MODEL*>( aEvent.GetModel() )->SetProvider( m_markersProvider );
|
2020-04-24 21:59:57 +00:00
|
|
|
modified = true;
|
2020-02-28 00:05:40 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case 5:
|
2020-05-04 21:05:30 +00:00
|
|
|
{
|
2020-05-15 23:25:33 +00:00
|
|
|
bds().m_DRCSeverities[ rcItem->GetErrorCode() ] = RPT_SEVERITY_IGNORE;
|
2020-02-28 00:05:40 +00:00
|
|
|
|
2020-05-04 21:05:30 +00:00
|
|
|
std::vector<MARKER_PCB*>& markers = m_brdEditor->GetBoard()->Markers();
|
|
|
|
|
|
|
|
for( unsigned i = 0; i < markers.size(); )
|
2020-02-28 00:05:40 +00:00
|
|
|
{
|
2020-05-04 21:05:30 +00:00
|
|
|
if( markers[i]->GetRCItem()->GetErrorCode() == rcItem->GetErrorCode() )
|
2020-05-26 20:01:04 +00:00
|
|
|
{
|
2020-08-08 17:06:00 +00:00
|
|
|
m_brdEditor->GetCanvas()->GetView()->Remove( markers.at( i ) );
|
2020-05-04 21:05:30 +00:00
|
|
|
markers.erase( markers.begin() + i );
|
2020-05-26 20:01:04 +00:00
|
|
|
}
|
2020-05-04 21:05:30 +00:00
|
|
|
else
|
|
|
|
++i;
|
2020-02-28 00:05:40 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// Rebuild model and view
|
2020-03-16 11:05:01 +00:00
|
|
|
static_cast<RC_TREE_MODEL*>( aEvent.GetModel() )->SetProvider( m_markersProvider );
|
2020-04-24 21:59:57 +00:00
|
|
|
modified = true;
|
2020-05-04 21:05:30 +00:00
|
|
|
}
|
2020-02-28 00:05:40 +00:00
|
|
|
break;
|
2020-03-04 21:51:39 +00:00
|
|
|
|
|
|
|
case 6:
|
2020-05-24 14:54:26 +00:00
|
|
|
m_brdEditor->ShowBoardSetupDialog( _( "Violation Severity" ) );
|
2020-03-04 21:51:39 +00:00
|
|
|
break;
|
2020-02-28 00:05:40 +00:00
|
|
|
}
|
2020-04-24 21:59:57 +00:00
|
|
|
|
|
|
|
if( modified )
|
|
|
|
{
|
|
|
|
updateDisplayedCounts();
|
2020-08-08 17:06:00 +00:00
|
|
|
refreshBoardEditor();
|
2020-04-24 21:59:57 +00:00
|
|
|
m_brdEditor->OnModify();
|
|
|
|
m_brdEditor->SyncToolbars();
|
|
|
|
}
|
2018-01-28 09:35:33 +00:00
|
|
|
}
|
2008-02-23 04:53:44 +00:00
|
|
|
|
|
|
|
|
2020-03-16 11:05:01 +00:00
|
|
|
void DIALOG_DRC::OnSeverity( wxCommandEvent& aEvent )
|
2018-01-28 09:35:33 +00:00
|
|
|
{
|
2020-02-27 22:00:14 +00:00
|
|
|
int flag = 0;
|
|
|
|
|
2020-02-28 00:05:40 +00:00
|
|
|
if( aEvent.GetEventObject() == m_showAll )
|
2020-03-04 09:48:18 +00:00
|
|
|
flag = RPT_SEVERITY_ALL;
|
2020-02-28 00:05:40 +00:00
|
|
|
else if( aEvent.GetEventObject() == m_showErrors )
|
2020-03-04 09:48:18 +00:00
|
|
|
flag = RPT_SEVERITY_ERROR;
|
2020-02-28 00:05:40 +00:00
|
|
|
else if( aEvent.GetEventObject() == m_showWarnings )
|
2020-03-04 09:48:18 +00:00
|
|
|
flag = RPT_SEVERITY_WARNING;
|
2020-02-28 00:05:40 +00:00
|
|
|
else if( aEvent.GetEventObject() == m_showExclusions )
|
2020-03-04 09:48:18 +00:00
|
|
|
flag = RPT_SEVERITY_EXCLUSION;
|
2020-02-27 22:00:14 +00:00
|
|
|
|
2020-02-28 00:05:40 +00:00
|
|
|
if( aEvent.IsChecked() )
|
2020-02-27 22:00:14 +00:00
|
|
|
m_severities |= flag;
|
2020-02-28 00:05:40 +00:00
|
|
|
else if( aEvent.GetEventObject() == m_showAll )
|
2020-03-04 09:48:18 +00:00
|
|
|
m_severities = RPT_SEVERITY_ERROR;
|
2020-02-27 22:00:14 +00:00
|
|
|
else
|
|
|
|
m_severities &= ~flag;
|
|
|
|
|
|
|
|
syncCheckboxes();
|
|
|
|
|
2020-02-28 00:05:40 +00:00
|
|
|
// 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_unconnectedTreeModel->SetSeverities( m_severities );
|
|
|
|
m_footprintWarningsTreeModel->SetSeverities( m_severities );
|
|
|
|
|
|
|
|
updateDisplayedCounts();
|
2020-02-27 22:00:14 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2020-03-16 11:05:01 +00:00
|
|
|
void DIALOG_DRC::OnSaveReport( wxCommandEvent& aEvent )
|
2020-02-27 22:00:14 +00:00
|
|
|
{
|
|
|
|
wxFileName fn( "./DRC." + ReportFileExtension );
|
2019-03-26 02:38:18 +00:00
|
|
|
|
2020-02-27 22:00:14 +00:00
|
|
|
wxFileDialog dlg( this, _( "Save Report to File" ), fn.GetPath(), fn.GetFullName(),
|
2020-02-24 23:17:30 +00:00
|
|
|
ReportFileWildcard(), wxFD_SAVE | wxFD_OVERWRITE_PROMPT );
|
2019-03-26 02:38:18 +00:00
|
|
|
|
2020-02-27 22:00:14 +00:00
|
|
|
if( dlg.ShowModal() != wxID_OK )
|
2020-02-24 23:17:30 +00:00
|
|
|
return;
|
2019-03-26 02:38:18 +00:00
|
|
|
|
2020-02-27 22:00:14 +00:00
|
|
|
fn = dlg.GetPath();
|
|
|
|
|
|
|
|
if( fn.GetExt().IsEmpty() )
|
|
|
|
fn.SetExt( ReportFileExtension );
|
|
|
|
|
|
|
|
if( !fn.IsAbsolute() )
|
|
|
|
{
|
|
|
|
wxString prj_path = Prj().GetProjectPath();
|
|
|
|
fn.MakeAbsolute( prj_path );
|
|
|
|
}
|
|
|
|
|
|
|
|
if( writeReport( fn.GetFullPath() ) )
|
|
|
|
{
|
|
|
|
m_Messages->AppendText( wxString::Format( _( "Report file '%s' created\n" ),
|
|
|
|
fn.GetFullPath() ) );
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
DisplayError( this, wxString::Format( _( "Unable to create report file '%s'" ),
|
|
|
|
fn.GetFullPath() ) );
|
|
|
|
}
|
2007-11-13 09:35:39 +00:00
|
|
|
}
|
2007-11-27 01:34:35 +00:00
|
|
|
|
|
|
|
|
2020-03-16 11:05:01 +00:00
|
|
|
void DIALOG_DRC::OnCancelClick( wxCommandEvent& aEvent )
|
2019-03-28 19:30:51 +00:00
|
|
|
{
|
2020-02-25 12:17:13 +00:00
|
|
|
m_brdEditor->FocusOnItem( nullptr );
|
|
|
|
|
2020-02-24 23:17:30 +00:00
|
|
|
SetReturnCode( wxID_CANCEL );
|
2020-02-27 22:00:14 +00:00
|
|
|
setDRCParameters();
|
2019-03-28 19:30:51 +00:00
|
|
|
|
2020-02-24 23:17:30 +00:00
|
|
|
// The dialog can be modal or not modal.
|
|
|
|
// Leave the DRC caller destroy (or not) the dialog
|
|
|
|
m_tester->DestroyDRCDialog( wxID_CANCEL );
|
2019-03-28 19:30:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2020-03-16 11:05:01 +00:00
|
|
|
void DIALOG_DRC::OnChangingNotebookPage( wxNotebookEvent& aEvent )
|
2012-12-10 19:08:09 +00:00
|
|
|
{
|
2018-01-16 19:09:37 +00:00
|
|
|
// Shouldn't be necessary, but is on at least OSX
|
2020-02-28 00:05:40 +00:00
|
|
|
if( aEvent.GetSelection() >= 0 )
|
|
|
|
m_Notebook->ChangeSelection( (unsigned) aEvent.GetSelection() );
|
2018-01-16 19:09:37 +00:00
|
|
|
|
2020-02-24 23:17:30 +00:00
|
|
|
m_markerDataView->UnselectAll();
|
|
|
|
m_unconnectedDataView->UnselectAll();
|
|
|
|
m_footprintsDataView->UnselectAll();
|
2019-03-28 19:30:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2020-03-16 11:05:01 +00:00
|
|
|
void DIALOG_DRC::refreshBoardEditor()
|
2007-12-03 21:28:56 +00:00
|
|
|
{
|
2018-11-14 23:34:32 +00:00
|
|
|
WINDOW_THAWER thawer( m_brdEditor );
|
2018-01-17 09:34:38 +00:00
|
|
|
|
2019-06-13 17:28:55 +00:00
|
|
|
m_brdEditor->GetCanvas()->Refresh();
|
2007-12-03 21:28:56 +00:00
|
|
|
}
|
2007-12-03 05:14:51 +00:00
|
|
|
|
|
|
|
|
2020-08-02 21:45:06 +00:00
|
|
|
void DIALOG_DRC::deleteAllMarkers( bool aIncludeExclusions )
|
2007-12-03 05:14:51 +00:00
|
|
|
{
|
2018-05-31 07:31:03 +00:00
|
|
|
// Clear current selection list to avoid selection of deleted items
|
|
|
|
m_brdEditor->GetToolManager()->RunAction( PCB_ACTIONS::selectionClear, true );
|
|
|
|
|
2020-08-04 12:25:44 +00:00
|
|
|
m_markerTreeModel->DeleteItems( false, aIncludeExclusions, true );
|
2007-12-03 05:14:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2020-03-16 11:05:01 +00:00
|
|
|
bool DIALOG_DRC::writeReport( const wxString& aFullFileName )
|
2016-06-15 17:00:30 +00:00
|
|
|
{
|
|
|
|
FILE* fp = wxFopen( aFullFileName, wxT( "w" ) );
|
|
|
|
|
|
|
|
if( fp == NULL )
|
|
|
|
return false;
|
|
|
|
|
2020-04-24 13:36:10 +00:00
|
|
|
std::map<KIID, EDA_ITEM*> itemMap;
|
|
|
|
m_brdEditor->GetBoard()->FillItemMap( itemMap );
|
|
|
|
|
2020-01-15 15:26:13 +00:00
|
|
|
int count;
|
2019-12-20 14:11:39 +00:00
|
|
|
EDA_UNITS units = GetUserUnits();
|
2007-12-04 18:23:38 +00:00
|
|
|
|
2020-01-15 15:26:13 +00:00
|
|
|
fprintf( fp, "** Drc report for %s **\n", TO_UTF8( m_brdEditor->GetBoard()->GetFileName() ) );
|
2007-12-05 13:50:42 +00:00
|
|
|
|
|
|
|
wxDateTime now = wxDateTime::Now();
|
2008-02-23 04:53:44 +00:00
|
|
|
|
2011-02-28 18:36:19 +00:00
|
|
|
fprintf( fp, "** Created on %s **\n", TO_UTF8( now.Format( wxT( "%F %T" ) ) ) );
|
2007-12-04 18:23:38 +00:00
|
|
|
|
2020-02-28 00:05:40 +00:00
|
|
|
count = m_markersProvider->GetCount();
|
2007-12-04 18:23:38 +00:00
|
|
|
|
2020-02-28 00:05:40 +00:00
|
|
|
fprintf( fp, "\n** Found %d DRC violations **\n", count );
|
2008-02-23 04:53:44 +00:00
|
|
|
|
2020-01-15 15:26:13 +00:00
|
|
|
for( int i = 0; i < count; ++i )
|
2020-04-24 13:36:10 +00:00
|
|
|
fprintf( fp, "%s", TO_UTF8( m_markersProvider->GetItem( i )->ShowReport( units, itemMap ) ) );
|
2007-12-04 18:23:38 +00:00
|
|
|
|
2020-02-28 00:05:40 +00:00
|
|
|
count = m_unconnectedItemsProvider->GetCount();
|
2007-12-04 18:23:38 +00:00
|
|
|
|
|
|
|
fprintf( fp, "\n** Found %d unconnected pads **\n", count );
|
2008-02-23 04:53:44 +00:00
|
|
|
|
2020-01-15 15:26:13 +00:00
|
|
|
for( int i = 0; i < count; ++i )
|
2020-04-24 13:36:10 +00:00
|
|
|
fprintf( fp, "%s", TO_UTF8( m_unconnectedItemsProvider->GetItem( i )->ShowReport( units, itemMap ) ) );
|
2008-02-23 04:53:44 +00:00
|
|
|
|
2020-02-28 00:05:40 +00:00
|
|
|
count = m_footprintWarningsProvider->GetCount();
|
2020-01-15 15:26:13 +00:00
|
|
|
|
|
|
|
fprintf( fp, "\n** Found %d Footprint errors **\n", count );
|
|
|
|
|
|
|
|
for( int i = 0; i < count; ++i )
|
2020-04-24 13:36:10 +00:00
|
|
|
fprintf( fp, "%s", TO_UTF8( m_footprintWarningsProvider->GetItem( i )->ShowReport( units, itemMap ) ) );
|
2020-01-15 15:26:13 +00:00
|
|
|
|
|
|
|
|
2007-12-04 18:23:38 +00:00
|
|
|
fprintf( fp, "\n** End of Report **\n" );
|
2016-06-15 17:00:30 +00:00
|
|
|
|
|
|
|
fclose( fp );
|
|
|
|
|
|
|
|
return true;
|
2007-12-04 18:23:38 +00:00
|
|
|
}
|
|
|
|
|
2007-12-03 05:14:51 +00:00
|
|
|
|
2020-03-16 11:05:01 +00:00
|
|
|
void DIALOG_DRC::OnDeleteOneClick( wxCommandEvent& aEvent )
|
2007-12-01 03:42:52 +00:00
|
|
|
{
|
2020-02-24 23:17:30 +00:00
|
|
|
if( m_Notebook->GetSelection() == 0 )
|
2007-12-03 05:14:51 +00:00
|
|
|
{
|
2020-02-24 23:17:30 +00:00
|
|
|
// Clear the selection. It may be the selected DRC marker.
|
|
|
|
m_brdEditor->GetToolManager()->RunAction( PCB_ACTIONS::selectionClear, true );
|
2011-12-22 13:28:11 +00:00
|
|
|
|
2020-02-28 00:05:40 +00:00
|
|
|
m_markerTreeModel->DeleteCurrentItem( true );
|
2019-05-14 22:07:34 +00:00
|
|
|
|
2020-02-24 23:17:30 +00:00
|
|
|
// redraw the pcb
|
2020-02-28 00:05:40 +00:00
|
|
|
refreshBoardEditor();
|
2007-12-03 05:14:51 +00:00
|
|
|
}
|
2020-02-24 23:17:30 +00:00
|
|
|
else if( m_Notebook->GetSelection() == 1 )
|
2007-12-03 05:14:51 +00:00
|
|
|
{
|
2020-02-28 00:05:40 +00:00
|
|
|
m_unconnectedTreeModel->DeleteCurrentItem( true );
|
|
|
|
}
|
|
|
|
else if( m_Notebook->GetSelection() == 2 )
|
|
|
|
{
|
|
|
|
m_footprintWarningsTreeModel->DeleteCurrentItem( true );
|
2007-12-03 05:14:51 +00:00
|
|
|
}
|
2016-09-08 18:17:37 +00:00
|
|
|
|
2020-02-28 00:05:40 +00:00
|
|
|
updateDisplayedCounts();
|
2016-09-08 18:17:37 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2020-03-16 11:05:01 +00:00
|
|
|
void DIALOG_DRC::OnDeleteAllClick( wxCommandEvent& aEvent )
|
2020-02-25 12:17:13 +00:00
|
|
|
{
|
2020-08-04 12:25:44 +00:00
|
|
|
static bool s_includeExclusions = false;
|
|
|
|
|
2020-08-02 21:45:06 +00:00
|
|
|
int numExcluded = 0;
|
|
|
|
|
|
|
|
if( m_markersProvider )
|
|
|
|
numExcluded += m_markersProvider->GetCount( RPT_SEVERITY_EXCLUSION );
|
|
|
|
|
|
|
|
if( m_unconnectedItemsProvider )
|
|
|
|
numExcluded += m_unconnectedItemsProvider->GetCount( RPT_SEVERITY_EXCLUSION );
|
|
|
|
|
|
|
|
if( m_footprintWarningsProvider )
|
|
|
|
numExcluded += m_footprintWarningsProvider->GetCount( RPT_SEVERITY_EXCLUSION );
|
|
|
|
|
|
|
|
if( numExcluded > 0 )
|
|
|
|
{
|
2020-08-04 10:50:39 +00:00
|
|
|
wxRichMessageDialog dlg( this, _( "Do you wish to delete excluded markers as well?" ),
|
|
|
|
_( "Delete All Markers" ),
|
|
|
|
wxOK | wxCANCEL | wxCENTER | wxICON_QUESTION );
|
2020-08-04 12:25:44 +00:00
|
|
|
dlg.ShowCheckBox( _( "Delete exclusions" ), s_includeExclusions );
|
2020-08-02 21:45:06 +00:00
|
|
|
|
|
|
|
int ret = dlg.ShowModal();
|
|
|
|
|
|
|
|
if( ret == wxID_CANCEL )
|
|
|
|
return;
|
2020-08-04 12:25:44 +00:00
|
|
|
else
|
|
|
|
s_includeExclusions = dlg.IsCheckBoxChecked();
|
2020-08-02 21:45:06 +00:00
|
|
|
}
|
|
|
|
|
2020-08-04 12:25:44 +00:00
|
|
|
deleteAllMarkers( s_includeExclusions );
|
2020-02-28 00:05:40 +00:00
|
|
|
|
|
|
|
refreshBoardEditor();
|
|
|
|
updateDisplayedCounts();
|
2020-02-25 12:17:13 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2020-03-16 11:05:01 +00:00
|
|
|
void DIALOG_DRC::updateDisplayedCounts()
|
2016-09-08 18:17:37 +00:00
|
|
|
{
|
2019-03-28 19:30:51 +00:00
|
|
|
wxString msg;
|
|
|
|
|
2020-02-28 00:05:40 +00:00
|
|
|
// First the tab headers:
|
|
|
|
//
|
|
|
|
|
2019-03-28 19:30:51 +00:00
|
|
|
if( m_tester->m_drcRun )
|
|
|
|
{
|
2020-02-24 23:17:30 +00:00
|
|
|
msg.sprintf( m_markersTitleTemplate, m_markerTreeModel->GetDRCItemCount() );
|
2019-03-28 19:30:51 +00:00
|
|
|
m_Notebook->SetPageText( 0, msg );
|
|
|
|
|
2020-02-28 00:05:40 +00:00
|
|
|
msg.sprintf( m_unconnectedTitleTemplate, m_unconnectedTreeModel->GetDRCItemCount() );
|
2019-03-28 19:30:51 +00:00
|
|
|
m_Notebook->SetPageText( 1, msg );
|
2016-09-08 18:17:37 +00:00
|
|
|
|
2019-03-28 19:30:51 +00:00
|
|
|
if( m_tester->m_footprintsTested )
|
2020-02-28 00:05:40 +00:00
|
|
|
msg.sprintf( m_footprintsTitleTemplate, m_footprintWarningsTreeModel->GetDRCItemCount() );
|
2019-03-28 19:30:51 +00:00
|
|
|
else
|
|
|
|
{
|
|
|
|
msg = m_footprintsTitleTemplate;
|
|
|
|
msg.Replace( wxT( "%d" ), _( "not run" ) );
|
|
|
|
}
|
|
|
|
m_Notebook->SetPageText( 2, msg );
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
msg = m_markersTitleTemplate;
|
|
|
|
msg.Replace( wxT( "(%d)" ), wxEmptyString );
|
|
|
|
m_Notebook->SetPageText( 0, msg );
|
|
|
|
|
|
|
|
msg = m_unconnectedTitleTemplate;
|
|
|
|
msg.Replace( wxT( "(%d)" ), wxEmptyString );
|
|
|
|
m_Notebook->SetPageText( 1, msg );
|
2018-01-30 14:13:34 +00:00
|
|
|
|
2019-03-28 19:30:51 +00:00
|
|
|
msg = m_footprintsTitleTemplate;
|
|
|
|
msg.Replace( wxT( "(%d)" ), wxEmptyString );
|
|
|
|
m_Notebook->SetPageText( 2, msg );
|
|
|
|
}
|
2020-02-28 00:05:40 +00:00
|
|
|
|
|
|
|
// And now the badges:
|
|
|
|
//
|
|
|
|
|
|
|
|
int numErrors = 0;
|
|
|
|
int numWarnings = 0;
|
|
|
|
int numExcluded = 0;
|
|
|
|
|
|
|
|
if( m_markersProvider )
|
|
|
|
{
|
2020-03-04 09:48:18 +00:00
|
|
|
numErrors += m_markersProvider->GetCount( RPT_SEVERITY_ERROR );
|
|
|
|
numWarnings += m_markersProvider->GetCount( RPT_SEVERITY_WARNING );
|
|
|
|
numExcluded += m_markersProvider->GetCount( RPT_SEVERITY_EXCLUSION );
|
2020-02-28 00:05:40 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if( m_unconnectedItemsProvider )
|
|
|
|
{
|
2020-03-04 09:48:18 +00:00
|
|
|
numErrors += m_unconnectedItemsProvider->GetCount( RPT_SEVERITY_ERROR );
|
|
|
|
numWarnings += m_unconnectedItemsProvider->GetCount( RPT_SEVERITY_WARNING );
|
|
|
|
numExcluded += m_unconnectedItemsProvider->GetCount( RPT_SEVERITY_EXCLUSION );
|
2020-02-28 00:05:40 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if( m_footprintWarningsProvider )
|
|
|
|
{
|
2020-03-04 09:48:18 +00:00
|
|
|
numErrors += m_footprintWarningsProvider->GetCount( RPT_SEVERITY_ERROR );
|
|
|
|
numWarnings += m_footprintWarningsProvider->GetCount( RPT_SEVERITY_WARNING );
|
|
|
|
numExcluded += m_footprintWarningsProvider->GetCount( RPT_SEVERITY_EXCLUSION );
|
2020-02-28 00:05:40 +00:00
|
|
|
}
|
|
|
|
|
2020-03-04 09:48:18 +00:00
|
|
|
m_errorsBadge->SetBitmap( MakeBadge( RPT_SEVERITY_ERROR, numErrors, m_errorsBadge ) );
|
|
|
|
m_warningsBadge->SetBitmap( MakeBadge( RPT_SEVERITY_WARNING, numWarnings, m_warningsBadge ) );
|
|
|
|
m_exclusionsBadge->SetBitmap( MakeBadge( RPT_SEVERITY_EXCLUSION, numExcluded, m_exclusionsBadge ) );
|
2007-12-01 03:42:52 +00:00
|
|
|
}
|