KiCad PCB EDA Suite
Loading...
Searching...
No Matches
sch_tool_utils.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, see <https://www.gnu.org/licenses/>.
18 */
19
20#include "sch_tool_utils.h"
21
22#include <sch_text.h>
23#include <sch_field.h>
24#include <sch_pin.h>
25#include <sch_reference_list.h>
26#include <sch_symbol.h>
27#include <sch_table.h>
28#include <sch_tablecell.h>
29#include <sch_textbox.h>
30#include <schematic.h>
31#include <sch_sheet_path.h>
32#include <sch_sheet.h>
33#include <sch_screen.h>
34#include <sch_group.h>
35#include <kiid.h>
36
37#include <limits>
38
39#include <wx/arrstr.h>
40
41wxString GetSchItemAsText( const SCH_ITEM& aItem )
42{
43 switch( aItem.Type() )
44 {
45 case SCH_TEXT_T:
46 case SCH_LABEL_T:
50 case SCH_SHEET_PIN_T:
51 {
52 const SCH_TEXT& text = static_cast<const SCH_TEXT&>( aItem );
53 return text.GetShownText( FOR_CANVAS );
54 }
55
56 case SCH_FIELD_T:
57 {
58 // Goes via EDA_TEXT
59 const SCH_FIELD& field = static_cast<const SCH_FIELD&>( aItem );
60 return field.GetShownText( FOR_CANVAS );
61 }
62
63 case SCH_TEXTBOX_T:
64 case SCH_TABLECELL_T:
65 {
66 // Also EDA_TEXT
67 const SCH_TEXTBOX& textbox = static_cast<const SCH_TEXTBOX&>( aItem );
68
69 // Call the correct GetShownText overload with nullptr for settings/path and aDepth=0
70 // This ensures proper variable expansion and escape marker conversion
71 return textbox.GetShownText( nullptr, nullptr, FOR_CANVAS );
72 }
73
74 case SCH_PIN_T:
75 {
76 // This is a choice - probably the name makes more sense than the number
77 // (or should it be name/number?)
78 const SCH_PIN& pin = static_cast<const SCH_PIN&>( aItem );
79 return pin.GetShownName();
80 }
81
82 case SCH_TABLE_T:
83 {
84 // A simple tabbed list of the cells seems like a place to start here
85 const SCH_TABLE& table = static_cast<const SCH_TABLE&>( aItem );
86 wxString s;
87
88 for( int row = 0; row < table.GetRowCount(); ++row )
89 {
90 for( int col = 0; col < table.GetColCount(); ++col )
91 {
92 const SCH_TABLECELL* cell = table.GetCell( row, col );
93 s << cell->GetShownText( FOR_CANVAS );
94
95 if( col < table.GetColCount() - 1 )
96 {
97 s << '\t';
98 }
99 }
100
101 if( row < table.GetRowCount() - 1 )
102 {
103 s << '\n';
104 }
105 }
106 return s;
107 }
108
109 default:
110 break;
111 }
112
113 return wxEmptyString;
114};
115
116
117wxString GetSelectedItemsAsText( const SELECTION& aSel )
118{
119 wxArrayString itemTexts;
120
121 for( EDA_ITEM* item : aSel )
122 {
123 if( item->IsSCH_ITEM() )
124 {
125 const SCH_ITEM& schItem = static_cast<const SCH_ITEM&>( *item );
126 wxString itemText = GetSchItemAsText( schItem );
127
128 itemText.Trim( false ).Trim( true );
129
130 if( !itemText.IsEmpty() )
131 itemTexts.Add( itemText );
132 }
133 }
134
135 return wxJoin( itemTexts, '\n', '\0' );
136}
137
138
139template <typename T>
140static std::vector<SCH_ITEM*> flattenGroups( const T& aItems )
141{
142 std::vector<SCH_ITEM*> flattened;
143 std::vector<SCH_ITEM*> toVisit;
144
145 for( EDA_ITEM* item : aItems )
146 toVisit.push_back( static_cast<SCH_ITEM*>( item ) );
147
148 while( !toVisit.empty() )
149 {
150 SCH_ITEM* item = toVisit.back();
151 toVisit.pop_back();
152 flattened.push_back( item );
153
154 if( item->Type() == SCH_GROUP_T )
155 {
156 for( EDA_ITEM* child : static_cast<SCH_GROUP*>( item )->GetItems() )
157 toVisit.push_back( static_cast<SCH_ITEM*>( child ) );
158 }
159 }
160
161 return flattened;
162}
163
164
165std::vector<SCH_ITEM*> FlattenGroups( const EDA_ITEMS& aItems )
166{
167 return flattenGroups( aItems );
168}
169
170
171std::vector<SCH_ITEM*> FlattenGroups( const std::deque<EDA_ITEM*>& aItems )
172{
173 return flattenGroups( aItems );
174}
175
176
177bool IsUnannotatedUnitOccupied( const SCH_REFERENCE_LIST& aRefs, const wxString& aRef,
178 const LIB_ID& aLibId, int aUnit )
179{
180 for( size_t i = 0; i < aRefs.GetCount(); ++i )
181 {
182 const SCH_REFERENCE& ref = aRefs[i];
183
184 if( ref.GetUnit() != aUnit )
185 continue;
186
187 if( ref.GetRef() != aRef )
188 continue;
189
190 SCH_SYMBOL* refSym = ref.GetSymbol();
191
192 if( refSym && refSym->GetLibId() == aLibId )
193 return true;
194 }
195
196 return false;
197}
198
199
200std::set<int> GetUnplacedUnitsForSymbol( const SCH_SYMBOL& aSym )
201{
202 SCHEMATIC const* schematic = aSym.Schematic();
203
204 if( !schematic )
205 return {};
206
207 const wxString symRefDes = aSym.GetRef( &schematic->CurrentSheet(), false );
208
209 // Pre-annotation references all share the same "U?" form regardless of which library symbol
210 // they came from, so an unannotated AD8620 and an unannotated OPA1664 would otherwise be
211 // collapsed into one logical part. Match library identity as a tie-breaker when the
212 // reference is still unannotated.
213 const bool refIsUnannotated = !symRefDes.IsEmpty() && symRefDes.Last() == '?';
214 const LIB_ID& symLibId = aSym.GetLibId();
215
216 // Get a list of all references in the schematic
217 SCH_SHEET_LIST hierarchy = schematic->Hierarchy();
218 SCH_REFERENCE_LIST existingRefs;
219 hierarchy.GetSymbols( existingRefs, SYMBOL_FILTER_ALL );
220
221 std::set<int> missingUnits;
222
223 for( int unit = 1; unit <= aSym.GetUnitCount(); ++unit )
224 missingUnits.insert( unit );
225
226 for( const SCH_REFERENCE& ref : existingRefs )
227 {
228 if( symRefDes != ref.GetRef() )
229 continue;
230
231 if( refIsUnannotated && ref.GetSymbol() && ref.GetSymbol()->GetLibId() != symLibId )
232 continue;
233
234 missingUnits.erase( ref.GetUnit() );
235 }
236
237 return missingUnits;
238}
239
240
241std::optional<SCH_REFERENCE> FindSymbolByRefAndUnit( const SCHEMATIC& aSchematic,
242 const wxString& aRef, int aUnit )
243{
245 aSchematic.Hierarchy().GetSymbols( refs, SYMBOL_FILTER_ALL );
246
247 for( const SCH_REFERENCE& ref : refs )
248 {
249 if( ref.GetRef() == aRef && ref.GetUnit() == aUnit )
250 {
251 return ref;
252 }
253 }
254
255 return std::nullopt;
256}
257
258
259std::vector<SCH_SYMBOL*> GetSameSymbolMultiUnitSelection( const SELECTION& aSel )
260{
261 std::vector<SCH_SYMBOL*> result;
262
263 if( aSel.GetSize() < 2 || !aSel.OnlyContains( { SCH_SYMBOL_T } ) )
264 return result;
265
266 wxString rootRef;
267 LIB_ID rootLibId;
268 bool haveRootLibId = false;
269 size_t rootPinCount = 0;
270 bool haveRootPinCount = false;
271
272 // Preserve selection order for cyclical swaps A->B->C
273 std::vector<EDA_ITEM*> itemsInOrder = aSel.GetItemsSortedBySelectionOrder();
274
275 for( EDA_ITEM* it : itemsInOrder )
276 {
277 SCH_SYMBOL* sym = dynamic_cast<SCH_SYMBOL*>( it );
278
279 if( !sym || !sym->GetLibSymbolRef() || sym->GetLibSymbolRef()->GetUnitCount() < 2 )
280 return {};
281
282 const SCH_SHEET_PATH& sheet = sym->Schematic()->CurrentSheet();
283
284 // Get unit-less reference
285 wxString ref = sym->GetRef( &sheet, false );
286
287 if( rootRef.IsEmpty() )
288 rootRef = ref;
289
290 if( ref != rootRef )
291 return {};
292
293 // Make sure the user isn't selecting units that are misreferenced such that
294 // they have U1A and U1B that are actually from different library symbols.
295 const LIB_ID& libId = sym->GetLibId();
296
297 if( !haveRootLibId )
298 {
299 rootLibId = libId;
300 haveRootLibId = true;
301 }
302
303 if( libId != rootLibId )
304 return {};
305
306 // Ensure same pin count across selected units
307 size_t pinCount = sym->GetPins( &sheet ).size();
308
309 if( !haveRootPinCount )
310 {
311 rootPinCount = pinCount;
312 haveRootPinCount = true;
313 }
314
315 if( pinCount != rootPinCount )
316 return {};
317
318 result.push_back( sym );
319 }
320
321 if( result.size() < 2 )
322 return {};
323
324 return result;
325}
326
327
328bool SwapPinGeometry( SCH_PIN* aFirst, SCH_PIN* aSecond )
329{
330 wxCHECK_MSG( aFirst && aSecond, false, "Invalid pins supplied to SwapPinGeometry" );
331
332 // If the schematic pin is still backed by a library definition, swap that library pin; once the
333 // caller sees the true return value it can decide to clone the updated library data into the
334 // schematic cache. Otherwise the schematic already owns a local copy, so swap in place.
335 SCH_PIN* firstPin = aFirst->GetLibPin() ? aFirst->GetLibPin() : aFirst;
336 SCH_PIN* secondPin = aSecond->GetLibPin() ? aSecond->GetLibPin() : aSecond;
337
338 VECTOR2I firstLocal = firstPin->GetLocalPosition();
339 VECTOR2I secondLocal = secondPin->GetLocalPosition();
340 firstPin->SetPosition( secondLocal );
341 secondPin->SetPosition( firstLocal );
342
343 PIN_ORIENTATION firstOrientation = firstPin->GetOrientation();
344 PIN_ORIENTATION secondOrientation = secondPin->GetOrientation();
345 firstPin->SetOrientation( secondOrientation );
346 secondPin->SetOrientation( firstOrientation );
347
348 int firstLength = firstPin->GetLength();
349 int secondLength = secondPin->GetLength();
350 firstPin->SetLength( secondLength );
351 secondPin->SetLength( firstLength );
352
353 const wxString& firstOp = firstPin->GetOperatingPoint();
354 const wxString& secondOp = secondPin->GetOperatingPoint();
355 firstPin->SetOperatingPoint( secondOp );
356 secondPin->SetOperatingPoint( firstOp );
357
358 // Return true if we touched the library-backed copy so callers can refresh the schematic symbol
359 // cache once the swap completes.
360 return ( firstPin != aFirst ) || ( secondPin != aSecond );
361}
362
363
364bool SymbolHasSheetInstances( const SCH_SYMBOL& aSymbol, const wxString& aCurrentProject,
365 std::set<wxString>* aSheetPaths, std::set<wxString>* aProjectNames )
366{
367 std::set<KIID_PATH> uniquePaths;
368 std::set<wxString> sheetPaths;
369 std::set<wxString> otherProjects;
370
371 for( const SCH_SYMBOL_INSTANCE& instance : aSymbol.GetInstances() )
372 {
373 uniquePaths.insert( instance.m_Path );
374
375 if( !instance.m_Path.empty() )
376 sheetPaths.insert( instance.m_Path.AsString() );
377
378 if( !instance.m_ProjectName.IsEmpty() )
379 {
380 if( aCurrentProject.IsEmpty() || !instance.m_ProjectName.IsSameAs( aCurrentProject ) )
381 otherProjects.insert( instance.m_ProjectName );
382 }
383 }
384
385 bool sharedWithinProject = uniquePaths.size() > 1;
386 bool sharedWithOtherProjects = !otherProjects.empty();
387
388 if( aSheetPaths )
389 {
390 if( sharedWithinProject )
391 *aSheetPaths = sheetPaths;
392 else
393 aSheetPaths->clear();
394 }
395
396 if( aProjectNames )
397 {
398 if( sharedWithOtherProjects )
399 *aProjectNames = otherProjects;
400 else
401 aProjectNames->clear();
402 }
403
404 return sharedWithinProject || sharedWithOtherProjects;
405}
406
407
408std::set<wxString> GetSheetNamesFromPaths( const std::set<wxString>& aSheetPaths, const SCHEMATIC& aSchematic )
409{
410 std::set<wxString> friendlyNames;
411
412 if( aSheetPaths.empty() )
413 return friendlyNames;
414
415 SCH_SHEET_LIST hierarchy = aSchematic.Hierarchy();
416
417 for( const wxString& pathStr : aSheetPaths )
418 {
419 wxString display = pathStr;
420
421 try
422 {
423 KIID_PATH kiidPath( pathStr );
424
425 for( const SCH_SHEET_PATH& sheetPath : hierarchy )
426 {
427 if( sheetPath.Path() == kiidPath )
428 {
429 wxString sheetNames;
430
431 for( size_t ii = 0; ii < sheetPath.size(); ++ii )
432 {
433 SCH_SHEET* sheet = sheetPath.at( ii );
434
435 if( !sheet )
436 continue;
437
438 const SCH_FIELD* nameField = sheet->GetField( FIELD_T::SHEET_NAME );
439
440 if( !nameField )
441 continue;
442
443 wxString name = nameField->GetShownText( FOR_NETNAME );
444
445 if( name.IsEmpty() )
446 continue;
447
448 if( !sheetNames.IsEmpty() )
449 sheetNames << wxS( "/" );
450
451 sheetNames << name;
452 }
453
454 if( sheetNames.IsEmpty() )
455 display = sheetPath.PathHumanReadable( false, true );
456 else
457 display = sheetNames;
458
459 break;
460 }
461 }
462 }
463 catch( ... )
464 {
465 // If the path cannot be parsed, fall back to the raw string.
466 }
467
468 friendlyNames.insert( display );
469 }
470
471 return friendlyNames;
472}
473
474
475wxString UniqueSheetName( SCH_SCREEN* aScreen, const wxString& aBaseName )
476{
477 if( !aScreen )
478 return aBaseName;
479
480 std::set<wxString> existing;
481
482 for( SCH_ITEM* item : aScreen->Items().OfType( SCH_SHEET_T ) )
483 existing.insert( static_cast<SCH_SHEET*>( item )->GetShownName( INTERNAL ).Lower() );
484
485 if( !existing.count( aBaseName.Lower() ) )
486 return aBaseName;
487
488 for( int n = 1; n < std::numeric_limits<int>::max(); ++n )
489 {
490 wxString candidate = aBaseName + wxString::Format( wxT( "%d" ), n );
491
492 if( !existing.count( candidate.Lower() ) )
493 return candidate;
494 }
495
496 return aBaseName;
497}
498
499
500wxString UniqueGroupName( SCH_SCREEN* aScreen, const wxString& aBaseName )
501{
502 if( !aScreen )
503 return aBaseName;
504
505 std::set<wxString> existing;
506
507 for( SCH_ITEM* item : aScreen->Items().OfType( SCH_GROUP_T ) )
508 existing.insert( static_cast<SCH_GROUP*>( item )->GetName() );
509
510 if( !existing.count( aBaseName ) )
511 return aBaseName;
512
513 for( int n = 1; n < std::numeric_limits<int>::max(); ++n )
514 {
515 wxString candidate = aBaseName + wxString::Format( wxT( "%d" ), n );
516
517 if( !existing.count( candidate ) )
518 return candidate;
519 }
520
521 return aBaseName;
522}
523
524
525void PrunePastedSymbolInstances( SCH_SYMBOL* aSymbol, const SCHEMATIC& aSchematic )
526{
527 wxCHECK( aSymbol && aSchematic.IsValid(), /* void */ );
528
529 const wxString projectName = aSchematic.Project().GetProjectName();
530
531 std::vector<KIID_PATH> pathsToRemove;
532
533 // Claiming rewrites a field in place, so only the removals have to wait for the walk to end
534 for( const SCH_SYMBOL_INSTANCE& instance : aSymbol->GetInstances() )
535 {
536 if( !aSchematic.IsInstancePathInProject( instance.m_Path ) )
537 pathsToRemove.emplace_back( instance.m_Path );
538 else if( instance.m_ProjectName != projectName )
539 aSymbol->SetInstanceProjectName( instance.m_Path, projectName );
540 }
541
542 for( const KIID_PATH& path : pathsToRemove )
543 aSymbol->RemoveInstance( path );
544}
const char * name
A base class for most all the KiCad significant classes used in schematics and boards.
Definition eda_item.h:98
KICAD_T Type() const
Returns the type of object.
Definition eda_item.h:110
EE_TYPE OfType(KICAD_T aType) const
Definition sch_rtree.h:248
A logical library item identifier and consists of various portions much like a URI.
Definition lib_id.h:45
int GetUnitCount() const override
virtual const wxString GetProjectName() const
Return the short name of the project.
Definition project.cpp:195
Holds all the data relating to one schematic.
Definition schematic.h:148
SCH_SHEET_LIST Hierarchy() const
Return the full schematic flattened hierarchical sheet list.
PROJECT & Project() const
Return a reference to the project this schematic is part of.
Definition schematic.h:170
bool IsValid() const
A simple test if the schematic is loaded, not a complete one.
Definition schematic.h:288
SCH_SHEET_PATH & CurrentSheet() const
Definition schematic.h:303
bool IsInstancePathInProject(const KIID_PATH &aPath) const
Test whether an instance path is rooted in this schematic's top level sheets.
wxString GetShownText(const SCH_SHEET_PATH *aPath, RESOLUTION_CONTEXT aContext, const wxString &aVariantName=wxEmptyString, int aDepth=0) const
A set of SCH_ITEMs (i.e., without duplicates).
Definition sch_group.h:48
Base class for any item which can be embedded within the SCHEMATIC container class,...
Definition sch_item.h:165
SCHEMATIC * Schematic() const
Search the item hierarchy to find a SCHEMATIC.
Definition sch_item.cpp:281
VECTOR2I GetLocalPosition() const
Definition sch_pin.h:313
int GetLength() const
Definition sch_pin.cpp:397
const wxString & GetOperatingPoint() const
Definition sch_pin.h:402
void SetOrientation(PIN_ORIENTATION aOrientation)
Definition sch_pin.h:111
SCH_PIN * GetLibPin() const
Definition sch_pin.h:107
void SetPosition(const VECTOR2I &aPos) override
Definition sch_pin.h:314
void SetLength(int aLength)
Definition sch_pin.h:117
PIN_ORIENTATION GetOrientation() const
Definition sch_pin.cpp:362
void SetOperatingPoint(const wxString &aText)
Definition sch_pin.h:403
Container to create a flattened list of symbols because in a complex hierarchy, a symbol can be used ...
A helper to define a symbol's reference designator in a schematic.
SCH_SYMBOL * GetSymbol() const
wxString GetRef() const
int GetUnit() const
EE_RTREE & Items()
Get the full RTree, usually for iterating.
Definition sch_screen.h:118
A container for handling SCH_SHEET_PATH objects in a flattened hierarchy.
void GetSymbols(SCH_REFERENCE_LIST &aReferences, SYMBOL_FILTER aSymbolFilter, bool aForceIncludeOrphanSymbols=false) const
Add a SCH_REFERENCE object to aReferences for each symbol in the list of sheets.
Handle access to a stack of flattened SCH_SHEET objects by way of a path for creating a flattened sch...
Sheet symbol placed in a schematic, and is the entry point for a sub schematic.
Definition sch_sheet.h:48
SCH_FIELD * GetField(FIELD_T aFieldType)
Return a mandatory field in this sheet.
Schematic symbol object.
Definition sch_symbol.h:75
const std::vector< SCH_SYMBOL_INSTANCE > & GetInstances() const
Definition sch_symbol.h:134
void RemoveInstance(const SCH_SHEET_PATH &aInstancePath)
bool SetInstanceProjectName(const KIID_PATH &aSheetPath, const wxString &aProjectName)
Set the owning project of the instance stored for aSheetPath.
std::vector< const SCH_PIN * > GetPins(const SCH_SHEET_PATH *aSheet) const
Retrieve a list of the SCH_PINs for the given sheet path.
const LIB_ID & GetLibId() const override
Definition sch_symbol.h:164
int GetUnitCount() const override
Return the number of units per package of the symbol.
std::unique_ptr< LIB_SYMBOL > & GetLibSymbolRef()
Definition sch_symbol.h:183
const wxString GetRef(const SCH_SHEET_PATH *aSheet, bool aIncludeUnit=false) const override
wxString GetShownText(const RENDER_SETTINGS *aSettings, const SCH_SHEET_PATH *aPath, RESOLUTION_CONTEXT aContext, int aDepth=0) const override
virtual wxString GetShownText(const RENDER_SETTINGS *aSettings, const SCH_SHEET_PATH *aPath, RESOLUTION_CONTEXT aContext, int aDepth=0) const
virtual unsigned int GetSize() const override
Return the number of stored items.
Definition selection.h:104
std::vector< EDA_ITEM * > GetItemsSortedBySelectionOrder() const
bool OnlyContains(std::vector< KICAD_T > aList) const
Checks if all items in the selection have a type in aList.
@ FOR_CANVAS
Definition common.h:88
@ FOR_NETNAME
Definition common.h:90
@ INTERNAL
Definition common.h:92
PIN_ORIENTATION
The symbol library pin object orientations.
Definition pin_type.h:101
Class to handle a set of SCH_ITEMs.
std::vector< EDA_ITEM * > EDA_ITEMS
Definition of the SCH_SHEET_PATH and SCH_SHEET_LIST classes for Eeschema.
@ SYMBOL_FILTER_ALL
wxString UniqueGroupName(SCH_SCREEN *aScreen, const wxString &aBaseName)
Return aBaseName, or aBaseName + smallest free integer if a group with that name already exists on aS...
bool IsUnannotatedUnitOccupied(const SCH_REFERENCE_LIST &aRefs, const wxString &aRef, const LIB_ID &aLibId, int aUnit)
Decide whether aUnit of an unannotated multi-unit symbol is already placed.
std::set< wxString > GetSheetNamesFromPaths(const std::set< wxString > &aSheetPaths, const SCHEMATIC &aSchematic)
Get human-readable sheet names from a set of sheet paths, e.g.
bool SwapPinGeometry(SCH_PIN *aFirst, SCH_PIN *aSecond)
Swap the positions/lengths/etc.
std::set< int > GetUnplacedUnitsForSymbol(const SCH_SYMBOL &aSym)
Get a list of unplaced (i.e.
wxString GetSelectedItemsAsText(const SELECTION &aSel)
bool SymbolHasSheetInstances(const SCH_SYMBOL &aSymbol, const wxString &aCurrentProject, std::set< wxString > *aSheetPaths, std::set< wxString > *aProjectNames)
Returns true when the given symbol has instances, e.g.
std::optional< SCH_REFERENCE > FindSymbolByRefAndUnit(const SCHEMATIC &aSchematic, const wxString &aRef, int aUnit)
Find a symbol by reference and unit.
void PrunePastedSymbolInstances(SCH_SYMBOL *aSymbol, const SCHEMATIC &aSchematic)
Discard the instance data a paste dragged in from somewhere else, keyed by path rather than project n...
std::vector< SCH_ITEM * > FlattenGroups(const EDA_ITEMS &aItems)
Return the given items with the members of any group added, recursively.
static std::vector< SCH_ITEM * > flattenGroups(const T &aItems)
std::vector< SCH_SYMBOL * > GetSameSymbolMultiUnitSelection(const SELECTION &aSel)
Validates and gathers a selection containing multiple symbol units that all belong to the same refere...
wxString UniqueSheetName(SCH_SCREEN *aScreen, const wxString &aBaseName)
Return aBaseName, or aBaseName + smallest free integer if a sheet with that name already exists on aS...
wxString GetSchItemAsText(const SCH_ITEM &aItem)
A simple container for schematic symbol instance information.
std::string path
KIBIS_PIN * pin
wxString result
Test unit parsing edge cases and error handling.
@ SCH_GROUP_T
Definition typeinfo.h:169
@ SCH_TABLE_T
Definition typeinfo.h:161
@ SCH_TABLECELL_T
Definition typeinfo.h:162
@ SCH_FIELD_T
Definition typeinfo.h:146
@ SCH_DIRECTIVE_LABEL_T
Definition typeinfo.h:167
@ SCH_LABEL_T
Definition typeinfo.h:163
@ SCH_SHEET_T
Definition typeinfo.h:171
@ SCH_HIER_LABEL_T
Definition typeinfo.h:165
@ SCH_SHEET_PIN_T
Definition typeinfo.h:170
@ SCH_TEXT_T
Definition typeinfo.h:147
@ SCH_TEXTBOX_T
Definition typeinfo.h:148
@ SCH_GLOBAL_LABEL_T
Definition typeinfo.h:164
@ SCH_PIN_T
Definition typeinfo.h:149
VECTOR2< int32_t > VECTOR2I
Definition vector2d.h:683