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