41 for(
size_t i = 0; i < references.
GetCount(); i++ )
47 curr_full_uuid.push_back( symbol->
m_Uuid );
49 wxString ref = symbol->
GetRef( curr_sheetpath );
55 aMap[ curr_full_uuid.
AsString() ] = ref;
62 auto clearAnnotation =
67 SCH_COMPONENT* component = static_cast<SCH_COMPONENT*>( item );
75 if( aCurrentSheetOnly )
82 clearAnnotation( sheet.LastScreen(), nullptr );
101 bool aResetAnnotation,
102 bool aRepairTimestamps,
109 bool appendUndo =
false;
115 std::map<wxString, wxString> previousAnnotation;
120 if( aRepairTimestamps )
127 msg.Printf(
_(
"%d duplicate time stamps were found and replaced." ), count );
135 if( aAnnotateSchematic )
145 if( aResetAnnotation )
152 if( aAnnotateSchematic )
161 switch( aSortOption )
168 bool useSheetNum =
false;
171 switch( aAlgoOption )
188 references.
Annotate( useSheetNum, idStep, aStartNumber, lockedComponents );
190 for(
size_t i = 0; i < references.
GetCount(); i++ )
201 full_uuid.push_back( symbol->
m_Uuid );
203 wxString prevRef = previousAnnotation[ full_uuid.
AsString() ];
204 wxString newRef = symbol->
GetRef( sheet );
211 if( prevRef.Length() )
213 if( newRef == prevRef )
217 msg.Printf(
_(
"Updated %s (unit %s) from %s to %s" ),
223 msg.Printf(
_(
"Updated %s from %s to %s" ),
231 msg.Printf(
_(
"Annotated %s (unit %s) as %s" ),
236 msg.Printf(
_(
"Annotated %s as %s" ),
250 !aAnnotateSchematic ) )
271 constexpr
bool includePowerSymbols =
false;
A container for handling SCH_SHEET_PATH objects in a flattened hierarchy.
EE_TYPE OfType(KICAD_T aType) const
int CheckAnnotate(ANNOTATION_ERROR_HANDLER aErrorHandler, bool aOneSheetOnly=false)
Check for annotation errors.
void SortByYCoordinate()
Sort the list of references by Y position.
void UpdateNetHighlightStatus()
void mapExistingAnnotation(std::map< wxString, wxString > &aMap)
Fills a map of uuid -> reference from the currently loaded schematic.
void GetSymbols(SCH_REFERENCE_LIST &aReferences, bool aIncludePowerSymbols=true, bool aForceIncludeOrphanComponents=false) const
Add a SCH_REFERENCE object to aReferences for each component in the list of sheets.
void GetMultiUnitSymbols(SCH_MULTI_UNIT_REFERENCE_MAP &aRefList, bool aIncludePowerSymbols=true) const
Add a SCH_REFERENCE_LIST object to aRefList for each same-reference set of multi-unit parts in the li...
This file is part of the common library.
const SCH_SHEET_PATH & GetSheetPath() const
ANNOTATE_ORDER_T
Schematic annotation order options.
KIID_PATH Path() const
Get the sheet path as an KIID_PATH.
void AnnotateComponents(bool aAnnotateSchematic, ANNOTATE_ORDER_T aSortOption, ANNOTATE_OPTION_T aAlgoOption, int aStartNumber, bool aResetAnnotation, bool aRepairTimestamps, bool aLockUnits, REPORTER &aReporter)
Annotate the components in the schematic that are not currently annotated.
virtual REPORTER & ReportTail(const wxString &aText, SEVERITY aSeverity=RPT_SEVERITY_UNDEFINED)
Places the report at the end of the list, for objects that support report ordering.
int GetUnitCount() const
Return the number of units per package of the symbol.
Annotate incrementally using the first free reference number.
A pure virtual class used to derive REPORTER objects from.
void UpdateAllScreenReferences()
Update all the symbol references for this sheet path.
void DeleteAnnotation(bool aCurrentSheetOnly, bool *appendUndo)
Clear the current component annotation.
virtual REPORTER & Report(const wxString &aText, SEVERITY aSeverity=RPT_SEVERITY_UNDEFINED)=0
Report a string with a given severity.
void GetMultiUnitComponents(SCH_MULTI_UNIT_REFERENCE_MAP &aRefList, bool aIncludePowerSymbols=true) const
Add a SCH_REFERENCE_LIST object to aRefList for each same-reference set of multi-unit parts in the sh...
Container to create a flattened list of symbols because in a complex hierarchy, a symbol can be used ...
SCH_SCREEN * GetScreen() const override
Return a pointer to a BASE_SCREEN or one of its derivatives.
const wxString GetValue(const SCH_SHEET_PATH *sheet, bool aResolve) const
void SortByXCoordinate()
Sort the list of references by X position.
void SyncView()
Mark all items for refresh.
SCH_DRAW_PANEL * GetCanvas() const override
Return a pointer to GAL-based canvas of given EDA draw frame.
void Annotate()
Update the annotation of the symbol according the the current object state.
SCHEMATIC & Schematic() const
ANNOTATE_OPTION_T
Schematic annotation type options.
void Annotate(bool aUseSheetNum, int aSheetIntervalId, int aStartNumber, SCH_MULTI_UNIT_REFERENCE_MAP aLockedUnitMap)
Set the reference designators in the list that have not been annotated.
bool IsAnnotated(const SCH_SHEET_PATH *aSheet)
Checks if the component has a valid annotation (reference) for the given sheet path.
Handle access to a stack of flattened SCH_SHEET objects by way of a path for creating a flattened sch...
std::map< wxString, SCH_REFERENCE_LIST > SCH_MULTI_UNIT_REFERENCE_MAP
Container to map reference designators for multi-unit parts.
virtual void Refresh(bool aEraseBackground=true, const wxRect *aRect=NULL) override
Update the board display after modifying it by a python script (note: it is automatically called by a...
SCH_COMPONENT * GetSymbol() const
Annotate by Y position from top to bottom.
unsigned GetCount() const
Annotate using the first free reference number starting at the sheet number * 100.
SCH_SHEET_LIST GetSheets() const override
Builds and returns an updated schematic hierarchy TODO: can this be cached?
int CheckAnnotation(ANNOTATION_ERROR_HANDLER aErrorHandler)
Check for annotations errors.
SCH_SCREEN * LastScreen()
void SetSheetNumberAndCount()
Set the m_ScreenNumber and m_NumberOfScreens members for screens.
void SplitReferences()
Attempt to split all reference designators into a name (U) and number (1).
void SaveCopyInUndoList(SCH_SCREEN *aScreen, SCH_ITEM *aItemToCopy, UNDO_REDO aTypeCommand, bool aAppend)
Create a copy of the current schematic item, and put it in the undo list.
std::function< void(ERCE_T aType, const wxString &aMsg, SCH_REFERENCE *aItemA, SCH_REFERENCE *aItemB)> ANNOTATION_ERROR_HANDLER
Define a standard error handler for annotation errors.
wxString AsString() const
Annotate by X position from left to right.
Annotate using the first free reference number starting at the sheet number * 1000.
static wxString SubReference(int aUnit, bool aAddSeparator=true)
SCH_SHEET_PATH & GetCurrentSheet() const
int ReplaceDuplicateTimeStamps()
Test all sheet and component objects in the schematic for duplicate time stamps and replaces them as ...
void OnModify() override
Must be called after a schematic change in order to set the "modify" flag of the current screen and u...
Definition for part library class.
void ClearAnnotation(const SCH_SHEET_PATH *aSheetPath)
Clear exiting component annotation.
Base class for any item which can be embedded within the SCHEMATIC container class,...
int GetUnitSelection(const SCH_SHEET_PATH *aSheet) const
A helper to define a symbol's reference designator in a schematic.
void GetSymbols(SCH_REFERENCE_LIST &aReferences, bool aIncludePowerSymbols=true, bool aForceIncludeOrphanComponents=false) const
Adds SCH_REFERENCE object to aReferences for each component in the sheet.
Container class that holds multiple SCH_SCREEN objects in a hierarchy.
const wxString GetRef(const SCH_SHEET_PATH *aSheet, bool aIncludeUnit=false) const
Return the reference for the given sheet path.