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 <schematic_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 SCHEMATIC_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 GetCanvas()->Refresh();
158
159 // Must go after OnModify() so the connectivity graph has been updated
161}
162
163
164std::unordered_set<SCH_SYMBOL*> getInferredSymbols( const EE_SELECTION& aSelection )
165{
166 std::unordered_set<SCH_SYMBOL*> symbols;
167
168 for( EDA_ITEM* item : aSelection )
169 {
170 switch( item->Type() )
171 {
172 case SCH_FIELD_T:
173 {
174 SCH_FIELD* field = static_cast<SCH_FIELD*>( item );
175
176 if( field->GetId() == REFERENCE_FIELD && field->GetParent()->Type() == SCH_SYMBOL_T )
177 symbols.insert( static_cast<SCH_SYMBOL*>( field->GetParent() ) );
178
179 break;
180 }
181
182 case SCH_SYMBOL_T:
183 symbols.insert( static_cast<SCH_SYMBOL*>( item ) );
184 break;
185
186 default:
187 break;
188 }
189 }
190
191 return symbols;
192}
193
194
196 ANNOTATE_ORDER_T aSortOption,
197 ANNOTATE_ALGO_T aAlgoOption,
198 bool aRecursive,
199 int aStartNumber,
200 bool aResetAnnotation,
201 bool aRepairTimestamps,
202 REPORTER& aReporter,
203 bool appendUndo )
204{
206 EE_SELECTION& selection = selTool->GetSelection();
207
208 SCH_REFERENCE_LIST references;
209 SCH_SCREENS screens( Schematic().Root() );
211 SCH_SHEET_PATH currentSheet = GetCurrentSheet();
212
213
214 // Store the selected sheets relative to the full hierarchy so we get the correct sheet numbers
215 SCH_SHEET_LIST selectedSheets;
216
217 for( EDA_ITEM* item : selection )
218 {
219 if( item->Type() == SCH_SHEET_T )
220 {
221 SCH_SHEET_PATH subSheetPath = currentSheet;
222 subSheetPath.push_back( static_cast<SCH_SHEET*>( item ) );
223
224 sheets.GetSheetsWithinPath( selectedSheets, subSheetPath );
225 }
226 }
227
228
229 // Like above, store subsheets relative to full hierarchy for recursive annotation from current
230 // sheet
231 SCH_SHEET_LIST subSheets;
232
233 std::vector<SCH_ITEM*> tempSubSheets;
234 currentSheet.LastScreen()->GetSheets( &tempSubSheets );
235
236 for( SCH_ITEM* item : tempSubSheets )
237 {
238 SCH_SHEET_PATH subSheetPath = currentSheet;
239 subSheetPath.push_back( static_cast<SCH_SHEET*>( item ) );
240
241 sheets.GetSheetsWithinPath( subSheets, subSheetPath );
242 }
243
244
245 std::unordered_set<SCH_SYMBOL*> selectedSymbols;
246
247 if( aAnnotateScope == ANNOTATE_SELECTION )
248 selectedSymbols = getInferredSymbols( selection );
249
250
251 // Map of locked symbols
252 SCH_MULTI_UNIT_REFERENCE_MAP lockedSymbols;
253
254 // Map of previous annotation for building info messages
255 std::map<wxString, wxString> previousAnnotation;
256
257 // Test for and replace duplicate time stamps in symbols and sheets. Duplicate time stamps
258 // can happen with old schematics, schematic conversions, or manual editing of files.
259 if( aRepairTimestamps )
260 {
261 int count = screens.ReplaceDuplicateTimeStamps();
262
263 if( count )
264 {
265 wxString msg;
266 msg.Printf( _( "%d duplicate time stamps were found and replaced." ), count );
267 aReporter.ReportTail( msg, RPT_SEVERITY_WARNING );
268 }
269 }
270
271 // Collect all the sets that must be annotated together.
272 switch( aAnnotateScope )
273 {
274 case ANNOTATE_ALL:
275 sheets.GetMultiUnitSymbols( lockedSymbols );
276 break;
277
279 currentSheet.GetMultiUnitSymbols( lockedSymbols );
280 break;
281
283 for( SCH_SYMBOL* symbol : selectedSymbols )
284 currentSheet.AppendMultiUnitSymbol( lockedSymbols, symbol );
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 SaveCopyInUndoList( sheet->LastScreen(), symbol, UNDO_REDO::CHANGED, appendUndo );
358 appendUndo = true;
359 ref.Annotate();
360
361 KIID_PATH full_uuid = sheet->Path();
362 full_uuid.push_back( symbol->m_Uuid );
363
364 wxString prevRef = previousAnnotation[ full_uuid.AsString() ];
365 wxString newRef = symbol->GetRef( sheet );
366
367 if( symbol->GetUnitCount() > 1 )
368 newRef << LIB_SYMBOL::SubReference( symbol->GetUnitSelection( sheet ) );
369
370 wxString msg;
371
372 if( prevRef.Length() )
373 {
374 if( newRef == prevRef )
375 continue;
376
377 if( symbol->GetUnitCount() > 1 )
378 {
379 msg.Printf( _( "Updated %s (unit %s) from %s to %s." ),
380 symbol->GetValueFieldText( true, sheet, false ),
381 LIB_SYMBOL::SubReference( symbol->GetUnit(), false ),
382 prevRef,
383 newRef );
384 }
385 else
386 {
387 msg.Printf( _( "Updated %s from %s to %s." ),
388 symbol->GetValueFieldText( true, sheet, false ),
389 prevRef,
390 newRef );
391 }
392 }
393 else
394 {
395 if( symbol->GetUnitCount() > 1 )
396 {
397 msg.Printf( _( "Annotated %s (unit %s) as %s." ),
398 symbol->GetValueFieldText( true, sheet, false ),
399 LIB_SYMBOL::SubReference( symbol->GetUnit(), false ),
400 newRef );
401 }
402 else
403 {
404 msg.Printf( _( "Annotated %s as %s." ),
405 symbol->GetValueFieldText( true, sheet, false ),
406 newRef );
407 }
408 }
409
410 aReporter.Report( msg, RPT_SEVERITY_ACTION );
411 }
412
413 // Final control (just in case ... ).
414 if( !CheckAnnotate(
415 [ &aReporter ]( ERCE_T , const wxString& aMsg, SCH_REFERENCE* , SCH_REFERENCE* )
416 {
417 aReporter.Report( aMsg, RPT_SEVERITY_ERROR );
418 },
419 aAnnotateScope, aRecursive ) )
420 {
421 aReporter.ReportTail( _( "Annotation complete." ), RPT_SEVERITY_ACTION );
422 }
423
424 // Update on screen references, that can be modified by previous calculations:
427
428 wxWindow* erc_dlg = wxWindow::FindWindowByName( DIALOG_ERC_WINDOW_NAME );
429
430 if( erc_dlg )
431 static_cast<DIALOG_ERC*>( erc_dlg )->UpdateAnnotationWarning();
432
433 SyncView();
434 GetCanvas()->Refresh();
435 OnModify();
436
437 // Must go after OnModify() so the connectivity graph has been updated
439}
440
441
443 ANNOTATE_SCOPE_T aAnnotateScope,
444 bool aRecursive )
445{
446 SCH_REFERENCE_LIST referenceList;
447 constexpr bool includePowerSymbols = false;
449 SCH_SHEET_PATH currentSheet = GetCurrentSheet();
450
451 // Build the list of symbols
452 switch( aAnnotateScope )
453 {
454 case ANNOTATE_ALL:
455 Schematic().GetSheets().GetSymbols( referenceList );
456 break;
457
459 GetCurrentSheet().GetSymbols( referenceList, includePowerSymbols );
460
461 if( aRecursive )
462 {
463 SCH_SHEET_LIST subSheets;
464
465 std::vector<SCH_ITEM*> tempSubSheets;
466 currentSheet.LastScreen()->GetSheets( &tempSubSheets );
467
468 for( SCH_ITEM* item : tempSubSheets )
469 {
470 SCH_SHEET_PATH subSheetPath = currentSheet;
471 subSheetPath.push_back( static_cast<SCH_SHEET*>( item ) );
472
473 sheets.GetSheetsWithinPath( subSheets, subSheetPath );
474 }
475
476 for( SCH_SHEET_PATH sheet : subSheets )
477 sheet.GetSymbols( referenceList, includePowerSymbols );
478 }
479
480 break;
481
484 EE_SELECTION& selection = selTool->RequestSelection();
485
486 for( SCH_SYMBOL* symbol : getInferredSymbols( selection ) )
487 GetCurrentSheet().AppendSymbol( referenceList, symbol, false, true );
488
489 if( aRecursive )
490 {
491 SCH_SHEET_LIST selectedSheets;
492
493 for( EDA_ITEM* item : selection.Items() )
494 {
495 if( item->Type() == SCH_SHEET_T )
496 {
497 SCH_SHEET_PATH subSheetPath = currentSheet;
498 subSheetPath.push_back( static_cast<SCH_SHEET*>( item ) );
499
500 sheets.GetSheetsWithinPath( selectedSheets, subSheetPath );
501 }
502 }
503
504 for( SCH_SHEET_PATH sheet : selectedSheets )
505 sheet.GetSymbols( referenceList, includePowerSymbols );
506 }
507
508 break;
509 }
510
511 // Empty schematic does not need annotation
512 if( referenceList.GetCount() == 0 )
513 return 0;
514
515 return referenceList.CheckAnnotation( aErrorHandler );
516}
std::unordered_set< SCH_SYMBOL * > getInferredSymbols(const EE_SELECTION &aSelection)
Definition: annotate.cpp:164
COMMIT & Modify(EDA_ITEM *aItem, BASE_SCREEN *aScreen=nullptr)
Create an undo entry for an item that has been already modified.
Definition: commit.h:104
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:85
const KIID m_Uuid
Definition: eda_item.h:475
KICAD_T Type() const
Returns the type of object.
Definition: eda_item.h:97
EDA_ITEM * GetParent() const
Definition: eda_item.h:99
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...
EE_SELECTION & GetSelection()
wxString AsString() const
Definition: kiid.cpp:359
static wxString SubReference(int aUnit, bool aAddSeparator=true)
Definition: lib_symbol.cpp:720
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.
virtual void Push(const wxString &aMessage=wxT("A commit"), int aCommitFlags=0) override
Revert the commit by restoring the modified items state.
SCH_SHEET_LIST GetSheets() const override
Builds and returns an updated schematic hierarchy TODO: can this be cached?
Definition: schematic.h:97
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: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 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 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:442
void UpdateNetHighlightStatus()
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:195
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:125
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 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:662
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:81
int GetUnitCount() const
Return the number of units per package of the symbol.
Definition: sch_symbol.cpp:427
int GetUnit() const
Definition: sch_symbol.h:231
const wxString GetRef(const SCH_SHEET_PATH *aSheet, bool aIncludeUnit=false) const
Return the reference for the given sheet path.
Definition: sch_symbol.cpp:698
void ClearAnnotation(const SCH_SHEET_PATH *aSheetPath, bool aResetPrefix)
Clear exiting symbol annotation.
const wxString GetValueFieldText(bool aResolve, const SCH_SHEET_PATH *aPath, bool aAllowExtraText) const
Definition: sch_symbol.cpp:859
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:776
int GetUnitSelection(const SCH_SHEET_PATH *aSheet) const
Return the instance-specific unit selection for the given sheet path.
Definition: sch_symbol.cpp:817
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:42
#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:146
@ SCH_FIELD_T
Definition: typeinfo.h:145
@ SCH_SHEET_T
Definition: typeinfo.h:148