2011-10-31 20:29:46 +00:00
|
|
|
/**
|
|
|
|
* @file dialog_drc.cpp
|
|
|
|
*/
|
2007-05-06 16:03:28 +00:00
|
|
|
|
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
|
2018-01-17 14:36:04 +00:00
|
|
|
* Copyright (C) 2004-2018 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
|
|
|
|
2012-01-23 04:33:36 +00:00
|
|
|
#include <fctsys.h>
|
2017-03-16 17:09:33 +00:00
|
|
|
#include <kiface_i.h>
|
2016-06-15 17:00:30 +00:00
|
|
|
#include <confirm.h>
|
|
|
|
#include <wildcards_and_files_ext.h>
|
2018-01-30 14:13:34 +00:00
|
|
|
#include <bitmaps.h>
|
2016-06-15 17:00:30 +00:00
|
|
|
#include <pgm_base.h>
|
2012-01-23 04:33:36 +00:00
|
|
|
#include <dialog_drc.h>
|
2018-01-29 20:58:58 +00:00
|
|
|
#include <pcb_edit_frame.h>
|
2012-04-16 17:39:32 +00:00
|
|
|
#include <base_units.h>
|
2018-02-02 20:57:12 +00:00
|
|
|
#include <board_design_settings.h>
|
2015-06-18 09:35:02 +00:00
|
|
|
#include <class_draw_panel_gal.h>
|
2016-12-02 17:58:12 +00:00
|
|
|
#include <view/view.h>
|
2018-01-28 09:35:33 +00:00
|
|
|
#include <collectors.h>
|
|
|
|
#include <tool/tool_manager.h>
|
|
|
|
#include <tools/pcb_actions.h>
|
2009-11-05 19:51:50 +00:00
|
|
|
|
2018-05-31 07:31:03 +00:00
|
|
|
#include <tool/tool_manager.h>
|
|
|
|
#include <tools/pcb_actions.h>
|
|
|
|
|
2009-06-18 13:30:52 +00:00
|
|
|
/* class DIALOG_DRC_CONTROL: a dialog to set DRC parameters (clearance, min cooper size)
|
|
|
|
* and run DRC tests
|
2008-02-23 04:53:44 +00:00
|
|
|
*/
|
2009-06-27 06:26:41 +00:00
|
|
|
|
2017-03-16 17:09:33 +00:00
|
|
|
// Keywords for read and write config
|
2019-03-28 19:30:51 +00:00
|
|
|
#define DrcRefillZonesKey wxT( "RefillZonesBeforeDrc" )
|
|
|
|
#define DrcTrackToZoneTestKey wxT( "DrcTrackToZoneTest" )
|
|
|
|
#define DrcTestFootprintsKey wxT( "DrcTestFootprints" )
|
2017-03-16 17:09:33 +00:00
|
|
|
|
|
|
|
|
2016-07-27 12:53:45 +00:00
|
|
|
DIALOG_DRC_CONTROL::DIALOG_DRC_CONTROL( DRC* aTester, PCB_EDIT_FRAME* aEditorFrame,
|
|
|
|
wxWindow* aParent ) :
|
2018-02-03 09:09:53 +00:00
|
|
|
DIALOG_DRC_CONTROL_BASE( aParent ),
|
|
|
|
m_trackMinWidth( aEditorFrame, m_TrackMinWidthTitle, m_SetTrackMinWidthCtrl, m_TrackMinWidthUnit, true ),
|
|
|
|
m_viaMinSize( aEditorFrame, m_ViaMinTitle, m_SetViaMinSizeCtrl, m_ViaMinUnit, true ),
|
|
|
|
m_uviaMinSize( aEditorFrame, m_MicroViaMinTitle, m_SetMicroViakMinSizeCtrl, m_MicroViaMinUnit, true )
|
2007-05-06 16:03:28 +00:00
|
|
|
{
|
2017-03-16 17:09:33 +00:00
|
|
|
m_config = Kiface().KifaceSettings();
|
2007-12-01 03:42:52 +00:00
|
|
|
m_tester = aTester;
|
2016-07-27 12:53:45 +00:00
|
|
|
m_brdEditor = aEditorFrame;
|
|
|
|
m_currentBoard = m_brdEditor->GetBoard();
|
|
|
|
m_BrdSettings = m_brdEditor->GetBoard()->GetDesignSettings();
|
2007-05-06 16:03:28 +00:00
|
|
|
|
2018-01-30 14:13:34 +00:00
|
|
|
m_BrowseButton->SetBitmap( KiBitmap( folder_xpm ) );
|
|
|
|
|
|
|
|
// 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();
|
|
|
|
|
2009-10-21 19:16:25 +00:00
|
|
|
InitValues();
|
2016-06-15 17:00:30 +00:00
|
|
|
|
2018-01-30 14:13:34 +00:00
|
|
|
// Connect events
|
|
|
|
m_ClearanceListBox->Connect( ID_CLEARANCE_LIST, wxEVT_LEFT_DCLICK,
|
|
|
|
wxMouseEventHandler( DIALOG_DRC_CONTROL::OnLeftDClickClearance ), NULL, this );
|
|
|
|
m_ClearanceListBox->Connect( ID_CLEARANCE_LIST, wxEVT_RIGHT_UP,
|
|
|
|
wxMouseEventHandler( DIALOG_DRC_CONTROL::OnRightUpClearance ), NULL, this );
|
|
|
|
m_UnconnectedListBox->Connect( ID_UNCONNECTED_LIST, wxEVT_LEFT_DCLICK,
|
|
|
|
wxMouseEventHandler( DIALOG_DRC_CONTROL::OnLeftDClickUnconnected ), NULL, this );
|
|
|
|
m_UnconnectedListBox->Connect( ID_UNCONNECTED_LIST, wxEVT_RIGHT_UP,
|
|
|
|
wxMouseEventHandler( DIALOG_DRC_CONTROL::OnRightUpUnconnected ), NULL, this );
|
2019-03-28 19:30:51 +00:00
|
|
|
m_FootprintsListBox->Connect( ID_FOOTPRINTS_LIST, wxEVT_LEFT_DCLICK,
|
|
|
|
wxMouseEventHandler( DIALOG_DRC_CONTROL::OnLeftDClickFootprints ), NULL, this );
|
|
|
|
m_FootprintsListBox->Connect( ID_FOOTPRINTS_LIST, wxEVT_RIGHT_UP,
|
|
|
|
wxMouseEventHandler( DIALOG_DRC_CONTROL::OnRightUpFootprints ), NULL, this );
|
2018-01-30 14:13:34 +00:00
|
|
|
|
2016-07-15 10:05:13 +00:00
|
|
|
// Now all widgets have the size fixed, call FinishDialogSettings
|
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
|
|
|
|
2017-03-16 17:09:33 +00:00
|
|
|
DIALOG_DRC_CONTROL::~DIALOG_DRC_CONTROL()
|
|
|
|
{
|
2019-03-28 19:30:51 +00:00
|
|
|
m_config->Write( DrcRefillZonesKey, m_cbRefillZones->GetValue() );
|
2019-03-19 16:46:46 +00:00
|
|
|
m_config->Write( DrcTrackToZoneTestKey, m_cbReportTracksToZonesErrors->GetValue() );
|
2019-03-28 19:30:51 +00:00
|
|
|
m_config->Write( DrcTestFootprintsKey, m_cbTestFootprints->GetValue() );
|
2018-02-10 20:17:11 +00:00
|
|
|
|
2018-01-30 14:13:34 +00:00
|
|
|
// Disconnect events
|
2018-01-17 14:36:04 +00:00
|
|
|
m_ClearanceListBox->Disconnect( ID_CLEARANCE_LIST, wxEVT_LEFT_DCLICK,
|
2018-01-30 14:13:34 +00:00
|
|
|
wxMouseEventHandler( DIALOG_DRC_CONTROL::OnLeftDClickClearance ), NULL, this );
|
2018-01-17 14:36:04 +00:00
|
|
|
m_ClearanceListBox->Disconnect( ID_CLEARANCE_LIST, wxEVT_RIGHT_UP,
|
2018-01-30 14:13:34 +00:00
|
|
|
wxMouseEventHandler( DIALOG_DRC_CONTROL::OnRightUpClearance ), NULL, this );
|
2018-01-17 14:36:04 +00:00
|
|
|
m_UnconnectedListBox->Disconnect( ID_UNCONNECTED_LIST, wxEVT_LEFT_DCLICK,
|
2019-03-28 19:30:51 +00:00
|
|
|
wxMouseEventHandler( DIALOG_DRC_CONTROL::OnLeftDClickUnconnected ), NULL, this );
|
2018-01-17 14:36:04 +00:00
|
|
|
m_UnconnectedListBox->Disconnect( ID_UNCONNECTED_LIST, wxEVT_RIGHT_UP,
|
2019-03-28 19:30:51 +00:00
|
|
|
wxMouseEventHandler( DIALOG_DRC_CONTROL::OnRightUpUnconnected ), NULL, this );
|
|
|
|
m_FootprintsListBox->Disconnect( ID_FOOTPRINTS_LIST, wxEVT_LEFT_DCLICK,
|
|
|
|
wxMouseEventHandler( DIALOG_DRC_CONTROL::OnLeftDClickFootprints ), NULL, this );
|
|
|
|
m_FootprintsListBox->Disconnect( ID_FOOTPRINTS_LIST, wxEVT_RIGHT_UP,
|
|
|
|
wxMouseEventHandler( DIALOG_DRC_CONTROL::OnRightUpFootprints ), NULL, this );
|
2017-03-16 17:09:33 +00:00
|
|
|
}
|
2009-11-05 22:02:24 +00:00
|
|
|
|
2018-01-30 14:13:34 +00:00
|
|
|
|
2016-04-15 18:15:22 +00:00
|
|
|
void DIALOG_DRC_CONTROL::OnActivateDlg( wxActivateEvent& event )
|
|
|
|
{
|
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
|
2016-07-27 12:53:45 +00:00
|
|
|
m_BrdSettings = m_brdEditor->GetBoard()->GetDesignSettings();
|
2016-04-15 18:15:22 +00:00
|
|
|
DisplayDRCValues();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void DIALOG_DRC_CONTROL::DisplayDRCValues()
|
|
|
|
{
|
2018-02-03 09:09:53 +00:00
|
|
|
m_trackMinWidth.SetValue( m_BrdSettings.m_TrackMinWidth );
|
|
|
|
m_viaMinSize.SetValue( m_BrdSettings.m_ViasMinSize );
|
|
|
|
m_uviaMinSize.SetValue( m_BrdSettings.m_MicroViasMinSize );
|
2016-04-15 18:15:22 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-10-21 19:16:25 +00:00
|
|
|
void DIALOG_DRC_CONTROL::InitValues()
|
2007-11-27 01:34:35 +00:00
|
|
|
{
|
2018-01-30 14:13:34 +00:00
|
|
|
m_markersTitleTemplate = m_Notebook->GetPageText( 0 );
|
|
|
|
m_unconnectedTitleTemplate = m_Notebook->GetPageText( 1 );
|
2019-03-28 19:30:51 +00:00
|
|
|
m_footprintsTitleTemplate = m_Notebook->GetPageText( 2 );
|
2009-06-27 06:26:41 +00:00
|
|
|
|
2012-12-10 19:08:09 +00:00
|
|
|
m_DeleteCurrentMarkerButton->Enable( false );
|
|
|
|
|
2016-04-15 18:15:22 +00:00
|
|
|
DisplayDRCValues();
|
|
|
|
|
2017-03-16 17:09:33 +00:00
|
|
|
// read options
|
|
|
|
bool value;
|
2019-03-28 19:30:51 +00:00
|
|
|
m_config->Read( DrcRefillZonesKey, &value, false );
|
2018-02-10 20:17:11 +00:00
|
|
|
m_cbRefillZones->SetValue( value );
|
2019-03-19 16:46:46 +00:00
|
|
|
m_config->Read( DrcTrackToZoneTestKey, &value, false );
|
|
|
|
m_cbReportTracksToZonesErrors->SetValue( value );
|
2019-03-28 19:30:51 +00:00
|
|
|
m_config->Read( DrcTestFootprintsKey, &value, false );
|
|
|
|
m_cbTestFootprints->SetValue( value );
|
2017-03-16 17:09:33 +00:00
|
|
|
|
2016-06-15 17:00:30 +00:00
|
|
|
Layout(); // adding the units above expanded Clearance text, now resize.
|
|
|
|
|
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
|
|
|
|
2009-10-06 18:58:51 +00:00
|
|
|
/* accept DRC parameters (min clearance value and min sizes
|
|
|
|
*/
|
|
|
|
void DIALOG_DRC_CONTROL::SetDrcParmeters( )
|
|
|
|
{
|
2018-02-03 09:09:53 +00:00
|
|
|
m_BrdSettings.m_TrackMinWidth = m_trackMinWidth.GetValue();
|
|
|
|
m_BrdSettings.m_ViasMinSize = m_viaMinSize.GetValue();
|
|
|
|
m_BrdSettings.m_MicroViasMinSize = m_uviaMinSize.GetValue();
|
++PCBNew
* Removed Pcb_Frame argument from BOARD() constructor, since it precludes
having a BOARD being edited by more than one editor, it was a bad design.
And this meant removing m_PcbFrame from BOARD.
* removed BOARD::SetWindowFrame(), and BOARD::m_PcbFrame
* Removed the global BOARD_DESIGN_SETTINGS which was in class_board.cpp
* added BOARD_DESIGN_SETTINGS to the BOARD class, a full instance
* a couple dialogs now only change BOARD_DESIGN_SETTINGS when OK is pressed,
such as dialog_mask_clearance, dialog_drc, etc.
* Removed common/pcbcommon.cpp's int g_CurrentVersionPCB = 1 and replaced it
with build_version.h's #define BOARD_FILE_VERSION, although there may be a
better place for this constant.
* Made the public functions in PARAM_CFG_ARRAY be type const.
void SaveParam(..) const and void ReadParam(..) const
* PARAM_CFG_BASE now has virtual destructor since we have various way of
destroying the derived class and boost::ptr_vector must be told about this.
* Pass const PARAM_CFG_ARRAY& instead of PARAM_CFG_ARRAY so that we can use
an automatic PARAM_CFG_ARRAY which is on the stack.\
* PCB_EDIT_FRAME::GetProjectFileParameters() may no longer cache the array,
since it has to access the current BOARD and the BOARD can change.
Remember BOARD_DESIGN_SETTINGS are now in the BOARD.
* Made the m_BoundingBox member private, this was a brutally hard task,
and indicative of the lack of commitment to accessors and object oriented
design on the part of KiCad developers. We must do better.
Added BOARD::GetBoundingBox, SetBoundingBox(), ComputeBoundingBox().
* Added PCB_BASE_FRAME::GetBoardBoundingBox() which calls BOARD::ComputeBoundingBox()
2011-12-05 06:15:33 +00:00
|
|
|
|
2016-07-27 12:53:45 +00:00
|
|
|
m_brdEditor->GetBoard()->SetDesignSettings( m_BrdSettings );
|
2009-10-06 18:58:51 +00:00
|
|
|
}
|
|
|
|
|
2007-12-03 05:14:51 +00:00
|
|
|
|
2016-06-15 17:00:30 +00:00
|
|
|
void DIALOG_DRC_CONTROL::SetRptSettings( bool aEnable, const wxString& aFileName )
|
|
|
|
{
|
|
|
|
m_RptFilenameCtrl->SetValue( aFileName );
|
2018-01-30 14:13:34 +00:00
|
|
|
m_CreateRptCtrl->SetValue( aEnable );
|
2016-06-15 17:00:30 +00:00
|
|
|
}
|
|
|
|
|
2018-02-10 20:17:11 +00:00
|
|
|
|
2016-06-15 17:00:30 +00:00
|
|
|
void DIALOG_DRC_CONTROL::GetRptSettings( bool* aEnable, wxString& aFileName )
|
|
|
|
{
|
|
|
|
*aEnable = m_CreateRptCtrl->GetValue();
|
|
|
|
aFileName = m_RptFilenameCtrl->GetValue();
|
|
|
|
}
|
|
|
|
|
2018-02-10 20:17:11 +00:00
|
|
|
|
2009-06-18 13:30:52 +00:00
|
|
|
void DIALOG_DRC_CONTROL::OnStartdrcClick( wxCommandEvent& event )
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
2018-01-30 14:13:34 +00:00
|
|
|
wxString reportName, msg;
|
2008-02-23 04:53:44 +00:00
|
|
|
|
2016-06-17 06:24:54 +00:00
|
|
|
bool make_report = m_CreateRptCtrl->IsChecked();
|
|
|
|
|
|
|
|
if( make_report ) // Create a rpt file
|
2007-12-03 05:14:51 +00:00
|
|
|
{
|
|
|
|
reportName = m_RptFilenameCtrl->GetValue();
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2007-12-03 05:14:51 +00:00
|
|
|
if( reportName.IsEmpty() )
|
|
|
|
{
|
2016-06-15 17:00:30 +00:00
|
|
|
wxCommandEvent dummy;
|
|
|
|
OnButtonBrowseRptFileClick( dummy );
|
2007-12-03 05:14:51 +00:00
|
|
|
}
|
|
|
|
|
2016-06-17 06:24:54 +00:00
|
|
|
if( !reportName.IsEmpty() )
|
|
|
|
reportName = makeValidFileNameReport();
|
|
|
|
}
|
2016-06-15 17:00:30 +00:00
|
|
|
|
++PCBNew
* Removed Pcb_Frame argument from BOARD() constructor, since it precludes
having a BOARD being edited by more than one editor, it was a bad design.
And this meant removing m_PcbFrame from BOARD.
* removed BOARD::SetWindowFrame(), and BOARD::m_PcbFrame
* Removed the global BOARD_DESIGN_SETTINGS which was in class_board.cpp
* added BOARD_DESIGN_SETTINGS to the BOARD class, a full instance
* a couple dialogs now only change BOARD_DESIGN_SETTINGS when OK is pressed,
such as dialog_mask_clearance, dialog_drc, etc.
* Removed common/pcbcommon.cpp's int g_CurrentVersionPCB = 1 and replaced it
with build_version.h's #define BOARD_FILE_VERSION, although there may be a
better place for this constant.
* Made the public functions in PARAM_CFG_ARRAY be type const.
void SaveParam(..) const and void ReadParam(..) const
* PARAM_CFG_BASE now has virtual destructor since we have various way of
destroying the derived class and boost::ptr_vector must be told about this.
* Pass const PARAM_CFG_ARRAY& instead of PARAM_CFG_ARRAY so that we can use
an automatic PARAM_CFG_ARRAY which is on the stack.\
* PCB_EDIT_FRAME::GetProjectFileParameters() may no longer cache the array,
since it has to access the current BOARD and the BOARD can change.
Remember BOARD_DESIGN_SETTINGS are now in the BOARD.
* Made the m_BoundingBox member private, this was a brutally hard task,
and indicative of the lack of commitment to accessors and object oriented
design on the part of KiCad developers. We must do better.
Added BOARD::GetBoundingBox, SetBoundingBox(), ComputeBoundingBox().
* Added PCB_BASE_FRAME::GetBoardBoundingBox() which calls BOARD::ComputeBoundingBox()
2011-12-05 06:15:33 +00:00
|
|
|
SetDrcParmeters();
|
2019-03-28 19:30:51 +00:00
|
|
|
m_tester->m_doZonesTest = m_cbReportTracksToZonesErrors->GetValue();
|
|
|
|
m_tester->m_rptFilename = reportName;
|
|
|
|
m_tester->m_doCreateRptFile = make_report;
|
|
|
|
m_tester->m_refillZones = m_cbRefillZones->GetValue();
|
|
|
|
m_tester->m_drcInLegacyRoutingMode = false;
|
|
|
|
m_tester->m_reportAllTrackErrors = m_cbReportAllTrackErrors->GetValue();
|
|
|
|
m_tester->m_testFootprints = m_cbTestFootprints->GetValue();
|
2009-06-27 06:26:41 +00:00
|
|
|
|
2007-12-03 21:28:56 +00:00
|
|
|
DelDRCMarkers();
|
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();
|
2018-01-30 14:13:34 +00:00
|
|
|
wxSafeYield(); // Allows time slice to refresh the Messages
|
|
|
|
m_brdEditor->GetBoard()->m_Status_Pcb = 0; // Force full connectivity and ratsnest calculations
|
2009-06-27 06:26:41 +00:00
|
|
|
m_tester->RunTests(m_Messages);
|
2018-01-30 14:13:34 +00:00
|
|
|
m_Notebook->ChangeSelection( 0 ); // display the "Problems/Markers" tab
|
2008-02-23 04:53:44 +00:00
|
|
|
|
|
|
|
// Generate the report
|
2007-12-03 05:14:51 +00:00
|
|
|
if( !reportName.IsEmpty() )
|
|
|
|
{
|
2016-06-15 17:00:30 +00:00
|
|
|
if( writeReport( reportName ) )
|
|
|
|
{
|
|
|
|
msg.Printf( _( "Report file \"%s\" created" ), GetChars( reportName ) );
|
2018-01-30 14:13:34 +00:00
|
|
|
wxMessageDialog popupWindow( this, msg, _( "Disk File Report Completed" ) );
|
2016-06-15 17:00:30 +00:00
|
|
|
popupWindow.ShowModal();
|
|
|
|
}
|
|
|
|
else
|
2018-01-30 14:13:34 +00:00
|
|
|
{
|
|
|
|
msg.Printf( _( "Unable to create report file \"%s\"" ), GetChars( reportName ) );
|
|
|
|
DisplayError( this, msg );
|
|
|
|
}
|
2007-12-03 05:14:51 +00:00
|
|
|
}
|
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
|
|
|
|
2007-12-03 21:28:56 +00:00
|
|
|
RedrawDrawPanel();
|
2007-06-05 12:10:51 +00:00
|
|
|
}
|
|
|
|
|
2007-12-03 21:28:56 +00:00
|
|
|
|
2009-06-18 13:30:52 +00:00
|
|
|
void DIALOG_DRC_CONTROL::OnDeleteAllClick( wxCommandEvent& event )
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
2007-12-03 21:28:56 +00:00
|
|
|
DelDRCMarkers();
|
|
|
|
RedrawDrawPanel();
|
2016-09-08 18:17:37 +00:00
|
|
|
UpdateDisplayedCounts();
|
2007-06-05 12:10:51 +00:00
|
|
|
}
|
|
|
|
|
2007-12-03 05:14:51 +00:00
|
|
|
|
2018-01-30 14:13:34 +00:00
|
|
|
void DIALOG_DRC_CONTROL::OnButtonBrowseRptFileClick( wxCommandEvent& )
|
2007-08-02 07:42:58 +00:00
|
|
|
{
|
2016-07-27 12:53:45 +00:00
|
|
|
wxFileName fn = m_brdEditor->GetBoard()->GetFileName();
|
2016-06-17 06:24:54 +00:00
|
|
|
fn.SetExt( ReportFileExtension );
|
|
|
|
wxString prj_path = Prj().GetProjectPath();
|
2009-04-05 20:49:15 +00:00
|
|
|
|
2018-01-30 14:13:34 +00:00
|
|
|
wxFileDialog dlg( this, _( "Save DRC Report File" ), prj_path, fn.GetFullName(),
|
|
|
|
ReportFileWildcard(), wxFD_SAVE | wxFD_OVERWRITE_PROMPT );
|
2009-04-05 20:49:15 +00:00
|
|
|
|
|
|
|
if( dlg.ShowModal() == wxID_CANCEL )
|
2007-11-13 09:35:39 +00:00
|
|
|
return;
|
|
|
|
|
2018-01-30 14:13:34 +00:00
|
|
|
m_CreateRptCtrl->SetValue( true );
|
2009-06-27 06:26:41 +00:00
|
|
|
m_RptFilenameCtrl->SetValue( dlg.GetPath() );
|
2007-08-02 07:42:58 +00:00
|
|
|
}
|
|
|
|
|
2007-10-03 15:21:13 +00:00
|
|
|
|
2018-01-30 14:13:34 +00:00
|
|
|
void DIALOG_DRC_CONTROL::OnCancelClick( wxCommandEvent& event )
|
2007-10-03 15:21:13 +00:00
|
|
|
{
|
2018-01-30 14:13:34 +00:00
|
|
|
SetReturnCode( wxID_CANCEL );
|
++PCBNew
* Removed Pcb_Frame argument from BOARD() constructor, since it precludes
having a BOARD being edited by more than one editor, it was a bad design.
And this meant removing m_PcbFrame from BOARD.
* removed BOARD::SetWindowFrame(), and BOARD::m_PcbFrame
* Removed the global BOARD_DESIGN_SETTINGS which was in class_board.cpp
* added BOARD_DESIGN_SETTINGS to the BOARD class, a full instance
* a couple dialogs now only change BOARD_DESIGN_SETTINGS when OK is pressed,
such as dialog_mask_clearance, dialog_drc, etc.
* Removed common/pcbcommon.cpp's int g_CurrentVersionPCB = 1 and replaced it
with build_version.h's #define BOARD_FILE_VERSION, although there may be a
better place for this constant.
* Made the public functions in PARAM_CFG_ARRAY be type const.
void SaveParam(..) const and void ReadParam(..) const
* PARAM_CFG_BASE now has virtual destructor since we have various way of
destroying the derived class and boost::ptr_vector must be told about this.
* Pass const PARAM_CFG_ARRAY& instead of PARAM_CFG_ARRAY so that we can use
an automatic PARAM_CFG_ARRAY which is on the stack.\
* PCB_EDIT_FRAME::GetProjectFileParameters() may no longer cache the array,
since it has to access the current BOARD and the BOARD can change.
Remember BOARD_DESIGN_SETTINGS are now in the BOARD.
* Made the m_BoundingBox member private, this was a brutally hard task,
and indicative of the lack of commitment to accessors and object oriented
design on the part of KiCad developers. We must do better.
Added BOARD::GetBoundingBox, SetBoundingBox(), ComputeBoundingBox().
* Added PCB_BASE_FRAME::GetBoardBoundingBox() which calls BOARD::ComputeBoundingBox()
2011-12-05 06:15:33 +00:00
|
|
|
SetDrcParmeters();
|
2009-11-05 19:51:50 +00:00
|
|
|
|
2016-07-28 12:07:35 +00:00
|
|
|
// The dialog can be modal or not modal.
|
|
|
|
// Leave the DRC caller destroy (or not) the dialog
|
2018-01-30 14:13:34 +00:00
|
|
|
m_tester->DestroyDRCDialog( wxID_CANCEL );
|
2007-11-27 01:34:35 +00:00
|
|
|
}
|
2007-10-03 15:21:13 +00:00
|
|
|
|
|
|
|
|
2018-01-30 14:13:34 +00:00
|
|
|
void DIALOG_DRC_CONTROL::OnReportCheckBoxClicked( wxCommandEvent& event )
|
2007-11-27 01:34:35 +00:00
|
|
|
{
|
2018-01-30 14:13:34 +00:00
|
|
|
if( m_CreateRptCtrl->IsChecked() )
|
|
|
|
m_RptFilenameCtrl->SetFocus();
|
2007-11-27 01:34:35 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2018-01-30 14:13:34 +00:00
|
|
|
void DIALOG_DRC_CONTROL::OnReportFilenameEdited( wxCommandEvent &event )
|
2007-11-27 01:34:35 +00:00
|
|
|
{
|
2018-01-30 14:13:34 +00:00
|
|
|
m_CreateRptCtrl->SetValue( event.GetString().Length() );
|
2007-10-03 15:21:13 +00:00
|
|
|
}
|
|
|
|
|
2007-11-13 09:35:39 +00:00
|
|
|
|
2009-06-18 13:30:52 +00:00
|
|
|
void DIALOG_DRC_CONTROL::OnLeftDClickClearance( wxMouseEvent& event )
|
2007-11-13 09:35:39 +00:00
|
|
|
{
|
2007-12-04 18:23:38 +00:00
|
|
|
event.Skip();
|
|
|
|
|
2007-11-27 01:34:35 +00:00
|
|
|
int selection = m_ClearanceListBox->GetSelection();
|
|
|
|
|
|
|
|
if( selection != wxNOT_FOUND )
|
|
|
|
{
|
2019-03-26 02:38:18 +00:00
|
|
|
if( focusOnItem( m_ClearanceListBox->GetItem( selection ) ) )
|
2007-12-04 07:04:53 +00:00
|
|
|
{
|
2016-07-28 12:07:35 +00:00
|
|
|
if( !IsModal() )
|
|
|
|
{
|
|
|
|
// turn control over to m_brdEditor, hide this DIALOG_DRC_CONTROL window,
|
|
|
|
// no destruction so we can preserve listbox cursor
|
|
|
|
Show( false );
|
2008-02-23 04:53:44 +00:00
|
|
|
|
2018-01-30 14:13:34 +00:00
|
|
|
// We do not want the clarify selection popup when releasing the
|
|
|
|
// left button in the main window
|
2016-07-28 12:07:35 +00:00
|
|
|
m_brdEditor->SkipNextLeftButtonReleaseEvent();
|
|
|
|
}
|
2007-12-04 07:04:53 +00:00
|
|
|
}
|
2007-11-27 01:34:35 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2019-03-28 19:30:51 +00:00
|
|
|
void DIALOG_DRC_CONTROL::OnRightUpFootprints( wxMouseEvent& event )
|
|
|
|
{
|
|
|
|
// popup menu to go to either of the items listed in the DRC_ITEM.
|
2019-03-26 02:38:18 +00:00
|
|
|
// Check if user right-clicked on a different item
|
|
|
|
int selection = m_FootprintsListBox->HitTest( event.GetPosition() );
|
2019-03-28 19:30:51 +00:00
|
|
|
|
2019-03-26 02:38:18 +00:00
|
|
|
if( selection == wxNOT_FOUND )
|
|
|
|
selection = m_FootprintsListBox->GetSelection();
|
|
|
|
else
|
|
|
|
m_FootprintsListBox->SetSelection( selection );
|
2019-03-28 19:30:51 +00:00
|
|
|
|
|
|
|
if( selection != wxNOT_FOUND )
|
|
|
|
doSelectionMenu( m_FootprintsListBox->GetItem( selection ) );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2019-03-26 02:38:18 +00:00
|
|
|
void DIALOG_DRC_CONTROL::OnLeftUpClearance( wxMouseEvent& event )
|
|
|
|
{
|
|
|
|
int selection = m_ClearanceListBox->GetSelection();
|
|
|
|
|
|
|
|
if( selection != wxNOT_FOUND )
|
|
|
|
focusOnItem( m_ClearanceListBox->GetItem( selection ) );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
bool DIALOG_DRC_CONTROL::focusOnItem( const DRC_ITEM* aItem )
|
|
|
|
{
|
|
|
|
if( !aItem )
|
|
|
|
return false;
|
|
|
|
|
|
|
|
auto toolmgr = m_brdEditor->GetToolManager();
|
|
|
|
auto pos = aItem->GetPointA();
|
|
|
|
auto marker = static_cast<MARKER_PCB*>( aItem->GetParent() );
|
|
|
|
|
|
|
|
if( marker )
|
|
|
|
{
|
|
|
|
pos = marker->GetPos();
|
|
|
|
|
|
|
|
toolmgr->RunAction( PCB_ACTIONS::selectionClear, true );
|
|
|
|
toolmgr->RunAction( PCB_ACTIONS::selectItem, true, marker );
|
|
|
|
}
|
|
|
|
|
|
|
|
toolmgr->GetView()->SetCenter( pos );
|
|
|
|
m_brdEditor->GetCanvas()->Refresh();
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-06-18 13:30:52 +00:00
|
|
|
void DIALOG_DRC_CONTROL::OnRightUpUnconnected( wxMouseEvent& event )
|
2007-11-27 01:34:35 +00:00
|
|
|
{
|
2007-12-04 20:44:41 +00:00
|
|
|
// popup menu to go to either of the items listed in the DRC_ITEM.
|
2019-03-26 02:38:18 +00:00
|
|
|
// Check if user right-clicked on a different item
|
|
|
|
int selection = m_UnconnectedListBox->HitTest( event.GetPosition() );
|
2008-02-23 04:53:44 +00:00
|
|
|
|
2019-03-26 02:38:18 +00:00
|
|
|
if( selection == wxNOT_FOUND )
|
|
|
|
selection = m_UnconnectedListBox->GetSelection();
|
|
|
|
else
|
|
|
|
m_UnconnectedListBox->SetSelection( selection );
|
2008-02-23 04:53:44 +00:00
|
|
|
|
2007-12-04 20:44:41 +00:00
|
|
|
if( selection != wxNOT_FOUND )
|
2018-01-28 09:35:33 +00:00
|
|
|
doSelectionMenu( m_UnconnectedListBox->GetItem( selection ) );
|
2007-11-27 01:34:35 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-06-18 13:30:52 +00:00
|
|
|
void DIALOG_DRC_CONTROL::OnRightUpClearance( wxMouseEvent& event )
|
2007-11-27 01:34:35 +00:00
|
|
|
{
|
2007-12-04 20:44:41 +00:00
|
|
|
// popup menu to go to either of the items listed in the DRC_ITEM.
|
2019-03-26 02:38:18 +00:00
|
|
|
// Check if user right-clicked on a different item
|
|
|
|
int selection = m_ClearanceListBox->HitTest( event.GetPosition() );
|
2008-02-23 04:53:44 +00:00
|
|
|
|
2019-03-26 02:38:18 +00:00
|
|
|
if( selection == wxNOT_FOUND )
|
|
|
|
selection = m_ClearanceListBox->GetSelection();
|
|
|
|
else
|
|
|
|
m_ClearanceListBox->SetSelection( selection );
|
2008-02-23 04:53:44 +00:00
|
|
|
|
2007-12-04 20:44:41 +00:00
|
|
|
if( selection != wxNOT_FOUND )
|
2018-01-28 09:35:33 +00:00
|
|
|
doSelectionMenu( m_ClearanceListBox->GetItem( selection ) );
|
|
|
|
}
|
2008-02-23 04:53:44 +00:00
|
|
|
|
|
|
|
|
2018-01-28 09:35:33 +00:00
|
|
|
void DIALOG_DRC_CONTROL::doSelectionMenu( const DRC_ITEM* aItem )
|
|
|
|
{
|
|
|
|
// popup menu to go to either of the items listed in the DRC_ITEM.
|
2019-03-26 02:38:18 +00:00
|
|
|
|
|
|
|
BOARD_ITEM* first = aItem->GetMainItem( m_brdEditor->GetBoard() );
|
|
|
|
BOARD_ITEM* second = nullptr;
|
|
|
|
|
2018-01-28 09:35:33 +00:00
|
|
|
GENERAL_COLLECTOR items;
|
2007-12-04 20:44:41 +00:00
|
|
|
|
2019-03-26 02:38:18 +00:00
|
|
|
items.Append( first );
|
2018-01-28 09:35:33 +00:00
|
|
|
|
|
|
|
if( aItem->HasSecondItem() )
|
2019-03-26 02:38:18 +00:00
|
|
|
{
|
|
|
|
second = aItem->GetAuxiliaryItem( m_brdEditor->GetBoard() );
|
|
|
|
items.Append( second );
|
|
|
|
}
|
2018-01-28 09:35:33 +00:00
|
|
|
|
2018-11-14 23:34:32 +00:00
|
|
|
WINDOW_THAWER thawer( m_brdEditor );
|
2019-04-13 15:22:48 +00:00
|
|
|
m_brdEditor->GetToolManager()->VetoContextMenuMouseWarp();
|
2018-01-28 09:35:33 +00:00
|
|
|
m_brdEditor->GetToolManager()->RunAction( PCB_ACTIONS::selectionMenu, true, &items );
|
2019-03-26 02:38:18 +00:00
|
|
|
|
|
|
|
// If we got an item, focus on it
|
|
|
|
BOARD_ITEM* selection = m_brdEditor->GetCurItem();
|
|
|
|
|
|
|
|
if( selection && ( selection == first || selection == second ) )
|
|
|
|
m_brdEditor->GetToolManager()->GetView()->SetCenter( selection->GetPosition() );
|
|
|
|
|
2018-01-28 09:35:33 +00:00
|
|
|
m_brdEditor->GetCanvas()->Refresh();
|
2007-11-13 09:35:39 +00:00
|
|
|
}
|
2007-11-27 01:34:35 +00:00
|
|
|
|
|
|
|
|
2019-03-28 19:30:51 +00:00
|
|
|
void DIALOG_DRC_CONTROL::OnLeftDClickFootprints( wxMouseEvent& event )
|
|
|
|
{
|
|
|
|
event.Skip();
|
|
|
|
|
|
|
|
int selection = m_FootprintsListBox->GetSelection();
|
|
|
|
|
|
|
|
if( selection != wxNOT_FOUND )
|
|
|
|
{
|
|
|
|
// Find the selected DRC_ITEM in the listbox, position cursor there.
|
|
|
|
// Then hide the dialog.
|
2019-03-26 02:38:18 +00:00
|
|
|
if( focusOnItem( m_FootprintsListBox->GetItem( selection ) ) )
|
2019-03-28 19:30:51 +00:00
|
|
|
{
|
|
|
|
if( !IsModal() )
|
|
|
|
{
|
|
|
|
Show( false );
|
|
|
|
|
|
|
|
// We do not want the clarify selection popup when releasing the
|
|
|
|
// left button in the main window
|
|
|
|
m_brdEditor->SkipNextLeftButtonReleaseEvent();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-06-18 13:30:52 +00:00
|
|
|
void DIALOG_DRC_CONTROL::OnLeftDClickUnconnected( wxMouseEvent& event )
|
2007-11-27 01:34:35 +00:00
|
|
|
{
|
2007-12-04 18:23:38 +00:00
|
|
|
event.Skip();
|
|
|
|
|
2007-11-27 01:34:35 +00:00
|
|
|
int selection = m_UnconnectedListBox->GetSelection();
|
|
|
|
|
|
|
|
if( selection != wxNOT_FOUND )
|
|
|
|
{
|
2019-03-26 02:38:18 +00:00
|
|
|
if( focusOnItem( m_UnconnectedListBox->GetItem( selection ) ) )
|
2007-12-04 07:04:53 +00:00
|
|
|
{
|
2016-07-28 12:07:35 +00:00
|
|
|
if( !IsModal() )
|
|
|
|
{
|
2019-03-26 02:38:18 +00:00
|
|
|
// turn control over to m_brdEditor, hide this DIALOG_DRC_CONTROL window,
|
|
|
|
// no destruction so we can preserve listbox cursor
|
2016-07-28 12:07:35 +00:00
|
|
|
Show( false );
|
2008-02-23 04:53:44 +00:00
|
|
|
|
2018-01-30 14:13:34 +00:00
|
|
|
// We do not want the clarify selection popup when releasing the
|
|
|
|
// left button in the main window
|
2016-07-28 12:07:35 +00:00
|
|
|
m_brdEditor->SkipNextLeftButtonReleaseEvent();
|
|
|
|
}
|
2007-12-04 07:04:53 +00:00
|
|
|
}
|
2007-11-27 01:34:35 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-02-10 20:17:11 +00:00
|
|
|
|
2019-03-26 02:38:18 +00:00
|
|
|
void DIALOG_DRC_CONTROL::OnLeftUpUnconnected( wxMouseEvent& event )
|
|
|
|
{
|
|
|
|
int selection = m_UnconnectedListBox->GetSelection();
|
|
|
|
|
|
|
|
if( selection != wxNOT_FOUND )
|
|
|
|
focusOnItem( m_UnconnectedListBox->GetItem( selection ) );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2012-12-10 19:08:09 +00:00
|
|
|
/* called when switching from Error list to Unconnected list
|
|
|
|
* To avoid mistakes, the current marker is selection is cleared
|
|
|
|
*/
|
|
|
|
void DIALOG_DRC_CONTROL::OnChangingMarkerList( wxNotebookEvent& event )
|
|
|
|
{
|
2018-01-16 19:09:37 +00:00
|
|
|
// Shouldn't be necessary, but is on at least OSX
|
2019-03-28 19:30:51 +00:00
|
|
|
if( event.GetSelection() >= 0 )
|
|
|
|
m_Notebook->ChangeSelection( (unsigned) event.GetSelection() );
|
2018-01-16 19:09:37 +00:00
|
|
|
|
2012-12-10 19:08:09 +00:00
|
|
|
m_DeleteCurrentMarkerButton->Enable( false );
|
|
|
|
m_ClearanceListBox->SetSelection( -1 );
|
|
|
|
m_UnconnectedListBox->SetSelection( -1 );
|
|
|
|
}
|
2007-11-27 01:34:35 +00:00
|
|
|
|
2018-01-17 14:36:04 +00:00
|
|
|
|
2009-06-18 13:30:52 +00:00
|
|
|
void DIALOG_DRC_CONTROL::OnMarkerSelectionEvent( wxCommandEvent& event )
|
2007-11-27 01:34:35 +00:00
|
|
|
{
|
|
|
|
int selection = event.GetSelection();
|
2008-02-23 04:53:44 +00:00
|
|
|
|
2007-11-27 01:34:35 +00:00
|
|
|
if( selection != wxNOT_FOUND )
|
|
|
|
{
|
|
|
|
// until a MARKER is selected, this button is not enabled.
|
2009-06-27 06:26:41 +00:00
|
|
|
m_DeleteCurrentMarkerButton->Enable( true );
|
2012-12-10 19:08:09 +00:00
|
|
|
|
2018-01-30 14:13:34 +00:00
|
|
|
// Find the selected DRC_ITEM in the listbox, position cursor there.
|
2019-03-26 02:38:18 +00:00
|
|
|
focusOnItem( m_ClearanceListBox->GetItem( selection ) );
|
2007-11-27 01:34:35 +00:00
|
|
|
}
|
2008-02-23 04:53:44 +00:00
|
|
|
|
2007-11-27 01:34:35 +00:00
|
|
|
event.Skip();
|
|
|
|
}
|
|
|
|
|
2009-06-27 06:26:41 +00:00
|
|
|
|
2009-06-18 13:30:52 +00:00
|
|
|
void DIALOG_DRC_CONTROL::OnUnconnectedSelectionEvent( wxCommandEvent& event )
|
2007-11-27 01:34:35 +00:00
|
|
|
{
|
|
|
|
int selection = event.GetSelection();
|
2008-02-23 04:53:44 +00:00
|
|
|
|
2007-11-27 01:34:35 +00:00
|
|
|
if( selection != wxNOT_FOUND )
|
|
|
|
{
|
2007-12-04 07:04:53 +00:00
|
|
|
// until a MARKER is selected, this button is not enabled.
|
2009-06-27 06:26:41 +00:00
|
|
|
m_DeleteCurrentMarkerButton->Enable( true );
|
2012-12-10 19:08:09 +00:00
|
|
|
|
2018-01-30 14:13:34 +00:00
|
|
|
// Find the selected DRC_ITEM in the listbox, position cursor there.
|
2019-03-26 02:38:18 +00:00
|
|
|
focusOnItem( m_UnconnectedListBox->GetItem( selection ) );
|
2007-11-27 01:34:35 +00:00
|
|
|
}
|
2008-02-23 04:53:44 +00:00
|
|
|
|
2007-11-27 01:34:35 +00:00
|
|
|
event.Skip();
|
|
|
|
}
|
|
|
|
|
2007-12-01 03:42:52 +00:00
|
|
|
|
2019-03-28 19:30:51 +00:00
|
|
|
void DIALOG_DRC_CONTROL::OnFootprintsSelectionEvent( wxCommandEvent& event )
|
|
|
|
{
|
|
|
|
int selection = event.GetSelection();
|
|
|
|
|
|
|
|
if( selection != wxNOT_FOUND )
|
|
|
|
{
|
|
|
|
// until a MARKER is selected, this button is not enabled.
|
|
|
|
m_DeleteCurrentMarkerButton->Enable( true );
|
|
|
|
|
|
|
|
// Find the selected DRC_ITEM in the listbox, position cursor there.
|
2019-03-26 02:38:18 +00:00
|
|
|
focusOnItem( m_FootprintsListBox->GetItem( selection ) );
|
2019-03-28 19:30:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
event.Skip();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-06-18 13:30:52 +00:00
|
|
|
void DIALOG_DRC_CONTROL::RedrawDrawPanel()
|
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
|
|
|
|
2016-07-27 12:53:45 +00:00
|
|
|
m_brdEditor->GetCanvas()->Refresh();
|
2007-12-03 21:28:56 +00:00
|
|
|
}
|
2007-12-03 05:14:51 +00:00
|
|
|
|
|
|
|
|
2009-06-18 13:30:52 +00:00
|
|
|
void DIALOG_DRC_CONTROL::DelDRCMarkers()
|
2007-12-03 05:14:51 +00:00
|
|
|
{
|
2016-07-27 12:53:45 +00:00
|
|
|
m_brdEditor->SetCurItem( NULL ); // clear curr item, because it could be a DRC marker
|
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 );
|
|
|
|
|
2007-12-03 21:28:56 +00:00
|
|
|
m_ClearanceListBox->DeleteAllItems();
|
|
|
|
m_UnconnectedListBox->DeleteAllItems();
|
2012-12-10 19:08:09 +00:00
|
|
|
m_DeleteCurrentMarkerButton->Enable( false );
|
2007-12-03 05:14:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2016-06-15 17:00:30 +00:00
|
|
|
const wxString DIALOG_DRC_CONTROL::makeValidFileNameReport()
|
2007-12-04 18:23:38 +00:00
|
|
|
{
|
2016-06-15 17:00:30 +00:00
|
|
|
wxFileName fn = m_RptFilenameCtrl->GetValue();
|
|
|
|
|
|
|
|
if( !fn.HasExt() )
|
|
|
|
{
|
|
|
|
fn.SetExt( ReportFileExtension );
|
|
|
|
m_RptFilenameCtrl->SetValue( fn.GetFullPath() );
|
|
|
|
}
|
|
|
|
|
|
|
|
// Ensure it is an absolute filename. if it is given relative
|
|
|
|
// it will be made relative to the project
|
|
|
|
if( !fn.IsAbsolute() )
|
|
|
|
{
|
|
|
|
wxString prj_path = Prj().GetProjectPath();
|
|
|
|
fn.MakeAbsolute( prj_path );
|
|
|
|
}
|
|
|
|
|
|
|
|
return fn.GetFullPath();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
bool DIALOG_DRC_CONTROL::writeReport( const wxString& aFullFileName )
|
|
|
|
{
|
|
|
|
FILE* fp = wxFopen( aFullFileName, wxT( "w" ) );
|
|
|
|
|
|
|
|
if( fp == NULL )
|
|
|
|
return false;
|
|
|
|
|
2007-12-04 18:23:38 +00:00
|
|
|
int count;
|
2018-06-15 04:49:50 +00:00
|
|
|
EDA_UNITS_T units = GetUserUnits();
|
2007-12-04 18:23:38 +00:00
|
|
|
|
|
|
|
fprintf( fp, "** Drc report for %s **\n",
|
2016-07-27 12:53:45 +00:00
|
|
|
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
|
|
|
|
|
|
|
count = m_ClearanceListBox->GetItemCount();
|
|
|
|
|
|
|
|
fprintf( fp, "\n** Found %d DRC errors **\n", count );
|
2008-02-23 04:53:44 +00:00
|
|
|
|
2009-06-27 06:26:41 +00:00
|
|
|
for( int i = 0; i<count; ++i )
|
2018-06-15 04:49:50 +00:00
|
|
|
fprintf( fp, "%s", TO_UTF8( m_ClearanceListBox->GetItem( i )->ShowReport( units ) ) );
|
2007-12-04 18:23:38 +00:00
|
|
|
|
|
|
|
count = m_UnconnectedListBox->GetItemCount();
|
|
|
|
|
|
|
|
fprintf( fp, "\n** Found %d unconnected pads **\n", count );
|
2008-02-23 04:53:44 +00:00
|
|
|
|
2009-06-27 06:26:41 +00:00
|
|
|
for( int i = 0; i<count; ++i )
|
2018-06-15 04:49:50 +00:00
|
|
|
fprintf( fp, "%s", TO_UTF8( m_UnconnectedListBox->GetItem( i )->ShowReport( units ) ) );
|
2008-02-23 04:53:44 +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
|
|
|
|
2009-06-18 13:30:52 +00:00
|
|
|
void DIALOG_DRC_CONTROL::OnDeleteOneClick( wxCommandEvent& event )
|
2007-12-01 03:42:52 +00:00
|
|
|
{
|
2007-12-03 05:14:51 +00:00
|
|
|
int selectedIndex;
|
2009-06-27 06:26:41 +00:00
|
|
|
int curTab = m_Notebook->GetSelection();
|
2007-12-03 05:14:51 +00:00
|
|
|
|
|
|
|
if( curTab == 0 )
|
|
|
|
{
|
|
|
|
selectedIndex = m_ClearanceListBox->GetSelection();
|
2011-12-22 13:28:11 +00:00
|
|
|
|
2007-12-03 05:14:51 +00:00
|
|
|
if( selectedIndex != wxNOT_FOUND )
|
|
|
|
{
|
|
|
|
m_ClearanceListBox->DeleteItem( selectedIndex );
|
2008-02-23 04:53:44 +00:00
|
|
|
|
2007-12-04 18:23:38 +00:00
|
|
|
// redraw the pcb
|
2007-12-04 07:04:53 +00:00
|
|
|
RedrawDrawPanel();
|
2007-12-03 05:14:51 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else if( curTab == 1 )
|
|
|
|
{
|
|
|
|
selectedIndex = m_UnconnectedListBox->GetSelection();
|
2011-12-22 13:28:11 +00:00
|
|
|
|
2007-12-03 05:14:51 +00:00
|
|
|
if( selectedIndex != wxNOT_FOUND )
|
|
|
|
{
|
|
|
|
m_UnconnectedListBox->DeleteItem( selectedIndex );
|
2008-02-23 04:53:44 +00:00
|
|
|
|
|
|
|
/* these unconnected DRC_ITEMs are not currently visible on the pcb
|
2009-06-27 06:26:41 +00:00
|
|
|
* RedrawDrawPanel();
|
|
|
|
*/
|
2007-12-03 05:14:51 +00:00
|
|
|
}
|
|
|
|
}
|
2016-09-08 18:17:37 +00:00
|
|
|
|
|
|
|
UpdateDisplayedCounts();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void DIALOG_DRC_CONTROL::UpdateDisplayedCounts()
|
|
|
|
{
|
2019-03-28 19:30:51 +00:00
|
|
|
wxString msg;
|
|
|
|
|
|
|
|
if( m_tester->m_drcRun )
|
|
|
|
{
|
|
|
|
msg.sprintf( m_markersTitleTemplate, (int) m_ClearanceListBox->GetItemCount() );
|
|
|
|
m_Notebook->SetPageText( 0, msg );
|
|
|
|
|
|
|
|
msg.sprintf( m_unconnectedTitleTemplate, (int) m_UnconnectedListBox->GetItemCount() );
|
|
|
|
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 )
|
|
|
|
msg.sprintf( m_footprintsTitleTemplate, (int) m_FootprintsListBox->GetItemCount() );
|
|
|
|
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 );
|
|
|
|
}
|
2007-12-01 03:42:52 +00:00
|
|
|
}
|