KiCad PCB EDA Suite
Loading...
Searching...
No Matches
ee_graphic_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 The KiCad Developers, see AUTHORS.txt for contributors.
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version 2
9 * of the License, or (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program. If not, see <https://www.gnu.org/licenses/>.
18 */
19
20#pragma once
21
22#include <vector>
23
24#include <tools/sch_tool_base.h>
25#include <sch_base_frame.h>
26#include <sch_shape.h>
27
28class SCH_EDIT_FRAME;
31
32
37class EE_GRAPHIC_TOOL : public SCH_TOOL_BASE<SCH_BASE_FRAME>
38{
39public:
40 enum class MODE
41 {
46 };
47
49
50 bool Init() override;
51
52 int DrawShape( const TOOL_EVENT& aEvent );
53 int DrawArc( const TOOL_EVENT& aEvent );
54 int DrawBezier( const TOOL_EVENT& aEvent );
55 int DrawEllipseArc( const TOOL_EVENT& aEvent );
56 int ImportGraphics( const TOOL_EVENT& aEvent );
57
58private:
59 void setTransitions() override;
60
63
65 void commitItem( SCH_COMMIT& aCommit, std::unique_ptr<SCH_ITEM> aItem, const wxString& aDescription );
66
68 int getDefaultTextSize() const;
69
74 void applySymbolEditorFlags( SCH_ITEM& aItem ) const;
75
82 bool drawManagedShape( const TOOL_EVENT& aTool, std::unique_ptr<SCH_SHAPE>& aShape, SHAPE_DRAW_BEHAVIOR& aBehavior,
83 const std::vector<VECTOR2D>& aInitialPts );
84
88
92
98
100
101 // Re-entrancy guards
103};
bool Init() override
Init() is called once upon a registration of the tool.
COLOR4D m_lastTextboxFillColor
void applySymbolEditorFlags(SCH_ITEM &aItem) const
When in the symbol editor, apply unit and body-style restrictions to aItem according to the current d...
int getDefaultTextSize() const
int DrawEllipseArc(const TOOL_EVENT &aEvent)
STROKE_PARAMS m_lastStroke
void setTransitions() override
The layer to use for new shapes in the current editor.
GR_TEXT_H_ALIGN_T m_lastTextboxHJustify
GR_TEXT_V_ALIGN_T m_lastTextboxVJustify
int DrawArc(const TOOL_EVENT &aEvent)
void commitItem(SCH_COMMIT &aCommit, std::unique_ptr< SCH_ITEM > aItem, const wxString &aDescription)
Return the default text size (in IU) for the active editor.
EDA_ANGLE m_lastTextboxAngle
int DrawBezier(const TOOL_EVENT &aEvent)
bool drawManagedShape(const TOOL_EVENT &aTool, std::unique_ptr< SCH_SHAPE > &aShape, SHAPE_DRAW_BEHAVIOR &aBehavior, const std::vector< VECTOR2D > &aInitialPts)
Run the interactive drawing event loop for any shape driven by a SHAPE_DRAW_BEHAVIOR (arcs,...
int DrawShape(const TOOL_EVENT &aEvent)
STROKE_PARAMS m_lastTextboxStroke
FILL_T m_lastTextboxFillStyle
int ImportGraphics(const TOOL_EVENT &aEvent)
SCH_LAYER_ID getShapeLayer() const
Commit a completed item.
A color representation with 4 components: red, green, blue, alpha.
Definition color4d.h:101
Schematic editor (Eeschema) main window.
Base class for any item which can be embedded within the SCHEMATIC container class,...
Definition sch_item.h:162
SCH_TOOL_BASE(const std::string &aName)
Abstract interface for interactive shape-drawing behaviours.
Simple container to manage line stroke parameters.
The symbol library editor main window.
Generic, UI-independent tool event.
Definition tool_event.h:167
FILL_T
Definition eda_shape.h:59
SCH_LAYER_ID
Eeschema drawing layers.
Definition layer_ids.h:455
GR_TEXT_H_ALIGN_T
This is API surface mapped to common.types.HorizontalAlignment.
GR_TEXT_V_ALIGN_T
This is API surface mapped to common.types.VertialAlignment.