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
29#include <tool/tool_menu.h>
30
31
32class PL_EDITOR_FRAME;
34
35
37{
38public:
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
68private:
69 void moveItem( DS_DATA_ITEM* aItem, const VECTOR2I& aDelta );
70
73 bool updateModificationPoint( PL_SELECTION& aSelection );
74
76 void setTransitions() override;
77
78private:
81
84
87
91
93};
94
95#endif //PL_EDIT_TOOL_H
Drawing sheet structure type definitions.
Definition: ds_data_item.h:96
A base class for most all the KiCad significant classes used in schematics and boards.
Definition: eda_item.h:89
The main window used in the drawing sheet editor.
bool Init() override
Init() is called once upon a registration of the tool.
int Redo(const TOOL_EVENT &aEvent)
int DoDelete(const TOOL_EVENT &aEvent)
Delete the selected items, or the item under the cursor.
int ImportDrawingSheetContent(const TOOL_EVENT &aEvent)
bool m_moveInProgress
Used for chaining commands.
Definition: pl_edit_tool.h:83
int Main(const TOOL_EVENT &aEvent)
The "move" event loop.
int Cut(const TOOL_EVENT &aEvent)
bool updateModificationPoint(PL_SELECTION &aSelection)
Set up handlers for various events.
PL_SELECTION_TOOL * m_selectionTool
Flag determining if anything is being dragged right now.
Definition: pl_edit_tool.h:80
void moveItem(DS_DATA_ITEM *aItem, const VECTOR2I &aDelta)
Return the right modification point (e.g.
int InteractiveDelete(const TOOL_EVENT &aEvent)
VECTOR2I m_moveOffset
Last cursor position (needed for getModificationPoint() to avoid changes of edit reference point).
Definition: pl_edit_tool.h:86
VECTOR2I m_cursor
Definition: pl_edit_tool.h:90
int Paste(const TOOL_EVENT &aEvent)
void setTransitions() override
This method is meant to be overridden in order to specify handlers for events.
EDA_ITEM * m_pickerItem
Definition: pl_edit_tool.h:92
int Undo(const TOOL_EVENT &aEvent)
PL_EDITOR_FRAME * m_frame
Definition: pl_edit_tool.h:79
int Copy(const TOOL_EVENT &aEvent)
RESET_REASON
Determine the reason of reset for a tool.
Definition: tool_base.h:78
Generic, UI-independent tool event.
Definition: tool_event.h:167
void Reset() override