KiCad PCB EDA Suite
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 (C) 2020-2021 KiCad Developers, see change_log.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, you may find one here:
18 * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
19 * or you may search the http://www.gnu.org website for the version 2 license,
20 * or you may write to the Free Software Foundation, Inc.,
21 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
22 */
23
24#ifndef DRC_TOOL_H
25#define DRC_TOOL_H
26
27#include <board_commit.h>
28#include <board.h>
29#include <pcb_marker.h>
30#include <geometry/seg.h>
32#include <memory>
33#include <vector>
34#include <tools/pcb_tool_base.h>
35
36
37class PCB_EDIT_FRAME;
38class DIALOG_DRC;
39class DRC_ITEM;
41class DRC_ENGINE;
42
43
44class DRC_TOOL : public PCB_TOOL_BASE
45{
46public:
47 DRC_TOOL();
48 ~DRC_TOOL();
49
51 void Reset( RESET_REASON aReason ) override;
52
59 void ShowDRCDialog( wxWindow* aParent );
60
61 int ShowDRCDialog( const TOOL_EVENT& aEvent );
62
66 bool IsDRCDialogShown();
67
71 bool IsDRCRunning() const { return m_drcRunning; }
72
76 void DestroyDRCDialog();
77
78 std::shared_ptr<DRC_ENGINE> GetDRCEngine() { return m_drcEngine; }
79
83 void RunTests( PROGRESS_REPORTER* aProgressReporter, bool aRefillZones,
84 bool aReportAllTrackErrors, bool aTestFootprints );
85
86 int PrevMarker( const TOOL_EVENT& aEvent );
87 int NextMarker( const TOOL_EVENT& aEvent );
88 int CrossProbe( const TOOL_EVENT& aEvent );
89
94 void CrossProbe( const PCB_MARKER* aMarker );
95
96 int ExcludeMarker( const TOOL_EVENT& aEvent );
97
98private:
100 void setTransitions() override;
101
105 void updatePointers();
106
108
109private:
114 std::shared_ptr<DRC_ENGINE> m_drcEngine;
115};
116
117
118#endif // DRC_TOOL_H
Information pertinent to a Pcbnew printed circuit board.
Definition: board.h:265
Design Rule Checker object that performs all the DRC tests.
Definition: drc_engine.h:83
EDA_UNITS userUnits() const
Definition: drc_tool.h:107
void Reset(RESET_REASON aReason) override
Bring the tool to a known, initial state.
Definition: drc_tool.cpp:55
void ShowDRCDialog(wxWindow *aParent)
Opens the DRC dialog.
Definition: drc_tool.cpp:70
int NextMarker(const TOOL_EVENT &aEvent)
Definition: drc_tool.cpp:233
DRC_TOOL()
Definition: drc_tool.cpp:40
void DestroyDRCDialog()
Close and free the DRC dialog.
Definition: drc_tool.cpp:121
std::shared_ptr< DRC_ENGINE > GetDRCEngine()
Definition: drc_tool.h:78
DIALOG_DRC * m_drcDialog
Definition: drc_tool.h:112
PCB_EDIT_FRAME * m_editFrame
Definition: drc_tool.h:110
~DRC_TOOL()
Definition: drc_tool.cpp:50
bool IsDRCDialogShown()
Check to see if the DRC_TOOL dialog is currently shown.
Definition: drc_tool.cpp:112
int CrossProbe(const TOOL_EVENT &aEvent)
Definition: drc_tool.cpp:250
bool IsDRCRunning() const
Check to see if the DRC engine is running the tests.
Definition: drc_tool.h:71
int ExcludeMarker(const TOOL_EVENT &aEvent)
Definition: drc_tool.cpp:279
void setTransitions() override
< Set up handlers for various events.
Definition: drc_tool.cpp:288
BOARD * m_pcb
Definition: drc_tool.h:111
int PrevMarker(const TOOL_EVENT &aEvent)
Definition: drc_tool.cpp:216
bool m_drcRunning
Definition: drc_tool.h:113
void RunTests(PROGRESS_REPORTER *aProgressReporter, bool aRefillZones, bool aReportAllTrackErrors, bool aTestFootprints)
Run the DRC tests.
Definition: drc_tool.cpp:131
void updatePointers()
Update needed pointers from the one pointer which is known not to change.
Definition: drc_tool.cpp:204
std::shared_ptr< DRC_ENGINE > m_drcEngine
Definition: drc_tool.h:114
The main frame for Pcbnew.
A progress reporter interface for use in multi-threaded environments.
RESET_REASON
Determine the reason of reset for a tool.
Definition: tool_base.h:78
Generic, UI-independent tool event.
Definition: tool_event.h:156
EDA_UNITS GetUserUnits() const
Multi-thread safe progress reporter dialog, intended for use of tasks that parallel reporting back of...
EDA_UNITS
Definition: eda_units.h:43