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 <Jasuramme@gmail.com>
5  * Copyright (C) 2004-2021 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 <schematic.h>
35 #include <kicad_string.h>
36 #include <kiface_i.h>
38 #include <connection_graph.h>
39 
40 BACK_ANNOTATE::BACK_ANNOTATE( SCH_EDIT_FRAME* aFrame, REPORTER& aReporter, bool aRelinkFootprints,
41  bool aProcessFootprints, bool aProcessValues,
42  bool aProcessReferences, bool aProcessNetNames, bool aDryRun ) :
43  m_reporter( aReporter ),
44  m_matchByReference( aRelinkFootprints ),
45  m_processFootprints( aProcessFootprints ),
46  m_processValues( aProcessValues ),
47  m_processReferences( aProcessReferences ),
48  m_processNetNames( aProcessNetNames ),
49  m_dryRun( aDryRun ),
50  m_frame( aFrame ),
51  m_changesCount( 0 ),
52  m_appendUndo( false )
53 {
54 }
55 
56 
58 {
59 }
60 
61 
62 bool BACK_ANNOTATE::BackAnnotateSymbols( const std::string& aNetlist )
63 {
64  m_changesCount = 0;
65  m_appendUndo = false;
66  wxString msg;
67 
69  && !m_processNetNames )
70  {
71  m_reporter.ReportTail( _( "Select at least one property to back annotate." ),
73  return false;
74  }
75 
76  getPcbModulesFromString( aNetlist );
77 
79  sheets.GetSymbols( m_refs, false );
81 
82  getChangeList();
84 
86 
87  return true;
88 }
89 
90 
91 bool BACK_ANNOTATE::FetchNetlistFromPCB( std::string& aNetlist )
92 {
93  if( Kiface().IsSingle() )
94  {
95  DisplayErrorMessage( m_frame, _( "Cannot fetch PCB netlist because eeschema is opened "
96  "in stand-alone mode.\n"
97  "You must launch the KiCad project manager and create "
98  "a project." ) );
99  return false;
100  }
101 
102  KIWAY_PLAYER* frame = m_frame->Kiway().Player( FRAME_PCB_EDITOR, false );
103 
104  if( !frame )
105  {
106  wxFileName fn( m_frame->Prj().GetProjectFullName() );
107  fn.SetExt( PcbFileExtension );
108 
109  frame = m_frame->Kiway().Player( FRAME_PCB_EDITOR, true );
110  frame->OpenProjectFiles( std::vector<wxString>( 1, fn.GetFullPath() ) );
111  }
112 
114  return true;
115 }
116 
117 
119 {
120  std::string nullPayload;
121 
123 }
124 
125 
126 void BACK_ANNOTATE::getPcbModulesFromString( const std::string& aPayload )
127 {
128  auto getStr = []( const PTREE& pt ) -> wxString
129  {
130  return UTF8( pt.front().first );
131  };
132 
133  DSNLEXER lexer( aPayload, FROM_UTF8( __func__ ) );
134  PTREE doc;
135 
136  // NOTE: KiCad's PTREE scanner constructs a property *name* tree, not a property tree.
137  // Every token in the s-expr is stored as a property name; the property's value is then
138  // either the nested s-exprs or an empty PTREE; there are *no* literal property values.
139 
140  Scan( &doc, &lexer );
141 
142  PTREE& tree = doc.get_child( "pcb_netlist" );
143  wxString msg;
144  m_pcbFootprints.clear();
145 
146  for( const std::pair<const std::string, PTREE>& item : tree )
147  {
148  wxString path, value, footprint;
149  std::map<wxString, wxString> pinNetMap;
150  wxASSERT( item.first == "ref" );
151  wxString ref = getStr( item.second );
152 
153  try
154  {
155  if( m_matchByReference )
156  path = ref;
157  else
158  path = getStr( item.second.get_child( "timestamp" ) );
159 
160  if( path == "" )
161  {
162  msg.Printf( _( "Footprint '%s' has no assigned symbol." ),
163  ref );
165  continue;
166  }
167 
168  footprint = getStr( item.second.get_child( "fpid" ) );
169  value = getStr( item.second.get_child( "value" ) );
170 
171  boost::optional<const PTREE&> nets = item.second.get_child_optional( "nets" );
172 
173  if( nets )
174  {
175  for( const std::pair<const std::string, PTREE>& pin_net : nets.get() )
176  {
177  wxASSERT( pin_net.first == "pin_net" );
178  wxString pinNumber = UTF8( pin_net.second.front().first );
179  wxString netName = UTF8( pin_net.second.back().first );
180  pinNetMap[ pinNumber ] = netName;
181  }
182  }
183  }
184  catch( ... )
185  {
186  wxLogWarning( "Cannot parse PCB netlist for back-annotation." );
187  }
188 
189  // Use lower_bound for not to iterate over map twice
190  auto nearestItem = m_pcbFootprints.lower_bound( path );
191 
192  if( nearestItem != m_pcbFootprints.end() && nearestItem->first == path )
193  {
194  // Module with this path already exists - generate error
195  msg.Printf( _( "Footprints '%s' and '%s' linked to same symbol." ),
196  nearestItem->second->m_ref,
197  ref );
199  }
200  else
201  {
202  // Add footprint to the map
203  auto data = std::make_shared<PCB_FP_DATA>( ref, footprint, value, pinNetMap );
204  m_pcbFootprints.insert( nearestItem, std::make_pair( path, data ) );
205  }
206  }
207 }
208 
209 
211 {
212  for( std::pair<const wxString, std::shared_ptr<PCB_FP_DATA>>& fpData : m_pcbFootprints )
213  {
214  const wxString& pcbPath = fpData.first;
215  auto& pcbData = fpData.second;
216  int refIndex;
217  bool foundInMultiunit = false;
218 
219  for( std::pair<const wxString, SCH_REFERENCE_LIST>& item : m_multiUnitsRefs )
220  {
221  SCH_REFERENCE_LIST& refList = item.second;
222 
223  if( m_matchByReference )
224  refIndex = refList.FindRef( pcbPath );
225  else
226  refIndex = refList.FindRefByPath( pcbPath );
227 
228  if( refIndex >= 0 )
229  {
230  // If footprint linked to multi unit symbol, we add all symbol's units to
231  // the change list
232  foundInMultiunit = true;
233 
234  for( size_t i = 0; i < refList.GetCount(); ++i )
235  {
236  refList[ i ].GetSymbol()->ClearFlags(SKIP_STRUCT );
237  m_changelist.emplace_back( CHANGELIST_ITEM( refList[i], pcbData ) );
238  }
239 
240  break;
241  }
242  }
243 
244  if( foundInMultiunit )
245  continue;
246 
247  if( m_matchByReference )
248  refIndex = m_refs.FindRef( pcbPath );
249  else
250  refIndex = m_refs.FindRefByPath( pcbPath );
251 
252  if( refIndex >= 0 )
253  {
254  m_refs[ refIndex ].GetSymbol()->ClearFlags(SKIP_STRUCT );
255  m_changelist.emplace_back( CHANGELIST_ITEM( m_refs[refIndex], pcbData ) );
256  }
257  else
258  {
259  // Haven't found linked symbol in multiunits or common refs. Generate error
260  wxString msg = wxString::Format( _( "Cannot find symbol for footprint '%s'." ),
261  pcbData->m_ref );
263  }
264  }
265 }
266 
268 {
270 
271  std::sort( m_changelist.begin(), m_changelist.end(),
272  []( const CHANGELIST_ITEM& a, const CHANGELIST_ITEM& b )
273  {
274  return SCH_REFERENCE_LIST::sortByTimeStamp( a.first, b.first );
275  } );
276 
277  size_t i = 0;
278 
279  for( const std::pair<SCH_REFERENCE, std::shared_ptr<PCB_FP_DATA>>& item : m_changelist )
280  {
281  // Refs and changelist are both sorted by paths, so we just go over m_refs and
282  // generate errors before we will find m_refs member to which item linked
283  while( i < m_refs.GetCount() && m_refs[i].GetPath() != item.first.GetPath() )
284  {
285  const SCH_REFERENCE& ref = m_refs[i];
286 
287  if( ref.GetSymbol()->GetIncludeOnBoard() )
288  {
289  wxString msg = wxString::Format( _( "Footprint '%s' is not present on PCB. "
290  "Corresponding symbols in schematic must be "
291  "manually deleted (if desired)." ),
292  m_refs[i].GetFullRef() );
294  }
295 
296  ++i;
297  }
298 
299  ++i;
300  }
301 
302  if( m_matchByReference && !m_frame->ReadyToNetlist( _( "Re-linking footprints requires a fully "
303  "annotated schematic." ) ) )
304  {
305  m_reporter.ReportTail( _( "Footprint re-linking cancelled by user." ), RPT_SEVERITY_ERROR );
306  }
307 }
308 
309 
311 {
312  wxString msg;
313 
314  // Apply changes from change list
315  for( CHANGELIST_ITEM& item : m_changelist )
316  {
317  SCH_REFERENCE& ref = item.first;
318  PCB_FP_DATA& fpData = *item.second;
319  SCH_COMPONENT* symbol = ref.GetSymbol();
320  SCH_SCREEN* screen = ref.GetSheetPath().LastScreen();
321  wxString oldFootprint = ref.GetFootprint();
322  wxString oldValue = ref.GetValue();
323  bool skip = ( ref.GetSymbol()->GetFlags() & SKIP_STRUCT ) > 0;
324 
325  if( m_processReferences && ref.GetRef() != fpData.m_ref && !skip )
326  {
327  ++m_changesCount;
328  msg.Printf( _( "Change '%s' reference designator to '%s'." ),
329  ref.GetFullRef(),
330  fpData.m_ref );
331 
332  if( !m_dryRun )
333  {
335  m_appendUndo = true;
336  symbol->SetRef( &ref.GetSheetPath(), fpData.m_ref );
337  }
338 
340  }
341 
342  if( m_processFootprints && oldFootprint != fpData.m_footprint && !skip )
343  {
344  ++m_changesCount;
345  msg.Printf( _( "Change %s footprint assignment from '%s' to '%s'." ),
346  ref.GetFullRef(),
347  oldFootprint,
348  fpData.m_footprint );
349 
350  if( !m_dryRun )
351  {
353  m_appendUndo = true;
354  symbol->SetFootprint( &ref.GetSheetPath(), fpData.m_footprint );
355  }
356 
358  }
359 
360  if( m_processValues && oldValue != fpData.m_value && !skip )
361  {
362  ++m_changesCount;
363  msg.Printf( _( "Change %s value from '%s' to '%s'." ),
364  ref.GetFullRef(),
365  oldValue,
366  fpData.m_value );
367 
368  if( !m_dryRun )
369  {
371  m_appendUndo = true;
372  symbol->SetValue( &ref.GetSheetPath(), fpData.m_value );
373  }
374 
376  }
377 
378  if( m_processNetNames )
379  {
380  for( const std::pair<const wxString, wxString>& entry : fpData.m_pinMap )
381  {
382  const wxString& pinNumber = entry.first;
383  const wxString& shortNetName = entry.second;
384  SCH_PIN* pin = symbol->GetPin( pinNumber );
385 
386  if( !pin )
387  {
388  msg.Printf( _( "Cannot find %s pin '%s'." ),
389  ref.GetFullRef(),
390  pinNumber );
392 
393  continue;
394  }
395 
396  SCH_CONNECTION* connection = pin->Connection( &ref.GetSheetPath() );
397 
398  if( connection && connection->Name( true ) != shortNetName )
399  {
400  processNetNameChange( ref.GetFullRef(), pin, connection,
401  connection->Name( true ), shortNetName );
402  }
403  }
404  }
405  }
406 
407  if( !m_dryRun )
408  {
411  }
412 
414 }
415 
416 
418 {
420 
421  // Initial orientation from the pin
422  switch( aPin->GetLibPin()->GetOrientation() )
423  {
424  case PIN_UP: spin = LABEL_SPIN_STYLE::BOTTOM; break;
425  case PIN_DOWN: spin = LABEL_SPIN_STYLE::UP; break;
426  case PIN_LEFT: spin = LABEL_SPIN_STYLE::RIGHT; break;
427  case PIN_RIGHT: spin = LABEL_SPIN_STYLE::LEFT; break;
428  }
429 
430  // Reorient based on the actual symbol orientation now
431  struct ORIENT
432  {
433  int flag;
434  int n_rots;
435  int mirror_x;
436  int mirror_y;
437  }
438  orientations[] =
439  {
440  { CMP_ORIENT_0, 0, 0, 0 },
441  { CMP_ORIENT_90, 1, 0, 0 },
442  { CMP_ORIENT_180, 2, 0, 0 },
443  { CMP_ORIENT_270, 3, 0, 0 },
444  { CMP_MIRROR_X + CMP_ORIENT_0, 0, 1, 0 },
445  { CMP_MIRROR_X + CMP_ORIENT_90, 1, 1, 0 },
446  { CMP_MIRROR_Y, 0, 0, 1 },
447  { CMP_MIRROR_X + CMP_ORIENT_270, 3, 1, 0 },
448  { CMP_MIRROR_Y + CMP_ORIENT_0, 0, 0, 1 },
449  { CMP_MIRROR_Y + CMP_ORIENT_90, 1, 0, 1 },
450  { CMP_MIRROR_Y + CMP_ORIENT_180, 2, 0, 1 },
451  { CMP_MIRROR_Y + CMP_ORIENT_270, 3, 0, 1 }
452  };
453 
454  ORIENT o = orientations[ 0 ];
455 
456  SCH_COMPONENT* parentSymbol = aPin->GetParentSymbol();
457 
458  if( !parentSymbol )
459  return spin;
460 
461  int symbolOrientation = parentSymbol->GetOrientation();
462 
463  for( auto& i : orientations )
464  {
465  if( i.flag == symbolOrientation )
466  {
467  o = i;
468  break;
469  }
470  }
471 
472  for( int i = 0; i < o.n_rots; i++ )
473  spin = spin.RotateCCW();
474 
475  if( o.mirror_x )
476  spin = spin.MirrorX();
477 
478  if( o.mirror_y )
479  spin = spin.MirrorY();
480 
481  return spin;
482 }
483 
484 
485 void addConnections( SCH_ITEM* aItem, const SCH_SHEET_PATH& aSheetPath,
486  std::set<SCH_ITEM*>& connectedItems )
487 {
488  if( connectedItems.insert( aItem ).second )
489  {
490  for( SCH_ITEM* connectedItem : aItem->ConnectedItems( aSheetPath ) )
491  addConnections( connectedItem, aSheetPath, connectedItems );
492  }
493 }
494 
495 
496 void BACK_ANNOTATE::processNetNameChange( const wxString& aRef, SCH_PIN* aPin,
497  const SCH_CONNECTION* aConnection,
498  const wxString& aOldName, const wxString& aNewName )
499 {
500  wxString msg;
501 
502  // Find a physically-connected driver. We can't use the SCH_CONNECTION's m_driver because
503  // it has already been resolved by merging subgraphs with the same label, etc., and our
504  // name change may cause that resolution to change.
505 
506  std::set<SCH_ITEM*> connectedItems;
507  SCH_ITEM* driver = nullptr;
509 
510  addConnections( aPin, aConnection->Sheet(), connectedItems );
511 
512  for( SCH_ITEM* item : connectedItems )
513  {
515 
516  if( priority > driverPriority )
517  {
518  driver = item;
519  driverPriority = priority;
520  }
521  }
522 
523  switch( driver->Type() )
524  {
525  case SCH_LABEL_T:
526  case SCH_GLOBAL_LABEL_T:
527  case SCH_HIER_LABEL_T:
528  case SCH_SHEET_PIN_T:
529  ++m_changesCount;
530 
531  msg.Printf( _( "Change %s pin %s net label from '%s' to '%s'." ),
532  aRef,
533  aPin->GetNumber(),
534  aOldName,
535  aNewName );
536 
537  if( !m_dryRun )
538  {
539  SCH_SCREEN* screen = aConnection->Sheet().LastScreen();
540 
542  m_appendUndo = true;
543  static_cast<SCH_TEXT*>( driver )->SetText( aNewName );
544  }
545 
547  break;
548 
549  case SCH_PIN_T:
550  {
551  SCH_PIN* schPin = static_cast<SCH_PIN*>( driver );
552  LABEL_SPIN_STYLE spin = orientLabel( schPin );
553 
554  if( schPin->IsPowerConnection() )
555  {
556  msg.Printf( _( "Net %s cannot be changed to '%s' because it is driven by a power pin." ),
557  aOldName,
558  aNewName );
559 
561  break;
562  }
563 
564  ++m_changesCount;
565  msg.Printf( _( "Add label '%s' to %s pin %s net." ),
566  aNewName,
567  aRef,
568  aPin->GetNumber() );
569 
570  if( !m_dryRun )
571  {
572  SCHEMATIC_SETTINGS& settings = m_frame->Schematic().Settings();
573  SCH_LABEL* label = new SCH_LABEL( driver->GetPosition(), aNewName );
574  label->SetParent( &m_frame->Schematic() );
575  label->SetTextSize( wxSize( settings.m_DefaultTextSize,
576  settings.m_DefaultTextSize ) );
577  label->SetLabelSpinStyle( 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 }
bool ReadyToNetlist(const wxString &aAnnotateMessage)
Checks if we are ready to write a netlist file for the current schematic.
An 8 bit string that is assuredly encoded in UTF8, and supplies special conversion support to and fro...
Definition: utf8.h:70
A container for handling SCH_SHEET_PATH objects in a flattened hierarchy.
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:115
LIB_PIN * GetLibPin() const
Definition: sch_pin.h:69
static bool sortByTimeStamp(const SCH_REFERENCE &item1, const SCH_REFERENCE &item2)
BACK_ANNOTATE(SCH_EDIT_FRAME *aFrame, REPORTER &aReporter, bool aRelinkFootprints, bool aProcessFootprints, bool aProcessValues, bool aProcessReferences, bool aProcessNetNames, bool aDryRun)
A wxFrame capable of the OpenProjectFiles function, meaning it can load a portion of a KiCad project.
Definition: kiway_player.h:61
void UpdateNetHighlightStatus()
KIWAY & Kiway() const
Return a reference to the KIWAY that this object has an opportunity to participate in.
Definition: kiway_holder.h:56
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
int GetOrientation()
Get the display symbol orientation.
void DisplayErrorMessage(wxWindow *aParent, const wxString &aText, const wxString &aExtraInfo)
Display an error message with aMessage.
Definition: confirm.cpp:265
void GetSymbols(SCH_REFERENCE_LIST &aReferences, bool aIncludePowerSymbols=true, bool aForceIncludeOrphanComponents=false) const
Add a SCH_REFERENCE object to aReferences for each component in the list of sheets.
void RecalculateConnections(SCH_CLEANUP_FLAGS aCleanupFlags)
Generates the connection data for the entire schematic 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...
SCH_EDIT_FRAME * m_frame
Definition: backannotate.h:145
This file is part of the common library.
int FindRefByPath(const wxString &aPath) const
Search the list for a symbol with the given KIID path.
const SCH_SHEET_PATH & GetSheetPath() const
bool GetIncludeOnBoard() const
Definition: sch_symbol.h:701
int GetOrientation() const
Definition: lib_pin.h:125
void Scan(PTREE *aTree, DSNLEXER *aLexer)
Fill an empty PTREE with information from a KiCad s-expression stream.
Definition: ptree.cpp:86
SCH_COMPONENT * GetParentSymbol() const
Definition: sch_pin.cpp:141
void PushNewLinksToPCB()
SCHEMATIC_SETTINGS & Settings() const
Definition: schematic.cpp:125
bool m_processNetNames
Definition: backannotate.h:138
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:93
bool m_processFootprints
Definition: backannotate.h:135
virtual KIWAY_PLAYER * Player(FRAME_T aFrameType, bool doCreate=true, wxTopLevelWindow *aParent=nullptr)
Return the KIWAY_PLAYER* given a FRAME_T.
Definition: kiway.cpp:345
virtual void ExpressMail(FRAME_T aDestination, MAIL_T aCommand, std::string &aPayload, wxWindow *aSource=nullptr)
Send aPayload to aDestination from aSource.
Definition: kiway.cpp:439
Schematic editor (Eeschema) main window.
bool m_processReferences
Definition: backannotate.h:137
wxString GetNumber() const
Definition: sch_pin.h:116
void getPcbModulesFromString(const std::string &aPayload)
Parse netlist sent over KiWay express mail interface and fill m_pcbModules.
void SetTextSize(const wxSize &aNewSize)
Definition: eda_text.h:244
Definition: lib_pin.h:50
virtual wxPoint GetPosition() const
Definition: eda_item.h:301
A pure virtual class used to derive REPORTER objects from.
Definition: reporter.h:64
bool m_matchByReference
Definition: backannotate.h:134
std::map< wxString, wxString > m_pinMap
Definition: backannotate.h:74
bool BackAnnotateSymbols(const std::string &aNetlist)
Run back annotation algorithm.
virtual void SetParent(EDA_ITEM *aParent)
Definition: eda_item.h:165
Container to create a flattened list of symbols because in a complex hierarchy, a symbol can be used ...
int FindRef(const wxString &aPath) const
Search the list for a symbol with a given reference.
void checkForUnusedSymbols()
Check if some symbols are not represented in PCB footprints and vice versa.
SCH_CONNECTION * Connection(const SCH_SHEET_PATH *aSheet=nullptr) const
Retrieve the connection associated with this object in the given sheet.
Definition: sch_item.cpp:131
REPORTER & m_reporter
Definition: backannotate.h:132
wxString GetRef() const
boost::property_tree::ptree PTREE
Definition: ptree.h:52
bool m_processValues
Definition: backannotate.h:136
void SortByTimeStamp()
Sort the flat list by Time Stamp (sheet path + timestamp).
void processNetNameChange(const wxString &aRef, SCH_PIN *aPin, const SCH_CONNECTION *aConnection, const wxString &aOldName, const wxString &aNewName)
void SetFlags(STATUS_FLAGS aMask)
Definition: eda_item.h:202
wxString Name(bool aIgnoreSheet=false) const
void addConnections(SCH_ITEM *aItem, const SCH_SHEET_PATH &aSheetPath, std::set< SCH_ITEM * > &connectedItems)
bool FetchNetlistFromPCB(std::string &aNetlist)
Get netlist from the Pcbnew.
PROJECT & Prj() const
Return a reference to the PROJECT associated with this KIWAY.
KIFACE_I & Kiface()
Global KIFACE_I "get" accessor.
SCHEMATIC & Schematic() const
Definition of file extensions used in Kicad.
const wxString GetFootprint() const
#define PcbFileExtension
Handle access to a stack of flattened SCH_SHEET objects by way of a path for creating a flattened sch...
virtual const wxString GetProjectFullName() const
Return the full path and name of the project.
LABEL_SPIN_STYLE MirrorY()
Definition: sch_text.h:128
std::pair< SCH_REFERENCE, std::shared_ptr< PCB_FP_DATA > > CHANGELIST_ITEM
Definition: backannotate.h:80
void getChangeList()
SCH_COMPONENT * GetSymbol() const
LABEL_SPIN_STYLE RotateCCW()
Definition: sch_text.h:90
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
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:102
unsigned GetCount() const
wxString GetFullRef()
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:477
SCH_SHEET_LIST GetSheets() const override
Builds and returns an updated schematic hierarchy TODO: can this be cached?
Definition: schematic.h:111
SCH_SHEET_PATH Sheet() const
LABEL_SPIN_STYLE MirrorX()
Definition: sch_text.h:109
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.
SCH_SCREEN * LastScreen()
void applyChangelist()
Apply changelist to the schematic.
static LABEL_SPIN_STYLE orientLabel(SCH_PIN *aPin)
SCH_ITEM_SET & ConnectedItems(const SCH_SHEET_PATH &aPath)
Retrieves the set of items connected to this item on the given sheet.
Definition: sch_item.cpp:164
Each graphical item can have a SCH_CONNECTION describing its logical connection (to a bus or net).
void SaveCopyInUndoList(SCH_SCREEN *aScreen, SCH_ITEM *aItemToCopy, UNDO_REDO aTypeCommand, bool aAppend)
Create a copy of the current schematic item, and put it in the undo list.
#define _(s)
Definition: 3d_actions.cpp:33
Schematic symbol object.
Definition: sch_symbol.h:78
These settings were stored in SCH_BASE_FRAME previously.
const wxString GetValue() const
SCH_REFERENCE_LIST m_refs
Definition: backannotate.h:142
bool IsPowerConnection() const
Definition: sch_pin.h:132
std::deque< CHANGELIST_ITEM > m_changelist
Definition: backannotate.h:144
#define SKIP_STRUCT
flag indicating that the structure should be ignored
Definition: eda_item.h:117
virtual void SetLabelSpinStyle(LABEL_SPIN_STYLE aSpinStyle)
Set a spin or rotation angle, along with specific horizontal and vertical justification styles with e...
Definition: sch_text.cpp:248
void SetValue(const SCH_SHEET_PATH *sheet, const wxString &aValue)
Definition: sch_symbol.cpp:609
Definition of the SCH_SHEET_PATH and SCH_SHEET_LIST classes for Eeschema.
Struct to hold Pcbnew footprint data.Map to hold NETLIST footprints data.
Definition: backannotate.h:61
STATUS_FLAGS GetFlags() const
Definition: eda_item.h:204
Base class for any item which can be embedded within the SCHEMATIC container class,...
Definition: sch_item.h:196
Implement a lexical analyzer for the SPECCTRA DSN file format.
Definition: dsnlexer.h:78
PCB_FOOTPRINTS_MAP m_pcbFootprints
Definition: backannotate.h:141
#define IS_NEW
New item, just created.
Definition: eda_item.h:106
void SetFootprint(const SCH_SHEET_PATH *sheet, const wxString &aFootprint)
Definition: sch_symbol.cpp:659
A helper to define a symbol's reference designator in a schematic.
PRIORITY GetDriverPriority()
SCH_MULTI_UNIT_REFERENCE_MAP m_multiUnitsRefs
Definition: backannotate.h:143
KICAD_T Type() const
Returns the type of object.
Definition: eda_item.h:162
SCH_PIN * GetPin(const wxString &number) const
Find a symbol pin by number.
Definition: sch_symbol.cpp:837