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(), parent->GetCanvas()->GetBackend() );
91 
92  if( RESCUER::RescueProject( this, rescuer, false ) )
93  {
94  LIB_VIEW_FRAME* viewer = (LIB_VIEW_FRAME*) parent->Kiway().Player( FRAME_SCH_VIEWER, false );
95 
96  if( viewer )
97  viewer->ReCreateListLib();
98 
99  parent->GetScreen()->ClearUndoORRedoList( parent->GetScreen()->m_UndoList, 1 );
100  parent->SyncView();
101  parent->GetCanvas()->Refresh();
102  parent->OnModify();
103  }
104 
105  // The schematic is fully loaded, any legacy library symbols have been rescued. Now
106  // check to see if the schematic has not been converted to the symbol library table
107  // method for looking up symbols.
108  wxFileName prjSymLibTableFileName( Prj().GetProjectPath(),
110 
111  // Delete the existing project symbol library table.
112  if( prjSymLibTableFileName.FileExists() )
113  {
114  wxRemoveFile( prjSymLibTableFileName.GetFullPath() );
115  }
116 
119  Prj().SchSymbolLibTable();
120 
122 
123  // Remove all of the libraries from the legacy library list.
124  wxString paths;
125  wxArrayString libNames;
126 
127  PART_LIBS::LibNamesAndPaths( &Prj(), true, &paths, &libNames );
128 
129  // Reload the the cache symbol library.
131  Prj().SchLibs();
132 
133  Raise();
134  m_remapped = true;
135 }
136 
137 
138 size_t DIALOG_SYMBOL_REMAP::getLibsNotInGlobalSymbolLibTable( std::vector< PART_LIB* >& aLibs )
139 {
140  PART_LIBS* libs = Prj().SchLibs();
141 
142  for( PART_LIBS_BASE::iterator it = libs->begin(); it != libs->end(); ++it )
143  {
144  // Ignore the cache library.
145  if( it->IsCache() )
146  continue;
147 
148  // Check for the obvious library name.
149  wxString libFileName = it->GetFullFileName();
150 
151  if( !SYMBOL_LIB_TABLE::GetGlobalLibTable().FindRowByURI( libFileName ) )
152  aLibs.push_back( &(*it) );
153  }
154 
155  return aLibs.size();
156 }
157 
158 
160 {
161  wxString msg;
162  std::vector< PART_LIB* > libs;
163 
165  {
166  SYMBOL_LIB_TABLE prjLibTable;
167  std::vector< wxString > libNames = SYMBOL_LIB_TABLE::GetGlobalLibTable().GetLogicalLibs();
168 
169  for( auto lib : libs )
170  {
171  wxString libName = lib->GetName();
172  int libNameInc = 1;
173  int libNameLen = libName.Length();
174 
175  // Spaces in the file name will break the symbol name because they are not
176  // quoted in the symbol library file format.
177  libName.Replace( " ", "-" );
178 
179  // Don't create duplicate table entries.
180  while( std::find( libNames.begin(), libNames.end(), libName ) != libNames.end() )
181  {
182  libName = libName.Left( libNameLen );
183  libName << libNameInc;
184  libNameInc++;
185  }
186 
187  wxString pluginType = SCH_IO_MGR::ShowType( SCH_IO_MGR::SCH_LEGACY );
188  wxFileName fn = lib->GetFullFileName();
189 
190  // Use environment variable substitution where possible. This is based solely
191  // on the internal user environment variable list. Checking against all of the
192  // system wide environment variables is probably not a good idea.
193  wxString fullFileName = NormalizePath( fn, &Pgm().GetLocalEnvVariables(), &Prj() );
194 
195  // Fall back to the absolute library path.
196  if( fullFileName.IsEmpty() )
197  fullFileName = lib->GetFullFileName();
198 
199  wxFileName tmpFn = fullFileName;
200 
201  // Don't add symbol libraries that do not exist.
202  if( tmpFn.Normalize() && tmpFn.FileExists() )
203  {
204  msg.Printf( _( "Adding library \"%s\", file \"%s\" to project symbol library table." ),
205  libName, fullFileName );
206  aReporter.Report( msg, REPORTER::RPT_INFO );
207 
208  prjLibTable.InsertRow( new SYMBOL_LIB_TABLE_ROW( libName, fullFileName,
209  pluginType ) );
210  }
211  else
212  {
213  msg.Printf( _( "Library \"%s\" not found." ), fullFileName );
214  aReporter.Report( msg, REPORTER::RPT_WARNING );
215  }
216  }
217 
218  // Don't save empty project symbol library table.
219  if( !prjLibTable.IsEmpty() )
220  {
221  wxFileName fn( Prj().GetProjectPath(), SYMBOL_LIB_TABLE::GetSymbolLibTableFileName() );
222 
223  try
224  {
225  FILE_OUTPUTFORMATTER formatter( fn.GetFullPath() );
226  prjLibTable.Format( &formatter, 0 );
227  }
228  catch( const IO_ERROR& ioe )
229  {
230  msg.Printf( _( "Failed to write project symbol library table. Error:\n %s" ),
231  ioe.What() );
232  aReporter.ReportTail( msg, REPORTER::RPT_ERROR );
233  }
234 
235  aReporter.ReportTail( _( "Created project symbol library table.\n" ), REPORTER::RPT_INFO );
236  }
237  }
238 }
239 
240 
242 {
243  wxString msg;
244  SCH_SCREENS schematic;
245  SCH_COMPONENT* symbol;
246  SCH_ITEM* item;
247  SCH_ITEM* nextItem;
248  SCH_SCREEN* screen;
249 
250  for( screen = schematic.GetFirst(); screen; screen = schematic.GetNext() )
251  {
252  for( item = screen->GetDrawItems(); item; item = nextItem )
253  {
254  nextItem = item->Next();
255 
256  if( item->Type() != SCH_COMPONENT_T )
257  continue;
258 
259  symbol = dynamic_cast< SCH_COMPONENT* >( item );
260 
261  if( !remapSymbolToLibTable( symbol ) )
262  {
263  msg.Printf( _( "No symbol \"%s\" found in symbol library table." ),
264  symbol->GetLibId().GetLibItemName().wx_str() );
265  aReporter.Report( msg, REPORTER::RPT_WARNING );
266  }
267  else
268  {
269  msg.Printf( _( "Symbol \"%s\" mapped to symbol library \"%s\"." ),
270  symbol->GetLibId().GetLibItemName().wx_str(),
271  symbol->GetLibId().GetLibNickname().wx_str() );
272  aReporter.Report( msg, REPORTER::RPT_ACTION );
273  screen->SetModify();
274  }
275  }
276  }
277 
278  aReporter.Report( _( "Symbol library table mapping complete!" ), REPORTER::RPT_INFO );
279  schematic.UpdateSymbolLinks( true );
280 }
281 
282 
284 {
285  wxCHECK_MSG( aSymbol != NULL, false, "Null pointer passed to remapSymbolToLibTable." );
286  wxCHECK_MSG( aSymbol->GetLibId().GetLibNickname().empty(), false,
287  "Cannot remap symbol that is already mapped." );
288  wxCHECK_MSG( !aSymbol->GetLibId().GetLibItemName().empty(), false,
289  "The symbol LIB_ID name is empty." );
290 
291  PART_LIBS* libs = Prj().SchLibs();
292 
293  for( PART_LIBS_BASE::iterator it = libs->begin(); it != libs->end(); ++it )
294  {
295  // Ignore the cache library.
296  if( it->IsCache() )
297  continue;
298 
299  LIB_ALIAS* alias = it->FindAlias( aSymbol->GetLibId().GetLibItemName().wx_str() );
300 
301  // Found in the same library as the old look up method assuming the user didn't
302  // change the libraries or library ordering since the last time the schematic was
303  // loaded.
304  if( alias )
305  {
306  // Find the same library in the symbol library table using the full path and file name.
307  wxString libFileName = it->GetFullFileName();
308 
309  const LIB_TABLE_ROW* row = Prj().SchSymbolLibTable()->FindRowByURI( libFileName );
310 
311  if( row )
312  {
313  LIB_ID id = aSymbol->GetLibId();
314 
315  id.SetLibNickname( row->GetNickName() );
316 
317  // Don't resolve symbol library links now.
318  aSymbol->SetLibId( id, nullptr, nullptr );
319  return true;
320  }
321  }
322  }
323 
324  return false;
325 }
326 
327 
329 {
330  static wxString backupFolder = "rescue-backup";
331 
332  wxString tmp;
333  wxString errorMsg;
334  wxFileName srcFileName;
335  wxFileName destFileName;
336  wxFileName backupPath;
337  SCH_SCREENS schematic;
338 
339  // Copy backup files to different folder so as not to pollute the project folder.
340  destFileName.SetPath( Prj().GetProjectPath() );
341  destFileName.AppendDir( backupFolder );
342  backupPath = destFileName;
343 
344  if( !destFileName.DirExists() )
345  {
346  if( !destFileName.Mkdir() )
347  {
348  errorMsg.Printf( _( "Cannot create project remap back up folder \"%s\"." ),
349  destFileName.GetPath() );
350 
351  wxMessageDialog dlg( this, errorMsg, _( "Backup Error" ),
352  wxYES_NO | wxCENTRE | wxRESIZE_BORDER | wxICON_QUESTION );
353  dlg.SetYesNoLabels( wxMessageDialog::ButtonLabel( _( "Continue with Rescue" ) ),
354  wxMessageDialog::ButtonLabel( _( "Abort Rescue" ) ) );
355 
356  if( dlg.ShowModal() == wxID_NO )
357  return false;
358  }
359  }
360 
361  // Time stamp to append to file name in case multiple remappings are performed.
362  wxString timeStamp = wxDateTime::Now().Format( "-%Y-%m-%d-%H-%M-%S" );
363 
364  // Back up symbol library table.
365  srcFileName.SetPath( Prj().GetProjectPath() );
366  srcFileName.SetName( SYMBOL_LIB_TABLE::GetSymbolLibTableFileName() );
367  destFileName = srcFileName;
368  destFileName.AppendDir( backupFolder );
369  destFileName.SetName( destFileName.GetName() + timeStamp );
370 
371  tmp.Printf( _( "Backing up file \"%s\" to file \"%s\"." ),
372  srcFileName.GetFullPath(), destFileName.GetFullPath() );
373  aReporter.Report( tmp, REPORTER::RPT_INFO );
374 
375  if( wxFileName::Exists( srcFileName.GetFullPath() )
376  && !wxCopyFile( srcFileName.GetFullPath(), destFileName.GetFullPath() ) )
377  {
378  tmp.Printf( _( "Failed to back up file \"%s\".\n" ), srcFileName.GetFullPath() );
379  errorMsg += tmp;
380  }
381 
382  // Back up the schematic files.
383  for( SCH_SCREEN* screen = schematic.GetFirst(); screen; screen = schematic.GetNext() )
384  {
385  destFileName = screen->GetFileName();
386  destFileName.SetName( destFileName.GetName() + timeStamp );
387 
388  // Check for nest hierarchical schematic paths.
389  if( destFileName.GetPath() != backupPath.GetPath() )
390  {
391  destFileName.SetPath( backupPath.GetPath() );
392 
393  wxArrayString srcDirs = wxFileName( screen->GetFileName() ).GetDirs();
394  wxArrayString destDirs = wxFileName( Prj().GetProjectPath() ).GetDirs();
395 
396  for( size_t i = destDirs.GetCount(); i < srcDirs.GetCount(); i++ )
397  destFileName.AppendDir( srcDirs[i] );
398  }
399  else
400  {
401  destFileName.AppendDir( backupFolder );
402  }
403 
404  tmp.Printf( _( "Backing up file \"%s\" to file \"%s\"." ),
405  screen->GetFileName(), destFileName.GetFullPath() );
406  aReporter.Report( tmp, REPORTER::RPT_INFO );
407 
408  if( !destFileName.DirExists() && !destFileName.Mkdir( wxS_DIR_DEFAULT, wxPATH_MKDIR_FULL ) )
409  {
410  tmp.Printf( _( "Failed to create backup folder \"%s\"\n" ), destFileName.GetPath() );
411  errorMsg += tmp;
412  continue;
413  }
414 
415  if( wxFileName::Exists( screen->GetFileName() )
416  && !wxCopyFile( screen->GetFileName(), destFileName.GetFullPath() ) )
417  {
418  tmp.Printf( _( "Failed to back up file \"%s\".\n" ), screen->GetFileName() );
419  errorMsg += tmp;
420  }
421  }
422 
423  // Back up the project file.
424  destFileName = Prj().GetProjectFullName();
425  destFileName.SetName( destFileName.GetName() + timeStamp );
426  destFileName.AppendDir( backupFolder );
427 
428  tmp.Printf( _( "Backing up file \"%s\" to file \"%s\"." ),
429  Prj().GetProjectFullName(), destFileName.GetFullPath() );
430  aReporter.Report( tmp, REPORTER::RPT_INFO );
431 
432  if( wxFileName::Exists( Prj().GetProjectFullName() )
433  && !wxCopyFile( Prj().GetProjectFullName(), destFileName.GetFullPath() ) )
434  {
435  tmp.Printf( _( "Failed to back up file \"%s\".\n" ), Prj().GetProjectFullName() );
436  errorMsg += tmp;
437  }
438 
439  // Back up the cache library.
440  srcFileName.SetPath( Prj().GetProjectPath() );
441  srcFileName.SetName( Prj().GetProjectName() + "-cache" );
442  srcFileName.SetExt( SchematicLibraryFileExtension );
443 
444  destFileName = srcFileName;
445  destFileName.SetName( destFileName.GetName() + timeStamp );
446  destFileName.AppendDir( backupFolder );
447 
448  tmp.Printf( _( "Backing up file \"%s\" to file \"%s\"." ),
449  srcFileName.GetFullPath(), destFileName.GetFullPath() );
450  aReporter.Report( tmp, REPORTER::RPT_INFO );
451 
452  if( srcFileName.Exists()
453  && !wxCopyFile( srcFileName.GetFullPath(), destFileName.GetFullPath() ) )
454  {
455  tmp.Printf( _( "Failed to back up file \"%s\".\n" ), srcFileName.GetFullPath() );
456  errorMsg += tmp;
457  }
458 
459  // Back up the rescue symbol library if it exists.
460  srcFileName.SetName( Prj().GetProjectName() + "-rescue" );
461  destFileName.SetName( srcFileName.GetName() + timeStamp );
462 
463  tmp.Printf( _( "Backing up file \"%s\" to file \"%s\"." ),
464  srcFileName.GetFullPath(), destFileName.GetFullPath() );
465  aReporter.Report( tmp, REPORTER::RPT_INFO );
466 
467  if( srcFileName.Exists()
468  && !wxCopyFile( srcFileName.GetFullPath(), destFileName.GetFullPath() ) )
469  {
470  tmp.Printf( _( "Failed to back up file \"%s\".\n" ), srcFileName.GetFullPath() );
471  errorMsg += tmp;
472  }
473 
474  // Back up the rescue symbol library document file if it exists.
475  srcFileName.SetExt( "dcm" );
476  destFileName.SetExt( srcFileName.GetExt() );
477 
478  tmp.Printf( _( "Backing up file \"%s\" to file \"%s\"." ),
479  srcFileName.GetFullPath(), destFileName.GetFullPath() );
480  aReporter.Report( tmp, REPORTER::RPT_INFO );
481 
482  if( srcFileName.Exists()
483  && !wxCopyFile( srcFileName.GetFullPath(), destFileName.GetFullPath() ) )
484  {
485  tmp.Printf( _( "Failed to back up file \"%s\".\n" ), srcFileName.GetFullPath() );
486  errorMsg += tmp;
487  }
488 
489  if( !errorMsg.IsEmpty() )
490  {
491  wxMessageDialog dlg( this, _( "Some of the project files could not be backed up." ),
492  _( "Backup Error" ),
493  wxYES_NO | wxCENTRE | wxRESIZE_BORDER | wxICON_QUESTION );
494  errorMsg.Trim();
495  dlg.SetExtendedMessage( errorMsg );
496  dlg.SetYesNoLabels( wxMessageDialog::ButtonLabel( _( "Continue with Rescue" ) ),
497  wxMessageDialog::ButtonLabel( _( "Abort Rescue" ) ) );
498 
499  if( dlg.ShowModal() == wxID_NO )
500  return false;
501  }
502 
503  return true;
504 }
505 
506 
507 void DIALOG_SYMBOL_REMAP::OnUpdateUIRemapButton( wxUpdateUIEvent& aEvent )
508 {
509  aEvent.Enable( !m_remapped );
510 }
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_holder.h:56
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
Definition: sch_item.h:153
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...
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:65
Schematic editor (Eeschema) main window.
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:43
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:321
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:132
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
Return a pointer to GAL-based canvas of given EDA draw frame.
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
#define _(s)
virtual 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...
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.
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)
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:73
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.
void OnModify() override
Must be called after a schematic change in order to set the "modify" flag of the current screen and u...
virtual void ClearUndoORRedoList(UNDO_REDO_CONTAINER &aList, int aItemCount=-1) override
Free the undo or redo list from aList element.
Definition: sch_screen.cpp:598
Definition for part library class.
void SetModify()
Definition: base_screen.h:224
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)
Display an informational message box with aMessage.
Definition: confirm.cpp:265
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...
Definition: sch_item.h:114
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:491
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:210
bool empty() const
Definition: utf8.h:108
SCH_ITEM * GetDrawItems() const
Definition: sch_screen.h:152