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
25#include <tool/tool_menu.h>
26
27
28class PL_EDITOR_FRAME;
30
31
33{
34public:
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
64private:
65 void moveItem( DS_DATA_ITEM* aItem, const VECTOR2I& aDelta );
66
69 bool updateModificationPoint( PL_SELECTION& aSelection );
70
72 void setTransitions() override;
73
74private:
77
80
83
87
89};
90
91#endif //PL_EDIT_TOOL_H
Drawing sheet structure type definitions.
A base class for most all the KiCad significant classes used in schematics and boards.
Definition eda_item.h:96
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.
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.
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).
VECTOR2I m_cursor
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
int Undo(const TOOL_EVENT &aEvent)
PL_EDITOR_FRAME * m_frame
int Copy(const TOOL_EVENT &aEvent)
RESET_REASON
Determine the reason of reset for a tool.
Definition tool_base.h:74
Generic, UI-independent tool event.
Definition tool_event.h:167
TOOL_INTERACTIVE(TOOL_ID aId, const std::string &aName)
Create a tool with given id & name.
void Reset() override
VECTOR2< int32_t > VECTOR2I
Definition vector2d.h:683