2012-08-03 15:43:15 +00:00
|
|
|
/*
|
|
|
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
|
|
|
*
|
|
|
|
* Copyright (C) 2011 Jean-Pierre Charras, jean-pierre.charras@ujf-grenoble.fr
|
|
|
|
* Copyright (C) 2009 Dick Hollenbeck, dick@softplc.com
|
2019-12-02 09:15:04 +00:00
|
|
|
* Copyright (C) 2004-2019 KiCad Developers, see AUTHORS.txt for contributors.
|
2012-08-03 15:43:15 +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
|
|
|
|
|
|
|
#ifndef _DIALOG_DRC_H_
|
|
|
|
#define _DIALOG_DRC_H_
|
|
|
|
|
2009-06-18 13:30:52 +00:00
|
|
|
#include <wx/htmllbox.h>
|
2012-01-23 04:33:36 +00:00
|
|
|
#include <fctsys.h>
|
|
|
|
#include <pcbnew.h>
|
2019-06-03 13:49:17 +00:00
|
|
|
#include <tools/drc.h>
|
2012-01-23 04:33:36 +00:00
|
|
|
#include <class_marker_pcb.h>
|
|
|
|
#include <class_board.h>
|
|
|
|
#include <dialog_drc_base.h>
|
2012-08-03 15:43:15 +00:00
|
|
|
#include <dialog_drclistbox.h>
|
2018-02-03 09:09:53 +00:00
|
|
|
#include <widgets/unit_binder.h>
|
2007-11-27 01:34:35 +00:00
|
|
|
|
2011-09-23 13:57:12 +00:00
|
|
|
// forward declarations
|
|
|
|
class DRCLISTBOX;
|
|
|
|
class BOARD_DESIGN_SETTINGS;
|
|
|
|
|
|
|
|
//end forward declarations
|
|
|
|
|
2007-05-06 16:03:28 +00:00
|
|
|
/*!
|
2007-12-01 03:42:52 +00:00
|
|
|
* DrcDialog class declaration
|
2007-05-06 16:03:28 +00:00
|
|
|
*/
|
2019-09-19 07:11:45 +00:00
|
|
|
#define DIALOG_DRC_WINDOW_NAME "DialogDrcWindowName"
|
2007-05-06 16:03:28 +00:00
|
|
|
|
2009-06-18 13:30:52 +00:00
|
|
|
class DIALOG_DRC_CONTROL: public DIALOG_DRC_CONTROL_BASE
|
2007-11-27 01:34:35 +00:00
|
|
|
{
|
2009-06-18 13:30:52 +00:00
|
|
|
public:
|
++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
|
|
|
BOARD_DESIGN_SETTINGS m_BrdSettings;
|
2010-01-31 20:01:46 +00:00
|
|
|
|
2009-06-18 13:30:52 +00:00
|
|
|
/// Constructors
|
2016-07-27 12:53:45 +00:00
|
|
|
DIALOG_DRC_CONTROL( DRC* aTester, PCB_EDIT_FRAME* aEditorFrame, wxWindow* aParent );
|
2017-03-16 17:09:33 +00:00
|
|
|
~DIALOG_DRC_CONTROL();
|
2007-05-06 16:03:28 +00:00
|
|
|
|
2016-06-15 17:00:30 +00:00
|
|
|
/**
|
|
|
|
* Enable/disable the report file creation
|
2017-06-17 08:40:38 +00:00
|
|
|
* @param aEnable = true to ask for creation
|
2016-06-15 17:00:30 +00:00
|
|
|
* @param aFileName = the filename or the report file
|
|
|
|
*/
|
|
|
|
void SetRptSettings( bool aEnable, const wxString& aFileName );
|
|
|
|
|
|
|
|
void GetRptSettings( bool* aEnable, wxString& aFileName );
|
|
|
|
|
2016-09-08 18:17:37 +00:00
|
|
|
void UpdateDisplayedCounts();
|
|
|
|
|
|
|
|
|
2009-06-18 13:30:52 +00:00
|
|
|
private:
|
2007-12-04 18:23:38 +00:00
|
|
|
/**
|
|
|
|
* Function writeReport
|
2009-06-18 13:30:52 +00:00
|
|
|
* outputs the MARKER items and unconnecte DRC_ITEMs with commentary to an
|
2007-12-04 18:23:38 +00:00
|
|
|
* open text file.
|
2016-06-15 17:00:30 +00:00
|
|
|
* @param aFullFileName The text filename to write the report to.
|
|
|
|
* @return true if OK, false on error
|
|
|
|
*/
|
|
|
|
bool writeReport( const wxString& aFullFileName );
|
|
|
|
|
|
|
|
/**
|
|
|
|
* filenames can be entered by name.
|
|
|
|
* @return a good report filename (with .rpt extension) (a full filename)
|
|
|
|
* from m_CreateRptCtrl
|
2007-12-04 18:23:38 +00:00
|
|
|
*/
|
2016-06-15 17:00:30 +00:00
|
|
|
const wxString makeValidFileNameReport();
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2009-10-21 19:16:25 +00:00
|
|
|
void InitValues( );
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2016-04-15 18:15:22 +00:00
|
|
|
void DisplayDRCValues( );
|
|
|
|
|
2019-08-20 17:22:30 +00:00
|
|
|
void SetDRCParameters( );
|
2009-10-06 18:58:51 +00:00
|
|
|
|
2019-12-02 09:15:04 +00:00
|
|
|
/// @return the selection on a right click on a DRCLISTBOX
|
|
|
|
/// return wxNOT_FOUND if no selection
|
|
|
|
int rightUpClicSelection( DRCLISTBOX* aListBox, wxMouseEvent& event );
|
|
|
|
|
2018-01-30 14:13:34 +00:00
|
|
|
/// wxEVT_COMMAND_CHECKBOX_CLICKED event handler for ID_CHECKBOX_RPT_FILE
|
2016-09-24 18:53:15 +00:00
|
|
|
void OnReportCheckBoxClicked( wxCommandEvent& event ) override;
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2018-01-30 14:13:34 +00:00
|
|
|
/// wxEVT_COMMAND_TEXT_UPDATED event handler for m_RptFilenameCtrl
|
|
|
|
void OnReportFilenameEdited( wxCommandEvent &event ) override;
|
|
|
|
|
2007-08-02 07:42:58 +00:00
|
|
|
/// wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_BUTTON_BROWSE_RPT_FILE
|
2016-09-24 18:53:15 +00:00
|
|
|
void OnButtonBrowseRptFileClick( wxCommandEvent& event ) override;
|
2007-08-02 07:42:58 +00:00
|
|
|
|
2007-11-27 01:34:35 +00:00
|
|
|
/// wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_STARTDRC
|
2016-09-24 18:53:15 +00:00
|
|
|
void OnStartdrcClick( wxCommandEvent& event ) override;
|
2007-11-27 01:34:35 +00:00
|
|
|
|
|
|
|
/// wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_DELETE_ALL
|
2016-09-24 18:53:15 +00:00
|
|
|
void OnDeleteAllClick( wxCommandEvent& event ) override;
|
2007-11-27 01:34:35 +00:00
|
|
|
|
2007-12-03 05:14:51 +00:00
|
|
|
/// wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_DELETE_ONE
|
2016-09-24 18:53:15 +00:00
|
|
|
void OnDeleteOneClick( wxCommandEvent& event ) override;
|
2007-12-03 05:14:51 +00:00
|
|
|
|
2007-11-27 01:34:35 +00:00
|
|
|
/// wxEVT_LEFT_DCLICK event handler for ID_CLEARANCE_LIST
|
2016-09-24 18:53:15 +00:00
|
|
|
void OnLeftDClickClearance( wxMouseEvent& event ) override;
|
2007-11-27 01:34:35 +00:00
|
|
|
|
2019-03-26 02:38:18 +00:00
|
|
|
/// wxEVT_LEFT_UP event handler for ID_CLEARANCE_LIST
|
|
|
|
void OnLeftUpClearance( wxMouseEvent& event ) override;
|
|
|
|
|
2007-11-27 01:34:35 +00:00
|
|
|
/// wxEVT_RIGHT_UP event handler for ID_CLEARANCE_LIST
|
2016-09-24 18:53:15 +00:00
|
|
|
void OnRightUpClearance( wxMouseEvent& event ) override;
|
2007-11-27 01:34:35 +00:00
|
|
|
|
|
|
|
/// wxEVT_LEFT_DCLICK event handler for ID_UNCONNECTED_LIST
|
2016-09-24 18:53:15 +00:00
|
|
|
void OnLeftDClickUnconnected( wxMouseEvent& event ) override;
|
2007-11-27 01:34:35 +00:00
|
|
|
|
2019-03-26 02:38:18 +00:00
|
|
|
/// wxEVT_LEFT_UP event handler for ID_UNCONNECTED_LIST
|
|
|
|
void OnLeftUpUnconnected( wxMouseEvent& event ) override;
|
|
|
|
|
2007-11-27 01:34:35 +00:00
|
|
|
/// wxEVT_RIGHT_UP event handler for ID_UNCONNECTED_LIST
|
2016-09-24 18:53:15 +00:00
|
|
|
void OnRightUpUnconnected( wxMouseEvent& event ) override;
|
2007-11-13 09:35:39 +00:00
|
|
|
|
2019-03-28 19:30:51 +00:00
|
|
|
/// wxEVT_LEFT_DCLICK event handler for ID_FOOTPRINTS_LIST
|
|
|
|
void OnLeftDClickFootprints( wxMouseEvent& event ) override;
|
|
|
|
|
|
|
|
/// wxEVT_RIGHT_UP event handler for ID_FOOTPRINTS_LIST
|
|
|
|
void OnRightUpFootprints( wxMouseEvent& event ) override;
|
|
|
|
|
2007-11-13 09:35:39 +00:00
|
|
|
/// wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_CANCEL
|
2016-09-24 18:53:15 +00:00
|
|
|
void OnCancelClick( wxCommandEvent& event ) override;
|
2007-11-13 09:35:39 +00:00
|
|
|
|
2016-04-15 18:15:22 +00:00
|
|
|
/// handler for activate event, updating data which can be modified outside the dialog
|
|
|
|
/// (DRC parameters)
|
2016-09-24 18:53:15 +00:00
|
|
|
void OnActivateDlg( wxActivateEvent& event ) override;
|
2016-04-15 18:15:22 +00:00
|
|
|
|
2016-09-24 18:53:15 +00:00
|
|
|
void OnMarkerSelectionEvent( wxCommandEvent& event ) override;
|
|
|
|
void OnUnconnectedSelectionEvent( wxCommandEvent& event ) override;
|
2019-03-28 19:30:51 +00:00
|
|
|
void OnFootprintsSelectionEvent( wxCommandEvent& event ) override;
|
2016-09-24 18:53:15 +00:00
|
|
|
void OnChangingMarkerList( wxNotebookEvent& event ) override;
|
2007-11-27 01:34:35 +00:00
|
|
|
|
2007-12-03 05:14:51 +00:00
|
|
|
void DelDRCMarkers();
|
2007-12-03 21:28:56 +00:00
|
|
|
void RedrawDrawPanel();
|
2007-12-04 20:44:41 +00:00
|
|
|
|
2018-01-28 09:35:33 +00:00
|
|
|
/// Run the SELECTION_TOOL's disambiguation menu to highlight the two BOARD_ITEMs
|
|
|
|
/// in the DRC_ITEM.
|
|
|
|
void doSelectionMenu( const DRC_ITEM* aItem );
|
2007-11-27 22:49:35 +00:00
|
|
|
|
2019-03-26 02:38:18 +00:00
|
|
|
bool focusOnItem( const DRC_ITEM* aItem );
|
|
|
|
|
2016-04-15 18:15:22 +00:00
|
|
|
BOARD* m_currentBoard; // the board currently on test
|
2007-12-01 03:42:52 +00:00
|
|
|
DRC* m_tester;
|
2016-07-27 12:53:45 +00:00
|
|
|
PCB_EDIT_FRAME* m_brdEditor;
|
2017-03-16 17:09:33 +00:00
|
|
|
wxConfigBase* m_config;
|
2018-02-03 09:09:53 +00:00
|
|
|
|
2018-01-30 14:13:34 +00:00
|
|
|
wxString m_markersTitleTemplate;
|
|
|
|
wxString m_unconnectedTitleTemplate;
|
2019-03-28 19:30:51 +00:00
|
|
|
wxString m_footprintsTitleTemplate;
|
2018-02-03 09:09:53 +00:00
|
|
|
|
|
|
|
UNIT_BINDER m_trackMinWidth;
|
|
|
|
UNIT_BINDER m_viaMinSize;
|
|
|
|
UNIT_BINDER m_uviaMinSize;
|
2007-05-06 16:03:28 +00:00
|
|
|
};
|
|
|
|
|
2007-11-27 01:34:35 +00:00
|
|
|
#endif // _DIALOG_DRC_H_
|
|
|
|
|