KiCad PCB EDA Suite
Loading...
Searching...
No Matches
sch_label.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) 2015 Jean-Pierre Charras, jp.charras at wanadoo.fr
5 * Copyright (C) 1992-2023 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_LABEL_H
26#define SCH_LABEL_H
27
28#include <sch_text.h>
29#include <sch_item.h>
30#include <sch_field.h>
31#include <sch_connection.h> // for CONNECTION_TYPE
32
33
34/*
35 * Spin style for labels of all kinds on schematics
36 * Basically a higher level abstraction of rotation and justification of text
37 */
39{
40public:
41 enum SPIN : int
42 {
43 LEFT = 0,
44 UP = 1,
45 RIGHT = 2,
46 BOTTOM = 3
47 };
48
49
50 SPIN_STYLE() = default;
51 constexpr SPIN_STYLE( SPIN aSpin ) : m_spin( aSpin )
52 {
53 }
54
55 constexpr bool operator==( SPIN a ) const
56 {
57 return m_spin == a;
58 }
59
60 constexpr bool operator!=( SPIN a ) const
61 {
62 return m_spin != a;
63 }
64
65 operator int() const
66 {
67 return static_cast<int>( m_spin );
68 }
69
71
76
81
82private:
84};
85
86
87/*
88 * Label and flag shapes used with text objects.
89 */
91{
97
104
105
107{
108public:
109 SCH_LABEL_BASE( const VECTOR2I& aPos, const wxString& aText, KICAD_T aType );
110
111 SCH_LABEL_BASE( const SCH_LABEL_BASE& aLabel );
112
113 SCH_LABEL_BASE& operator=( const SCH_LABEL_BASE& aLabel );
114
115 // Abstract class
116 virtual wxString GetClass() const override = 0;
117
118 bool IsType( const std::vector<KICAD_T>& aScanTypes ) const override;
119
120 void SwapData( SCH_ITEM* aItem ) override;
121
122 bool CanConnect( const SCH_ITEM* aItem ) const override
123 {
124 switch( aItem->Type() )
125 {
126 case SCH_LINE_T:
127 return aItem->GetLayer() == LAYER_WIRE || aItem->GetLayer() == LAYER_BUS;
128
130 return true;
131
132 case SCH_SYMBOL_T:
133 return true;
134
135 case SCH_LABEL_T:
137 case SCH_HIER_LABEL_T:
139 case SCH_SHEET_PIN_T:
140 return true;
141
142 default:
143 return false;
144 }
145 }
146
148 void SetShape( LABEL_FLAG_SHAPE aShape ) { m_shape = aShape; }
149
150 COLOR4D GetLabelColor() const;
151
152 virtual void SetSpinStyle( SPIN_STYLE aSpinStyle );
153 SPIN_STYLE GetSpinStyle() const;
154
155 void SetLastResolvedState( const SCH_ITEM* aItem ) override
156 {
157 const SCH_LABEL_BASE* aLabel = dynamic_cast<const SCH_LABEL_BASE*>( aItem );
158
159 if( aLabel )
161 }
162
163 static const wxString GetDefaultFieldName( const wxString& aName, bool aUseDefaultName );
164
165 virtual int GetMandatoryFieldCount() { return 0; }
166
167 std::vector<SCH_FIELD>& GetFields() { return m_fields; }
168 const std::vector<SCH_FIELD>& GetFields() const { return m_fields; }
169
175 void SetFields( const std::vector<SCH_FIELD>& aFields )
176 {
177 m_fields = aFields; // vector copying, length is changed possibly
178 }
179
180 void AddFields( const std::vector<SCH_FIELD>& aFields )
181 {
182 m_fields.insert( m_fields.end(), aFields.begin(), aFields.end() );
183 }
184
185 void AddField( const SCH_FIELD& aField )
186 {
187 m_fields.push_back( aField );
188 }
189
195 bool IncrementLabel( int aIncrement );
196
197 void Move( const VECTOR2I& aMoveVector ) override;
198 void Rotate( const VECTOR2I& aCenter ) override;
199 void Rotate90( bool aClockwise ) override;
200
201 void MirrorSpinStyle( bool aLeftRight ) override;
202
203 void MirrorHorizontally( int aCenter ) override;
204 void MirrorVertically( int aCenter ) override;
205
206 void SetPosition( const VECTOR2I& aPosition ) override;
207
208 void AutoplaceFields( SCH_SCREEN* aScreen, bool aManual ) override;
209
214 void GetIntersheetRefs( std::vector<std::pair<wxString, wxString>>* pages );
215
219 void GetContextualTextVars( wxArrayString* aVars ) const;
220
226 virtual bool ResolveTextVar( const SCH_SHEET_PATH* aPath, wxString* token, int aDepth ) const;
227
228 wxString GetShownText( const SCH_SHEET_PATH* aPath, bool aAllowExtraText,
229 int aDepth = 0 ) const override;
230
231 wxString GetShownText( bool aAllowExtraText, int aDepth = 0 ) const override
232 {
233 return GetShownText( nullptr, aAllowExtraText, aDepth );
234 }
235
236 bool HasCachedDriverName() const override;
237 const wxString& GetCachedDriverName() const override;
238
239 void RunOnChildren( const std::function<void( SCH_ITEM* )>& aFunction ) override;
240
241 INSPECT_RESULT Visit( INSPECTOR inspector, void* testData,
242 const std::vector<KICAD_T>& scanTypes ) override;
243
244 bool Matches( const EDA_SEARCH_DATA& aSearchData, void* aAuxData ) const override;
245 bool Replace( const EDA_SEARCH_DATA& aSearchData, void* aAuxData ) override;
246
247 VECTOR2I GetSchematicTextOffset( const RENDER_SETTINGS* aSettings ) const override;
248
255 virtual void CreateGraphicShape( const RENDER_SETTINGS* aSettings,
256 std::vector<VECTOR2I>& aPoints, const VECTOR2I& Pos ) const
257 {
258 aPoints.clear();
259 }
260
261 int GetLabelBoxExpansion( const RENDER_SETTINGS* aSettings = nullptr ) const;
262
266 virtual const BOX2I GetBodyBoundingBox() const;
267
271 const BOX2I GetBoundingBox() const override;
272
273 bool HitTest( const VECTOR2I& aPosition, int aAccuracy = 0 ) const override;
274 bool HitTest( const BOX2I& aRect, bool aContained, int aAccuracy = 0 ) const override;
275
276 std::vector<VECTOR2I> GetConnectionPoints() const override;
277
278 void GetEndPoints( std::vector< DANGLING_END_ITEM >& aItemList ) override;
279
280 bool UpdateDanglingState( std::vector<DANGLING_END_ITEM>& aItemList,
281 const SCH_SHEET_PATH* aPath = nullptr ) override;
282
283 bool IsDangling() const override { return m_isDangling; }
284 void SetIsDangling( bool aIsDangling ) { m_isDangling = aIsDangling; }
285
286 void ViewGetLayers( int aLayers[], int& aCount ) const override;
287
288 void GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>& aList ) override;
289
290 void Plot( PLOTTER* aPlotter, bool aBackground ) const override;
291
292 void Print( const RENDER_SETTINGS* aSettings, const VECTOR2I& offset ) override;
293
298 bool AutoRotateOnPlacement() const;
299
305 void SetAutoRotateOnPlacement( bool autoRotate = true );
306
312 virtual bool AutoRotateOnPlacementSupported() const = 0;
313
314protected:
315 void cacheShownText() override;
316
317protected:
318 std::vector<SCH_FIELD> m_fields;
319
321
325
327
329};
330
331
333{
334public:
335 SCH_LABEL( const VECTOR2I& aPos = VECTOR2I( 0, 0 ), const wxString& aText = wxEmptyString );
336
337 // Do not create a copy constructor. The one generated by the compiler is adequate.
338
340
341 static inline bool ClassOf( const EDA_ITEM* aItem )
342 {
343 return aItem && SCH_LABEL_T == aItem->Type();
344 }
345
346 wxString GetClass() const override
347 {
348 return wxT( "SCH_LABEL" );
349 }
350
351 const BOX2I GetBodyBoundingBox() const override;
352
353 bool IsConnectable() const override { return true; }
354
355 wxString GetItemDescription( UNITS_PROVIDER* aUnitsProvider ) const override;
356
357 BITMAPS GetMenuImage() const override;
358
359 bool IsReplaceable() const override { return true; }
360
361 EDA_ITEM* Clone() const override
362 {
363 return new SCH_LABEL( *this );
364 }
365
366 bool IsPointClickableAnchor( const VECTOR2I& aPos ) const override
367 {
368 return m_isDangling && GetPosition() == aPos;
369 }
370
371 bool AutoRotateOnPlacementSupported() const override { return false; }
372
373private:
374 bool doIsConnected( const VECTOR2I& aPosition ) const override
375 {
376 return EDA_TEXT::GetTextPos() == aPosition;
377 }
378};
379
380
382{
383public:
384 SCH_DIRECTIVE_LABEL( const VECTOR2I& aPos = VECTOR2I( 0, 0 ) );
385
386 SCH_DIRECTIVE_LABEL( const SCH_DIRECTIVE_LABEL& aClassLabel );
387
389
390 static inline bool ClassOf( const EDA_ITEM* aItem )
391 {
392 return aItem && SCH_DIRECTIVE_LABEL_T == aItem->Type();
393 }
394
395 wxString GetClass() const override
396 {
397 return wxT( "SCH_DIRECTIVE_LABEL" );
398 }
399
400 EDA_ITEM* Clone() const override
401 {
402 return new SCH_DIRECTIVE_LABEL( *this );
403 }
404
405 void SwapData( SCH_ITEM* aItem ) override;
406
407 int GetPinLength() const { return m_pinLength; }
408 void SetPinLength( int aLength ) { m_pinLength = aLength; }
409
410 int GetPenWidth() const override;
411
412 void CreateGraphicShape( const RENDER_SETTINGS* aSettings, std::vector<VECTOR2I>& aPoints,
413 const VECTOR2I& aPos ) const override;
414
415 void AutoplaceFields( SCH_SCREEN* aScreen, bool aManual ) override;
416
417 wxString GetItemDescription( UNITS_PROVIDER* aUnitsProvider ) const override;
418
419 bool IsConnectable() const override { return true; }
420
421 bool AutoRotateOnPlacementSupported() const override { return false; }
422
423 void MirrorSpinStyle( bool aLeftRight ) override;
424
425 void MirrorHorizontally( int aCenter ) override;
426 void MirrorVertically( int aCenter ) override;
427
428private:
431};
432
433
435{
436public:
437 SCH_GLOBALLABEL( const VECTOR2I& aPos = VECTOR2I( 0, 0 ), const wxString& aText = wxEmptyString );
438
439 SCH_GLOBALLABEL( const SCH_GLOBALLABEL& aGlobalLabel );
440
442
443 static inline bool ClassOf( const EDA_ITEM* aItem )
444 {
445 return aItem && SCH_GLOBAL_LABEL_T == aItem->Type();
446 }
447
448 wxString GetClass() const override
449 {
450 return wxT( "SCH_GLOBALLABEL" );
451 }
452
453 EDA_ITEM* Clone() const override
454 {
455 return new SCH_GLOBALLABEL( *this );
456 }
457
458 int GetMandatoryFieldCount() override { return 1; }
459
460 void SetSpinStyle( SPIN_STYLE aSpinStyle ) override;
461
462 VECTOR2I GetSchematicTextOffset( const RENDER_SETTINGS* aSettings ) const override;
463
464 void CreateGraphicShape( const RENDER_SETTINGS* aRenderSettings, std::vector<VECTOR2I>& aPoints,
465 const VECTOR2I& aPos ) const override;
466
467 bool ResolveTextVar( const SCH_SHEET_PATH* aPath, wxString* token, int aDepth ) const override;
468
469 bool IsConnectable() const override { return true; }
470
471 void ViewGetLayers( int aLayers[], int& aCount ) const override;
472
473 wxString GetItemDescription( UNITS_PROVIDER* aUnitsProvider ) const override;
474
475 BITMAPS GetMenuImage() const override;
476
477 bool IsPointClickableAnchor( const VECTOR2I& aPos ) const override
478 {
479 return m_isDangling && GetPosition() == aPos;
480 }
481
482 bool AutoRotateOnPlacementSupported() const override { return true; }
483
484private:
485 bool doIsConnected( const VECTOR2I& aPosition ) const override
486 {
487 return EDA_TEXT::GetTextPos() == aPosition;
488 }
489};
490
491
493{
494public:
495 SCH_HIERLABEL( const VECTOR2I& aPos = VECTOR2I( 0, 0 ), const wxString& aText = wxEmptyString,
496 KICAD_T aType = SCH_HIER_LABEL_T );
497
498 // Do not create a copy constructor. The one generated by the compiler is adequate.
499
501
502 static inline bool ClassOf( const EDA_ITEM* aItem )
503 {
504 return aItem && SCH_HIER_LABEL_T == aItem->Type();
505 }
506
507 wxString GetClass() const override
508 {
509 return wxT( "SCH_HIERLABEL" );
510 }
511
512 void SetSpinStyle( SPIN_STYLE aSpinStyle ) override;
513
514 VECTOR2I GetSchematicTextOffset( const RENDER_SETTINGS* aSettings ) const override;
515
516 void CreateGraphicShape( const RENDER_SETTINGS* aSettings, std::vector<VECTOR2I>& aPoints,
517 const VECTOR2I& aPos ) const override;
518 void CreateGraphicShape( const RENDER_SETTINGS* aSettings, std::vector<VECTOR2I>& aPoints,
519 const VECTOR2I& aPos, LABEL_FLAG_SHAPE aShape ) const;
520
521 const BOX2I GetBodyBoundingBox() const override;
522
523 bool IsConnectable() const override { return true; }
524
525 wxString GetItemDescription( UNITS_PROVIDER* aUnitsProvider ) const override;
526
527 BITMAPS GetMenuImage() const override;
528
529 EDA_ITEM* Clone() const override
530 {
531 return new SCH_HIERLABEL( *this );
532 }
533
534 bool IsPointClickableAnchor( const VECTOR2I& aPos ) const override
535 {
536 return m_isDangling && GetPosition() == aPos;
537 }
538
539 bool AutoRotateOnPlacementSupported() const override { return true; }
540
541private:
542 bool doIsConnected( const VECTOR2I& aPosition ) const override
543 {
544 return EDA_TEXT::GetTextPos() == aPosition;
545 }
546};
547
548#endif /* SCH_LABEL_H */
BITMAPS
A list of all bitmap identifiers.
Definition: bitmaps_list.h:33
The base class for create windows for drawing purpose.
A base class for most all the KiCad significant classes used in schematics and boards.
Definition: eda_item.h:85
KICAD_T Type() const
Returns the type of object.
Definition: eda_item.h:97
const VECTOR2I & GetTextPos() const
Definition: eda_text.h:219
A color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:104
Container for all the knowledge about how graphical objects are drawn on any output surface/device.
Base plotter engine class.
Definition: plotter.h:104
void MirrorSpinStyle(bool aLeftRight) override
Definition: sch_label.cpp:1417
void SwapData(SCH_ITEM *aItem) override
Swap the internal data structures aItem with the schematic item.
Definition: sch_label.cpp:1387
void MirrorVertically(int aCenter) override
Mirror item vertically about aCenter.
Definition: sch_label.cpp:1484
void MirrorHorizontally(int aCenter) override
Mirror item horizontally about aCenter.
Definition: sch_label.cpp:1448
void AutoplaceFields(SCH_SCREEN *aScreen, bool aManual) override
Definition: sch_label.cpp:1575
bool IsConnectable() const override
Definition: sch_label.h:419
static bool ClassOf(const EDA_ITEM *aItem)
Definition: sch_label.h:390
void CreateGraphicShape(const RENDER_SETTINGS *aSettings, std::vector< VECTOR2I > &aPoints, const VECTOR2I &aPos) const override
Calculate the graphic shape (a polygon) associated to the text.
Definition: sch_label.cpp:1506
int GetPenWidth() const override
Definition: sch_label.cpp:1406
bool AutoRotateOnPlacementSupported() const override
AutoRotateOnPlacementSupported.
Definition: sch_label.h:421
wxString GetClass() const override
Return the class name.
Definition: sch_label.h:395
void SetPinLength(int aLength)
Definition: sch_label.h:408
EDA_ITEM * Clone() const override
Create a duplicate of this item with linked list members set to NULL.
Definition: sch_label.h:400
wxString GetItemDescription(UNITS_PROVIDER *aUnitsProvider) const override
Return a user-visible description string of this item.
Definition: sch_label.cpp:1625
int GetPinLength() const
Definition: sch_label.h:407
Instances are attached to a symbol or sheet and provide a place for the symbol's value,...
Definition: sch_field.h:52
bool IsConnectable() const override
Definition: sch_label.h:469
void ViewGetLayers(int aLayers[], int &aCount) const override
Return the layers the item is drawn on (which may be more than its "home" layer)
Definition: sch_label.cpp:1754
void CreateGraphicShape(const RENDER_SETTINGS *aRenderSettings, std::vector< VECTOR2I > &aPoints, const VECTOR2I &aPos) const override
Calculate the graphic shape (a polygon) associated to the text.
Definition: sch_label.cpp:1766
bool ResolveTextVar(const SCH_SHEET_PATH *aPath, wxString *token, int aDepth) const override
Resolve any references to system tokens supported by the label.
Definition: sch_label.cpp:1702
static bool ClassOf(const EDA_ITEM *aItem)
Definition: sch_label.h:443
int GetMandatoryFieldCount() override
Definition: sch_label.h:458
bool doIsConnected(const VECTOR2I &aPosition) const override
Provide the object specific test to see if it is connected to aPosition.
Definition: sch_label.h:485
VECTOR2I GetSchematicTextOffset(const RENDER_SETTINGS *aSettings) const override
This offset depends on the orientation, the type of text, and the area required to draw the associate...
Definition: sch_label.cpp:1663
void SetSpinStyle(SPIN_STYLE aSpinStyle) override
Definition: sch_label.cpp:1695
wxString GetItemDescription(UNITS_PROVIDER *aUnitsProvider) const override
Return a user-visible description string of this item.
Definition: sch_label.cpp:1834
bool AutoRotateOnPlacementSupported() const override
AutoRotateOnPlacementSupported.
Definition: sch_label.h:482
EDA_ITEM * Clone() const override
Create a duplicate of this item with linked list members set to NULL.
Definition: sch_label.h:453
bool IsPointClickableAnchor(const VECTOR2I &aPos) const override
Definition: sch_label.h:477
wxString GetClass() const override
Return the class name.
Definition: sch_label.h:448
BITMAPS GetMenuImage() const override
Return a pointer to an image to be used in menus.
Definition: sch_label.cpp:1840
bool doIsConnected(const VECTOR2I &aPosition) const override
Provide the object specific test to see if it is connected to aPosition.
Definition: sch_label.h:542
static bool ClassOf(const EDA_ITEM *aItem)
Definition: sch_label.h:502
wxString GetClass() const override
Return the class name.
Definition: sch_label.h:507
const BOX2I GetBodyBoundingBox() const override
Return the bounding box of the label only, without taking in account its fields.
Definition: sch_label.cpp:1894
void SetSpinStyle(SPIN_STYLE aSpinStyle) override
Definition: sch_label.cpp:1855
void CreateGraphicShape(const RENDER_SETTINGS *aSettings, std::vector< VECTOR2I > &aPoints, const VECTOR2I &aPos) const override
Calculate the graphic shape (a polygon) associated to the text.
Definition: sch_label.cpp:1862
EDA_ITEM * Clone() const override
Create a duplicate of this item with linked list members set to NULL.
Definition: sch_label.h:529
BITMAPS GetMenuImage() const override
Return a pointer to an image to be used in menus.
Definition: sch_label.cpp:1974
bool IsPointClickableAnchor(const VECTOR2I &aPos) const override
Definition: sch_label.h:534
bool IsConnectable() const override
Definition: sch_label.h:523
VECTOR2I GetSchematicTextOffset(const RENDER_SETTINGS *aSettings) const override
This offset depends on the orientation, the type of text, and the area required to draw the associate...
Definition: sch_label.cpp:1947
wxString GetItemDescription(UNITS_PROVIDER *aUnitsProvider) const override
Return a user-visible description string of this item.
Definition: sch_label.cpp:1967
bool AutoRotateOnPlacementSupported() const override
AutoRotateOnPlacementSupported.
Definition: sch_label.h:539
Base class for any item which can be embedded within the SCHEMATIC container class,...
Definition: sch_item.h:150
SCH_LAYER_ID GetLayer() const
Return the layer this item is on.
Definition: sch_item.h:257
void SetLastResolvedState(const SCH_ITEM *aItem) override
Definition: sch_label.h:155
const wxString & GetCachedDriverName() const override
Definition: sch_label.cpp:816
void ViewGetLayers(int aLayers[], int &aCount) const override
Return the layers the item is drawn on (which may be more than its "home" layer)
Definition: sch_label.cpp:917
COLOR4D m_lastResolvedColor
Definition: sch_label.h:326
wxString GetShownText(const SCH_SHEET_PATH *aPath, bool aAllowExtraText, int aDepth=0) const override
Definition: sch_label.cpp:831
void Move(const VECTOR2I &aMoveVector) override
Move the item by aMoveVector to a new position.
Definition: sch_label.cpp:417
void AddFields(const std::vector< SCH_FIELD > &aFields)
Definition: sch_label.h:180
void SetFields(const std::vector< SCH_FIELD > &aFields)
Set multiple schematic fields.
Definition: sch_label.h:175
void SetIsDangling(bool aIsDangling)
Definition: sch_label.h:284
bool m_isDangling
Definition: sch_label.h:323
void AddField(const SCH_FIELD &aField)
Definition: sch_label.h:185
bool IsDangling() const override
Definition: sch_label.h:283
INSPECT_RESULT Visit(INSPECTOR inspector, void *testData, const std::vector< KICAD_T > &scanTypes) override
May be re-implemented for each derived class in order to handle all the types given by its member dat...
Definition: sch_label.cpp:879
bool Matches(const EDA_SEARCH_DATA &aSearchData, void *aAuxData) const override
Compare the item against the search criteria in aSearchData.
Definition: sch_label.cpp:863
bool HasCachedDriverName() const override
Definition: sch_label.cpp:810
const std::vector< SCH_FIELD > & GetFields() const
Definition: sch_label.h:168
bool HitTest(const VECTOR2I &aPosition, int aAccuracy=0) const override
Test if aPosition is inside or on the boundary of this item.
Definition: sch_label.cpp:986
void GetEndPoints(std::vector< DANGLING_END_ITEM > &aItemList) override
Add the schematic item end points to aItemList if the item has end points.
Definition: sch_label.cpp:904
bool AutoRotateOnPlacement() const
autoRotateOnPlacement
Definition: sch_label.cpp:1316
void Rotate(const VECTOR2I &aCenter) override
Rotate the item around aCenter 90 degrees in the clockwise direction.
Definition: sch_label.cpp:426
SCH_LABEL_BASE & operator=(const SCH_LABEL_BASE &aLabel)
Definition: sch_label.cpp:236
std::vector< SCH_FIELD > m_fields
Definition: sch_label.h:318
CONNECTION_TYPE m_connectionType
Definition: sch_label.h:322
void MirrorHorizontally(int aCenter) override
Mirror item horizontally about aCenter.
Definition: sch_label.cpp:522
wxString GetShownText(bool aAllowExtraText, int aDepth=0) const override
Return the string actually shown after processing of the base text.
Definition: sch_label.h:231
void SwapData(SCH_ITEM *aItem) override
Swap the internal data structures aItem with the schematic item.
Definition: sch_label.cpp:304
SPIN_STYLE GetSpinStyle() const
Definition: sch_label.cpp:372
void GetIntersheetRefs(std::vector< std::pair< wxString, wxString > > *pages)
Builds an array of { pageNumber, pageName } pairs.
Definition: sch_label.cpp:653
void MirrorSpinStyle(bool aLeftRight) override
Definition: sch_label.cpp:494
std::vector< VECTOR2I > GetConnectionPoints() const override
Add all the connection points for this item to aPoints.
Definition: sch_label.cpp:911
COLOR4D GetLabelColor() const
Definition: sch_label.cpp:326
void SetShape(LABEL_FLAG_SHAPE aShape)
Definition: sch_label.h:148
LABEL_FLAG_SHAPE GetShape() const
Definition: sch_label.h:147
const BOX2I GetBoundingBox() const override
Return the bounding box of the label including its fields.
Definition: sch_label.cpp:961
bool IsType(const std::vector< KICAD_T > &aScanTypes) const override
Check whether the item is one of the listed types.
Definition: sch_label.cpp:259
void MirrorVertically(int aCenter) override
Mirror item vertically about aCenter.
Definition: sch_label.cpp:552
virtual bool AutoRotateOnPlacementSupported() const =0
AutoRotateOnPlacementSupported.
void SetPosition(const VECTOR2I &aPosition) override
Definition: sch_label.cpp:410
virtual bool ResolveTextVar(const SCH_SHEET_PATH *aPath, wxString *token, int aDepth) const
Resolve any references to system tokens supported by the label.
Definition: sch_label.cpp:701
bool CanConnect(const SCH_ITEM *aItem) const override
Definition: sch_label.h:122
bool m_autoRotateOnPlacement
Definition: sch_label.h:324
wxString m_cached_driver_name
Definition: sch_label.h:328
void Print(const RENDER_SETTINGS *aSettings, const VECTOR2I &offset) override
Print a schematic item.
Definition: sch_label.cpp:1273
int GetLabelBoxExpansion(const RENDER_SETTINGS *aSettings=nullptr) const
Definition: sch_label.cpp:928
bool IncrementLabel(int aIncrement)
Increment the label text, if it ends with a number.
Definition: sch_label.cpp:568
void SetAutoRotateOnPlacement(bool autoRotate=true)
setAutoRotateOnPlacement
Definition: sch_label.cpp:1321
void cacheShownText() override
Definition: sch_label.cpp:822
void Rotate90(bool aClockwise) override
Definition: sch_label.cpp:441
bool UpdateDanglingState(std::vector< DANGLING_END_ITEM > &aItemList, const SCH_SHEET_PATH *aPath=nullptr) override
Test the schematic item to aItemList to check if it's dangling state has changed.
Definition: sch_label.cpp:1047
void GetMsgPanelInfo(EDA_DRAW_FRAME *aFrame, std::vector< MSG_PANEL_ITEM > &aList) override
Populate aList of MSG_PANEL_ITEM objects with it's internal state for display purposes.
Definition: sch_label.cpp:1122
static const wxString GetDefaultFieldName(const wxString &aName, bool aUseDefaultName)
Definition: sch_label.cpp:246
void AutoplaceFields(SCH_SCREEN *aScreen, bool aManual) override
Definition: sch_label.cpp:582
void RunOnChildren(const std::function< void(SCH_ITEM *)> &aFunction) override
Definition: sch_label.cpp:856
virtual int GetMandatoryFieldCount()
Definition: sch_label.h:165
LABEL_FLAG_SHAPE m_shape
Definition: sch_label.h:320
void GetContextualTextVars(wxArrayString *aVars) const
Return the list of system text vars & fields for this label.
Definition: sch_label.cpp:688
virtual const BOX2I GetBodyBoundingBox() const
Return the bounding box of the label only, without taking in account its fields.
Definition: sch_label.cpp:943
virtual void CreateGraphicShape(const RENDER_SETTINGS *aSettings, std::vector< VECTOR2I > &aPoints, const VECTOR2I &Pos) const
Calculate the graphic shape (a polygon) associated to the text.
Definition: sch_label.h:255
std::vector< SCH_FIELD > & GetFields()
Definition: sch_label.h:167
virtual wxString GetClass() const override=0
Return the class name.
VECTOR2I GetSchematicTextOffset(const RENDER_SETTINGS *aSettings) const override
This offset depends on the orientation, the type of text, and the area required to draw the associate...
Definition: sch_label.cpp:391
virtual void SetSpinStyle(SPIN_STYLE aSpinStyle)
Definition: sch_label.cpp:337
void Plot(PLOTTER *aPlotter, bool aBackground) const override
Plot the schematic item to aPlotter.
Definition: sch_label.cpp:1180
bool Replace(const EDA_SEARCH_DATA &aSearchData, void *aAuxData) override
Perform a text replace using the find and replace criteria in aSearchData on items that support text ...
Definition: sch_label.cpp:869
bool AutoRotateOnPlacementSupported() const override
AutoRotateOnPlacementSupported.
Definition: sch_label.h:371
wxString GetItemDescription(UNITS_PROVIDER *aUnitsProvider) const override
Return a user-visible description string of this item.
Definition: sch_label.cpp:1364
wxString GetClass() const override
Return the class name.
Definition: sch_label.h:346
bool doIsConnected(const VECTOR2I &aPosition) const override
Provide the object specific test to see if it is connected to aPosition.
Definition: sch_label.h:374
EDA_ITEM * Clone() const override
Create a duplicate of this item with linked list members set to NULL.
Definition: sch_label.h:361
bool IsPointClickableAnchor(const VECTOR2I &aPos) const override
Definition: sch_label.h:366
const BOX2I GetBodyBoundingBox() const override
Return the bounding box of the label only, without taking in account its fields.
Definition: sch_label.cpp:1335
BITMAPS GetMenuImage() const override
Return a pointer to an image to be used in menus.
Definition: sch_label.cpp:1370
~SCH_LABEL()
Definition: sch_label.h:339
bool IsReplaceable() const override
Override this method in any derived object that supports test find and replace.
Definition: sch_label.h:359
static bool ClassOf(const EDA_ITEM *aItem)
Definition: sch_label.h:341
bool IsConnectable() const override
Definition: sch_label.h:353
Handle access to a stack of flattened SCH_SHEET objects by way of a path for creating a flattened sch...
VECTOR2I GetPosition() const override
Definition: sch_text.h:126
constexpr SPIN_STYLE(SPIN aSpin)
Definition: sch_label.h:51
SPIN_STYLE MirrorX()
Mirror the label spin style across the X axis or simply swaps up and bottom.
Definition: sch_label.cpp:172
SPIN m_spin
Definition: sch_label.h:83
SPIN_STYLE()=default
constexpr bool operator!=(SPIN a) const
Definition: sch_label.h:60
constexpr bool operator==(SPIN a) const
Definition: sch_label.h:55
SPIN_STYLE MirrorY()
Mirror the label spin style across the Y axis or simply swaps left and right.
Definition: sch_label.cpp:188
SPIN_STYLE RotateCCW()
Definition: sch_label.cpp:156
INSPECT_RESULT
Definition: eda_item.h:42
const INSPECTOR_FUNC & INSPECTOR
Definition: eda_item.h:78
@ LAYER_WIRE
Definition: layer_ids.h:349
@ LAYER_BUS
Definition: layer_ids.h:350
CONNECTION_TYPE
LABEL_FLAG_SHAPE
Definition: sch_label.h:91
@ L_BIDI
Definition: sch_label.h:94
@ L_TRISTATE
Definition: sch_label.h:95
@ L_UNSPECIFIED
Definition: sch_label.h:96
@ F_DOT
Definition: sch_label.h:99
@ F_ROUND
Definition: sch_label.h:100
@ F_FIRST
Definition: sch_label.h:98
@ L_OUTPUT
Definition: sch_label.h:93
@ F_DIAMOND
Definition: sch_label.h:101
@ L_INPUT
Definition: sch_label.h:92
@ F_RECTANGLE
Definition: sch_label.h:102
KICAD_T
The set of class identification values stored in EDA_ITEM::m_structType.
Definition: typeinfo.h:78
@ SCH_LINE_T
Definition: typeinfo.h:145
@ SCH_SYMBOL_T
Definition: typeinfo.h:155
@ SCH_DIRECTIVE_LABEL_T
Definition: typeinfo.h:153
@ SCH_LABEL_T
Definition: typeinfo.h:150
@ SCH_HIER_LABEL_T
Definition: typeinfo.h:152
@ SCH_SHEET_PIN_T
Definition: typeinfo.h:156
@ SCH_BUS_WIRE_ENTRY_T
Definition: typeinfo.h:143
@ SCH_GLOBAL_LABEL_T
Definition: typeinfo.h:151
VECTOR2< int > VECTOR2I
Definition: vector2d.h:588