KiCad PCB EDA Suite
Loading...
Searching...
No Matches
annotate.cpp
Go to the documentation of this file.
1/*
2 * This program source code file is part of KiCad, a free EDA CAD application.
3 *
4 * Copyright (C) 2004-2023 KiCad Developers, see AUTHORS.txt for contributors.
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version 2
9 * of the License, or (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, you may find one here:
18 * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
19 * or you may search the http://www.gnu.org website for the version 2 license,
20 * or you may write to the Free Software Foundation, Inc.,
21 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
22 */
23
24#include <algorithm>
25
26#include <confirm.h>
27#include <reporter.h>
28#include <sch_edit_frame.h>
29#include <schematic.h>
30#include <sch_commit.h>
31#include <erc_settings.h>
32#include <sch_reference_list.h>
33#include <symbol_library.h>
34#include <tools/ee_selection.h>
36#include <tool/tool_manager.h>
37#include <dialog_erc.h>
38
39void SCH_EDIT_FRAME::mapExistingAnnotation( std::map<wxString, wxString>& aMap )
40{
41 SCH_REFERENCE_LIST references;
42
43 Schematic().GetSheets().GetSymbols( references );
44
45 for( size_t i = 0; i < references.GetCount(); i++ )
46 {
47 SCH_SYMBOL* symbol = references[ i ].GetSymbol();
48 SCH_SHEET_PATH* curr_sheetpath = &references[ i ].GetSheetPath();
49 KIID_PATH curr_full_uuid = curr_sheetpath->Path();
50
51 curr_full_uuid.push_back( symbol->m_Uuid );
52
53 wxString ref = symbol->GetRef( curr_sheetpath, true );
54
55 if( symbol->IsAnnotated( curr_sheetpath ) )
56 aMap[ curr_full_uuid.AsString() ] = ref;
57 }
58}
59
60
61void SCH_EDIT_FRAME::DeleteAnnotation( ANNOTATE_SCOPE_T aAnnotateScope, bool aRecursive )
62{
63
65 SCH_SCREEN* screen = GetScreen();
66 SCH_SHEET_PATH currentSheet = GetCurrentSheet();
67 SCH_COMMIT commit( this );
68
69 auto clearSymbolAnnotation =
70 [&]( EDA_ITEM* aItem, SCH_SCREEN* aScreen, SCH_SHEET_PATH* aSheet, bool aResetPrefixes )
71 {
72 SCH_SYMBOL* symbol = static_cast<SCH_SYMBOL*>( aItem );
73 commit.Modify( aItem, aScreen );
74
75 symbol->ClearAnnotation( aSheet, aResetPrefixes );
76 };
77
78 auto clearSheetAnnotation =
79 [&]( SCH_SCREEN* aScreen, SCH_SHEET_PATH* aSheet, bool aResetPrefixes )
80 {
81 for( SCH_ITEM* item : aScreen->Items().OfType( SCH_SYMBOL_T ) )
82 clearSymbolAnnotation( item, aScreen, aSheet, aResetPrefixes );
83 };
84
85 switch( aAnnotateScope )
86 {
87 case ANNOTATE_ALL:
88 {
89 for( const SCH_SHEET_PATH& sheet : sheets )
90 clearSheetAnnotation( sheet.LastScreen(), nullptr, false );
91
92 break;
93 }
95 {
96 clearSheetAnnotation( screen, &currentSheet, false );
97
98 if( aRecursive )
99 {
100 SCH_SHEET_LIST subSheets;
101
102 std::vector<SCH_ITEM*> tempSubSheets;
103 currentSheet.LastScreen()->GetSheets( &tempSubSheets );
104
105 for( SCH_ITEM* item : tempSubSheets )
106 {
107 SCH_SHEET_PATH subSheetPath = currentSheet;
108 subSheetPath.push_back( static_cast<SCH_SHEET*>( item ) );
109
110 sheets.GetSheetsWithinPath( subSheets, subSheetPath );
111 }
112
113 for( SCH_SHEET_PATH sheet : subSheets )
114 clearSheetAnnotation( sheet.LastScreen(), &sheet, false );
115 }
116
117 break;
118 }
119
121 {
123 EE_SELECTION& selection = selTool->RequestSelection();
124 SCH_SHEET_LIST selectedSheets;
125
126 for( EDA_ITEM* item : selection.Items() )
127 {
128 if( item->Type() == SCH_SYMBOL_T )
129 clearSymbolAnnotation( item, screen, &currentSheet, false );
130
131 if( item->Type() == SCH_SHEET_T && aRecursive )
132 {
133 SCH_SHEET_PATH subSheetPath = currentSheet;
134 subSheetPath.push_back( static_cast<SCH_SHEET*>( item ) );
135
136 sheets.GetSheetsWithinPath( selectedSheets, subSheetPath );
137 }
138 }
139
140 for( SCH_SHEET_PATH sheet : selectedSheets )
141 clearSheetAnnotation( sheet.LastScreen(), &sheet, false );
142
143 break;
144 }
145 }
146
147 // Update the references for the sheet that is currently being displayed.
149
150 wxWindow* erc_dlg = wxWindow::FindWindowByName( DIALOG_ERC_WINDOW_NAME );
151
152 if( erc_dlg )
153 static_cast<DIALOG_ERC*>( erc_dlg )->UpdateAnnotationWarning();
154
155 commit.Push( _( "Delete Annotation" ) );
156
157 // Must go after OnModify() so the connectivity graph has been updated
159}
160
161
162std::unordered_set<SCH_SYMBOL*> getInferredSymbols( const EE_SELECTION& aSelection )
163{
164 std::unordered_set<SCH_SYMBOL*> symbols;
165
166 for( EDA_ITEM* item : aSelection )
167 {
168 switch( item->Type() )
169 {
170 case SCH_FIELD_T:
171 {
172 SCH_FIELD* field = static_cast<SCH_FIELD*>( item );
173
174 if( field->GetId() == REFERENCE_FIELD && field->GetParent()->Type() == SCH_SYMBOL_T )
175 symbols.insert( static_cast<SCH_SYMBOL*>( field->GetParent() ) );
176
177 break;
178 }
179
180 case SCH_SYMBOL_T:
181 symbols.insert( static_cast<SCH_SYMBOL*>( item ) );
182 break;
183
184 default:
185 break;
186 }
187 }
188
189 return symbols;
190}
191
192
194 ANNOTATE_ORDER_T aSortOption, ANNOTATE_ALGO_T aAlgoOption,
195 bool aRecursive, int aStartNumber, bool aResetAnnotation,
196 bool aRepairTimestamps, REPORTER& aReporter )
197{
199 EE_SELECTION& selection = selTool->GetSelection();
200
201 SCH_REFERENCE_LIST references;
202 SCH_SCREENS screens( Schematic().Root() );
204 SCH_SHEET_PATH currentSheet = GetCurrentSheet();
205
206
207 // Store the selected sheets relative to the full hierarchy so we get the correct sheet numbers
208 SCH_SHEET_LIST selectedSheets;
209
210 for( EDA_ITEM* item : selection )
211 {
212 if( item->Type() == SCH_SHEET_T )
213 {
214 SCH_SHEET_PATH subSheetPath = currentSheet;
215 subSheetPath.push_back( static_cast<SCH_SHEET*>( item ) );
216
217 sheets.GetSheetsWithinPath( selectedSheets, subSheetPath );
218 }
219 }
220
221
222 // Like above, store subsheets relative to full hierarchy for recursive annotation from current
223 // sheet
224 SCH_SHEET_LIST subSheets;
225
226 std::vector<SCH_ITEM*> tempSubSheets;
227 currentSheet.LastScreen()->GetSheets( &tempSubSheets );
228
229 for( SCH_ITEM* item : tempSubSheets )
230 {
231 SCH_SHEET_PATH subSheetPath = currentSheet;
232 subSheetPath.push_back( static_cast<SCH_SHEET*>( item ) );
233
234 sheets.GetSheetsWithinPath( subSheets, subSheetPath );
235 }
236
237
238 std::unordered_set<SCH_SYMBOL*> selectedSymbols;
239
240 if( aAnnotateScope == ANNOTATE_SELECTION )
241 selectedSymbols = getInferredSymbols( selection );
242
243
244 // Map of locked symbols
245 SCH_MULTI_UNIT_REFERENCE_MAP lockedSymbols;
246
247 // Map of previous annotation for building info messages
248 std::map<wxString, wxString> previousAnnotation;
249
250 // Test for and replace duplicate time stamps in symbols and sheets. Duplicate time stamps
251 // can happen with old schematics, schematic conversions, or manual editing of files.
252 if( aRepairTimestamps )
253 {
254 int count = screens.ReplaceDuplicateTimeStamps();
255
256 if( count )
257 {
258 wxString msg;
259 msg.Printf( _( "%d duplicate time stamps were found and replaced." ), count );
260 aReporter.ReportTail( msg, RPT_SEVERITY_WARNING );
261 }
262 }
263
264 // Collect all the sets that must be annotated together.
265 switch( aAnnotateScope )
266 {
267 case ANNOTATE_ALL:
268 sheets.GetMultiUnitSymbols( lockedSymbols );
269 break;
270
272 currentSheet.GetMultiUnitSymbols( lockedSymbols );
273
274 if( aRecursive )
275 subSheets.GetMultiUnitSymbols( lockedSymbols );
276
277 break;
278
280 for( SCH_SYMBOL* symbol : selectedSymbols )
281 currentSheet.AppendMultiUnitSymbol( lockedSymbols, symbol );
282
283 if( aRecursive )
284 selectedSheets.GetMultiUnitSymbols( lockedSymbols );
285
286 break;
287 }
288
289 // Store previous annotations for building info messages
290 mapExistingAnnotation( previousAnnotation );
291
292 // Set sheet number and number of sheets.
294
295 // Build symbol list
296 switch( aAnnotateScope )
297 {
298 case ANNOTATE_ALL:
299 sheets.GetSymbols( references );
300 break;
301
303 currentSheet.GetSymbols( references );
304
305 if( aRecursive )
306 subSheets.GetSymbolsWithinPath( references, currentSheet, false, true );
307
308 break;
309
311 for( SCH_SYMBOL* symbol : selectedSymbols )
312 currentSheet.AppendSymbol( references, symbol, false, true );
313
314 if( aRecursive )
315 selectedSheets.GetSymbolsWithinPath( references, currentSheet, false, true );
316
317 break;
318 }
319
320 // Remove annotation only updates the "new" flag to indicate to the algorithm
321 // that these references must be reannotated, but keeps the original reference
322 // so that we can reannotate multi-unit symbols together.
323 if( aResetAnnotation )
324 references.RemoveAnnotation();
325
326 // Build additional list of references to be used during reannotation
327 // to avoid duplicate designators (no additional references when annotating
328 // the full schematic)
329 SCH_REFERENCE_LIST additionalRefs;
330
331 if( aAnnotateScope != ANNOTATE_ALL )
332 {
333 SCH_REFERENCE_LIST allRefs;
334 sheets.GetSymbols( allRefs );
335
336 for( size_t i = 0; i < allRefs.GetCount(); i++ )
337 {
338 if( !references.Contains( allRefs[i] ) )
339 additionalRefs.AddItem( allRefs[i] );
340 }
341 }
342
343 // Break full symbol reference into name (prefix) and number:
344 // example: IC1 become IC, and 1
345 references.SplitReferences();
346
347 // Annotate all of the references we've collected by our options
348 references.AnnotateByOptions( aSortOption, aAlgoOption, aStartNumber, lockedSymbols,
349 additionalRefs, false );
350
351 for( size_t i = 0; i < references.GetCount(); i++ )
352 {
353 SCH_REFERENCE& ref = references[i];
354 SCH_SYMBOL* symbol = ref.GetSymbol();
355 SCH_SHEET_PATH* sheet = &ref.GetSheetPath();
356
357 aCommit->Modify( symbol, sheet->LastScreen() );
358 ref.Annotate();
359
360 KIID_PATH full_uuid = sheet->Path();
361 full_uuid.push_back( symbol->m_Uuid );
362
363 wxString prevRef = previousAnnotation[ full_uuid.AsString() ];
364 wxString newRef = symbol->GetRef( sheet );
365
366 if( symbol->GetUnitCount() > 1 )
367 newRef << symbol->SubReference( symbol->GetUnitSelection( sheet ) );
368
369 wxString msg;
370
371 if( prevRef.Length() )
372 {
373 if( newRef == prevRef )
374 continue;
375
376 if( symbol->GetUnitCount() > 1 )
377 {
378 msg.Printf( _( "Updated %s (unit %s) from %s to %s." ),
379 symbol->GetValue( true, sheet, false ),
380 symbol->SubReference( symbol->GetUnit(), false ),
381 prevRef,
382 newRef );
383 }
384 else
385 {
386 msg.Printf( _( "Updated %s from %s to %s." ),
387 symbol->GetValue( true, sheet, false ),
388 prevRef,
389 newRef );
390 }
391 }
392 else
393 {
394 if( symbol->GetUnitCount() > 1 )
395 {
396 msg.Printf( _( "Annotated %s (unit %s) as %s." ),
397 symbol->GetValue( true, sheet, false ),
398 symbol->SubReference( symbol->GetUnit(), false ),
399 newRef );
400 }
401 else
402 {
403 msg.Printf( _( "Annotated %s as %s." ),
404 symbol->GetValue( true, sheet, false ),
405 newRef );
406 }
407 }
408
409 aReporter.Report( msg, RPT_SEVERITY_ACTION );
410 }
411
412 // Final control (just in case ... ).
413 if( !CheckAnnotate(
414 [ &aReporter ]( ERCE_T , const wxString& aMsg, SCH_REFERENCE* , SCH_REFERENCE* )
415 {
416 aReporter.Report( aMsg, RPT_SEVERITY_ERROR );
417 },
418 aAnnotateScope, aRecursive ) )
419 {
420 aReporter.ReportTail( _( "Annotation complete." ), RPT_SEVERITY_ACTION );
421 }
422
423 // Update on screen references, that can be modified by previous calculations:
426
427 wxWindow* erc_dlg = wxWindow::FindWindowByName( DIALOG_ERC_WINDOW_NAME );
428
429 if( erc_dlg )
430 static_cast<DIALOG_ERC*>( erc_dlg )->UpdateAnnotationWarning();
431
432 SyncView();
433 GetCanvas()->Refresh();
434 OnModify();
435
436 // Must go after OnModify() so the connectivity graph has been updated
438}
439
440
442 ANNOTATE_SCOPE_T aAnnotateScope,
443 bool aRecursive )
444{
445 SCH_REFERENCE_LIST referenceList;
446 constexpr bool includePowerSymbols = false;
448 SCH_SHEET_PATH currentSheet = GetCurrentSheet();
449
450 // Build the list of symbols
451 switch( aAnnotateScope )
452 {
453 case ANNOTATE_ALL:
454 Schematic().GetSheets().GetSymbols( referenceList );
455 break;
456
458 GetCurrentSheet().GetSymbols( referenceList, includePowerSymbols );
459
460 if( aRecursive )
461 {
462 SCH_SHEET_LIST subSheets;
463
464 std::vector<SCH_ITEM*> tempSubSheets;
465 currentSheet.LastScreen()->GetSheets( &tempSubSheets );
466
467 for( SCH_ITEM* item : tempSubSheets )
468 {
469 SCH_SHEET_PATH subSheetPath = currentSheet;
470 subSheetPath.push_back( static_cast<SCH_SHEET*>( item ) );
471
472 sheets.GetSheetsWithinPath( subSheets, subSheetPath );
473 }
474
475 for( SCH_SHEET_PATH sheet : subSheets )
476 sheet.GetSymbols( referenceList, includePowerSymbols );
477 }
478
479 break;
480
483 EE_SELECTION& selection = selTool->RequestSelection();
484
485 for( SCH_SYMBOL* symbol : getInferredSymbols( selection ) )
486 GetCurrentSheet().AppendSymbol( referenceList, symbol, false, true );
487
488 if( aRecursive )
489 {
490 SCH_SHEET_LIST selectedSheets;
491
492 for( EDA_ITEM* item : selection.Items() )
493 {
494 if( item->Type() == SCH_SHEET_T )
495 {
496 SCH_SHEET_PATH subSheetPath = currentSheet;
497 subSheetPath.push_back( static_cast<SCH_SHEET*>( item ) );
498
499 sheets.GetSheetsWithinPath( selectedSheets, subSheetPath );
500 }
501 }
502
503 for( SCH_SHEET_PATH sheet : selectedSheets )
504 sheet.GetSymbols( referenceList, includePowerSymbols );
505 }
506
507 break;
508 }
509
510 // Empty schematic does not need annotation
511 if( referenceList.GetCount() == 0 )
512 return 0;
513
514 return referenceList.CheckAnnotation( aErrorHandler );
515}
std::unordered_set< SCH_SYMBOL * > getInferredSymbols(const EE_SELECTION &aSelection)
Definition: annotate.cpp:162
COMMIT & Modify(EDA_ITEM *aItem, BASE_SCREEN *aScreen=nullptr)
Create an undo entry for an item that has been already modified.
Definition: commit.h:105
virtual void Refresh(bool aEraseBackground=true, const wxRect *aRect=nullptr) override
A base class for most all the KiCad significant classes used in schematics and boards.
Definition: eda_item.h:88
const KIID m_Uuid
Definition: eda_item.h:485
KICAD_T Type() const
Returns the type of object.
Definition: eda_item.h:100
EDA_ITEM * GetParent() const
Definition: eda_item.h:102
EE_SELECTION & RequestSelection(const std::vector< KICAD_T > &aScanTypes={ SCH_LOCATE_ANY_T }, bool aPromoteCellSelections=false)
Return either an existing selection (filtered), or the selection at the current cursor position if th...
EE_SELECTION & GetSelection()
wxString AsString() const
Definition: kiid.cpp:368
A pure virtual class used to derive REPORTER objects from.
Definition: reporter.h:71
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.
Definition: reporter.h:99
virtual REPORTER & Report(const wxString &aText, SEVERITY aSeverity=RPT_SEVERITY_UNDEFINED)=0
Report a string with a given severity.
SCH_SHEET_LIST GetSheets() const override
Builds and returns an updated schematic hierarchy TODO: can this be cached?
Definition: schematic.h:100
SCH_DRAW_PANEL * GetCanvas() const override
Return a pointer to GAL-based canvas of given EDA draw frame.
void SyncView()
Mark all items for refresh.
virtual void Push(const wxString &aMessage=wxT("A commit"), int aCommitFlags=0) override
Revert the commit by restoring the modified items state.
Definition: sch_commit.cpp:405
void mapExistingAnnotation(std::map< wxString, wxString > &aMap)
Fill a map of uuid -> reference from the currently loaded schematic.
Definition: annotate.cpp:39
void OnModify() override
Must be called after a schematic change in order to set the "modify" flag and update other data struc...
SCH_SCREEN * GetScreen() const override
Return a pointer to a BASE_SCREEN or one of its derivatives.
void AnnotateSymbols(SCH_COMMIT *aCommit, ANNOTATE_SCOPE_T aAnnotateScope, ANNOTATE_ORDER_T aSortOption, ANNOTATE_ALGO_T aAlgoOption, bool aRecursive, int aStartNumber, bool aResetAnnotation, bool aRepairTimestamps, REPORTER &aReporter)
Annotate the symbols in the schematic that are not currently annotated.
Definition: annotate.cpp:193
SCH_SHEET_PATH & GetCurrentSheet() const
SCHEMATIC & Schematic() const
void DeleteAnnotation(ANNOTATE_SCOPE_T aAnnotateScope, bool aRecursive)
Clear the current symbol annotation.
Definition: annotate.cpp:61
void SetSheetNumberAndCount()
Set the m_ScreenNumber and m_NumberOfScreens members for screens.
int CheckAnnotate(ANNOTATION_ERROR_HANDLER aErrorHandler, ANNOTATE_SCOPE_T aAnnotateScope=ANNOTATE_ALL, bool aRecursive=true)
Check for annotation errors.
Definition: annotate.cpp:441
void UpdateNetHighlightStatus()
Instances are attached to a symbol or sheet and provide a place for the symbol's value,...
Definition: sch_field.h:51
int GetId() const
Definition: sch_field.h:133
Base class for any item which can be embedded within the SCHEMATIC container class,...
Definition: sch_item.h:174
int GetUnit() const
Definition: sch_item.h:237
Container to create a flattened list of symbols because in a complex hierarchy, a symbol can be used ...
bool Contains(const SCH_REFERENCE &aItem) const
Return true if aItem exists in this list.
void AnnotateByOptions(enum ANNOTATE_ORDER_T aSortOption, enum ANNOTATE_ALGO_T aAlgoOption, int aStartNumber, SCH_MULTI_UNIT_REFERENCE_MAP aLockedUnitMap, const SCH_REFERENCE_LIST &aAdditionalRefs, bool aStartAtCurrent)
Annotate the references by the provided options.
size_t GetCount() const
void SplitReferences()
Attempt to split all reference designators into a name (U) and number (1).
void RemoveAnnotation()
Treat all symbols in this list as non-annotated.
void AddItem(const SCH_REFERENCE &aItem)
int CheckAnnotation(ANNOTATION_ERROR_HANDLER aErrorHandler)
Check for annotations errors.
A helper to define a symbol's reference designator in a schematic.
const SCH_SHEET_PATH & GetSheetPath() const
SCH_SYMBOL * GetSymbol() const
void Annotate()
Update the annotation of the symbol according the current object state.
Container class that holds multiple SCH_SCREEN objects in a hierarchy.
Definition: sch_screen.h:704
int ReplaceDuplicateTimeStamps()
Test all sheet and symbol objects in the schematic for duplicate time stamps and replaces them as nec...
void GetSheets(std::vector< SCH_ITEM * > *aItems) const
Similar to Items().OfType( SCH_SHEET_T ), but return the sheets in a deterministic order (L-R,...
A container for handling SCH_SHEET_PATH objects in a flattened hierarchy.
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...
void GetSymbols(SCH_REFERENCE_LIST &aReferences, bool aIncludePowerSymbols=true, bool aForceIncludeOrphanSymbols=false) const
Add a SCH_REFERENCE object to aReferences for each symbol in the list of sheets.
void GetSymbolsWithinPath(SCH_REFERENCE_LIST &aReferences, const SCH_SHEET_PATH &aSheetPath, bool aIncludePowerSymbols=true, bool aForceIncludeOrphanSymbols=false) const
Add a SCH_REFERENCE object to aReferences for each symbol in the list of sheets that are contained wi...
void GetSheetsWithinPath(SCH_SHEET_PATHS &aSheets, const SCH_SHEET_PATH &aSheetPath) const
Add a SCH_SHEET_PATH object to aSheets for each sheet in the list that are contained within aSheetPat...
Handle access to a stack of flattened SCH_SHEET objects by way of a path for creating a flattened sch...
void AppendMultiUnitSymbol(SCH_MULTI_UNIT_REFERENCE_MAP &aRefList, SCH_SYMBOL *aSymbol, bool aIncludePowerSymbols=true) const
Append a SCH_REFERENCE_LIST object to aRefList based on aSymbol, storing same-reference set of multi-...
void GetSymbols(SCH_REFERENCE_LIST &aReferences, bool aIncludePowerSymbols=true, bool aForceIncludeOrphanSymbols=false) const
Adds SCH_REFERENCE object to aReferences for each symbol in the sheet.
KIID_PATH Path() const
Get the sheet path as an KIID_PATH.
void UpdateAllScreenReferences() const
Update all the symbol references for this sheet path.
SCH_SCREEN * LastScreen()
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 sh...
void AppendSymbol(SCH_REFERENCE_LIST &aReferences, SCH_SYMBOL *aSymbol, bool aIncludePowerSymbols=true, bool aForceIncludeOrphanSymbols=false) const
Append a SCH_REFERENCE object to aReferences based on aSymbol.
void push_back(SCH_SHEET *aSheet)
Forwarded method from std::vector.
Sheet symbol placed in a schematic, and is the entry point for a sub schematic.
Definition: sch_sheet.h:57
Schematic symbol object.
Definition: sch_symbol.h:108
wxString SubReference(int aUnit, bool aAddSeparator=true) const
Definition: sch_symbol.cpp:827
bool IsAnnotated(const SCH_SHEET_PATH *aSheet) const
Check if the symbol has a valid annotation (reference) for the given sheet path.
Definition: sch_symbol.cpp:786
const wxString GetValue(bool aResolve, const SCH_SHEET_PATH *aPath, bool aAllowExtraText) const override
Definition: sch_symbol.cpp:878
void ClearAnnotation(const SCH_SHEET_PATH *aSheetPath, bool aResetPrefix)
Clear exiting symbol annotation.
int GetUnitSelection(const SCH_SHEET_PATH *aSheet) const
Return the instance-specific unit selection for the given sheet path.
Definition: sch_symbol.cpp:836
int GetUnitCount() const override
Return the number of units per package of the symbol.
Definition: sch_symbol.cpp:449
const wxString GetRef(const SCH_SHEET_PATH *aSheet, bool aIncludeUnit=false) const override
Definition: sch_symbol.cpp:711
TOOL_MANAGER * m_toolManager
Definition: tools_holder.h:167
This file is part of the common library.
#define DIALOG_ERC_WINDOW_NAME
Definition: dialog_erc.h:40
#define _(s)
ERCE_T
ERC error codes.
Definition: erc_settings.h:37
@ RPT_SEVERITY_WARNING
@ RPT_SEVERITY_ERROR
@ RPT_SEVERITY_ACTION
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.
ANNOTATE_ORDER_T
Schematic annotation order options.
ANNOTATE_SCOPE_T
Schematic annotation scope options.
@ ANNOTATE_SELECTION
Annotate the selection.
@ ANNOTATE_CURRENT_SHEET
Annotate the current sheet.
@ ANNOTATE_ALL
Annotate the full schematic.
ANNOTATE_ALGO_T
Schematic annotation type options.
std::map< wxString, SCH_REFERENCE_LIST > SCH_MULTI_UNIT_REFERENCE_MAP
Container to map reference designators for multi-unit parts.
Definition for symbol library class.
@ REFERENCE_FIELD
Field Reference of part, i.e. "IC21".
@ SCH_SYMBOL_T
Definition: typeinfo.h:172
@ SCH_FIELD_T
Definition: typeinfo.h:150
@ SCH_SHEET_T
Definition: typeinfo.h:174