KiCad PCB EDA Suite
Loading...
Searching...
No Matches
sch_painter.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-2020 CERN
5 * Copyright (C) 2020-2024 KiCad Developers, see AUTHORS.txt for contributors.
6 *
7 * @author Tomasz Wlostowski <[email protected]>
8 *
9 * This program is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public License
11 * as published by the Free Software Foundation; either version 2
12 * of the License, or (at your option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, you may find one here:
21 * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
22 * or you may search the http://www.gnu.org website for the version 2 license,
23 * or you may write to the Free Software Foundation, Inc.,
24 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
25 */
26
27#ifndef SCH_PAINTER_H
28#define SCH_PAINTER_H
29
30#include <sch_render_settings.h>
31#include <sch_symbol.h>
32
33#include <gal/painter.h>
34
35
36class SCH_PIN;
37class LIB_SYMBOL;
38class SCH_SYMBOL;
39class SCH_FIELD;
40class SCH_JUNCTION;
41class SCH_LABEL;
42class SCH_TEXT;
43class SCH_TEXTBOX;
44class SCH_TABLE;
45class SCH_HIERLABEL;
47class SCH_GLOBALLABEL;
48class SCH_SHEET;
49class SCH_SHEET_PIN;
50class SCH_SHAPE;
51class SCH_MARKER;
52class SCH_NO_CONNECT;
53class SCH_LINE;
55class SCH_BITMAP;
56class SCHEMATIC;
57
58namespace KIGFX
59{
60class GAL;
61class SCH_PAINTER;
62
63
67class SCH_PAINTER : public PAINTER
68{
69public:
70 SCH_PAINTER( GAL* aGal );
71
73 virtual bool Draw( const VIEW_ITEM*, int ) override;
74
76 virtual SCH_RENDER_SETTINGS* GetSettings() override { return &m_schSettings; }
77
78 void SetSchematic( SCHEMATIC* aSchematic ) { m_schematic = aSchematic; }
79
80private:
81 void drawItemBoundingBox( const EDA_ITEM* aItem );
82 void draw( const EDA_ITEM*, int, bool aDimmed );
83 void draw( const SCH_PIN* aPin, int aLayer, bool aDimmed );
84 void draw( const LIB_SYMBOL* aSymbol, int, bool aDrawFields = true, int aUnit = 0,
85 int aBodyStyle = 0, bool aDimmed = false );
86 void draw( const SCH_SYMBOL* aSymbol, int aLayer );
87 void draw( const SCH_SHAPE* aShape, int aLayer, bool aDimmed );
88 void draw( const SCH_JUNCTION* aJct, int aLayer );
89 void draw( const SCH_FIELD* aField, int aLayer, bool aDimmed );
90 void draw( const SCH_TEXTBOX* aTextBox, int aLayer, bool aDimmed );
91 void draw( const SCH_TEXT* aText, int aLayer, bool aDimmed );
92 void draw( const SCH_TABLE* aTable, int aLayer, bool aDimmed );
93 void draw( const SCH_LABEL* aLabel, int aLayer );
94 void draw( const SCH_DIRECTIVE_LABEL* aLabel, int aLayer );
95 void draw( const SCH_HIERLABEL* aLabel, int aLayer, bool aDimmed );
96 void draw( const SCH_GLOBALLABEL* aLabel, int aLayer );
97 void draw( const SCH_SHEET* aSheet, int aLayer );
98 void draw( const SCH_NO_CONNECT* aNC, int aLayer );
99 void draw( const SCH_MARKER* aMarker, int aLayer );
100 void draw( const SCH_BITMAP* aBitmap, int aLayer );
101 void draw( const SCH_LINE* aLine, int aLayer );
102 void draw( const SCH_BUS_ENTRY_BASE* aEntry, int aLayer );
103
104 void drawPinDanglingIndicator( const VECTOR2I& aPos, const COLOR4D& aColor,
105 bool aDrawingShadows, bool aBrightened );
106 void drawDanglingIndicator( const VECTOR2I& aPos, const COLOR4D& aColor, int aWidth,
107 bool aDangling, bool aDrawingShadows, bool aBrightened );
108 void drawAnchor( const VECTOR2I& aPos, bool aDrawingShadows );
109
110 int internalPinDecoSize( const SCH_PIN &aPin );
111 int externalPinDecoSize( const SCH_PIN &aPin );
112
113 // Indicates the item is drawn on a non-cached layer in OpenGL
114 bool nonCached( const EDA_ITEM* aItem );
115
116 bool isUnitAndConversionShown( const SCH_ITEM* aItem ) const;
117
118 float getShadowWidth( bool aForHighlight ) const;
119 COLOR4D getRenderColor( const SCH_ITEM* aItem, int aLayer, bool aDrawingShadows,
120 bool aDimmed = false ) const;
121 KIFONT::FONT* getFont( const EDA_TEXT* aText ) const;
122 float getLineWidth( const SCH_ITEM* aItem, bool aDrawingShadows,
123 bool aDrawingWireColorHighlights = false ) const;
124 float getTextThickness( const SCH_ITEM* aItem ) const;
125
126 int getOperatingPointTextSize() const;
127
128 void triLine( const VECTOR2D& a, const VECTOR2D& b, const VECTOR2D& c );
129
130 wxString expandLibItemTextVars( const wxString& aSourceText, const SCH_SYMBOL* aSymbolContext );
131
132public:
133 static std::vector<KICAD_T> g_ScaledSelectionTypes;
134
135private:
138};
139
140}; // namespace KIGFX
141
142
143#endif // SCH_PAINTER_H
A base class for most all the KiCad significant classes used in schematics and boards.
Definition: eda_item.h:89
A mix-in class (via multiple inheritance) that handles texts such as labels, parts,...
Definition: eda_text.h:79
FONT is an abstract base class for both outline and stroke fonts.
Definition: font.h:131
A color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:104
Abstract interface for drawing on a 2D-surface.
Contains all the knowledge about how to draw graphical object onto any particular output device.
Definition: painter.h:59
Contains methods for drawing schematic-specific items.
Definition: sch_painter.h:68
virtual SCH_RENDER_SETTINGS * GetSettings() override
Return a pointer to current settings that are going to be used when drawing items.
Definition: sch_painter.h:76
virtual bool Draw(const VIEW_ITEM *, int) override
Takes an instance of VIEW_ITEM and passes it to a function that knows how to draw the item.
COLOR4D getRenderColor(const SCH_ITEM *aItem, int aLayer, bool aDrawingShadows, bool aDimmed=false) const
float getTextThickness(const SCH_ITEM *aItem) const
float getShadowWidth(bool aForHighlight) const
int externalPinDecoSize(const SCH_PIN &aPin)
KIFONT::FONT * getFont(const EDA_TEXT *aText) const
void draw(const EDA_ITEM *, int, bool aDimmed)
wxString expandLibItemTextVars(const wxString &aSourceText, const SCH_SYMBOL *aSymbolContext)
static std::vector< KICAD_T > g_ScaledSelectionTypes
Definition: sch_painter.h:133
SCHEMATIC * m_schematic
Definition: sch_painter.h:137
int getOperatingPointTextSize() const
float getLineWidth(const SCH_ITEM *aItem, bool aDrawingShadows, bool aDrawingWireColorHighlights=false) const
void triLine(const VECTOR2D &a, const VECTOR2D &b, const VECTOR2D &c)
void SetSchematic(SCHEMATIC *aSchematic)
Definition: sch_painter.h:78
SCH_RENDER_SETTINGS m_schSettings
Definition: sch_painter.h:136
void drawPinDanglingIndicator(const VECTOR2I &aPos, const COLOR4D &aColor, bool aDrawingShadows, bool aBrightened)
void drawAnchor(const VECTOR2I &aPos, bool aDrawingShadows)
bool nonCached(const EDA_ITEM *aItem)
void drawDanglingIndicator(const VECTOR2I &aPos, const COLOR4D &aColor, int aWidth, bool aDangling, bool aDrawingShadows, bool aBrightened)
void drawItemBoundingBox(const EDA_ITEM *aItem)
int internalPinDecoSize(const SCH_PIN &aPin)
bool isUnitAndConversionShown(const SCH_ITEM *aItem) const
An abstract base class for deriving all objects that can be added to a VIEW.
Definition: view_item.h:84
Define a library symbol object.
Definition: lib_symbol.h:78
Holds all the data relating to one schematic.
Definition: schematic.h:77
Object to handle a bitmap image that can be inserted in a schematic.
Definition: sch_bitmap.h:40
Base class for a bus or wire entry.
Definition: sch_bus_entry.h:38
Instances are attached to a symbol or sheet and provide a place for the symbol's value,...
Definition: sch_field.h:51
Base class for any item which can be embedded within the SCHEMATIC container class,...
Definition: sch_item.h:166
Segment description base class to describe items which have 2 end points (track, wire,...
Definition: sch_line.h:41
Define a sheet pin (label) used in sheets to create hierarchical schematics.
Definition: sch_sheet_pin.h:66
Sheet symbol placed in a schematic, and is the entry point for a sub schematic.
Definition: sch_sheet.h:57
Schematic symbol object.
Definition: sch_symbol.h:104
The Cairo implementation of the graphics abstraction layer.
Definition: color4d.cpp:247