2020-09-14 17:54:14 +00:00
|
|
|
/*
|
|
|
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
|
|
|
*
|
2021-01-27 22:15:38 +00:00
|
|
|
* Copyright (C) 2020-2021 KiCad Developers, see change_log.txt for contributors.
|
2020-09-14 17:54:14 +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
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef DRC_TOOL_H
|
|
|
|
#define DRC_TOOL_H
|
|
|
|
|
|
|
|
#include <board_commit.h>
|
2020-11-12 20:19:22 +00:00
|
|
|
#include <board.h>
|
2020-11-14 18:11:28 +00:00
|
|
|
#include <pcb_marker.h>
|
2020-09-14 17:54:14 +00:00
|
|
|
#include <geometry/seg.h>
|
|
|
|
#include <geometry/shape_poly_set.h>
|
|
|
|
#include <memory>
|
|
|
|
#include <vector>
|
|
|
|
#include <tools/pcb_tool_base.h>
|
|
|
|
|
|
|
|
|
|
|
|
class PCB_EDIT_FRAME;
|
|
|
|
class DIALOG_DRC;
|
|
|
|
class DRC_ITEM;
|
|
|
|
class WX_PROGRESS_REPORTER;
|
2020-09-15 19:13:45 +00:00
|
|
|
class DRC_ENGINE;
|
2020-09-14 17:54:14 +00:00
|
|
|
|
|
|
|
|
|
|
|
class DRC_TOOL : public PCB_TOOL_BASE
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
DRC_TOOL();
|
|
|
|
~DRC_TOOL();
|
|
|
|
|
|
|
|
/// @copydoc TOOL_INTERACTIVE::Reset()
|
|
|
|
void Reset( RESET_REASON aReason ) override;
|
|
|
|
|
|
|
|
/**
|
2021-10-05 22:33:30 +00:00
|
|
|
* Opens the DRC dialog. The dialog is only created if it is not already in existence.
|
2020-09-14 17:54:14 +00:00
|
|
|
*
|
2021-10-05 22:33:30 +00:00
|
|
|
* @param aParent is the parent window for modal invocations. If nullptr, the parent will
|
|
|
|
* be the PCB_EDIT_FRAME and the dialog will be modeless.
|
2020-09-14 17:54:14 +00:00
|
|
|
*/
|
|
|
|
void ShowDRCDialog( wxWindow* aParent );
|
|
|
|
|
|
|
|
int ShowDRCDialog( const TOOL_EVENT& aEvent );
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Check to see if the DRC_TOOL dialog is currently shown
|
|
|
|
*/
|
|
|
|
bool IsDRCDialogShown();
|
|
|
|
|
2020-09-21 19:39:46 +00:00
|
|
|
/**
|
|
|
|
* Check to see if the DRC engine is running the tests
|
|
|
|
*/
|
|
|
|
bool IsDRCRunning() const { return m_drcRunning; }
|
|
|
|
|
2020-09-14 17:54:14 +00:00
|
|
|
/**
|
2021-01-27 22:15:38 +00:00
|
|
|
* Close and free the DRC dialog.
|
2020-09-14 17:54:14 +00:00
|
|
|
*/
|
2020-09-16 20:38:23 +00:00
|
|
|
void DestroyDRCDialog();
|
2020-09-14 17:54:14 +00:00
|
|
|
|
2020-09-24 14:17:18 +00:00
|
|
|
std::shared_ptr<DRC_ENGINE> GetDRCEngine() { return m_drcEngine; }
|
|
|
|
|
2020-09-14 17:54:14 +00:00
|
|
|
/**
|
2020-09-16 20:38:23 +00:00
|
|
|
* Run the DRC tests.
|
2020-09-14 17:54:14 +00:00
|
|
|
*/
|
2023-04-15 11:08:33 +00:00
|
|
|
void RunTests( PROGRESS_REPORTER* aProgressReporter, bool aRefillZones, bool aUpdateTeardrops,
|
2020-10-28 17:55:57 +00:00
|
|
|
bool aReportAllTrackErrors, bool aTestFootprints );
|
2020-12-01 22:35:11 +00:00
|
|
|
|
|
|
|
int PrevMarker( const TOOL_EVENT& aEvent );
|
|
|
|
int NextMarker( const TOOL_EVENT& aEvent );
|
2021-07-11 17:04:57 +00:00
|
|
|
int CrossProbe( const TOOL_EVENT& aEvent );
|
|
|
|
|
2021-10-05 22:33:30 +00:00
|
|
|
/**
|
|
|
|
* A more "active" CrossProbe which will open the DRC dialog if it is closed. Used when
|
|
|
|
* double-clicking on a marker.
|
|
|
|
*/
|
|
|
|
void CrossProbe( const PCB_MARKER* aMarker );
|
|
|
|
|
2020-12-01 22:35:11 +00:00
|
|
|
int ExcludeMarker( const TOOL_EVENT& aEvent );
|
2021-01-27 22:15:38 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
///< Set up handlers for various events.
|
|
|
|
void setTransitions() override;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Update needed pointers from the one pointer which is known not to change.
|
|
|
|
*/
|
|
|
|
void updatePointers();
|
|
|
|
|
|
|
|
EDA_UNITS userUnits() const { return m_editFrame->GetUserUnits(); }
|
|
|
|
|
2021-12-01 14:42:44 +00:00
|
|
|
private:
|
|
|
|
PCB_EDIT_FRAME* m_editFrame;
|
|
|
|
BOARD* m_pcb;
|
|
|
|
DIALOG_DRC* m_drcDialog;
|
|
|
|
bool m_drcRunning;
|
|
|
|
std::shared_ptr<DRC_ENGINE> m_drcEngine;
|
2020-09-14 17:54:14 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
#endif // DRC_TOOL_H
|