KiCad PCB EDA Suite
sch_drawing_tools.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 SCH_DRAWING_TOOLS_H
26 #define SCH_DRAWING_TOOLS_H
27 
28 #include <tools/ee_tool_base.h>
29 #include <sch_base_frame.h>
30 #include <status_popup.h>
31 
32 class SCH_SYMBOL;
33 class SCH_BUS_WIRE_ENTRY;
34 class SCH_LABEL;
35 class SCHLIB_FILTER;
36 class SCH_EDIT_FRAME;
37 class EE_SELECTION_TOOL;
38 
39 
44 class SCH_DRAWING_TOOLS : public EE_TOOL_BASE<SCH_EDIT_FRAME>
45 {
46 public:
48  ~SCH_DRAWING_TOOLS() override { }
49 
51  bool Init() override;
52 
53  int PlaceSymbol( const TOOL_EVENT& aEvent );
54  int SingleClickPlace( const TOOL_EVENT& aEvent );
55  int TwoClickPlace( const TOOL_EVENT& aEvent );
56  int DrawSheet( const TOOL_EVENT& aEvent );
57  int PlaceImage( const TOOL_EVENT& aEvent );
58 
59 private:
66 
72  SCH_TEXT* createNewText( const VECTOR2I& aPosition, int aType );
73 
75 
77 
78  void sizeSheet( SCH_SHEET* aSheet, const VECTOR2I& aPos );
79 
81  void setTransitions() override;
82 
83  std::vector<PICKED_SYMBOL> m_symbolHistoryList;
84  std::vector<PICKED_SYMBOL> m_powerHistoryList;
85 
91 
98 
99  std::unique_ptr<STATUS_TEXT_POPUP> m_statusPopup;
100 };
101 
102 #endif /* SCH_DRAWING_TOOLS_H */
PINSHEETLABEL_SHAPE m_lastGlobalLabelShape
int TwoClickPlace(const TOOL_EVENT &aEvent)
bool Init() override
Init() is called once upon a registration of the tool.
SCH_SHEET_PIN * createSheetPin(SCH_SHEET *aSheet, SCH_HIERLABEL *aLabel)
Tool responsible for drawing/placing items (symbols, wires, buses, labels, etc.).
EDA_RECT GetCanvasFreeAreaPixels()
~SCH_DRAWING_TOOLS() override
bool m_lastTextItalic
Re-entrancy guards.
Schematic editor (Eeschema) main window.
void sizeSheet(SCH_SHEET *aSheet, const VECTOR2I &aPos)
Set up handlers for various events.
int PlaceImage(const TOOL_EVENT &aEvent)
std::vector< PICKED_SYMBOL > m_symbolHistoryList
int PlaceSymbol(const TOOL_EVENT &aEvent)
int SingleClickPlace(const TOOL_EVENT &aEvent)
Generic, UI-independent tool event.
Definition: tool_event.h:152
Define a sheet pin (label) used in sheets to create hierarchical schematics.
Definition: sch_sheet_pin.h:65
Sheet symbol placed in a schematic, and is the entry point for a sub schematic.
Definition: sch_sheet.h:54
std::vector< PICKED_SYMBOL > m_powerHistoryList
PINSHEETLABEL_SHAPE
Definition: sch_text.h:95
Schematic symbol object.
Definition: sch_symbol.h:78
SCH_HIERLABEL * importHierLabel(SCH_SHEET *aSheet)
SCH_TEXT * createNewText(const VECTOR2I &aPosition, int aType)
Get the next queued text item.
Handle the component boundary box.
Definition: eda_rect.h:42
Class for a wire to bus entry.
PINSHEETLABEL_SHAPE m_lastSheetPinType
A foundation class for a tool operating on a schematic or symbol.
Definition: ee_tool_base.h:49
LABEL_SPIN_STYLE m_lastTextOrientation
void setTransitions() override
This method is meant to be overridden in order to specify handlers for events.
int DrawSheet(const TOOL_EVENT &aEvent)
std::unique_ptr< STATUS_TEXT_POPUP > m_statusPopup