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/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;
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 REPORTER& aReporter )
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 // aSheet == nullptr means all sheets
76 if( !aSheet || symbol->IsAnnotated( aSheet ) )
77 {
78 wxString msg;
79
80 if( symbol->GetUnitCount() > 1 )
81 {
82 msg.Printf( _( "Cleared annotation for %s (unit %s)." ),
83 symbol->GetValue( true, aSheet, false ),
84 symbol->SubReference( symbol->GetUnit(), false ) );
85 }
86 else
87 {
88 msg.Printf( _( "Cleared annotation for %s." ),
89 symbol->GetValue( true, aSheet, false ) );
90 }
91
92 symbol->ClearAnnotation( aSheet, aResetPrefixes );
93 aReporter.Report( msg, RPT_SEVERITY_ACTION );
94 }
95 };
96
97 auto clearSheetAnnotation =
98 [&]( SCH_SCREEN* aScreen, SCH_SHEET_PATH* aSheet, bool aResetPrefixes )
99 {
100 for( SCH_ITEM* item : aScreen->Items().OfType( SCH_SYMBOL_T ) )
101 clearSymbolAnnotation( item, aScreen, aSheet, aResetPrefixes );
102 };
103
104 switch( aAnnotateScope )
105 {
106 case ANNOTATE_ALL:
107 {
108 for( const SCH_SHEET_PATH& sheet : sheets )
109 clearSheetAnnotation( sheet.LastScreen(), nullptr, false );
110
111 break;
112 }
114 {
115 clearSheetAnnotation( screen, &currentSheet, false );
116
117 if( aRecursive )
118 {
119 SCH_SHEET_LIST subSheets;
120
121 std::vector<SCH_ITEM*> tempSubSheets;
122 currentSheet.LastScreen()->GetSheets( &tempSubSheets );
123
124 for( SCH_ITEM* item : tempSubSheets )
125 {
126 SCH_SHEET_PATH subSheetPath = currentSheet;
127 subSheetPath.push_back( static_cast<SCH_SHEET*>( item ) );
128
129 sheets.GetSheetsWithinPath( subSheets, subSheetPath );
130 }
131
132 for( SCH_SHEET_PATH sheet : subSheets )
133 clearSheetAnnotation( sheet.LastScreen(), &sheet, false );
134 }
135
136 break;
137 }
138
140 {
142 EE_SELECTION& selection = selTool->RequestSelection();
143 SCH_SHEET_LIST selectedSheets;
144
145 for( EDA_ITEM* item : selection.Items() )
146 {
147 if( item->Type() == SCH_SYMBOL_T )
148 clearSymbolAnnotation( item, screen, &currentSheet, false );
149
150 if( item->Type() == SCH_SHEET_T && aRecursive )
151 {
152 SCH_SHEET_PATH subSheetPath = currentSheet;
153 subSheetPath.push_back( static_cast<SCH_SHEET*>( item ) );
154
155 sheets.GetSheetsWithinPath( selectedSheets, subSheetPath );
156 }
157 }
158
159 for( SCH_SHEET_PATH sheet : selectedSheets )
160 clearSheetAnnotation( sheet.LastScreen(), &sheet, false );
161
162 break;
163 }
164 }
165
166 // Update the references for the sheet that is currently being displayed.
168
169 wxWindow* erc_dlg = wxWindow::FindWindowByName( DIALOG_ERC_WINDOW_NAME );
170
171 if( erc_dlg )
172 static_cast<DIALOG_ERC*>( erc_dlg )->UpdateAnnotationWarning();
173
174 commit.Push( _( "Delete Annotation" ) );
175
176 // Must go after OnModify() so the connectivity graph has been updated
178}
179
180
181std::unordered_set<SCH_SYMBOL*> getInferredSymbols( const EE_SELECTION& aSelection )
182{
183 std::unordered_set<SCH_SYMBOL*> symbols;
184
185 for( EDA_ITEM* item : aSelection )
186 {
187 switch( item->Type() )
188 {
189 case SCH_FIELD_T:
190 {
191 SCH_FIELD* field = static_cast<SCH_FIELD*>( item );
192
193 if( field->GetId() == REFERENCE_FIELD && field->GetParent()->Type() == SCH_SYMBOL_T )
194 symbols.insert( static_cast<SCH_SYMBOL*>( field->GetParent() ) );
195
196 break;
197 }
198
199 case SCH_SYMBOL_T:
200 symbols.insert( static_cast<SCH_SYMBOL*>( item ) );
201 break;
202
203 default:
204 break;
205 }
206 }
207
208 return symbols;
209}
210
211
213 ANNOTATE_ORDER_T aSortOption, ANNOTATE_ALGO_T aAlgoOption,
214 bool aRecursive, int aStartNumber, bool aResetAnnotation,
215 bool aRepairTimestamps, REPORTER& aReporter )
216{
218 EE_SELECTION& selection = selTool->GetSelection();
219
220 SCH_REFERENCE_LIST references;
221 SCH_SCREENS screens( Schematic().Root() );
223 SCH_SHEET_PATH currentSheet = GetCurrentSheet();
224
225
226 // Store the selected sheets relative to the full hierarchy so we get the correct sheet numbers
227 SCH_SHEET_LIST selectedSheets;
228
229 for( EDA_ITEM* item : selection )
230 {
231 if( item->Type() == SCH_SHEET_T )
232 {
233 SCH_SHEET_PATH subSheetPath = currentSheet;
234 subSheetPath.push_back( static_cast<SCH_SHEET*>( item ) );
235
236 sheets.GetSheetsWithinPath( selectedSheets, subSheetPath );
237 }
238 }
239
240
241 // Like above, store subsheets relative to full hierarchy for recursive annotation from current
242 // sheet
243 SCH_SHEET_LIST subSheets;
244
245 std::vector<SCH_ITEM*> tempSubSheets;
246 currentSheet.LastScreen()->GetSheets( &tempSubSheets );
247
248 for( SCH_ITEM* item : tempSubSheets )
249 {
250 SCH_SHEET_PATH subSheetPath = currentSheet;
251 subSheetPath.push_back( static_cast<SCH_SHEET*>( item ) );
252
253 sheets.GetSheetsWithinPath( subSheets, subSheetPath );
254 }
255
256
257 std::unordered_set<SCH_SYMBOL*> selectedSymbols;
258
259 if( aAnnotateScope == ANNOTATE_SELECTION )
260 selectedSymbols = getInferredSymbols( selection );
261
262
263 // Map of locked symbols
264 SCH_MULTI_UNIT_REFERENCE_MAP lockedSymbols;
265
266 // Map of previous annotation for building info messages
267 std::map<wxString, wxString> previousAnnotation;
268
269 // Test for and replace duplicate time stamps in symbols and sheets. Duplicate time stamps
270 // can happen with old schematics, schematic conversions, or manual editing of files.
271 if( aRepairTimestamps )
272 {
273 int count = screens.ReplaceDuplicateTimeStamps();
274
275 if( count )
276 {
277 wxString msg;
278 msg.Printf( _( "%d duplicate time stamps were found and replaced." ), count );
279 aReporter.ReportTail( msg, RPT_SEVERITY_WARNING );
280 }
281 }
282
283 // Collect all the sets that must be annotated together.
284 switch( aAnnotateScope )
285 {
286 case ANNOTATE_ALL:
287 sheets.GetMultiUnitSymbols( lockedSymbols );
288 break;
289
291 currentSheet.GetMultiUnitSymbols( lockedSymbols );
292
293 if( aRecursive )
294 subSheets.GetMultiUnitSymbols( lockedSymbols );
295
296 break;
297
299 for( SCH_SYMBOL* symbol : selectedSymbols )
300 currentSheet.AppendMultiUnitSymbol( lockedSymbols, symbol );
301
302 if( aRecursive )
303 selectedSheets.GetMultiUnitSymbols( lockedSymbols );
304
305 break;
306 }
307
308 // Store previous annotations for building info messages
309 mapExistingAnnotation( previousAnnotation );
310
311 // Set sheet number and number of sheets.
313
314 // Build symbol list
315 switch( aAnnotateScope )
316 {
317 case ANNOTATE_ALL:
318 sheets.GetSymbols( references );
319 break;
320
322 currentSheet.GetSymbols( references );
323
324 if( aRecursive )
325 subSheets.GetSymbolsWithinPath( references, currentSheet, false, true );
326
327 break;
328
330 for( SCH_SYMBOL* symbol : selectedSymbols )
331 currentSheet.AppendSymbol( references, symbol, false, true );
332
333 if( aRecursive )
334 selectedSheets.GetSymbolsWithinPath( references, currentSheet, false, true );
335
336 break;
337 }
338
339 // Remove annotation only updates the "new" flag to indicate to the algorithm
340 // that these references must be reannotated, but keeps the original reference
341 // so that we can reannotate multi-unit symbols together.
342 if( aResetAnnotation )
343 references.RemoveAnnotation();
344
345 // Build additional list of references to be used during reannotation
346 // to avoid duplicate designators (no additional references when annotating
347 // the full schematic)
348 SCH_REFERENCE_LIST additionalRefs;
349
350 if( aAnnotateScope != ANNOTATE_ALL )
351 {
352 SCH_REFERENCE_LIST allRefs;
353 sheets.GetSymbols( allRefs );
354
355 for( size_t i = 0; i < allRefs.GetCount(); i++ )
356 {
357 if( !references.Contains( allRefs[i] ) )
358 additionalRefs.AddItem( allRefs[i] );
359 }
360 }
361
362 // Break full symbol reference into name (prefix) and number:
363 // example: IC1 become IC, and 1
364 references.SplitReferences();
365
366 // Annotate all of the references we've collected by our options
367 references.AnnotateByOptions( aSortOption, aAlgoOption, aStartNumber, lockedSymbols,
368 additionalRefs, false );
369
370 for( size_t i = 0; i < references.GetCount(); i++ )
371 {
372 SCH_REFERENCE& ref = references[i];
373 SCH_SYMBOL* symbol = ref.GetSymbol();
374 SCH_SHEET_PATH* sheet = &ref.GetSheetPath();
375
376 aCommit->Modify( symbol, sheet->LastScreen() );
377 ref.Annotate();
378
379 KIID_PATH full_uuid = sheet->Path();
380 full_uuid.push_back( symbol->m_Uuid );
381
382 wxString prevRef = previousAnnotation[ full_uuid.AsString() ];
383 wxString newRef = symbol->GetRef( sheet );
384
385 if( symbol->GetUnitCount() > 1 )
386 newRef << symbol->SubReference( symbol->GetUnitSelection( sheet ) );
387
388 wxString msg;
389
390 if( prevRef.Length() )
391 {
392 if( newRef == prevRef )
393 continue;
394
395 if( symbol->GetUnitCount() > 1 )
396 {
397 msg.Printf( _( "Updated %s (unit %s) from %s to %s." ),
398 symbol->GetValue( true, sheet, false ),
399 symbol->SubReference( symbol->GetUnit(), false ),
400 prevRef,
401 newRef );
402 }
403 else
404 {
405 msg.Printf( _( "Updated %s from %s to %s." ),
406 symbol->GetValue( true, sheet, false ),
407 prevRef,
408 newRef );
409 }
410 }
411 else
412 {
413 if( symbol->GetUnitCount() > 1 )
414 {
415 msg.Printf( _( "Annotated %s (unit %s) as %s." ),
416 symbol->GetValue( true, sheet, false ),
417 symbol->SubReference( symbol->GetUnit(), false ),
418 newRef );
419 }
420 else
421 {
422 msg.Printf( _( "Annotated %s as %s." ),
423 symbol->GetValue( true, sheet, false ),
424 newRef );
425 }
426 }
427
428 aReporter.Report( msg, RPT_SEVERITY_ACTION );
429 }
430
431 // Final control (just in case ... ).
432 if( !CheckAnnotate(
433 [ &aReporter ]( ERCE_T , const wxString& aMsg, SCH_REFERENCE* , SCH_REFERENCE* )
434 {
435 aReporter.Report( aMsg, RPT_SEVERITY_ERROR );
436 },
437 aAnnotateScope, aRecursive ) )
438 {
439 aReporter.ReportTail( _( "Annotation complete." ), RPT_SEVERITY_ACTION );
440 }
441
442 // Update on screen references, that can be modified by previous calculations:
445
446 wxWindow* erc_dlg = wxWindow::FindWindowByName( DIALOG_ERC_WINDOW_NAME );
447
448 if( erc_dlg )
449 static_cast<DIALOG_ERC*>( erc_dlg )->UpdateAnnotationWarning();
450
451 SyncView();
452 GetCanvas()->Refresh();
453 OnModify();
454
455 // Must go after OnModify() so the connectivity graph has been updated
457}
458
459
461 ANNOTATE_SCOPE_T aAnnotateScope,
462 bool aRecursive )
463{
464 SCH_REFERENCE_LIST referenceList;
465 constexpr bool includePowerSymbols = false;
467 SCH_SHEET_PATH currentSheet = GetCurrentSheet();
468
469 // Build the list of symbols
470 switch( aAnnotateScope )
471 {
472 case ANNOTATE_ALL:
473 sheets.GetSymbols( referenceList );
474 break;
475
477 GetCurrentSheet().GetSymbols( referenceList, includePowerSymbols );
478
479 if( aRecursive )
480 {
481 SCH_SHEET_LIST subSheets;
482
483 std::vector<SCH_ITEM*> tempSubSheets;
484 currentSheet.LastScreen()->GetSheets( &tempSubSheets );
485
486 for( SCH_ITEM* item : tempSubSheets )
487 {
488 SCH_SHEET_PATH subSheetPath = currentSheet;
489 subSheetPath.push_back( static_cast<SCH_SHEET*>( item ) );
490
491 sheets.GetSheetsWithinPath( subSheets, subSheetPath );
492 }
493
494 for( SCH_SHEET_PATH sheet : subSheets )
495 sheet.GetSymbols( referenceList, includePowerSymbols );
496 }
497
498 break;
499
502 EE_SELECTION& selection = selTool->RequestSelection();
503
504 for( SCH_SYMBOL* symbol : getInferredSymbols( selection ) )
505 GetCurrentSheet().AppendSymbol( referenceList, symbol, false, true );
506
507 if( aRecursive )
508 {
509 SCH_SHEET_LIST selectedSheets;
510
511 for( EDA_ITEM* item : selection.Items() )
512 {
513 if( item->Type() == SCH_SHEET_T )
514 {
515 SCH_SHEET_PATH subSheetPath = currentSheet;
516 subSheetPath.push_back( static_cast<SCH_SHEET*>( item ) );
517
518 sheets.GetSheetsWithinPath( selectedSheets, subSheetPath );
519 }
520 }
521
522 for( SCH_SHEET_PATH sheet : selectedSheets )
523 sheet.GetSymbols( referenceList, includePowerSymbols );
524 }
525
526 break;
527 }
528
529 // Empty schematic does not need annotation
530 if( referenceList.GetCount() == 0 )
531 return 0;
532
533 return referenceList.CheckAnnotation( aErrorHandler );
534}
std::unordered_set< SCH_SYMBOL * > getInferredSymbols(const EE_SELECTION &aSelection)
Definition: annotate.cpp:181
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:89
const KIID m_Uuid
Definition: eda_item.h:489
KICAD_T Type() const
Returns the type of object.
Definition: eda_item.h:101
EDA_ITEM * GetParent() const
Definition: eda_item.h:103
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:356
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 BuildUnorderedSheetList() const
Definition: schematic.h:101
SCH_SHEET_LIST BuildSheetListSortedByPageNumbers() const override
Definition: schematic.h:96
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:406
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...
void DeleteAnnotation(ANNOTATE_SCOPE_T aAnnotateScope, bool aRecursive, REPORTER &aReporter)
Clear the current symbol annotation.
Definition: annotate.cpp:60
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:212
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:460
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:166
int GetUnit() const
Definition: sch_item.h:229
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:710
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 GetSheetsWithinPath(std::vector< SCH_SHEET_PATH > &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...
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...
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:105
wxString SubReference(int aUnit, bool aAddSeparator=true) const
Definition: sch_symbol.cpp:836
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:795
const wxString GetValue(bool aResolve, const SCH_SHEET_PATH *aPath, bool aAllowExtraText) const override
Definition: sch_symbol.cpp:887
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:845
int GetUnitCount() const override
Return the number of units per package of the symbol.
Definition: sch_symbol.cpp:451
const wxString GetRef(const SCH_SHEET_PATH *aSheet, bool aIncludeUnit=false) const override
Definition: sch_symbol.cpp:720
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