KiCad PCB EDA Suite
Loading...
Searching...
No Matches
sch_sheet.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 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, 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_SHEEET_H
26#define SCH_SHEEET_H
27
28#include <sch_field.h>
29
30class KIID_PATH;
31class SCH_SCREEN;
33class SCH_SHEET_LIST;
34class SCH_SHEET_PIN;
35class SCH_SHEET_PATH;
36class EDA_DRAW_FRAME;
37class SCH_NO_CONNECT;
38
39
40#define MIN_SHEET_WIDTH 500 // Units are mils.
41#define MIN_SHEET_HEIGHT 150 // Units are mils.
42
43
47class SCH_SHEET : public SCH_ITEM
48{
49public:
50 SCH_SHEET( EDA_ITEM* aParent = nullptr, const VECTOR2I& aPos = VECTOR2I( 0, 0 ),
51 VECTOR2I aSize = VECTOR2I( schIUScale.MilsToIU( MIN_SHEET_WIDTH ),
52 schIUScale.MilsToIU( MIN_SHEET_HEIGHT ) ) );
53
60 SCH_SHEET( const SCH_SHEET& aSheet );
61
62 ~SCH_SHEET();
63
64 static inline bool ClassOf( const EDA_ITEM* aItem )
65 {
66 return aItem && SCH_SHEET_T == aItem->Type();
67 }
68
69 wxString GetClass() const override
70 {
71 return wxT( "SCH_SHEET" );
72 }
73
83 bool IsMovableFromAnchorPoint() const override { return false; }
84
88 std::vector<SCH_FIELD>& GetFields() { return m_fields; }
89 const std::vector<SCH_FIELD>& GetFields() const { return m_fields; }
90
95 SCH_FIELD* GetField( FIELD_T aFieldType );
96 const SCH_FIELD* GetField( FIELD_T aFieldNdx ) const;
97
105 SCH_FIELD* GetField( const wxString& aFieldName );
106 const SCH_FIELD* GetField( const wxString& aFieldName ) const;
107
111 int GetNextFieldOrdinal() const;
112
118 void SetFields( const std::vector<SCH_FIELD>& aFields );
119
125 SCH_FIELD* AddField( const SCH_FIELD& aField );
126
127 void SetFieldText( const wxString& aFieldName, const wxString& aFieldText, const SCH_SHEET_PATH* aPath = nullptr,
128 const wxString& aVariantName = wxEmptyString );
129
130 wxString GetFieldText( const wxString& aFieldName, const SCH_SHEET_PATH* aPath = nullptr,
131 const wxString& aVariantName = wxEmptyString ) const;
132
133 wxString GetShownName( bool aAllowExtraText ) const
134 {
135 return GetField( FIELD_T::SHEET_NAME )->GetShownText( aAllowExtraText );
136 }
137 wxString GetName() const { return GetField( FIELD_T::SHEET_NAME )->GetText(); }
138 void SetName( const wxString& aName ) { GetField( FIELD_T::SHEET_NAME )->SetText( aName ); }
139
140 SCH_SCREEN* GetScreen() const { return m_screen; }
141
142 VECTOR2I GetSize() const { return m_size; }
143 void SetSize( const VECTOR2I& aSize ) { m_size = aSize; }
144
145 int GetBorderWidth() const { return m_borderWidth; }
146 void SetBorderWidth( int aWidth ) { m_borderWidth = aWidth; }
147
149 void SetBorderColor( KIGFX::COLOR4D aColor ) { m_borderColor = aColor; }
150
153
159 bool IsVirtualRootSheet() const;
160
168 bool IsTopLevelSheet() const;
169
181 void SetScreen( SCH_SCREEN* aScreen );
182
188 int GetScreenCount() const;
189
193 void GetContextualTextVars( wxArrayString* aVars ) const;
194
200 bool ResolveTextVar( const SCH_SHEET_PATH* aPath, wxString* token, int aDepth = 0 ) const;
201
202 void GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>& aList ) override;
203
204 /* there is no member for orientation in sch_sheet, to preserve file
205 * format, we detect orientation based on pin edges
206 */
207 bool IsVerticalOrientation() const;
208
213 std::map<SCH_SHEET_PIN*, SCH_NO_CONNECT*> GetNoConnects() const;
214
215 void SetPositionIgnoringPins( const VECTOR2I& aPosition );
216
226 void AddPin( SCH_SHEET_PIN* aSheetPin );
227
228 std::vector<SCH_SHEET_PIN*>& GetPins() { return m_pins; }
229 const std::vector<SCH_SHEET_PIN*>& GetPins() const { return m_pins; }
230
236 void RemovePin( const SCH_SHEET_PIN* aSheetPin );
237
244 void CleanupSheet();
245
253 SCH_SHEET_PIN* GetPin( const VECTOR2I& aPosition );
254
261 bool HasPin( const wxString& aName ) const;
262
263 bool HasPins() const { return !m_pins.empty(); }
264
270 bool HasUndefinedPins() const;
271
283 int GetMinWidth( bool aFromLeft ) const;
284
295 int GetMinHeight( bool aFromTop ) const;
296
297 int GetPenWidth() const override;
298
302 const BOX2I GetBodyBoundingBox() const;
303
304 const BOX2I GetBoundingBox() const override;
305
313
314 void swapData( SCH_ITEM* aItem ) override;
315
319 int SymbolCount() const;
320
328 bool SearchHierarchy( const wxString& aFilename, SCH_SCREEN** aScreen );
329
340 bool LocatePathOfScreen( SCH_SCREEN* aScreen, SCH_SHEET_PATH* aList );
341
347 int CountSheets() const;
348
356 int CountActiveSheets() const;
357
364 int CountSheets( const wxString& aFileName ) const;
365
371 wxString GetFileName() const
372 {
374 }
375
376 // Set a new filename without changing anything else
377 void SetFileName( const wxString& aFilename )
378 {
379 // Filenames are stored using unix notation
380 wxString tmp = aFilename;
381 tmp.Replace( wxT( "\\" ), wxT( "/" ) );
383 }
384
385 // Geometric transforms (used in block operations):
386
387 void Move( const VECTOR2I& aMoveVector ) override;
388 void MirrorHorizontally( int aCenter ) override;
389 void MirrorVertically( int aCenter ) override;
390 void Rotate( const VECTOR2I& aCenter, bool aRotateCCW ) override;
391
392 bool Matches( const EDA_SEARCH_DATA& aSearchData, void* aAuxData ) const override;
393
394 bool IsReplaceable() const override { return true; }
395
401 void Resize( const VECTOR2I& aSize );
402
403 void AutoplaceFields( SCH_SCREEN* aScreen, AUTOPLACE_ALGO aAlgo ) override;
404
405 void GetEndPoints( std::vector <DANGLING_END_ITEM>& aItemList ) override;
406
407 bool UpdateDanglingState( std::vector<DANGLING_END_ITEM>& aItemListByType,
408 std::vector<DANGLING_END_ITEM>& aItemListByPos,
409 const SCH_SHEET_PATH* aPath = nullptr ) override;
410
411 bool IsConnectable() const override { return true; }
412
413 bool HasConnectivityChanges( const SCH_ITEM* aItem,
414 const SCH_SHEET_PATH* aInstance = nullptr ) const override;
415
416 bool CanConnect( const SCH_ITEM* aItem ) const override
417 {
418 return ( aItem->Type() == SCH_LINE_T && aItem->GetLayer() == LAYER_WIRE )
419 || ( aItem->Type() == SCH_LINE_T && aItem->GetLayer() == LAYER_BUS )
420 || ( aItem->Type() == SCH_NO_CONNECT_T )
421 || ( aItem->Type() == SCH_SYMBOL_T );
422 }
423
424 std::vector<VECTOR2I> GetConnectionPoints() const override;
425
426 INSPECT_RESULT Visit( INSPECTOR inspector, void* testData,
427 const std::vector<KICAD_T>& aScanTypes ) override;
428
429 void RunOnChildren( const std::function<void( SCH_ITEM* )>& aFunction, RECURSE_MODE aMode ) override;
430
434 void SetExcludedFromSim( bool aExcludeFromSim, const SCH_SHEET_PATH* aInstance = nullptr,
435 const wxString& aVariantName = wxEmptyString ) override;
436 bool GetExcludedFromSim( const SCH_SHEET_PATH* aInstance = nullptr,
437 const wxString& aVariantName = wxEmptyString ) const override;
438
439 bool GetExcludedFromSimProp() const;
440 void SetExcludedFromSimProp( bool aEnable );
441
445 void SetExcludedFromBOM( bool aExcludeFromBOM, const SCH_SHEET_PATH* aInstance = nullptr,
446 const wxString& aVariantName = wxEmptyString ) override;
447 bool GetExcludedFromBOM( const SCH_SHEET_PATH* aInstance = nullptr,
448 const wxString& aVariantName = wxEmptyString ) const override;
449
450 bool GetExcludedFromBOMProp() const;
451 void SetExcludedFromBOMProp( bool aEnable );
452
456 void SetExcludedFromBoard( bool aExclude, const SCH_SHEET_PATH* aInstance = nullptr,
457 const wxString& aVariantName = wxEmptyString ) override
458 {
459 m_excludedFromBoard = aExclude;
460 }
461
462 bool GetExcludedFromBoard( const SCH_SHEET_PATH* aInstance = nullptr,
463 const wxString& aVariantName = wxEmptyString ) const override
464 {
465 return m_excludedFromBoard;
466 }
467
469 void SetExcludedFromBoardProp( bool aExclude ) { SetExcludedFromBoard( aExclude ); }
470
474 bool GetDNP( const SCH_SHEET_PATH* aInstance = nullptr,
475 const wxString& aVariantName = wxEmptyString ) const override;
476 void SetDNP( bool aDNP, const SCH_SHEET_PATH* aInstance = nullptr,
477 const wxString& aVariantName = wxEmptyString ) override;
478 bool GetDNPProp() const;
479 void SetDNPProp( bool aEnable );
480
481 wxString GetItemDescription( UNITS_PROVIDER* aUnitsProvider, bool aFull ) const override;
482
483 BITMAPS GetMenuImage() const override;
484
485 SCH_SHEET& operator=( const SCH_ITEM& aSheet );
486
487 bool operator <( const SCH_ITEM& aItem ) const override;
488
489 std::vector<int> ViewGetLayers() const override;
490
491 VECTOR2I GetPosition() const override { return m_pos; }
492 void SetPosition( const VECTOR2I& aPosition ) override;
493
494 bool HitTest( const VECTOR2I& aPosition, int aAccuracy ) const override;
495 bool HitTest( const BOX2I& aRect, bool aContained, int aAccuracy = 0 ) const override;
496 bool HitTest( const SHAPE_LINE_CHAIN& aPoly, bool aContained ) const override;
497
498 void Plot( PLOTTER* aPlotter, bool aBackground, const SCH_PLOT_OPTS& aPlotOpts,
499 int aUnit, int aBodyStyle, const VECTOR2I& aOffset, bool aDimmed ) override;
500
501 EDA_ITEM* Clone() const override;
502
506 const std::vector<SCH_SHEET_INSTANCE>& GetInstances() const { return m_instances; }
507
517 bool HasRootInstance() const;
518
527 const SCH_SHEET_INSTANCE& GetRootInstance() const;
528
529 void RemoveInstance( const KIID_PATH& aInstancePath );
530
531 void AddInstance( const SCH_SHEET_INSTANCE& aInstance );
532
533 void DeleteVariant( const KIID_PATH& aPath, const wxString& aVariantName );
534
535 void RenameVariant( const KIID_PATH& aPath, const wxString& aOldName, const wxString& aNewName );
536
537 void CopyVariant( const KIID_PATH& aPath, const wxString& aSourceVariant,
538 const wxString& aNewVariant );
539
540 void AddVariant( const SCH_SHEET_PATH& aInstance, const SCH_SHEET_VARIANT& aVariant );
541 void DeleteVariant( const SCH_SHEET_PATH& aInstance, const wxString& aVariantName )
542 {
543 DeleteVariant( aInstance.Path(), aVariantName );
544 }
545
546 void RenameVariant( const SCH_SHEET_PATH& aInstance, const wxString& aOldName,
547 const wxString& aNewName )
548 {
549 RenameVariant( aInstance.Path(), aOldName, aNewName );
550 }
551
552 void CopyVariant( const SCH_SHEET_PATH& aInstance, const wxString& aSourceVariant,
553 const wxString& aNewVariant )
554 {
555 CopyVariant( aInstance.Path(), aSourceVariant, aNewVariant );
556 }
557
564 bool HasPageNumberChanges( const SCH_SHEET& aOther ) const;
565
571 static int ComparePageNum( const wxString& aPageNumberA, const wxString& aPageNumberB );
572
573 double Similarity( const SCH_ITEM& aOther ) const override;
574
575 bool operator==( const SCH_ITEM& aOther ) const override;
576
577#if defined(DEBUG)
578 void Show( int nestLevel, std::ostream& os ) const override;
579#endif
580
581protected:
584
585 void setInstances( const std::vector<SCH_SHEET_INSTANCE>& aInstances )
586 {
587 m_instances = aInstances;
588 }
589
603 bool addInstance( const KIID_PATH& aInstance );
604
614 wxString getPageNumber( const KIID_PATH& aParentPath ) const;
615
625 void setPageNumber( const KIID_PATH& aInstance, const wxString& aPageNumber );
626
627 bool getInstance( SCH_SHEET_INSTANCE& aInstance, const KIID_PATH& aSheetPath,
628 bool aTestFromEnd = false ) const;
629
631 const SCH_SHEET_INSTANCE* getInstance( const KIID_PATH& aPath ) const;
632
633 SCH_SHEET_INSTANCE* getInstance( const SCH_SHEET_PATH& aPath ) { return getInstance( aPath.Path() ); }
634 const SCH_SHEET_INSTANCE* getInstance( const SCH_SHEET_PATH& aPath ) const { return getInstance( aPath.Path() ); }
635
643 void renumberPins();
644
649 SCH_SHEET_PATH findSelf() const;
650
651private:
652 bool doIsConnected( const VECTOR2I& aPosition ) const override;
653
654 friend class SCH_SHEET_PIN;
655 friend class SCH_SHEET_LIST;
656
657private:
658 SCH_SCREEN* m_screen; // Screen that contains the physical data for the
659 // sheet. In complex hierarchies multiple sheets
660 // can share a common screen.
661
662 std::vector<SCH_SHEET_PIN*> m_pins; // The list of sheet connection points.
663 std::vector<SCH_FIELD> m_fields;
664
668 bool m_DNP;
669
670 VECTOR2I m_pos; // The position of the sheet.
671 VECTOR2I m_size; // The size of the sheet.
675
676 std::vector<SCH_SHEET_INSTANCE> m_instances;
677};
678
679
680#endif // SCH_SHEEET_H
constexpr EDA_IU_SCALE schIUScale
Definition base_units.h:114
BITMAPS
A list of all bitmap identifiers.
BOX2< VECTOR2I > BOX2I
Definition box2.h:922
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:99
KICAD_T Type() const
Returns the type of object.
Definition eda_item.h:111
EDA_ITEM(EDA_ITEM *parent, KICAD_T idType, bool isSCH_ITEM=false, bool isBOARD_ITEM=false)
Definition eda_item.cpp:41
A color representation with 4 components: red, green, blue, alpha.
Definition color4d.h:105
Base plotter engine class.
Definition plotter.h:136
virtual const wxString & GetText() const override
Return the string associated with the text object.
Definition sch_field.h:116
wxString GetShownText(const SCH_SHEET_PATH *aPath, bool aAllowExtraText, int aDepth=0, const wxString &aVariantName=wxEmptyString) const
void SetText(const wxString &aText) override
Object to parser s-expression symbol library and schematic file formats.
Base class for any item which can be embedded within the SCHEMATIC container class,...
Definition sch_item.h:168
SCH_LAYER_ID GetLayer() const
Return the layer this item is on.
Definition sch_item.h:341
SCH_ITEM(EDA_ITEM *aParent, KICAD_T aType, int aUnit=0, int aBodyStyle=0)
Definition sch_item.cpp:56
A container for handling SCH_SHEET_PATH objects in a flattened hierarchy.
Handle access to a stack of flattened SCH_SHEET objects by way of a path for creating a flattened sch...
KIID_PATH Path() const
Get the sheet path as an KIID_PATH.
Define a sheet pin (label) used in sheets to create hierarchical schematics.
Variant information for a schematic sheet.
Sheet symbol placed in a schematic, and is the entry point for a sub schematic.
Definition sch_sheet.h:48
void GetEndPoints(std::vector< DANGLING_END_ITEM > &aItemList) override
Add the schematic item end points to aItemList if the item has end points.
void GetContextualTextVars(wxArrayString *aVars) const
Return the list of system text vars & fields for this sheet.
friend SCH_SHEET_PATH
Definition sch_sheet.h:582
void SetBorderColor(KIGFX::COLOR4D aColor)
Definition sch_sheet.h:149
const std::vector< SCH_SHEET_PIN * > & GetPins() const
Definition sch_sheet.h:229
friend class SCH_SHEET_PIN
Definition sch_sheet.h:654
VECTOR2I m_size
Definition sch_sheet.h:671
void SetFileName(const wxString &aFilename)
Definition sch_sheet.h:377
bool HasConnectivityChanges(const SCH_ITEM *aItem, const SCH_SHEET_PATH *aInstance=nullptr) const override
Check if aItem has connectivity changes against this object.
wxString GetFileName() const
Return the filename corresponding to this sheet.
Definition sch_sheet.h:371
bool getInstance(SCH_SHEET_INSTANCE &aInstance, const KIID_PATH &aSheetPath, bool aTestFromEnd=false) const
BITMAPS GetMenuImage() const override
Return a pointer to an image to be used in menus.
void SetExcludedFromSim(bool aExcludeFromSim, const SCH_SHEET_PATH *aInstance=nullptr, const wxString &aVariantName=wxEmptyString) override
Set or clear the exclude from simulation flag.
void CopyVariant(const KIID_PATH &aPath, const wxString &aSourceVariant, const wxString &aNewVariant)
void SetSize(const VECTOR2I &aSize)
Definition sch_sheet.h:143
void RemoveInstance(const KIID_PATH &aInstancePath)
void SetDNP(bool aDNP, const SCH_SHEET_PATH *aInstance=nullptr, const wxString &aVariantName=wxEmptyString) override
bool addInstance(const KIID_PATH &aInstance)
Add a new instance aSheetPath to the instance list.
void AddPin(SCH_SHEET_PIN *aSheetPin)
Add aSheetPin to the sheet.
bool HasRootInstance() const
Check to see if this sheet has a root sheet instance.
wxString GetClass() const override
Return the class name.
Definition sch_sheet.h:69
wxString getPageNumber(const KIID_PATH &aParentPath) const
Return the sheet page number for aParentPath.
void SetExcludedFromBOM(bool aExcludeFromBOM, const SCH_SHEET_PATH *aInstance=nullptr, const wxString &aVariantName=wxEmptyString) override
Set or clear the exclude from schematic bill of materials flag.
int GetPenWidth() const override
std::map< SCH_SHEET_PIN *, SCH_NO_CONNECT * > GetNoConnects() const
EDA_ITEM * Clone() const override
Create a duplicate of this item with linked list members set to NULL.
bool IsConnectable() const override
Definition sch_sheet.h:411
bool IsTopLevelSheet() const
Check if this sheet is a top-level sheet.
SCH_SHEET_PATH findSelf() const
Get the sheetpath of this sheet.
bool GetDNPProp() const
bool Matches(const EDA_SEARCH_DATA &aSearchData, void *aAuxData) const override
Compare the item against the search criteria in aSearchData.
bool GetExcludedFromBoardProp() const
Definition sch_sheet.h:468
double Similarity(const SCH_ITEM &aOther) const override
Return a measure of how likely the other object is to represent the same object.
bool GetExcludedFromBOMProp() const
VECTOR2I m_pos
Definition sch_sheet.h:670
void CopyVariant(const SCH_SHEET_PATH &aInstance, const wxString &aSourceVariant, const wxString &aNewVariant)
Definition sch_sheet.h:552
std::vector< SCH_FIELD > & GetFields()
Return a reference to the vector holding the sheet's fields.
Definition sch_sheet.h:88
KIGFX::COLOR4D m_borderColor
Definition sch_sheet.h:673
SCH_FIELD * GetField(FIELD_T aFieldType)
Return a mandatory field in this sheet.
bool m_excludedFromBOM
Definition sch_sheet.h:666
wxString GetName() const
Definition sch_sheet.h:137
void renumberPins()
Renumber the sheet pins in the sheet.
VECTOR2I GetRotationCenter() const
Rotating around the boundingBox's center can cause walking when the sheetname or filename is longer t...
SCH_SHEET_PIN * GetPin(const VECTOR2I &aPosition)
Return the sheet pin item found at aPosition in the sheet.
bool GetExcludedFromBOM(const SCH_SHEET_PATH *aInstance=nullptr, const wxString &aVariantName=wxEmptyString) const override
bool operator<(const SCH_ITEM &aItem) const override
void CleanupSheet()
Delete sheet label which do not have a corresponding hierarchical label.
void RemovePin(const SCH_SHEET_PIN *aSheetPin)
Remove aSheetPin from the sheet.
void SetPositionIgnoringPins(const VECTOR2I &aPosition)
bool SearchHierarchy(const wxString &aFilename, SCH_SCREEN **aScreen)
Search the existing hierarchy for an instance of screen loaded from aFileName.
bool GetExcludedFromSim(const SCH_SHEET_PATH *aInstance=nullptr, const wxString &aVariantName=wxEmptyString) const override
bool LocatePathOfScreen(SCH_SCREEN *aScreen, SCH_SHEET_PATH *aList)
Search the existing hierarchy for an instance of screen loaded from aFileName.
std::vector< SCH_SHEET_INSTANCE > m_instances
Definition sch_sheet.h:676
bool HasUndefinedPins() const
Check all sheet labels against schematic for undefined hierarchical labels.
bool m_excludedFromSim
Definition sch_sheet.h:665
void SetPosition(const VECTOR2I &aPosition) override
wxString GetFieldText(const wxString &aFieldName, const SCH_SHEET_PATH *aPath=nullptr, const wxString &aVariantName=wxEmptyString) const
void SetBackgroundColor(KIGFX::COLOR4D aColor)
Definition sch_sheet.h:152
int SymbolCount() const
Count our own symbols, without the power symbols.
void Plot(PLOTTER *aPlotter, bool aBackground, const SCH_PLOT_OPTS &aPlotOpts, int aUnit, int aBodyStyle, const VECTOR2I &aOffset, bool aDimmed) override
Plot the item to aPlotter.
bool IsReplaceable() const override
Override this method in any derived object that supports test find and replace.
Definition sch_sheet.h:394
void SetDNPProp(bool aEnable)
void AddInstance(const SCH_SHEET_INSTANCE &aInstance)
int GetMinWidth(bool aFromLeft) const
Return the minimum width of the sheet based on the widths of the sheet pin text.
bool operator==(const SCH_ITEM &aOther) const override
SCH_SCREEN * m_screen
Definition sch_sheet.h:658
std::vector< int > ViewGetLayers() const override
Return the layers the item is drawn on (which may be more than its "home" layer)
std::vector< SCH_FIELD > m_fields
Definition sch_sheet.h:663
void RenameVariant(const KIID_PATH &aPath, const wxString &aOldName, const wxString &aNewName)
VECTOR2I GetSize() const
Definition sch_sheet.h:142
KIGFX::COLOR4D m_backgroundColor
Definition sch_sheet.h:674
void SetExcludedFromBoard(bool aExclude, const SCH_SHEET_PATH *aInstance=nullptr, const wxString &aVariantName=wxEmptyString) override
Set or clear exclude from board netlist flag.
Definition sch_sheet.h:456
void DeleteVariant(const KIID_PATH &aPath, const wxString &aVariantName)
SCH_SHEET(EDA_ITEM *aParent=nullptr, const VECTOR2I &aPos=VECTOR2I(0, 0), VECTOR2I aSize=VECTOR2I(schIUScale.MilsToIU(MIN_SHEET_WIDTH), schIUScale.MilsToIU(MIN_SHEET_HEIGHT)))
Definition sch_sheet.cpp:57
void SetName(const wxString &aName)
Definition sch_sheet.h:138
int CountSheets() const
Count the number of sheets found in "this" sheet including all of the subsheets.
int GetNextFieldOrdinal() const
Return the next ordinal for a user field for this sheet.
SCH_SCREEN * GetScreen() const
Definition sch_sheet.h:140
void SetExcludedFromSimProp(bool aEnable)
bool HasPins() const
Definition sch_sheet.h:263
VECTOR2I GetPosition() const override
Definition sch_sheet.h:491
const BOX2I GetBodyBoundingBox() const
Return a bounding box for the sheet body but not the fields.
bool HasPin(const wxString &aName) const
Check if the sheet already has a sheet pin named aName.
static int ComparePageNum(const wxString &aPageNumberA, const wxString &aPageNumberB)
Compare page numbers of schematic sheets.
void SetFieldText(const wxString &aFieldName, const wxString &aFieldText, const SCH_SHEET_PATH *aPath=nullptr, const wxString &aVariantName=wxEmptyString)
void MirrorHorizontally(int aCenter) override
Mirror item horizontally about aCenter.
void SetFields(const std::vector< SCH_FIELD > &aFields)
Set multiple schematic fields.
int CountActiveSheets() const
Count the number of sheets found in "this" sheet including all of the subsheets.
int GetScreenCount() const
Return the number of times the associated screen for the sheet is being used.
void SetScreen(SCH_SCREEN *aScreen)
Set the SCH_SCREEN associated with this sheet to aScreen.
SCH_SHEET & operator=(const SCH_ITEM &aSheet)
bool HasPageNumberChanges(const SCH_SHEET &aOther) const
Check if the instance data of this sheet has any changes compared to aOther.
const SCH_SHEET_INSTANCE & GetRootInstance() const
Return the root sheet instance data.
bool doIsConnected(const VECTOR2I &aPosition) const override
Provide the object specific test to see if it is connected to aPosition.
void swapData(SCH_ITEM *aItem) override
Swap the internal data structures aItem with the schematic item.
bool m_excludedFromBoard
Definition sch_sheet.h:667
void setInstances(const std::vector< SCH_SHEET_INSTANCE > &aInstances)
Definition sch_sheet.h:585
const BOX2I GetBoundingBox() const override
Return the orthogonal bounding box of this object for display purposes.
const std::vector< SCH_FIELD > & GetFields() const
Definition sch_sheet.h:89
std::vector< VECTOR2I > GetConnectionPoints() const override
Add all the connection points for this item to aPoints.
KIGFX::COLOR4D GetBorderColor() const
Definition sch_sheet.h:148
std::vector< SCH_SHEET_PIN * > m_pins
Definition sch_sheet.h:662
bool IsMovableFromAnchorPoint() const override
Return true for items which are moved with the anchor point at mouse cursor and false for items moved...
Definition sch_sheet.h:83
bool CanConnect(const SCH_ITEM *aItem) const override
Definition sch_sheet.h:416
INSPECT_RESULT Visit(INSPECTOR inspector, void *testData, const std::vector< KICAD_T > &aScanTypes) override
May be re-implemented for each derived class in order to handle all the types given by its member dat...
friend class SCH_SHEET_LIST
Definition sch_sheet.h:655
void SetBorderWidth(int aWidth)
Definition sch_sheet.h:146
static bool ClassOf(const EDA_ITEM *aItem)
Definition sch_sheet.h:64
void MirrorVertically(int aCenter) override
Mirror item vertically about aCenter.
SCH_FIELD * AddField(const SCH_FIELD &aField)
Add a @aField to the list of fields.
void setPageNumber(const KIID_PATH &aInstance, const wxString &aPageNumber)
Set the page number for the sheet instance aInstance.
bool IsVirtualRootSheet() const
void AutoplaceFields(SCH_SCREEN *aScreen, AUTOPLACE_ALGO aAlgo) override
int GetMinHeight(bool aFromTop) const
Return the minimum height that the sheet can be resized based on the sheet pin positions.
bool GetDNP(const SCH_SHEET_PATH *aInstance=nullptr, const wxString &aVariantName=wxEmptyString) const override
Set or clear the 'Do Not Populate' flags.
bool GetExcludedFromSimProp() const
void SetExcludedFromBoardProp(bool aExclude)
Definition sch_sheet.h:469
int m_borderWidth
Definition sch_sheet.h:672
wxString GetItemDescription(UNITS_PROVIDER *aUnitsProvider, bool aFull) const override
Return a user-visible description string of this item.
bool UpdateDanglingState(std::vector< DANGLING_END_ITEM > &aItemListByType, std::vector< DANGLING_END_ITEM > &aItemListByPos, const SCH_SHEET_PATH *aPath=nullptr) override
Test the schematic item to aItemList to check if it's dangling state has changed.
bool GetExcludedFromBoard(const SCH_SHEET_PATH *aInstance=nullptr, const wxString &aVariantName=wxEmptyString) const override
Definition sch_sheet.h:462
void Resize(const VECTOR2I &aSize)
Resize this sheet to aSize and adjust all of the labels accordingly.
void Move(const VECTOR2I &aMoveVector) override
Move the item by aMoveVector to a new position.
int GetBorderWidth() const
Definition sch_sheet.h:145
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.
bool m_DNP
Definition sch_sheet.h:668
std::vector< SCH_SHEET_PIN * > & GetPins()
Definition sch_sheet.h:228
void RunOnChildren(const std::function< void(SCH_ITEM *)> &aFunction, RECURSE_MODE aMode) override
void SetExcludedFromBOMProp(bool aEnable)
wxString GetShownName(bool aAllowExtraText) const
Definition sch_sheet.h:133
void DeleteVariant(const SCH_SHEET_PATH &aInstance, const wxString &aVariantName)
Definition sch_sheet.h:541
friend SCH_IO_KICAD_SEXPR_PARSER
Definition sch_sheet.h:583
void Rotate(const VECTOR2I &aCenter, bool aRotateCCW) override
Rotate the item around aCenter 90 degrees in the clockwise direction.
void AddVariant(const SCH_SHEET_PATH &aInstance, const SCH_SHEET_VARIANT &aVariant)
bool ResolveTextVar(const SCH_SHEET_PATH *aPath, wxString *token, int aDepth=0) const
Resolve any references to system tokens supported by the sheet.
const std::vector< SCH_SHEET_INSTANCE > & GetInstances() const
Definition sch_sheet.h:506
void RenameVariant(const SCH_SHEET_PATH &aInstance, const wxString &aOldName, const wxString &aNewName)
Definition sch_sheet.h:546
SCH_SHEET_INSTANCE * getInstance(const SCH_SHEET_PATH &aPath)
Definition sch_sheet.h:633
bool IsVerticalOrientation() const
const SCH_SHEET_INSTANCE * getInstance(const SCH_SHEET_PATH &aPath) const
Definition sch_sheet.h:634
bool HitTest(const VECTOR2I &aPosition, int aAccuracy) const override
Test if aPosition is inside or on the boundary of this item.
KIGFX::COLOR4D GetBackgroundColor() const
Definition sch_sheet.h:151
Represent a polyline containing arcs as well as line segments: A chain of connected line and/or arc s...
RECURSE_MODE
Definition eda_item.h:51
INSPECT_RESULT
Definition eda_item.h:45
const INSPECTOR_FUNC & INSPECTOR
std::function passed to nested users by ref, avoids copying std::function.
Definition eda_item.h:92
@ LAYER_WIRE
Definition layer_ids.h:452
@ LAYER_BUS
Definition layer_ids.h:453
AUTOPLACE_ALGO
Definition sch_item.h:69
#define MIN_SHEET_HEIGHT
Definition sch_sheet.h:41
#define MIN_SHEET_WIDTH
Definition sch_sheet.h:40
A simple container for sheet instance information.
FIELD_T
The set of all field indices assuming an array like sequence that a SCH_COMPONENT or LIB_PART can hol...
@ SCH_LINE_T
Definition typeinfo.h:167
@ SCH_NO_CONNECT_T
Definition typeinfo.h:164
@ SCH_SYMBOL_T
Definition typeinfo.h:176
@ SCH_SHEET_T
Definition typeinfo.h:179
VECTOR2< int32_t > VECTOR2I
Definition vector2d.h:695