KiCad PCB EDA Suite
SCH_SHEET Class Reference

Sheet symbol placed in a schematic, and is the entry point for a sub schematic. More...

#include <sch_sheet.h>

Inheritance diagram for SCH_SHEET:
SCH_ITEM EDA_ITEM KIGFX::VIEW_ITEM INSPECTABLE

Public Member Functions

 SCH_SHEET (EDA_ITEM *aParent=nullptr, const VECTOR2I &aPos=VECTOR2I(0, 0), wxSize aSize=wxSize(schIUScale.MilsToIU(MIN_SHEET_WIDTH), schIUScale.MilsToIU(MIN_SHEET_HEIGHT)), FIELDS_AUTOPLACED aAutoplaceFields=FIELDS_AUTOPLACED_AUTO)
 
 SCH_SHEET (const SCH_SHEET &aSheet)
 Copy aSheet into a new object. More...
 
 ~SCH_SHEET ()
 
wxString GetClass () const override
 Return the class name. More...
 
bool IsMovableFromAnchorPoint () const override
 Return true for items which are moved with the anchor point at mouse cursor and false for items moved with no reference to anchor. More...
 
std::vector< SCH_FIELD > & GetFields ()
 
const std::vector< SCH_FIELD > & GetFields () const
 
void SetFields (const std::vector< SCH_FIELD > &aFields)
 Set multiple schematic fields. More...
 
wxString GetName () const
 
void SetName (const wxString &aName)
 
SCH_SCREENGetScreen () const
 
wxSize GetSize () const
 
void SetSize (const wxSize &aSize)
 
int GetBorderWidth () const
 
void SetBorderWidth (int aWidth)
 
KIGFX::COLOR4D GetBorderColor () const
 
void SetBorderColor (KIGFX::COLOR4D aColor)
 
KIGFX::COLOR4D GetBackgroundColor () const
 
void SetBackgroundColor (KIGFX::COLOR4D aColor)
 
bool IsRootSheet () const
 
void SetScreen (SCH_SCREEN *aScreen)
 Set the SCH_SCREEN associated with this sheet to aScreen. More...
 
int GetScreenCount () const
 Return the number of times the associated screen for the sheet is being used. More...
 
void GetContextualTextVars (wxArrayString *aVars) const
 Return the list of system text vars & fields for this sheet. More...
 
bool ResolveTextVar (wxString *token, int aDepth=0) const
 Resolve any references to system tokens supported by the sheet. More...
 
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. More...
 
bool IsVerticalOrientation () const
 
void AddPin (SCH_SHEET_PIN *aSheetPin)
 Add aSheetPin to the sheet. More...
 
std::vector< SCH_SHEET_PIN * > & GetPins ()
 
const std::vector< SCH_SHEET_PIN * > & GetPins () const
 
void RemovePin (const SCH_SHEET_PIN *aSheetPin)
 Remove aSheetPin from the sheet. More...
 
void CleanupSheet ()
 Delete sheet label which do not have a corresponding hierarchical label. More...
 
SCH_SHEET_PINGetPin (const VECTOR2I &aPosition)
 Return the sheet pin item found at aPosition in the sheet. More...
 
bool HasPin (const wxString &aName) const
 Checks if the sheet already has a sheet pin named aName. More...
 
bool HasPins () const
 
bool HasUndefinedPins () const
 Check all sheet labels against schematic for undefined hierarchical labels. More...
 
int GetMinWidth (bool aFromLeft) const
 Return the minimum width of the sheet based on the widths of the sheet pin text. More...
 
int GetMinHeight (bool aFromTop) const
 Return the minimum height that the sheet can be resized based on the sheet pin positions. More...
 
int GetPenWidth () const override
 
void Print (const RENDER_SETTINGS *aSettings, const VECTOR2I &aOffset) override
 Print a schematic item. More...
 
const BOX2I GetBodyBoundingBox () const
 Return a bounding box for the sheet body but not the fields. More...
 
const BOX2I GetBoundingBox () const override
 Return the orthogonal bounding box of this object for display purposes. More...
 
VECTOR2I GetRotationCenter () const
 Rotating around the boundingBox's center can cause walking when the sheetname or filename is longer than the edge it's on. More...
 
void SwapData (SCH_ITEM *aItem) override
 Swap the internal data structures aItem with the schematic item. More...
 
int SymbolCount () const
 Count our own symbols, without the power symbols. More...
 
bool SearchHierarchy (const wxString &aFilename, SCH_SCREEN **aScreen)
 Search the existing hierarchy for an instance of screen loaded from aFileName. More...
 
bool LocatePathOfScreen (SCH_SCREEN *aScreen, SCH_SHEET_PATH *aList)
 Search the existing hierarchy for an instance of screen loaded from aFileName. More...
 
int CountSheets () const
 Count the number of sheets found in "this" sheet including all of the subsheets. More...
 
wxString GetFileName () const
 Return the filename corresponding to this sheet. More...
 
void SetFileName (const wxString &aFilename)
 
void Move (const VECTOR2I &aMoveVector) override
 Move the item by aMoveVector to a new position. More...
 
void MirrorHorizontally (int aCenter) override
 Mirror item horizontally about aCenter. More...
 
void MirrorVertically (int aCenter) override
 Mirror item vertically about aCenter. More...
 
void Rotate (const VECTOR2I &aCenter) override
 Rotate the item around aCenter 90 degrees in the clockwise direction. More...
 
bool Matches (const EDA_SEARCH_DATA &aSearchData, void *aAuxData) const override
 Compare the item against the search criteria in aSearchData. More...
 
bool IsReplaceable () const override
 Override this method in any derived object that supports test find and replace. More...
 
void Resize (const wxSize &aSize)
 Resize this sheet to aSize and adjust all of the labels accordingly. More...
 
void AutoplaceFields (SCH_SCREEN *aScreen, bool aManual) override
 
void GetEndPoints (std::vector< DANGLING_END_ITEM > &aItemList) override
 Add the schematic item end points to aItemList if the item has end points. More...
 
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. More...
 
bool IsConnectable () const override
 
bool CanConnect (const SCH_ITEM *aItem) const override
 
std::vector< VECTOR2IGetConnectionPoints () const override
 Add all the connection points for this item to aPoints. More...
 
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 data. More...
 
void RunOnChildren (const std::function< void(SCH_ITEM *)> &aFunction) override
 
wxString GetItemDescription (UNITS_PROVIDER *aUnitsProvider) const override
 Return a user-visible description string of this item. More...
 
BITMAPS GetMenuImage () const override
 Return a pointer to an image to be used in menus. More...
 
SCH_SHEEToperator= (const SCH_ITEM &aSheet)
 
bool operator< (const SCH_ITEM &aItem) const override
 
void ViewGetLayers (int aLayers[], int &aCount) const override
 Return the layers the item is drawn on (which may be more than its "home" layer) More...
 
VECTOR2I GetPosition () const override
 
void SetPosition (const VECTOR2I &aPosition) override
 
bool HitTest (const VECTOR2I &aPosition, int aAccuracy) const override
 Test if aPosition is inside or on the boundary of this item. More...
 
bool HitTest (const BOX2I &aRect, bool aContained, int aAccuracy=0) const override
 Test if aRect intersects this item. More...
 
void Plot (PLOTTER *aPlotter, bool aBackground) const override
 Plot the schematic item to aPlotter. More...
 
EDA_ITEMClone () const override
 Create a duplicate of this item with linked list members set to NULL. More...
 
const std::vector< SCH_SHEET_INSTANCE > & GetInstances () const
 
bool HasRootInstance () const
 Check to see if this sheet has a root sheet instance. More...
 
const SCH_SHEET_INSTANCEGetRootInstance () const
 Return the root sheet instance data. More...
 
bool IsType (const std::vector< KICAD_T > &aScanTypes) const override
 Check whether the item is one of the listed types. More...
 
SCH_ITEMDuplicate (bool doClone=false) const
 Routine to create a new copy of given item. More...
 
VECTOR2IGetStoredPos ()
 
void SetStoredPos (const VECTOR2I &aPos)
 
SCHEMATICSchematic () const
 Searches the item hierarchy to find a SCHEMATIC. More...
 
virtual bool IsLocked () const
 
virtual void SetLocked (bool aLocked)
 Set the 'lock' status to aLocked for of this item. More...
 
virtual bool IsHypertext () const
 Allow items to support hypertext actions when hovered/clicked. More...
 
virtual void DoHypertextAction (EDA_DRAW_FRAME *aFrame) const
 
SCH_LAYER_ID GetLayer () const
 Return the layer this item is on. More...
 
void SetLayer (SCH_LAYER_ID aLayer)
 Set the layer this item is on. More...
 
const wxString & GetDefaultFont () const
 
bool RenderAsBitmap (double aWorldScale) const override
 
virtual void PrintBackground (const RENDER_SETTINGS *aSettings, const VECTOR2I &aOffset)
 Print the (optional) backaground elements if they exist. More...
 
virtual bool IsDangling () const
 
virtual bool IsPointClickableAnchor (const VECTOR2I &aPos) const
 
void ClearConnections ()
 Clears all of the connection items from the list. More...
 
bool IsConnected (const VECTOR2I &aPoint) const
 Test the item to see if it is connected to aPoint. More...
 
SCH_CONNECTIONConnection (const SCH_SHEET_PATH *aSheet=nullptr) const
 Retrieve the connection associated with this object in the given sheet. More...
 
SCH_ITEM_SETConnectedItems (const SCH_SHEET_PATH &aPath)
 Retrieve the set of items connected to this item on the given sheet. More...
 
void AddConnectionTo (const SCH_SHEET_PATH &aPath, SCH_ITEM *aItem)
 Add a connection link between this item and another. More...
 
SCH_CONNECTIONInitializeConnection (const SCH_SHEET_PATH &aPath, CONNECTION_GRAPH *aGraph)
 Create a new connection object associated with this object. More...
 
SCH_CONNECTIONGetOrInitConnection (const SCH_SHEET_PATH &aPath, CONNECTION_GRAPH *aGraph)
 
virtual bool ConnectionPropagatesTo (const EDA_ITEM *aItem) const
 Return true if this item should propagate connection info to aItem. More...
 
bool IsConnectivityDirty () const
 
void SetConnectivityDirty (bool aDirty=true)
 
virtual void SetLastResolvedState (const SCH_ITEM *aItem)
 
std::shared_ptr< NETCLASSGetEffectiveNetClass (const SCH_SHEET_PATH *aSheet=nullptr) const
 
FIELDS_AUTOPLACED GetFieldsAutoplaced () const
 Return whether the fields have been automatically placed. More...
 
void SetFieldsAutoplaced ()
 
void ClearFieldsAutoplaced ()
 
void AutoAutoplaceFields (SCH_SCREEN *aScreen)
 Autoplace fields only if correct to do so automatically. More...
 
virtual void ClearCaches ()
 
virtual bool HasLineStroke () const
 Check if this schematic item has line stoke properties. More...
 
virtual STROKE_PARAMS GetStroke () const
 
virtual void SetStroke (const STROKE_PARAMS &aStroke)
 
bool operator< (const EDA_ITEM &aItem) const
 Test if another item is less than this object. More...
 
KICAD_T Type () const
 Returns the type of object. More...
 
EDA_ITEMGetParent () const
 
virtual void SetParent (EDA_ITEM *aParent)
 
bool IsModified () const
 
bool IsNew () const
 
bool IsMoving () const
 
bool IsSelected () const
 
bool IsEntered () const
 
bool IsBrightened () const
 
bool IsRollover () const
 
void SetSelected ()
 
void SetBrightened ()
 
void ClearSelected ()
 
void ClearBrightened ()
 
void SetModified ()
 
int GetState (EDA_ITEM_FLAGS type) const
 
void SetState (EDA_ITEM_FLAGS type, bool state)
 
EDA_ITEM_FLAGS GetStatus () const
 
void SetStatus (EDA_ITEM_FLAGS aStatus)
 
void SetFlags (EDA_ITEM_FLAGS aMask)
 
void XorFlags (EDA_ITEM_FLAGS aMask)
 
void ClearFlags (EDA_ITEM_FLAGS aMask=EDA_ITEM_ALL_FLAGS)
 
EDA_ITEM_FLAGS GetFlags () const
 
bool HasFlag (EDA_ITEM_FLAGS aFlag) const
 
EDA_ITEM_FLAGS GetEditFlags () const
 
void ClearTempFlags ()
 
void ClearEditFlags ()
 
void SetIsShownAsBitmap (bool aBitmap)
 
bool IsShownAsBitmap () const
 
void SetForceVisible (bool aEnable)
 Set and clear force visible flag used to force the item to be drawn even if it's draw attribute is set to not visible. More...
 
bool IsForceVisible () const
 
virtual wxString GetFriendlyName () const
 
virtual const VECTOR2I GetFocusPosition () const
 Similar to GetPosition, but allows items to return their visual center rather than their anchor. More...
 
virtual VECTOR2I GetSortPosition () const
 Return the coordinates that should be used for sorting this element visually compared to other elements. More...
 
wxString GetTypeDesc () const
 Return a translated description of the type for this EDA_ITEM for display in user facing messages. More...
 
virtual bool Replace (const EDA_SEARCH_DATA &aSearchData, void *aAuxData=nullptr)
 Perform a text replace using the find and replace criteria in aSearchData on items that support text find and replace. More...
 
virtual const BOX2I ViewBBox () const override
 Return the bounding box of the item covering all its layers. More...
 
virtual void ViewDraw (int aLayer, VIEW *aView) const
 Draw the parts of the object belonging to layer aLayer. More...
 
virtual double ViewGetLOD (int aLayer, VIEW *aView) const
 Return the level of detail (LOD) of the item. More...
 
VIEW_ITEM_DATA * viewPrivData () const
 
void ClearViewPrivData ()
 
bool Set (PROPERTY_BASE *aProperty, wxAny &aValue)
 
template<typename T >
bool Set (PROPERTY_BASE *aProperty, T aValue)
 
template<typename T >
bool Set (const wxString &aProperty, T aValue)
 
wxAny Get (PROPERTY_BASE *aProperty) const
 
template<typename T >
Get (PROPERTY_BASE *aProperty) const
 
template<typename T >
std::optional< T > Get (const wxString &aProperty) const
 

Static Public Member Functions

static bool ClassOf (const EDA_ITEM *aItem)
 
static int ComparePageNum (const wxString &aPageNumberA, const wxString &aPageNumberB)
 Compares page numbers of schematic sheets. More...
 
static const wxString GetDefaultFieldName (int aFieldNdx, bool aTranslated=true)
 
template<class T >
static INSPECT_RESULT IterateForward (std::deque< T > &aList, INSPECTOR inspector, void *testData, const std::vector< KICAD_T > &scanTypes)
 This changes first parameter to avoid the DList and use the main queue instead. More...
 
template<class T >
static INSPECT_RESULT IterateForward (std::vector< T > &aList, INSPECTOR inspector, void *testData, const std::vector< KICAD_T > &scanTypes)
 Change first parameter to avoid the DList and use std::vector instead. More...
 
static bool Replace (const EDA_SEARCH_DATA &aSearchData, wxString &aText)
 Perform a text replace on aText using the find and replace criteria in aSearchData on items that support text find and replace. More...
 
static bool Sort (const EDA_ITEM *aLeft, const EDA_ITEM *aRight)
 Helper function to be used by the C++ STL sort algorithm for sorting a STL container of EDA_ITEM pointers. More...
 

Public Attributes

const KIID m_Uuid
 

Protected Member Functions

void setInstances (const std::vector< SCH_SHEET_INSTANCE > &aInstances)
 
bool addInstance (const SCH_SHEET_PATH &aInstance)
 Add a new instance aSheetPath to the instance list. More...
 
wxString getPageNumber (const SCH_SHEET_PATH &aInstance) const
 Return the sheet page number for aInstance. More...
 
void setPageNumber (const SCH_SHEET_PATH &aInstance, const wxString &aPageNumber)
 Set the page number for the sheet instance aInstance. More...
 
bool getInstance (SCH_SHEET_INSTANCE &aInstance, const KIID_PATH &aSheetPath, bool aTestFromEnd=false) const
 
void renumberPins ()
 Renumber the sheet pins in the sheet. More...
 
SCH_SHEET_PATH findSelf () const
 Get the sheetpath of this sheet. More...
 
bool Matches (const wxString &aText, const EDA_SEARCH_DATA &aSearchData) const
 Compare aText against search criteria in aSearchData. More...
 

Protected Attributes

friend SCH_SHEET_PATH
 
friend SCH_SEXPR_PARSER
 
SCH_LAYER_ID m_layer
 
EDA_ITEMS m_connections
 
FIELDS_AUTOPLACED m_fieldsAutoplaced
 
VECTOR2I m_storedPos
 
std::map< SCH_SHEET_PATH, SCH_ITEM_SET, SHEET_PATH_CMPm_connected_items
 Store pointers to other items that are connected to this one, per sheet. More...
 
std::unordered_map< SCH_SHEET_PATH, SCH_CONNECTION * > m_connection_map
 Store connectivity information, per sheet. More...
 
bool m_connectivity_dirty
 
EDA_ITEM_FLAGS m_status
 
EDA_ITEMm_parent
 Linked list: Link (parent struct) More...
 
bool m_forceVisible
 
EDA_ITEM_FLAGS m_flags
 

Private Member Functions

bool doIsConnected (const VECTOR2I &aPosition) const override
 Provide the object specific test to see if it is connected to aPosition. More...
 

Private Attributes

SCH_SCREENm_screen
 
std::vector< SCH_SHEET_PIN * > m_pins
 
std::vector< SCH_FIELDm_fields
 
VECTOR2I m_pos
 
wxSize m_size
 
int m_borderWidth
 
KIGFX::COLOR4D m_borderColor
 
KIGFX::COLOR4D m_backgroundColor
 
std::vector< SCH_SHEET_INSTANCEm_instances
 
KICAD_T m_structType
 Run time identification, keep private so it can never be changed after a ctor sets it. More...
 
VIEW_ITEM_DATA * m_viewPrivData
 

Friends

class SCH_SHEET_PIN
 
class SCH_SHEET_LIST
 

Detailed Description

Sheet symbol placed in a schematic, and is the entry point for a sub schematic.

Definition at line 56 of file sch_sheet.h.

Constructor & Destructor Documentation

◆ SCH_SHEET() [1/2]

SCH_SHEET::SCH_SHEET ( EDA_ITEM aParent = nullptr,
const VECTOR2I aPos = VECTOR2I( 0, 0 ),
wxSize  aSize = wxSize( schIUScale.MilsToIU( MIN_SHEET_WIDTH ),                                      schIUScale.MilsToIU( MIN_SHEET_HEIGHT ) ),
FIELDS_AUTOPLACED  aAutoplaceFields = FIELDS_AUTOPLACED_AUTO 
)

Definition at line 77 of file sch_sheet.cpp.

78 :
79 SCH_ITEM( aParent, SCH_SHEET_T )
80{
82 m_pos = aPos;
83 m_size = aSize;
84 m_screen = nullptr;
85
86 for( int i = 0; i < SHEET_MANDATORY_FIELDS; ++i )
87 {
88 m_fields.emplace_back( aPos, i, this, GetDefaultFieldName( i ) );
89 m_fields.back().SetVisible( true );
90
91 if( i == SHEETNAME )
92 m_fields.back().SetLayer( LAYER_SHEETNAME );
93 else if( i == SHEETFILENAME )
94 m_fields.back().SetLayer( LAYER_SHEETFILENAME );
95 else
96 m_fields.back().SetLayer( LAYER_SHEETFIELDS );
97 }
98
99 m_fieldsAutoplaced = aAutoplaceFields;
100 AutoAutoplaceFields( nullptr );
101
102 m_borderWidth = 0;
103 m_borderColor = COLOR4D::UNSPECIFIED;
104 m_backgroundColor = COLOR4D::UNSPECIFIED;
105}
SCH_ITEM(EDA_ITEM *aParent, KICAD_T aType)
Definition: sch_item.cpp:52
FIELDS_AUTOPLACED m_fieldsAutoplaced
Definition: sch_item.h:493
void AutoAutoplaceFields(SCH_SCREEN *aScreen)
Autoplace fields only if correct to do so automatically.
Definition: sch_item.h:436
SCH_LAYER_ID m_layer
Definition: sch_item.h:491
static const wxString GetDefaultFieldName(int aFieldNdx, bool aTranslated=true)
Definition: sch_sheet.cpp:55
VECTOR2I m_pos
Definition: sch_sheet.h:500
KIGFX::COLOR4D m_borderColor
Definition: sch_sheet.h:503
SCH_SCREEN * m_screen
Definition: sch_sheet.h:493
std::vector< SCH_FIELD > m_fields
Definition: sch_sheet.h:498
KIGFX::COLOR4D m_backgroundColor
Definition: sch_sheet.h:504
wxSize m_size
Definition: sch_sheet.h:501
int m_borderWidth
Definition: sch_sheet.h:502
@ LAYER_SHEETNAME
Definition: layer_ids.h:363
@ LAYER_SHEETFIELDS
Definition: layer_ids.h:365
@ LAYER_SHEET
Definition: layer_ids.h:362
@ LAYER_SHEETFILENAME
Definition: layer_ids.h:364
@ SHEET_MANDATORY_FIELDS
The first 2 are mandatory, and must be instantiated in SCH_SHEET.
Definition: sch_sheet.h:49
@ SHEETNAME
Definition: sch_sheet.h:45
@ SHEETFILENAME
Definition: sch_sheet.h:46
@ SCH_SHEET_T
Definition: typeinfo.h:158

References SCH_ITEM::AutoAutoplaceFields(), GetDefaultFieldName(), LAYER_SHEET, LAYER_SHEETFIELDS, LAYER_SHEETFILENAME, LAYER_SHEETNAME, m_backgroundColor, m_borderColor, m_borderWidth, m_fields, SCH_ITEM::m_fieldsAutoplaced, SCH_ITEM::m_layer, m_pos, m_screen, m_size, SHEET_MANDATORY_FIELDS, SHEETFILENAME, and SHEETNAME.

Referenced by Clone().

◆ SCH_SHEET() [2/2]

SCH_SHEET::SCH_SHEET ( const SCH_SHEET aSheet)

Copy aSheet into a new object.

All sheet pins are copied as is except and the SCH_SHEET_PIN's #m_Parent pointers are set to the new copied parent object.

Definition at line 108 of file sch_sheet.cpp.

108 :
109 SCH_ITEM( aSheet )
110{
111 m_pos = aSheet.m_pos;
112 m_size = aSheet.m_size;
113 m_layer = aSheet.m_layer;
114 const_cast<KIID&>( m_Uuid ) = aSheet.m_Uuid;
115 m_fields = aSheet.m_fields;
117 m_screen = aSheet.m_screen;
118
119 for( SCH_SHEET_PIN* pin : aSheet.m_pins )
120 {
121 m_pins.emplace_back( new SCH_SHEET_PIN( *pin ) );
122 m_pins.back()->SetParent( this );
123 }
124
125 for( SCH_FIELD& field : m_fields )
126 field.SetParent( this );
127
131 m_instances = aSheet.m_instances;
132
133 if( m_screen )
135}
const KIID m_Uuid
Definition: eda_item.h:492
Definition: kiid.h:48
Instances are attached to a symbol or sheet and provide a place for the symbol's value,...
Definition: sch_field.h:51
void IncRefCount()
Definition: sch_screen.cpp:118
Define a sheet pin (label) used in sheets to create hierarchical schematics.
Definition: sch_sheet_pin.h:66
friend class SCH_SHEET_PIN
Definition: sch_sheet.h:489
std::vector< SCH_SHEET_INSTANCE > m_instances
Definition: sch_sheet.h:506
std::vector< SCH_SHEET_PIN * > m_pins
Definition: sch_sheet.h:497

References SCH_SCREEN::IncRefCount(), m_backgroundColor, m_borderColor, m_borderWidth, m_fields, SCH_ITEM::m_fieldsAutoplaced, m_instances, SCH_ITEM::m_layer, m_pins, m_pos, m_screen, m_size, EDA_ITEM::m_Uuid, pin, and SCH_SHEET_PIN.

◆ ~SCH_SHEET()

SCH_SHEET::~SCH_SHEET ( )

Definition at line 138 of file sch_sheet.cpp.

139{
140 // also, look at the associated sheet & its reference count
141 // perhaps it should be deleted also.
142 if( m_screen )
143 {
145
146 if( m_screen->GetRefCount() == 0 )
147 delete m_screen;
148 }
149
150 // We own our pins; delete them
151 for( SCH_SHEET_PIN* pin : m_pins )
152 delete pin;
153}
void DecRefCount()
Definition: sch_screen.cpp:124
int GetRefCount() const
Definition: sch_screen.h:161

References SCH_SCREEN::DecRefCount(), SCH_SCREEN::GetRefCount(), m_pins, m_screen, and pin.

Member Function Documentation

◆ AddConnectionTo()

void SCH_ITEM::AddConnectionTo ( const SCH_SHEET_PATH aPath,
SCH_ITEM aItem 
)
inherited

Add a connection link between this item and another.

Definition at line 193 of file sch_item.cpp.

194{
195 SCH_ITEM_SET& set = m_connected_items[ aSheet ];
196
197 // The vector elements are small, so reserve 1k at a time to prevent re-allocations
198 if( set.size() == set.capacity() )
199 set.reserve( set.size() + 4096 );
200
201 set.emplace_back( aItem );
202}
std::map< SCH_SHEET_PATH, SCH_ITEM_SET, SHEET_PATH_CMP > m_connected_items
Store pointers to other items that are connected to this one, per sheet.
Definition: sch_item.h:498
std::vector< SCH_ITEM * > SCH_ITEM_SET
Definition: sch_item.h:136

References SCH_ITEM::m_connected_items.

Referenced by SCH_LABEL_BASE::UpdateDanglingState(), and CONNECTION_GRAPH::updateItemConnectivity().

◆ addInstance()

bool SCH_SHEET::addInstance ( const SCH_SHEET_PATH aInstance)
protected

Add a new instance aSheetPath to the instance list.

If aSheetPath does not already exist, it is added to the list. If already exists in the list, do nothing. Sheet instances allow for the sharing in complex hierarchies which allows for per instance data such as page number for sheets to stored.

Warning
The SCH_SHEET_PATH object must be a full hierarchical path which means the SCH_SHEET object at index 0 must be the root sheet. A partial sheet path will raise an assertion on debug builds and silently fail and return false on release builds.
Parameters
[in]aInstanceis the SCH_SHEET_PATH of the sheet instance to the instance list.
Returns
false if the instance already exists, true if the instance was added.

Definition at line 1217 of file sch_sheet.cpp.

1218{
1219 wxCHECK( aSheetPath.IsFullPath(), false );
1220 wxCHECK( !aSheetPath.Last() || ( aSheetPath.Last()->m_Uuid != m_Uuid ), false );
1221
1222 for( const SCH_SHEET_INSTANCE& instance : m_instances )
1223 {
1224 // if aSheetPath is found, nothing to do:
1225 if( instance.m_Path == aSheetPath.Path() )
1226 return false;
1227 }
1228
1229 wxLogTrace( traceSchSheetPaths, wxT( "Adding instance `%s` to sheet `%s`." ),
1230 aSheetPath.Path().AsString(),
1231 ( GetName().IsEmpty() ) ? wxT( "root" ) : GetName() );
1232
1233 SCH_SHEET_INSTANCE instance;
1234
1235 instance.m_Path = aSheetPath.Path();
1236
1237 // This entry does not exist: add it with an empty page number.
1238 m_instances.emplace_back( instance );
1239 return true;
1240}
wxString GetName() const
Definition: sch_sheet.h:103
const wxChar *const traceSchSheetPaths
Flag to enable debug output of schematic symbol sheet path manipulation code.
A simple container for sheet instance information.

References KIID_PATH::AsString(), GetName(), SCH_SHEET_PATH::IsFullPath(), SCH_SHEET_PATH::Last(), m_instances, SCH_SHEET_INSTANCE::m_Path, EDA_ITEM::m_Uuid, SCH_SHEET_PATH::Path(), and traceSchSheetPaths.

Referenced by SCH_SHEET_PATH::SetPageNumber().

◆ AddPin()

void SCH_SHEET::AddPin ( SCH_SHEET_PIN aSheetPin)

Add aSheetPin to the sheet.

Note
Once a sheet pin is added to the sheet, it is owned by the sheet. Do not delete the sheet pin object or you will likely get a segfault when the sheet is destroyed.
Parameters
aSheetPinThe sheet pin item to add to the sheet.

Definition at line 365 of file sch_sheet.cpp.

366{
367 wxASSERT( aSheetPin != nullptr );
368 wxASSERT( aSheetPin->Type() == SCH_SHEET_PIN_T );
369
370 aSheetPin->SetParent( this );
371 m_pins.push_back( aSheetPin );
372 renumberPins();
373}
KICAD_T Type() const
Returns the type of object.
Definition: eda_item.h:97
virtual void SetParent(EDA_ITEM *aParent)
Definition: eda_item.h:100
void renumberPins()
Renumber the sheet pins in the sheet.
Definition: sch_sheet.cpp:935
@ SCH_SHEET_PIN_T
Definition: typeinfo.h:157

References m_pins, renumberPins(), SCH_SHEET_PIN_T, EDA_ITEM::SetParent(), and EDA_ITEM::Type().

Referenced by SCH_EDIT_FRAME::AddItemToScreenAndUndoList(), and CADSTAR_SCH_ARCHIVE_LOADER::loadHierarchicalSheetPins().

◆ AutoAutoplaceFields()

void SCH_ITEM::AutoAutoplaceFields ( SCH_SCREEN aScreen)
inlineinherited

Autoplace fields only if correct to do so automatically.

Fields that have been moved by hand are not automatically placed.

Parameters
aScreenis the SCH_SCREEN associated with the current instance of the symbol.

Definition at line 436 of file sch_item.h.

437 {
438 if( GetFieldsAutoplaced() )
440 }
FIELDS_AUTOPLACED GetFieldsAutoplaced() const
Return whether the fields have been automatically placed.
Definition: sch_item.h:424
virtual void AutoplaceFields(SCH_SCREEN *aScreen, bool aManual)
Definition: sch_item.h:442
@ FIELDS_AUTOPLACED_MANUAL
Definition: sch_item.h:58

References SCH_ITEM::AutoplaceFields(), FIELDS_AUTOPLACED_MANUAL, and SCH_ITEM::GetFieldsAutoplaced().

Referenced by DIALOG_CHANGE_SYMBOLS::processSymbol(), SCH_EDIT_TOOL::Properties(), SCH_EDIT_TOOL::Rotate(), SCH_SHEET(), SCH_EDIT_FRAME::SelectUnit(), and DIALOG_LABEL_PROPERTIES::TransferDataFromWindow().

◆ AutoplaceFields()

void SCH_SHEET::AutoplaceFields ( SCH_SCREEN aScreen,
bool  aManual 
)
overridevirtual

Reimplemented from SCH_ITEM.

Definition at line 602 of file sch_sheet.cpp.

603{
604 VECTOR2I textSize = m_fields[SHEETNAME].GetTextSize();
605 int borderMargin = KiROUND( GetPenWidth() / 2.0 ) + 4;
606 int margin = borderMargin + KiROUND( std::max( textSize.x, textSize.y ) * 0.5 );
607
609 {
610 m_fields[SHEETNAME].SetTextPos( m_pos + VECTOR2I( -margin, m_size.y ) );
611 m_fields[ SHEETNAME ].SetHorizJustify( GR_TEXT_H_ALIGN_LEFT );
612 m_fields[ SHEETNAME ].SetVertJustify( GR_TEXT_V_ALIGN_BOTTOM );
613 m_fields[ SHEETNAME ].SetTextAngle( ANGLE_VERTICAL );
614 }
615 else
616 {
617 m_fields[SHEETNAME].SetTextPos( m_pos + VECTOR2I( 0, -margin ) );
618 m_fields[ SHEETNAME ].SetHorizJustify( GR_TEXT_H_ALIGN_LEFT );
619 m_fields[ SHEETNAME ].SetVertJustify( GR_TEXT_V_ALIGN_BOTTOM );
620 m_fields[ SHEETNAME ].SetTextAngle( ANGLE_HORIZONTAL );
621 }
622
623 textSize = m_fields[ SHEETFILENAME ].GetTextSize();
624 margin = borderMargin + KiROUND( std::max( textSize.x, textSize.y ) * 0.4 );
625
627 {
628 m_fields[SHEETFILENAME].SetTextPos( m_pos + VECTOR2I( m_size.x + margin, m_size.y ) );
629 m_fields[ SHEETFILENAME ].SetHorizJustify( GR_TEXT_H_ALIGN_LEFT );
630 m_fields[ SHEETFILENAME ].SetVertJustify( GR_TEXT_V_ALIGN_TOP );
631 m_fields[ SHEETFILENAME ].SetTextAngle( ANGLE_VERTICAL );
632 }
633 else
634 {
635 m_fields[SHEETFILENAME].SetTextPos( m_pos + VECTOR2I( 0, m_size.y + margin ) );
636 m_fields[ SHEETFILENAME ].SetHorizJustify( GR_TEXT_H_ALIGN_LEFT );
637 m_fields[ SHEETFILENAME ].SetVertJustify( GR_TEXT_V_ALIGN_TOP );
638 m_fields[ SHEETFILENAME ].SetTextAngle( ANGLE_HORIZONTAL );
639 }
640
642}
int GetPenWidth() const override
Definition: sch_sheet.cpp:590
bool IsVerticalOrientation() const
Definition: sch_sheet.cpp:417
static constexpr EDA_ANGLE & ANGLE_HORIZONTAL
Definition: eda_angle.h:408
static constexpr EDA_ANGLE & ANGLE_VERTICAL
Definition: eda_angle.h:409
@ FIELDS_AUTOPLACED_AUTO
Definition: sch_item.h:57
@ GR_TEXT_H_ALIGN_LEFT
@ GR_TEXT_V_ALIGN_BOTTOM
@ GR_TEXT_V_ALIGN_TOP
constexpr ret_type KiROUND(fp_type v)
Round a floating point number to an integer using "round halfway cases away from zero".
Definition: util.h:85
VECTOR2< int > VECTOR2I
Definition: vector2d.h:618

References ANGLE_HORIZONTAL, ANGLE_VERTICAL, FIELDS_AUTOPLACED_AUTO, GetPenWidth(), GR_TEXT_H_ALIGN_LEFT, GR_TEXT_V_ALIGN_BOTTOM, GR_TEXT_V_ALIGN_TOP, IsVerticalOrientation(), KiROUND(), m_fields, SCH_ITEM::m_fieldsAutoplaced, m_pos, m_size, SHEETFILENAME, SHEETNAME, VECTOR2< T >::x, and VECTOR2< T >::y.

Referenced by PANEL_EESCHEMA_COLOR_SETTINGS::createPreviewItems(), SCH_DRAWING_TOOLS::DrawSheet(), SCH_EAGLE_PLUGIN::loadSheet(), CADSTAR_SCH_ARCHIVE_LOADER::loadSheetAndChildSheets(), Resize(), and Rotate().

◆ CanConnect()

bool SCH_SHEET::CanConnect ( const SCH_ITEM aItem) const
inlineoverridevirtual

Reimplemented from SCH_ITEM.

Definition at line 343 of file sch_sheet.h.

344 {
345 return ( aItem->Type() == SCH_LINE_T && aItem->GetLayer() == LAYER_WIRE )
346 || ( aItem->Type() == SCH_LINE_T && aItem->GetLayer() == LAYER_BUS )
347 || ( aItem->Type() == SCH_NO_CONNECT_T )
348 || ( aItem->Type() == SCH_SYMBOL_T );
349 }
SCH_LAYER_ID GetLayer() const
Return the layer this item is on.
Definition: sch_item.h:246
@ LAYER_WIRE
Definition: layer_ids.h:344
@ LAYER_BUS
Definition: layer_ids.h:345
@ SCH_LINE_T
Definition: typeinfo.h:146
@ SCH_NO_CONNECT_T
Definition: typeinfo.h:143
@ SCH_SYMBOL_T
Definition: typeinfo.h:156

References SCH_ITEM::GetLayer(), LAYER_BUS, LAYER_WIRE, SCH_LINE_T, SCH_NO_CONNECT_T, SCH_SYMBOL_T, and EDA_ITEM::Type().

◆ ClassOf()

static bool SCH_SHEET::ClassOf ( const EDA_ITEM aItem)
inlinestatic

Definition at line 72 of file sch_sheet.h.

73 {
74 return aItem && SCH_SHEET_T == aItem->Type();
75 }

References SCH_SHEET_T, and EDA_ITEM::Type().

Referenced by CADSTAR_SCH_ARCHIVE_LOADER::loadNets().

◆ CleanupSheet()

void SCH_SHEET::CleanupSheet ( )

Delete sheet label which do not have a corresponding hierarchical label.

Note
Make sure you save a copy of the sheet in the undo list before calling CleanupSheet() otherwise any unreferenced sheet labels will be lost.

Definition at line 552 of file sch_sheet.cpp.

553{
554 std::vector<SCH_SHEET_PIN*> pins = m_pins;
555
556 m_pins.clear();
557
558 for( SCH_SHEET_PIN* pin : pins )
559 {
560 /* Search the schematic for a hierarchical label corresponding to this sheet label. */
561 const SCH_HIERLABEL* HLabel = nullptr;
562
563 for( SCH_ITEM* aItem : m_screen->Items().OfType( SCH_HIER_LABEL_T ) )
564 {
565 if( pin->GetText().CmpNoCase( static_cast<SCH_HIERLABEL*>( aItem )->GetText() ) == 0 )
566 {
567 HLabel = static_cast<SCH_HIERLABEL*>( aItem );
568 break;
569 }
570 }
571
572 if( HLabel )
573 m_pins.push_back( pin );
574 }
575}
virtual const wxString & GetText() const
Return the string associated with the text object.
Definition: eda_text.h:87
EE_TYPE OfType(KICAD_T aType) const
Definition: sch_rtree.h:238
Base class for any item which can be embedded within the SCHEMATIC container class,...
Definition: sch_item.h:147
EE_RTREE & Items()
Gets the full RTree, usually for iterating.
Definition: sch_screen.h:109
@ SCH_HIER_LABEL_T
Definition: typeinfo.h:153

References EDA_TEXT::GetText(), SCH_SCREEN::Items(), m_pins, m_screen, EE_RTREE::OfType(), pin, and SCH_HIER_LABEL_T.

Referenced by SCH_EDIT_TOOL::CleanupSheetPins().

◆ ClearBrightened()

void EDA_ITEM::ClearBrightened ( )
inlineinherited

Definition at line 119 of file eda_item.h.

void ClearFlags(EDA_ITEM_FLAGS aMask=EDA_ITEM_ALL_FLAGS)
Definition: eda_item.h:141
#define BRIGHTENED
item is drawn with a bright contour

References BRIGHTENED, and EDA_ITEM::ClearFlags().

Referenced by SCH_EDIT_FRAME::FocusOnItem(), PCB_BASE_FRAME::FocusOnItems(), EE_SELECTION_TOOL::unhighlight(), PL_SELECTION_TOOL::unhighlight(), PCB_SELECTION_TOOL::unhighlightInternal(), and SCH_EDITOR_CONTROL::UpdateNetHighlighting().

◆ ClearCaches()

void SCH_ITEM::ClearCaches ( )
virtualinherited

Reimplemented in SCH_FIELD.

Definition at line 251 of file sch_item.cpp.

252{
253 auto clearTextCaches =
254 []( SCH_ITEM* aItem )
255 {
256 EDA_TEXT* text = dynamic_cast<EDA_TEXT*>( aItem );
257
258 if( text )
259 {
260 text->ClearBoundingBoxCache();
261 text->ClearRenderCache();
262 }
263 };
264
265 clearTextCaches( this );
266
267 RunOnChildren( clearTextCaches );
268}
A mix-in class (via multiple inheritance) that handles texts such as labels, parts,...
Definition: eda_text.h:72
virtual void RunOnChildren(const std::function< void(SCH_ITEM *)> &aFunction)
Definition: sch_item.h:444

References SCH_ITEM::RunOnChildren(), and text.

◆ ClearConnections()

void SCH_ITEM::ClearConnections ( )
inlineinherited

Clears all of the connection items from the list.

The vector release method is used to prevent the item pointers from being deleted. Do not use the vector erase method on the connection list.

Definition at line 372 of file sch_item.h.

372{ m_connections.clear(); }
EDA_ITEMS m_connections
Definition: sch_item.h:492

References SCH_ITEM::m_connections.

◆ ClearEditFlags()

◆ ClearFieldsAutoplaced()

◆ ClearFlags()

void EDA_ITEM::ClearFlags ( EDA_ITEM_FLAGS  aMask = EDA_ITEM_ALL_FLAGS)
inlineinherited

Definition at line 141 of file eda_item.h.

141{ m_flags &= ~aMask; }
EDA_ITEM_FLAGS m_flags
Definition: eda_item.h:498

References EDA_ITEM::m_flags.

Referenced by FOOTPRINT_VIEWER_FRAME::AddFootprintToPCB(), PNS_KICAD_IFACE::AddItem(), SCH_EDIT_FRAME::AddItemToScreenAndUndoList(), SCH_MOVE_TOOL::AlignElements(), SCH_EDIT_TOOL::BreakWire(), FOOTPRINT::BuildCourtyardCaches(), EDA_ITEM::ClearBrightened(), EDA_ITEM::ClearEditFlags(), EDA_ITEM::ClearSelected(), EDA_ITEM::ClearTempFlags(), SCH_EDIT_FRAME::ConvertPart(), SYMBOL_EDITOR_EDIT_TOOL::Copy(), FOOTPRINT_EDITOR_CONTROL::CreateFootprint(), SYMBOL_EDITOR_PIN_TOOL::CreateImagePins(), MICROWAVE_TOOL::createMicrowaveInductor(), DIALOG_PAD_PROPERTIES::DIALOG_PAD_PROPERTIES(), PCB_TOOL_BASE::doInteractiveItemPlacement(), KIGFX::SCH_PAINTER::draw(), SCH_ITEM::Duplicate(), SYMBOL_EDITOR_EDIT_TOOL::Duplicate(), PCB_EDIT_FRAME::ExchangeFootprint(), PCB_SELECTION_TOOL::ExitGroup(), SYMBOL_EDIT_FRAME::GetSymbolFromRedoList(), SYMBOL_EDIT_FRAME::GetSymbolFromUndoList(), FOOTPRINT_EDITOR_CONTROL::ImportFootprint(), DRC_INTERACTIVE_COURTYARD_CLEARANCE::Init(), EE_COLLECTOR::Inspect(), FOOTPRINT_EDIT_FRAME::LoadFootprintFromBoard(), FOOTPRINT_EDIT_FRAME::LoadFootprintFromLibrary(), FOOTPRINT_EDITOR_CONTROL::NewFootprint(), DIALOG_SYMBOL_PROPERTIES::OnUnitChoice(), FOOTPRINT_EDIT_FRAME::OpenProjectFiles(), PCB_BASE_FRAME::PlaceFootprint(), SYMBOL_EDITOR_PIN_TOOL::PlacePin(), BOARD_COMMIT::Push(), PCB_SELECTION_TOOL::RebuildSelection(), PAD_TOOL::RecombinePad(), SCH_EDIT_TOOL::RepeatDrawItem(), SYMBOL_EDIT_FRAME::RollbackSymbolFromUndo(), DRC_TEST_PROVIDER_DISALLOW::Run(), FOOTPRINT_EDIT_FRAME::SaveFootprintToBoard(), SCH_SEXPR_PLUGIN_CACHE::savePin(), EE_SELECTION_TOOL::selectMultiple(), SCH_EDIT_FRAME::SelectUnit(), EDA_ITEM::SetIsShownAsBitmap(), BOARD_COMMIT::Stage(), DIALOG_SYMBOL_PROPERTIES::TransferDataFromWindow(), SCH_DRAWING_TOOLS::TwoClickPlace(), and EE_SELECTION_TOOL::unhighlight().

◆ ClearSelected()

◆ ClearTempFlags()

void EDA_ITEM::ClearTempFlags ( )
inlineinherited

Definition at line 153 of file eda_item.h.

154 {
156 }
#define IS_LINKED
Used in calculation to mark linked items (temporary use)
#define SELECTED_BY_DRAG
Item was algorithmically selected as a dragged item.
#define SKIP_STRUCT
flag indicating that the structure should be ignored
#define CANDIDATE
flag indicating that the structure is connected

References CANDIDATE, EDA_ITEM::ClearFlags(), IS_LINKED, SELECTED_BY_DRAG, and SKIP_STRUCT.

Referenced by PCB_EDIT_FRAME::OpenProjectFiles(), and SCH_EDIT_FRAME::PutDataInPreviousState().

◆ ClearViewPrivData()

void KIGFX::VIEW_ITEM::ClearViewPrivData ( )
inlineinherited

Definition at line 143 of file view_item.h.

144 {
145 m_viewPrivData = nullptr;
146 }
VIEW_ITEM_DATA * m_viewPrivData
Definition: view_item.h:151

References KIGFX::VIEW_ITEM::m_viewPrivData.

Referenced by KIGFX::VIEW::OnDestroy().

◆ Clone()

EDA_ITEM * SCH_SHEET::Clone ( ) const
overridevirtual

Create a duplicate of this item with linked list members set to NULL.

The default version will return NULL in release builds and likely crash the program. In debug builds, a warning message indicating the derived class has not implemented cloning. This really should be a pure virtual function. Due to the fact that there are so many objects derived from EDA_ITEM, the decision was made to return NULL until all the objects derived from EDA_ITEM implement cloning. Once that happens, this function should be made pure.

Returns
A clone of the item.

Reimplemented from EDA_ITEM.

Definition at line 156 of file sch_sheet.cpp.

157{
158 return new SCH_SHEET( *this );
159}
SCH_SHEET(EDA_ITEM *aParent=nullptr, const VECTOR2I &aPos=VECTOR2I(0, 0), wxSize aSize=wxSize(schIUScale.MilsToIU(MIN_SHEET_WIDTH), schIUScale.MilsToIU(MIN_SHEET_HEIGHT)), FIELDS_AUTOPLACED aAutoplaceFields=FIELDS_AUTOPLACED_AUTO)
Definition: sch_sheet.cpp:77

References SCH_SHEET().

Referenced by SCH_DRAWING_TOOLS::DrawSheet().

◆ ComparePageNum()

int SCH_SHEET::ComparePageNum ( const wxString &  aPageNumberA,
const wxString &  aPageNumberB 
)
static

Compares page numbers of schematic sheets.

Returns
0 if the page numbers are equal, -1 if aPageNumberA < aPageNumberB, 1 otherwise

Definition at line 1334 of file sch_sheet.cpp.

1335{
1336 if( aPageNumberA == aPageNumberB )
1337 return 0; // A == B
1338
1339 // First sort numerically if the page numbers are integers
1340 long pageA, pageB;
1341 bool isIntegerPageA = aPageNumberA.ToLong( &pageA );
1342 bool isIntegerPageB = aPageNumberB.ToLong( &pageB );
1343
1344 if( isIntegerPageA && isIntegerPageB )
1345 {
1346 if( pageA < pageB )
1347 return -1; //A < B
1348 else
1349 return 1; // A > B
1350 }
1351
1352 // Numerical page numbers always before strings
1353 if( isIntegerPageA )
1354 return -1; //A < B
1355 else if( isIntegerPageB )
1356 return 1; // A > B
1357
1358 // If not numeric, then sort as strings using natural sort
1359 int result = StrNumCmp( aPageNumberA, aPageNumberB );
1360
1361 // Divide by zero bad.
1362 wxCHECK( result != 0, 0 );
1363
1364 result = result / std::abs( result );
1365
1366 return result;
1367}
EDA_ANGLE abs(const EDA_ANGLE &aAngle)
Definition: eda_angle.h:401
int StrNumCmp(const wxString &aString1, const wxString &aString2, bool aIgnoreCase)
Compare two strings with alphanumerical content.

References std::abs(), and StrNumCmp().

Referenced by SCH_SHEET_PATH::ComparePageNum().

◆ ConnectedItems()

SCH_ITEM_SET & SCH_ITEM::ConnectedItems ( const SCH_SHEET_PATH aPath)
inherited

Retrieve the set of items connected to this item on the given sheet.

Definition at line 187 of file sch_item.cpp.

188{
189 return m_connected_items[ aSheet ];
190}

References SCH_ITEM::m_connected_items.

Referenced by addConnections(), SCH_EDIT_FRAME::AddItemToScreenAndUndoList(), SCH_LINE::FindWireSegmentNetNameRecursive(), and DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::visitItem().

◆ Connection()

SCH_CONNECTION * SCH_ITEM::Connection ( const SCH_SHEET_PATH aSheet = nullptr) const
inherited

Retrieve the connection associated with this object in the given sheet.

Note
The returned value can be nullptr.

Definition at line 146 of file sch_item.cpp.

147{
148 if( !IsConnectable() )
149 return nullptr;
150
151 wxCHECK_MSG( !IsConnectivityDirty(), nullptr,
152 wxT( "Shouldn't be asking for connection if connectivity is dirty!" ) );
153
154 if( !aSheet )
155 aSheet = &Schematic()->CurrentSheet();
156
157 auto it = m_connection_map.find( *aSheet );
158
159 if( it == m_connection_map.end() )
160 return nullptr;
161 else
162 return it->second;
163}
SCH_SHEET_PATH & CurrentSheet() const override
Definition: schematic.h:120
virtual bool IsConnectable() const
Definition: sch_item.h:349
SCHEMATIC * Schematic() const
Searches the item hierarchy to find a SCHEMATIC.
Definition: sch_item.cpp:112
bool IsConnectivityDirty() const
Definition: sch_item.h:413
std::unordered_map< SCH_SHEET_PATH, SCH_CONNECTION * > m_connection_map
Store connectivity information, per sheet.
Definition: sch_item.h:501

References SCHEMATIC::CurrentSheet(), SCH_ITEM::IsConnectable(), SCH_ITEM::IsConnectivityDirty(), SCH_ITEM::m_connection_map, and SCH_ITEM::Schematic().

Referenced by CONNECTION_SUBGRAPH::Absorb(), CONNECTION_SUBGRAPH::AddItem(), CONNECTION_GRAPH::buildConnectionGraph(), KIGFX::SCH_PAINTER::draw(), CONNECTION_GRAPH::ercCheckBusToBusConflicts(), CONNECTION_GRAPH::ercCheckBusToBusEntryConflicts(), CONNECTION_GRAPH::GetBusesNeedingMigration(), SCH_ITEM::GetEffectiveNetClass(), SCH_BUS_ENTRY_BASE::GetMsgPanelInfo(), SCH_LABEL_BASE::GetMsgPanelInfo(), SCH_LINE::GetMsgPanelInfo(), SCH_PIN::GetMsgPanelInfo(), CONNECTION_SUBGRAPH::GetNetName(), SCH_ITEM::GetOrInitConnection(), highlightNet(), SCH_ITEM::InitializeConnection(), SCH_LABEL_BASE::Plot(), SCH_LINE::Plot(), SCH_TEXT::Plot(), SCH_LABEL_BASE::Print(), NETLIST_EXPORTER_SPICE_MODEL::readPorts(), SCH_EDIT_FRAME::RecalculateConnections(), SCH_LABEL_BASE::ResolveTextVar(), DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::TransferDataToWindow(), BUS_UNFOLD_MENU::update(), SCH_EDITOR_CONTROL::UpdateNetHighlighting(), and DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::visitItem().

◆ ConnectionPropagatesTo()

virtual bool SCH_ITEM::ConnectionPropagatesTo ( const EDA_ITEM aItem) const
inlinevirtualinherited

Return true if this item should propagate connection info to aItem.

Reimplemented in SCH_BUS_WIRE_ENTRY, SCH_LINE, and SCH_PIN.

Definition at line 411 of file sch_item.h.

411{ return true; }

◆ CountSheets()

int SCH_SHEET::CountSheets ( ) const

Count the number of sheets found in "this" sheet including all of the subsheets.

Returns
the full count of sheets+subsheets contained by "this"

Definition at line 779 of file sch_sheet.cpp.

780{
781 int count = 1; //1 = this!!
782
783 if( m_screen )
784 {
785 for( SCH_ITEM* aItem : m_screen->Items().OfType( SCH_SHEET_T ) )
786 count += static_cast<SCH_SHEET*>( aItem )->CountSheets();
787 }
788
789 return count;
790}
Sheet symbol placed in a schematic, and is the entry point for a sub schematic.
Definition: sch_sheet.h:57
int CountSheets() const
Count the number of sheets found in "this" sheet including all of the subsheets.
Definition: sch_sheet.cpp:779

References CountSheets(), SCH_SCREEN::Items(), m_screen, EE_RTREE::OfType(), and SCH_SHEET_T.

Referenced by CountSheets(), SCH_PRINTOUT::GetPageInfo(), SCH_PRINTOUT::HasPage(), SCHEMATIC::SetSheetNumberAndCount(), and DIALOG_PRINT_USING_PRINTER::TransferDataFromWindow().

◆ DoHypertextAction()

virtual void SCH_ITEM::DoHypertextAction ( EDA_DRAW_FRAME aFrame) const
inlinevirtualinherited

Reimplemented in SCH_FIELD, SCH_TEXT, and SCH_TEXTBOX.

Definition at line 241 of file sch_item.h.

241{ }

◆ doIsConnected()

bool SCH_SHEET::doIsConnected ( const VECTOR2I aPosition) const
overrideprivatevirtual

Provide the object specific test to see if it is connected to aPosition.

Note
Override this function if the derived object can be connect to another object such as a wire, bus, or junction. Do not override this function for objects that cannot have connections. The default will always return false. This functions is call through the public function IsConnected() which performs tests common to all schematic items before calling the item specific connection testing.
Parameters
aPositionis a reference to a VECTOR2I object containing the test position.
Returns
True if connection to aPosition exists.

Reimplemented from SCH_ITEM.

Definition at line 405 of file sch_sheet.cpp.

406{
407 for( SCH_SHEET_PIN* sheetPin : m_pins )
408 {
409 if( sheetPin->GetPosition() == aPosition )
410 return true;
411 }
412
413 return false;
414}

References m_pins.

◆ Duplicate()

SCH_ITEM * SCH_ITEM::Duplicate ( bool  doClone = false) const
inherited

Routine to create a new copy of given item.

The new object is not put in draw list (not linked).

Parameters
doClone(default = false) indicates unique values (such as timestamp and sheet name) should be duplicated. Use only for undo/redo operations.

Definition at line 93 of file sch_item.cpp.

94{
95 SCH_ITEM* newItem = (SCH_ITEM*) Clone();
96
97 if( !doClone )
98 const_cast<KIID&>( newItem->m_Uuid ) = KIID();
99
100 newItem->ClearFlags( SELECTED | BRIGHTENED );
101
102 newItem->RunOnChildren(
103 []( SCH_ITEM* aChild )
104 {
105 aChild->ClearFlags( SELECTED | BRIGHTENED );
106 } );
107
108 return newItem;
109}
virtual EDA_ITEM * Clone() const
Create a duplicate of this item with linked list members set to NULL.
Definition: eda_item.cpp:82

References BRIGHTENED, EDA_ITEM::ClearFlags(), EDA_ITEM::Clone(), EDA_ITEM::m_Uuid, SCH_ITEM::RunOnChildren(), and SELECTED.

Referenced by SCH_LINE::BreakAt(), SCH_LINE_WIRE_BUS_TOOL::doDrawSegments(), CADSTAR_SCH_ARCHIVE_LOADER::loadItemOntoKiCadSheet(), SCH_EAGLE_PLUGIN::loadSchematic(), SCH_DRAWING_TOOLS::PlaceSymbol(), SCH_EDIT_TOOL::RepeatDrawItem(), SCH_EDIT_FRAME::SaveCopyInUndoList(), and SCH_LINE_WIRE_BUS_TOOL::startSegments().

◆ findSelf()

SCH_SHEET_PATH SCH_SHEET::findSelf ( ) const
protected

Get the sheetpath of this sheet.

NB: REQUIRES that the current sheet hierarchy contains the given sheet.

Definition at line 947 of file sch_sheet.cpp.

948{
949 wxCHECK_MSG( Schematic(), SCH_SHEET_PATH(), "Can't call findSelf without a schematic" );
950
951 SCH_SHEET_PATH sheetPath = Schematic()->CurrentSheet();
952
953 while( !sheetPath.empty() && sheetPath.Last() != this )
954 sheetPath.pop_back();
955
956 if( sheetPath.empty() )
957 {
958 // If we weren't in the hierarchy, then we must be a child of the current sheet.
959 sheetPath = Schematic()->CurrentSheet();
960 sheetPath.push_back( const_cast<SCH_SHEET*>( this ) );
961 }
962
963 return sheetPath;
964}
Handle access to a stack of flattened SCH_SHEET objects by way of a path for creating a flattened sch...
bool empty() const
Forwarded method from std::vector.
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.
void pop_back()
Forwarded method from std::vector.
friend SCH_SHEET_PATH
Definition: sch_sheet.h:418

References SCHEMATIC::CurrentSheet(), SCH_SHEET_PATH::empty(), SCH_SHEET_PATH::Last(), SCH_SHEET_PATH::pop_back(), SCH_SHEET_PATH::push_back(), SCH_SHEET_PATH, and SCH_ITEM::Schematic().

Referenced by GetContextualTextVars(), Plot(), and ResolveTextVar().

◆ Get() [1/3]

template<typename T >
std::optional< T > INSPECTABLE::Get ( const wxString &  aProperty) const
inlineinherited

Definition at line 104 of file inspectable.h.

105 {
107 TYPE_ID thisType = TYPE_HASH( *this );
108 PROPERTY_BASE* prop = propMgr.GetProperty( thisType, aProperty );
109 std::optional<T> ret;
110
111 if( prop )
112 {
113 const void* object = propMgr.TypeCast( this, thisType, prop->OwnerHash() );
114
115 if( object )
116 ret = prop->get<T>( object );
117 }
118
119 return ret;
120 }
virtual size_t OwnerHash() const =0
Return type-id of the Owner class.
T get(const void *aObject) const
Definition: property.h:316
Provide class metadata.Helper macro to map type hashes to names.
Definition: property_mgr.h:74
static PROPERTY_MANAGER & Instance()
Definition: property_mgr.h:76
PROPERTY_BASE * GetProperty(TYPE_ID aType, const wxString &aProperty) const
Return a property for a specific type.
const void * TypeCast(const void *aSource, TYPE_ID aBase, TYPE_ID aTarget) const
Cast a type to another type.
#define TYPE_HASH(x)
Definition: property.h:62
size_t TYPE_ID
Unique type identifier.
Definition: property_mgr.h:46

References PROPERTY_BASE::get(), PROPERTY_MANAGER::GetProperty(), PROPERTY_MANAGER::Instance(), PROPERTY_BASE::OwnerHash(), TYPE_HASH, and PROPERTY_MANAGER::TypeCast().

◆ Get() [2/3]

wxAny INSPECTABLE::Get ( PROPERTY_BASE aProperty) const
inlineinherited

Definition at line 84 of file inspectable.h.

85 {
87 const void* object = propMgr.TypeCast( this, TYPE_HASH( *this ), aProperty->OwnerHash() );
88 return object ? aProperty->getter( object ) : wxAny();
89 }
virtual wxAny getter(const void *aObject) const =0

References PROPERTY_BASE::getter(), PROPERTY_MANAGER::Instance(), PROPERTY_BASE::OwnerHash(), TYPE_HASH, and PROPERTY_MANAGER::TypeCast().

Referenced by BOOST_AUTO_TEST_CASE(), CLASS_D_DESC::CLASS_D_DESC(), EDA_SHAPE_DESC::EDA_SHAPE_DESC(), PROPERTIES_PANEL::getItemValue(), PCB_EXPR_VAR_REF::GetValue(), and PAD_DESC::PAD_DESC().

◆ Get() [3/3]

template<typename T >
T INSPECTABLE::Get ( PROPERTY_BASE aProperty) const
inlineinherited

Definition at line 92 of file inspectable.h.

93 {
95 const void* object = propMgr.TypeCast( this, TYPE_HASH( *this ), aProperty->OwnerHash() );
96
97 if( !object )
98 throw std::runtime_error( "Could not cast INSPECTABLE to the requested type" );
99
100 return aProperty->get<T>( object );
101 }

References PROPERTY_BASE::get(), PROPERTY_MANAGER::Instance(), PROPERTY_BASE::OwnerHash(), TYPE_HASH, and PROPERTY_MANAGER::TypeCast().

◆ GetBackgroundColor()

◆ GetBodyBoundingBox()

const BOX2I SCH_SHEET::GetBodyBoundingBox ( ) const

Return a bounding box for the sheet body but not the fields.

Definition at line 658 of file sch_sheet.cpp.

659{
660 VECTOR2I end;
661 BOX2I box( m_pos, m_size );
662 int lineWidth = GetPenWidth();
663 int textLength = 0;
664
665 // Calculate bounding box X size:
666 end.x = std::max( m_size.x, textLength );
667
668 // Calculate bounding box pos:
669 end.y = m_size.y;
670 end += m_pos;
671
672 box.SetEnd( end );
673 box.Inflate( lineWidth / 2 );
674
675 return box;
676}

References GetPenWidth(), BOX2< Vec >::Inflate(), m_pos, m_size, BOX2< Vec >::SetEnd(), VECTOR2< T >::x, and VECTOR2< T >::y.

Referenced by GetBoundingBox(), HitTest(), and SCH_EDIT_TOOL::Rotate().

◆ GetBorderColor()

◆ GetBorderWidth()

int SCH_SHEET::GetBorderWidth ( ) const
inline

◆ GetBoundingBox()

const BOX2I SCH_SHEET::GetBoundingBox ( ) const
overridevirtual

Return the orthogonal bounding box of this object for display purposes.

This box should be an enclosing perimeter for visible components of this object, and the units should be in the pcb or schematic coordinate system. It is OK to overestimate the size by a few counts.

Reimplemented from EDA_ITEM.

Definition at line 679 of file sch_sheet.cpp.

680{
681 BOX2I bbox = GetBodyBoundingBox();
682
683 for( const SCH_FIELD& field : m_fields )
684 bbox.Merge( field.GetBoundingBox() );
685
686 return bbox;
687}
BOX2< Vec > & Merge(const BOX2< Vec > &aRect)
Modify the position and size of the rectangle in order to contain aRect.
Definition: box2.h:588
const BOX2I GetBodyBoundingBox() const
Return a bounding box for the sheet body but not the fields.
Definition: sch_sheet.cpp:658

References GetBodyBoundingBox(), m_fields, and BOX2< Vec >::Merge().

Referenced by SCH_EDIT_TOOL::Mirror(), and Plot().

◆ GetClass()

wxString SCH_SHEET::GetClass ( ) const
inlineoverridevirtual

Return the class name.

Reimplemented from SCH_ITEM.

Definition at line 77 of file sch_sheet.h.

78 {
79 return wxT( "SCH_SHEET" );
80 }

Referenced by operator=().

◆ GetConnectionPoints()

std::vector< VECTOR2I > SCH_SHEET::GetConnectionPoints ( ) const
overridevirtual

Add all the connection points for this item to aPoints.

Not all schematic items have connection points so the default method does nothing.

Parameters
aPointsis the list of connection points to add to.

Reimplemented from SCH_ITEM.

Definition at line 991 of file sch_sheet.cpp.

992{
993 std::vector<VECTOR2I> retval;
994
995 for( SCH_SHEET_PIN* sheetPin : m_pins )
996 retval.push_back( sheetPin->GetPosition() );
997
998 return retval;
999}

References m_pins.

◆ GetContextualTextVars()

void SCH_SHEET::GetContextualTextVars ( wxArrayString *  aVars) const

Return the list of system text vars & fields for this sheet.

Definition at line 202 of file sch_sheet.cpp.

203{
204 auto add =
205 [&]( const wxString& aVar )
206 {
207 if( !alg::contains( *aVars, aVar ) )
208 aVars->push_back( aVar );
209 };
210
211 for( int i = 0; i < SHEET_MANDATORY_FIELDS; ++i )
212 add( m_fields[i].GetCanonicalName().Upper() );
213
214 for( size_t i = SHEET_MANDATORY_FIELDS; i < m_fields.size(); ++i )
215 add( m_fields[i].GetName() );
216
217 SCH_SHEET_PATH sheetPath = findSelf();
218
219 if( sheetPath.size() >= 2 )
220 {
221 sheetPath.pop_back();
222 sheetPath.Last()->GetContextualTextVars( aVars );
223 }
224
225 add( wxT( "#" ) );
226 add( wxT( "##" ) );
227 add( wxT( "SHEETPATH" ) );
228
230}
const TITLE_BLOCK & GetTitleBlock() const
Definition: sch_screen.h:155
size_t size() const
Forwarded method from std::vector.
void GetContextualTextVars(wxArrayString *aVars) const
Return the list of system text vars & fields for this sheet.
Definition: sch_sheet.cpp:202
SCH_SHEET_PATH findSelf() const
Get the sheetpath of this sheet.
Definition: sch_sheet.cpp:947
static void GetContextualTextVars(wxArrayString *aVars)
Definition: title_block.cpp:74
bool contains(const _Container &__container, _Value __value)
Returns true if the container contains the given value.
Definition: kicad_algo.h:99

References alg::contains(), findSelf(), TITLE_BLOCK::GetContextualTextVars(), GetContextualTextVars(), GetName(), SCH_SCREEN::GetTitleBlock(), SCH_SHEET_PATH::Last(), m_fields, m_screen, SCH_SHEET_PATH::pop_back(), SHEET_MANDATORY_FIELDS, and SCH_SHEET_PATH::size().

Referenced by GetContextualTextVars(), DIALOG_SCH_FIELD_PROPERTIES::onScintillaCharAdded(), and DIALOG_TEXT_PROPERTIES::onScintillaCharAdded().

◆ GetDefaultFieldName()

const wxString SCH_SHEET::GetDefaultFieldName ( int  aFieldNdx,
bool  aTranslated = true 
)
static

Definition at line 55 of file sch_sheet.cpp.

56{
57 if( !aTranslated )
58 {
59 switch( aFieldNdx )
60 {
63 default: return wxString::Format( USER_FIELD_CANONICAL, aFieldNdx );
64 }
65 }
66
67 // Fixed values for the mandatory fields
68 switch( aFieldNdx )
69 {
70 case SHEETNAME: return _( SHEET_NAME_CANONICAL );
71 case SHEETFILENAME: return _( SHEET_FILE_CANONICAL );
72 default: return wxString::Format( _( USER_FIELD_CANONICAL ), aFieldNdx );
73 }
74}
#define _(s)
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, const CPTREE &aTree)
Output a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
Definition: ptree.cpp:200
#define USER_FIELD_CANONICAL
Definition: sch_sheet.cpp:52
#define SHEET_NAME_CANONICAL
Definition: sch_sheet.cpp:50
#define SHEET_FILE_CANONICAL
Definition: sch_sheet.cpp:51

References _, Format(), SHEET_FILE_CANONICAL, SHEET_NAME_CANONICAL, SHEETFILENAME, SHEETNAME, and USER_FIELD_CANONICAL.

Referenced by SCH_FIELD::GetName(), FIELDS_GRID_TABLE< T >::GetValue(), DIALOG_SHEET_PROPERTIES::OnAddField(), SCH_SEXPR_PARSER::parseSchField(), and SCH_SHEET().

◆ GetDefaultFont()

const wxString & SCH_ITEM::GetDefaultFont ( ) const
inherited

Definition at line 286 of file sch_item.cpp.

287{
288 EESCHEMA_SETTINGS* cfg = Pgm().GetSettingsManager().GetAppSettings<EESCHEMA_SETTINGS>();
289
290 return cfg->m_Appearance.default_font;
291}
KIWAY Kiway & Pgm(), KFCTL_STANDALONE
The global Program "get" accessor.
Definition: single_top.cpp:111

References EESCHEMA_SETTINGS::APPEARANCE::default_font, EESCHEMA_SETTINGS::m_Appearance, and Pgm().

Referenced by SCH_FIELD::getDrawFont(), SCH_TEXT::getDrawFont(), SCH_TEXTBOX::getDrawFont(), SCH_FIELD::GetRenderCache(), and SCH_TEXTBOX::GetShownText().

◆ GetEditFlags()

EDA_ITEM_FLAGS EDA_ITEM::GetEditFlags ( ) const
inlineinherited

Definition at line 145 of file eda_item.h.

146 {
147 constexpr int mask =
149
150 return m_flags & mask;
151 }
#define IS_PASTED
Modifier on IS_NEW which indicates it came from clipboard.
#define IS_CHANGED
Item was edited, and modified.
#define IS_NEW
New item, just created.
#define IS_BROKEN
Is a segment just broken by BreakSegment.
#define STRUCT_DELETED
flag indication structures to be erased
#define IS_MOVING
Item being moved.

References IS_BROKEN, IS_CHANGED, IS_MOVING, IS_NEW, IS_PASTED, EDA_ITEM::m_flags, and STRUCT_DELETED.

Referenced by SCH_EDIT_TOOL::ChangeTextType(), EDA_ITEM::ClearEditFlags(), SCH_EDIT_FRAME::DeleteJunction(), SCH_EDIT_TOOL::editFieldText(), SYMBOL_EDITOR_PIN_TOOL::EditPinProperties(), SCH_EDITOR_CONTROL::EditWithSymbolEditor(), SCH_SYMBOL::GetMsgPanelInfo(), SELECTION_CONDITIONS::Idle(), SELECTION_CONDITIONS::IdleSelection(), SYMBOL_EDITOR_MOVE_TOOL::Main(), PCB_POINT_EDITOR::OnSelectionChange(), SYMBOL_EDITOR_EDIT_TOOL::Properties(), SCH_EDIT_FRAME::SelectUnit(), DIALOG_IMAGE_PROPERTIES::TransferDataFromWindow(), DIALOG_LABEL_PROPERTIES::TransferDataFromWindow(), DIALOG_SYMBOL_PROPERTIES::TransferDataFromWindow(), DIALOG_TEXT_PROPERTIES::TransferDataFromWindow(), DIALOG_DIMENSION_PROPERTIES::TransferDataFromWindow(), DIALOG_FOOTPRINT_PROPERTIES::TransferDataFromWindow(), DIALOG_TARGET_PROPERTIES::TransferDataFromWindow(), and DIALOG_TEXTBOX_PROPERTIES::TransferDataFromWindow().

◆ GetEffectiveNetClass()

std::shared_ptr< NETCLASS > SCH_ITEM::GetEffectiveNetClass ( const SCH_SHEET_PATH aSheet = nullptr) const
inherited

Definition at line 166 of file sch_item.cpp.

167{
168 static std::shared_ptr<NETCLASS> nullNetclass = std::make_shared<NETCLASS>( wxEmptyString );
169
170 SCHEMATIC* schematic = Schematic();
171
172 if( schematic )
173 {
174 std::shared_ptr<NET_SETTINGS>& netSettings = schematic->Prj().GetProjectFile().m_NetSettings;
175 SCH_CONNECTION* connection = Connection( aSheet );
176
177 if( connection )
178 return netSettings->GetEffectiveNetClass( connection->Name() );
179 else
180 return netSettings->m_DefaultNetClass;
181 }
182
183 return nullNetclass;
184}
std::shared_ptr< NET_SETTINGS > m_NetSettings
Net settings for this project (owned here)
Definition: project_file.h:168
virtual PROJECT_FILE & GetProjectFile() const
Definition: project.h:149
Holds all the data relating to one schematic.
Definition: schematic.h:61
PROJECT & Prj() const override
Return a reference to the project this schematic is part of.
Definition: schematic.h:76
Each graphical item can have a SCH_CONNECTION describing its logical connection (to a bus or net).
wxString Name(bool aIgnoreSheet=false) const
SCH_CONNECTION * Connection(const SCH_SHEET_PATH *aSheet=nullptr) const
Retrieve the connection associated with this object in the given sheet.
Definition: sch_item.cpp:146

References SCH_ITEM::Connection(), PROJECT::GetProjectFile(), PROJECT_FILE::m_NetSettings, SCH_CONNECTION::Name(), SCHEMATIC::Prj(), and SCH_ITEM::Schematic().

Referenced by SCH_BUS_ENTRY_BASE::GetBusEntryColor(), SCH_LINE::GetEffectiveLineStyle(), SCH_JUNCTION::getEffectiveShape(), SCH_FIELD::GetFieldColor(), SCH_JUNCTION::GetJunctionColor(), SCH_LABEL_BASE::GetLabelColor(), SCH_LINE::GetLineColor(), SCH_BUS_ENTRY_BASE::GetLineStyle(), SCH_BUS_ENTRY_BASE::GetMsgPanelInfo(), SCH_LABEL_BASE::GetMsgPanelInfo(), SCH_LINE::GetMsgPanelInfo(), SCH_BUS_WIRE_ENTRY::GetPenWidth(), SCH_BUS_BUS_ENTRY::GetPenWidth(), SCH_LINE::GetPenWidth(), SCH_LABEL_BASE::Plot(), SCH_LINE::Plot(), and SCH_LABEL_BASE::ResolveTextVar().

◆ GetEndPoints()

void SCH_SHEET::GetEndPoints ( std::vector< DANGLING_END_ITEM > &  aItemList)
overridevirtual

Add the schematic item end points to aItemList if the item has end points.

The default version doesn't do anything since many of the schematic object cannot be tested for dangling ends. If you add a new schematic item that can have a dangling end ( no connect ), override this method to provide the correct end points.

Parameters
aItemListis the list of DANGLING_END_ITEMS to add to.

Reimplemented from SCH_ITEM.

Definition at line 967 of file sch_sheet.cpp.

968{
969 for( SCH_SHEET_PIN* sheetPin : m_pins )
970 {
971 wxCHECK2_MSG( sheetPin->Type() == SCH_SHEET_PIN_T, continue,
972 wxT( "Invalid item in schematic sheet pin list. Bad programmer!" ) );
973
974 sheetPin->GetEndPoints( aItemList );
975 }
976}

References m_pins, and SCH_SHEET_PIN_T.

◆ GetFields() [1/2]

◆ GetFields() [2/2]

const std::vector< SCH_FIELD > & SCH_SHEET::GetFields ( ) const
inline

Definition at line 94 of file sch_sheet.h.

94{ return m_fields; }

References m_fields.

◆ GetFieldsAutoplaced()

FIELDS_AUTOPLACED SCH_ITEM::GetFieldsAutoplaced ( ) const
inlineinherited

Return whether the fields have been automatically placed.

Definition at line 424 of file sch_item.h.

424{ return m_fieldsAutoplaced; }

References SCH_ITEM::m_fieldsAutoplaced.

Referenced by SCH_ITEM::AutoAutoplaceFields(), SCH_SEXPR_PLUGIN::saveSheet(), SCH_SEXPR_PLUGIN::saveSymbol(), and SCH_SEXPR_PLUGIN::saveText().

◆ GetFileName()

◆ GetFlags()

◆ GetFocusPosition()

virtual const VECTOR2I EDA_ITEM::GetFocusPosition ( ) const
inlinevirtualinherited

Similar to GetPosition, but allows items to return their visual center rather than their anchor.

Reimplemented in BOARD, PCB_SHAPE, and PCB_TRACK.

Definition at line 256 of file eda_item.h.

256{ return GetPosition(); }
virtual VECTOR2I GetPosition() const
Definition: eda_item.h:249

References EDA_ITEM::GetPosition().

Referenced by SCH_EDIT_FRAME::FocusOnItem().

◆ GetFriendlyName()

wxString EDA_ITEM::GetFriendlyName ( ) const
virtualinherited

Reimplemented in PCB_SHAPE, PCB_TRACK, and ZONE.

Definition at line 310 of file eda_item.cpp.

311{
312 return GetTypeDesc();
313}
wxString GetTypeDesc() const
Return a translated description of the type for this EDA_ITEM for display in user facing messages.
Definition: eda_item.cpp:301

References EDA_ITEM::GetTypeDesc().

Referenced by PROPERTIES_PANEL::rebuildProperties().

◆ getInstance()

bool SCH_SHEET::getInstance ( SCH_SHEET_INSTANCE aInstance,
const KIID_PATH aSheetPath,
bool  aTestFromEnd = false 
) const
protected

Definition at line 1243 of file sch_sheet.cpp.

1245{
1246 for( const SCH_SHEET_INSTANCE& instance : m_instances )
1247 {
1248 if( !aTestFromEnd )
1249 {
1250 if( instance.m_Path == aSheetPath )
1251 {
1252 aInstance = instance;
1253 return true;
1254 }
1255 }
1256 else if( instance.m_Path.EndsWith( aSheetPath ) )
1257 {
1258 aInstance = instance;
1259 return true;
1260 }
1261 }
1262
1263 return false;
1264}

References m_instances.

Referenced by SCH_SHEET_LIST::AddNewSheetInstances().

◆ GetInstances()

const std::vector< SCH_SHEET_INSTANCE > & SCH_SHEET::GetInstances ( ) const
inline
Returns
the list of SCH_SHEET_INSTANCE objects for this sheet.

Definition at line 381 of file sch_sheet.h.

381{ return m_instances; }

References m_instances.

Referenced by SCH_SEXPR_PLUGIN::saveSheet().

◆ GetItemDescription()

wxString SCH_SHEET::GetItemDescription ( UNITS_PROVIDER aUnitsProvider) const
overridevirtual

Return a user-visible description string of this item.

This description is used in disambiguation menus, the message panel, ERC/DRC reports, etc.

The default version of this function raises an assertion in the debug mode and returns a string to indicate that it was not overridden to provide the object specific text.

Returns
The menu text string.

Reimplemented from EDA_ITEM.

Definition at line 1049 of file sch_sheet.cpp.

1050{
1051 return wxString::Format( _( "Hierarchical Sheet %s" ),
1052 m_fields[ SHEETNAME ].GetText() );
1053}
wxString GetText(EDA_UNITS aUnits, EDA_DATA_TYPE aType=EDA_DATA_TYPE::DISTANCE)
Get the units string for a given units type.
Definition: eda_units.cpp:98

References _, Format(), EDA_UNIT_UTILS::GetText(), m_fields, and SHEETNAME.

◆ GetLayer()

◆ GetMenuImage()

BITMAPS SCH_SHEET::GetMenuImage ( ) const
overridevirtual

Return a pointer to an image to be used in menus.

The default version returns the right arrow image. Override this function to provide object specific menu images.

Returns
The menu image associated with the item.

Reimplemented from EDA_ITEM.

Definition at line 1056 of file sch_sheet.cpp.

1057{
1059}
@ add_hierarchical_subsheet

References add_hierarchical_subsheet.

◆ GetMinHeight()

int SCH_SHEET::GetMinHeight ( bool  aFromTop) const

Return the minimum height that the sheet can be resized based on the sheet pin positions.

The minimum width of a sheet is determined by the Y axis location of the bottom most sheet pin. If at some point in the future sheet objects can be rotated or pins can be placed in the vertical orientation, this function will need to be changed.

Returns
The minimum height the sheet can be resized.

Definition at line 518 of file sch_sheet.cpp.

519{
520 int pinsTop = m_pos.y + m_size.y;
521 int pinsBottom = m_pos.y;
522
523 for( size_t i = 0; i < m_pins.size(); i++ )
524 {
525 SHEET_SIDE edge = m_pins[i]->GetSide();
526
527 if( edge == SHEET_SIDE::RIGHT || edge == SHEET_SIDE::LEFT )
528 {
529 BOX2I pinRect = m_pins[i]->GetBoundingBox();
530
531 pinsTop = std::min( pinsTop, pinRect.GetTop() );
532 pinsBottom = std::max( pinsBottom, pinRect.GetBottom() );
533 }
534 }
535
536 pinsTop = bumpToNextGrid( pinsTop, -1 );
537 pinsBottom = bumpToNextGrid( pinsBottom, 1 );
538
539 int pinMinHeight;
540
541 if( pinsTop >= pinsBottom )
542 pinMinHeight = 0;
543 else if( aFromTop )
544 pinMinHeight = pinsBottom - m_pos.y;
545 else
546 pinMinHeight = m_pos.y + m_size.y - pinsTop;
547
548 return std::max( pinMinHeight, schIUScale.MilsToIU( MIN_SHEET_HEIGHT ) );
549}
constexpr EDA_IU_SCALE schIUScale
Definition: base_units.h:111
coord_type GetTop() const
Definition: box2.h:194
coord_type GetBottom() const
Definition: box2.h:190
int bumpToNextGrid(const int aVal, const int aDirection)
Definition: sch_sheet.cpp:462
#define MIN_SHEET_HEIGHT
Definition: sch_sheet.h:40
SHEET_SIDE
Define the edge of the sheet that the sheet pin is positioned.
Definition: sch_sheet_pin.h:46
constexpr int MilsToIU(int mils) const
Definition: base_units.h:94

References bumpToNextGrid(), BOX2< Vec >::GetBottom(), BOX2< Vec >::GetTop(), LEFT, m_pins, m_pos, m_size, EDA_IU_SCALE::MilsToIU(), MIN_SHEET_HEIGHT, RIGHT, schIUScale, and VECTOR2< T >::y.

Referenced by EE_POINT_EDITOR::updateParentItem().

◆ GetMinWidth()

int SCH_SHEET::GetMinWidth ( bool  aFromLeft) const

Return the minimum width of the sheet based on the widths of the sheet pin text.

The minimum sheet width is determined by the width of the bounding box of each hierarchical sheet pin. If two pins are horizontally adjacent ( same Y position ) to each other, the sum of the bounding box widths is used. If at some point in the future sheet objects can be rotated or pins can be placed in the vertical orientation, this function will need to be changed.

Returns
The minimum width the sheet can be resized.

Definition at line 484 of file sch_sheet.cpp.

485{
486 int pinsLeft = m_pos.x + m_size.x;
487 int pinsRight = m_pos.x;
488
489 for( size_t i = 0; i < m_pins.size(); i++ )
490 {
491 SHEET_SIDE edge = m_pins[i]->GetSide();
492
493 if( edge == SHEET_SIDE::TOP || edge == SHEET_SIDE::BOTTOM )
494 {
495 BOX2I pinRect = m_pins[i]->GetBoundingBox();
496
497 pinsLeft = std::min( pinsLeft, pinRect.GetLeft() );
498 pinsRight = std::max( pinsRight, pinRect.GetRight() );
499 }
500 }
501
502 pinsLeft = bumpToNextGrid( pinsLeft, -1 );
503 pinsRight = bumpToNextGrid( pinsRight, 1 );
504
505 int pinMinWidth;
506
507 if( pinsLeft >= pinsRight )
508 pinMinWidth = 0;
509 else if( aFromLeft )
510 pinMinWidth = pinsRight - m_pos.x;
511 else
512 pinMinWidth = m_pos.x + m_size.x - pinsLeft;
513
514 return std::max( pinMinWidth, schIUScale.MilsToIU( MIN_SHEET_WIDTH ) );
515}
coord_type GetRight() const
Definition: box2.h:189
coord_type GetLeft() const
Definition: box2.h:193
#define MIN_SHEET_WIDTH
Definition: sch_sheet.h:39

References BOTTOM, bumpToNextGrid(), BOX2< Vec >::GetLeft(), BOX2< Vec >::GetRight(), m_pins, m_pos, m_size, EDA_IU_SCALE::MilsToIU(), MIN_SHEET_WIDTH, schIUScale, TOP, and VECTOR2< T >::x.

Referenced by EE_POINT_EDITOR::updateParentItem().

◆ GetMsgPanelInfo()

void SCH_SHEET::GetMsgPanelInfo ( EDA_DRAW_FRAME aFrame,
std::vector< MSG_PANEL_ITEM > &  aList 
)
overridevirtual

Populate aList of MSG_PANEL_ITEM objects with it's internal state for display purposes.

Parameters
aListis the list to populate.

Reimplemented from EDA_ITEM.

Definition at line 793 of file sch_sheet.cpp.

794{
795 aList.emplace_back( _( "Sheet Name" ), m_fields[ SHEETNAME ].GetText() );
796
797 if( SCH_EDIT_FRAME* schframe = dynamic_cast<SCH_EDIT_FRAME*>( aFrame ) )
798 {
799 SCH_SHEET_PATH path = schframe->GetCurrentSheet();
800 path.push_back( this );
801
802 aList.emplace_back( _( "Hierarchical Path" ), path.PathHumanReadable( false, true ) );
803 }
804
805 aList.emplace_back( _( "File Name" ), m_fields[ SHEETFILENAME ].GetText() );
806}
Schematic editor (Eeschema) main window.

References _, EDA_UNIT_UTILS::GetText(), m_fields, path, SHEETFILENAME, and SHEETNAME.

◆ GetName()

◆ GetOrInitConnection()

SCH_CONNECTION * SCH_ITEM::GetOrInitConnection ( const SCH_SHEET_PATH aPath,
CONNECTION_GRAPH aGraph 
)
inherited

Definition at line 228 of file sch_item.cpp.

230{
231 if( !IsConnectable() )
232 return nullptr;
233
234 SetConnectivityDirty( false );
235
236 SCH_CONNECTION* connection = Connection( &aSheet );
237
238 if( connection )
239 return connection;
240 else
241 return InitializeConnection( aSheet, aGraph );
242}
SCH_CONNECTION * InitializeConnection(const SCH_SHEET_PATH &aPath, CONNECTION_GRAPH *aGraph)
Create a new connection object associated with this object.
Definition: sch_item.cpp:205
void SetConnectivityDirty(bool aDirty=true)
Definition: sch_item.h:415

References SCH_ITEM::Connection(), SCH_ITEM::InitializeConnection(), SCH_ITEM::IsConnectable(), and SCH_ITEM::SetConnectivityDirty().

◆ getPageNumber()

wxString SCH_SHEET::getPageNumber ( const SCH_SHEET_PATH aInstance) const
protected

Return the sheet page number for aInstance.

Warning
The SCH_SHEET_PATH object must be a full hierarchical path which means the SCH_SHEET object at index 0 must be the root sheet. A partial sheet path will raise an assertion on debug builds and silently fail and return an empty page number on release builds.
Returns
the page number for the requested sheet instance.

Definition at line 1295 of file sch_sheet.cpp.

1296{
1297 wxCHECK( aSheetPath.IsFullPath(), wxEmptyString );
1298 wxCHECK( !aSheetPath.Last() || ( aSheetPath.Last()->m_Uuid != m_Uuid ), wxEmptyString );
1299
1300 wxString pageNumber;
1301 KIID_PATH path = aSheetPath.Path();
1302
1303 for( const SCH_SHEET_INSTANCE& instance : m_instances )
1304 {
1305 if( instance.m_Path == path )
1306 {
1307 pageNumber = instance.m_PageNumber;
1308 break;
1309 }
1310 }
1311
1312 return pageNumber;
1313}

References SCH_SHEET_PATH::IsFullPath(), SCH_SHEET_PATH::Last(), m_instances, EDA_ITEM::m_Uuid, SCH_SHEET_PATH::Path(), and path.

Referenced by SCH_SHEET_PATH::GetPageNumber().

◆ GetParent()

◆ GetPenWidth()

int SCH_SHEET::GetPenWidth ( ) const
overridevirtual
Returns
the size of the "pen" that be used to draw or plot this item

Reimplemented from SCH_ITEM.

Definition at line 590 of file sch_sheet.cpp.

591{
592 if( GetBorderWidth() > 0 )
593 return GetBorderWidth();
594
595 if( Schematic() )
597
599}
SCHEMATIC_SETTINGS & Settings() const
Definition: schematic.cpp:178
int GetBorderWidth() const
Definition: sch_sheet.h:111
#define DEFAULT_LINE_WIDTH_MILS
The default wire width in mils. (can be changed in preference menu)

References DEFAULT_LINE_WIDTH_MILS, GetBorderWidth(), SCHEMATIC_SETTINGS::m_DefaultLineWidth, EDA_IU_SCALE::MilsToIU(), SCH_ITEM::Schematic(), schIUScale, and SCHEMATIC::Settings().

Referenced by AutoplaceFields(), KIGFX::SCH_PAINTER::draw(), GetBodyBoundingBox(), Plot(), and Print().

◆ GetPin()

SCH_SHEET_PIN * SCH_SHEET::GetPin ( const VECTOR2I aPosition)

Return the sheet pin item found at aPosition in the sheet.

Parameters
aPositionThe position to check for a sheet pin.
Returns
The sheet pin found at aPosition or NULL if no sheet pin is found.

Definition at line 578 of file sch_sheet.cpp.

579{
580 for( SCH_SHEET_PIN* pin : m_pins )
581 {
582 if( pin->HitTest( aPosition ) )
583 return pin;
584 }
585
586 return nullptr;
587}

References m_pins, and pin.

Referenced by SCH_SCREEN::GetSheetPin().

◆ GetPins() [1/2]

◆ GetPins() [2/2]

const std::vector< SCH_SHEET_PIN * > & SCH_SHEET::GetPins ( ) const
inline

Definition at line 176 of file sch_sheet.h.

176{ return m_pins; }

References m_pins.

◆ GetPosition()

◆ GetRootInstance()

const SCH_SHEET_INSTANCE & SCH_SHEET::GetRootInstance ( ) const

Return the root sheet instance data.

Note
If no root sheet instance data exists, an assertion will be raise in debug builds and an empty instance will be returned.
Returns
the root sheet instance data.

Definition at line 1279 of file sch_sheet.cpp.

1280{
1281 for( const SCH_SHEET_INSTANCE& instance : m_instances )
1282 {
1283 if( instance.m_Path.size() == 0 )
1284 return instance;
1285 }
1286
1287 wxFAIL;
1288
1290
1291 return dummy;
1292}
std::vector< FAB_LAYER_COLOR > dummy

References dummy, and m_instances.

Referenced by SCH_SEXPR_PLUGIN::Format().

◆ GetRotationCenter()

VECTOR2I SCH_SHEET::GetRotationCenter ( ) const

Rotating around the boundingBox's center can cause walking when the sheetname or filename is longer than the edge it's on.

Use this instead, which always returns the center of the sheet itself.

Definition at line 690 of file sch_sheet.cpp.

691{
692 BOX2I box( m_pos, m_size );
693 return box.GetCenter();
694}

References BOX2< Vec >::GetCenter(), m_pos, and m_size.

Referenced by SCH_EDIT_TOOL::Rotate().

◆ GetScreen()

SCH_SCREEN * SCH_SHEET::GetScreen ( ) const
inline

Definition at line 106 of file sch_sheet.h.

106{ return m_screen; }

References m_screen.

Referenced by SCH_SCREENS::buildScreenList(), SCH_EDIT_FRAME::checkForNoFullyDefinedLibIds(), SCH_EDITOR_CONTROL::doCopy(), CONNECTION_GRAPH::ercCheckHierSheets(), SCH_SEXPR_PLUGIN::Format(), SCH_LEGACY_PLUGIN::Format(), SCH_EAGLE_PLUGIN::getCurrentScreen(), SCHEMATIC::GetFileName(), getSheetBbox(), SCH_DRAWING_TOOLS::importHierLabel(), SCH_EDIT_FRAME::InitSheet(), SCH_SHEET_PATH::LastScreen(), SCH_ALTIUM_PLUGIN::Load(), CADSTAR_SCH_ARCHIVE_PLUGIN::Load(), SCH_EAGLE_PLUGIN::Load(), CADSTAR_SCH_ARCHIVE_LOADER::Load(), CADSTAR_SCH_ARCHIVE_LOADER::loadHierarchicalSheetPins(), SCH_SEXPR_PLUGIN::loadHierarchy(), SCH_LEGACY_PLUGIN::loadHierarchy(), KI_TEST::LoadHierarchy(), SCH_EAGLE_PLUGIN::loadSchematic(), CADSTAR_SCH_ARCHIVE_LOADER::loadSchematicSymbol(), CADSTAR_SCH_ARCHIVE_LOADER::loadSheetAndChildSheets(), SCH_EDIT_FRAME::LoadSheetFromFile(), CADSTAR_SCH_ARCHIVE_LOADER::loadSheets(), SCH_LEGACY_PLUGIN::loadSymbol(), DIALOG_SHEET_PIN_PROPERTIES::onComboBox(), DIALOG_SHEET_PROPERTIES::onSheetFilenameChanged(), SCH_ALTIUM_PLUGIN::ParseAltiumSch(), SCH_SEXPR_PARSER::ParseSchematic(), SCH_SEXPR_PARSER::parseSchSheetInstances(), SCH_ALTIUM_PLUGIN::ParseSheetSymbol(), SCH_SHEET_PATH::PathHumanReadable(), SCH_EDIT_TOOL::Properties(), SCHEMATIC::RootScreen(), SCH_LEGACY_PLUGIN::Save(), SCH_SEXPR_PLUGIN::Save(), SCH_EDIT_FRAME::SaveProject(), SCH_EDIT_FRAME::saveSchematicFile(), DIALOG_SHEET_PIN_PROPERTIES::TransferDataToWindow(), and SCH_EDITOR_CONTROL::updatePastedSheet().

◆ GetScreenCount()

int SCH_SHEET::GetScreenCount ( ) const

Return the number of times the associated screen for the sheet is being used.

If no screen is associated with the sheet, then zero is returned.

Definition at line 185 of file sch_sheet.cpp.

186{
187 if( m_screen == nullptr )
188 return 0;
189
190 return m_screen->GetRefCount();
191}

References SCH_SCREEN::GetRefCount(), and m_screen.

Referenced by DIALOG_SHEET_PROPERTIES::onSheetFilenameChanged().

◆ GetSize()

◆ GetSortPosition()

virtual VECTOR2I EDA_ITEM::GetSortPosition ( ) const
inlinevirtualinherited

Return the coordinates that should be used for sorting this element visually compared to other elements.

For instance, for lines the midpoint might be a better sorting point than either end.

Returns
X,Y coordinate of the sort point

Reimplemented in SCH_LINE.

Definition at line 265 of file eda_item.h.

265{ return GetPosition(); }

References EDA_ITEM::GetPosition().

◆ GetState()

int EDA_ITEM::GetState ( EDA_ITEM_FLAGS  type) const
inlineinherited

Definition at line 123 of file eda_item.h.

124 {
125 return m_status & type;
126 }
EDA_ITEM_FLAGS m_status
Definition: eda_item.h:495

References EDA_ITEM::m_status.

◆ GetStatus()

EDA_ITEM_FLAGS EDA_ITEM::GetStatus ( ) const
inlineinherited

Definition at line 136 of file eda_item.h.

136{ return m_status; }

References EDA_ITEM::m_status.

◆ GetStoredPos()

VECTOR2I & SCH_ITEM::GetStoredPos ( )
inlineinherited

Definition at line 209 of file sch_item.h.

209{ return m_storedPos; }
VECTOR2I m_storedPos
Definition: sch_item.h:494

References SCH_ITEM::m_storedPos.

◆ GetStroke()

virtual STROKE_PARAMS SCH_ITEM::GetStroke ( ) const
inlinevirtualinherited

Reimplemented in SCH_BUS_ENTRY_BASE, SCH_LINE, and SCH_SHAPE.

Definition at line 457 of file sch_item.h.

457{ wxCHECK( false, STROKE_PARAMS() ); }
Simple container to manage line stroke parameters.
Definition: stroke_params.h:88

Referenced by DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::processItem().

◆ GetTypeDesc()

wxString EDA_ITEM::GetTypeDesc ( ) const
inherited

Return a translated description of the type for this EDA_ITEM for display in user facing messages.

Definition at line 301 of file eda_item.cpp.

302{
303 //@see EDA_ITEM_DESC for definition of ENUM_MAP<KICAD_T>
304 wxString typeDescr = ENUM_MAP<KICAD_T>::Instance().ToString( Type() );
305
306 return wxGetTranslation( typeDescr );
307}
static ENUM_MAP< T > & Instance()
Definition: property.h:573

References ENUM_MAP< T >::Instance(), and EDA_ITEM::Type().

Referenced by PCB_GROUP::AddItem(), EDIT_TOOL::doMoveSelection(), and EDA_ITEM::GetFriendlyName().

◆ HasFlag()

◆ HasLineStroke()

virtual bool SCH_ITEM::HasLineStroke ( ) const
inlinevirtualinherited

Check if this schematic item has line stoke properties.

See also
STROKE_PARAMS
Returns
true if this schematic item support line stroke properties. Otherwise, false.

Reimplemented in SCH_BUS_ENTRY_BASE, SCH_LINE, and SCH_SHAPE.

Definition at line 455 of file sch_item.h.

455{ return false; }

Referenced by SCH_EDIT_TOOL::Init(), and DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::processItem().

◆ HasPin()

bool SCH_SHEET::HasPin ( const wxString &  aName) const

Checks if the sheet already has a sheet pin named aName.

Parameters
aNameName of the sheet pin to search for.
Returns
True if sheet pin with aName is found, otherwise false.

Definition at line 393 of file sch_sheet.cpp.

394{
395 for( SCH_SHEET_PIN* pin : m_pins )
396 {
397 if( pin->GetText().CmpNoCase( aName ) == 0 )
398 return true;
399 }
400
401 return false;
402}

References m_pins, and pin.

Referenced by SCH_DRAWING_TOOLS::importHierLabel().

◆ HasPins()

bool SCH_SHEET::HasPins ( ) const
inline

Definition at line 210 of file sch_sheet.h.

210{ return !m_pins.empty(); }

References m_pins.

◆ HasRootInstance()

bool SCH_SHEET::HasRootInstance ( ) const

Check to see if this sheet has a root sheet instance.

Note
It is possible for sheets to contain both sheet instances from other projects as well as a root sheet instance for this schematic. This will happen with a shared schematic is opened by the schematic editor in stand alone model.
Returns
true if the instance data contains a root sheet instance.

Definition at line 1267 of file sch_sheet.cpp.

1268{
1269 for( const SCH_SHEET_INSTANCE& instance : m_instances )
1270 {
1271 if( instance.m_Path.size() == 0 )
1272 return true;
1273 }
1274
1275 return false;
1276}

References m_instances.

Referenced by SCH_SEXPR_PLUGIN::Format().

◆ HasUndefinedPins()

bool SCH_SHEET::HasUndefinedPins ( ) const

Check all sheet labels against schematic for undefined hierarchical labels.

Returns
True if there are any undefined labels.

Definition at line 438 of file sch_sheet.cpp.

439{
440 for( SCH_SHEET_PIN* pin : m_pins )
441 {
442 /* Search the schematic for a hierarchical label corresponding to this sheet label. */
443 const SCH_HIERLABEL* HLabel = nullptr;
444
445 for( SCH_ITEM* aItem : m_screen->Items().OfType( SCH_HIER_LABEL_T ) )
446 {
447 if( !pin->GetText().CmpNoCase( static_cast<SCH_HIERLABEL*>( aItem )->GetText() ) )
448 {
449 HLabel = static_cast<SCH_HIERLABEL*>( aItem );
450 break;
451 }
452 }
453
454 if( HLabel == nullptr ) // Corresponding hierarchical label not found.
455 return true;
456 }
457
458 return false;
459}

References EDA_TEXT::GetText(), SCH_SCREEN::Items(), m_pins, m_screen, EE_RTREE::OfType(), pin, and SCH_HIER_LABEL_T.

Referenced by SCH_EDIT_TOOL::CleanupSheetPins().

◆ HitTest() [1/2]

bool SCH_SHEET::HitTest ( const BOX2I aRect,
bool  aContained,
int  aAccuracy = 0 
) const
overridevirtual

Test if aRect intersects this item.

Parameters
aRectA reference to a BOX2I object containing the rectangle to test.
aContainedSet to true to test for containment instead of an intersection.
aAccuracyIncrease aRect by this amount.
Returns
True if aRect contains or intersects the item bounding box.

Reimplemented from EDA_ITEM.

Definition at line 1072 of file sch_sheet.cpp.

1073{
1074 BOX2I rect = aRect;
1075
1076 rect.Inflate( aAccuracy );
1077
1078 if( aContained )
1079 return rect.Contains( GetBodyBoundingBox() );
1080
1081 return rect.Intersects( GetBodyBoundingBox() );
1082}
bool Intersects(const BOX2< Vec > &aRect) const
Definition: box2.h:269
bool Contains(const Vec &aPoint) const
Definition: box2.h:141
BOX2< Vec > & Inflate(coord_type dx, coord_type dy)
Inflates the rectangle horizontally by dx and vertically by dy.
Definition: box2.h:506

References BOX2< Vec >::Contains(), GetBodyBoundingBox(), BOX2< Vec >::Inflate(), and BOX2< Vec >::Intersects().

◆ HitTest() [2/2]

bool SCH_SHEET::HitTest ( const VECTOR2I aPosition,
int  aAccuracy 
) const
overridevirtual

Test if aPosition is inside or on the boundary of this item.

Parameters
aPositionA reference to a VECTOR2I object containing the coordinates to test.
aAccuracyIncrease the item bounding box by this amount.
Returns
True if aPosition is within the item bounding box.

Reimplemented from EDA_ITEM.

Definition at line 1062 of file sch_sheet.cpp.

1063{
1064 BOX2I rect = GetBodyBoundingBox();
1065
1066 rect.Inflate( aAccuracy );
1067
1068 return rect.Contains( aPosition );
1069}

References BOX2< Vec >::Contains(), GetBodyBoundingBox(), and BOX2< Vec >::Inflate().

◆ InitializeConnection()

SCH_CONNECTION * SCH_ITEM::InitializeConnection ( const SCH_SHEET_PATH aPath,
CONNECTION_GRAPH aGraph 
)
inherited

Create a new connection object associated with this object.

Parameters
aPathis the sheet path to initialize.

Definition at line 205 of file sch_item.cpp.

207{
208 SetConnectivityDirty( false );
209
210 SCH_CONNECTION* connection = Connection( &aSheet );
211
212 if( connection )
213 {
214 connection->Reset();
215 }
216 else
217 {
218 connection = new SCH_CONNECTION( this );
219 m_connection_map.insert( std::make_pair( aSheet, connection ) );
220 }
221
222 connection->SetGraph( aGraph );
223 connection->SetSheet( aSheet );
224 return connection;
225}
void Reset()
Clears connectivity information.
void SetGraph(CONNECTION_GRAPH *aGraph)
void SetSheet(SCH_SHEET_PATH aSheet)

References SCH_ITEM::Connection(), SCH_ITEM::m_connection_map, SCH_CONNECTION::Reset(), SCH_ITEM::SetConnectivityDirty(), SCH_CONNECTION::SetGraph(), and SCH_CONNECTION::SetSheet().

Referenced by SCH_ITEM::GetOrInitConnection().

◆ IsBrightened()

◆ IsConnectable()

bool SCH_SHEET::IsConnectable ( ) const
inlineoverridevirtual
Returns
true if the schematic item can connect to another schematic item.

Reimplemented from SCH_ITEM.

Definition at line 341 of file sch_sheet.h.

341{ return true; }

◆ IsConnected()

bool SCH_ITEM::IsConnected ( const VECTOR2I aPoint) const
inherited

Test the item to see if it is connected to aPoint.

Parameters
aPointis a reference to a VECTOR2I object containing the coordinates to test.
Returns
True if connection to aPoint exists.

Definition at line 137 of file sch_item.cpp.

138{
139 if(( m_flags & STRUCT_DELETED ) || ( m_flags & SKIP_STRUCT ) )
140 return false;
141
142 return doIsConnected( aPosition );
143}
virtual bool doIsConnected(const VECTOR2I &aPosition) const
Provide the object specific test to see if it is connected to aPosition.
Definition: sch_item.h:488

References SCH_ITEM::doIsConnected(), EDA_ITEM::m_flags, SKIP_STRUCT, and STRUCT_DELETED.

Referenced by SCH_SCREEN::doIsJunction(), SCH_MOVE_TOOL::getConnectedItems(), SCH_SCREEN::IsTerminalPoint(), and SCH_SCREEN::MarkConnections().

◆ IsConnectivityDirty()

◆ IsDangling()

virtual bool SCH_ITEM::IsDangling ( ) const
inlinevirtualinherited

Reimplemented in SCH_BUS_ENTRY_BASE, SCH_LABEL_BASE, SCH_LINE, and SCH_PIN.

Definition at line 342 of file sch_item.h.

342{ return false; }

Referenced by SCH_EDIT_TOOL::ChangeTextType(), and KIGFX::SCH_PAINTER::draw().

◆ IsEntered()

bool EDA_ITEM::IsEntered ( ) const
inlineinherited

Definition at line 107 of file eda_item.h.

107{ return m_flags & ENTERED; }
#define ENTERED
indicates a group has been entered

References ENTERED, and EDA_ITEM::m_flags.

Referenced by KIGFX::PCB_PAINTER::draw().

◆ IsForceVisible()

bool EDA_ITEM::IsForceVisible ( ) const
inlineinherited

Definition at line 201 of file eda_item.h.

201{ return m_forceVisible; }
bool m_forceVisible
Definition: eda_item.h:497

References EDA_ITEM::m_forceVisible.

Referenced by KIGFX::SCH_PAINTER::draw(), and SCH_FIELD::Print().

◆ IsHypertext()

virtual bool SCH_ITEM::IsHypertext ( ) const
inlinevirtualinherited

Allow items to support hypertext actions when hovered/clicked.

Reimplemented in SCH_FIELD, SCH_TEXT, and SCH_TEXTBOX.

Definition at line 239 of file sch_item.h.

239{ return false; }

Referenced by SCH_ITEM::RenderAsBitmap().

◆ IsLocked()

virtual bool SCH_ITEM::IsLocked ( ) const
inlinevirtualinherited
Returns
true if the object is locked, else false.

Definition at line 229 of file sch_item.h.

229{ return false; }

◆ IsModified()

bool EDA_ITEM::IsModified ( ) const
inlineinherited

Definition at line 102 of file eda_item.h.

102{ return m_flags & IS_CHANGED; }

References IS_CHANGED, and EDA_ITEM::m_flags.

Referenced by PCB_EDIT_FRAME::OpenProjectFiles().

◆ IsMovableFromAnchorPoint()

bool SCH_SHEET::IsMovableFromAnchorPoint ( ) const
inlineoverridevirtual

Return true for items which are moved with the anchor point at mouse cursor and false for items moved with no reference to anchor.

Usually return true for small items (labels, junctions) and false for items which can be large (hierarchical sheets, symbols).

Returns
false for a hierarchical sheet.

Reimplemented from SCH_ITEM.

Definition at line 91 of file sch_sheet.h.

91{ return false; }

◆ IsMoving()

◆ IsNew()

◆ IsPointClickableAnchor()

virtual bool SCH_ITEM::IsPointClickableAnchor ( const VECTOR2I aPos) const
inlinevirtualinherited
Returns
true if the given point can start drawing (usually means the anchor is unused/free/dangling).

Reimplemented in SCH_BUS_ENTRY_BASE, SCH_JUNCTION, SCH_LABEL, SCH_GLOBALLABEL, SCH_HIERLABEL, SCH_LINE, SCH_PIN, SCH_SHEET_PIN, and SCH_SYMBOL.

Definition at line 355 of file sch_item.h.

355{ return false; }

Referenced by EE_SELECTION_TOOL::autostartEvent().

◆ IsReplaceable()

bool SCH_SHEET::IsReplaceable ( ) const
inlineoverridevirtual

Override this method in any derived object that supports test find and replace.

Returns
True if the item has replaceable text that can be modified using the find and replace dialog.

Reimplemented from EDA_ITEM.

Definition at line 325 of file sch_sheet.h.

325{ return true; }

◆ IsRollover()

bool EDA_ITEM::IsRollover ( ) const
inlineinherited

Definition at line 110 of file eda_item.h.

111 {
112 return ( m_flags & ( IS_ROLLOVER | IS_MOVING ) ) == IS_ROLLOVER;
113 }
#define IS_ROLLOVER
Rollover active. Used for hyperlink highlighting.

References IS_MOVING, IS_ROLLOVER, and EDA_ITEM::m_flags.

Referenced by KIGFX::SCH_PAINTER::draw().

◆ IsRootSheet()

bool SCH_SHEET::IsRootSheet ( ) const
Returns
true if this sheet is the root sheet.

Definition at line 194 of file sch_sheet.cpp.

195{
196 wxCHECK_MSG( Schematic(), false, "Can't call IsRootSheet without setting a schematic" );
197
198 return &Schematic()->Root() == this;
199}
SCH_SHEET & Root() const
Definition: schematic.h:91

References SCHEMATIC::Root(), and SCH_ITEM::Schematic().

Referenced by SCH_SHEET_PATH::IsFullPath(), SCH_EDIT_FRAME::SaveProject(), and SCH_SHEET_LIST::SCH_SHEET_LIST().

◆ IsSelected()

bool EDA_ITEM::IsSelected ( ) const
inlineinherited

Definition at line 106 of file eda_item.h.

106{ return m_flags & SELECTED; }

References EDA_ITEM::m_flags, and SELECTED.

Referenced by ALIGN_DISTRIBUTE_TOOL::AlignBottom(), ALIGN_DISTRIBUTE_TOOL::AlignCenterX(), ALIGN_DISTRIBUTE_TOOL::AlignCenterY(), ALIGN_DISTRIBUTE_TOOL::AlignTop(), SCH_EDIT_TOOL::ChangeTextType(), SCH_EDIT_FRAME::ConvertPart(), DIALOG_CHANGE_SYMBOLS::DIALOG_CHANGE_SYMBOLS(), ALIGN_DISTRIBUTE_TOOL::doAlignLeft(), ALIGN_DISTRIBUTE_TOOL::doAlignRight(), ALIGN_DISTRIBUTE_TOOL::doDistributeCentersHorizontally(), ALIGN_DISTRIBUTE_TOOL::doDistributeCentersVertically(), ALIGN_DISTRIBUTE_TOOL::doDistributeGapsHorizontally(), ALIGN_DISTRIBUTE_TOOL::doDistributeGapsVertically(), EDIT_TOOL::doMoveSelection(), KIGFX::SCH_PAINTER::draw(), KIGFX::PCB_PAINTER::draw(), KIGFX::PCB_PAINTER::Draw(), DS_PROXY_UNDO_ITEM::DS_PROXY_UNDO_ITEM(), KIGFX::GERBVIEW_RENDER_SETTINGS::GetColor(), KIGFX::DS_RENDER_SETTINGS::GetColor(), KIGFX::PCB_RENDER_SETTINGS::GetColor(), SCH_MOVE_TOOL::getConnectedDragItems(), KIGFX::SCH_PAINTER::getLineWidth(), DIALOG_EXCHANGE_FOOTPRINTS::isMatch(), DIALOG_CHANGE_SYMBOLS::isMatch(), SCH_SCREEN::MarkConnections(), SCH_LINE::MergeOverlap(), SCH_EDIT_TOOL::Mirror(), EDIT_TOOL::MoveExact(), SCH_MOVE_TOOL::moveItem(), KIGFX::SCH_PAINTER::nonCached(), SCH_MOVE_TOOL::orthoLineDrag(), DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::processItem(), BOARD_COMMIT::Push(), EE_SELECTION_TOOL::RebuildSelection(), PCB_SELECTION_TOOL::RebuildSelection(), RENDER_3D_OPENGL::renderFootprint(), SCH_EDIT_TOOL::Rotate(), EE_TOOL_BASE< T >::saveCopyInUndoList(), GERBVIEW_SELECTION_TOOL::select(), PCB_SELECTION_TOOL::select(), EE_SELECTION_TOOL::selectMultiple(), PCB_SELECTION_TOOL::selectMultiple(), GERBVIEW_SELECTION_TOOL::selectPoint(), KIGFX::SCH_PAINTER::setDeviceColors(), GERBVIEW_SELECTION_TOOL::unselect(), HIERARCHY_PANE::UpdateHierarchySelection(), PCB_BASE_FRAME::UpdateUserUnits(), DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::visitItem(), and DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS::visitItem().

◆ IsShownAsBitmap()

bool EDA_ITEM::IsShownAsBitmap ( ) const
inlineinherited

Definition at line 173 of file eda_item.h.

173{ return m_flags & IS_SHOWN_AS_BITMAP; }
#define IS_SHOWN_AS_BITMAP

References IS_SHOWN_AS_BITMAP, and EDA_ITEM::m_flags.

◆ IsType()

bool SCH_ITEM::IsType ( const std::vector< KICAD_T > &  aScanTypes) const
inlineoverridevirtualinherited

Check whether the item is one of the listed types.

Parameters
aScanTypesList of item types
Returns
true if the item type is contained in the list aScanTypes

Reimplemented from EDA_ITEM.

Reimplemented in SCH_LABEL_BASE, and SCH_LINE.

Definition at line 162 of file sch_item.h.

163 {
164 if( EDA_ITEM::IsType( aScanTypes ) )
165 return true;
166
167 for( KICAD_T scanType : aScanTypes )
168 {
169 if( scanType == SCH_ITEM_LOCATE_WIRE_T && m_layer == LAYER_WIRE )
170 return true;
171
172 if ( scanType == SCH_ITEM_LOCATE_BUS_T && m_layer == LAYER_BUS )
173 return true;
174
175 if ( scanType == SCH_ITEM_LOCATE_GRAPHIC_LINE_T
176 && Type() == SCH_LINE_T && m_layer == LAYER_NOTES )
177 {
178 return true;
179 }
180 }
181
182 return false;
183 }
virtual bool IsType(const std::vector< KICAD_T > &aScanTypes) const
Check whether the item is one of the listed types.
Definition: eda_item.h:181
@ LAYER_NOTES
Definition: layer_ids.h:358
KICAD_T
The set of class identification values stored in EDA_ITEM::m_structType.
Definition: typeinfo.h:78
@ SCH_ITEM_LOCATE_WIRE_T
Definition: typeinfo.h:170
@ SCH_ITEM_LOCATE_BUS_T
Definition: typeinfo.h:171
@ SCH_ITEM_LOCATE_GRAPHIC_LINE_T
Definition: typeinfo.h:172

References EDA_ITEM::IsType(), LAYER_BUS, LAYER_NOTES, LAYER_WIRE, SCH_ITEM::m_layer, SCH_ITEM_LOCATE_BUS_T, SCH_ITEM_LOCATE_GRAPHIC_LINE_T, SCH_ITEM_LOCATE_WIRE_T, SCH_LINE_T, and EDA_ITEM::Type().

Referenced by SCH_EDIT_TOOL::AutoplaceFields(), SCH_EDIT_FRAME::AutoRotateItem(), SCH_FIELD::IsType(), SCH_LABEL_BASE::IsType(), SCH_LINE::IsType(), and DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::visitItem().

◆ IsVerticalOrientation()

bool SCH_SHEET::IsVerticalOrientation ( ) const

Definition at line 417 of file sch_sheet.cpp.

418{
419 int leftRight = 0;
420 int topBottom = 0;
421
422 for( SCH_SHEET_PIN* pin : m_pins )
423 {
424 switch( pin->GetSide() )
425 {
426 case SHEET_SIDE::LEFT: leftRight++; break;
427 case SHEET_SIDE::RIGHT: leftRight++; break;
428 case SHEET_SIDE::TOP: topBottom++; break;
429 case SHEET_SIDE::BOTTOM: topBottom++; break;
430 default: break;
431 }
432 }
433
434 return topBottom > 0 && leftRight == 0;
435}

References BOTTOM, LEFT, m_pins, pin, RIGHT, and TOP.

Referenced by AutoplaceFields(), and SCH_SHEET_PIN::SCH_SHEET_PIN().

◆ IterateForward() [1/2]

template<class T >
static INSPECT_RESULT EDA_ITEM::IterateForward ( std::deque< T > &  aList,
INSPECTOR  inspector,
void *  testData,
const std::vector< KICAD_T > &  scanTypes 
)
inlinestaticinherited

This changes first parameter to avoid the DList and use the main queue instead.

Definition at line 302 of file eda_item.h.

304 {
305 for( const auto& it : aList )
306 {
307 if( static_cast<EDA_ITEM*>( it )->Visit( inspector,
308 testData,
309 scanTypes ) == INSPECT_RESULT::QUIT )
310 {
312 }
313 }
314
316 }
A base class for most all the KiCad significant classes used in schematics and boards.
Definition: eda_item.h:85
virtual INSPECT_RESULT Visit(INSPECTOR inspector, void *testData, const std::vector< KICAD_T > &aScanTypes)
May be re-implemented for each derived class in order to handle all the types given by its member dat...
Definition: eda_item.cpp:91

References CONTINUE, QUIT, and EDA_ITEM::Visit().

Referenced by GERBER_FILE_IMAGE::Visit().

◆ IterateForward() [2/2]

template<class T >
static INSPECT_RESULT EDA_ITEM::IterateForward ( std::vector< T > &  aList,
INSPECTOR  inspector,
void *  testData,
const std::vector< KICAD_T > &  scanTypes 
)
inlinestaticinherited

Change first parameter to avoid the DList and use std::vector instead.

Definition at line 322 of file eda_item.h.

324 {
325 for( const auto& it : aList )
326 {
327 if( static_cast<EDA_ITEM*>( it )->Visit( inspector,
328 testData,
329 scanTypes ) == INSPECT_RESULT::QUIT )
330 {
332 }
333 }
334
336 }

References CONTINUE, QUIT, and EDA_ITEM::Visit().

◆ LocatePathOfScreen()

bool SCH_SHEET::LocatePathOfScreen ( SCH_SCREEN aScreen,
SCH_SHEET_PATH aList 
)

Search the existing hierarchy for an instance of screen loaded from aFileName.

Don't bother looking at the root sheet, it must be unique. No other references to its m_screen otherwise there would be loops in the hierarchy.

Parameters
[in]aScreenThe SCH_SCREEN* screen that we search for.
[in]aListThe SCH_SHEET_PATH* that must be used.
Returns
true if found.

Definition at line 755 of file sch_sheet.cpp.

756{
757 if( m_screen )
758 {
759 aList->push_back( this );
760
761 if( m_screen == aScreen )
762 return true;
763
764 for( EDA_ITEM* item : m_screen->Items().OfType( SCH_SHEET_T ) )
765 {
766 SCH_SHEET* sheet = static_cast<SCH_SHEET*>( item );
767
768 if( sheet->LocatePathOfScreen( aScreen, aList ) )
769 return true;
770 }
771
772 aList->pop_back();
773 }
774
775 return false;
776}
bool LocatePathOfScreen(SCH_SCREEN *aScreen, SCH_SHEET_PATH *aList)
Search the existing hierarchy for an instance of screen loaded from aFileName.
Definition: sch_sheet.cpp:755

References SCH_SCREEN::Items(), LocatePathOfScreen(), m_screen, EE_RTREE::OfType(), SCH_SHEET_PATH::pop_back(), SCH_SHEET_PATH::push_back(), and SCH_SHEET_T.

Referenced by SCH_EAGLE_PLUGIN::loadSchematic(), CADSTAR_SCH_ARCHIVE_LOADER::loadSchematicSymbol(), and LocatePathOfScreen().

◆ Matches() [1/2]

bool SCH_SHEET::Matches ( const EDA_SEARCH_DATA aSearchData,
void *  aAuxData 
) const
overridevirtual

Compare the item against the search criteria in aSearchData.

The base class returns false since many of the objects derived from EDA_ITEM do not have any text to search.

Parameters
aSearchDataA reference to a wxFindReplaceData object containing the search criteria.
aAuxDataA pointer to optional data required for the search or NULL if not used.
Returns
True if the item's text matches the search criteria in aSearchData.

Reimplemented from EDA_ITEM.

Definition at line 928 of file sch_sheet.cpp.

929{
930 // Sheets are searchable via the child field and pin item text.
931 return false;
932}

Referenced by SCH_DRAWING_TOOLS::DrawSheet().

◆ Matches() [2/2]

bool EDA_ITEM::Matches ( const wxString &  aText,
const EDA_SEARCH_DATA aSearchData 
) const
protectedinherited

Compare aText against search criteria in aSearchData.

This is a helper function for simplify derived class logic.

Parameters
aTextA reference to a wxString object containing the string to test.
aSearchDataThe criteria to search against.
Returns
True if aText matches the search criteria in aSearchData.

Definition at line 117 of file eda_item.cpp.

118{
119 wxString text = aText;
120 wxString searchText = aSearchData.findString;
121
122 // Don't match if searching for replaceable item and the item doesn't support text replace.
123 if( aSearchData.searchAndReplace && !IsReplaceable() )
124 return false;
125
126 if( !aSearchData.matchCase )
127 {
128 text.MakeUpper();
129 searchText.MakeUpper();
130 }
131
133 {
134 int ii = 0;
135
136 while( ii < (int) text.length() )
137 {
138 int next = text.find( searchText, ii );
139
140 if( next == wxNOT_FOUND )
141 return false;
142
143 ii = next;
144 next += searchText.length();
145
146 bool startOK = ( ii == 0 || !wxIsalnum( text.GetChar( ii - 1 ) ) );
147 bool endOK = ( next == (int) text.length() || !wxIsalnum( text.GetChar( next ) ) );
148
149 if( startOK && endOK )
150 return true;
151 else
152 ii++;
153 }
154
155 return false;
156 }
157 else if( aSearchData.matchMode == EDA_SEARCH_MATCH_MODE::WILDCARD )
158 {
159 return text.Matches( searchText );
160 }
161 else
162 {
163 return text.Find( searchText ) != wxNOT_FOUND;
164 }
165}
virtual bool IsReplaceable() const
Override this method in any derived object that supports test find and replace.
Definition: eda_item.h:420
CITER next(CITER it)
Definition: ptree.cpp:126
EDA_SEARCH_MATCH_MODE matchMode

References EDA_SEARCH_DATA::findString, EDA_ITEM::IsReplaceable(), EDA_SEARCH_DATA::matchCase, EDA_SEARCH_DATA::matchMode, next(), EDA_SEARCH_DATA::searchAndReplace, text, WHOLEWORD, and WILDCARD.

◆ MirrorHorizontally()

void SCH_SHEET::MirrorHorizontally ( int  aCenter)
overridevirtual

Mirror item horizontally about aCenter.

Implements SCH_ITEM.

Definition at line 883 of file sch_sheet.cpp.

884{
885 int dx = m_pos.x;
886
887 MIRROR( m_pos.x, aCenter );
888 m_pos.x -= m_size.x;
889 dx -= m_pos.x; // dx,0 is the move vector for this transform
890
891 for( SCH_SHEET_PIN* sheetPin : m_pins )
892 sheetPin->MirrorHorizontally( aCenter );
893
894 for( SCH_FIELD& field : m_fields )
895 {
896 VECTOR2I pos = field.GetTextPos();
897 pos.x -= dx;
898 field.SetTextPos( pos );
899 }
900}
void MIRROR(T &aPoint, const T &aMirrorRef)
Updates aPoint with the mirror of aPoint relative to the aMirrorRef.
Definition: mirror.h:40

References m_fields, m_pins, m_pos, m_size, MIRROR(), and VECTOR2< T >::x.

◆ MirrorVertically()

void SCH_SHEET::MirrorVertically ( int  aCenter)
overridevirtual

Mirror item vertically about aCenter.

Implements SCH_ITEM.

Definition at line 863 of file sch_sheet.cpp.

864{
865 int dy = m_pos.y;
866
867 MIRROR( m_pos.y, aCenter );
868 m_pos.y -= m_size.y;
869 dy -= m_pos.y; // 0,dy is the move vector for this transform
870
871 for( SCH_SHEET_PIN* sheetPin : m_pins )
872 sheetPin->MirrorVertically( aCenter );
873
874 for( SCH_FIELD& field : m_fields )
875 {
876 VECTOR2I pos = field.GetTextPos();
877 pos.y -= dy;
878 field.SetTextPos( pos );
879 }
880}

References m_fields, m_pins, m_pos, m_size, MIRROR(), and VECTOR2< T >::y.

◆ Move()

void SCH_SHEET::Move ( const VECTOR2I aMoveVector)
overridevirtual

Move the item by aMoveVector to a new position.

Implements SCH_ITEM.

Definition at line 809 of file sch_sheet.cpp.

810{
811 m_pos += aMoveVector;
812
813 for( SCH_SHEET_PIN* pin : m_pins )
814 pin->Move( aMoveVector );
815
816 for( SCH_FIELD& field : m_fields )
817 field.Move( aMoveVector );
818}

References m_fields, m_pins, m_pos, and pin.

Referenced by SetPosition().

◆ operator<() [1/2]

bool EDA_ITEM::operator< ( const EDA_ITEM aItem) const
inherited

Test if another item is less than this object.

Parameters
aItem- Item to compare against.
Returns
- True if aItem is less than the item.

Definition at line 231 of file eda_item.cpp.

232{
233 wxFAIL_MSG( wxString::Format( wxT( "Less than operator not defined for item type %s." ),
234 GetClass() ) );
235
236 return false;
237}
virtual wxString GetClass() const =0
Return the class name.

References Format(), and EDA_ITEM::GetClass().

◆ operator<() [2/2]

bool SCH_SHEET::operator< ( const SCH_ITEM aItem) const
overridevirtual

Reimplemented from SCH_ITEM.

Definition at line 1200 of file sch_sheet.cpp.

1201{
1202 if( Type() != aItem.Type() )
1203 return Type() < aItem.Type();
1204
1205 auto sheet = static_cast<const SCH_SHEET*>( &aItem );
1206
1207 if (m_fields[ SHEETNAME ].GetText() != sheet->m_fields[ SHEETNAME ].GetText() )
1208 return m_fields[ SHEETNAME ].GetText() < sheet->m_fields[ SHEETNAME ].GetText();
1209
1210 if (m_fields[ SHEETFILENAME ].GetText() != sheet->m_fields[ SHEETFILENAME ].GetText() )
1211 return m_fields[ SHEETFILENAME ].GetText() < sheet->m_fields[ SHEETFILENAME ].GetText();
1212
1213 return false;
1214}

References EDA_UNIT_UTILS::GetText(), m_fields, SHEETFILENAME, SHEETNAME, and EDA_ITEM::Type().

◆ operator=()

SCH_SHEET & SCH_SHEET::operator= ( const SCH_ITEM aSheet)

Definition at line 1170 of file sch_sheet.cpp.

1171{
1172 wxCHECK_MSG( Type() == aItem.Type(), *this,
1173 wxT( "Cannot assign object type " ) + aItem.GetClass() + wxT( " to type " ) +
1174 GetClass() );
1175
1176 if( &aItem != this )
1177 {
1178 SCH_ITEM::operator=( aItem );
1179
1180 SCH_SHEET* sheet = (SCH_SHEET*) &aItem;
1181
1182 m_pos = sheet->m_pos;
1183 m_size = sheet->m_size;
1184 m_fields = sheet->m_fields;
1185
1186 for( SCH_SHEET_PIN* pin : sheet->m_pins )
1187 {
1188 m_pins.emplace_back( new SCH_SHEET_PIN( *pin ) );
1189 m_pins.back()->SetParent( this );
1190 }
1191
1192 for( const SCH_SHEET_INSTANCE& instance : sheet->m_instances )
1193 m_instances.emplace_back( instance );
1194 }
1195
1196 return *this;
1197}
SCH_ITEM & operator=(const SCH_ITEM &aPin)
Definition: sch_item.cpp:70
wxString GetClass() const override
Return the class name.
Definition: sch_sheet.h:77

References SCH_ITEM::GetClass(), GetClass(), m_fields, m_instances, m_pins, m_pos, m_size, SCH_ITEM::operator=(), pin, SCH_SHEET_PIN, and EDA_ITEM::Type().

◆ Plot()

void SCH_SHEET::Plot ( PLOTTER aPlotter,
bool  aBackground 
) const
overridevirtual

Plot the schematic item to aPlotter.

Parameters
aPlotteris the PLOTTER object to plot to.
aBackgrounda poor-man's Z-order. The routine will get called twice, first with aBackground true and then with aBackground false.

Reimplemented from SCH_ITEM.

Definition at line 1085 of file sch_sheet.cpp.

1086{
1087 if( aBackground && !aPlotter->GetColorMode() )
1088 return;
1089
1090 auto* settings = dynamic_cast<KIGFX::SCH_RENDER_SETTINGS*>( aPlotter->RenderSettings() );
1091 bool override = settings ? settings->m_OverrideItemColors : false;
1092 COLOR4D borderColor = GetBorderColor();
1093 COLOR4D backgroundColor = GetBackgroundColor();
1094
1095 if( override || borderColor == COLOR4D::UNSPECIFIED )
1096 borderColor = aPlotter->RenderSettings()->GetLayerColor( LAYER_SHEET );
1097
1098 if( override || backgroundColor == COLOR4D::UNSPECIFIED )
1099 backgroundColor = aPlotter->RenderSettings()->GetLayerColor( LAYER_SHEET_BACKGROUND );
1100
1101 if( aBackground )
1102 {
1103 aPlotter->SetColor( backgroundColor );
1104 aPlotter->Rect( m_pos, m_pos + m_size, FILL_T::FILLED_SHAPE, 1 );
1105 }
1106 else
1107 {
1108 aPlotter->SetColor( borderColor );
1109
1110 int penWidth = std::max( GetPenWidth(), aPlotter->RenderSettings()->GetMinPenWidth() );
1111 aPlotter->Rect( m_pos, m_pos + m_size, FILL_T::NO_FILL, penWidth );
1112 }
1113
1114 // Make the sheet object a clickable hyperlink (e.g. for PDF plotter)
1115 std::vector<wxString> properties;
1116
1117 properties.emplace_back( EDA_TEXT::GotoPageHref( findSelf().GetPageNumber() ) );
1118
1119 for( const SCH_FIELD& field : GetFields() )
1120 {
1121 properties.emplace_back( wxString::Format( wxT( "!%s = %s" ),
1122 field.GetName(),
1123 field.GetShownText() ) );
1124 }
1125
1126 aPlotter->HyperlinkMenu( GetBoundingBox(), properties );
1127
1128 // Plot sheet pins
1129 for( SCH_SHEET_PIN* sheetPin : m_pins )
1130 sheetPin->Plot( aPlotter, aBackground );
1131
1132 // Plot the fields
1133 for( const SCH_FIELD& field : m_fields )
1134 field.Plot( aPlotter, aBackground );
1135}
static wxString GotoPageHref(const wxString &aDestination)
Generate a href to a page in the current schematic.
Definition: eda_text.cpp:1004
A color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:104
const COLOR4D & GetLayerColor(int aLayer) const
Return the color used to draw a layer.
Store schematic specific render settings.
Definition: sch_painter.h:71
RENDER_SETTINGS * RenderSettings()
Definition: plotter.h:141
bool GetColorMode() const
Definition: plotter.h:138
virtual void HyperlinkMenu(const BOX2I &aBox, const std::vector< wxString > &aDestURLs)
Create a clickable hyperlink menu with a rectangular click area.
Definition: plotter.h:446
virtual void Rect(const VECTOR2I &p1, const VECTOR2I &p2, FILL_T fill, int width=USE_DEFAULT_LINE_WIDTH)=0
virtual void SetColor(const COLOR4D &color)=0
std::vector< SCH_FIELD > & GetFields()
Definition: sch_sheet.h:93
const BOX2I GetBoundingBox() const override
Return the orthogonal bounding box of this object for display purposes.
Definition: sch_sheet.cpp:679
KIGFX::COLOR4D GetBorderColor() const
Definition: sch_sheet.h:114
KIGFX::COLOR4D GetBackgroundColor() const
Definition: sch_sheet.h:117
@ FILLED_SHAPE
@ LAYER_SHEET_BACKGROUND
Definition: layer_ids.h:373

References FILLED_SHAPE, findSelf(), Format(), GetBackgroundColor(), GetBorderColor(), GetBoundingBox(), PLOTTER::GetColorMode(), GetFields(), KIGFX::RENDER_SETTINGS::GetLayerColor(), KIGFX::RENDER_SETTINGS::GetMinPenWidth(), GetPenWidth(), EDA_TEXT::GotoPageHref(), PLOTTER::HyperlinkMenu(), LAYER_SHEET, LAYER_SHEET_BACKGROUND, m_fields, KIGFX::SCH_RENDER_SETTINGS::m_OverrideItemColors, m_pins, m_pos, m_size, NO_FILL, PLOTTER::Rect(), PLOTTER::RenderSettings(), and PLOTTER::SetColor().

◆ Print()

void SCH_SHEET::Print ( const RENDER_SETTINGS aSettings,
const VECTOR2I aOffset 
)
overridevirtual

Print a schematic item.

Each schematic item should have its own method

Parameters
aOffsetis the drawing offset (usually {0,0} but can be different when moving an object).

Implements SCH_ITEM.

Definition at line 1138 of file sch_sheet.cpp.

1139{
1140 wxDC* DC = aSettings->GetPrintDC();
1141 VECTOR2I pos = m_pos + aOffset;
1142 int lineWidth = std::max( GetPenWidth(), aSettings->GetDefaultPenWidth() );
1143 const auto* settings = dynamic_cast<const KIGFX::SCH_RENDER_SETTINGS*>( aSettings );
1144 bool override = settings && settings->m_OverrideItemColors;
1145 COLOR4D border = GetBorderColor();
1146 COLOR4D background = GetBackgroundColor();
1147
1148 if( override || border == COLOR4D::UNSPECIFIED )
1149 border = aSettings->GetLayerColor( LAYER_SHEET );
1150
1151 if( override || background == COLOR4D::UNSPECIFIED )
1152 background = aSettings->GetLayerColor( LAYER_SHEET_BACKGROUND );
1153
1154 if( GetGRForceBlackPenState() ) // printing in black & white
1155 background = COLOR4D::UNSPECIFIED;
1156
1157 if( background != COLOR4D::UNSPECIFIED )
1158 GRFilledRect( DC, pos, pos + m_size, 0, background, background );
1159
1160 GRRect( DC, pos, pos + m_size, lineWidth, border );
1161
1162 for( SCH_FIELD& field : m_fields )
1163 field.Print( aSettings, aOffset );
1164
1165 for( SCH_SHEET_PIN* sheetPin : m_pins )
1166 sheetPin->Print( aSettings, aOffset );
1167}
int GetDefaultPenWidth() const
wxDC * GetPrintDC() const
void GRRect(wxDC *DC, const VECTOR2I &aStart, const VECTOR2I &aEnd, int aWidth, const COLOR4D &aColor)
Definition: gr_basic.cpp:387
void GRFilledRect(wxDC *DC, const VECTOR2I &aStart, const VECTOR2I &aEnd, int aWidth, const COLOR4D &aColor, const COLOR4D &aBgColor)
Definition: gr_basic.cpp:394
bool GetGRForceBlackPenState(void)
Definition: gr_basic.cpp:156

References GetBackgroundColor(), GetBorderColor(), KIGFX::RENDER_SETTINGS::GetDefaultPenWidth(), GetGRForceBlackPenState(), KIGFX::RENDER_SETTINGS::GetLayerColor(), GetPenWidth(), KIGFX::RENDER_SETTINGS::GetPrintDC(), GRFilledRect(), GRRect(), LAYER_SHEET, LAYER_SHEET_BACKGROUND, m_fields, KIGFX::SCH_RENDER_SETTINGS::m_OverrideItemColors, m_pins, m_pos, and m_size.

◆ PrintBackground()

virtual void SCH_ITEM::PrintBackground ( const RENDER_SETTINGS aSettings,
const VECTOR2I aOffset 
)
inlinevirtualinherited

Print the (optional) backaground elements if they exist.

Parameters
aSettingsPrint settings
aOffsetis the drawing offset (usually {0,0} but can be different when moving an object).

Reimplemented in SCH_SHAPE, and SCH_SYMBOL.

Definition at line 286 of file sch_item.h.

286{};

◆ RemovePin()

void SCH_SHEET::RemovePin ( const SCH_SHEET_PIN aSheetPin)

Remove aSheetPin from the sheet.

Parameters
aSheetPinThe sheet pin item to remove from the sheet.

Definition at line 376 of file sch_sheet.cpp.

377{
378 wxASSERT( aSheetPin != nullptr );
379 wxASSERT( aSheetPin->Type() == SCH_SHEET_PIN_T );
380
381 for( auto i = m_pins.begin(); i < m_pins.end(); ++i )
382 {
383 if( *i == aSheetPin )
384 {
385 m_pins.erase( i );
386 renumberPins();
387 return;
388 }
389 }
390}

References m_pins, renumberPins(), SCH_SHEET_PIN_T, and EDA_ITEM::Type().

Referenced by SCH_SCREEN::DeleteItem(), and SCH_EDIT_TOOL::DoDelete().

◆ RenderAsBitmap()

bool SCH_ITEM::RenderAsBitmap ( double  aWorldScale) const
overridevirtualinherited

Reimplemented from EDA_ITEM.

Definition at line 294 of file sch_item.cpp.

295{
296 if( IsHypertext() )
297 return false;
298
299 if( const EDA_TEXT* text = dynamic_cast<const EDA_TEXT*>( this ) )
300 return text->GetTextHeight() * aWorldScale < BITMAP_FONT_SIZE_THRESHOLD;
301
302 return false;
303}
virtual bool IsHypertext() const
Allow items to support hypertext actions when hovered/clicked.
Definition: sch_item.h:239
#define BITMAP_FONT_SIZE_THRESHOLD
Definition: sch_item.cpp:46

References BITMAP_FONT_SIZE_THRESHOLD, SCH_ITEM::IsHypertext(), and text.

Referenced by KIGFX::SCH_PAINTER::draw().

◆ renumberPins()

void SCH_SHEET::renumberPins ( )
protected

Renumber the sheet pins in the sheet.

This method is used internally by SCH_SHEET to update the pin numbering when the pin list changes. Make sure you call this method any time a sheet pin is added or removed.

Definition at line 935 of file sch_sheet.cpp.

936{
937 int id = 2;
938
939 for( SCH_SHEET_PIN* pin : m_pins )
940 {
941 pin->SetNumber( id );
942 id++;
943 }
944}

References m_pins, and pin.

Referenced by AddPin(), and RemovePin().

◆ Replace() [1/2]

virtual bool EDA_ITEM::Replace ( const EDA_SEARCH_DATA aSearchData,
void *  aAuxData = nullptr 
)
inlinevirtualinherited

Perform a text replace using the find and replace criteria in aSearchData on items that support text find and replace.

This function must be overridden for items that support text replace.

Parameters
aSearchDataA reference to a wxFindReplaceData object containing the search and replace criteria.
aAuxDataA pointer to optional data required for the search or NULL if not used.
Returns
True if the item text was modified, otherwise false.

Reimplemented in LIB_TEXTBOX, SCH_LABEL_BASE, SCH_PIN, SCH_TEXT, SCH_TEXTBOX, SCH_FIELD, and SCH_SHEET_PIN.

Definition at line 409 of file eda_item.h.

410 {
411 return false;
412 }

◆ Replace() [2/2]

bool EDA_ITEM::Replace ( const EDA_SEARCH_DATA aSearchData,
wxString &  aText 
)
staticinherited

Perform a text replace on aText using the find and replace criteria in aSearchData on items that support text find and replace.

Parameters
aSearchDataA reference to a wxFindReplaceData object containing the search and replace criteria.
aTextA reference to a wxString object containing the text to be replaced.
Returns
True if aText was modified, otherwise false.

Definition at line 168 of file eda_item.cpp.

169{
170 wxString text = aText;
171 wxString searchText = aSearchData.findString;
172 wxString result;
173 bool replaced = false;
174
175 if( !aSearchData.matchCase )
176 {
177 text = text.Upper();
178 searchText = searchText.Upper();
179 }
180
181 int ii = 0;
182
183 while( ii < (int) text.length() )
184 {
185 int next = text.find( searchText, ii );
186
187 if( next == wxNOT_FOUND )
188 {
189 result += aText.Mid( ii, wxString::npos );
190 break;
191 }
192
193 if( next > ii )
194 result += aText.Mid( ii, next - ii );
195
196 ii = next;
197 next += searchText.length();
198
199 bool startOK;
200 bool endOK;
201
203 {
204 startOK = ( ii == 0 || !wxIsalnum( text.GetChar( ii - 1 ) ) );
205 endOK = ( next == (int) text.length() || !wxIsalnum( text.GetChar( next ) ) );
206 }
207 else
208 {
209 startOK = true;
210 endOK = true;
211 }
212
213 if( startOK && endOK )
214 {
215 result += aSearchData.replaceString;
216 replaced = true;
217 ii = next;
218 }
219 else
220 {
221 result += aText.GetChar( ii );
222 ii++;
223 }
224 }
225
226 aText = result;
227 return replaced;
228}
wxString replaceString

References EDA_SEARCH_DATA::findString, EDA_SEARCH_DATA::matchCase, EDA_SEARCH_DATA::matchMode, next(), EDA_SEARCH_DATA::replaceString, text, and WHOLEWORD.

Referenced by EDA_TEXT::Replace(), SCH_FIELD::Replace(), SCH_FIND_REPLACE_TOOL::ReplaceAll(), and SCH_FIND_REPLACE_TOOL::ReplaceAndFindNext().

◆ Resize()

void SCH_SHEET::Resize ( const wxSize &  aSize)

Resize this sheet to aSize and adjust all of the labels accordingly.

Parameters
[in]aSizeThe new size for this sheet.

Definition at line 911 of file sch_sheet.cpp.

912{
913 if( aSize == m_size )
914 return;
915
916 m_size = aSize;
917
918 // Move the fields if we're in autoplace mode
920 AutoplaceFields( /* aScreen */ nullptr, /* aManual */ false );
921
922 // Move the sheet labels according to the new sheet size.
923 for( SCH_SHEET_PIN* sheetPin : m_pins )
924 sheetPin->ConstrainOnEdge( sheetPin->GetPosition() );
925}
void AutoplaceFields(SCH_SCREEN *aScreen, bool aManual) override
Definition: sch_sheet.cpp:602

References AutoplaceFields(), FIELDS_AUTOPLACED_AUTO, SCH_ITEM::m_fieldsAutoplaced, m_pins, and m_size.

Referenced by SCH_DRAWING_TOOLS::sizeSheet(), and EE_POINT_EDITOR::updateParentItem().

◆ ResolveTextVar()

bool SCH_SHEET::ResolveTextVar ( wxString *  token,
int  aDepth = 0 
) const

Resolve any references to system tokens supported by the sheet.

Parameters
aDepthis a counter to limit recursion and circular references.

Definition at line 233 of file sch_sheet.cpp.

234{
235 if( !Schematic() )
236 return false;
237
238 if( token->Contains( ':' ) )
239 {
240 if( Schematic()->ResolveCrossReference( token, aDepth + 1 ) )
241 return true;
242 }
243
244 for( int i = 0; i < SHEET_MANDATORY_FIELDS; ++i )
245 {
246 if( token->IsSameAs( m_fields[i].GetCanonicalName().Upper() ) )
247 {
248 *token = m_fields[i].GetShownText( aDepth + 1 );
249 return true;
250 }
251 }
252
253 for( size_t i = SHEET_MANDATORY_FIELDS; i < m_fields.size(); ++i )
254 {
255 if( token->IsSameAs( m_fields[i].GetName() ) )
256 {
257 *token = m_fields[i].GetShownText( aDepth + 1 );
258 return true;
259 }
260 }
261
262 PROJECT *project = &Schematic()->Prj();
263
264 // We cannot resolve text variables initially on load as we need to first load the screen and
265 // then parse the hierarchy. So skip the resolution if the screen isn't set yet
267 {
268 return true;
269 }
270
271 if( token->IsSameAs( wxT( "#" ) ) )
272 {
273 *token = wxString::Format( "%s", findSelf().GetPageNumber() );
274 return true;
275 }
276 else if( token->IsSameAs( wxT( "##" ) ) )
277 {
278 SCH_SHEET_LIST sheetList = Schematic()->GetSheets();
279 *token = wxString::Format( wxT( "%d" ), (int) sheetList.size() );
280 return true;
281 }
282 else if( token->IsSameAs( wxT( "SHEETPATH" ) ) )
283 {
284 *token = findSelf().PathHumanReadable();
285 return true;
286 }
287
288 // See if parent can resolve it (these will recurse to ancestors)
289
290 SCH_SHEET_PATH sheetPath = findSelf();
291
292 if( sheetPath.size() >= 2 )
293 {
294 sheetPath.pop_back();
295
296 if( sheetPath.Last()->ResolveTextVar( token, aDepth + 1 ) )
297 return true;
298 }
299 else
300 {
301 if( Schematic()->ResolveTextVar( token, aDepth + 1 ) )
302 return true;
303 }
304
305 return false;
306}
Container for project specific data.
Definition: project.h:64
SCH_SHEET_LIST GetSheets() const override
Builds and returns an updated schematic hierarchy TODO: can this be cached?
Definition: schematic.h:86
A container for handling SCH_SHEET_PATH objects in a flattened hierarchy.
wxString PathHumanReadable(bool aUseShortRootName=true, bool aStripTrailingSeparator=false) const
Return the sheet path in a human readable form made from the sheet names.
bool ResolveTextVar(wxString *token, int aDepth=0) const
Resolve any references to system tokens supported by the sheet.
Definition: sch_sheet.cpp:233
bool TextVarResolver(wxString *aToken, const PROJECT *aProject) const
Definition: title_block.cpp:95

References findSelf(), Format(), SCHEMATIC::GetSheets(), SCH_SCREEN::GetTitleBlock(), SCH_SHEET_PATH::Last(), m_fields, m_screen, SCH_SHEET_PATH::PathHumanReadable(), SCH_SHEET_PATH::pop_back(), SCHEMATIC::Prj(), project, ResolveTextVar(), SCH_ITEM::Schematic(), SHEET_MANDATORY_FIELDS, SCH_SHEET_PATH::size(), and TITLE_BLOCK::TextVarResolver().

Referenced by SCHEMATIC::ResolveCrossReference(), SCH_LABEL_BASE::ResolveTextVar(), and ResolveTextVar().

◆ Rotate()

void SCH_SHEET::Rotate ( const VECTOR2I aCenter)
overridevirtual

Rotate the item around aCenter 90 degrees in the clockwise direction.

Implements SCH_ITEM.

Definition at line 821 of file sch_sheet.cpp.

822{
823 VECTOR2I prev = m_pos;
824
825 RotatePoint( m_pos, aCenter, ANGLE_90 );
827
828 if( m_size.x < 0 )
829 {
830 m_pos.x += m_size.x;
831 m_size.x = -m_size.x;
832 }
833
834 if( m_size.y < 0 )
835 {
836 m_pos.y += m_size.y;
837 m_size.y = -m_size.y;
838 }
839
840 // Pins must be rotated first as that's how we determine vertical vs horizontal
841 // orientation for auto-placement
842 for( SCH_SHEET_PIN* sheetPin : m_pins )
843 sheetPin->Rotate( aCenter );
844
846 {
847 AutoplaceFields( /* aScreen */ nullptr, /* aManual */ false );
848 }
849 else
850 {
851 // Move the fields to the new position because the parent itself has moved.
852 for( SCH_FIELD& field : m_fields )
853 {
854 VECTOR2I pos = field.GetTextPos();
855 pos.x -= prev.x - m_pos.x;
856 pos.y -= prev.y - m_pos.y;
857 field.SetTextPos( pos );
858 }
859 }
860}
static constexpr EDA_ANGLE & ANGLE_90
Definition: eda_angle.h:414
void RotatePoint(int *pX, int *pY, const EDA_ANGLE &aAngle)
Definition: trigo.cpp:183

References ANGLE_90, AutoplaceFields(), FIELDS_AUTOPLACED_AUTO, m_fields, SCH_ITEM::m_fieldsAutoplaced, m_pins, m_pos, m_size, RotatePoint(), VECTOR2< T >::x, and VECTOR2< T >::y.

Referenced by SCH_EDIT_TOOL::Rotate().

◆ RunOnChildren()

void SCH_SHEET::RunOnChildren ( const std::function< void(SCH_ITEM *)> &  aFunction)
overridevirtual

Reimplemented from SCH_ITEM.

Definition at line 1039 of file sch_sheet.cpp.

1040{
1041 for( SCH_FIELD& field : m_fields )
1042 aFunction( &field );
1043
1044 for( SCH_SHEET_PIN* pin : m_pins )
1045 aFunction( pin );
1046}

References m_fields, m_pins, and pin.

◆ Schematic()

SCHEMATIC * SCH_ITEM::Schematic ( ) const
inherited

Searches the item hierarchy to find a SCHEMATIC.

Every SCH_ITEM that lives on a SCH_SCREEN should be parented to either that screen or another SCH_ITEM on the same screen (for example, pins to their symbols).

Every SCH_SCREEN should be parented to the SCHEMATIC.

Note
This hierarchy is not the same as the sheet hierarchy!
Returns
the parent schematic this item lives on, or nullptr.

Definition at line 112 of file sch_item.cpp.

113{
114 EDA_ITEM* parent = GetParent();
115
116 while( parent )
117 {
118 if( parent->Type() == SCHEMATIC_T )
119 return static_cast<SCHEMATIC*>( parent );
120 else
121 parent = parent->GetParent();
122 }
123
124 return nullptr;
125}
EDA_ITEM * GetParent() const
Definition: eda_item.h:99
@ SCHEMATIC_T
Definition: typeinfo.h:188

References EDA_ITEM::GetParent(), SCHEMATIC_T, and EDA_ITEM::Type().

Referenced by EE_SELECTION_TOOL::autostartEvent(), SCH_EDIT_TOOL::ChangeTextType(), SCH_ITEM::Connection(), SCH_DRAWING_TOOLS::createSheetPin(), DIALOG_SCH_FIELD_PROPERTIES::DIALOG_SCH_FIELD_PROPERTIES(), findSelf(), SCH_MARKER::GetColorLayer(), SCH_ITEM::GetEffectiveNetClass(), SCH_JUNCTION::getEffectiveShape(), SCH_LABEL_BASE::GetIntersheetRefs(), SCH_LABEL_BASE::GetLabelBoxExpansion(), SCH_DIRECTIVE_LABEL::GetPenWidth(), SCH_LINE::GetPenWidth(), SCH_NO_CONNECT::GetPenWidth(), SCH_SHAPE::GetPenWidth(), GetPenWidth(), SCH_SHEET_PIN::GetPenWidth(), SCH_SYMBOL::GetPins(), SCH_MARKER::GetSeverity(), SCH_FIELD::GetShownText(), SCH_TEXT::GetShownText(), SCH_TEXTBOX::GetShownText(), SCH_TEXT::GetTextOffset(), SCH_PIN::HitTest(), IsRootSheet(), SCH_LABEL_BASE::IsType(), DIALOG_SYMBOL_PROPERTIES::OnAddField(), DIALOG_SCH_FIELD_PROPERTIES::onScintillaCharAdded(), DIALOG_TEXT_PROPERTIES::onScintillaCharAdded(), SCH_LABEL_BASE::ResolveTextVar(), SCH_GLOBALLABEL::ResolveTextVar(), ResolveTextVar(), SCH_SYMBOL::ResolveTextVar(), SCH_SYMBOL::SetRef(), DIALOG_LABEL_PROPERTIES::TransferDataFromWindow(), DIALOG_LABEL_PROPERTIES::TransferDataToWindow(), SCH_SHEET_PATH::UpdateAllScreenReferences(), DIALOG_SCH_FIELD_PROPERTIES::UpdateField(), and SCH_MARKER::ViewGetLayers().

◆ SearchHierarchy()

bool SCH_SHEET::SearchHierarchy ( const wxString &  aFilename,
SCH_SCREEN **  aScreen 
)

Search the existing hierarchy for an instance of screen loaded from aFileName.

Parameters
aFilenameThe filename to find (MUST be absolute, and in wxPATH_NATIVE encoding).
aScreenA location to return a pointer to the screen (if found).
Returns
true if found, and a pointer to the screen

Definition at line 719 of file sch_sheet.cpp.

720{
721 if( m_screen )
722 {
723 // Only check the root sheet once and don't recurse.
724 if( !GetParent() )
725 {
726 if( m_screen && m_screen->GetFileName().Cmp( aFilename ) == 0 )
727 {
728 *aScreen = m_screen;
729 return true;
730 }
731 }
732
733 for( SCH_ITEM* aItem : m_screen->Items().OfType( SCH_SHEET_T ) )
734 {
735 SCH_SHEET* sheet = static_cast<SCH_SHEET*>( aItem );
736 SCH_SCREEN* screen = sheet->m_screen;
737
738 // Must use the screen's path (which is always absolute) rather than the
739 // sheet's (which could be relative).
740 if( screen && screen->GetFileName().Cmp( aFilename ) == 0 )
741 {
742 *aScreen = screen;
743 return true;
744 }
745
746 if( sheet->SearchHierarchy( aFilename, aScreen ) )
747 return true;
748 }
749 }
750
751 return false;
752}
const wxString & GetFileName() const
Definition: sch_screen.h:144
bool SearchHierarchy(const wxString &aFilename, SCH_SCREEN **aScreen)
Search the existing hierarchy for an instance of screen loaded from aFileName.
Definition: sch_sheet.cpp:719

References SCH_SCREEN::GetFileName(), EDA_ITEM::GetParent(), SCH_SCREEN::Items(), m_screen, EE_RTREE::OfType(), SCH_SHEET_T, and SearchHierarchy().

Referenced by SCH_SEXPR_PLUGIN::loadHierarchy(), SCH_LEGACY_PLUGIN::loadHierarchy(), DIALOG_SHEET_PROPERTIES::onSheetFilenameChanged(), SCH_ALTIUM_PLUGIN::ParseAltiumSch(), SCH_EDITOR_CONTROL::Paste(), and SearchHierarchy().

◆ Set() [1/3]

template<typename T >
bool INSPECTABLE::Set ( const wxString &  aProperty,
aValue 
)
inlineinherited

Definition at line 66 of file inspectable.h.

67 {
69 TYPE_ID thisType = TYPE_HASH( *this );
70 PROPERTY_BASE* prop = propMgr.GetProperty( thisType, aProperty );
71 void* object = nullptr;
72
73 if( prop )
74 {
75 object = propMgr.TypeCast( this, thisType, prop->OwnerHash() );
76
77 if( object )
78 prop->set<T>( object, aValue );
79 }
80
81 return object != nullptr;
82 }
void set(void *aObject, T aValue)
Definition: property.h:289

References PROPERTY_MANAGER::GetProperty(), PROPERTY_MANAGER::Instance(), PROPERTY_BASE::OwnerHash(), PROPERTY_BASE::set(), TYPE_HASH, and PROPERTY_MANAGER::TypeCast().

◆ Set() [2/3]

template<typename T >
bool INSPECTABLE::Set ( PROPERTY_BASE aProperty,
aValue 
)
inlineinherited

Definition at line 54 of file inspectable.h.

55 {
57 void* object = propMgr.TypeCast( this, TYPE_HASH( *this ), aProperty->OwnerHash() );
58
59 if( object )
60 aProperty->set<T>( object, aValue );
61
62 return object != nullptr;
63 }

References PROPERTY_MANAGER::Instance(), PROPERTY_BASE::OwnerHash(), PROPERTY_BASE::set(), TYPE_HASH, and PROPERTY_MANAGER::TypeCast().

◆ Set() [3/3]

bool INSPECTABLE::Set ( PROPERTY_BASE aProperty,
wxAny &  aValue 
)
inlineinherited

Definition at line 42 of file inspectable.h.

43 {
45 void* object = propMgr.TypeCast( this, TYPE_HASH( *this ), aProperty->OwnerHash() );
46
47 if( object )
48 aProperty->setter( object, aValue );
49
50 return object != nullptr;
51 }
virtual void setter(void *aObject, wxAny &aValue)=0

References PROPERTY_MANAGER::Instance(), PROPERTY_BASE::OwnerHash(), PROPERTY_BASE::setter(), TYPE_HASH, and PROPERTY_MANAGER::TypeCast().

Referenced by PCB_PROPERTIES_PANEL::valueChanged().

◆ SetBackgroundColor()

◆ SetBorderColor()

◆ SetBorderWidth()

void SCH_SHEET::SetBorderWidth ( int  aWidth)
inline

◆ SetBrightened()

◆ SetConnectivityDirty()

◆ SetFields()

void SCH_SHEET::SetFields ( const std::vector< SCH_FIELD > &  aFields)

Set multiple schematic fields.

Parameters
aFieldsare the fields to set in this symbol.

Definition at line 343 of file sch_sheet.cpp.

344{
345 m_fields = aFields;
346 int next_id = SHEET_MANDATORY_FIELDS;
347
348 for( int ii = 0; ii < int( m_fields.size() ); )
349 {
350 if( m_fields[ii].GetId() < 0 || m_fields[ii].GetId() >= ssize_t( m_fields.size() ) )
351 m_fields[ii].SetId( next_id++ );
352
353 if( m_fields[ii].GetId() != ii )
354 std::swap( m_fields[ii], m_fields[m_fields[ii].GetId()]);
355
356 if( m_fields[ii].GetId() == ii )
357 ++ii;
358 }
359
360 // Make sure that we get the UNIX variant of the file path
362}
void SetFileName(const wxString &aFilename)
Definition: sch_sheet.h:308

References EDA_UNIT_UTILS::GetText(), m_fields, SetFileName(), SHEET_MANDATORY_FIELDS, and SHEETFILENAME.

Referenced by CADSTAR_SCH_ARCHIVE_LOADER::loadChildSheets(), DIALOG_SHEET_PROPERTIES::OnUpdateUI(), and DIALOG_SHEET_PROPERTIES::TransferDataFromWindow().

◆ SetFieldsAutoplaced()

void SCH_ITEM::SetFieldsAutoplaced ( )
inlineinherited

◆ SetFileName()

void SCH_SHEET::SetFileName ( const wxString &  aFilename)
inline

Definition at line 308 of file sch_sheet.h.

309 {
310 // Filenames are stored using unix notation
311 wxString tmp = aFilename;
312 tmp.Replace( wxT( "\\" ), wxT( "/" ) );
313 m_fields[ SHEETFILENAME ].SetText( tmp );
314 }

References m_fields, and SHEETFILENAME.

Referenced by SCH_EDIT_FRAME::importFile(), SCH_ALTIUM_PLUGIN::Load(), CADSTAR_SCH_ARCHIVE_PLUGIN::Load(), SCH_EAGLE_PLUGIN::Load(), SCH_EDIT_FRAME::LoadSheetFromFile(), SCH_SHEET_PATH::MakeFilePathRelativeToParentSheet(), SCH_ALTIUM_PLUGIN::ParseAltiumSch(), SCH_EDIT_FRAME::SaveProject(), and SetFields().

◆ SetFlags()

void EDA_ITEM::SetFlags ( EDA_ITEM_FLAGS  aMask)
inlineinherited

Definition at line 139 of file eda_item.h.

139{ m_flags |= aMask; }

References EDA_ITEM::m_flags.

Referenced by SCH_EAGLE_PLUGIN::addBusEntries(), PCB_BASE_FRAME::AddFootprintToBoard(), FOOTPRINT_VIEWER_FRAME::AddFootprintToPCB(), SCH_ALTIUM_PLUGIN::AddTextBox(), SCH_MOVE_TOOL::AlignElements(), PCB_CONTROL::AppendBoard(), SCH_EDIT_FRAME::BreakSegment(), SCH_EDIT_TOOL::BreakWire(), FOOTPRINT::BuildCourtyardCaches(), SCH_EDIT_TOOL::ChangeTextType(), GRAPHICS_CLEANER::cleanupShapes(), ConvertOutlineToPolygon(), SCH_EDIT_FRAME::ConvertPart(), SCH_DRAWING_TOOLS::createNewText(), SCH_DRAWING_TOOLS::createSheetPin(), SCH_EDIT_TOOL::DoDelete(), SCH_LINE_WIRE_BUS_TOOL::doDrawSegments(), PCBNEW_JOBS_HANDLER::doFpExportSvg(), PCB_TOOL_BASE::doInteractiveItemPlacement(), SCH_LINE_WIRE_BUS_TOOL::doUnfoldBus(), EDIT_TOOL::DragArcTrack(), KIGFX::SCH_PAINTER::draw(), DRAWING_TOOL::DrawArc(), DRAWING_TOOL::DrawCircle(), DRAWING_TOOL::DrawLine(), DRAWING_TOOL::DrawRectangle(), SCH_DRAWING_TOOLS::DrawShape(), SYMBOL_EDITOR_DRAWING_TOOLS::DrawShape(), SCH_DRAWING_TOOLS::DrawSheet(), SYMBOL_EDITOR_EDIT_TOOL::Duplicate(), PCB_SELECTION_TOOL::EnterGroup(), PAD_TOOL::explodePad(), SCH_MOVE_TOOL::getConnectedDragItems(), SYMBOL_EDIT_FRAME::GetSymbolFromRedoList(), SYMBOL_EDIT_FRAME::GetSymbolFromUndoList(), EE_COLLECTOR::Inspect(), CONVERT_TOOL::makePolysFromChainedSegs(), CONVERT_TOOL::makePolysFromClosedGraphics(), CONVERT_TOOL::makePolysFromOpenGraphics(), SCH_SCREEN::MarkConnections(), TRACKS_CLEANER::mergeCollinearSegments(), SCH_MOVE_TOOL::moveItem(), SYMBOL_EDITOR_MOVE_TOOL::moveItem(), DIALOG_SYMBOL_PROPERTIES::OnUnitChoice(), KIGFX::ORIGIN_VIEWITEM::ORIGIN_VIEWITEM(), SCH_MOVE_TOOL::orthoLineDrag(), SCH_ALTIUM_PLUGIN::ParseBezier(), SCH_ALTIUM_PLUGIN::ParseBus(), SCH_ALTIUM_PLUGIN::ParseBusEntry(), SCH_ALTIUM_PLUGIN::ParseHarnessPort(), SCH_ALTIUM_PLUGIN::ParseJunction(), SCH_ALTIUM_PLUGIN::ParseLabel(), SCH_ALTIUM_PLUGIN::ParseLine(), SCH_ALTIUM_PLUGIN::ParseNetLabel(), SCH_ALTIUM_PLUGIN::ParseNoERC(), SCH_ALTIUM_PLUGIN::ParsePolygon(), SCH_ALTIUM_PLUGIN::ParsePolyline(), SCH_ALTIUM_PLUGIN::ParsePort(), SCH_ALTIUM_PLUGIN::ParseRectangle(), SCH_ALTIUM_PLUGIN::ParseRoundRectangle(), SCH_ALTIUM_PLUGIN::ParseSheetSymbol(), SCH_ALTIUM_PLUGIN::ParseSignalHarness(), SCH_ALTIUM_PLUGIN::ParseWire(), SCH_EDITOR_CONTROL::Paste(), SYMBOL_EDITOR_EDIT_TOOL::Paste(), BOARD_EDITOR_CONTROL::PlaceFootprint(), PL_DRAWING_TOOLS::PlaceItem(), DRAWING_TOOL::PlaceText(), SCH_SYMBOL::Plot(), BACK_ANNOTATE::processNetNameChange(), SCH_EDIT_FRAME::PutDataInPreviousState(), PCB_SELECTION_TOOL::RebuildSelection(), BOARD::Remove(), FOOTPRINT::Remove(), SCH_EDIT_TOOL::RepeatDrawItem(), SCH_EDIT_TOOL::Rotate(), SYMBOL_EDIT_FRAME::SaveCopyInUndoList(), EE_SELECTION_TOOL::SelectAll(), EE_SELECTION_TOOL::selectMultiple(), SCH_EDIT_FRAME::SelectUnit(), EDA_ITEM::SetBrightened(), EDA_ITEM::SetIsShownAsBitmap(), EDA_ITEM::SetModified(), EDA_ITEM::SetSelected(), SCH_DRAWING_TOOLS::SingleClickPlace(), BOARD_COMMIT::Stage(), SCH_LINE_WIRE_BUS_TOOL::startSegments(), DS_DATA_ITEM::SyncDrawItems(), DS_DATA_ITEM_BITMAP::SyncDrawItems(), DIALOG_SYMBOL_PROPERTIES::TransferDataFromWindow(), DIALOG_DIMENSION_PROPERTIES::TransferDataFromWindow(), DIALOG_TARGET_PROPERTIES::TransferDataFromWindow(), DIALOG_TEXTBOX_PROPERTIES::TransferDataFromWindow(), SCH_DRAWING_TOOLS::TwoClickPlace(), and SYMBOL_EDITOR_DRAWING_TOOLS::TwoClickPlace().

◆ SetForceVisible()

void EDA_ITEM::SetForceVisible ( bool  aEnable)
inlineinherited

Set and clear force visible flag used to force the item to be drawn even if it's draw attribute is set to not visible.

Parameters
aEnableTrue forces the item to be drawn. False uses the item's visibility setting to determine if the item is to be drawn.

Definition at line 199 of file eda_item.h.

199{ m_forceVisible = aEnable; }

References EDA_ITEM::m_forceVisible.

Referenced by SCH_FIND_REPLACE_TOOL::FindNext(), and SCH_FIND_REPLACE_TOOL::UpdateFind().

◆ setInstances()

void SCH_SHEET::setInstances ( const std::vector< SCH_SHEET_INSTANCE > &  aInstances)
inlineprotected

Definition at line 421 of file sch_sheet.h.

422 {
423 m_instances = aInstances;
424 }

References m_instances.

◆ SetIsShownAsBitmap()

void EDA_ITEM::SetIsShownAsBitmap ( bool  aBitmap)
inlineinherited

Definition at line 165 of file eda_item.h.

166 {
167 if( aBitmap )
169 else
171 }

References EDA_ITEM::ClearFlags(), IS_SHOWN_AS_BITMAP, and EDA_ITEM::SetFlags().

◆ SetLastResolvedState()

virtual void SCH_ITEM::SetLastResolvedState ( const SCH_ITEM aItem)
inlinevirtualinherited

Reimplemented in SCH_BUS_ENTRY_BASE, SCH_FIELD, SCH_JUNCTION, SCH_LABEL_BASE, and SCH_LINE.

Definition at line 417 of file sch_item.h.

417{ }

Referenced by SCH_EDITOR_CONTROL::Paste().

◆ SetLayer()

◆ SetLocked()

virtual void SCH_ITEM::SetLocked ( bool  aLocked)
inlinevirtualinherited

Set the 'lock' status to aLocked for of this item.

Definition at line 234 of file sch_item.h.

234{}

◆ SetModified()

◆ SetName()

void SCH_SHEET::SetName ( const wxString &  aName)
inline

Definition at line 104 of file sch_sheet.h.

104{ m_fields[ SHEETNAME ].SetText( aName ); }

References m_fields, and SHEETNAME.

Referenced by SCH_ALTIUM_PLUGIN::ParseAltiumSch().

◆ setPageNumber()

void SCH_SHEET::setPageNumber ( const SCH_SHEET_PATH aInstance,
const wxString &  aPageNumber 
)
protected

Set the page number for the sheet instance aInstance.

Warning
The SCH_SHEET_PATH object must be a full hierarchical path which means the SCH_SHEET object at index 0 must be the root sheet. A partial sheet path will raise an assertion on debug builds and silently fail and return on release builds.
Parameters
[in]aInstanceis the hierarchical path of the sheet.
[in]aReferenceis the new page number for the sheet.

Definition at line 1316 of file sch_sheet.cpp.

1317{
1318 wxCHECK( aSheetPath.IsFullPath(), /* void */ );
1319 wxCHECK( !aSheetPath.Last() || ( aSheetPath.Last()->m_Uuid != m_Uuid ), /* void */ );
1320
1321 KIID_PATH path = aSheetPath.Path();
1322
1323 for( SCH_SHEET_INSTANCE& instance : m_instances )
1324 {
1325 if( instance.m_Path == path )
1326 {
1327 instance.m_PageNumber = aPageNumber;
1328 break;
1329 }
1330 }
1331}

References SCH_SHEET_PATH::IsFullPath(), SCH_SHEET_PATH::Last(), m_instances, EDA_ITEM::m_Uuid, SCH_SHEET_PATH::Path(), and path.

Referenced by SCH_SHEET_PATH::SetPageNumber().

◆ SetParent()

virtual void EDA_ITEM::SetParent ( EDA_ITEM aParent)
inlinevirtualinherited

Reimplemented in LIB_SYMBOL, and PCB_DIMENSION_BASE.

Definition at line 100 of file eda_item.h.

100{ m_parent = aParent; }

References EDA_ITEM::m_parent.

Referenced by BOARD::Add(), FOOTPRINT::Add(), FOOTPRINT_VIEWER_FRAME::AddFootprintToPCB(), BOARD_NETLIST_UPDATER::addNewFootprint(), AddPin(), PAD::AddPrimitive(), PAD::AddPrimitiveAnnotationBox(), PAD::AddPrimitiveArc(), PAD::AddPrimitiveCircle(), PAD::AddPrimitiveCurve(), PAD::AddPrimitivePoly(), PAD::AddPrimitiveRect(), PAD::AddPrimitiveSegment(), SYMBOL_EDITOR_CONTROL::AddSymbolToSchematic(), SCH_SCREEN::Append(), LIB_FIELD::Copy(), SYMBOL_EDIT_FRAME::CreateNewSymbol(), SCH_DRAWING_TOOLS::createNewText(), DIALOG_PAD_PROPERTIES::DIALOG_PAD_PROPERTIES(), DIALOG_PIN_PROPERTIES::DIALOG_PIN_PROPERTIES(), PCBNEW_JOBS_HANDLER::doFpExportSvg(), SCH_LINE_WIRE_BUS_TOOL::doUnfoldBus(), SYMBOL_EDITOR_DRAWING_TOOLS::DrawShape(), SYMBOL_EDITOR_EDIT_TOOL::Duplicate(), PCB_EDIT_FRAME::ExchangeFootprint(), LIB_SYMBOL::Flatten(), FOOTPRINT::FOOTPRINT(), PCB_PLUGIN::FootprintSave(), DISPLAY_FOOTPRINTS_FRAME::GetFootprint(), CADSTAR_SCH_ARCHIVE_LOADER::getKiCadSchText(), LIB_SYMBOL::LIB_SYMBOL(), SCH_LEGACY_PLUGIN_CACHE::loadAliases(), CADSTAR_SCH_ARCHIVE_LOADER::loadChildSheets(), FOOTPRINT_EDIT_FRAME::LoadFootprintFromBoard(), SCH_SEXPR_PLUGIN::loadHierarchy(), SCH_LEGACY_PLUGIN::loadHierarchy(), KI_TEST::LoadHierarchy(), LIB_SYMBOL::operator=(), FOOTPRINT::operator=(), PCB_PARSER::parseFOOTPRINT_unchecked(), SCH_SEXPR_PARSER::ParseSchematic(), SCH_SEXPR_PARSER::ParseSymbol(), SCH_EDITOR_CONTROL::Paste(), SYMBOL_EDITOR_EDIT_TOOL::Paste(), PCB_CONTROL::Paste(), pasteFootprintItemsToFootprintEditor(), BOARD_EDITOR_CONTROL::PlaceFootprint(), BACK_ANNOTATE::processNetNameChange(), BOARD_COMMIT::Push(), SCH_LIB_PLUGIN_CACHE::removeSymbol(), PCB_BASE_EDIT_FRAME::saveCopyInUndoList(), SaveCopyOfZones(), FOOTPRINT_EDIT_FRAME::SaveFootprintToBoard(), CLIPBOARD_IO::SaveSelection(), SCH_SHEET_PIN::SCH_SHEET_PIN(), LIB_SYMBOL::SetFields(), PCB_DIMENSION_BASE::SetParent(), SCH_DRAWING_TOOLS::SingleClickPlace(), SCH_LINE_WIRE_BUS_TOOL::startSegments(), SCH_LABEL_BASE::SwapData(), SwapData(), SCH_SYMBOL::SwapData(), BOARD_ITEM::SwapItemData(), DIALOG_SYMBOL_PROPERTIES::TransferDataFromWindow(), and SCH_DRAWING_TOOLS::TwoClickPlace().

◆ SetPosition()

void SCH_SHEET::SetPosition ( const VECTOR2I aPosition)
overridevirtual

Reimplemented from EDA_ITEM.

Definition at line 903 of file sch_sheet.cpp.

904{
905 // Remember the sheet and all pin sheet positions must be
906 // modified. So use Move function to do that.
907 Move( aPosition - m_pos );
908}
void Move(const VECTOR2I &aMoveVector) override
Move the item by aMoveVector to a new position.
Definition: sch_sheet.cpp:809

References m_pos, and Move().

Referenced by TEST_EE_ITEM_FIXTURE::TEST_EE_ITEM_FIXTURE(), and EE_POINT_EDITOR::updateParentItem().

◆ SetScreen()

void SCH_SHEET::SetScreen ( SCH_SCREEN aScreen)

Set the SCH_SCREEN associated with this sheet to aScreen.

The screen reference counting is performed by SetScreen. If aScreen is not the same as the current screen, the current screen reference count is decremented and aScreen becomes the screen for the sheet. If the current screen reference count reaches zero, the current screen is deleted. NULL is a valid value for aScreen.

Parameters
aScreenThe new screen to associate with the sheet.

Definition at line 162 of file sch_sheet.cpp.

163{
164 if( aScreen == m_screen )
165 return;
166
167 if( m_screen != nullptr )
168 {
170
171 if( m_screen->GetRefCount() == 0 )
172 {
173 delete m_screen;
174 m_screen = nullptr;
175 }
176 }
177
178 m_screen = aScreen;
179
180 if( m_screen )
182}

References SCH_SCREEN::DecRefCount(), SCH_SCREEN::GetRefCount(), SCH_SCREEN::IncRefCount(), and m_screen.

Referenced by SCH_EDIT_FRAME::CreateScreens(), SCH_DRAWING_TOOLS::DrawSheet(), SCH_EDIT_FRAME::InitSheet(), SCH_ALTIUM_PLUGIN::Load(), CADSTAR_SCH_ARCHIVE_PLUGIN::Load(), SCH_EAGLE_PLUGIN::Load(), SCH_SEXPR_PLUGIN::loadHierarchy(), SCH_LEGACY_PLUGIN::loadHierarchy(), KI_TEST::LoadHierarchy(), CADSTAR_SCH_ARCHIVE_LOADER::loadSheetAndChildSheets(), SCH_EDIT_FRAME::LoadSheetFromFile(), DIALOG_SHEET_PROPERTIES::onSheetFilenameChanged(), SCH_ALTIUM_PLUGIN::ParseAltiumSch(), SCH_ALTIUM_PLUGIN::ParseHarnessConnector(), and SCH_EDITOR_CONTROL::Paste().

◆ SetSelected()

◆ SetSize()

void SCH_SHEET::SetSize ( const wxSize &  aSize)
inline

Definition at line 109 of file sch_sheet.h.

109{ m_size = aSize; }

References m_size.

Referenced by SCH_MOVE_TOOL::AlignElements(), and TEST_EE_ITEM_FIXTURE::TEST_EE_ITEM_FIXTURE().

◆ SetState()

void EDA_ITEM::SetState ( EDA_ITEM_FLAGS  type,
bool  state 
)
inlineinherited

Definition at line 128 of file eda_item.h.

129 {
130 if( state )
131 m_status |= type; // state = ON or OFF
132 else
133 m_status &= ~type;
134 }

References EDA_ITEM::m_status.

Referenced by LEGACY_PLUGIN::loadTrackList(), and TRACKS_CLEANER::mergeCollinearSegments().

◆ SetStatus()

void EDA_ITEM::SetStatus ( EDA_ITEM_FLAGS  aStatus)
inlineinherited

Definition at line 137 of file eda_item.h.

137{ m_status = aStatus; }

References EDA_ITEM::m_status.

Referenced by BOARD_NETLIST_UPDATER::UpdateNetlist().

◆ SetStoredPos()

void SCH_ITEM::SetStoredPos ( const VECTOR2I aPos)
inlineinherited

Definition at line 210 of file sch_item.h.

210{ m_storedPos = aPos; }

References SCH_ITEM::m_storedPos.

Referenced by SCH_MOVE_TOOL::Main().

◆ SetStroke()

virtual void SCH_ITEM::SetStroke ( const STROKE_PARAMS aStroke)
inlinevirtualinherited

Reimplemented in SCH_BUS_ENTRY_BASE, SCH_LINE, and SCH_SHAPE.

Definition at line 459 of file sch_item.h.

459{ wxCHECK( false, /* void */ ); }

Referenced by DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::processItem().

◆ Sort()

static bool EDA_ITEM::Sort ( const EDA_ITEM aLeft,
const EDA_ITEM aRight 
)
inlinestaticinherited

Helper function to be used by the C++ STL sort algorithm for sorting a STL container of EDA_ITEM pointers.

Parameters
aLeftThe left hand item to compare.
aRightThe right hand item to compare.
Returns
True if aLeft is less than aRight.

Definition at line 438 of file eda_item.h.

438{ return *aLeft < *aRight; }

◆ SwapData()

void SCH_SHEET::SwapData ( SCH_ITEM aItem)
overridevirtual

Swap the internal data structures aItem with the schematic item.

Obviously, aItem must have the same type than me.

Parameters
aItemThe item to swap the data structures with.

Reimplemented from SCH_ITEM.

Definition at line 309 of file sch_sheet.cpp.

310{
311 wxCHECK_RET( aItem->Type() == SCH_SHEET_T,
312 wxString::Format( wxT( "SCH_SHEET object cannot swap data with %s object." ),
313 aItem->GetClass() ) );
314
315 SCH_SHEET* sheet = ( SCH_SHEET* ) aItem;
316
317 std::swap( m_pos, sheet->m_pos );
318 std::swap( m_size, sheet->m_size );
319 m_fields.swap( sheet->m_fields );
320 std::swap( m_fieldsAutoplaced, sheet->m_fieldsAutoplaced );
321 m_pins.swap( sheet->m_pins );
322
323 // Update parent pointers after swapping.
324 for( SCH_SHEET_PIN* sheetPin : m_pins )
325 sheetPin->SetParent( this );
326
327 for( SCH_SHEET_PIN* sheetPin : sheet->m_pins )
328 sheetPin->SetParent( sheet );
329
330 for( SCH_FIELD& field : m_fields )
331 field.SetParent( this );
332
333 for( SCH_FIELD& field : sheet->m_fields )
334 field.SetParent( sheet );
335
336 std::swap( m_borderWidth, sheet->m_borderWidth );
337 std::swap( m_borderColor, sheet->m_borderColor );
338 std::swap( m_backgroundColor, sheet->m_backgroundColor );
339 std::swap( m_instances, sheet->m_instances );
340}
virtual wxString GetClass() const override
Return the class name.
Definition: sch_item.h:157

References Format(), SCH_ITEM::GetClass(), m_backgroundColor, m_borderColor, m_borderWidth, m_fields, SCH_ITEM::m_fieldsAutoplaced, m_instances, m_pins, m_pos, m_size, SCH_SHEET_T, EDA_ITEM::SetParent(), and EDA_ITEM::Type().

◆ SymbolCount()

int SCH_SHEET::SymbolCount ( ) const

Count our own symbols, without the power symbols.

Definition at line 697 of file sch_sheet.cpp.

698{
699 int n = 0;
700
701 if( m_screen )
702 {
703 for( SCH_ITEM* aItem : m_screen->Items().OfType( SCH_SYMBOL_T ) )
704 {
705 SCH_SYMBOL* symbol = (SCH_SYMBOL*) aItem;
706
707 if( symbol->GetField( VALUE_FIELD )->GetText().GetChar( 0 ) != '#' )
708 n++;
709 }
710
711 for( SCH_ITEM* aItem : m_screen->Items().OfType( SCH_SHEET_T ) )
712 n += static_cast<const SCH_SHEET*>( aItem )->SymbolCount();
713 }
714
715 return n;
716}
int SymbolCount() const
Count our own symbols, without the power symbols.
Definition: sch_sheet.cpp:697
Schematic symbol object.
Definition: sch_symbol.h:81
SCH_FIELD * GetField(MANDATORY_FIELD_T aFieldType)
Return a mandatory field in this symbol.
Definition: sch_symbol.cpp:843
@ VALUE_FIELD
Field Value of part, i.e. "3.3K".

References SCH_SYMBOL::GetField(), EDA_TEXT::GetText(), SCH_SCREEN::Items(), m_screen, EE_RTREE::OfType(), SCH_SHEET_T, SCH_SYMBOL_T, SymbolCount(), and VALUE_FIELD.

Referenced by SymbolCount().

◆ Type()

KICAD_T EDA_ITEM::Type ( ) const
inlineinherited

Returns the type of object.

This attribute should never be changed after a ctor sets it, so there is no public "setter" method.

Returns
the type of object.

Definition at line 97 of file eda_item.h.

97{ return m_structType; }
KICAD_T m_structType
Run time identification, keep private so it can never be changed after a ctor sets it.
Definition: eda_item.h:505

References EDA_ITEM::m_structType.

Referenced by CN_CONNECTIVITY_ALGO::Add(), BOARD::Add(), FOOTPRINT::Add(), CN_CLUSTER::Add(), KIGFX::PCB_VIEW::Add(), PCB_POINT_EDITOR::addCorner(), PCB_GROUP::AddItem(), CONNECTION_SUBGRAPH::AddItem(), DRC_TEST_PROVIDER_SOLDER_MASK::addItemToRTrees(), SCH_EDIT_FRAME::AddItemToScreenAndUndoList(), ZONE_FILLER::addKnockout(), AddPin(), ALIGN_DISTRIBUTE_TOOL::AlignBottom(), ALIGN_DISTRIBUTE_TOOL::AlignCenterX(), ALIGN_DISTRIBUTE_TOOL::AlignCenterY(), SCH_MOVE_TOOL::AlignElements(), ALIGN_DISTRIBUTE_TOOL::AlignTop(), CN_ITEM::AnchorCount(), SCH_SCREEN::Append(), CADSTAR_SCH_ARCHIVE_LOADER::applyTextSettings(), PNS::TOPOLOGY::AssembleTuningPath(), SCH_LABEL_BASE::AutoplaceFields(), EE_SELECTION_TOOL::autostartEvent(), DIALOG_NET_INSPECTOR::buildNewItem(), SCH_SCREENS::buildScreenList(), BOARD_INSPECTION_TOOL::calculateSelectionRatsnest(), PCB_POINT_EDITOR::canAddCorner(), SCH_BUS_WIRE_ENTRY::CanConnect(), SCH_BUS_BUS_ENTRY::CanConnect(), SCH_JUNCTION::CanConnect(), SCH_LABEL_BASE::CanConnect(), SCH_LINE::CanConnect(), SCH_NO_CONNECT::CanConnect(), CanConnect(), SCH_SYMBOL::CanConnect(), SCH_EDIT_TOOL::ChangeTextType(), KI_TEST::CheckFootprint(), KI_TEST::CheckFpShape(), KI_TEST::CheckFpZone(), CN_VISITOR::checkZoneItemConnection(), LIB_TEXTBOX::ClassOf(), SCH_BITMAP::ClassOf(), SCH_BUS_WIRE_ENTRY::ClassOf(), SCH_BUS_BUS_ENTRY::ClassOf(), SCH_FIELD::ClassOf(), SCH_JUNCTION::ClassOf(), SCH_LABEL::ClassOf(), SCH_DIRECTIVE_LABEL::ClassOf(), SCH_GLOBALLABEL::ClassOf(), SCH_HIERLABEL::ClassOf(), SCH_LINE::ClassOf(), SCH_MARKER::ClassOf(), SCH_NO_CONNECT::ClassOf(), SCH_PIN::ClassOf(), SCH_SCREEN::ClassOf(), ClassOf(), SCH_SHEET_PIN::ClassOf(), SCH_SYMBOL::ClassOf(), SCH_TEXT::ClassOf(), SCH_TEXTBOX::ClassOf(), PCB_GROUP::ClassOf(), BOARD::ClassOf(), BOARD_CONNECTED_ITEM::ClassOf(), FOOTPRINT::ClassOf(), FP_SHAPE::ClassOf(), FP_TEXT::ClassOf(), FP_TEXTBOX::ClassOf(), NETINFO_ITEM::ClassOf(), PAD::ClassOf(), PCB_BITMAP::ClassOf(), PCB_DIM_ALIGNED::ClassOf(), PCB_DIM_ORTHOGONAL::ClassOf(), PCB_DIM_RADIAL::ClassOf(), PCB_DIM_LEADER::ClassOf(), PCB_DIM_CENTER::ClassOf(), PCB_MARKER::ClassOf(), PCB_SHAPE::ClassOf(), PCB_TARGET::ClassOf(), PCB_TEXT::ClassOf(), PCB_TEXTBOX::ClassOf(), PCB_TRACK::ClassOf(), PCB_ARC::ClassOf(), PCB_VIA::ClassOf(), ZONE::ClassOf(), CONNECTION_GRAPH::collectAllDriverValues(), collidesWithArea(), LIB_ITEM::compare(), LIB_FIELD::compare(), LIB_PIN::compare(), LIB_TEXT::compare(), LIB_TEXTBOX::compare(), LIB_SYMBOL::Compare(), PCB_GRID_HELPER::computeAnchors(), EE_GRID_HELPER::computeAnchors(), TEARDROP_MANAGER::ComputePointsOnPadVia(), SCH_BUS_WIRE_ENTRY::ConnectionPropagatesTo(), SCH_LINE::ConnectionPropagatesTo(), EE_RTREE::contains(), BOARD::ConvertKIIDsToCrossReferences(), SCHEMATIC::ConvertKIIDsToRefs(), PAD_TOOL::copyPadSettings(), FOOTPRINT::CoverageRatio(), BOARD_ADAPTER::createLayers(), PCB_BASE_FRAME::CreateNewFootprint(), SCH_DRAWING_TOOLS::createNewText(), ZONE_CREATE_HELPER::createNewZone(), BOARD_ADAPTER::createTrack(), DRC_TOOL::CrossProbe(), SCH_SCREEN::DeleteItem(), DIALOG_DIMENSION_PROPERTIES::DIALOG_DIMENSION_PROPERTIES(), DIALOG_LABEL_PROPERTIES::DIALOG_LABEL_PROPERTIES(), DIALOG_SCH_FIELD_PROPERTIES::DIALOG_SCH_FIELD_PROPERTIES(), DIALOG_TEXT_PROPERTIES::DIALOG_TEXT_PROPERTIES(), DIALOG_TEXTBOX_PROPERTIES::DIALOG_TEXTBOX_PROPERTIES(), BOARD_COMMIT::dirtyIntersectingZones(), ALIGN_DISTRIBUTE_TOOL::doAlignLeft(), ALIGN_DISTRIBUTE_TOOL::doAlignRight(), SCH_EDITOR_CONTROL::doCopy(), SCH_EDIT_TOOL::DoDelete(), ALIGN_DISTRIBUTE_TOOL::doDistributeCentersHorizontally(), ALIGN_DISTRIBUTE_TOOL::doDistributeCentersVertically(), ALIGN_DISTRIBUTE_TOOL::doDistributeGapsHorizontally(), ALIGN_DISTRIBUTE_TOOL::doDistributeGapsVertically(), APPEARANCE_CONTROLS::doesBoardItemNeedRebuild(), DIALOG_GLOBAL_DELETION::DoGlobalDeletions(), EDIT_TOOL::doMoveSelection(), EDIT_TOOL::DragArcTrack(), KIGFX::SCH_PAINTER::draw(), KIGFX::PCB_PAINTER::Draw(), DRAWING_TOOL::DrawDimension(), SCH_DRAWING_TOOLS::DrawSheet(), DRAWING_TOOL::DrawVia(), CONNECTION_SUBGRAPH::driverName(), CN_ITEM::Dump(), SYMBOL_EDITOR_EDIT_TOOL::Duplicate(), EDIT_TOOL::Duplicate(), FOOTPRINT::DuplicateItem(), EDA_ITEM_DESC::EDA_ITEM_DESC(), SCH_EDIT_TOOL::EditField(), SCH_EDIT_TOOL::editFieldText(), SYMBOL_EDITOR_EDIT_TOOL::editTextBoxProperties(), SYMBOL_EDITOR_EDIT_TOOL::editTextProperties(), CONNECTION_GRAPH::ercCheckBusToBusConflicts(), CONNECTION_GRAPH::ercCheckBusToBusEntryConflicts(), CONNECTION_GRAPH::ercCheckBusToNetConflicts(), CONNECTION_GRAPH::ercCheckFloatingWires(), CONNECTION_GRAPH::ercCheckLabels(), CONNECTION_GRAPH::ercCheckMultipleDrivers(), CONNECTION_GRAPH::ercCheckNoConnects(), DRC_ENGINE::EvalRules(), DRC_ENGINE::EvalZoneConnection(), EDIT_TOOL::FilletTracks(), PCB_SELECTION_TOOL::FilterCollectorForFreePads(), PCB_SELECTION_TOOL::FilterCollectorForHierarchy(), PCB_SELECTION_TOOL::FilterCollectorForMarkers(), PCB_SELECTION_TOOL::FindItem(), NETLIST_EXPORTER_BASE::findNextSymbol(), CADSTAR_ARCHIVE_PARSER::FixTextPositionNoAlignment(), PCB_BASE_FRAME::FocusOnItems(), EDIT_TOOL::FootprintFilter(), PCB_PLUGIN::Format(), PCB_PLUGIN::format(), SCH_SEXPR_PLUGIN::Format(), SCH_LEGACY_PLUGIN::Format(), FormatProbeItem(), FP_TEXT::FP_TEXT(), PCB_POINT_EDITOR::get45DegConstrainer(), CN_ITEM::GetAnchor(), BOARD_ITEM::GetBoard(), SCH_FIELD::GetBoundingBox(), SCH_LABEL_BASE::GetBoundingBox(), PCB_TRACK::GetBoundingBox(), SCH_FIELD::GetCanonicalName(), getClosestGroup(), KIGFX::GERBVIEW_RENDER_SETTINGS::GetColor(), KIGFX::DS_RENDER_SETTINGS::GetColor(), KIGFX::PCB_RENDER_SETTINGS::GetColor(), SCH_MOVE_TOOL::getConnectedDragItems(), SCH_MOVE_TOOL::getConnectedItems(), FOOTPRINT::GetCoverageArea(), CONNECTION_GRAPH::getDefaultConnection(), SCH_FIELD::GetDrawRotation(), getDrilledHoleShape(), CONNECTION_SUBGRAPH::GetDriverPriority(), getFieldFunc(), PCB_TRACK::GetFriendlyName(), getInferredSymbols(), PCB_TRACK::GetItemDescription(), PL_EDITOR_FRAME::GetLayoutFromRedoList(), PL_EDITOR_FRAME::GetLayoutFromUndoList(), SCH_FIELD::GetMenuImage(), getMinDist(), SCH_LABEL_BASE::GetMsgPanelInfo(), PCB_DIMENSION_BASE::GetMsgPanelInfo(), PCB_TRACK::GetMsgPanelInfo(), SCH_FIELD::GetName(), SCH_SCREEN::GetNeededJunctions(), CONNECTION_SUBGRAPH::GetNetclassForDriver(), CONNECTIVITY_DATA::GetNetItems(), BOARD_ITEM::GetParentFootprint(), SCH_SYMBOL::GetPinPhysicalPosition(), SCH_FIELD::GetPosition(), KIGFX::SCH_PAINTER::getRenderColor(), ALIGN_DISTRIBUTE_TOOL::GetSelections(), SCH_FIELD::GetShownText(), CONVERT_TOOL::getStartEndPoints(), KIGFX::SCH_PAINTER::getTextThickness(), EDA_ITEM::GetTypeDesc(), PCB_EXPR_TYPE_REF::GetValue(), PCB_SELECTION_TOOL::grabUnconnected(), GROUP_TOOL::Group(), PCB_SELECTION_TOOL::GuessSelectionCandidates(), hasDrilledHole(), hash_fp_item(), EE_SELECTION_TOOL::highlight(), PCB_SELECTION_TOOL::highlightInternal(), BOARD_INSPECTION_TOOL::HighlightItem(), BOARD_INSPECTION_TOOL::highlightNet(), highlightNet(), SCH_FIELD::HitTest(), SCH_LABEL_BASE::HitTest(), PCB_SELECTION_TOOL::hitTestDistance(), SCH_EDIT_TOOL::Init(), ROUTER_TOOL::InlineBreakTrack(), ROUTER_TOOL::InlineDrag(), DRC_RTREE::Insert(), EE_RTREE::insert(), EE_COLLECTOR::Inspect(), GENERAL_COLLECTOR::Inspect(), BOARD_INSPECTION_TOOL::InspectClearance(), BOARD_INSPECTION_TOOL::InspectConstraints(), BOARD_INSPECTION_TOOL::InspectDRCError(), ARRAY_CREATOR::Invoke(), CONNECTIVITY_DATA::IsConnectedOnLayer(), isCopper(), SCH_LINE_WIRE_BUS_TOOL::IsDrawingLineWireOrBus(), PNS_KICAD_IFACE_BASE::IsFlashedOnLayer(), CADSTAR_PCB_ARCHIVE_LOADER::isFootprint(), SCH_FIELD::IsHypertext(), isKeepoutZone(), isMaskAperture(), isNPTHPad(), PCB_TRACK::IsNull(), isNullAperture(), SCH_LINE::IsParallel(), isPlatedFunc(), SCH_FIELD::IsReplaceable(), PNS::ROUTER::isStartingPointRoutable(), SCH_ITEM::IsType(), itemIsIncludedByFilter(), PCB_SELECTION_TOOL::itemPassesFilter(), CLIPBOARD_IO::Load(), FOOTPRINT_EDIT_FRAME::LoadFootprintFromBoard(), CADSTAR_SCH_ARCHIVE_LOADER::loadHierarchicalSheetPins(), CADSTAR_SCH_ARCHIVE_LOADER::loadNets(), EE_SELECTION_TOOL::Main(), SCH_MOVE_TOOL::Main(), SYMBOL_EDITOR_MOVE_TOOL::Main(), EDIT_POINTS_FACTORY::Make(), NETLIST_EXPORTER_XML::makeListOfNets(), PCB_POINT_EDITOR::makePoints(), CONVERT_TOOL::makePolysFromChainedSegs(), SCH_SCREEN::MarkConnections(), CONNECTIVITY_DATA::MarkItemNetAsDirty(), CN_CONNECTIVITY_ALGO::markItemNetAsDirty(), SCH_FIELD::Matches(), memberOfFunc(), SCH_LINE::MergeOverlap(), SCH_EDIT_TOOL::Mirror(), EDIT_TOOL::MoveExact(), SCH_MOVE_TOOL::moveItem(), DIALOG_DRC::OnDRCItemSelected(), FOOTPRINT_EDIT_FRAME::OnEditItemRequest(), PCB_EDIT_FRAME::OnEditItemRequest(), EDA_3D_CANVAS::OnMouseMove(), CN_VISITOR::operator()(), BOARD_ITEM::ptr_cmp::operator()(), BOARD::cmp_items::operator()(), BOARD::cmp_drawings::operator()(), PCB_SHAPE::cmp_drawings::operator()(), FOOTPRINT::cmp_drawings::operator()(), KI_TEST::kitest_cmp_drawings::operator()(), PCB_TRACK::cmp_tracks::operator()(), LIB_ITEM::operator<(), SCH_ITEM::operator<(), SCH_BUS_ENTRY_BASE::operator<(), SCH_FIELD::operator<(), SCH_JUNCTION::operator<(), SCH_LINE::operator<(), operator<(), SCH_SYMBOL::operator<(), SCH_TEXT::operator<(), SCH_TEXTBOX::operator<(), PCB_BITMAP::operator=(), SCH_BITMAP::operator=(), SCH_SYMBOL::operator=(), operator=(), LIB_ITEM::operator==(), PAD::PAD(), EDIT_TOOL::PadFilter(), BOARD_COMMIT::parentObject(), SCH_SEXPR_PARSER::parseSchField(), SCH_EDITOR_CONTROL::Paste(), PCB_CONTROL::Paste(), DRAWING_TOOL::PlaceImportedGraphics(), SCH_FIELD::Plot(), SCH_LABEL_BASE::Plot(), BRDITEMS_PLOTTER::PlotPcbGraphicItem(), SCH_FIELD::Print(), DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS::processItem(), BACK_ANNOTATE::processNetNameChange(), CONNECTION_GRAPH::processSubGraphs(), SCH_EDIT_TOOL::Properties(), SYMBOL_EDITOR_EDIT_TOOL::Properties(), BOARD_COMMIT::Push(), PCB_BASE_EDIT_FRAME::PutDataInPreviousState(), PCB_GRID_HELPER::queryVisible(), BOARD_REANNOTATE_TOOL::ReannotateDuplicates(), SCH_CONNECTION::recacheName(), SCH_BASE_FRAME::RefreshZoomDependentItems(), BOARD::Remove(), CN_CONNECTIVITY_ALGO::Remove(), FOOTPRINT::Remove(), EE_RTREE::remove(), SCH_SCREEN::Remove(), KIGFX::PCB_VIEW::Remove(), PCB_POINT_EDITOR::removeCorner(), PCB_POINT_EDITOR::removeCornerCondition(), LIB_SYMBOL::RemoveDrawItem(), RemovePin(), SCH_EDIT_TOOL::RepeatDrawItem(), SCH_FIELD::Replace(), SCH_FIND_REPLACE_TOOL::ReplaceAll(), PCB_SELECTION_TOOL::RequestSelection(), CONNECTION_GRAPH::resolveAllDrivers(), SCHEMATIC::ResolveCrossReference(), PCB_PARSER::resolveGroups(), SCH_LABEL_BASE::ResolveTextVar(), BOARD::ResolveTextVar(), DS_PROXY_UNDO_ITEM::Restore(), BOARD_COMMIT::Revert(), PL_EDITOR_FRAME::RollbackFromUndo(), SCH_EDIT_TOOL::Rotate(), DRC_TEST_PROVIDER_EDGE_CLEARANCE::Run(), DRC_TEST_PROVIDER_PHYSICAL_CLEARANCE::Run(), DRC_TEST_PROVIDER_TEXT_DIMS::Run(), DRC_TEST_PROVIDER_MATCHED_LENGTH::runInternal(), EE_TOOL_BASE< T >::saveCopyInUndoList(), PCB_BASE_EDIT_FRAME::saveCopyInUndoList(), SCH_LEGACY_PLUGIN_CACHE::saveField(), SCH_SEXPR_PLUGIN_CACHE::saveField(), SCH_LEGACY_PLUGIN_CACHE::savePin(), SCH_SEXPR_PLUGIN_CACHE::savePin(), CLIPBOARD_IO::SaveSelection(), SCH_SEXPR_PLUGIN_CACHE::saveSymbolDrawItem(), SCH_LEGACY_PLUGIN_CACHE::saveText(), SCH_SEXPR_PLUGIN_CACHE::saveText(), SCH_SEXPR_PLUGIN::saveText(), SCH_SEXPR_PLUGIN_CACHE::saveTextBox(), SCH_ITEM::Schematic(), SCH_SCREEN::Schematic(), PCB_SELECTION_TOOL::select(), PCB_SELECTION_TOOL::Selectable(), EE_SELECTION_TOOL::Selectable(), PCB_SELECTION_TOOL::selectMultiple(), PCB_SELECTION_TOOL::selectSameSheet(), PCB_SELECTION_TOOL::selectUnconnected(), PCB_EDIT_FRAME::SetActiveLayer(), PCB_POINT_EDITOR::setAltConstraint(), SCH_FIELD::SetId(), ITEM_PICKER::SetItem(), SCH_FIELD::SetPosition(), PCB_EDIT_FRAME::SetTrackSegmentWidth(), PCB_EDIT_FRAME::ShowFindDialog(), SCH_EDIT_FRAME::ShowFindReplaceDialog(), BOARD_COMMIT::Stage(), PNS::LINE_PLACER::Start(), SCH_EDIT_TOOL::Swap(), PCB_GROUP::swapData(), FOOTPRINT::swapData(), PAD::swapData(), PCB_DIM_ALIGNED::swapData(), PCB_DIM_ORTHOGONAL::swapData(), PCB_DIM_RADIAL::swapData(), PCB_DIM_LEADER::swapData(), PCB_DIM_CENTER::swapData(), PCB_TARGET::swapData(), PCB_TEXT::swapData(), PCB_TEXTBOX::swapData(), PCB_TRACK::swapData(), PCB_ARC::swapData(), PCB_VIA::swapData(), ZONE::swapData(), PCB_BITMAP::swapData(), SCH_BITMAP::SwapData(), SCH_FIELD::SwapData(), SCH_JUNCTION::SwapData(), SCH_NO_CONNECT::SwapData(), SwapData(), SCH_SHEET_PIN::SwapData(), SCH_SYMBOL::SwapData(), DRC_TEST_PROVIDER_EDGE_CLEARANCE::testAgainstEdge(), DRC_TEST_PROVIDER_PHYSICAL_CLEARANCE::testItemAgainstItem(), DRC_TEST_PROVIDER_COPPER_CLEARANCE::testItemAgainstZone(), DRC_TEST_PROVIDER_PHYSICAL_CLEARANCE::testItemAgainstZones(), DRC_TEST_PROVIDER_SOLDER_MASK::testMaskItemAgainstZones(), ERC_TESTER::TestMultUnitPinConflicts(), DRC_TEST_PROVIDER_COPPER_CLEARANCE::testPadAgainstItem(), ERC_TESTER::TestPinToPin(), ERC_TESTER::TestSimilarLabels(), DRC_TEST_PROVIDER_COPPER_CLEARANCE::testTrackAgainstItem(), DRC_TEST_PROVIDER_COPPER_CLEARANCE::testTrackClearances(), CONNECTIVITY_DATA::TestTrackEndpointDangling(), DIALOG_LABEL_PROPERTIES::TransferDataFromWindow(), DIALOG_TEXT_PROPERTIES::TransferDataFromWindow(), DIALOG_LABEL_PROPERTIES::TransferDataToWindow(), DIALOG_SYMBOL_FIELDS_TABLE::TransferDataToWindow(), DIALOG_TEXT_PROPERTIES::TransferDataToWindow(), DIALOG_DIMENSION_PROPERTIES::TransferDataToWindow(), DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS::TransferDataToWindow(), PCB_TRACK::TransformShapeToPolygon(), SCH_LINE_WIRE_BUS_TOOL::TrimOverLappingWires(), SCH_DRAWING_TOOLS::TwoClickPlace(), SYMBOL_EDITOR_DRAWING_TOOLS::TwoClickPlace(), EE_SELECTION_TOOL::unhighlight(), PCB_SELECTION_TOOL::unhighlightInternal(), KIGFX::PCB_VIEW::Update(), SCH_SHEET_PATH::UpdateAllScreenReferences(), DIALOG_DIMENSION_PROPERTIES::updateDimensionFromDialog(), DIALOG_SCH_FIELD_PROPERTIES::UpdateField(), PL_POINT_EDITOR::updateItem(), PCB_POINT_EDITOR::updateItem(), EE_TOOL_BASE< T >::updateItem(), SCH_BASE_FRAME::UpdateItem(), PCB_CONTROL::UpdateMessagePanel(), SCH_EDITOR_CONTROL::UpdateNetHighlighting(), EE_POINT_EDITOR::updateParentItem(), SCH_EDITOR_CONTROL::updatePastedSheet(), EE_POINT_EDITOR::updatePoints(), PL_POINT_EDITOR::updatePoints(), PCB_POINT_EDITOR::updatePoints(), SCH_BUS_ENTRY_BASE::ViewGetLayers(), PCB_GROUP::Visit(), Visit(), GERBER_DRAW_ITEM::Visit(), PCB_TRACK::Visit(), DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::visitItem(), and NETLIST_EXPORTER_CADSTAR::writeListOfNets().

◆ UpdateDanglingState()

bool SCH_SHEET::UpdateDanglingState ( std::vector< DANGLING_END_ITEM > &  aItemList,
const SCH_SHEET_PATH aPath = nullptr 
)
overridevirtual

Test the schematic item to aItemList to check if it's dangling state has changed.

Note that the return value only true when the state of the test has changed. Use the IsDangling() method to get the current dangling state of the item. Some of the schematic objects cannot be tested for a dangling state, the default method always returns false. Only override the method if the item can be tested for a dangling state.

If aSheet is passed a non-null pointer to a SCH_SHEET_PATH, the overridden method can optionally use it to update sheet-local connectivity information

Parameters
aItemListis the list of items to test item against.
aSheetis the sheet path to update connections for.
Returns
True if the dangling state has changed from it's current setting.

Reimplemented from SCH_ITEM.

Definition at line 979 of file sch_sheet.cpp.

981{
982 bool changed = false;
983
984 for( SCH_SHEET_PIN* sheetPin : m_pins )
985 changed |= sheetPin->UpdateDanglingState( aItemList );
986
987 return changed;
988}

References m_pins.

◆ ViewBBox()

const BOX2I EDA_ITEM::ViewBBox ( ) const
overridevirtualinherited

◆ ViewDraw()

virtual void KIGFX::VIEW_ITEM::ViewDraw ( int  aLayer,
VIEW aView 
) const
inlinevirtualinherited

Draw the parts of the object belonging to layer aLayer.

An alternative way for drawing objects if there is no #PAINTER assigned for the view or if the PAINTER doesn't know how to paint this particular implementation of VIEW_ITEM. The preferred way of drawing is to design an appropriate PAINTER object, the method below is intended only for quick hacks and debugging purposes.

Parameters
aLayeris the current drawing layer.
aViewis a pointer to the VIEW device we are drawing on.

Reimplemented in DS_PROXY_VIEW_ITEM, KIGFX::PREVIEW::SIMPLE_OVERLAY_ITEM, EDIT_POINTS, RATSNEST_VIEW_ITEM, ROUTER_PREVIEW_ITEM, MY_DRAWING, KIGFX::PREVIEW::ARC_ASSISTANT, KIGFX::PREVIEW::RULER_ITEM, KIGFX::PREVIEW::SELECTION_AREA, KIGFX::PREVIEW::TWO_POINT_ASSISTANT, KIGFX::ORIGIN_VIEWITEM, KIGFX::VIEW_GROUP, and KIGFX::VIEW_OVERLAY.

Definition at line 106 of file view_item.h.

107 {}

Referenced by KIGFX::VIEW::draw(), and KIGFX::VIEW::updateItemGeometry().

◆ ViewGetLayers()

void SCH_SHEET::ViewGetLayers ( int  aLayers[],
int &  aCount 
) const
overridevirtual

Return the layers the item is drawn on (which may be more than its "home" layer)

Reimplemented from SCH_ITEM.

Definition at line 645 of file sch_sheet.cpp.

646{
647 aCount = 7;
648 aLayers[0] = LAYER_HIERLABEL;
649 aLayers[1] = LAYER_SHEETNAME;
650 aLayers[2] = LAYER_SHEETFILENAME;
651 aLayers[3] = LAYER_SHEETFIELDS;
652 aLayers[4] = LAYER_SHEET;
653 aLayers[5] = LAYER_SHEET_BACKGROUND;
654 aLayers[6] = LAYER_SELECTION_SHADOWS;
655}
@ LAYER_HIERLABEL
Definition: layer_ids.h:349
@ LAYER_SELECTION_SHADOWS
Definition: layer_ids.h:381

References LAYER_HIERLABEL, LAYER_SELECTION_SHADOWS, LAYER_SHEET, LAYER_SHEET_BACKGROUND, LAYER_SHEETFIELDS, LAYER_SHEETFILENAME, and LAYER_SHEETNAME.

◆ ViewGetLOD()

virtual double KIGFX::VIEW_ITEM::ViewGetLOD ( int  aLayer,
VIEW aView 
) const
inlinevirtualinherited

Return the level of detail (LOD) of the item.

A level of detail is the minimal VIEW scale that is sufficient for an item to be shown on a given layer.

Parameters
aLayeris the current drawing layer.
aViewis a pointer to the VIEW device we are drawing on.
Returns
the level of detail. 0 always show the item, because the actual zoom level (or VIEW scale) is always > 0

Reimplemented in GERBER_DRAW_ITEM, PCB_GROUP, FOOTPRINT, FP_SHAPE, FP_TEXT, FP_TEXTBOX, PAD, PCB_BITMAP, PCB_SHAPE, PCB_TEXT, PCB_TEXTBOX, PCB_TRACK, PCB_VIA, ZONE, and FP_ZONE.

Definition at line 132 of file view_item.h.

133 {
134 // By default always show the item
135 return 0.0;
136 }

Referenced by PNS_KICAD_IFACE::IsItemVisible(), KIGFX::VIEW::DRAW_ITEM_VISITOR::operator()(), EE_GRID_HELPER::queryVisible(), and PCB_GRID_HELPER::queryVisible().

◆ viewPrivData()

◆ Visit()

INSPECT_RESULT SCH_SHEET::Visit ( INSPECTOR  inspector,
void *  testData,
const std::vector< KICAD_T > &  aScanTypes 
)
overridevirtual

May be re-implemented for each derived class in order to handle all the types given by its member data.

Implementations should call inspector->Inspect() on types in aScanTypes, and may use IterateForward() to do so on lists of such data.

Parameters
inspectorAn INSPECTOR instance to use in the inspection.
testDataArbitrary data used by the inspector.
aScanTypesWhich KICAD_T types are of interest and the order in which they should be processed.
Returns
#SEARCH_RESULT SEARCH_QUIT if the Iterator is to stop the scan, else #SCAN_CONTINUE, and determined by the inspector.

Reimplemented from EDA_ITEM.

Definition at line 1002 of file sch_sheet.cpp.

1004{
1005 for( KICAD_T scanType : aScanTypes )
1006 {
1007 // If caller wants to inspect my type
1008 if( scanType == SCH_LOCATE_ANY_T || scanType == Type() )
1009 {
1010 if( INSPECT_RESULT::QUIT == aInspector( this, nullptr ) )
1011 return INSPECT_RESULT::QUIT;
1012 }
1013
1014 if( scanType == SCH_LOCATE_ANY_T || scanType == SCH_FIELD_T )
1015 {
1016 // Test the sheet fields.
1017 for( SCH_FIELD& field : m_fields )
1018 {
1019 if( INSPECT_RESULT::QUIT == aInspector( &field, this ) )
1020 return INSPECT_RESULT::QUIT;
1021 }
1022 }
1023
1024 if( scanType == SCH_LOCATE_ANY_T || scanType == SCH_SHEET_PIN_T )
1025 {
1026 // Test the sheet labels.
1027 for( SCH_SHEET_PIN* sheetPin : m_pins )
1028 {
1029 if( INSPECT_RESULT::QUIT == aInspector( sheetPin, this ) )
1030 return INSPECT_RESULT::QUIT;
1031 }
1032 }
1033 }
1034
1036}
@ SCH_FIELD_T
Definition: typeinfo.h:155
@ SCH_LOCATE_ANY_T
Definition: typeinfo.h:183

References CONTINUE, m_fields, m_pins, QUIT, SCH_FIELD_T, SCH_LOCATE_ANY_T, SCH_SHEET_PIN_T, and EDA_ITEM::Type().

◆ XorFlags()

void EDA_ITEM::XorFlags ( EDA_ITEM_FLAGS  aMask)
inlineinherited

Definition at line 140 of file eda_item.h.

140{ m_flags ^= aMask; }

References EDA_ITEM::m_flags.

Referenced by EE_SELECTION_TOOL::selectMultiple().

Friends And Related Function Documentation

◆ SCH_SHEET_LIST

friend class SCH_SHEET_LIST
friend

Definition at line 490 of file sch_sheet.h.

◆ SCH_SHEET_PIN

friend class SCH_SHEET_PIN
friend

Definition at line 489 of file sch_sheet.h.

Referenced by operator=(), and SCH_SHEET().

Member Data Documentation

◆ m_backgroundColor

KIGFX::COLOR4D SCH_SHEET::m_backgroundColor
private

Definition at line 504 of file sch_sheet.h.

Referenced by GetBackgroundColor(), SCH_SHEET(), SetBackgroundColor(), and SwapData().

◆ m_borderColor

KIGFX::COLOR4D SCH_SHEET::m_borderColor
private

Definition at line 503 of file sch_sheet.h.

Referenced by GetBorderColor(), SCH_SHEET(), SetBorderColor(), and SwapData().

◆ m_borderWidth

int SCH_SHEET::m_borderWidth
private

Definition at line 502 of file sch_sheet.h.

Referenced by GetBorderWidth(), SCH_SHEET(), SetBorderWidth(), and SwapData().

◆ m_connected_items

std::map<SCH_SHEET_PATH, SCH_ITEM_SET, SHEET_PATH_CMP> SCH_ITEM::m_connected_items
protectedinherited

Store pointers to other items that are connected to this one, per sheet.

Definition at line 498 of file sch_item.h.

Referenced by SCH_ITEM::AddConnectionTo(), SCH_ITEM::ConnectedItems(), and SCH_LABEL_BASE::IsType().

◆ m_connection_map

std::unordered_map<SCH_SHEET_PATH, SCH_CONNECTION*> SCH_ITEM::m_connection_map
protectedinherited

Store connectivity information, per sheet.

Definition at line 501 of file sch_item.h.

Referenced by SCH_ITEM::Connection(), SCH_ITEM::InitializeConnection(), and SCH_ITEM::~SCH_ITEM().

◆ m_connections

EDA_ITEMS SCH_ITEM::m_connections
protectedinherited

Definition at line 492 of file sch_item.h.

Referenced by SCH_ITEM::ClearConnections(), and SCH_ITEM::~SCH_ITEM().

◆ m_connectivity_dirty

bool SCH_ITEM::m_connectivity_dirty
protectedinherited

◆ m_fields

◆ m_fieldsAutoplaced

◆ m_flags

◆ m_forceVisible

bool EDA_ITEM::m_forceVisible
protectedinherited

◆ m_instances

◆ m_layer

◆ m_parent

◆ m_pins

◆ m_pos

◆ m_screen

◆ m_size

◆ m_status

◆ m_storedPos

VECTOR2I SCH_ITEM::m_storedPos
protectedinherited

Definition at line 494 of file sch_item.h.

Referenced by SCH_ITEM::GetStoredPos(), and SCH_ITEM::SetStoredPos().

◆ m_structType

KICAD_T EDA_ITEM::m_structType
privateinherited

Run time identification, keep private so it can never be changed after a ctor sets it.

See comment near SetType() regarding virtual functions.

Definition at line 505 of file eda_item.h.

Referenced by EDA_ITEM::IsType(), EDA_ITEM::operator=(), and EDA_ITEM::Type().

◆ m_Uuid

const KIID EDA_ITEM::m_Uuid
inherited

Definition at line 492 of file eda_item.h.

Referenced by FIELDS_EDITOR_GRID_DATA_MODEL::AddColumn(), SCH_SYMBOL::AddHierarchicalReference(), addInstance(), RC_ITEM::AddItem(), SCH_EDIT_FRAME::AnnotateSymbols(), FIELDS_EDITOR_GRID_DATA_MODEL::ApplyData(), SCH_SHEET_PATH::Cmp(), SCHEMATIC::ConvertRefsToKIIDs(), MICROWAVE_TOOL::createMicrowaveInductor(), SCH_EDIT_FRAME::CreateScreens(), ZONE_FILLER_TOOL::DirtyZone(), DRAWING_TOOL::DrawVia(), LIB_SYMBOL::Duplicate(), BOARD_ITEM::Duplicate(), FOOTPRINT::Duplicate(), SCH_ITEM::Duplicate(), FOOTPRINT::DuplicateItem(), PCB_EDIT_FRAME::ExchangeFootprint(), PAD_TOOL::explodePad(), SCH_SHEET_LIST::FillItemMap(), BOARD::FillItemMap(), SCH_EDITOR_CONTROL::FindSymbolAndItem(), SCH_EDIT_FRAME::FocusOnItem(), PCB_PLUGIN::format(), SCH_SEXPR_PLUGIN::Format(), SCH_PIN::GetDefaultNetName(), SCH_SHEET_PATH::GetItem(), BOARD::GetItem(), PAD::GetMsgPanelInfo(), DIALOG_BOARD_REANNOTATE::GetNewRefDes(), getPageNumber(), FP_SHAPE::GetParentAsString(), FP_TEXT::GetParentAsString(), FP_TEXTBOX::GetParentAsString(), PAD::GetParentAsString(), SCH_MARKER::GetUUID(), PCB_MARKER::GetUUID(), FIELDS_EDITOR_GRID_DATA_MODEL::GetValue(), FIELDS_EDITOR_GRID_DATA_MODEL::groupMatch(), ZONE::HigherPriority(), SCH_SHEET_PATH::IsContainedWithin(), SCH_ALTIUM_PLUGIN::Load(), SCH_EAGLE_PLUGIN::Load(), LEGACY_PLUGIN::loadFOOTPRINT(), FOOTPRINT_EDIT_FRAME::LoadFootprintFromBoard(), PCB_EDIT_FRAME::LoadFootprints(), SCH_LEGACY_PLUGIN::loadHierarchy(), LEGACY_PLUGIN::loadPCB_TARGET(), LEGACY_PLUGIN::loadPCB_TEXT(), SCH_EDIT_FRAME::LoadSheetFromFile(), SYMBOL_EDIT_FRAME::LoadSymbolFromSchematic(), LEGACY_PLUGIN::loadTrackList(), PNS::LOGGER::Log(), NETLIST_EXPORTER_XML::makeSymbols(), SCH_EDIT_FRAME::mapExistingAnnotation(), BOARD_ITEM::ptr_cmp::operator()(), BOARD::cmp_items::operator()(), BOARD::cmp_drawings::operator()(), PCB_SHAPE::cmp_drawings::operator()(), FOOTPRINT::cmp_drawings::operator()(), FOOTPRINT::cmp_zones::operator()(), FOOTPRINT::cmp_pads::operator()(), PCB_TRACK::cmp_tracks::operator()(), SCH_ITEM::operator<(), SCH_SYMBOL::operator<(), PAD::PAD(), SCH_SEXPR_PARSER::ParseSchematic(), SCH_EDITOR_CONTROL::Paste(), SCH_SHEET_PATH::PathAsString(), PCB_VIA::PCB_VIA(), SCH_EDIT_FRAME::RecalculateConnections(), FIELDS_EDITOR_GRID_DATA_MODEL::RemoveColumn(), SCH_SYMBOL::RemoveInstance(), SCH_SCREENS::ReplaceDuplicateTimeStamps(), SCH_SYMBOL::ReplaceInstanceSheetPath(), PCB_PARSER::resolveGroups(), SCH_SEXPR_PLUGIN::saveBitmap(), SCH_SEXPR_PLUGIN::saveBusEntry(), FOOTPRINT_EDIT_FRAME::SaveFootprintToBoard(), SCH_SEXPR_PLUGIN::saveJunction(), SCH_SEXPR_PLUGIN::saveLine(), SCH_SEXPR_PLUGIN::saveNoConnect(), SCH_EDIT_FRAME::SaveProject(), SCH_SEXPR_PLUGIN::saveShape(), SCH_LEGACY_PLUGIN::saveSheet(), SCH_SEXPR_PLUGIN::saveSheet(), SCH_LEGACY_PLUGIN::saveSymbol(), SCH_SEXPR_PLUGIN::saveSymbol(), SCH_SEXPR_PLUGIN::saveText(), SCH_SEXPR_PLUGIN::saveTextBox(), SCH_REFERENCE::SCH_REFERENCE(), SCH_SHEET(), SCH_SYMBOL::SCH_SYMBOL(), RC_ITEM::SetItems(), setPageNumber(), FIELDS_EDITOR_GRID_DATA_MODEL::SetValue(), SCH_DRAWING_TOOLS::SingleClickPlace(), DRC_TEST_PROVIDER_EDGE_CLEARANCE::testAgainstEdge(), testGroupEqual(), DIALOG_SYMBOL_PROPERTIES::TransferDataFromWindow(), SCH_EDITOR_CONTROL::updatePastedSheet(), SCH_SHEET_LIST::UpdateSymbolInstanceData(), and NETLIST_EXPORTER_ORCADPCB2::WriteNetlist().

◆ m_viewPrivData

VIEW_ITEM_DATA* KIGFX::VIEW_ITEM::m_viewPrivData
privateinherited

◆ SCH_SEXPR_PARSER

friend SCH_SHEET::SCH_SEXPR_PARSER
protected

Definition at line 419 of file sch_sheet.h.

◆ SCH_SHEET_PATH

friend SCH_SHEET::SCH_SHEET_PATH
protected

Definition at line 418 of file sch_sheet.h.

Referenced by findSelf().


The documentation for this class was generated from the following files: