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 (C) 2019-2021 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, you may find one here:
19
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
20
* or you may search the http://www.gnu.org website for the version 2 license,
21
* or you may write to the Free Software Foundation, Inc.,
22
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
23
*/
24
25
#ifndef PL_EDIT_TOOL_H
26
#define PL_EDIT_TOOL_H
27
28
#include <
tool/tool_interactive.h
>
29
#include <
tool/tool_menu.h
>
30
31
32
class
PL_EDITOR_FRAME
;
33
class
PL_SELECTION_TOOL
;
34
35
36
class
PL_EDIT_TOOL
:
public
TOOL_INTERACTIVE
37
{
38
public
:
39
PL_EDIT_TOOL
();
40
~PL_EDIT_TOOL
() {}
41
43
bool
Init
()
override
;
44
46
void
Reset
(
RESET_REASON
aReason )
override
;
47
49
int
Main
(
const
TOOL_EVENT
& aEvent );
50
51
int
Undo
(
const
TOOL_EVENT
& aEvent );
52
int
Redo
(
const
TOOL_EVENT
& aEvent );
53
54
int
Cut
(
const
TOOL_EVENT
& aEvent );
55
int
Copy
(
const
TOOL_EVENT
& aEvent );
56
int
Paste
(
const
TOOL_EVENT
& aEvent );
57
58
int
ImportDrawingSheetContent
(
const
TOOL_EVENT
& aEvent );
59
63
int
DoDelete
(
const
TOOL_EVENT
& aEvent );
64
66
int
InteractiveDelete
(
const
TOOL_EVENT
& aEvent );
67
68
private
:
69
void
moveItem
(
DS_DATA_ITEM
* aItem,
const
VECTOR2I
& aDelta );
70
73
bool
updateModificationPoint
(
PL_SELECTION
& aSelection );
74
76
void
setTransitions
()
override
;
77
78
private
:
79
PL_EDITOR_FRAME
*
m_frame
;
80
PL_SELECTION_TOOL
*
m_selectionTool
;
81
83
bool
m_moveInProgress
;
84
86
VECTOR2I
m_moveOffset
;
87
90
VECTOR2I
m_cursor
;
91
92
EDA_ITEM
*
m_pickerItem
;
93
};
94
95
#endif
//PL_EDIT_TOOL_H
DS_DATA_ITEM
Drawing sheet structure type definitions.
Definition:
ds_data_item.h:96
EDA_ITEM
A base class for most all the KiCad significant classes used in schematics and boards.
Definition:
eda_item.h:89
PL_EDITOR_FRAME
The main window used in the drawing sheet editor.
Definition:
pl_editor_frame.h:48
PL_EDIT_TOOL
Definition:
pl_edit_tool.h:37
PL_EDIT_TOOL::Init
bool Init() override
Init() is called once upon a registration of the tool.
Definition:
pl_edit_tool.cpp:63
PL_EDIT_TOOL::Redo
int Redo(const TOOL_EVENT &aEvent)
Definition:
pl_edit_tool.cpp:496
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:371
PL_EDIT_TOOL::ImportDrawingSheetContent
int ImportDrawingSheetContent(const TOOL_EVENT &aEvent)
Definition:
pl_edit_tool.cpp:360
PL_EDIT_TOOL::m_moveInProgress
bool m_moveInProgress
Used for chaining commands.
Definition:
pl_edit_tool.h:83
PL_EDIT_TOOL::Main
int Main(const TOOL_EVENT &aEvent)
The "move" event loop.
Definition:
pl_edit_tool.cpp:105
PL_EDIT_TOOL::Cut
int Cut(const TOOL_EVENT &aEvent)
Definition:
pl_edit_tool.cpp:503
PL_EDIT_TOOL::updateModificationPoint
bool updateModificationPoint(PL_SELECTION &aSelection)
Set up handlers for various events.
Definition:
pl_edit_tool.cpp:339
PL_EDIT_TOOL::m_selectionTool
PL_SELECTION_TOOL * m_selectionTool
Flag determining if anything is being dragged right now.
Definition:
pl_edit_tool.h:80
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:327
PL_EDIT_TOOL::InteractiveDelete
int InteractiveDelete(const TOOL_EVENT &aEvent)
Definition:
pl_edit_tool.cpp:416
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:86
PL_EDIT_TOOL::m_cursor
VECTOR2I m_cursor
Definition:
pl_edit_tool.h:90
PL_EDIT_TOOL::Paste
int Paste(const TOOL_EVENT &aEvent)
Definition:
pl_edit_tool.cpp:543
PL_EDIT_TOOL::~PL_EDIT_TOOL
~PL_EDIT_TOOL()
Definition:
pl_edit_tool.h:40
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:593
PL_EDIT_TOOL::PL_EDIT_TOOL
PL_EDIT_TOOL()
Definition:
pl_edit_tool.cpp:51
PL_EDIT_TOOL::m_pickerItem
EDA_ITEM * m_pickerItem
Definition:
pl_edit_tool.h:92
PL_EDIT_TOOL::Undo
int Undo(const TOOL_EVENT &aEvent)
Definition:
pl_edit_tool.cpp:489
PL_EDIT_TOOL::m_frame
PL_EDITOR_FRAME * m_frame
Definition:
pl_edit_tool.h:79
PL_EDIT_TOOL::Copy
int Copy(const TOOL_EVENT &aEvent)
Definition:
pl_edit_tool.cpp:514
PL_SELECTION_TOOL
Definition:
pl_selection_tool.h:44
PL_SELECTION
Definition:
pl_selection.h:32
TOOL_BASE::RESET_REASON
RESET_REASON
Determine the reason of reset for a tool.
Definition:
tool_base.h:78
TOOL_EVENT
Generic, UI-independent tool event.
Definition:
tool_event.h:167
TOOL_INTERACTIVE
Definition:
tool_interactive.h:57
VECTOR2< int32_t >
Reset
void Reset() override
tool_interactive.h
tool_menu.h
src
pagelayout_editor
tools
pl_edit_tool.h
Generated on Fri Nov 22 2024 00:04:55 for KiCad PCB EDA Suite by
1.9.6