107 m_pins.emplace_back( new SCH_SHEET_PIN( *pin ) );
108 m_pins.back()->SetParent( this );
112 field.SetParent(
this );
177 wxCHECK_MSG(
Schematic(),
false,
"Can't call IsVirtualRootSheet without setting a schematic" );
185 wxCHECK_MSG(
Schematic(),
false,
"Can't call IsTopLevelSheet without setting a schematic" );
194 [&](
const wxString& aVar )
197 aVars->push_back( aVar );
202 if( field.IsMandatory() )
203 add( field.GetCanonicalName().Upper() );
205 add( field.GetName() );
210 if( sheetPath.
size() >= 2 )
222 add( wxT(
"SHEETPATH" ) );
223 add( wxT(
"EXCLUDE_FROM_BOM" ) );
224 add( wxT(
"EXCLUDE_FROM_BOARD" ) );
225 add( wxT(
"EXCLUDE_FROM_SIM" ) );
227 add( wxT(
"ERC_ERROR <message_text>" ) );
228 add( wxT(
"ERC_WARNING <message_text>" ) );
230 m_screen->GetTitleBlock().GetContextualTextVars( aVars );
236 wxCHECK( aPath,
false );
243 if( token->Contains(
':' ) )
251 wxString fieldName = field.IsMandatory() ? field.GetCanonicalName().Upper()
254 if( token->IsSameAs( fieldName ) )
256 *token = field.GetShownText( aPath,
false, aDepth + 1 );
271 if( token->IsSameAs( wxT(
"#" ) ) )
276 else if( token->IsSameAs( wxT(
"##" ) ) )
278 *token = wxString::Format( wxT(
"%d" ), (
int) schematic->
Hierarchy().size() );
281 else if( token->IsSameAs( wxT(
"SHEETPATH" ) ) )
286 else if( token->IsSameAs( wxT(
"EXCLUDE_FROM_BOM" ) ) )
288 *token = wxEmptyString;
290 if( aPath->
GetExcludedFromBOM( variant ) || this->ResolveExcludedFromBOM( aPath, variant ) )
291 *token =
_(
"Excluded from BOM" );
295 else if( token->IsSameAs( wxT(
"EXCLUDE_FROM_BOARD" ) ) )
297 *token = wxEmptyString;
299 if( aPath->
GetExcludedFromBoard( variant ) || this->ResolveExcludedFromBoard( aPath, variant ) )
300 *token =
_(
"Excluded from board" );
304 else if( token->IsSameAs( wxT(
"EXCLUDE_FROM_SIM" ) ) )
306 *token = wxEmptyString;
308 if( aPath->
GetExcludedFromSim( variant ) || this->ResolveExcludedFromSim( aPath, variant ) )
309 *token =
_(
"Excluded from simulation" );
313 else if( token->IsSameAs( wxT(
"DNP" ) ) )
315 *token = wxEmptyString;
317 if( aPath->
GetDNP( variant ) || this->ResolveDNP( aPath, variant ) )
325 if( aPath->
size() >= 2 )
330 if(
path.Last()->ResolveTextVar( &
path, token, aDepth + 1 ) )
346 wxString::Format( wxT(
"SCH_SHEET object cannot swap data with %s object." ),
359 sheetPin->SetParent(
this );
365 field.SetParent(
this );
387 m_fields.emplace_back(
this, aFieldType );
433 const wxString& aVariantName )
435 wxCHECK( !aFieldName.IsEmpty(), );
441 switch( field->
GetId() )
446 wxString tmp = aFieldText;
447 tmp.Replace( wxT(
"\\" ), wxT(
"/" ) );
458 wxString defaultText = field->
GetText( aPath );
460 if( aVariantName.IsEmpty() )
462 if( aFieldText != defaultText )
469 wxCHECK( instance, );
471 if( instance->
m_Variants.contains( aVariantName ) )
473 if( aFieldText != defaultText )
474 instance->
m_Variants[aVariantName].m_Fields[aFieldName] = aFieldText;
476 instance->
m_Variants[aVariantName].m_Fields.erase( aFieldName );
478 else if( aFieldText != defaultText )
483 newVariant.
m_Fields[aFieldName] = aFieldText;
484 instance->
m_Variants.insert( std::make_pair( aVariantName, newVariant ) );
495 const wxString& aVariantName )
const
497 wxCHECK( !aFieldName.IsEmpty(), wxEmptyString );
501 wxCHECK( field, wxEmptyString );
503 switch( field->
GetId() )
511 if( aVariantName.IsEmpty() )
519 if( instance->
m_Variants.contains( aVariantName )
520 && instance->
m_Variants.at( aVariantName ).m_Fields.contains( aFieldName ) )
521 return instance->
m_Variants.at( aVariantName ).m_Fields.at( aFieldName );
533 wxASSERT( aSheetPin !=
nullptr );
537 m_pins.push_back( aSheetPin );
544 wxASSERT( aSheetPin !=
nullptr );
549 if( *i == aSheetPin )
563 if(
pin->GetText().Cmp( aName ) == 0 )
575 if( sheetPin->GetPosition() == aPosition )
590 switch(
pin->GetSide() )
600 return topBottom > 0 && leftRight == 0;
620 if( HLabel ==
nullptr )
630 constexpr int gridSize =
schIUScale.MilsToIU( 50 );
632 int base = aVal / gridSize;
633 int excess = abs( aVal % gridSize );
637 return ( base + 1 ) * gridSize;
639 else if( excess > 0 )
641 return ( base ) * gridSize;
645 return ( base - 1 ) * gridSize;
653 int pinsRight =
m_pos.x;
655 for(
size_t i = 0; i <
m_pins.size(); i++ )
663 pinsLeft = std::min( pinsLeft, pinRect.
GetLeft() );
664 pinsRight = std::max( pinsRight, pinRect.
GetRight() );
673 if( pinsLeft >= pinsRight )
676 pinMinWidth = pinsRight -
m_pos.x;
687 int pinsBottom =
m_pos.y;
689 for(
size_t i = 0; i <
m_pins.size(); i++ )
697 pinsTop = std::min( pinsTop, pinRect.
GetTop() );
698 pinsBottom = std::max( pinsBottom, pinRect.
GetBottom() );
707 if( pinsTop >= pinsBottom )
710 pinMinHeight = pinsBottom -
m_pos.y;
720 std::vector<SCH_SHEET_PIN*> pins =
m_pins;
748 if(
pin->HitTest( aPosition ) )
773 int margin = borderMargin +
KiROUND( std::max( textSize.
x, textSize.
y ) * 0.5 );
793 margin = borderMargin +
KiROUND( std::max( textSize.
x, textSize.
y ) * 0.4 );
831 end.x = std::max(
m_size.x, textLength );
849 bbox.
Merge( field.GetBoundingBox() );
905 if( screen && screen->
GetFileName().Cmp( aFilename ) == 0 )
950 if(
m_screen->GetFileName().Cmp( aFilename ) == 0 )
993 wxString currentVariant;
998 path.push_back(
this );
1002 aList.emplace_back(
_(
"Hierarchical Path" ),
path.PathHumanReadable(
false,
true ) );
1012 msgs.Add(
_(
"Simulation" ) );
1015 msgs.Add(
_(
"BOM" ) );
1018 msgs.Add(
_(
"Board" ) );
1020 if(
GetDNP( currentSheet, currentVariant ) )
1021 msgs.Add(
_(
"DNP" ) );
1023 msg = wxJoin( msgs,
'|' );
1024 msg.Replace(
'|', wxS(
", " ) );
1027 aList.emplace_back(
_(
"Exclude from" ), msg );
1033 std::map<SCH_SHEET_PIN*, SCH_NO_CONNECT*> noConnects;
1040 noConnects[sheetPin] =
static_cast<SCH_NO_CONNECT*
>( noConnect );
1055 field.Move(
delta );
1061 m_pos += aMoveVector;
1064 pin->Move( aMoveVector );
1067 field.Move( aMoveVector );
1093 sheetPin->Rotate( aCenter, aRotateCCW );
1107 field.SetTextPos( pos );
1122 sheetPin->MirrorVertically( aCenter );
1128 field.SetTextPos( pos );
1142 sheetPin->MirrorHorizontally( aCenter );
1148 field.SetTextPos( pos );
1174 sheetPin->ConstrainOnEdge( sheetPin->GetPosition(),
false );
1191 pin->SetNumber(
id );
1203 while( !sheetPath.
empty() && sheetPath.
Last() !=
this )
1206 if( sheetPath.
empty() )
1222 wxT(
"Invalid item in schematic sheet pin list. Bad programmer!" ) );
1224 sheetPin->GetEndPoints( aItemList );
1230 std::vector<DANGLING_END_ITEM>& aItemListByPos,
1233 bool changed =
false;
1236 changed |= sheetPin->UpdateDanglingState( aItemListByType, aItemListByPos );
1252 wxCHECK( sheet,
false );
1266 for(
size_t i = 0; i <
m_pins.size(); i++ )
1278 std::vector<VECTOR2I> retval;
1281 retval.push_back( sheetPin->GetPosition() );
1288 const std::vector<KICAD_T>& aScanTypes )
1290 for(
KICAD_T scanType : aScanTypes )
1327 aFunction( &field );
1338 return wxString::Format(
_(
"Hierarchical Sheet '%s'" ),
1380 int aUnit,
int aBodyStyle,
const VECTOR2I& aOffset,
bool aDimmed )
1401 if( aBackground && backgroundColor.
a > 0.0 )
1403 aPlotter->
SetColor( backgroundColor );
1422 std::vector<wxString> properties;
1428 properties.emplace_back( wxString::Format( wxT(
"!%s = %s" ), field.GetName(),
1429 field.GetShownText(
false ) ) );
1437 sheetPin->Plot( aPlotter, aBackground, aPlotOpts, aUnit, aBodyStyle, aOffset, aDimmed );
1441 field.Plot( aPlotter, aBackground, aPlotOpts, aUnit, aBodyStyle, aOffset, aDimmed );
1444 wxString variantName;
1452 if(
GetDNP( &instance, variantName) )
1459 std::max( bbox.
GetY() - pins.
GetY(),
1463 margins.
x = std::max( margins.
x * 0.6, margins.
y * 0.3 );
1464 margins.
y = std::max( margins.
y * 0.6, margins.
x * 0.3 );
1473 strokeWidth,
nullptr );
1480 wxCHECK_MSG(
Type() == aItem.
Type(), *
this,
1481 wxT(
"Cannot assign object type " ) + aItem.
GetClass() + wxT(
" to type " ) +
1484 if( &aItem !=
this )
1497 m_pins.back()->SetParent(
this );
1529 for(
int ii =
m_instances.size() - 1; ii >= 0; --ii )
1535 " page %s, from project %s.",
1563 if( instance.m_Path == aPath )
1569 (
GetName().IsEmpty() ) ? wxString( wxT(
"root" ) ) :
GetName() );
1582 bool aTestFromEnd )
const
1588 if( instance.m_Path == aSheetPath )
1590 aInstance = instance;
1594 else if( instance.m_Path.EndsWith( aSheetPath ) )
1596 aInstance = instance;
1609 if( instance.m_Path == aSheetPath )
1621 if( instance.m_Path == aSheetPath )
1633 if( instance.m_Path.size() == 0 )
1645 if( instance.m_Path.size() == 0 )
1659 wxString pageNumber;
1663 if( instance.m_Path == aParentPath )
1665 pageNumber = instance.m_PageNumber;
1678 if( instance.m_Path == aPath )
1680 instance.m_PageNumber = aPageNumber;
1690 if( &aOther ==
this )
1697 std::vector<SCH_SHEET_INSTANCE> instances =
GetInstances();
1698 std::vector<SCH_SHEET_INSTANCE> otherInstances = aOther.
GetInstances();
1704 std::sort( instances.begin(), instances.end(),
1707 if( aLhs.m_Path > aRhs.m_Path )
1712 std::sort( otherInstances.begin(), otherInstances.end(),
1715 if( aLhs.m_Path > aRhs.m_Path )
1721 auto itThis = instances.begin();
1722 auto itOther = otherInstances.begin();
1724 while( itThis != instances.end() )
1726 if( ( itThis->m_Path == itOther->m_Path )
1727 && ( itThis->m_PageNumber != itOther->m_PageNumber ) )
1742 if( aPageNumberA == aPageNumberB )
1747 bool isIntegerPageA = aPageNumberA.ToLong( &pageA );
1748 bool isIntegerPageB = aPageNumberB.ToLong( &pageB );
1750 if( isIntegerPageA && isIntegerPageB )
1759 if( isIntegerPageA )
1761 else if( isIntegerPageB )
1768 wxCHECK(
result != 0, 0 );
1813 for(
size_t i = 0; i <
GetFields().size(); ++i )
1845 instance->
m_Variants.insert( std::make_pair( aVariant.
m_Name, aVariant ) );
1854 if( !instance || !instance->
m_Variants.contains( aVariantName ) )
1862 const wxString& aNewName )
1867 if( !instance || !instance->
m_Variants.contains( aOldName ) )
1872 variant.
m_Name = aNewName;
1874 instance->
m_Variants.insert( std::make_pair( aNewName, variant ) );
1879 const wxString& aNewVariant )
1884 if( !instance || !instance->
m_Variants.contains( aSourceVariant ) )
1889 variant.
m_Name = aNewVariant;
1890 instance->
m_Variants.insert( std::make_pair( aNewVariant, variant ) );
1896 if( !aInstance || aVariantName.IsEmpty() )
1904 wxCHECK_MSG( instance, ,
1905 wxString::Format( wxS(
"Cannot get DNP attribute for invalid sheet path '%s'." ),
1908 if( aVariantName.IsEmpty() )
1914 if( instance->
m_Variants.contains( aVariantName ) && ( aEnable != instance->
m_Variants[aVariantName].m_DNP ) )
1916 instance->
m_Variants[aVariantName].m_DNP = aEnable;
1923 variant.
m_DNP = aEnable;
1932 if( !aInstance || aVariantName.IsEmpty() )
1940 if( aVariantName.IsEmpty() )
1942 else if( instance.
m_Variants.contains( aVariantName ) )
1943 return instance.
m_Variants[aVariantName].m_DNP;
1964 if( !aInstance || aVariantName.IsEmpty() )
1972 wxCHECK_MSG( instance, ,
1973 wxString::Format( wxS(
"Cannot get m_excludedFromSim attribute for invalid sheet path '%s'." ),
1976 if( aVariantName.IsEmpty() )
1982 if( instance->
m_Variants.contains( aVariantName )
1983 && ( aEnable != instance->
m_Variants[aVariantName].m_ExcludedFromSim ) )
1985 instance->
m_Variants[aVariantName].m_ExcludedFromSim = aEnable;
2001 if( !aInstance || aVariantName.IsEmpty() )
2009 if( aVariantName.IsEmpty() )
2011 else if( instance.
m_Variants.contains( aVariantName ) )
2012 return instance.
m_Variants[aVariantName].m_ExcludedFromSim;
2033 if( !aInstance || aVariantName.IsEmpty() )
2041 wxCHECK_MSG( instance, ,
2042 wxString::Format( wxS(
"Cannot get m_excludedFromBOM attribute for invalid sheet path '%s'." ),
2045 if( aVariantName.IsEmpty() )
2051 if( instance->
m_Variants.contains( aVariantName )
2052 && ( aEnable != instance->
m_Variants[aVariantName].m_ExcludedFromBOM ) )
2054 instance->
m_Variants[aVariantName].m_ExcludedFromBOM = aEnable;
2070 if( !aInstance || aVariantName.IsEmpty() )
2078 if( aVariantName.IsEmpty() )
2080 else if( instance.
m_Variants.contains( aVariantName ) )
2081 return instance.
m_Variants[aVariantName].m_ExcludedFromBOM;
2102void SCH_SHEET::Show(
int nestLevel, std::ostream& os )
const
2107 NestedSpace( nestLevel, os ) <<
'<' << s.Lower().mb_str() <<
">" <<
" sheet_name=\""
2112 sheetPin->Show( nestLevel + 1, os );
2114 NestedSpace( nestLevel, os ) <<
"</" << s.Lower().mb_str() <<
">\n" << std::flush;
2133 if( !aValue.GetAs( &value ) )
2141 return std::make_unique<VALIDATION_ERROR_MSG>( msg );
2154 const wxString groupAttributes =
_HKI(
"Attributes" );
constexpr EDA_IU_SCALE schIUScale
BITMAPS
A list of all bitmap identifiers.
@ add_hierarchical_subsheet
constexpr BOX2I KiROUND(const BOX2D &aBoxD)
constexpr BOX2< Vec > & Inflate(coord_type dx, coord_type dy)
Inflates the rectangle horizontally by dx and vertically by dy.
constexpr const Vec GetEnd() const
constexpr coord_type GetY() const
constexpr size_type GetWidth() const
constexpr coord_type GetX() const
constexpr BOX2< Vec > & Merge(const BOX2< Vec > &aRect)
Modify the position and size of the rectangle in order to contain aRect.
constexpr const Vec GetCenter() const
constexpr size_type GetHeight() const
constexpr coord_type GetLeft() const
constexpr bool Contains(const Vec &aPoint) const
constexpr const Vec & GetOrigin() const
constexpr coord_type GetRight() const
constexpr void SetEnd(coord_type x, coord_type y)
constexpr coord_type GetTop() const
constexpr bool Intersects(const BOX2< Vec > &aRect) const
constexpr coord_type GetBottom() const
static const COLOR4D UNSPECIFIED
For legacy support; used as a value to indicate color hasn't been set yet.
Color settings are a bit different than most of the settings objects in that there can be more than o...
COLOR4D GetColor(int aLayer) const
The base class for create windows for drawing purpose.
A base class for most all the KiCad significant classes used in schematics and boards.
KICAD_T Type() const
Returns the type of object.
EDA_ITEM * GetParent() const
virtual void SetParent(EDA_ITEM *aParent)
EDA_ITEM(EDA_ITEM *parent, KICAD_T idType, bool isSCH_ITEM=false, bool isBOARD_ITEM=false)
virtual const wxString & GetText() const
Return the string associated with the text object.
void SetTextPos(const VECTOR2I &aPoint)
void SetVertJustify(GR_TEXT_V_ALIGN_T aType)
static wxString GotoPageHref(const wxString &aDestination)
Generate a href to a page in the current schematic.
virtual void SetTextAngle(const EDA_ANGLE &aAngle)
VECTOR2I GetTextSize() const
void SetHorizJustify(GR_TEXT_H_ALIGN_T aType)
A color representation with 4 components: red, green, blue, alpha.
std::shared_ptr< wxString > m_text
const COLOR4D & GetLayerColor(int aLayer) const
Return the color used to draw a layer.
wxString AsString() const
Base plotter engine class.
RENDER_SETTINGS * RenderSettings()
virtual void Rect(const VECTOR2I &p1, const VECTOR2I &p2, FILL_T fill, int width, int aCornerRadius=0)=0
virtual void HyperlinkBox(const BOX2I &aBox, const wxString &aDestinationURL)
Create a clickable hyperlink with a rectangular click area.
bool GetColorMode() const
virtual void ThickSegment(const VECTOR2I &start, const VECTOR2I &end, int width, void *aData)
virtual void HyperlinkMenu(const BOX2I &aBox, const std::vector< wxString > &aDestURLs)
Create a clickable hyperlink menu with a rectangular click area.
virtual void SetColor(const COLOR4D &color)=0
Container for project specific data.
PROPERTY_BASE & SetValidator(PROPERTY_VALIDATOR_FN &&aValidator)
Provide class metadata.Helper macro to map type hashes to names.
void InheritsAfter(TYPE_ID aDerived, TYPE_ID aBase)
Declare an inheritance relationship between types.
static PROPERTY_MANAGER & Instance()
PROPERTY_BASE & AddProperty(PROPERTY_BASE *aProperty, const wxString &aGroup=wxEmptyString)
Register a property.
Holds all the data relating to one schematic.
bool IsTopLevelSheet(const SCH_SHEET *aSheet) const
Check if a sheet is a top-level sheet (direct child of virtual root).
SCHEMATIC_SETTINGS & Settings() const
SCH_SHEET_LIST Hierarchy() const
Return the full schematic flattened hierarchical sheet list.
PROJECT & Project() const
Return a reference to the project this schematic is part of.
wxString GetCurrentVariant() const
Return the current variant being edited.
bool ResolveTextVar(const SCH_SHEET_PATH *aSheetPath, wxString *token, int aDepth) const
void GetContextualTextVars(wxArrayString *aVars) const
SCH_SHEET_PATH & CurrentSheet() const
bool ResolveCrossReference(wxString *token, int aDepth) const
Resolves text vars that refer to other items.
Schematic editor (Eeschema) main window.
SCH_SHEET_PATH & GetCurrentSheet() const
virtual const wxString & GetText() const override
Return the string associated with the text object.
wxString GetShownText(const SCH_SHEET_PATH *aPath, bool aAllowExtraText, int aDepth=0, const wxString &aVariantName=wxEmptyString) const
void SetText(const wxString &aText) override
Base class for any item which can be embedded within the SCHEMATIC container class,...
SCH_ITEM & operator=(const SCH_ITEM &aPin)
SCH_RENDER_SETTINGS * getRenderSettings(PLOTTER *aPlotter) const
SCHEMATIC * Schematic() const
Search the item hierarchy to find a SCHEMATIC.
AUTOPLACE_ALGO m_fieldsAutoplaced
SCH_ITEM(EDA_ITEM *aParent, KICAD_T aType, int aUnit=0, int aBodyStyle=0)
wxString ResolveText(const wxString &aText, const SCH_SHEET_PATH *aPath, int aDepth=0) const
wxString GetClass() const override
Return the class name.
int GetEffectivePenWidth(const SCH_RENDER_SETTINGS *aSettings) const
bool m_OverrideItemColors
const wxString & GetFileName() const
bool GetExcludedFromBOM() const
bool empty() const
Forwarded method from std::vector.
KIID_PATH Path() const
Get the sheet path as an KIID_PATH.
wxString GetPageNumber() const
wxString PathHumanReadable(bool aUseShortRootName=true, bool aStripTrailingSeparator=false, bool aEscapeSheetNames=false) const
Return the sheet path in a human readable form made from the sheet names.
bool GetExcludedFromSim() const
bool GetExcludedFromBoard() const
SCH_SHEET * Last() const
Return a pointer to the last SCH_SHEET of the list.
void push_back(SCH_SHEET *aSheet)
Forwarded method from std::vector.
size_t size() const
Forwarded method from std::vector.
void pop_back()
Forwarded method from std::vector.
Define a sheet pin (label) used in sheets to create hierarchical schematics.
Variant information for a schematic sheet.
void InitializeAttributes(const SCH_SHEET &aSheet)
Sheet symbol placed in a schematic, and is the entry point for a sub schematic.
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.
void SetBorderColor(KIGFX::COLOR4D aColor)
friend class SCH_SHEET_PIN
void SetFileName(const wxString &aFilename)
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.
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 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.
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 IsTopLevelSheet() const
Check if this sheet is a top-level sheet.
SCH_SHEET_PATH findSelf() const
Get the sheetpath of this sheet.
bool Matches(const EDA_SEARCH_DATA &aSearchData, void *aAuxData) const override
Compare the item against the search criteria in aSearchData.
bool GetExcludedFromBoardProp() const
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
std::vector< SCH_FIELD > & GetFields()
Return a reference to the vector holding the sheet's fields.
KIGFX::COLOR4D m_borderColor
SCH_FIELD * GetField(FIELD_T aFieldType)
Return a mandatory field in this sheet.
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
bool HasUndefinedPins() const
Check all sheet labels against schematic for undefined hierarchical labels.
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)
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.
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
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
void RenameVariant(const KIID_PATH &aPath, const wxString &aOldName, const wxString &aNewName)
KIGFX::COLOR4D m_backgroundColor
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)))
void SetName(const wxString &aName)
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.
void SetExcludedFromSimProp(bool aEnable)
VECTOR2I GetPosition() const override
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.
const BOX2I GetBoundingBox() const override
Return the orthogonal bounding box of this object for display purposes.
std::vector< VECTOR2I > GetConnectionPoints() const override
Add all the connection points for this item to aPoints.
KIGFX::COLOR4D GetBorderColor() const
std::vector< SCH_SHEET_PIN * > m_pins
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...
void SetBorderWidth(int aWidth)
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)
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
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
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.
void RunOnChildren(const std::function< void(SCH_ITEM *)> &aFunction, RECURSE_MODE aMode) override
void SetExcludedFromBOMProp(bool aEnable)
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
bool IsVerticalOrientation() const
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
bool IsPower() const override
Represent a polyline containing arcs as well as line segments: A chain of connected line and/or arc s...
std::map< wxString, wxString > m_Fields
#define DEFAULT_LINE_WIDTH_MILS
The default wire width in mils. (can be changed in preference menu)
static constexpr EDA_ANGLE ANGLE_90
static constexpr EDA_ANGLE ANGLE_VERTICAL
static constexpr EDA_ANGLE ANGLE_HORIZONTAL
static constexpr EDA_ANGLE ANGLE_270
const INSPECTOR_FUNC & INSPECTOR
std::function passed to nested users by ref, avoids copying std::function.
@ FILLED_SHAPE
Fill with object color.
a few functions useful in geometry calculations.
const wxChar *const traceSchSheetPaths
Flag to enable debug output of schematic symbol sheet path manipulation code.
@ LAYER_SELECTION_SHADOWS
constexpr void MIRROR(T &aPoint, const T &aMirrorRef)
Updates aPoint with the mirror of aPoint relative to the aMirrorRef.
Message panel definition file.
bool BoxHitTest(const VECTOR2I &aHitPoint, const BOX2I &aHittee, int aAccuracy)
Perform a point-to-box hit test.
KICOMMON_API wxString EllipsizeMenuText(const wxString &aString)
Ellipsize text (at the end) to be no more than 36 characters.
KICOMMON_API wxString EllipsizeStatusText(wxWindow *aWindow, const wxString &aString)
Ellipsize text (at the end) to be no more than 1/3 of the window width.
bool contains(const _Container &__container, _Value __value)
Returns true if the container contains the given value.
EDA_ANGLE abs(const EDA_ANGLE &aAngle)
@ PT_SIZE
Size expressed in distance units (mm/inch)
std::optional< std::unique_ptr< VALIDATION_ERROR > > VALIDATOR_RESULT
Null optional means validation succeeded.
const SCH_FIELD * FindField(const std::vector< SCH_FIELD > &aFields, FIELD_T aFieldId)
int NextFieldOrdinal(const std::vector< SCH_FIELD > &aFields)
int bumpToNextGrid(const int aVal, const int aDirection)
static struct SCH_SHEET_DESC _SCH_SHEET_DESC
Definition of the SCH_SHEET_PATH and SCH_SHEET_LIST classes for Eeschema.
SHEET_SIDE
Define the edge of the sheet that the sheet pin is positioned.
COLOR_SETTINGS * GetColorSettings(const wxString &aName)
std::vector< FAB_LAYER_COLOR > dummy
int StrNumCmp(const wxString &aString1, const wxString &aString2, bool aIgnoreCase)
Compare two strings with alphanumerical content.
#define TO_UTF8(wxstring)
Convert a wxString to a UTF8 encoded C string for all wxWidgets build modes.
bool m_PDFHierarchicalLinks
A simple container for sheet instance information.
std::map< wxString, SCH_SHEET_VARIANT > m_Variants
A list of sheet variants.
wxString GetDefaultFieldName(FIELD_T aFieldId, bool aTranslateForHI)
Return a default symbol field name for a mandatory field type.
FIELD_T
The set of all field indices assuming an array like sequence that a SCH_COMPONENT or LIB_PART can hol...
@ FOOTPRINT
Field Name Module PCB, i.e. "16DIP300".
@ REFERENCE
Field Reference of part, i.e. "IC21".
wxString result
Test unit parsing edge cases and error handling.
wxLogTrace helper definitions.
void RotatePoint(int *pX, int *pY, const EDA_ANGLE &aAngle)
Calculate the new point of coord coord pX, pY, for a rotation center 0, 0.
KICAD_T
The set of class identification values stored in EDA_ITEM::m_structType.
wxString GetFieldValidationErrorMessage(FIELD_T aFieldId, const wxString &aValue)
Return the error message if aValue is invalid for aFieldId.
Custom text control validator definitions.
VECTOR2< int32_t > VECTOR2I
VECTOR2< double > VECTOR2D