39 switch( aItem.
Type() )
49 return text.GetShownText(
true );
67 return textbox.
GetShownText(
nullptr,
nullptr,
true, 0 );
75 return pin.GetShownName();
84 for(
int row = 0; row <
table.GetRowCount(); ++row )
86 for(
int col = 0; col <
table.GetColCount(); ++col )
91 if( col <
table.GetColCount() - 1 )
97 if( row <
table.GetRowCount() - 1 )
109 return wxEmptyString;
115 wxArrayString itemTexts;
119 if( item->IsSCH_ITEM() )
124 itemText.Trim(
false ).Trim(
true );
126 if( !itemText.IsEmpty() )
128 itemTexts.Add( std::move( itemText ) );
133 return wxJoin( itemTexts,
'\n',
'\0' );
138 const LIB_ID& aLibId,
int aUnit )
140 for(
size_t i = 0; i < aRefs.
GetCount(); ++i )
147 if( ref.
GetRef() != aRef )
152 if( refSym && refSym->
GetLibId() == aLibId )
167 const wxString symRefDes = aSym.
GetRef( &schematic->CurrentSheet(),
false );
173 const bool refIsUnannotated = !symRefDes.IsEmpty() && symRefDes.Last() ==
'?';
181 std::set<int> missingUnits;
183 for(
int unit = 1; unit <= aSym.
GetUnitCount(); ++unit )
184 missingUnits.insert( unit );
188 if( symRefDes != ref.GetRef() )
191 if( refIsUnannotated && ref.GetSymbol() && ref.GetSymbol()->GetLibId() != symLibId )
194 missingUnits.erase( ref.GetUnit() );
202 const wxString& aRef,
int aUnit )
209 if( ref.GetRef() == aRef && ref.GetUnit() == aUnit )
221 std::vector<SCH_SYMBOL*>
result;
228 bool haveRootLibId =
false;
229 size_t rootPinCount = 0;
230 bool haveRootPinCount =
false;
245 wxString ref = sym->
GetRef( &sheet,
false );
247 if( rootRef.IsEmpty() )
260 haveRootLibId =
true;
263 if( libId != rootLibId )
267 size_t pinCount = sym->
GetPins( &sheet ).size();
269 if( !haveRootPinCount )
271 rootPinCount = pinCount;
272 haveRootPinCount =
true;
275 if( pinCount != rootPinCount )
290 wxCHECK_MSG( aFirst && aSecond,
false,
"Invalid pins supplied to SwapPinGeometry" );
309 int secondLength = secondPin->
GetLength();
320 return ( firstPin != aFirst ) || ( secondPin != aSecond );
325 std::set<wxString>* aSheetPaths, std::set<wxString>* aProjectNames )
327 std::set<KIID_PATH> uniquePaths;
328 std::set<wxString> sheetPaths;
329 std::set<wxString> otherProjects;
333 uniquePaths.insert( instance.m_Path );
335 if( !instance.m_Path.empty() )
336 sheetPaths.insert( instance.m_Path.AsString() );
338 if( !instance.m_ProjectName.IsEmpty() )
340 if( aCurrentProject.IsEmpty() || !instance.m_ProjectName.IsSameAs( aCurrentProject ) )
341 otherProjects.insert( instance.m_ProjectName );
345 bool sharedWithinProject = uniquePaths.size() > 1;
346 bool sharedWithOtherProjects = !otherProjects.empty();
350 if( sharedWithinProject )
351 *aSheetPaths = sheetPaths;
353 aSheetPaths->clear();
358 if( sharedWithOtherProjects )
359 *aProjectNames = otherProjects;
361 aProjectNames->clear();
364 return sharedWithinProject || sharedWithOtherProjects;
370 std::set<wxString> friendlyNames;
372 if( aSheetPaths.empty() )
373 return friendlyNames;
377 for(
const wxString& pathStr : aSheetPaths )
379 wxString display = pathStr;
387 if( sheetPath.Path() == kiidPath )
391 for(
size_t ii = 0; ii < sheetPath.size(); ++ii )
408 if( !sheetNames.IsEmpty() )
409 sheetNames << wxS(
"/" );
414 if( sheetNames.IsEmpty() )
415 display = sheetPath.PathHumanReadable(
false,
true );
417 display = sheetNames;
428 friendlyNames.insert( display );
431 return friendlyNames;
A base class for most all the KiCad significant classes used in schematics and boards.
KICAD_T Type() const
Returns the type of object.
A logical library item identifier and consists of various portions much like a URI.
int GetUnitCount() const override
Holds all the data relating to one schematic.
SCH_SHEET_LIST Hierarchy() const
Return the full schematic flattened hierarchical sheet list.
SCH_SHEET_PATH & CurrentSheet() const
wxString GetShownText(const SCH_SHEET_PATH *aPath, bool aAllowExtraText, int aDepth=0, const wxString &aVariantName=wxEmptyString) const
Base class for any item which can be embedded within the SCHEMATIC container class,...
SCHEMATIC * Schematic() const
Search the item hierarchy to find a SCHEMATIC.
VECTOR2I GetLocalPosition() const
const wxString & GetOperatingPoint() const
void SetOrientation(PIN_ORIENTATION aOrientation)
SCH_PIN * GetLibPin() const
void SetPosition(const VECTOR2I &aPos) override
void SetLength(int aLength)
PIN_ORIENTATION GetOrientation() const
void SetOperatingPoint(const wxString &aText)
Container to create a flattened list of symbols because in a complex hierarchy, a symbol can be used ...
A helper to define a symbol's reference designator in a schematic.
SCH_SYMBOL * GetSymbol() const
A container for handling SCH_SHEET_PATH objects in a flattened hierarchy.
void GetSymbols(SCH_REFERENCE_LIST &aReferences, SYMBOL_FILTER aSymbolFilter, bool aForceIncludeOrphanSymbols=false) const
Add a SCH_REFERENCE object to aReferences for each symbol in the list of sheets.
Handle access to a stack of flattened SCH_SHEET objects by way of a path for creating a flattened sch...
Sheet symbol placed in a schematic, and is the entry point for a sub schematic.
SCH_FIELD * GetField(FIELD_T aFieldType)
Return a mandatory field in this sheet.
const std::vector< SCH_SYMBOL_INSTANCE > & GetInstances() const
std::vector< const SCH_PIN * > GetPins(const SCH_SHEET_PATH *aSheet) const
Retrieve a list of the SCH_PINs for the given sheet path.
const LIB_ID & GetLibId() const override
int GetUnitCount() const override
Return the number of units per package of the symbol.
std::unique_ptr< LIB_SYMBOL > & GetLibSymbolRef()
const wxString GetRef(const SCH_SHEET_PATH *aSheet, bool aIncludeUnit=false) const override
wxString GetShownText(const RENDER_SETTINGS *aSettings, const SCH_SHEET_PATH *aPath, bool aAllowExtraText, int aDepth=0) const override
virtual wxString GetShownText(const RENDER_SETTINGS *aSettings, const SCH_SHEET_PATH *aPath, bool aAllowExtraText, int aDepth=0) const
virtual unsigned int GetSize() const override
Return the number of stored items.
std::vector< EDA_ITEM * > GetItemsSortedBySelectionOrder() const
bool OnlyContains(std::vector< KICAD_T > aList) const
Checks if all items in the selection have a type in aList.
PIN_ORIENTATION
The symbol library pin object orientations.
Definition of the SCH_SHEET_PATH and SCH_SHEET_LIST classes for Eeschema.
A simple container for schematic symbol instance information.
std::vector< std::vector< std::string > > table
wxString result
Test unit parsing edge cases and error handling.
VECTOR2< int32_t > VECTOR2I