KiCad PCB EDA Suite
dialog_symbol_remap.cpp
Go to the documentation of this file.
1 
5 /*
6  * This program source code file is part of KiCad, a free EDA CAD application.
7  *
8  * Copyright (C) 2017 Wayne Stambaugh <stambaughw@verizon.net>
9  * Copyright (C) 2017-2019 KiCad Developers, see AUTHORS.txt for contributors.
10  *
11  * This program is free software: you can redistribute it and/or modify it
12  * under the terms of the GNU General Public License as published by the
13  * Free Software Foundation, either version 3 of the License, or (at your
14  * option) any later version.
15  *
16  * This program is distributed in the hope that it will be useful, but
17  * WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19  * General Public License for more details.
20  *
21  * You should have received a copy of the GNU General Public License along
22  * with this program. If not, see <http://www.gnu.org/licenses/>.
23  */
24 
25 #include <macros.h>
26 #include <pgm_base.h>
27 #include <kiface_i.h>
28 #include <project.h>
29 #include <confirm.h>
30 #include <reporter.h>
32 #include <wx_html_report_panel.h>
33 
34 #include <class_library.h>
35 #include <project_rescue.h>
36 #include <sch_io_mgr.h>
37 #include <sch_sheet.h>
38 #include <sch_component.h>
39 #include <sch_screen.h>
40 #include <sch_edit_frame.h>
41 #include <symbol_lib_table.h>
42 #include <viewlib_frame.h>
43 #include <env_paths.h>
44 
45 #include <dialog_symbol_remap.h>
46 
47 
49  DIALOG_SYMBOL_REMAP_BASE( aParent )
50 {
51  m_remapped = false;
52 
53  if( !wxFileName::IsDirWritable( Prj().GetProjectPath() ) )
54  {
55  DisplayInfoMessage( this, _( "Remapping is not possible because you do not have "
56  "write privileges to the project folder \"%s\"." ) );
57 
58  // Disable the remap button.
59  m_remapped = true;
60  }
61 
62  wxString text;
63 
64  text = _( "This schematic currently uses the project symbol library list look up method "
65  "for loading library symbols. KiCad will attempt to map the existing symbols "
66  "to use the new symbol library table. Remapping will change some project files "
67  "and schematics may not be compatible with older versions of KiCad. All files "
68  "that are changed will be backed up to the \"remap_backup\" folder in the project "
69  "folder should you need to revert any changes. If you choose to skip this step, "
70  "you will be responsible for manually remapping the symbols." );
71 
72  m_htmlCtrl->AppendToPage( text );
73 }
74 
75 
76 void DIALOG_SYMBOL_REMAP::OnRemapSymbols( wxCommandEvent& aEvent )
77 {
78  SCH_EDIT_FRAME* parent = dynamic_cast< SCH_EDIT_FRAME* >( GetParent() );
79 
80  wxCHECK_RET( parent != nullptr, "Parent window is not type SCH_EDIT_FRAME." );
81 
82  wxBusyCursor busy;
83 
85  return;
86 
87  // Ignore the never show rescue setting for one last rescue of legacy symbol
88  // libraries before remapping to the symbol library table. This ensures the
89  // best remapping results.
90  LEGACY_RESCUER rescuer( Prj(), &parent->GetCurrentSheet(),
91  parent->GetGalCanvas()->GetBackend() );
92 
93  if( RESCUER::RescueProject( this, rescuer, false ) )
94  {
95  LIB_VIEW_FRAME* viewer = (LIB_VIEW_FRAME*) parent->Kiway().Player( FRAME_SCH_VIEWER, false );
96 
97  if( viewer )
98  viewer->ReCreateListLib();
99 
100  parent->GetScreen()->ClearUndoORRedoList( parent->GetScreen()->m_UndoList, 1 );
101  parent->SyncView();
102  parent->GetCanvas()->Refresh();
103  parent->OnModify();
104  }
105 
106  // The schematic is fully loaded, any legacy library symbols have been rescued. Now
107  // check to see if the schematic has not been converted to the symbol library table
108  // method for looking up symbols.
109  wxFileName prjSymLibTableFileName( Prj().GetProjectPath(),
111 
112  // Delete the existing project symbol library table.
113  if( prjSymLibTableFileName.FileExists() )
114  {
115  wxRemoveFile( prjSymLibTableFileName.GetFullPath() );
116  }
117 
120  Prj().SchSymbolLibTable();
121 
123 
124  // Remove all of the libraries from the legacy library list.
125  wxString paths;
126  wxArrayString libNames;
127 
128  PART_LIBS::LibNamesAndPaths( &Prj(), true, &paths, &libNames );
129 
130  // Reload the the cache symbol library.
132  Prj().SchLibs();
133 
134  Raise();
135  m_remapped = true;
136 }
137 
138 
139 size_t DIALOG_SYMBOL_REMAP::getLibsNotInGlobalSymbolLibTable( std::vector< PART_LIB* >& aLibs )
140 {
141  PART_LIBS* libs = Prj().SchLibs();
142 
143  for( PART_LIBS_BASE::iterator it = libs->begin(); it != libs->end(); ++it )
144  {
145  // Ignore the cache library.
146  if( it->IsCache() )
147  continue;
148 
149  // Check for the obvious library name.
150  wxString libFileName = it->GetFullFileName();
151 
152  if( !SYMBOL_LIB_TABLE::GetGlobalLibTable().FindRowByURI( libFileName ) )
153  aLibs.push_back( &(*it) );
154  }
155 
156  return aLibs.size();
157 }
158 
159 
161 {
162  wxString msg;
163  std::vector< PART_LIB* > libs;
164 
166  {
167  SYMBOL_LIB_TABLE prjLibTable;
168  std::vector< wxString > libNames = SYMBOL_LIB_TABLE::GetGlobalLibTable().GetLogicalLibs();
169 
170  for( auto lib : libs )
171  {
172  wxString libName = lib->GetName();
173  int libNameInc = 1;
174  int libNameLen = libName.Length();
175 
176  // Spaces in the file name will break the symbol name because they are not
177  // quoted in the symbol library file format.
178  libName.Replace( " ", "-" );
179 
180  // Don't create duplicate table entries.
181  while( std::find( libNames.begin(), libNames.end(), libName ) != libNames.end() )
182  {
183  libName = libName.Left( libNameLen );
184  libName << libNameInc;
185  libNameInc++;
186  }
187 
188  wxString pluginType = SCH_IO_MGR::ShowType( SCH_IO_MGR::SCH_LEGACY );
189  wxFileName fn = lib->GetFullFileName();
190 
191  // Use environment variable substitution where possible. This is based solely
192  // on the internal user environment variable list. Checking against all of the
193  // system wide environment variables is probably not a good idea.
194  wxString fullFileName = NormalizePath( fn, &Pgm().GetLocalEnvVariables(), &Prj() );
195 
196  // Fall back to the absolute library path.
197  if( fullFileName.IsEmpty() )
198  fullFileName = lib->GetFullFileName();
199 
200  wxFileName tmpFn = fullFileName;
201 
202  // Don't add symbol libraries that do not exist.
203  if( tmpFn.Normalize() && tmpFn.FileExists() )
204  {
205  msg.Printf( _( "Adding library \"%s\", file \"%s\" to project symbol library table." ),
206  libName, fullFileName );
207  aReporter.Report( msg, REPORTER::RPT_INFO );
208 
209  prjLibTable.InsertRow( new SYMBOL_LIB_TABLE_ROW( libName, fullFileName,
210  pluginType ) );
211  }
212  else
213  {
214  msg.Printf( _( "Library \"%s\" not found." ), fullFileName );
215  aReporter.Report( msg, REPORTER::RPT_WARNING );
216  }
217  }
218 
219  // Don't save empty project symbol library table.
220  if( !prjLibTable.IsEmpty() )
221  {
222  wxFileName fn( Prj().GetProjectPath(), SYMBOL_LIB_TABLE::GetSymbolLibTableFileName() );
223 
224  try
225  {
226  FILE_OUTPUTFORMATTER formatter( fn.GetFullPath() );
227  prjLibTable.Format( &formatter, 0 );
228  }
229  catch( const IO_ERROR& ioe )
230  {
231  msg.Printf( _( "Failed to write project symbol library table. Error:\n %s" ),
232  ioe.What() );
233  aReporter.ReportTail( msg, REPORTER::RPT_ERROR );
234  }
235 
236  aReporter.ReportTail( _( "Created project symbol library table.\n" ), REPORTER::RPT_INFO );
237  }
238  }
239 }
240 
241 
243 {
244  wxString msg;
245  SCH_SCREENS schematic;
246  SCH_COMPONENT* symbol;
247  SCH_ITEM* item;
248  SCH_ITEM* nextItem;
249  SCH_SCREEN* screen;
250 
251  for( screen = schematic.GetFirst(); screen; screen = schematic.GetNext() )
252  {
253  for( item = screen->GetDrawItems(); item; item = nextItem )
254  {
255  nextItem = item->Next();
256 
257  if( item->Type() != SCH_COMPONENT_T )
258  continue;
259 
260  symbol = dynamic_cast< SCH_COMPONENT* >( item );
261 
262  if( !remapSymbolToLibTable( symbol ) )
263  {
264  msg.Printf( _( "No symbol \"%s\" found in symbol library table." ),
265  symbol->GetLibId().GetLibItemName().wx_str() );
266  aReporter.Report( msg, REPORTER::RPT_WARNING );
267  }
268  else
269  {
270  msg.Printf( _( "Symbol \"%s\" mapped to symbol library \"%s\"." ),
271  symbol->GetLibId().GetLibItemName().wx_str(),
272  symbol->GetLibId().GetLibNickname().wx_str() );
273  aReporter.Report( msg, REPORTER::RPT_ACTION );
274  screen->SetModify();
275  }
276  }
277  }
278 
279  aReporter.Report( _( "Symbol library table mapping complete!" ), REPORTER::RPT_INFO );
280  schematic.UpdateSymbolLinks( true );
281 }
282 
283 
285 {
286  wxCHECK_MSG( aSymbol != NULL, false, "Null pointer passed to remapSymbolToLibTable." );
287  wxCHECK_MSG( aSymbol->GetLibId().GetLibNickname().empty(), false,
288  "Cannot remap symbol that is already mapped." );
289  wxCHECK_MSG( !aSymbol->GetLibId().GetLibItemName().empty(), false,
290  "The symbol LIB_ID name is empty." );
291 
292  PART_LIBS* libs = Prj().SchLibs();
293 
294  for( PART_LIBS_BASE::iterator it = libs->begin(); it != libs->end(); ++it )
295  {
296  // Ignore the cache library.
297  if( it->IsCache() )
298  continue;
299 
300  LIB_ALIAS* alias = it->FindAlias( aSymbol->GetLibId().GetLibItemName().wx_str() );
301 
302  // Found in the same library as the old look up method assuming the user didn't
303  // change the libraries or library ordering since the last time the schematic was
304  // loaded.
305  if( alias )
306  {
307  // Find the same library in the symbol library table using the full path and file name.
308  wxString libFileName = it->GetFullFileName();
309 
310  const LIB_TABLE_ROW* row = Prj().SchSymbolLibTable()->FindRowByURI( libFileName );
311 
312  if( row )
313  {
314  LIB_ID id = aSymbol->GetLibId();
315 
316  id.SetLibNickname( row->GetNickName() );
317 
318  // Don't resolve symbol library links now.
319  aSymbol->SetLibId( id, nullptr, nullptr );
320  return true;
321  }
322  }
323  }
324 
325  return false;
326 }
327 
328 
330 {
331  static wxString backupFolder = "rescue-backup";
332 
333  wxString tmp;
334  wxString errorMsg;
335  wxFileName srcFileName;
336  wxFileName destFileName;
337  wxFileName backupPath;
338  SCH_SCREENS schematic;
339 
340  // Copy backup files to different folder so as not to pollute the project folder.
341  destFileName.SetPath( Prj().GetProjectPath() );
342  destFileName.AppendDir( backupFolder );
343  backupPath = destFileName;
344 
345  if( !destFileName.DirExists() )
346  {
347  if( !destFileName.Mkdir() )
348  {
349  errorMsg.Printf( _( "Cannot create project remap back up folder \"%s\"." ),
350  destFileName.GetPath() );
351 
352  wxMessageDialog dlg( this, errorMsg, _( "Backup Error" ),
353  wxYES_NO | wxCENTRE | wxRESIZE_BORDER | wxICON_QUESTION );
354  dlg.SetYesNoLabels( wxMessageDialog::ButtonLabel( _( "Continue with Rescue" ) ),
355  wxMessageDialog::ButtonLabel( _( "Abort Rescue" ) ) );
356 
357  if( dlg.ShowModal() == wxID_NO )
358  return false;
359  }
360  }
361 
362  // Time stamp to append to file name in case multiple remappings are performed.
363  wxString timeStamp = wxDateTime::Now().Format( "-%Y-%m-%d-%H-%M-%S" );
364 
365  // Back up symbol library table.
366  srcFileName.SetPath( Prj().GetProjectPath() );
367  srcFileName.SetName( SYMBOL_LIB_TABLE::GetSymbolLibTableFileName() );
368  destFileName = srcFileName;
369  destFileName.AppendDir( backupFolder );
370  destFileName.SetName( destFileName.GetName() + timeStamp );
371 
372  tmp.Printf( _( "Backing up file \"%s\" to file \"%s\"." ),
373  srcFileName.GetFullPath(), destFileName.GetFullPath() );
374  aReporter.Report( tmp, REPORTER::RPT_INFO );
375 
376  if( wxFileName::Exists( srcFileName.GetFullPath() )
377  && !wxCopyFile( srcFileName.GetFullPath(), destFileName.GetFullPath() ) )
378  {
379  tmp.Printf( _( "Failed to back up file \"%s\".\n" ), srcFileName.GetFullPath() );
380  errorMsg += tmp;
381  }
382 
383  // Back up the schematic files.
384  for( SCH_SCREEN* screen = schematic.GetFirst(); screen; screen = schematic.GetNext() )
385  {
386  destFileName = screen->GetFileName();
387  destFileName.SetName( destFileName.GetName() + timeStamp );
388 
389  // Check for nest hierarchical schematic paths.
390  if( destFileName.GetPath() != backupPath.GetPath() )
391  {
392  destFileName.SetPath( backupPath.GetPath() );
393 
394  wxArrayString srcDirs = wxFileName( screen->GetFileName() ).GetDirs();
395  wxArrayString destDirs = wxFileName( Prj().GetProjectPath() ).GetDirs();
396 
397  for( size_t i = destDirs.GetCount(); i < srcDirs.GetCount(); i++ )
398  destFileName.AppendDir( srcDirs[i] );
399  }
400  else
401  {
402  destFileName.AppendDir( backupFolder );
403  }
404 
405  tmp.Printf( _( "Backing up file \"%s\" to file \"%s\"." ),
406  screen->GetFileName(), destFileName.GetFullPath() );
407  aReporter.Report( tmp, REPORTER::RPT_INFO );
408 
409  if( !destFileName.DirExists() && !destFileName.Mkdir( wxS_DIR_DEFAULT, wxPATH_MKDIR_FULL ) )
410  {
411  tmp.Printf( _( "Failed to create backup folder \"%s\"\n" ), destFileName.GetPath() );
412  errorMsg += tmp;
413  continue;
414  }
415 
416  if( wxFileName::Exists( screen->GetFileName() )
417  && !wxCopyFile( screen->GetFileName(), destFileName.GetFullPath() ) )
418  {
419  tmp.Printf( _( "Failed to back up file \"%s\".\n" ), screen->GetFileName() );
420  errorMsg += tmp;
421  }
422  }
423 
424  // Back up the project file.
425  destFileName = Prj().GetProjectFullName();
426  destFileName.SetName( destFileName.GetName() + timeStamp );
427  destFileName.AppendDir( backupFolder );
428 
429  tmp.Printf( _( "Backing up file \"%s\" to file \"%s\"." ),
430  Prj().GetProjectFullName(), destFileName.GetFullPath() );
431  aReporter.Report( tmp, REPORTER::RPT_INFO );
432 
433  if( wxFileName::Exists( Prj().GetProjectFullName() )
434  && !wxCopyFile( Prj().GetProjectFullName(), destFileName.GetFullPath() ) )
435  {
436  tmp.Printf( _( "Failed to back up file \"%s\".\n" ), Prj().GetProjectFullName() );
437  errorMsg += tmp;
438  }
439 
440  // Back up the cache library.
441  srcFileName.SetPath( Prj().GetProjectPath() );
442  srcFileName.SetName( Prj().GetProjectName() + "-cache" );
443  srcFileName.SetExt( SchematicLibraryFileExtension );
444 
445  destFileName = srcFileName;
446  destFileName.SetName( destFileName.GetName() + timeStamp );
447  destFileName.AppendDir( backupFolder );
448 
449  tmp.Printf( _( "Backing up file \"%s\" to file \"%s\"." ),
450  srcFileName.GetFullPath(), destFileName.GetFullPath() );
451  aReporter.Report( tmp, REPORTER::RPT_INFO );
452 
453  if( srcFileName.Exists()
454  && !wxCopyFile( srcFileName.GetFullPath(), destFileName.GetFullPath() ) )
455  {
456  tmp.Printf( _( "Failed to back up file \"%s\".\n" ), srcFileName.GetFullPath() );
457  errorMsg += tmp;
458  }
459 
460  // Back up the rescue symbol library if it exists.
461  srcFileName.SetName( Prj().GetProjectName() + "-rescue" );
462  destFileName.SetName( srcFileName.GetName() + timeStamp );
463 
464  tmp.Printf( _( "Backing up file \"%s\" to file \"%s\"." ),
465  srcFileName.GetFullPath(), destFileName.GetFullPath() );
466  aReporter.Report( tmp, REPORTER::RPT_INFO );
467 
468  if( srcFileName.Exists()
469  && !wxCopyFile( srcFileName.GetFullPath(), destFileName.GetFullPath() ) )
470  {
471  tmp.Printf( _( "Failed to back up file \"%s\".\n" ), srcFileName.GetFullPath() );
472  errorMsg += tmp;
473  }
474 
475  // Back up the rescue symbol library document file if it exists.
476  srcFileName.SetExt( "dcm" );
477  destFileName.SetExt( srcFileName.GetExt() );
478 
479  tmp.Printf( _( "Backing up file \"%s\" to file \"%s\"." ),
480  srcFileName.GetFullPath(), destFileName.GetFullPath() );
481  aReporter.Report( tmp, REPORTER::RPT_INFO );
482 
483  if( srcFileName.Exists()
484  && !wxCopyFile( srcFileName.GetFullPath(), destFileName.GetFullPath() ) )
485  {
486  tmp.Printf( _( "Failed to back up file \"%s\".\n" ), srcFileName.GetFullPath() );
487  errorMsg += tmp;
488  }
489 
490  if( !errorMsg.IsEmpty() )
491  {
492  wxMessageDialog dlg( this, _( "Some of the project files could not be backed up." ),
493  _( "Backup Error" ),
494  wxYES_NO | wxCENTRE | wxRESIZE_BORDER | wxICON_QUESTION );
495  errorMsg.Trim();
496  dlg.SetExtendedMessage( errorMsg );
497  dlg.SetYesNoLabels( wxMessageDialog::ButtonLabel( _( "Continue with Rescue" ) ),
498  wxMessageDialog::ButtonLabel( _( "Abort Rescue" ) ) );
499 
500  if( dlg.ShowModal() == wxID_NO )
501  return false;
502  }
503 
504  return true;
505 }
506 
507 
508 void DIALOG_SYMBOL_REMAP::OnUpdateUIRemapButton( wxUpdateUIEvent& aEvent )
509 {
510  aEvent.Enable( !m_remapped );
511 }
Definition of the SCH_SHEET class for Eeschema.
static const wxString & GetSymbolLibTableFileName()
static SYMBOL_LIB_TABLE & GetGlobalLibTable()
Part library alias object definition.
const UTF8 & GetLibItemName() const
Definition: lib_id.h:114
SCH_SCREEN * GetNext()
Hold a record identifying a symbol library accessed by the appropriate symbol library SCH_PLUGIN obje...
KIWAY & Kiway() const
Function Kiway returns a reference to the KIWAY that this object has an opportunity to participate in...
Definition: kiway_player.h:60
void OnUpdateUIRemapButton(wxUpdateUIEvent &aEvent) override
static void LibNamesAndPaths(PROJECT *aProject, bool doSave, wxString *aPaths, wxArrayString *aNames=NULL)
Save or load the names of the currently configured part libraries (without paths).
Hold a record identifying a library accessed by the appropriate plug in object in the LIB_TABLE.
bool InsertRow(LIB_TABLE_ROW *aRow, bool doReplace=false)
Adds aRow if it does not already exist or if doReplace is true.
This file is part of the common library.
SCH_ITEM * Next() const
void OnModify()
Must be called after a schematic change in order to set the "modify" flag of the current screen* and ...
size_t getLibsNotInGlobalSymbolLibTable(std::vector< PART_LIB * > &aLibs)
Add libraries found in the legacy library list to aLibs that are not found in the global symbol libra...
EDA_DRAW_PANEL_GAL * GetGalCanvas() const
Return a pointer to GAL-based canvas of given EDA draw frame.
Definition: draw_frame.h:935
static const wxString ShowType(SCH_FILE_T aFileType)
Return a brief name for a plugin, given aFileType enum.
Definition: sch_io_mgr.cpp:76
PGM_BASE & Pgm()
The global Program "get" accessor.
Definition: kicad.cpp:66
Schematic editor (Eeschema) main window.
void Refresh(bool aEraseBackground=true, const wxRect *aRect=NULL) override
Update the board display after modifying it by a python script (note: it is automatically called by a...
Class REPORTER is a pure virtual class used to derive REPORTER objects from.
Definition: reporter.h:61
A logical library item identifier and consists of various portions much like a URI.
Definition: lib_id.h:51
Symbol library viewer main window.
Definition: viewlib_frame.h:44
This file contains miscellaneous commonly used macros and functions.
VTBL_ENTRY void SetElem(ELEM_T aIndex, _ELEM *aElem)
Definition: project.cpp:217
SCH_SCREEN * GetScreen() const override
Return a pointer to a BASE_SCREEN or one of its derivatives.
Class DIALOG_SYMBOL_REMAP_BASE.
static bool RescueProject(wxWindow *aParent, RESCUER &aRescuer, bool aRunningOnDemand)
const wxString & GetNickName() const
void SetLibId(const LIB_ID &aName, PART_LIBS *aLibs=NULL)
void OnRemapSymbols(wxCommandEvent &aEvent) override
void createProjectSymbolLibTable(REPORTER &aReporter)
VTBL_ENTRY KIWAY_PLAYER * Player(FRAME_T aFrameType, bool doCreate=true, wxTopLevelWindow *aParent=NULL)
Function Player returns the KIWAY_PLAYER* given a FRAME_T.
Definition: kiway.cpp:300
virtual const wxString What() const
A composite of Problem() and Where()
Definition: exceptions.cpp:33
virtual REPORTER & ReportTail(const wxString &aText, SEVERITY aSeverity=RPT_UNDEFINED)
Function ReportTail Places the report at the end of the list, for objects that support report orderin...
Definition: reporter.h:111
UNDO_REDO_CONTAINER m_UndoList
Objects list for the undo command (old data)
Definition: base_screen.h:210
void SyncView()
Mark all items for refresh.
const std::string SchematicLibraryFileExtension
PROJECT & Prj() const
Function Prj returns a reference to the PROJECT "associated with" this KIWAY.
REPORTER & Reporter()
returns the reporter object that reports to this panel
SCH_DRAW_PANEL * GetCanvas() const override
SCH_SHEET_PATH & GetCurrentSheet()
void remapSymbolsToLibTable(REPORTER &aReporter)
Definition of file extensions used in Kicad.
const UTF8 & GetLibNickname() const
Return the logical library name portion of a LIB_ID.
Definition: lib_id.h:97
DIALOG_SYMBOL_REMAP(SCH_EDIT_FRAME *aParent)
virtual void Format(OUTPUTFORMATTER *aOutput, int aIndentLevel) const override
Generate the table in s-expression format to aOutput with an indention level of aIndentLevel.
VTBL_ENTRY const wxString GetProjectFullName() const
Function GetProjectFullName returns the full path and name of the project.
Definition: project.cpp:96
WX_HTML_REPORT_PANEL * m_messagePanel
int SetLibNickname(const UTF8 &aNickname)
Override the logical library name portion of the LIB_ID to aNickname.
Definition: lib_id.cpp:193
A collection of PART_LIB objects.
Definitions for the Eeschema program SCH_SCREEN class.
bool backupProject(REPORTER &aReporter)
Backup all of the files that could be modified by the remapping with a time stamp appended to the fil...
bool remapSymbolToLibTable(SCH_COMPONENT *aSymbol)
Definition the SCH_COMPONENT class for Eeschema.
see class PGM_BASE
void UpdateSymbolLinks(bool aForce=false)
Initialize or reinitialize the weak reference to the LIB_PART for each SCH_COMPONENT found in the ful...
size_t i
Definition: json11.cpp:597
wxString wx_str() const
Definition: utf8.cpp:51
Class SCH_COMPONENT describes a real schematic component.
Definition: sch_component.h:70
virtual REPORTER & Report(const wxString &aText, SEVERITY aSeverity=RPT_UNDEFINED)=0
Function Report is a pure virtual function to override in the derived object.
Class FILE_OUTPUTFORMATTER may be used for text file output.
Definition: richio.h:492
SCH_SCREEN * GetFirst()
GAL_TYPE GetBackend() const
Function GetBackend Returns the type of backend currently used by GAL canvas.
virtual void ClearUndoORRedoList(UNDO_REDO_CONTAINER &aList, int aItemCount=-1) override
Free the undo or redo list from aList element.
Definition: sch_screen.cpp:548
Definition for part library class.
void SetModify()
Definition: base_screen.h:324
bool ReCreateListLib()
Creates or recreates a sorted list of currently loaded libraries.
const LIB_ID & GetLibId() const
void DisplayInfoMessage(wxWindow *aParent, const wxString &aMessage, const wxString &aExtraInfo)
Function DisplayInfoMessage displays an informational message box with aMessage.
Definition: confirm.cpp:275
Struct IO_ERROR is a class used to hold an error message and may be used when throwing exceptions con...
Definition: ki_exception.h:76
Class SCH_ITEM is a base class for any item which can be embedded within the SCHEMATIC container clas...
wxString NormalizePath(const wxFileName &aFilePath, const ENV_VAR_MAP *aEnvVars, const wxString &aProjectPath)
Normalizes a file path to an environmental variable, if possible.
Definition: env_paths.cpp:67
Container class that holds multiple SCH_SCREEN objects in a hierarchy.
Definition: sch_screen.h:523
bool IsEmpty(bool aIncludeFallback=true)
Return true if the table is empty.
std::vector< wxString > GetLogicalLibs()
Return the logical library names, all of them that are pertinent to a look up done on this LIB_TABLE.
KICAD_T Type() const
Function Type()
Definition: base_struct.h:201
bool empty() const
Definition: utf8.h:108
SCH_ITEM * GetDrawItems() const
Definition: sch_screen.h:160