Browse Source
Finish exorcising the old DRC system.
Finish exorcising the old DRC system.
This moves the various BOARD_ITEM calls to the new system, and make the DRC_ENGINE long-lived so that it can field those queries.pull/16/head
43 changed files with 135 additions and 578 deletions
-
2common/CMakeLists.txt
-
8include/board_design_settings.h
-
3pcbnew/CMakeLists.txt
-
77pcbnew/board_connected_item.cpp
-
2pcbnew/board_connected_item.h
-
24pcbnew/board_design_settings.cpp
-
76pcbnew/class_track.cpp
-
77pcbnew/class_zone.cpp
-
9pcbnew/class_zone.h
-
3pcbnew/cleanup_item.h
-
1pcbnew/dialogs/dialog_board_setup.cpp
-
1pcbnew/dialogs/dialog_cleanup_graphics.cpp
-
1pcbnew/dialogs/dialog_drc.h
-
11pcbnew/dialogs/panel_setup_rules.cpp
-
101pcbnew/drc/drc.cpp
-
71pcbnew/drc/drc.h
-
66pcbnew/drc/drc_engine.cpp
-
9pcbnew/drc/drc_engine.h
-
44pcbnew/drc/drc_item.cpp
-
7pcbnew/drc/drc_item.h
-
48pcbnew/drc/drc_rule.cpp
-
1pcbnew/drc/drc_test_provider_annulus.cpp
-
1pcbnew/drc/drc_test_provider_connectivity.cpp
-
4pcbnew/drc/drc_test_provider_copper_clearance.cpp
-
1pcbnew/drc/drc_test_provider_courtyard_clearance.cpp
-
1pcbnew/drc/drc_test_provider_disallow.cpp
-
1pcbnew/drc/drc_test_provider_edge_clearance.cpp
-
2pcbnew/drc/drc_test_provider_hole_clearance.cpp
-
2pcbnew/drc/drc_test_provider_hole_size.cpp
-
1pcbnew/drc/drc_test_provider_lvs.cpp
-
1pcbnew/drc/drc_test_provider_misc.cpp
-
1pcbnew/drc/drc_test_provider_track_width.cpp
-
1pcbnew/drc/drc_test_provider_via_diameter.cpp
-
1pcbnew/footprint_editor_settings.cpp
-
1pcbnew/menubar_pcb_editor.cpp
-
4pcbnew/pcb_base_edit_frame.cpp
-
4pcbnew/pcb_edit_frame.cpp
-
27pcbnew/tools/drc_tool.cpp
-
5pcbnew/tools/drc_tool.h
-
5pcbnew/tools/pcb_inspection_tool.cpp
-
1pcbnew/zones_by_polygon.cpp
-
5qa/drc_proto/drc_test_provider_silk_to_pad.cpp
-
2qa/pcbnew_utils/board_construction_utils.cpp
@ -1,101 +0,0 @@ |
|||
/*
|
|||
* This program source code file is part of KiCad, a free EDA CAD application. |
|||
* |
|||
* Copyright (C) 2004-2019 Jean-Pierre Charras, jp.charras at wanadoo.fr |
|||
* Copyright (C) 2014 Dick Hollenbeck, dick@softplc.com |
|||
* Copyright (C) 2017-2020 KiCad Developers, see change_log.txt for contributors. |
|||
* |
|||
* This program is free software; you can redistribute it and/or |
|||
* modify it under the terms of the GNU General Public License |
|||
* 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 |
|||
*/ |
|||
|
|||
#include <fctsys.h>
|
|||
#include <pcb_edit_frame.h>
|
|||
#include <board_design_settings.h>
|
|||
#include <class_drawsegment.h>
|
|||
#include <tool/tool_manager.h>
|
|||
#include <tools/pcb_tool_base.h>
|
|||
#include <netlist_reader/pcb_netlist.h>
|
|||
#include <drc/drc.h>
|
|||
#include <drc/drc_rule_parser.h>
|
|||
#include <dialogs/panel_setup_rules.h>
|
|||
#include <project.h>
|
|||
#include <reporter.h>
|
|||
|
|||
|
|||
DRC::DRC() : |
|||
PCB_TOOL_BASE( "pcbnew.legacyDRCTool" ), |
|||
m_editFrame( nullptr ) |
|||
{ |
|||
} |
|||
|
|||
|
|||
DRC::~DRC() |
|||
{ |
|||
} |
|||
|
|||
|
|||
void DRC::Reset( RESET_REASON aReason ) |
|||
{ |
|||
m_editFrame = getEditFrame<PCB_EDIT_FRAME>(); |
|||
} |
|||
|
|||
|
|||
// JEY TODO: make DRC_TOOL's DRC_ENGINE be long-lived so it can be used for BOARD_CONNECTED_ITEM's
|
|||
// GetClearance() and the retire this.
|
|||
|
|||
bool DRC::LoadRules() |
|||
{ |
|||
wxString rulesFilepath = m_editFrame->Prj().AbsolutePath( "drc-rules" ); |
|||
wxFileName rulesFile( rulesFilepath ); |
|||
|
|||
if( rulesFile.FileExists() ) |
|||
{ |
|||
m_rules.clear(); |
|||
|
|||
FILE* fp = wxFopen( rulesFilepath, wxT( "rt" ) ); |
|||
|
|||
if( fp ) |
|||
{ |
|||
try |
|||
{ |
|||
DRC_RULES_PARSER parser( m_editFrame->GetBoard(), fp, rulesFilepath ); |
|||
parser.Parse( m_rules, &NULL_REPORTER::GetInstance() ); |
|||
} |
|||
catch( PARSE_ERROR& pe ) |
|||
{ |
|||
// Don't leave possibly malformed stuff around for us to trip over
|
|||
m_rules.clear(); |
|||
|
|||
wxSafeYield( m_editFrame ); |
|||
m_editFrame->ShowBoardSetupDialog( _( "Rules" ), pe.What(), ID_RULES_EDITOR, |
|||
pe.lineNumber, pe.byteIndex ); |
|||
|
|||
return false; |
|||
} |
|||
} |
|||
} |
|||
|
|||
std::reverse( std::begin( m_rules ), std::end( m_rules ) ); |
|||
|
|||
BOARD_DESIGN_SETTINGS& bds = m_editFrame->GetBoard()->GetDesignSettings(); |
|||
bds.m_DRCRules = m_rules; |
|||
|
|||
return true; |
|||
} |
|||
|
|||
|
|||
@ -1,71 +0,0 @@ |
|||
/* |
|||
* This program source code file is part of KiCad, a free EDA CAD application. |
|||
* |
|||
* Copyright (C) 2007-2016 Dick Hollenbeck, dick@softplc.com |
|||
* Copyright (C) 2017-2019 KiCad Developers, see change_log.txt for contributors. |
|||
* |
|||
* This program is free software; you can redistribute it and/or |
|||
* modify it under the terms of the GNU General Public License |
|||
* 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 |
|||
*/ |
|||
|
|||
#ifndef DRC_H |
|||
#define DRC_H |
|||
|
|||
#include <board_commit.h> |
|||
#include <class_board.h> |
|||
#include <class_track.h> |
|||
#include <class_marker_pcb.h> |
|||
#include <geometry/seg.h> |
|||
#include <geometry/shape_poly_set.h> |
|||
#include <memory> |
|||
#include <vector> |
|||
#include <tools/pcb_tool_base.h> |
|||
|
|||
|
|||
class PCB_EDIT_FRAME; |
|||
|
|||
|
|||
/** |
|||
* Design Rule Checker object that performs all the DRC tests. The output of |
|||
* the checking goes to the BOARD file in the form of two MARKER lists. Those |
|||
* two lists are displayable in the drc dialog box. And they can optionally |
|||
* be sent to a text file on disk. |
|||
* This class is given access to the windows and the BOARD |
|||
* that it needs via its constructor or public access functions. |
|||
*/ |
|||
class DRC : public PCB_TOOL_BASE |
|||
{ |
|||
public: |
|||
DRC(); |
|||
~DRC(); |
|||
|
|||
/// @copydoc TOOL_INTERACTIVE::Reset() |
|||
void Reset( RESET_REASON aReason ) override; |
|||
|
|||
private: |
|||
PCB_EDIT_FRAME* m_editFrame; // The pcb frame editor which owns the board |
|||
|
|||
std::vector<DRC_RULE*> m_rules; |
|||
public: |
|||
/** |
|||
* Load the DRC rules. Must be called after the netclasses have been read. |
|||
*/ |
|||
bool LoadRules(); |
|||
}; |
|||
|
|||
|
|||
#endif // DRC_H |
|||
Write
Preview
Loading…
Cancel
Save
Reference in new issue