KiCad PCB EDA Suite
Loading...
Searching...
No Matches
graphic_edit_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 modify it
7
* under the terms of the GNU General Public License as published by the
8
* Free Software Foundation, either version 3 of the License, or (at your
9
* option) any later version.
10
*
11
* This program is distributed in the hope that it will be useful, but
12
* WITHOUT ANY WARRANTY; without even the implied warranty of
13
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14
* 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 GRAPHIC_EDIT_TOOL_H
21
#define GRAPHIC_EDIT_TOOL_H
22
23
#include <
snap/snap_resolver.h
>
24
#include <
tools/graphic_edit.h
>
25
#include <
tools/pcb_tool_base.h
>
26
27
#include <set>
28
29
class
PCB_SELECTION_TOOL
;
30
31
class
GRAPHIC_EDIT_TOOL
:
public
PCB_TOOL_BASE
32
{
33
public
:
34
GRAPHIC_EDIT_TOOL
();
35
36
bool
Init
()
override
;
37
int
Extend
(
const
TOOL_EVENT
& aEvent );
38
int
Trim
(
const
TOOL_EVENT
& aEvent );
39
40
private
:
47
struct
OPERATION
48
{
49
wxString
m_NoResult
;
50
wxString
m_CommitDescription
;
51
53
bool ( *
m_Accepts
)(
const
PCB_SHAPE
& aShape );
54
58
std::set<SNAP_CANDIDATE_SUBTYPE>
m_SuppressedSnaps
= {};
59
61
int
m_PreviewLayer
;
62
64
BOX2I
( *
m_QueryBounds
)(
const
BOARD_ITEM
& aSource,
const
VECTOR2I
& aPointer,
const
BOX2I
& aWorldBounds );
65
GRAPHIC_EDIT_RESULT
( *
m_Plan
)(
const
BOARD_ITEM
& aSource,
const
VECTOR2I
& aPointer,
66
const
std::vector<const BOARD_ITEM*>& aBoundaries );
67
};
68
69
int
runInteractive
(
const
TOOL_EVENT
& aEvent,
const
OPERATION
& aOperation );
70
void
setTransitions
()
override
;
71
72
PCB_SELECTION_TOOL
*
m_selectionTool
=
nullptr
;
73
};
74
75
#endif
BOX2I
BOX2< VECTOR2I > BOX2I
Definition
box2.h:927
BOARD_ITEM
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
Definition
board_item.h:84
GRAPHIC_EDIT_TOOL::GRAPHIC_EDIT_TOOL
GRAPHIC_EDIT_TOOL()
Definition
graphic_edit_tool.cpp:139
GRAPHIC_EDIT_TOOL::setTransitions
void setTransitions() override
This method is meant to be overridden in order to specify handlers for events.
Definition
graphic_edit_tool.cpp:426
GRAPHIC_EDIT_TOOL::Trim
int Trim(const TOOL_EVENT &aEvent)
Definition
graphic_edit_tool.cpp:167
GRAPHIC_EDIT_TOOL::m_selectionTool
PCB_SELECTION_TOOL * m_selectionTool
Definition
graphic_edit_tool.h:72
GRAPHIC_EDIT_TOOL::Init
bool Init() override
Init() is called once upon a registration of the tool.
Definition
graphic_edit_tool.cpp:145
GRAPHIC_EDIT_TOOL::Extend
int Extend(const TOOL_EVENT &aEvent)
Definition
graphic_edit_tool.cpp:155
GRAPHIC_EDIT_TOOL::runInteractive
int runInteractive(const TOOL_EVENT &aEvent, const OPERATION &aOperation)
Definition
graphic_edit_tool.cpp:181
PCB_SELECTION_TOOL
The selection tool: currently supports:
Definition
pcb_selection_tool.h:63
PCB_SHAPE
Definition
pcb_shape.h:35
PCB_TOOL_BASE::PCB_TOOL_BASE
PCB_TOOL_BASE(TOOL_ID aId, const std::string &aName)
Constructor.
Definition
pcb_tool_base.h:74
TOOL_EVENT
Generic, UI-independent tool event.
Definition
tool_event.h:167
graphic_edit.h
pcb_tool_base.h
snap_resolver.h
GRAPHIC_EDIT_RESULT
Definition
graphic_edit.h:65
GRAPHIC_EDIT_TOOL::OPERATION
What one edit operation gives the shared interactive loop.
Definition
graphic_edit_tool.h:48
GRAPHIC_EDIT_TOOL::OPERATION::m_SuppressedSnaps
std::set< SNAP_CANDIDATE_SUBTYPE > m_SuppressedSnaps
Snap kinds this operation cannot use.
Definition
graphic_edit_tool.h:58
GRAPHIC_EDIT_TOOL::OPERATION::m_Accepts
bool(* m_Accepts)(const PCB_SHAPE &aShape)
Which shapes may be the source. Anything else is not worth hovering.
Definition
graphic_edit_tool.h:53
GRAPHIC_EDIT_TOOL::OPERATION::m_NoResult
wxString m_NoResult
Definition
graphic_edit_tool.h:49
GRAPHIC_EDIT_TOOL::OPERATION::m_Plan
GRAPHIC_EDIT_RESULT(* m_Plan)(const BOARD_ITEM &aSource, const VECTOR2I &aPointer, const std::vector< const BOARD_ITEM * > &aBoundaries)
Definition
graphic_edit_tool.h:65
GRAPHIC_EDIT_TOOL::OPERATION::m_CommitDescription
wxString m_CommitDescription
Definition
graphic_edit_tool.h:50
GRAPHIC_EDIT_TOOL::OPERATION::m_QueryBounds
BOX2I(* m_QueryBounds)(const BOARD_ITEM &aSource, const VECTOR2I &aPointer, const BOX2I &aWorldBounds)
Null bounds the search by the source's own extent, which only cuts what it crosses.
Definition
graphic_edit_tool.h:64
GRAPHIC_EDIT_TOOL::OPERATION::m_PreviewLayer
int m_PreviewLayer
The colour role the preview borrows. Trim marks a removal, extend an addition.
Definition
graphic_edit_tool.h:61
VECTOR2I
VECTOR2< int32_t > VECTOR2I
Definition
vector2d.h:683
src
pcbnew
tools
graphic_edit_tool.h
Generated on Thu Sep 17 2026 00:06:22 for KiCad PCB EDA Suite by
1.13.2