KiCad PCB EDA Suite
Loading...
Searching...
No Matches
pl_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 (C) 2019 CERN
5
* Copyright The KiCad Developers, see AUTHORS.txt for contributors.
6
*
7
* This program is free software; you can redistribute it and/or
8
* modify it under the terms of the GNU General Public License
9
* as published by the Free Software Foundation; either version 2
10
* of the License, or (at your option) any later version.
11
*
12
* This program is distributed in the hope that it will be useful,
13
* but WITHOUT ANY WARRANTY; without even the implied warranty of
14
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
* GNU General Public License for more details.
16
*
17
* You should have received a copy of the GNU General Public License
18
* along with this program. If not, see <https://www.gnu.org/licenses/>.
19
*/
20
21
#ifndef PL_EDIT_TOOL_H
22
#define PL_EDIT_TOOL_H
23
24
#include <
tool/tool_interactive.h
>
25
#include <
tool/tool_menu.h
>
26
27
28
class
PL_EDITOR_FRAME
;
29
class
PL_SELECTION_TOOL
;
30
31
32
class
PL_EDIT_TOOL
:
public
TOOL_INTERACTIVE
33
{
34
public
:
35
PL_EDIT_TOOL
();
36
~PL_EDIT_TOOL
() {}
37
39
bool
Init
()
override
;
40
42
void
Reset
(
RESET_REASON
aReason )
override
;
43
45
int
Main
(
const
TOOL_EVENT
& aEvent );
46
47
int
Undo
(
const
TOOL_EVENT
& aEvent );
48
int
Redo
(
const
TOOL_EVENT
& aEvent );
49
50
int
Cut
(
const
TOOL_EVENT
& aEvent );
51
int
Copy
(
const
TOOL_EVENT
& aEvent );
52
int
Paste
(
const
TOOL_EVENT
& aEvent );
53
54
int
ImportDrawingSheetContent
(
const
TOOL_EVENT
& aEvent );
55
59
int
DoDelete
(
const
TOOL_EVENT
& aEvent );
60
62
int
InteractiveDelete
(
const
TOOL_EVENT
& aEvent );
63
64
private
:
65
void
moveItem
(
DS_DATA_ITEM
* aItem,
const
VECTOR2I
& aDelta );
66
69
bool
updateModificationPoint
(
PL_SELECTION
& aSelection );
70
72
void
setTransitions
()
override
;
73
74
private
:
75
PL_EDITOR_FRAME
*
m_frame
;
76
PL_SELECTION_TOOL
*
m_selectionTool
;
77
79
bool
m_moveInProgress
;
80
82
VECTOR2I
m_moveOffset
;
83
86
VECTOR2I
m_cursor
;
87
88
EDA_ITEM
*
m_pickerItem
;
89
};
90
91
#endif
//PL_EDIT_TOOL_H
DS_DATA_ITEM
Drawing sheet structure type definitions.
Definition
ds_data_item.h:92
EDA_ITEM
A base class for most all the KiCad significant classes used in schematics and boards.
Definition
eda_item.h:96
PL_EDITOR_FRAME
The main window used in the drawing sheet editor.
Definition
pl_editor_frame.h:48
PL_EDIT_TOOL::Init
bool Init() override
Init() is called once upon a registration of the tool.
Definition
pl_edit_tool.cpp:60
PL_EDIT_TOOL::Redo
int Redo(const TOOL_EVENT &aEvent)
Definition
pl_edit_tool.cpp:493
PL_EDIT_TOOL::DoDelete
int DoDelete(const TOOL_EVENT &aEvent)
Delete the selected items, or the item under the cursor.
Definition
pl_edit_tool.cpp:368
PL_EDIT_TOOL::ImportDrawingSheetContent
int ImportDrawingSheetContent(const TOOL_EVENT &aEvent)
Definition
pl_edit_tool.cpp:357
PL_EDIT_TOOL::m_moveInProgress
bool m_moveInProgress
Used for chaining commands.
Definition
pl_edit_tool.h:79
PL_EDIT_TOOL::Main
int Main(const TOOL_EVENT &aEvent)
The "move" event loop.
Definition
pl_edit_tool.cpp:102
PL_EDIT_TOOL::Cut
int Cut(const TOOL_EVENT &aEvent)
Definition
pl_edit_tool.cpp:500
PL_EDIT_TOOL::updateModificationPoint
bool updateModificationPoint(PL_SELECTION &aSelection)
Set up handlers for various events.
Definition
pl_edit_tool.cpp:336
PL_EDIT_TOOL::m_selectionTool
PL_SELECTION_TOOL * m_selectionTool
Flag determining if anything is being dragged right now.
Definition
pl_edit_tool.h:76
PL_EDIT_TOOL::moveItem
void moveItem(DS_DATA_ITEM *aItem, const VECTOR2I &aDelta)
Return the right modification point (e.g.
Definition
pl_edit_tool.cpp:324
PL_EDIT_TOOL::InteractiveDelete
int InteractiveDelete(const TOOL_EVENT &aEvent)
Definition
pl_edit_tool.cpp:413
PL_EDIT_TOOL::m_moveOffset
VECTOR2I m_moveOffset
Last cursor position (needed for getModificationPoint() to avoid changes of edit reference point).
Definition
pl_edit_tool.h:82
PL_EDIT_TOOL::m_cursor
VECTOR2I m_cursor
Definition
pl_edit_tool.h:86
PL_EDIT_TOOL::Paste
int Paste(const TOOL_EVENT &aEvent)
Definition
pl_edit_tool.cpp:540
PL_EDIT_TOOL::~PL_EDIT_TOOL
~PL_EDIT_TOOL()
Definition
pl_edit_tool.h:36
PL_EDIT_TOOL::setTransitions
void setTransitions() override
This method is meant to be overridden in order to specify handlers for events.
Definition
pl_edit_tool.cpp:582
PL_EDIT_TOOL::PL_EDIT_TOOL
PL_EDIT_TOOL()
Definition
pl_edit_tool.cpp:48
PL_EDIT_TOOL::m_pickerItem
EDA_ITEM * m_pickerItem
Definition
pl_edit_tool.h:88
PL_EDIT_TOOL::Undo
int Undo(const TOOL_EVENT &aEvent)
Definition
pl_edit_tool.cpp:486
PL_EDIT_TOOL::m_frame
PL_EDITOR_FRAME * m_frame
Definition
pl_edit_tool.h:75
PL_EDIT_TOOL::Copy
int Copy(const TOOL_EVENT &aEvent)
Definition
pl_edit_tool.cpp:511
PL_SELECTION_TOOL
Definition
pl_selection_tool.h:40
PL_SELECTION
Definition
pl_selection.h:28
TOOL_BASE::RESET_REASON
RESET_REASON
Determine the reason of reset for a tool.
Definition
tool_base.h:74
TOOL_EVENT
Generic, UI-independent tool event.
Definition
tool_event.h:167
TOOL_INTERACTIVE::TOOL_INTERACTIVE
TOOL_INTERACTIVE(TOOL_ID aId, const std::string &aName)
Create a tool with given id & name.
Definition
tool_interactive.cpp:35
Reset
void Reset() override
tool_interactive.h
tool_menu.h
VECTOR2I
VECTOR2< int32_t > VECTOR2I
Definition
vector2d.h:683
src
pagelayout_editor
tools
pl_edit_tool.h
Generated on Fri Jun 26 2026 00:05:38 for KiCad PCB EDA Suite by
1.13.2