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 <[email protected]>
9 * Copyright (C) 2017-2022 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_base.h>
28#include <project.h>
29#include <confirm.h>
30#include <reporter.h>
32#include <wx_filename.h>
34
35#include <symbol_library.h>
36#include <core/kicad_algo.h>
37#include <symbol_viewer_frame.h>
38#include <project_rescue.h>
39#include <sch_io_mgr.h>
40#include <sch_symbol.h>
41#include <sch_screen.h>
42#include <sch_edit_frame.h>
43#include <schematic.h>
45#include <symbol_lib_table.h>
46#include <env_paths.h>
47
48#include <dialog_symbol_remap.h>
49
50
52 DIALOG_SYMBOL_REMAP_BASE( aParent ),
53 m_frame( aParent )
54{
55 m_remapped = false;
56
57 if( !wxFileName::IsDirWritable( Prj().GetProjectPath() ) )
58 {
59 DisplayInfoMessage( this, _( "Remapping is not possible because you have insufficient "
60 "privileges to the project folder '%s'." ) );
61
62 // Disable the remap button.
63 m_remapped = true;
64 }
65
66 wxString text;
67
68 text = _( "This schematic currently uses the project symbol library list look up method "
69 "for loading library symbols. KiCad will attempt to map the existing symbols "
70 "to use the new symbol library table. Remapping will change some project files "
71 "and schematics may not be compatible with older versions of KiCad. All files "
72 "that are changed will be backed up to the \"remap_backup\" folder in the project "
73 "folder should you need to revert any changes. If you choose to skip this step, "
74 "you will be responsible for manually remapping the symbols." );
75
77
78 m_messagePanel->SetFileName( Prj().GetProjectPath() + wxT( "report.txt" ) );
79}
80
81
82void DIALOG_SYMBOL_REMAP::OnRemapSymbols( wxCommandEvent& aEvent )
83{
84 SCH_EDIT_FRAME* parent = dynamic_cast< SCH_EDIT_FRAME* >( GetParent() );
85
86 wxCHECK_RET( parent != nullptr, "Parent window is not type SCH_EDIT_FRAME." );
87
89 return;
90
91 // Ignore the never show rescue setting for one last rescue of legacy symbol
92 // libraries before remapping to the symbol library table. This ensures the
93 // best remapping results.
94
95 LEGACY_RESCUER rescuer( Prj(), &parent->Schematic(), &parent->GetCurrentSheet(),
96 parent->GetCanvas()->GetBackend() );
97
98 if( RESCUER::RescueProject( this, rescuer, false ) )
99 {
100 wxBusyCursor busy;
101
102 auto viewer = (SYMBOL_VIEWER_FRAME*) parent->Kiway().Player( FRAME_SCH_VIEWER, false );
103
104 if( viewer )
105 viewer->ReCreateLibList();
106
108 parent->SyncView();
109 parent->GetCanvas()->Refresh();
110 parent->OnModify();
111 }
112
113 // The schematic is fully loaded, any legacy library symbols have been rescued. Now
114 // check to see if the schematic has not been converted to the symbol library table
115 // method for looking up symbols.
116
117 wxBusyCursor busy;
118
119 wxFileName prjSymLibTableFileName( Prj().GetProjectPath(),
121
122 // Delete the existing project symbol library table.
123 if( prjSymLibTableFileName.FileExists() )
124 wxRemoveFile( prjSymLibTableFileName.GetFullPath() );
125
128 Prj().SchSymbolLibTable();
129
131
132 // Remove all of the libraries from the legacy library list.
133 wxString paths;
134 wxArrayString libNames;
135
136 SYMBOL_LIBS::LibNamesAndPaths( &Prj(), true, &paths, &libNames );
137
138 // Reload the cache symbol library.
140 Prj().SchLibs();
141
142 Raise();
143 m_remapped = true;
144}
145
146
147size_t DIALOG_SYMBOL_REMAP::getLibsNotInGlobalSymbolLibTable( std::vector< SYMBOL_LIB* >& aLibs )
148{
149 SYMBOL_LIBS* libs = Prj().SchLibs();
150
151 for( SYMBOL_LIBS_BASE::iterator it = libs->begin(); it != libs->end(); ++it )
152 {
153 // Ignore the cache library.
154 if( it->IsCache() )
155 continue;
156
157 // Check for the obvious library name.
158 wxString libFileName = it->GetFullFileName();
159
160 if( !SYMBOL_LIB_TABLE::GetGlobalLibTable().FindRowByURI( libFileName ) )
161 aLibs.push_back( &(*it) );
162 }
163
164 return aLibs.size();
165}
166
167
169{
170 wxString msg;
171 std::vector< SYMBOL_LIB* > libs;
172
174 {
175 SYMBOL_LIB_TABLE prjLibTable;
176 std::vector< wxString > libNames = SYMBOL_LIB_TABLE::GetGlobalLibTable().GetLogicalLibs();
177
178 for( auto lib : libs )
179 {
180 wxString libName = lib->GetName();
181 int libNameInc = 1;
182 int libNameLen = libName.Length();
183
184 // Spaces in the file name will break the symbol name because they are not
185 // quoted in the symbol library file format.
186 libName.Replace( " ", "-" );
187
188 // Don't create duplicate table entries.
189 while( alg::contains( libNames, libName ) )
190 {
191 libName = libName.Left( libNameLen );
192 libName << libNameInc;
193 libNameInc++;
194 }
195
196 wxString pluginType = SCH_IO_MGR::ShowType( SCH_IO_MGR::SCH_LEGACY );
197 wxFileName fn = lib->GetFullFileName();
198
199 // Use environment variable substitution where possible. This is based solely
200 // on the internal user environment variable list. Checking against all of the
201 // system wide environment variables is probably not a good idea.
202 wxString fullFileName = NormalizePath( fn, &Pgm().GetLocalEnvVariables(), &Prj() );
203
204 wxFileName tmpFn = fullFileName;
205
206 // Don't add symbol libraries that do not exist.
207 if( tmpFn.Normalize( FN_NORMALIZE_FLAGS | wxPATH_NORM_ENV_VARS ) && tmpFn.FileExists() )
208 {
209 msg.Printf( _( "Adding library '%s', file '%s' to project symbol library table." ),
210 libName,
211 fullFileName );
212 aReporter.Report( msg, RPT_SEVERITY_INFO );
213
214 prjLibTable.InsertRow( new SYMBOL_LIB_TABLE_ROW( libName, fullFileName,
215 pluginType ) );
216 }
217 else
218 {
219 msg.Printf( _( "Library '%s' not found." ), fullFileName );
220 aReporter.Report( msg, RPT_SEVERITY_WARNING );
221 }
222 }
223
224 // Don't save empty project symbol library table.
225 if( !prjLibTable.IsEmpty() )
226 {
227 wxFileName fn( Prj().GetProjectPath(), SYMBOL_LIB_TABLE::GetSymbolLibTableFileName() );
228
229 try
230 {
231 FILE_OUTPUTFORMATTER formatter( fn.GetFullPath() );
232 prjLibTable.Format( &formatter, 0 );
233 }
234 catch( const IO_ERROR& ioe )
235 {
236 msg.Printf( _( "Failed to write project symbol library table. Error:\n %s" ),
237 ioe.What() );
238 aReporter.ReportTail( msg, RPT_SEVERITY_ERROR );
239 }
240
241 aReporter.ReportTail( _( "Created project symbol library table.\n" ),
243 }
244 }
245}
246
247
249{
250 wxString msg;
251 SCH_SCREENS schematic( m_frame->Schematic().Root() );
252 SCH_SYMBOL* symbol;
253 SCH_SCREEN* screen;
254
255 for( screen = schematic.GetFirst(); screen; screen = schematic.GetNext() )
256 {
257 for( EDA_ITEM* item : screen->Items().OfType( SCH_SYMBOL_T ) )
258 {
259 symbol = dynamic_cast<SCH_SYMBOL*>( 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, RPT_SEVERITY_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, RPT_SEVERITY_ACTION );
273 screen->SetContentModified();
274 }
275 }
276 }
277
278 aReporter.Report( _( "Symbol library table mapping complete!" ), RPT_SEVERITY_INFO );
279 schematic.UpdateSymbolLinks();
280}
281
282
284{
285 wxCHECK_MSG( aSymbol != nullptr, 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 SYMBOL_LIBS* libs = Prj().SchLibs();
292
293 for( SYMBOL_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_SYMBOL* alias = it->FindSymbol( 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 );
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( m_frame->Schematic().Root() );
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 {
362 wxBusyCursor busy;
363
364 // Time stamp to append to file name in case multiple remappings are performed.
365 wxString timeStamp = wxDateTime::Now().Format( "-%Y-%m-%d-%H-%M-%S" );
366
367 // Back up symbol library table.
368 srcFileName.SetPath( Prj().GetProjectPath() );
369 srcFileName.SetName( SYMBOL_LIB_TABLE::GetSymbolLibTableFileName() );
370 destFileName = srcFileName;
371 destFileName.AppendDir( backupFolder );
372 destFileName.SetName( destFileName.GetName() + timeStamp );
373
374 tmp.Printf( _( "Backing up file '%s' to '%s'." ),
375 srcFileName.GetFullPath(),
376 destFileName.GetFullPath() );
377 aReporter.Report( tmp, RPT_SEVERITY_INFO );
378
379 if( wxFileName::Exists( srcFileName.GetFullPath() )
380 && !wxCopyFile( srcFileName.GetFullPath(), destFileName.GetFullPath() ) )
381 {
382 tmp.Printf( _( "Failed to back up file '%s'.\n" ),
383 srcFileName.GetFullPath() );
384 errorMsg += tmp;
385 }
386
387 // Back up the schematic files.
388 for( SCH_SCREEN* screen = schematic.GetFirst(); screen; screen = schematic.GetNext() )
389 {
390 destFileName = screen->GetFileName();
391 destFileName.SetName( destFileName.GetName() + timeStamp );
392
393 // Check for nest hierarchical schematic paths.
394 if( destFileName.GetPath() != backupPath.GetPath() )
395 {
396 destFileName.SetPath( backupPath.GetPath() );
397
398 wxArrayString srcDirs = wxFileName( screen->GetFileName() ).GetDirs();
399 wxArrayString destDirs = wxFileName( Prj().GetProjectPath() ).GetDirs();
400
401 for( size_t i = destDirs.GetCount(); i < srcDirs.GetCount(); i++ )
402 destFileName.AppendDir( srcDirs[i] );
403 }
404 else
405 {
406 destFileName.AppendDir( backupFolder );
407 }
408
409 tmp.Printf( _( "Backing up file '%s' to '%s'." ),
410 screen->GetFileName(),
411 destFileName.GetFullPath() );
412 aReporter.Report( tmp, RPT_SEVERITY_INFO );
413
414 if( !destFileName.DirExists() && !destFileName.Mkdir( wxS_DIR_DEFAULT, wxPATH_MKDIR_FULL ) )
415 {
416 tmp.Printf( _( "Failed to create backup folder '%s'.\n" ), destFileName.GetPath() );
417 errorMsg += tmp;
418 continue;
419 }
420
421 if( wxFileName::Exists( screen->GetFileName() )
422 && !wxCopyFile( screen->GetFileName(), destFileName.GetFullPath() ) )
423 {
424 tmp.Printf( _( "Failed to back up file '%s'.\n" ), screen->GetFileName() );
425 errorMsg += tmp;
426 }
427 }
428
429 // Back up the project file.
430 destFileName = Prj().GetProjectFullName();
431 destFileName.SetName( destFileName.GetName() + timeStamp );
432 destFileName.AppendDir( backupFolder );
433
434 tmp.Printf( _( "Backing up file '%s' to '%s'." ),
435 Prj().GetProjectFullName(),
436 destFileName.GetFullPath() );
437 aReporter.Report( tmp, RPT_SEVERITY_INFO );
438
439 if( wxFileName::Exists( Prj().GetProjectFullName() )
440 && !wxCopyFile( Prj().GetProjectFullName(), destFileName.GetFullPath() ) )
441 {
442 tmp.Printf( _( "Failed to back up file '%s'.\n" ), Prj().GetProjectFullName() );
443 errorMsg += tmp;
444 }
445
446 // Back up the cache library.
447 srcFileName.SetPath( Prj().GetProjectPath() );
448 srcFileName.SetName( Prj().GetProjectName() + "-cache" );
449 srcFileName.SetExt( LegacySymbolLibFileExtension );
450
451 destFileName = srcFileName;
452 destFileName.SetName( destFileName.GetName() + timeStamp );
453 destFileName.AppendDir( backupFolder );
454
455 tmp.Printf( _( "Backing up file '%s' to '%s'." ),
456 srcFileName.GetFullPath(),
457 destFileName.GetFullPath() );
458 aReporter.Report( tmp, RPT_SEVERITY_INFO );
459
460 if( srcFileName.Exists()
461 && !wxCopyFile( srcFileName.GetFullPath(), destFileName.GetFullPath() ) )
462 {
463 tmp.Printf( _( "Failed to back up file '%s'.\n" ), srcFileName.GetFullPath() );
464 errorMsg += tmp;
465 }
466
467 // Back up the rescue symbol library if it exists.
468 srcFileName.SetName( Prj().GetProjectName() + "-rescue" );
469 destFileName.SetName( srcFileName.GetName() + timeStamp );
470
471 tmp.Printf( _( "Backing up file '%s' to '%s'." ),
472 srcFileName.GetFullPath(),
473 destFileName.GetFullPath() );
474 aReporter.Report( tmp, RPT_SEVERITY_INFO );
475
476 if( srcFileName.Exists()
477 && !wxCopyFile( srcFileName.GetFullPath(), destFileName.GetFullPath() ) )
478 {
479 tmp.Printf( _( "Failed to back up file '%s'.\n" ), srcFileName.GetFullPath() );
480 errorMsg += tmp;
481 }
482
483 // Back up the rescue symbol library document file if it exists.
484 srcFileName.SetExt( LegacySymbolDocumentFileExtension );
485 destFileName.SetExt( srcFileName.GetExt() );
486
487 tmp.Printf( _( "Backing up file '%s' to '%s'." ),
488 srcFileName.GetFullPath(),
489 destFileName.GetFullPath() );
490 aReporter.Report( tmp, RPT_SEVERITY_INFO );
491
492 if( srcFileName.Exists()
493 && !wxCopyFile( srcFileName.GetFullPath(), destFileName.GetFullPath() ) )
494 {
495 tmp.Printf( _( "Failed to back up file '%s'.\n" ), srcFileName.GetFullPath() );
496 errorMsg += tmp;
497 }
498 }
499
500 if( !errorMsg.IsEmpty() )
501 {
502 wxMessageDialog dlg( this, _( "Some of the project files could not be backed up." ),
503 _( "Backup Error" ),
504 wxYES_NO | wxCENTRE | wxRESIZE_BORDER | wxICON_QUESTION );
505 errorMsg.Trim();
506 dlg.SetExtendedMessage( errorMsg );
507 dlg.SetYesNoLabels( wxMessageDialog::ButtonLabel( _( "Continue with Rescue" ) ),
508 wxMessageDialog::ButtonLabel( _( "Abort Rescue" ) ) );
509
510 if( dlg.ShowModal() == wxID_NO )
511 return false;
512 }
513
514 return true;
515}
516
517
518void DIALOG_SYMBOL_REMAP::OnUpdateUIRemapButton( wxUpdateUIEvent& aEvent )
519{
520 aEvent.Enable( !m_remapped );
521}
void SetContentModified(bool aModified=true)
Definition: base_screen.h:59
Class DIALOG_SYMBOL_REMAP_BASE.
WX_HTML_REPORT_PANEL * m_messagePanel
void OnUpdateUIRemapButton(wxUpdateUIEvent &aEvent) override
void remapSymbolsToLibTable(REPORTER &aReporter)
SCH_EDIT_FRAME * m_frame
void createProjectSymbolLibTable(REPORTER &aReporter)
bool remapSymbolToLibTable(SCH_SYMBOL *aSymbol)
size_t getLibsNotInGlobalSymbolLibTable(std::vector< SYMBOL_LIB * > &aLibs)
Add libraries found in the legacy library list to aLibs that are not found in the global symbol libra...
DIALOG_SYMBOL_REMAP(SCH_EDIT_FRAME *aParent)
void OnRemapSymbols(wxCommandEvent &aEvent) override
bool backupProject(REPORTER &aReporter)
Backup all of the files that could be modified by the remapping with a time stamp appended to the fil...
GAL_TYPE GetBackend() const
Return the type of backend currently used by GAL canvas.
virtual void Refresh(bool aEraseBackground=true, const wxRect *aRect=nullptr) override
Update the board display after modifying it by a python script (note: it is automatically called by a...
A base class for most all the KiCad significant classes used in schematics and boards.
Definition: eda_item.h:85
EE_TYPE OfType(KICAD_T aType) const
Definition: sch_rtree.h:238
Used for text file output.
Definition: richio.h:457
bool AppendToPage(const wxString &aSource)
Definition: html_window.cpp:57
Hold an error message and may be used when throwing exceptions containing meaningful error messages.
Definition: ki_exception.h:76
virtual const wxString What() const
A composite of Problem() and Where()
Definition: exceptions.cpp:30
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
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
A logical library item identifier and consists of various portions much like a URI.
Definition: lib_id.h:49
int SetLibNickname(const UTF8 &aNickname)
Override the logical library name portion of the LIB_ID to aNickname.
Definition: lib_id.cpp:98
const UTF8 & GetLibItemName() const
Definition: lib_id.h:101
const UTF8 & GetLibNickname() const
Return the logical library name portion of a LIB_ID.
Definition: lib_id.h:87
Define a library symbol object.
Definition: lib_symbol.h:98
Hold a record identifying a library accessed by the appropriate plug in object in the LIB_TABLE.
const wxString & GetNickName() const
std::vector< wxString > GetLogicalLibs()
Return the logical library names, all of them that are pertinent to a look up done on this LIB_TABLE.
bool InsertRow(LIB_TABLE_ROW *aRow, bool doReplace=false)
Adds aRow if it does not already exist or if doReplace is true.
bool IsEmpty(bool aIncludeFallback=true)
Return true if the table is empty.
virtual const wxString GetProjectFullName() const
Return the full path and name of the project.
Definition: project.cpp:119
virtual void SetElem(ELEM_T aIndex, _ELEM *aElem)
Definition: project.cpp:293
@ ELEM_SYMBOL_LIB_TABLE
Definition: project.h:210
@ ELEM_SCH_SYMBOL_LIBS
Definition: project.h:207
A pure virtual class used to derive REPORTER objects from.
Definition: reporter.h:71
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
virtual REPORTER & Report(const wxString &aText, SEVERITY aSeverity=RPT_SEVERITY_UNDEFINED)=0
Report a string with a given severity.
static bool RescueProject(wxWindow *aParent, RESCUER &aRescuer, bool aRunningOnDemand)
SCH_SHEET & Root() const
Definition: schematic.h:90
SCH_DRAW_PANEL * GetCanvas() const override
Return a pointer to GAL-based canvas of given EDA draw frame.
void SyncView()
Mark all items for refresh.
Schematic editor (Eeschema) main window.
void OnModify() override
Must be called after a schematic change in order to set the "modify" flag of the current screen and u...
void ClearUndoORRedoList(UNDO_REDO_LIST whichList, int aItemCount=-1) override
Free the undo or redo list from aList element.
SCH_SHEET_PATH & GetCurrentSheet() const
SCHEMATIC & Schematic() const
static const wxString ShowType(SCH_FILE_T aFileType)
Return a brief name for a plugin, given aFileType enum.
Definition: sch_io_mgr.cpp:81
Container class that holds multiple SCH_SCREEN objects in a hierarchy.
Definition: sch_screen.h:613
SCH_SCREEN * GetNext()
void UpdateSymbolLinks(REPORTER *aReporter=nullptr)
Initialize the LIB_SYMBOL reference for each SCH_SYMBOL found in the full schematic.
SCH_SCREEN * GetFirst()
EE_RTREE & Items()
Gets the full RTree, usually for iterating.
Definition: sch_screen.h:108
Schematic symbol object.
Definition: sch_symbol.h:80
void SetLibId(const LIB_ID &aName)
Definition: sch_symbol.cpp:286
const LIB_ID & GetLibId() const
Definition: sch_symbol.h:178
A collection of SYMBOL_LIB objects.
static void LibNamesAndPaths(PROJECT *aProject, bool doSave, wxString *aPaths, wxArrayString *aNames=nullptr)
Save or load the names of the currently configured symbol libraries (without paths).
Hold a record identifying a symbol library accessed by the appropriate symbol library SCH_PLUGIN obje...
static SYMBOL_LIB_TABLE & GetGlobalLibTable()
static const wxString & GetSymbolLibTableFileName()
virtual void Format(OUTPUTFORMATTER *aOutput, int aIndentLevel) const override
Generate the table in s-expression format to aOutput with an indentation level of aIndentLevel.
Symbol library viewer main window.
bool empty() const
Definition: utf8.h:103
wxString wx_str() const
Definition: utf8.cpp:46
void SetFileName(const wxString &aReportFileName)
void DisplayInfoMessage(wxWindow *aParent, const wxString &aMessage, const wxString &aExtraInfo)
Display an informational message box with aMessage.
Definition: confirm.cpp:320
This file is part of the common library.
#define _(s)
wxString NormalizePath(const wxFileName &aFilePath, const ENV_VAR_MAP *aEnvVars, const wxString &aProjectPath)
Normalize a file path to an environmental variable, if possible.
Definition: env_paths.cpp:71
@ FRAME_SCH_VIEWER
Definition: frame_type.h:36
const std::string LegacySymbolDocumentFileExtension
const std::string LegacySymbolLibFileExtension
This file contains miscellaneous commonly used macros and functions.
bool contains(const _Container &__container, _Value __value)
Returns true if the container contains the given value.
Definition: kicad_algo.h:99
see class PGM_BASE
@ RPT_SEVERITY_WARNING
@ RPT_SEVERITY_ERROR
@ RPT_SEVERITY_INFO
@ RPT_SEVERITY_ACTION
KIWAY Kiway & Pgm(), KFCTL_STANDALONE
The global Program "get" accessor.
Definition: single_top.cpp:111
Definition for symbol library class.
@ SCH_SYMBOL_T
Definition: typeinfo.h:155
Definition of file extensions used in Kicad.
#define FN_NORMALIZE_FLAGS
Default flags to pass to wxFileName::Normalize().
Definition: wx_filename.h:38