KiCad PCB EDA Suite
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-2022 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 <erc_settings.h>
31#include <sch_reference_list.h>
32#include <symbol_library.h>
33#include <tools/ee_selection.h>
35#include <tool/tool_manager.h>
36#include <dialog_erc.h>
37
38void SCH_EDIT_FRAME::mapExistingAnnotation( std::map<wxString, wxString>& aMap )
39{
40 SCH_REFERENCE_LIST references;
41
42 Schematic().GetSheets().GetSymbols( references );
43
44 for( size_t i = 0; i < references.GetCount(); i++ )
45 {
46 SCH_SYMBOL* symbol = references[ i ].GetSymbol();
47 SCH_SHEET_PATH* curr_sheetpath = &references[ i ].GetSheetPath();
48 KIID_PATH curr_full_uuid = curr_sheetpath->Path();
49
50 curr_full_uuid.push_back( symbol->m_Uuid );
51
52 wxString ref = symbol->GetRef( curr_sheetpath, true );
53
54 if( symbol->IsAnnotated( curr_sheetpath ) )
55 aMap[ curr_full_uuid.AsString() ] = ref;
56 }
57}
58
59
60void SCH_EDIT_FRAME::DeleteAnnotation( ANNOTATE_SCOPE_T aAnnotateScope, bool aRecursive,
61 bool* aAppendUndo )
62{
63 auto clearSymbolAnnotation =
64 [&]( EDA_ITEM* aItem, SCH_SCREEN* aScreen, SCH_SHEET_PATH* aSheet, bool aResetPrefixes )
65 {
66 SCH_SYMBOL* symbol = static_cast<SCH_SYMBOL*>( aItem );
67
68 SaveCopyInUndoList( aScreen, symbol, UNDO_REDO::CHANGED, *aAppendUndo );
69 *aAppendUndo = true;
70 symbol->ClearAnnotation( aSheet, aResetPrefixes );
71 };
72
73 auto clearSheetAnnotation =
74 [&]( SCH_SCREEN* aScreen, SCH_SHEET_PATH* aSheet, bool aResetPrefixes )
75 {
76 for( SCH_ITEM* item : aScreen->Items().OfType( SCH_SYMBOL_T ) )
77 clearSymbolAnnotation( item, aScreen, aSheet, aResetPrefixes );
78 };
79
81 SCH_SCREEN* screen = GetScreen();
82 SCH_SHEET_PATH currentSheet = GetCurrentSheet();
83
84 switch( aAnnotateScope )
85 {
86 case ANNOTATE_ALL:
87 {
88 for( const SCH_SHEET_PATH& sheet : sheets )
89 clearSheetAnnotation( sheet.LastScreen(), nullptr, false );
90
91 break;
92 }
94 {
95 clearSheetAnnotation( screen, &currentSheet, false );
96
97 if( aRecursive )
98 {
99 SCH_SHEET_LIST subSheets;
100
101 std::vector<SCH_ITEM*> tempSubSheets;
102 currentSheet.LastScreen()->GetSheets( &tempSubSheets );
103
104 for( SCH_ITEM* item : tempSubSheets )
105 {
106 SCH_SHEET_PATH subSheetPath = currentSheet;
107 subSheetPath.push_back( static_cast<SCH_SHEET*>( item ) );
108
109 sheets.GetSheetsWithinPath( subSheets, subSheetPath );
110 }
111
112 for( SCH_SHEET_PATH sheet : subSheets )
113 clearSheetAnnotation( sheet.LastScreen(), &sheet, false );
114 }
115
116 break;
117 }
118
120 {
122 EE_SELECTION& selection = selTool->RequestSelection();
123 SCH_SHEET_LIST selectedSheets;
124
125 for( EDA_ITEM* item : selection.Items() )
126 {
127 if( item->Type() == SCH_SYMBOL_T )
128 clearSymbolAnnotation( item, screen, &currentSheet, false );
129
130 if( item->Type() == SCH_SHEET_T && aRecursive )
131 {
132 SCH_SHEET_PATH subSheetPath = currentSheet;
133 subSheetPath.push_back( static_cast<SCH_SHEET*>( item ) );
134
135 sheets.GetSheetsWithinPath( selectedSheets, subSheetPath );
136 }
137 }
138
139 for( SCH_SHEET_PATH sheet : selectedSheets )
140 clearSheetAnnotation( sheet.LastScreen(), &sheet, false );
141
142 break;
143 }
144 }
145
146 // Update the references for the sheet that is currently being displayed.
148
149 wxWindow* erc_dlg = wxWindow::FindWindowByName( DIALOG_ERC_WINDOW_NAME );
150
151 if( erc_dlg )
152 static_cast<DIALOG_ERC*>( erc_dlg )->UpdateAnnotationWarning();
153
154 SyncView();
155 GetCanvas()->Refresh();
156 OnModify();
157
158 // Must go after OnModify() so the connectivity graph has been updated
160}
161
162
163std::unordered_set<SCH_SYMBOL*> getInferredSymbols( const EE_SELECTION& aSelection )
164{
165 std::unordered_set<SCH_SYMBOL*> symbols;
166
167 for( EDA_ITEM* item : aSelection )
168 {
169 switch( item->Type() )
170 {
171 case SCH_FIELD_T:
172 {
173 SCH_FIELD* field = static_cast<SCH_FIELD*>( item );
174
175 if( field->GetId() == REFERENCE_FIELD && field->GetParent()->Type() == SCH_SYMBOL_T )
176 symbols.insert( static_cast<SCH_SYMBOL*>( field->GetParent() ) );
177
178 break;
179 }
180
181 case SCH_SYMBOL_T:
182 symbols.insert( static_cast<SCH_SYMBOL*>( item ) );
183 break;
184
185 default:
186 break;
187 }
188 }
189
190 return symbols;
191}
192
193
195 ANNOTATE_ORDER_T aSortOption,
196 ANNOTATE_ALGO_T aAlgoOption,
197 bool aRecursive,
198 int aStartNumber,
199 bool aResetAnnotation,
200 bool aRepairTimestamps,
201 REPORTER& aReporter,
202 bool appendUndo )
203{
205 EE_SELECTION& selection = selTool->RequestSelection();
206
207 SCH_REFERENCE_LIST references;
208 SCH_SCREENS screens( Schematic().Root() );
210 SCH_SHEET_PATH currentSheet = GetCurrentSheet();
211
212
213 // Store the selected sheets relative to the full hierarchy so we get the correct sheet numbers
214 SCH_SHEET_LIST selectedSheets;
215
216 for( EDA_ITEM* item : selection )
217 {
218 if( item->Type() == SCH_SHEET_T )
219 {
220 SCH_SHEET_PATH subSheetPath = currentSheet;
221 subSheetPath.push_back( static_cast<SCH_SHEET*>( item ) );
222
223 sheets.GetSheetsWithinPath( selectedSheets, subSheetPath );
224 }
225 }
226
227
228 // Like above, store subsheets relative to full hierarchy for recursive annotation from current
229 // sheet
230 SCH_SHEET_LIST subSheets;
231
232 std::vector<SCH_ITEM*> tempSubSheets;
233 currentSheet.LastScreen()->GetSheets( &tempSubSheets );
234
235 for( SCH_ITEM* item : tempSubSheets )
236 {
237 SCH_SHEET_PATH subSheetPath = currentSheet;
238 subSheetPath.push_back( static_cast<SCH_SHEET*>( item ) );
239
240 sheets.GetSheetsWithinPath( subSheets, subSheetPath );
241 }
242
243
244 std::unordered_set<SCH_SYMBOL*> selectedSymbols;
245
246 if( aAnnotateScope == ANNOTATE_SELECTION )
247 selectedSymbols = getInferredSymbols( selection );
248
249
250 // Map of locked symbols
251 SCH_MULTI_UNIT_REFERENCE_MAP lockedSymbols;
252
253 // Map of previous annotation for building info messages
254 std::map<wxString, wxString> previousAnnotation;
255
256 // Test for and replace duplicate time stamps in symbols and sheets. Duplicate time stamps
257 // can happen with old schematics, schematic conversions, or manual editing of files.
258 if( aRepairTimestamps )
259 {
260 int count = screens.ReplaceDuplicateTimeStamps();
261
262 if( count )
263 {
264 wxString msg;
265 msg.Printf( _( "%d duplicate time stamps were found and replaced." ), count );
266 aReporter.ReportTail( msg, RPT_SEVERITY_WARNING );
267 }
268 }
269
270 // Collect all the sets that must be annotated together.
271 switch( aAnnotateScope )
272 {
273 case ANNOTATE_ALL:
274 sheets.GetMultiUnitSymbols( lockedSymbols );
275 break;
276
278 currentSheet.GetMultiUnitSymbols( lockedSymbols );
279 break;
280
282 for( SCH_SYMBOL* symbol : selectedSymbols )
283 currentSheet.AppendMultiUnitSymbol( lockedSymbols, symbol );
284
285 break;
286 }
287
288 // Store previous annotations for building info messages
289 mapExistingAnnotation( previousAnnotation );
290
291 // Set sheet number and number of sheets.
293
294 // Build symbol list
295 switch( aAnnotateScope )
296 {
297 case ANNOTATE_ALL:
298 sheets.GetSymbols( references );
299 break;
300
302 currentSheet.GetSymbols( references );
303
304 if( aRecursive )
305 subSheets.GetSymbolsWithinPath( references, currentSheet, false, true );
306
307 break;
308
310 for( SCH_SYMBOL* symbol : selectedSymbols )
311 currentSheet.AppendSymbol( references, symbol, false, true );
312
313 if( aRecursive )
314 selectedSheets.GetSymbolsWithinPath( references, currentSheet, false, true );
315
316 break;
317 }
318
319 // Remove annotation only updates the "new" flag to indicate to the algorithm
320 // that these references must be reannotated, but keeps the original reference
321 // so that we can reannotate multi-unit symbols together.
322 if( aResetAnnotation )
323 references.RemoveAnnotation( false );
324
325 // Build additional list of references to be used during reannotation
326 // to avoid duplicate designators (no additional references when annotating
327 // the full schematic)
328 SCH_REFERENCE_LIST additionalRefs;
329
330 if( aAnnotateScope != ANNOTATE_ALL )
331 {
332 SCH_REFERENCE_LIST allRefs;
333 sheets.GetSymbols( allRefs );
334
335 for( size_t i = 0; i < allRefs.GetCount(); i++ )
336 {
337 if( !references.Contains( allRefs[i] ) )
338 additionalRefs.AddItem( allRefs[i] );
339 }
340 }
341
342 // Break full symbol reference into name (prefix) and number:
343 // example: IC1 become IC, and 1
344 references.SplitReferences();
345
346 // Annotate all of the references we've collected by our options
347 references.AnnotateByOptions( aSortOption, aAlgoOption, aStartNumber, lockedSymbols,
348 additionalRefs, false );
349
350 for( size_t i = 0; i < references.GetCount(); i++ )
351 {
352 SCH_REFERENCE& ref = references[i];
353 SCH_SYMBOL* symbol = ref.GetSymbol();
354 SCH_SHEET_PATH* sheet = &ref.GetSheetPath();
355
356 SaveCopyInUndoList( sheet->LastScreen(), symbol, UNDO_REDO::CHANGED, appendUndo );
357 appendUndo = true;
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 << LIB_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( sheet, true ),
380 LIB_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( sheet, true ),
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( sheet, true ),
398 LIB_SYMBOL::SubReference( symbol->GetUnit(), false ),
399 newRef );
400 }
401 else
402 {
403 msg.Printf( _( "Annotated %s as %s." ),
404 symbol->GetValue( sheet, true ),
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:163
virtual void Refresh(bool aEraseBackground=true, const wxRect *aRect=nullptr) override
Update the board display after modifying it by a python script (note: it is automatically called by a...
A base class for most all the KiCad significant classes used in schematics and boards.
Definition: eda_item.h:99
const KIID m_Uuid
Definition: eda_item.h:506
KICAD_T Type() const
Returns the type of object.
Definition: eda_item.h:111
EDA_ITEM * GetParent() const
Definition: eda_item.h:113
EE_SELECTION & RequestSelection(const std::vector< KICAD_T > &aScanTypes={ SCH_LOCATE_ANY_T })
Return either an existing selection (filtered), or the selection at the current cursor position if th...
wxString AsString() const
Definition: kiid.cpp:330
static wxString SubReference(int aUnit, bool aAddSeparator=true)
Definition: lib_symbol.cpp:588
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:85
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.
void mapExistingAnnotation(std::map< wxString, wxString > &aMap)
Fill a map of uuid -> reference from the currently loaded schematic.
Definition: annotate.cpp:38
void OnModify() override
Must be called after a schematic change in order to set the "modify" flag of the current screen and u...
SCH_SCREEN * GetScreen() const override
Return a pointer to a BASE_SCREEN or one of its derivatives.
void SaveCopyInUndoList(SCH_SCREEN *aScreen, SCH_ITEM *aItemToCopy, UNDO_REDO aTypeCommand, bool aAppend, bool aDirtyConnectivity=true)
Create a copy of the current schematic item, and put it in the undo list.
SCH_SHEET_PATH & GetCurrentSheet() const
SCHEMATIC & Schematic() const
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()
void DeleteAnnotation(ANNOTATE_SCOPE_T aAnnotateScope, bool aRecursive, bool *appendUndo)
Clear the current symbol annotation.
Definition: annotate.cpp:60
void AnnotateSymbols(ANNOTATE_SCOPE_T aAnnotateScope, ANNOTATE_ORDER_T aSortOption, ANNOTATE_ALGO_T aAlgoOption, bool aRecursive, int aStartNumber, bool aResetAnnotation, bool aRepairTimestamps, REPORTER &aReporter, bool appendUndo=false)
Annotate the symbols in the schematic that are not currently annotated.
Definition: annotate.cpp:194
Instances are attached to a symbol or sheet and provide a place for the symbol's value,...
Definition: sch_field.h:50
int GetId() const
Definition: sch_field.h:116
Base class for any item which can be embedded within the SCHEMATIC container class,...
Definition: sch_item.h:147
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 AddItem(const SCH_REFERENCE &aItem)
void RemoveAnnotation(bool aIncludePowerSymbols)
Treat all symbols in this list as non-annotated.
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:613
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:55
Schematic symbol object.
Definition: sch_symbol.h:79
int GetUnitCount() const
Return the number of units per package of the symbol.
Definition: sch_symbol.cpp:429
int GetUnit() const
Definition: sch_symbol.h:225
const wxString GetRef(const SCH_SHEET_PATH *aSheet, bool aIncludeUnit=false) const
Return the reference for the given sheet path.
Definition: sch_symbol.cpp:516
void ClearAnnotation(const SCH_SHEET_PATH *aSheetPath, bool aResetPrefix)
Clear exiting symbol annotation.
bool IsAnnotated(const SCH_SHEET_PATH *aSheet)
Check if the symbol has a valid annotation (reference) for the given sheet path.
Definition: sch_symbol.cpp:595
const wxString GetValue(const SCH_SHEET_PATH *sheet, bool aResolve) const
Return the instance-specific value for the given sheet path.
Definition: sch_symbol.cpp:651
int GetUnitSelection(const SCH_SHEET_PATH *aSheet) const
Return the instance-specific unit selection for the given sheet path.
Definition: sch_symbol.cpp:609
TOOL_MANAGER * m_toolManager
Definition: tools_holder.h:170
This file is part of the common library.
#define DIALOG_ERC_WINDOW_NAME
Definition: dialog_erc.h:37
#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:155
@ SCH_FIELD_T
Definition: typeinfo.h:154
@ SCH_SHEET_T
Definition: typeinfo.h:157