KiCad PCB EDA Suite
Loading...
Searching...
No Matches
drc_tool.h
Go to the documentation of this file.
1/*
2 * This program source code file is part of KiCad, a free EDA CAD application.
3 *
4 * Copyright The KiCad Developers, see AUTHORS.txt for contributors.
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version 2
9 * of the License, or (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program. If not, see <https://www.gnu.org/licenses/>.
18 */
19
20#ifndef DRC_TOOL_H
21#define DRC_TOOL_H
22
23#include <board_commit.h>
24#include <board.h>
25#include <pcb_marker.h>
26#include <geometry/seg.h>
28#include <memory>
29#include <vector>
30#include <tools/pcb_tool_base.h>
31
32
33class PCB_EDIT_FRAME;
34class DIALOG_DRC;
36class DRC_ITEM;
38class DRC_ENGINE;
39
40
41class DRC_TOOL : public PCB_TOOL_BASE
42{
43public:
44 DRC_TOOL();
45 ~DRC_TOOL();
46
48 void Reset( RESET_REASON aReason ) override;
49
56 void ShowDRCDialog( wxWindow* aParent );
57
58 int ShowDRCDialog( const TOOL_EVENT& aEvent );
59
61
65 bool IsDRCDialogShown();
66
70 bool IsDRCRunning() const { return m_drcRunning; }
71
75 void DestroyDRCDialog();
76
77 void ShowDesignRuleEditorDialog( wxWindow* aParent );
78
79 int ShowDesignRuleEditorDialog( const TOOL_EVENT& aEvent );
80
82
83 std::shared_ptr<DRC_ENGINE> GetDRCEngine() { return m_drcEngine; }
84
88 void RunTests( PROGRESS_REPORTER* aProgressReporter, bool aRefillZones,
89 bool aReportAllTrackErrors, bool aTestFootprints );
90
91 int PrevMarker( const TOOL_EVENT& aEvent );
92 int NextMarker( const TOOL_EVENT& aEvent );
93 int CrossProbe( const TOOL_EVENT& aEvent );
94
99 void CrossProbe( const PCB_MARKER* aMarker );
100
101 int ExcludeMarker( const TOOL_EVENT& aEvent );
102
103 wxString FixDRCErrorMenuText( const std::shared_ptr<RC_ITEM>& aDRCItem );
104 void FixDRCError( const std::shared_ptr<RC_ITEM>& aDRCItem );
105
106private:
108 void setTransitions() override;
109
113 void updatePointers( bool aDRCWasCancelled );
114
115 EDA_UNITS userUnits() const { return m_editFrame->GetUserUnits(); }
116
117private:
123 std::shared_ptr<DRC_ENGINE> m_drcEngine;
124};
125
126
127#endif // DRC_TOOL_H
Information pertinent to a Pcbnew printed circuit board.
Definition board.h:372
Design Rule Checker object that performs all the DRC tests.
Definition drc_engine.h:129
EDA_UNITS userUnits() const
Definition drc_tool.h:115
void updatePointers(bool aDRCWasCancelled)
Update needed pointers from the one pointer which is known not to change.
Definition drc_tool.cpp:222
void ShowDRCDialog(wxWindow *aParent)
Opens the DRC dialog.
Definition drc_tool.cpp:74
void FixDRCError(const std::shared_ptr< RC_ITEM > &aDRCItem)
Definition drc_tool.cpp:357
int NextMarker(const TOOL_EVENT &aEvent)
Definition drc_tool.cpp:251
wxString FixDRCErrorMenuText(const std::shared_ptr< RC_ITEM > &aDRCItem)
Definition drc_tool.cpp:301
void DestroyDRCDialog()
Close and free the DRC dialog.
Definition drc_tool.cpp:125
std::shared_ptr< DRC_ENGINE > GetDRCEngine()
Definition drc_tool.h:83
DIALOG_DRC * m_drcDialog
Definition drc_tool.h:120
PCB_EDIT_FRAME * m_editFrame
Definition drc_tool.h:118
DIALOG_DRC * GetDRCDialog()
Definition drc_tool.h:60
void DestroyDesignRuleEditorDialog()
Definition drc_tool.cpp:447
bool IsDRCDialogShown()
Check to see if the DRC_TOOL dialog is currently shown.
Definition drc_tool.cpp:116
int CrossProbe(const TOOL_EVENT &aEvent)
Definition drc_tool.cpp:268
bool IsDRCRunning() const
Check to see if the DRC engine is running the tests.
Definition drc_tool.h:70
int ExcludeMarker(const TOOL_EVENT &aEvent)
Definition drc_tool.cpp:292
void setTransitions() override
< Set up handlers for various events.
Definition drc_tool.cpp:457
BOARD * m_pcb
Definition drc_tool.h:119
int PrevMarker(const TOOL_EVENT &aEvent)
Definition drc_tool.cpp:234
bool m_drcRunning
Definition drc_tool.h:122
DIALOG_DRC_RULE_EDITOR * m_designRuleEditorDlg
Definition drc_tool.h:121
void RunTests(PROGRESS_REPORTER *aProgressReporter, bool aRefillZones, bool aReportAllTrackErrors, bool aTestFootprints)
Run the DRC tests.
Definition drc_tool.cpp:135
std::shared_ptr< DRC_ENGINE > m_drcEngine
Definition drc_tool.h:123
void ShowDesignRuleEditorDialog(wxWindow *aParent)
Definition drc_tool.cpp:405
The main frame for Pcbnew.
PCB_TOOL_BASE(TOOL_ID aId, const std::string &aName)
Constructor.
A progress reporter interface for use in multi-threaded environments.
RESET_REASON
Determine the reason of reset for a tool.
Definition tool_base.h:74
Generic, UI-independent tool event.
Definition tool_event.h:167
Multi-thread safe progress reporter dialog, intended for use of tasks that parallel reporting back of...
EDA_UNITS
Definition eda_units.h:44
void Reset() override