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.
|
|
|
|
*
|
2015-07-08 07:33:11 +00:00
|
|
|
* Copyright (C) 2015 Jean-Pierre Charras, jean-pierre.charras@ujf-grenoble.fr
|
2012-08-03 15:43:15 +00:00
|
|
|
* Copyright (C) 2009 Dick Hollenbeck, dick@softplc.com
|
2015-07-08 07:33:11 +00:00
|
|
|
* Copyright (C) 2004-2015 KiCad Developers, see change_log.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>
|
|
|
|
#include <dialog_drc.h>
|
|
|
|
#include <wxPcbStruct.h>
|
2012-04-16 17:39:32 +00:00
|
|
|
#include <base_units.h>
|
2012-01-23 04:33:36 +00:00
|
|
|
#include <class_board_design_settings.h>
|
2015-06-18 09:35:02 +00:00
|
|
|
#include <class_draw_panel_gal.h>
|
2009-11-05 19:51:50 +00:00
|
|
|
|
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
|
|
|
|
2011-03-01 19:26:17 +00:00
|
|
|
DIALOG_DRC_CONTROL::DIALOG_DRC_CONTROL( DRC* aTester, PCB_EDIT_FRAME* parent ) :
|
2009-06-27 06:26:41 +00:00
|
|
|
DIALOG_DRC_CONTROL_BASE( parent )
|
2007-05-06 16:03:28 +00:00
|
|
|
{
|
2007-12-01 03:42:52 +00:00
|
|
|
m_tester = aTester;
|
2007-11-13 09:35:39 +00:00
|
|
|
m_Parent = parent;
|
++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
|
|
|
m_BrdSettings = m_Parent->GetBoard()->GetDesignSettings();
|
2007-05-06 16:03:28 +00:00
|
|
|
|
2009-10-21 19:16:25 +00:00
|
|
|
InitValues();
|
2009-06-27 06:26:41 +00:00
|
|
|
if( GetSizer() )
|
2007-07-30 11:15:54 +00:00
|
|
|
{
|
2009-06-27 06:26:41 +00:00
|
|
|
GetSizer()->SetSizeHints( this );
|
2007-07-30 11:15:54 +00:00
|
|
|
}
|
2010-01-31 20:01:46 +00:00
|
|
|
|
2009-12-04 09:21:53 +00:00
|
|
|
Centre();
|
2009-11-05 22:02:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-10-21 19:16:25 +00:00
|
|
|
void DIALOG_DRC_CONTROL::InitValues()
|
2007-11-27 01:34:35 +00:00
|
|
|
{
|
|
|
|
// Connect events and objects
|
2009-06-27 06:26:41 +00:00
|
|
|
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 );
|
|
|
|
|
|
|
|
AddUnitSymbol( *m_TrackMinWidthTitle );
|
|
|
|
AddUnitSymbol( *m_ViaMinTitle );
|
|
|
|
AddUnitSymbol( *m_MicroViaMinTitle );
|
2009-11-05 19:51:50 +00:00
|
|
|
|
2012-12-10 19:08:09 +00:00
|
|
|
m_DeleteCurrentMarkerButton->Enable( false );
|
|
|
|
|
2007-12-01 03:42:52 +00:00
|
|
|
Layout(); // adding the units above expanded Clearance text, now resize.
|
2007-05-06 16:03:28 +00:00
|
|
|
|
2009-06-18 13:30:52 +00:00
|
|
|
// Set the initial "enabled" status of the browse button and the text
|
|
|
|
// field for report name
|
|
|
|
wxCommandEvent junk;
|
|
|
|
OnReportCheckBoxClicked( junk );
|
2007-05-06 16:03:28 +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
|
|
|
|
2009-10-06 18:58:51 +00:00
|
|
|
/* accept DRC parameters (min clearance value and min sizes
|
|
|
|
*/
|
|
|
|
void DIALOG_DRC_CONTROL::SetDrcParmeters( )
|
|
|
|
{
|
* KIWAY Milestone A): Make major modules into DLL/DSOs.
! The initial testing of this commit should be done using a Debug build so that
all the wxASSERT()s are enabled. Also, be sure and keep enabled the
USE_KIWAY_DLLs option. The tree won't likely build without it. Turning it
off is senseless anyways. If you want stable code, go back to a prior version,
the one tagged with "stable".
* Relocate all functionality out of the wxApp derivative into more finely
targeted purposes:
a) DLL/DSO specific
b) PROJECT specific
c) EXE or process specific
d) configuration file specific data
e) configuration file manipulations functions.
All of this functionality was blended into an extremely large wxApp derivative
and that was incompatible with the desire to support multiple concurrently
loaded DLL/DSO's ("KIFACE")s and multiple concurrently open projects.
An amazing amount of organization come from simply sorting each bit of
functionality into the proper box.
* Switch to wxConfigBase from wxConfig everywhere except instantiation.
* Add classes KIWAY, KIFACE, KIFACE_I, SEARCH_STACK, PGM_BASE, PGM_KICAD,
PGM_SINGLE_TOP,
* Remove "Return" prefix on many function names.
* Remove obvious comments from CMakeLists.txt files, and from else() and endif()s.
* Fix building boost for use in a DSO on linux.
* Remove some of the assumptions in the CMakeLists.txt files that windows had
to be the host platform when building windows binaries.
* Reduce the number of wxStrings being constructed at program load time via
static construction.
* Pass wxConfigBase* to all SaveSettings() and LoadSettings() functions so that
these functions are useful even when the wxConfigBase comes from another
source, as is the case in the KICAD_MANAGER_FRAME.
* Move the setting of the KIPRJMOD environment variable into class PROJECT,
so that it can be moved into a project variable soon, and out of FP_LIB_TABLE.
* Add the KIWAY_PLAYER which is associated with a particular PROJECT, and all
its child wxFrames and wxDialogs now have a Kiway() member function which
returns a KIWAY& that that window tree branch is in support of. This is like
wxWindows DNA in that child windows get this member with proper value at time
of construction.
* Anticipate some of the needs for milestones B) and C) and make code
adjustments now in an effort to reduce work in those milestones.
* No testing has been done for python scripting, since milestone C) has that
being largely reworked and re-thought-out.
2014-03-20 00:42:08 +00:00
|
|
|
m_BrdSettings.m_TrackMinWidth = ValueFromTextCtrl( *m_SetTrackMinWidthCtrl );
|
|
|
|
m_BrdSettings.m_ViasMinSize = ValueFromTextCtrl( *m_SetViaMinSizeCtrl );
|
|
|
|
m_BrdSettings.m_MicroViasMinSize = ValueFromTextCtrl( *m_SetMicroViakMinSizeCtrl );
|
++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
|
|
|
|
|
|
|
m_Parent->GetBoard()->SetDesignSettings( m_BrdSettings );
|
2009-10-06 18:58:51 +00:00
|
|
|
}
|
|
|
|
|
2007-12-03 05:14:51 +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
|
|
|
{
|
2007-12-03 05:14:51 +00:00
|
|
|
wxString reportName;
|
2008-02-23 04:53:44 +00:00
|
|
|
|
2007-12-03 05:14:51 +00:00
|
|
|
if( m_CreateRptCtrl->IsChecked() ) // Create a file rpt
|
|
|
|
{
|
|
|
|
reportName = m_RptFilenameCtrl->GetValue();
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2007-12-03 05:14:51 +00:00
|
|
|
if( reportName.IsEmpty() )
|
|
|
|
{
|
|
|
|
wxCommandEvent junk;
|
|
|
|
OnButtonBrowseRptFileClick( junk );
|
|
|
|
}
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2007-12-03 05:14:51 +00:00
|
|
|
reportName = m_RptFilenameCtrl->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
|
|
|
SetDrcParmeters();
|
2008-02-23 04:53:44 +00:00
|
|
|
|
2009-06-27 06:26:41 +00:00
|
|
|
m_tester->SetSettings( true, // Pad to pad DRC test enabled
|
2012-07-13 18:55:29 +00:00
|
|
|
true, // unconnected pdas DRC test enabled
|
|
|
|
true, // DRC test for zones enabled
|
|
|
|
true, // DRC test for keepout areas enabled
|
|
|
|
reportName, m_CreateRptCtrl->IsChecked() );
|
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();
|
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();
|
2009-09-10 15:22:26 +00:00
|
|
|
wxSafeYield(); // Allows time slice to refresh the m_Messages window
|
|
|
|
m_tester->m_pcb->m_Status_Pcb = 0; // Force full connectivity and ratsnest recalculations
|
2009-06-27 06:26:41 +00:00
|
|
|
m_tester->RunTests(m_Messages);
|
2007-12-03 05:14:51 +00:00
|
|
|
|
2009-06-27 06:26:41 +00:00
|
|
|
m_Notebook->ChangeSelection( 0 ); // display the 1at tab "...Markers ..."
|
2008-02-23 04:53:44 +00:00
|
|
|
|
|
|
|
|
|
|
|
// Generate the report
|
2007-12-03 05:14:51 +00:00
|
|
|
if( !reportName.IsEmpty() )
|
|
|
|
{
|
|
|
|
FILE* fp = wxFopen( reportName, wxT( "w" ) );
|
2007-12-04 18:23:38 +00:00
|
|
|
writeReport( fp );
|
2009-06-27 06:26:41 +00:00
|
|
|
fclose( fp );
|
2007-12-03 05:14:51 +00:00
|
|
|
|
2009-06-27 06:26:41 +00:00
|
|
|
wxString msg;
|
2009-09-10 15:22:26 +00:00
|
|
|
msg.Printf( _( "Report file \"%s\" created" ), GetChars( reportName ) );
|
2008-02-23 04:53:44 +00:00
|
|
|
|
2009-06-27 06:26:41 +00:00
|
|
|
wxString caption( _( "Disk File Report Completed" ) );
|
2007-12-04 18:23:38 +00:00
|
|
|
wxMessageDialog popupWindow( this, msg, caption );
|
2008-02-23 04:53:44 +00:00
|
|
|
|
2007-12-04 18:23:38 +00:00
|
|
|
popupWindow.ShowModal();
|
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();
|
2007-06-05 12:10:51 +00:00
|
|
|
}
|
|
|
|
|
2007-12-03 05:14:51 +00:00
|
|
|
|
2009-06-18 13:30:52 +00:00
|
|
|
void DIALOG_DRC_CONTROL::OnListUnconnectedClick( wxCommandEvent& event )
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
2007-12-03 05:14:51 +00:00
|
|
|
wxString reportName;
|
2008-02-23 04:53:44 +00:00
|
|
|
|
2007-12-03 05:14:51 +00:00
|
|
|
if( m_CreateRptCtrl->IsChecked() ) // Create a file rpt
|
|
|
|
{
|
|
|
|
reportName = m_RptFilenameCtrl->GetValue();
|
|
|
|
|
|
|
|
if( reportName.IsEmpty() )
|
|
|
|
{
|
|
|
|
wxCommandEvent junk;
|
|
|
|
OnButtonBrowseRptFileClick( junk );
|
|
|
|
}
|
|
|
|
|
|
|
|
reportName = m_RptFilenameCtrl->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
|
|
|
SetDrcParmeters();
|
2008-02-23 04:53:44 +00:00
|
|
|
|
2009-06-27 06:26:41 +00:00
|
|
|
m_tester->SetSettings( true, // Pad to pad DRC test enabled
|
2012-07-13 18:55:29 +00:00
|
|
|
true, // unconnected pdas DRC test enabled
|
|
|
|
true, // DRC test for zones enabled
|
|
|
|
true, // DRC test for keepout areas enabled
|
|
|
|
reportName, m_CreateRptCtrl->IsChecked() );
|
2007-12-03 05:14:51 +00:00
|
|
|
|
2008-02-23 04:53:44 +00:00
|
|
|
DelDRCMarkers();
|
2007-12-03 05:14:51 +00:00
|
|
|
|
2007-12-05 14:17:10 +00:00
|
|
|
wxBeginBusyCursor();
|
2008-02-23 04:53:44 +00:00
|
|
|
|
2009-06-27 06:26:41 +00:00
|
|
|
m_Messages->Clear();
|
2007-12-03 05:14:51 +00:00
|
|
|
m_tester->ListUnconnectedPads();
|
|
|
|
|
2009-06-27 06:26:41 +00:00
|
|
|
m_Notebook->ChangeSelection( 1 ); // display the 2nd tab "Unconnected..."
|
2008-02-23 04:53:44 +00:00
|
|
|
|
|
|
|
// Generate the report
|
2007-12-03 05:14:51 +00:00
|
|
|
if( !reportName.IsEmpty() )
|
|
|
|
{
|
|
|
|
FILE* fp = wxFopen( reportName, wxT( "w" ) );
|
2007-12-04 18:23:38 +00:00
|
|
|
writeReport( fp );
|
2009-06-27 06:26:41 +00:00
|
|
|
fclose( fp );
|
2007-12-03 05:14:51 +00:00
|
|
|
|
2009-06-27 06:26:41 +00:00
|
|
|
wxString msg;
|
2009-09-10 15:22:26 +00:00
|
|
|
msg.Printf( _( "Report file \"%s\" created" ), GetChars( reportName ) );
|
2009-06-27 06:26:41 +00:00
|
|
|
wxString caption( _( "Disk File Report Completed" ) );
|
2007-12-04 18:23:38 +00:00
|
|
|
wxMessageDialog popupWindow( this, msg, caption );
|
|
|
|
popupWindow.ShowModal();
|
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();
|
2007-12-04 18:23:38 +00:00
|
|
|
|
2008-02-23 04:53:44 +00:00
|
|
|
/* there is currently nothing visible on the DrawPanel for unconnected pads
|
2009-06-27 06:26:41 +00:00
|
|
|
* RedrawDrawPanel();
|
|
|
|
*/
|
2007-06-05 12:10:51 +00:00
|
|
|
}
|
|
|
|
|
2009-06-27 06:26:41 +00:00
|
|
|
|
2007-08-02 07:42:58 +00:00
|
|
|
/*!
|
|
|
|
* wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_BUTTON_BROWSE_RPT_FILE
|
|
|
|
*/
|
|
|
|
|
2009-06-18 13:30:52 +00:00
|
|
|
void DIALOG_DRC_CONTROL::OnButtonBrowseRptFileClick( wxCommandEvent& event )
|
2007-08-02 07:42:58 +00:00
|
|
|
{
|
2009-06-27 06:26:41 +00:00
|
|
|
wxFileName fn;
|
|
|
|
wxString wildcard( _( "DRC report files (.rpt)|*.rpt" ) );
|
|
|
|
wxString Ext( wxT( "rpt" ) );
|
2009-04-05 20:49:15 +00:00
|
|
|
|
2012-08-29 16:59:50 +00:00
|
|
|
fn = m_Parent->GetBoard()->GetFileName() + wxT( "-drc" );
|
2009-04-05 20:49:15 +00:00
|
|
|
fn.SetExt( Ext );
|
|
|
|
|
|
|
|
wxFileDialog dlg( this, _( "Save DRC Report File" ), wxEmptyString,
|
|
|
|
fn.GetFullName(), wildcard,
|
|
|
|
wxFD_SAVE | wxFD_OVERWRITE_PROMPT | wxFD_CHANGE_DIR );
|
|
|
|
|
|
|
|
if( dlg.ShowModal() == wxID_CANCEL )
|
2007-11-13 09:35:39 +00:00
|
|
|
return;
|
|
|
|
|
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
|
|
|
|
2009-06-18 13:30:52 +00:00
|
|
|
void DIALOG_DRC_CONTROL::OnOkClick( wxCommandEvent& event )
|
2007-10-03 15:21:13 +00:00
|
|
|
{
|
2007-12-03 05:14:51 +00:00
|
|
|
SetReturnCode( wxID_OK );
|
++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
|
|
|
|
2007-12-04 18:23:38 +00:00
|
|
|
m_tester->DestroyDialog( wxID_OK );
|
2007-11-27 01:34:35 +00:00
|
|
|
}
|
2007-10-03 15:21:13 +00:00
|
|
|
|
|
|
|
|
2009-06-18 13:30:52 +00:00
|
|
|
void DIALOG_DRC_CONTROL::OnCancelClick( wxCommandEvent& event )
|
2007-11-27 01:34:35 +00:00
|
|
|
{
|
2007-12-03 05:14:51 +00:00
|
|
|
SetReturnCode( wxID_CANCEL );
|
2009-11-05 19:51:50 +00:00
|
|
|
|
2007-12-04 18:23:38 +00:00
|
|
|
m_tester->DestroyDialog( wxID_CANCEL );
|
2007-11-27 01:34:35 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
* wxEVT_COMMAND_CHECKBOX_CLICKED event handler for ID_CHECKBOX1
|
|
|
|
*/
|
2007-10-03 15:21:13 +00:00
|
|
|
|
2009-06-18 13:30:52 +00:00
|
|
|
void DIALOG_DRC_CONTROL::OnReportCheckBoxClicked( wxCommandEvent& event )
|
2007-11-27 01:34:35 +00:00
|
|
|
{
|
|
|
|
if( m_CreateRptCtrl->IsChecked() )
|
|
|
|
{
|
2009-06-27 06:26:41 +00:00
|
|
|
m_RptFilenameCtrl->Enable( true );
|
|
|
|
m_BrowseButton->Enable( true );
|
2007-11-27 01:34:35 +00:00
|
|
|
}
|
2007-10-03 15:21:13 +00:00
|
|
|
else
|
|
|
|
{
|
2009-06-27 06:26:41 +00:00
|
|
|
m_RptFilenameCtrl->Enable( false );
|
|
|
|
m_BrowseButton->Enable( false );
|
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();
|
|
|
|
|
|
|
|
// I am assuming that the double click actually changed the selected item.
|
2008-02-23 04:53:44 +00:00
|
|
|
// please verify this.
|
2007-11-27 01:34:35 +00:00
|
|
|
int selection = m_ClearanceListBox->GetSelection();
|
|
|
|
|
|
|
|
if( selection != wxNOT_FOUND )
|
|
|
|
{
|
2007-12-03 05:14:51 +00:00
|
|
|
// Find the selected MARKER in the PCB, position cursor there.
|
2007-12-04 07:04:53 +00:00
|
|
|
// Then close the dialog.
|
|
|
|
const DRC_ITEM* item = m_ClearanceListBox->GetItem( selection );
|
|
|
|
if( item )
|
|
|
|
{
|
2007-12-04 18:23:38 +00:00
|
|
|
/*
|
2009-06-27 06:26:41 +00:00
|
|
|
* // after the goto, process a button OK command later.
|
|
|
|
* wxCommandEvent cmd( wxEVT_COMMAND_BUTTON_CLICKED, wxID_OK );
|
|
|
|
* ::wxPostEvent( GetEventHandler(), cmd );
|
|
|
|
*/
|
2008-02-23 04:53:44 +00:00
|
|
|
|
2009-07-06 18:02:26 +00:00
|
|
|
m_Parent->CursorGoto( item->GetPointA() );
|
2015-06-18 09:35:02 +00:00
|
|
|
m_Parent->GetGalCanvas()->GetView()->SetCenter( VECTOR2D( item->GetPointA() ) );
|
2008-02-23 04:53:44 +00:00
|
|
|
|
2009-06-18 13:30:52 +00:00
|
|
|
// turn control over to m_Parent, hide this DIALOG_DRC_CONTROL window,
|
2007-12-04 18:23:38 +00:00
|
|
|
// no destruction so we can preserve listbox cursor
|
2009-11-05 22:02:24 +00:00
|
|
|
Show( false );
|
2008-02-23 04:53:44 +00:00
|
|
|
|
2012-12-07 10:05:19 +00:00
|
|
|
// We do not want the clarification popup window.
|
|
|
|
// when releasing the left button in the main window
|
|
|
|
m_Parent->SkipNextLeftButtonReleaseEvent();
|
2007-12-04 07:04:53 +00:00
|
|
|
}
|
2007-11-27 01:34:35 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-06-18 13:30:52 +00:00
|
|
|
void DIALOG_DRC_CONTROL::OnPopupMenu( wxCommandEvent& event )
|
2007-12-04 20:44:41 +00:00
|
|
|
{
|
2009-06-27 06:26:41 +00:00
|
|
|
int source = event.GetId();
|
2008-02-23 04:53:44 +00:00
|
|
|
|
2007-12-04 20:44:41 +00:00
|
|
|
const DRC_ITEM* item = 0;
|
|
|
|
wxPoint pos;
|
2008-02-23 04:53:44 +00:00
|
|
|
|
2009-06-27 06:26:41 +00:00
|
|
|
int selection;
|
2007-12-04 20:44:41 +00:00
|
|
|
|
|
|
|
switch( source )
|
|
|
|
{
|
|
|
|
case ID_POPUP_UNCONNECTED_A:
|
|
|
|
selection = m_UnconnectedListBox->GetSelection();
|
|
|
|
item = m_UnconnectedListBox->GetItem( selection );
|
|
|
|
pos = item->GetPointA();
|
|
|
|
break;
|
2009-06-27 06:26:41 +00:00
|
|
|
|
2007-12-04 20:44:41 +00:00
|
|
|
case ID_POPUP_UNCONNECTED_B:
|
|
|
|
selection = m_UnconnectedListBox->GetSelection();
|
|
|
|
item = m_UnconnectedListBox->GetItem( selection );
|
|
|
|
pos = item->GetPointB();
|
|
|
|
break;
|
2009-06-27 06:26:41 +00:00
|
|
|
|
2007-12-04 20:44:41 +00:00
|
|
|
case ID_POPUP_MARKERS_A:
|
|
|
|
selection = m_ClearanceListBox->GetSelection();
|
|
|
|
item = m_ClearanceListBox->GetItem( selection );
|
|
|
|
pos = item->GetPointA();
|
|
|
|
break;
|
2009-06-27 06:26:41 +00:00
|
|
|
|
2007-12-04 20:44:41 +00:00
|
|
|
case ID_POPUP_MARKERS_B:
|
|
|
|
selection = m_ClearanceListBox->GetSelection();
|
|
|
|
item = m_ClearanceListBox->GetItem( selection );
|
|
|
|
pos = item->GetPointB();
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
if( item )
|
|
|
|
{
|
|
|
|
m_Parent->CursorGoto( pos );
|
2015-06-18 09:35:02 +00:00
|
|
|
m_Parent->GetGalCanvas()->GetView()->SetCenter( VECTOR2D( item->GetPointA() ) );
|
|
|
|
|
2009-11-05 22:02:24 +00:00
|
|
|
Show( false );
|
2007-12-04 20:44:41 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-06-18 13:30:52 +00:00
|
|
|
void DIALOG_DRC_CONTROL::OnRightUpUnconnected( wxMouseEvent& event )
|
2007-11-27 01:34:35 +00:00
|
|
|
{
|
|
|
|
event.Skip();
|
2007-12-04 20:44:41 +00:00
|
|
|
|
|
|
|
// popup menu to go to either of the items listed in the DRC_ITEM.
|
2008-02-23 04:53:44 +00:00
|
|
|
|
2007-12-04 20:44:41 +00:00
|
|
|
int selection = m_UnconnectedListBox->GetSelection();
|
2008-02-23 04:53:44 +00:00
|
|
|
|
2007-12-04 20:44:41 +00:00
|
|
|
if( selection != wxNOT_FOUND )
|
|
|
|
{
|
|
|
|
wxMenu menu;
|
|
|
|
wxMenuItem* mItem;
|
|
|
|
const DRC_ITEM* dItem = m_UnconnectedListBox->GetItem( selection );
|
2008-02-23 04:53:44 +00:00
|
|
|
|
2009-06-27 06:26:41 +00:00
|
|
|
mItem = new wxMenuItem( &menu, ID_POPUP_UNCONNECTED_A, dItem->GetTextA() );
|
2007-12-04 20:44:41 +00:00
|
|
|
menu.Append( mItem );
|
2008-02-23 04:53:44 +00:00
|
|
|
|
|
|
|
if( dItem->HasSecondItem() )
|
|
|
|
{
|
2009-06-27 06:26:41 +00:00
|
|
|
mItem = new wxMenuItem( &menu, ID_POPUP_UNCONNECTED_B, dItem->GetTextB() );
|
2008-02-23 04:53:44 +00:00
|
|
|
menu.Append( mItem );
|
|
|
|
}
|
2007-12-04 20:44:41 +00:00
|
|
|
|
|
|
|
PopupMenu( &menu );
|
|
|
|
}
|
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-11-13 09:35:39 +00:00
|
|
|
event.Skip();
|
2007-12-04 20:44:41 +00:00
|
|
|
|
|
|
|
// popup menu to go to either of the items listed in the DRC_ITEM.
|
2008-02-23 04:53:44 +00:00
|
|
|
|
2007-12-04 20:44:41 +00:00
|
|
|
int selection = m_ClearanceListBox->GetSelection();
|
2008-02-23 04:53:44 +00:00
|
|
|
|
2007-12-04 20:44:41 +00:00
|
|
|
if( selection != wxNOT_FOUND )
|
|
|
|
{
|
|
|
|
wxMenu menu;
|
|
|
|
wxMenuItem* mItem;
|
|
|
|
const DRC_ITEM* dItem = m_ClearanceListBox->GetItem( selection );
|
2008-02-23 04:53:44 +00:00
|
|
|
|
2009-06-27 06:26:41 +00:00
|
|
|
mItem = new wxMenuItem( &menu, ID_POPUP_MARKERS_A, dItem->GetTextA() );
|
2007-12-04 20:44:41 +00:00
|
|
|
menu.Append( mItem );
|
2008-02-23 04:53:44 +00:00
|
|
|
|
|
|
|
if( dItem->HasSecondItem() )
|
|
|
|
{
|
2009-06-27 06:26:41 +00:00
|
|
|
mItem = new wxMenuItem( &menu, ID_POPUP_MARKERS_B, dItem->GetTextB() );
|
2008-02-23 04:53:44 +00:00
|
|
|
menu.Append( mItem );
|
|
|
|
}
|
2007-12-04 20:44:41 +00:00
|
|
|
|
|
|
|
PopupMenu( &menu );
|
|
|
|
}
|
2007-11-13 09:35:39 +00:00
|
|
|
}
|
2007-11-27 01:34:35 +00:00
|
|
|
|
|
|
|
|
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();
|
|
|
|
|
|
|
|
// I am assuming that the double click actually changed the selected item.
|
2008-02-23 04:53:44 +00:00
|
|
|
// please verify this.
|
2007-11-27 01:34:35 +00:00
|
|
|
int selection = m_UnconnectedListBox->GetSelection();
|
|
|
|
|
|
|
|
if( selection != wxNOT_FOUND )
|
|
|
|
{
|
2008-02-23 04:53:44 +00:00
|
|
|
// Find the selected DRC_ITEM in the listbox, position cursor there,
|
2007-12-04 18:23:38 +00:00
|
|
|
// at the first of the two pads.
|
|
|
|
// Then hide the dialog.
|
2007-12-04 07:04:53 +00:00
|
|
|
const DRC_ITEM* item = m_UnconnectedListBox->GetItem( selection );
|
|
|
|
if( item )
|
|
|
|
{
|
2009-07-06 18:02:26 +00:00
|
|
|
m_Parent->CursorGoto( item->GetPointA() );
|
2015-06-18 09:35:02 +00:00
|
|
|
m_Parent->GetGalCanvas()->GetView()->SetCenter( VECTOR2D( item->GetPointA() ) );
|
2008-02-23 04:53:44 +00:00
|
|
|
|
2009-11-05 22:02:24 +00:00
|
|
|
Show( false );
|
2008-02-23 04:53:44 +00:00
|
|
|
|
2013-01-07 20:52:15 +00:00
|
|
|
// We do not want the clarification popup window.
|
|
|
|
// when releasing the left button in the main window
|
|
|
|
m_Parent->SkipNextLeftButtonReleaseEvent();
|
2007-12-04 07:04:53 +00:00
|
|
|
}
|
2007-11-27 01:34:35 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
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 )
|
|
|
|
{
|
|
|
|
m_DeleteCurrentMarkerButton->Enable( false );
|
|
|
|
m_ClearanceListBox->SetSelection( -1 );
|
|
|
|
m_UnconnectedListBox->SetSelection( -1 );
|
|
|
|
}
|
2007-11-27 01:34:35 +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
|
|
|
|
|
|
|
// Find the selected DRC_ITEM in the listbox, position cursor there,
|
|
|
|
// at the first of the two pads.
|
|
|
|
const DRC_ITEM* item = m_ClearanceListBox->GetItem( selection );
|
|
|
|
if( item )
|
2015-06-18 09:35:02 +00:00
|
|
|
{
|
2012-12-10 19:08:09 +00:00
|
|
|
m_Parent->CursorGoto( item->GetPointA(), false );
|
2015-06-18 09:35:02 +00:00
|
|
|
m_Parent->GetGalCanvas()->GetView()->SetCenter( VECTOR2D( item->GetPointA() ) );
|
|
|
|
}
|
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
|
|
|
|
|
|
|
// Find the selected DRC_ITEM in the listbox, position cursor there,
|
|
|
|
// at the first of the two pads.
|
|
|
|
const DRC_ITEM* item = m_UnconnectedListBox->GetItem( selection );
|
|
|
|
if( item )
|
2015-06-18 09:35:02 +00:00
|
|
|
{
|
2012-12-10 19:08:09 +00:00
|
|
|
m_Parent->CursorGoto( item->GetPointA(), false );
|
2015-06-18 09:35:02 +00:00
|
|
|
m_Parent->GetGalCanvas()->GetView()->SetCenter( VECTOR2D( item->GetPointA() ) );
|
|
|
|
}
|
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
|
|
|
|
2009-06-18 13:30:52 +00:00
|
|
|
void DIALOG_DRC_CONTROL::RedrawDrawPanel()
|
2007-12-03 21:28:56 +00:00
|
|
|
{
|
2011-12-22 13:28:11 +00:00
|
|
|
m_Parent->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
|
|
|
{
|
2010-04-08 11:33:43 +00:00
|
|
|
m_Parent->SetCurItem( NULL ); // clear curr item, because it could be a DRC marker
|
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
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-06-18 13:30:52 +00:00
|
|
|
void DIALOG_DRC_CONTROL::writeReport( FILE* fp )
|
2007-12-04 18:23:38 +00:00
|
|
|
{
|
|
|
|
int count;
|
|
|
|
|
|
|
|
fprintf( fp, "** Drc report for %s **\n",
|
2012-08-29 16:59:50 +00:00
|
|
|
TO_UTF8( m_Parent->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 )
|
2011-02-28 18:36:19 +00:00
|
|
|
fprintf( fp, "%s", TO_UTF8( m_ClearanceListBox->GetItem( i )->ShowReport()) );
|
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 )
|
2011-02-28 18:36:19 +00:00
|
|
|
fprintf( fp, "%s", TO_UTF8( m_UnconnectedListBox->GetItem( i )->ShowReport() ) );
|
2008-02-23 04:53:44 +00:00
|
|
|
|
2007-12-04 18:23:38 +00:00
|
|
|
fprintf( fp, "\n** End of Report **\n" );
|
|
|
|
}
|
|
|
|
|
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
|
|
|
}
|
|
|
|
}
|
2007-12-01 03:42:52 +00:00
|
|
|
}
|