KiCad PCB EDA Suite
backannotate.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) 2019 Alexander Shuklin <[email protected]>
5 * Copyright (C) 2004-2022 KiCad Developers, see AUTHORS.txt for contributors.
6 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation; either version 2
10 * of the License, or (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, you may find one here:
19 * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
20 * or you may search the http://www.gnu.org website for the version 2 license,
21 * or you may write to the Free Software Foundation, Inc.,
22 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
23 */
24
25
26#include <backannotate.h>
27#include <boost/property_tree/ptree.hpp>
28#include <confirm.h>
29#include <dsnlexer.h>
30#include <ptree.h>
31#include <reporter.h>
32#include <sch_edit_frame.h>
33#include <sch_sheet_path.h>
34#include <sch_label.h>
35#include <schematic.h>
36#include <string_utils.h>
37#include <kiface_base.h>
39#include <connection_graph.h>
40#include <wx/log.h>
41
42
43BACK_ANNOTATE::BACK_ANNOTATE( SCH_EDIT_FRAME* aFrame, REPORTER& aReporter, bool aRelinkFootprints,
44 bool aProcessFootprints, bool aProcessValues,
45 bool aProcessReferences, bool aProcessNetNames, bool aDryRun ) :
46 m_reporter( aReporter ),
47 m_matchByReference( aRelinkFootprints ),
48 m_processFootprints( aProcessFootprints ),
49 m_processValues( aProcessValues ),
50 m_processReferences( aProcessReferences ),
51 m_processNetNames( aProcessNetNames ),
52 m_dryRun( aDryRun ),
53 m_frame( aFrame ),
54 m_changesCount( 0 ),
55 m_appendUndo( false )
56{
57}
58
59
61{
62}
63
64
65bool BACK_ANNOTATE::BackAnnotateSymbols( const std::string& aNetlist )
66{
68 m_appendUndo = false;
69
72 {
73 m_reporter.ReportTail( _( "Select at least one property to back annotate." ),
75 return false;
76 }
77
78 getPcbModulesFromString( aNetlist );
79
81 sheets.GetSymbols( m_refs, false );
83
86
88
89 return true;
90}
91
92
93bool BACK_ANNOTATE::FetchNetlistFromPCB( std::string& aNetlist )
94{
95 if( Kiface().IsSingle() )
96 {
97 DisplayErrorMessage( m_frame, _( "Cannot fetch PCB netlist because Schematic Editor is opened "
98 "in stand-alone mode.\n"
99 "You must launch the KiCad project manager and create "
100 "a project." ) );
101 return false;
102 }
103
104 KIWAY_PLAYER* frame = m_frame->Kiway().Player( FRAME_PCB_EDITOR, false );
105
106 if( !frame )
107 {
108 wxFileName fn( m_frame->Prj().GetProjectFullName() );
109 fn.SetExt( PcbFileExtension );
110
111 frame = m_frame->Kiway().Player( FRAME_PCB_EDITOR, true );
112 frame->OpenProjectFiles( std::vector<wxString>( 1, fn.GetFullPath() ) );
113 }
114
116 return true;
117}
118
119
121{
122 std::string nullPayload;
123
125}
126
127
128void BACK_ANNOTATE::getPcbModulesFromString( const std::string& aPayload )
129{
130 auto getStr = []( const PTREE& pt ) -> wxString
131 {
132 return UTF8( pt.front().first );
133 };
134
135 DSNLEXER lexer( aPayload, FROM_UTF8( __func__ ) );
136 PTREE doc;
137
138 // NOTE: KiCad's PTREE scanner constructs a property *name* tree, not a property tree.
139 // Every token in the s-expr is stored as a property name; the property's value is then
140 // either the nested s-exprs or an empty PTREE; there are *no* literal property values.
141
142 Scan( &doc, &lexer );
143
144 PTREE& tree = doc.get_child( "pcb_netlist" );
145 wxString msg;
146 m_pcbFootprints.clear();
147
148 for( const std::pair<const std::string, PTREE>& item : tree )
149 {
150 wxString path, value, footprint;
151 std::map<wxString, wxString> pinNetMap;
152 wxASSERT( item.first == "ref" );
153 wxString ref = getStr( item.second );
154
155 try
156 {
158 path = ref;
159 else
160 path = getStr( item.second.get_child( "timestamp" ) );
161
162 if( path == "" )
163 {
164 msg.Printf( _( "Footprint '%s' has no assigned symbol." ), ref );
166 continue;
167 }
168
169 footprint = getStr( item.second.get_child( "fpid" ) );
170 value = getStr( item.second.get_child( "value" ) );
171
172 boost::optional<const PTREE&> nets = item.second.get_child_optional( "nets" );
173
174 if( nets )
175 {
176 for( const std::pair<const std::string, PTREE>& pin_net : nets.get() )
177 {
178 wxASSERT( pin_net.first == "pin_net" );
179 wxString pinNumber = UTF8( pin_net.second.front().first );
180 wxString netName = UTF8( pin_net.second.back().first );
181 pinNetMap[ pinNumber ] = netName;
182 }
183 }
184 }
185 catch( ... )
186 {
187 wxLogWarning( "Cannot parse PCB netlist for back-annotation." );
188 }
189
190 // Use lower_bound for not to iterate over map twice
191 auto nearestItem = m_pcbFootprints.lower_bound( path );
192
193 if( nearestItem != m_pcbFootprints.end() && nearestItem->first == path )
194 {
195 // Module with this path already exists - generate error
196 msg.Printf( _( "Footprints '%s' and '%s' linked to same symbol." ),
197 nearestItem->second->m_ref,
198 ref );
200 }
201 else
202 {
203 // Add footprint to the map
204 auto data = std::make_shared<PCB_FP_DATA>( ref, footprint, value, pinNetMap );
205 m_pcbFootprints.insert( nearestItem, std::make_pair( path, data ) );
206 }
207 }
208}
209
210
212{
213 for( std::pair<const wxString, std::shared_ptr<PCB_FP_DATA>>& fpData : m_pcbFootprints )
214 {
215 const wxString& pcbPath = fpData.first;
216 auto& pcbData = fpData.second;
217 int refIndex;
218 bool foundInMultiunit = false;
219
220 for( std::pair<const wxString, SCH_REFERENCE_LIST>& item : m_multiUnitsRefs )
221 {
222 SCH_REFERENCE_LIST& refList = item.second;
223
225 refIndex = refList.FindRef( pcbPath );
226 else
227 refIndex = refList.FindRefByFullPath( pcbPath );
228
229 if( refIndex >= 0 )
230 {
231 // If footprint linked to multi unit symbol, we add all symbol's units to
232 // the change list
233 foundInMultiunit = true;
234
235 for( size_t i = 0; i < refList.GetCount(); ++i )
236 {
237 refList[ i ].GetSymbol()->ClearFlags(SKIP_STRUCT );
238 m_changelist.emplace_back( CHANGELIST_ITEM( refList[i], pcbData ) );
239 }
240
241 break;
242 }
243 }
244
245 if( foundInMultiunit )
246 continue;
247
249 refIndex = m_refs.FindRef( pcbPath );
250 else
251 refIndex = m_refs.FindRefByFullPath( pcbPath );
252
253 if( refIndex >= 0 )
254 {
255 m_refs[ refIndex ].GetSymbol()->ClearFlags( SKIP_STRUCT );
256 m_changelist.emplace_back( CHANGELIST_ITEM( m_refs[refIndex], pcbData ) );
257 }
258 else
259 {
260 // Haven't found linked symbol in multiunits or common refs. Generate error
261 wxString msg = wxString::Format( _( "Cannot find symbol for footprint '%s'." ),
262 pcbData->m_ref );
264 }
265 }
266}
267
269{
271
272 std::sort( m_changelist.begin(), m_changelist.end(),
273 []( const CHANGELIST_ITEM& a, const CHANGELIST_ITEM& b )
274 {
275 return SCH_REFERENCE_LIST::sortByTimeStamp( a.first, b.first );
276 } );
277
278 size_t i = 0;
279
280 for( const std::pair<SCH_REFERENCE, std::shared_ptr<PCB_FP_DATA>>& item : m_changelist )
281 {
282 // Refs and changelist are both sorted by paths, so we just go over m_refs and
283 // generate errors before we will find m_refs member to which item linked
284 while( i < m_refs.GetCount() && m_refs[i].GetPath() != item.first.GetPath() )
285 {
286 const SCH_REFERENCE& ref = m_refs[i];
287
288 if( ref.GetSymbol()->GetIncludeOnBoard() )
289 {
290 wxString msg = wxString::Format( _( "Footprint '%s' is not present on PCB. "
291 "Corresponding symbols in schematic must be "
292 "manually deleted (if desired)." ),
293 m_refs[i].GetRef() );
295 }
296
297 ++i;
298 }
299
300 ++i;
301 }
302
303 if( m_matchByReference && !m_frame->ReadyToNetlist( _( "Re-linking footprints requires a fully "
304 "annotated schematic." ) ) )
305 {
306 m_reporter.ReportTail( _( "Footprint re-linking cancelled by user." ), RPT_SEVERITY_ERROR );
307 }
308}
309
310
312{
313 wxString msg;
314
315 // Apply changes from change list
316 for( CHANGELIST_ITEM& item : m_changelist )
317 {
318 SCH_REFERENCE& ref = item.first;
319 PCB_FP_DATA& fpData = *item.second;
320 SCH_SYMBOL* symbol = ref.GetSymbol();
321 SCH_SCREEN* screen = ref.GetSheetPath().LastScreen();
322 wxString oldFootprint = ref.GetFootprint();
323 wxString oldValue = ref.GetValue();
324 bool skip = ( ref.GetSymbol()->GetFlags() & SKIP_STRUCT ) > 0;
325
326 if( m_processReferences && ref.GetRef() != fpData.m_ref && !skip )
327 {
329 msg.Printf( _( "Change '%s' reference designator to '%s'." ),
330 ref.GetRef(),
331 fpData.m_ref );
332
333 if( !m_dryRun )
334 {
336 m_appendUndo = true;
337 symbol->SetRef( &ref.GetSheetPath(), fpData.m_ref );
338 }
339
341 }
342
343 if( m_processFootprints && oldFootprint != fpData.m_footprint && !skip )
344 {
346 msg.Printf( _( "Change %s footprint assignment from '%s' to '%s'." ),
347 ref.GetRef(),
348 oldFootprint,
349 fpData.m_footprint );
350
351 if( !m_dryRun )
352 {
354 m_appendUndo = true;
355 symbol->SetFootprintFieldText( fpData.m_footprint );
356 }
357
359 }
360
361 if( m_processValues && oldValue != fpData.m_value && !skip )
362 {
364 msg.Printf( _( "Change %s value from '%s' to '%s'." ),
365 ref.GetRef(),
366 oldValue,
367 fpData.m_value );
368
369 if( !m_dryRun )
370 {
372 m_appendUndo = true;
373 symbol->SetValueFieldText( fpData.m_value );
374 }
375
377 }
378
380 {
381 for( const std::pair<const wxString, wxString>& entry : fpData.m_pinMap )
382 {
383 const wxString& pinNumber = entry.first;
384 const wxString& shortNetName = entry.second;
385 SCH_PIN* pin = symbol->GetPin( pinNumber );
386
387 if( !pin )
388 {
389 msg.Printf( _( "Cannot find %s pin '%s'." ),
390 ref.GetRef(),
391 pinNumber );
393
394 continue;
395 }
396
397 SCH_CONNECTION* connection = pin->Connection( &ref.GetSheetPath() );
398
399 if( connection && connection->Name( true ) != shortNetName )
400 {
401 processNetNameChange( ref.GetRef(), pin, connection,
402 connection->Name( true ), shortNetName );
403 }
404 }
405 }
406
407 // JEY TODO: back-annotate netclass changes?
408 }
409
410 if( !m_dryRun )
411 {
414 }
415}
416
417
419{
421
422 // Initial orientation from the pin
423 switch( aPin->GetLibPin()->GetOrientation() )
424 {
425 case PIN_UP: spin = TEXT_SPIN_STYLE::BOTTOM; break;
426 case PIN_DOWN: spin = TEXT_SPIN_STYLE::UP; break;
427 case PIN_LEFT: spin = TEXT_SPIN_STYLE::RIGHT; break;
428 case PIN_RIGHT: spin = TEXT_SPIN_STYLE::LEFT; break;
429 }
430
431 // Reorient based on the actual symbol orientation now
432 struct ORIENT
433 {
434 int flag;
435 int n_rots;
436 int mirror_x;
437 int mirror_y;
438 }
439 orientations[] =
440 {
441 { SYM_ORIENT_0, 0, 0, 0 },
442 { SYM_ORIENT_90, 1, 0, 0 },
443 { SYM_ORIENT_180, 2, 0, 0 },
444 { SYM_ORIENT_270, 3, 0, 0 },
445 { SYM_MIRROR_X + SYM_ORIENT_0, 0, 1, 0 },
446 { SYM_MIRROR_X + SYM_ORIENT_90, 1, 1, 0 },
447 { SYM_MIRROR_Y, 0, 0, 1 },
448 { SYM_MIRROR_X + SYM_ORIENT_270, 3, 1, 0 },
449 { SYM_MIRROR_Y + SYM_ORIENT_0, 0, 0, 1 },
450 { SYM_MIRROR_Y + SYM_ORIENT_90, 1, 0, 1 },
451 { SYM_MIRROR_Y + SYM_ORIENT_180, 2, 0, 1 },
452 { SYM_MIRROR_Y + SYM_ORIENT_270, 3, 0, 1 }
453 };
454
455 ORIENT o = orientations[ 0 ];
456
457 SCH_SYMBOL* parentSymbol = aPin->GetParentSymbol();
458
459 if( !parentSymbol )
460 return spin;
461
462 int symbolOrientation = parentSymbol->GetOrientation();
463
464 for( auto& i : orientations )
465 {
466 if( i.flag == symbolOrientation )
467 {
468 o = i;
469 break;
470 }
471 }
472
473 for( int i = 0; i < o.n_rots; i++ )
474 spin = spin.RotateCCW();
475
476 if( o.mirror_x )
477 spin = spin.MirrorX();
478
479 if( o.mirror_y )
480 spin = spin.MirrorY();
481
482 return spin;
483}
484
485
486void addConnections( SCH_ITEM* aItem, const SCH_SHEET_PATH& aSheetPath,
487 std::set<SCH_ITEM*>& connectedItems )
488{
489 if( connectedItems.insert( aItem ).second )
490 {
491 for( SCH_ITEM* connectedItem : aItem->ConnectedItems( aSheetPath ) )
492 addConnections( connectedItem, aSheetPath, connectedItems );
493 }
494}
495
496
497void BACK_ANNOTATE::processNetNameChange( const wxString& aRef, SCH_PIN* aPin,
498 const SCH_CONNECTION* aConnection,
499 const wxString& aOldName, const wxString& aNewName )
500{
501 wxString msg;
502
503 // Find a physically-connected driver. We can't use the SCH_CONNECTION's m_driver because
504 // it has already been resolved by merging subgraphs with the same label, etc., and our
505 // name change may cause that resolution to change.
506
507 std::set<SCH_ITEM*> connectedItems;
508 SCH_ITEM* driver = nullptr;
510
511 addConnections( aPin, aConnection->Sheet(), connectedItems );
512
513 for( SCH_ITEM* item : connectedItems )
514 {
516
517 if( priority > driverPriority )
518 {
519 driver = item;
520 driverPriority = priority;
521 }
522 }
523
524 switch( driver->Type() )
525 {
526 case SCH_LABEL_T:
528 case SCH_HIER_LABEL_T:
529 case SCH_SHEET_PIN_T:
531
532 msg.Printf( _( "Change %s pin %s net label from '%s' to '%s'." ),
533 aRef,
534 aPin->GetShownNumber(),
535 aOldName,
536 aNewName );
537
538 if( !m_dryRun )
539 {
540 SCH_SCREEN* screen = aConnection->Sheet().LastScreen();
541
543 m_appendUndo = true;
544 static_cast<SCH_LABEL_BASE*>( driver )->SetText( aNewName );
545 }
546
548 break;
549
550 case SCH_PIN_T:
551 {
552 SCH_PIN* schPin = static_cast<SCH_PIN*>( driver );
553 TEXT_SPIN_STYLE spin = orientLabel( schPin );
554
555 if( schPin->IsGlobalPower() )
556 {
557 msg.Printf( _( "Net %s cannot be changed to %s because it is driven by a power pin." ),
558 aOldName,
559 aNewName );
560
562 break;
563 }
564
566 msg.Printf( _( "Add label '%s' to %s pin %s net." ),
567 aNewName,
568 aRef,
569 aPin->GetShownNumber() );
570
571 if( !m_dryRun )
572 {
574 SCH_LABEL* label = new SCH_LABEL( driver->GetPosition(), aNewName );
575 label->SetParent( &m_frame->Schematic() );
576 label->SetTextSize( VECTOR2I( settings.m_DefaultTextSize, settings.m_DefaultTextSize ) );
577 label->SetTextSpinStyle( spin );
578 label->SetFlags( IS_NEW );
579
580 SCH_SCREEN* screen = aConnection->Sheet().LastScreen();
582 m_appendUndo = true;
583 }
584
586 }
587 break;
588
589 default:
590 break;
591 }
592}
void addConnections(SCH_ITEM *aItem, const SCH_SHEET_PATH &aSheetPath, std::set< SCH_ITEM * > &connectedItems)
static TEXT_SPIN_STYLE orientLabel(SCH_PIN *aPin)
KIFACE_BASE & Kiface()
Global KIFACE_BASE "get" accessor.
void processNetNameChange(const wxString &aRef, SCH_PIN *aPin, const SCH_CONNECTION *aConnection, const wxString &aOldName, const wxString &aNewName)
bool BackAnnotateSymbols(const std::string &aNetlist)
Run back annotation algorithm.
BACK_ANNOTATE(SCH_EDIT_FRAME *aFrame, REPORTER &aReporter, bool aRelinkFootprints, bool aProcessFootprints, bool aProcessValues, bool aProcessReferences, bool aProcessNetNames, bool aDryRun)
SCH_MULTI_UNIT_REFERENCE_MAP m_multiUnitsRefs
Definition: backannotate.h:144
std::deque< CHANGELIST_ITEM > m_changelist
Definition: backannotate.h:145
bool m_processReferences
Definition: backannotate.h:138
bool m_processFootprints
Definition: backannotate.h:136
void getPcbModulesFromString(const std::string &aPayload)
Parse netlist sent over KiWay express mail interface and fill m_pcbModules.
SCH_EDIT_FRAME * m_frame
Definition: backannotate.h:146
bool m_processValues
Definition: backannotate.h:137
void checkForUnusedSymbols()
Check if some symbols are not represented in PCB footprints and vice versa.
SCH_REFERENCE_LIST m_refs
Definition: backannotate.h:143
bool FetchNetlistFromPCB(std::string &aNetlist)
Get netlist from the Pcbnew.
PCB_FOOTPRINTS_MAP m_pcbFootprints
Definition: backannotate.h:142
std::pair< SCH_REFERENCE, std::shared_ptr< PCB_FP_DATA > > CHANGELIST_ITEM
Definition: backannotate.h:80
REPORTER & m_reporter
Definition: backannotate.h:133
bool m_processNetNames
Definition: backannotate.h:139
bool m_matchByReference
Definition: backannotate.h:135
void getChangeList()
void PushNewLinksToPCB()
void applyChangelist()
Apply changelist to the schematic.
PRIORITY GetDriverPriority()
Implement a lexical analyzer for the SPECCTRA DSN file format.
Definition: dsnlexer.h:79
virtual VECTOR2I GetPosition() const
Definition: eda_item.h:249
void SetFlags(EDA_ITEM_FLAGS aMask)
Definition: eda_item.h:139
KICAD_T Type() const
Returns the type of object.
Definition: eda_item.h:97
virtual void SetParent(EDA_ITEM *aParent)
Definition: eda_item.h:100
EDA_ITEM_FLAGS GetFlags() const
Definition: eda_item.h:142
void SetTextSize(const VECTOR2I &aNewSize)
Definition: eda_text.cpp:349
PROJECT & Prj() const
Return a reference to the PROJECT associated with this KIWAY.
KIWAY & Kiway() const
Return a reference to the KIWAY that this object has an opportunity to participate in.
Definition: kiway_holder.h:53
A wxFrame capable of the OpenProjectFiles function, meaning it can load a portion of a KiCad project.
Definition: kiway_player.h:66
virtual bool OpenProjectFiles(const std::vector< wxString > &aFileList, int aCtl=0)
Open a project or set of files given by aFileList.
Definition: kiway_player.h:118
virtual KIWAY_PLAYER * Player(FRAME_T aFrameType, bool doCreate=true, wxTopLevelWindow *aParent=nullptr)
Return the KIWAY_PLAYER* given a FRAME_T.
Definition: kiway.cpp:394
virtual void ExpressMail(FRAME_T aDestination, MAIL_T aCommand, std::string &aPayload, wxWindow *aSource=nullptr)
Send aPayload to aDestination from aSource.
Definition: kiway.cpp:491
int GetOrientation() const
Definition: lib_pin.h:74
virtual const wxString GetProjectFullName() const
Return the full path and name of the project.
Definition: project.cpp:120
A pure virtual class used to derive REPORTER objects from.
Definition: reporter.h:71
virtual REPORTER & ReportHead(const wxString &aText, SEVERITY aSeverity=RPT_SEVERITY_UNDEFINED)
Places the report at the beginning of the list for objects that support ordering.
Definition: reporter.h:108
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
These settings were stored in SCH_BASE_FRAME previously.
SCHEMATIC_SETTINGS & Settings() const
Definition: schematic.cpp:205
SCH_SHEET_LIST GetSheets() const override
Builds and returns an updated schematic hierarchy TODO: can this be cached?
Definition: schematic.h:86
Each graphical item can have a SCH_CONNECTION describing its logical connection (to a bus or net).
SCH_SHEET_PATH Sheet() const
wxString Name(bool aIgnoreSheet=false) const
Schematic editor (Eeschema) main window.
void AddItemToScreenAndUndoList(SCH_SCREEN *aScreen, SCH_ITEM *aItem, bool aUndoAppend)
Add an item to the schematic and adds the changes to the undo/redo container.
bool ReadyToNetlist(const wxString &aAnnotateMessage)
Check if we are ready to write a netlist file for the current schematic.
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.
SCHEMATIC & Schematic() const
void RecalculateConnections(SCH_CLEANUP_FLAGS aCleanupFlags)
Generate the connection data for the entire schematic hierarchy.
void UpdateNetHighlightStatus()
Base class for any item which can be embedded within the SCHEMATIC container class,...
Definition: sch_item.h:147
SCH_ITEM_SET & ConnectedItems(const SCH_SHEET_PATH &aPath)
Retrieve the set of items connected to this item on the given sheet.
Definition: sch_item.cpp:187
wxString GetShownNumber() const
Definition: sch_pin.cpp:108
bool IsGlobalPower() const
Definition: sch_pin.h:158
LIB_PIN * GetLibPin() const
Definition: sch_pin.h:59
SCH_SYMBOL * GetParentSymbol() const
Definition: sch_pin.cpp:189
Container to create a flattened list of symbols because in a complex hierarchy, a symbol can be used ...
void SortByTimeStamp()
Sort the flat list by Time Stamp (sheet path + timestamp).
int FindRef(const wxString &aPath) const
Search the list for a symbol with a given reference.
size_t GetCount() const
int FindRefByFullPath(const wxString &aFullPath) const
Search the list for a symbol with the given KIID path (as string).
A helper to define a symbol's reference designator in a schematic.
const SCH_SHEET_PATH & GetSheetPath() const
const wxString GetFootprint() const
SCH_SYMBOL * GetSymbol() const
wxString GetRef() const
const wxString GetValue() const
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.
Handle access to a stack of flattened SCH_SHEET objects by way of a path for creating a flattened sch...
SCH_SCREEN * LastScreen()
Schematic symbol object.
Definition: sch_symbol.h:81
void SetValueFieldText(const wxString &aValue)
Definition: sch_symbol.cpp:844
bool GetIncludeOnBoard() const
Definition: sch_symbol.h:750
void SetRef(const SCH_SHEET_PATH *aSheet, const wxString &aReference)
Set the reference for the given sheet path for this symbol.
Definition: sch_symbol.cpp:716
void SetFootprintFieldText(const wxString &aFootprint)
Definition: sch_symbol.cpp:859
int GetOrientation() const
Get the display symbol orientation.
SCH_PIN * GetPin(const wxString &number) const
Find a symbol pin by number.
virtual void SetTextSpinStyle(TEXT_SPIN_STYLE aSpinStyle)
Set a spin or rotation angle, along with specific horizontal and vertical justification styles with e...
Definition: sch_text.cpp:188
TEXT_SPIN_STYLE MirrorY()
Mirror the label spin style across the Y axis or simply swaps left and right.
Definition: sch_text.cpp:99
TEXT_SPIN_STYLE RotateCCW()
Definition: sch_text.cpp:67
TEXT_SPIN_STYLE MirrorX()
Mirror the label spin style across the X axis or simply swaps up and bottom.
Definition: sch_text.cpp:83
An 8 bit string that is assuredly encoded in UTF8, and supplies special conversion support to and fro...
Definition: utf8.h:71
void DisplayErrorMessage(wxWindow *aParent, const wxString &aText, const wxString &aExtraInfo)
Display an error message with aMessage.
Definition: confirm.cpp:325
This file is part of the common library.
#define _(s)
#define IS_NEW
New item, just created.
#define SKIP_STRUCT
flag indicating that the structure should be ignored
@ FRAME_PCB_EDITOR
Definition: frame_type.h:40
#define PcbFileExtension
@ PIN_LEFT
Definition: lib_pin.h:46
@ PIN_RIGHT
Definition: lib_pin.h:45
@ PIN_UP
Definition: lib_pin.h:47
@ PIN_DOWN
Definition: lib_pin.h:48
static wxString FROM_UTF8(const char *cstring)
Convert a UTF8 encoded C string to a wxString for all wxWidgets build modes.
Definition: macros.h:110
@ MAIL_PCB_UPDATE_LINKS
Definition: mail_type.h:51
@ MAIL_PCB_GET_NETLIST
Definition: mail_type.h:50
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, const CPTREE &aTree)
Output a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
Definition: ptree.cpp:200
void Scan(PTREE *aTree, DSNLEXER *aLexer)
Fill an empty PTREE with information from a KiCad s-expression stream.
Definition: ptree.cpp:86
boost::property_tree::ptree PTREE
Definition: ptree.h:52
@ RPT_SEVERITY_WARNING
@ RPT_SEVERITY_ERROR
@ RPT_SEVERITY_ACTION
@ NO_CLEANUP
@ SYM_ORIENT_270
@ SYM_MIRROR_Y
@ SYM_ORIENT_180
@ SYM_MIRROR_X
@ SYM_ORIENT_90
@ SYM_ORIENT_0
Definition of the SCH_SHEET_PATH and SCH_SHEET_LIST classes for Eeschema.
Container for Pcbnew footprint data.Map to hold NETLIST footprints data.
Definition: backannotate.h:62
std::map< wxString, wxString > m_pinMap
Definition: backannotate.h:74
@ SCH_LABEL_T
Definition: typeinfo.h:151
@ SCH_HIER_LABEL_T
Definition: typeinfo.h:153
@ SCH_SHEET_PIN_T
Definition: typeinfo.h:157
@ SCH_GLOBAL_LABEL_T
Definition: typeinfo.h:152
@ SCH_PIN_T
Definition: typeinfo.h:159
VECTOR2< int > VECTOR2I
Definition: vector2d.h:590
Definition of file extensions used in Kicad.