KiCad PCB EDA Suite
Loading...
Searching...
No Matches
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-2023 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/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#include <project_sch.h>
48
49#include <dialog_symbol_remap.h>
50
51
53 DIALOG_SYMBOL_REMAP_BASE( aParent ),
54 m_frame( aParent )
55{
56 m_remapped = false;
57
58 wxString projectPath = Prj().GetProjectPath();
59
60 if( !wxFileName::IsDirWritable( projectPath ) )
61 {
62 wxString msg =
63 wxString::Format( _( "Remapping is not possible because you have insufficient "
64 "privileges to the project folder '%s'." ),
65 projectPath );
66
67 DisplayInfoMessage( this, msg );
68
69 // Disable the remap button.
70 m_remapped = true;
71 }
72
73 wxString text;
74
75 text = _( "This schematic currently uses the project symbol library list look up method "
76 "for loading library symbols. KiCad will attempt to map the existing symbols "
77 "to use the new symbol library table. Remapping will change some project files "
78 "and schematics may not be compatible with older versions of KiCad. All files "
79 "that are changed will be backed up to the \"rescue-backup\" folder in the project "
80 "folder should you need to revert any changes. If you choose to skip this step, "
81 "you will be responsible for manually remapping the symbols." );
82
84
85 m_messagePanel->SetFileName( Prj().GetProjectPath() + wxT( "report.txt" ) );
86}
87
88
89void DIALOG_SYMBOL_REMAP::OnRemapSymbols( wxCommandEvent& aEvent )
90{
91 SCH_EDIT_FRAME* parent = dynamic_cast< SCH_EDIT_FRAME* >( GetParent() );
92
93 wxCHECK_RET( parent != nullptr, "Parent window is not type SCH_EDIT_FRAME." );
94
96 return;
97
98 // Ignore the never show rescue setting for one last rescue of legacy symbol
99 // libraries before remapping to the symbol library table. This ensures the
100 // best remapping results.
101
102 LEGACY_RESCUER rescuer( Prj(), &parent->Schematic(), &parent->GetCurrentSheet(),
103 parent->GetCanvas()->GetBackend() );
104
105 if( RESCUER::RescueProject( this, rescuer, false ) )
106 {
107 wxBusyCursor busy;
108
109 auto viewer = (SYMBOL_VIEWER_FRAME*) parent->Kiway().Player( FRAME_SCH_VIEWER, false );
110
111 if( viewer )
112 viewer->ReCreateLibList();
113
115 parent->SyncView();
116 parent->GetCanvas()->Refresh();
117 parent->OnModify();
118 }
119
120 // The schematic is fully loaded, any legacy library symbols have been rescued. Now
121 // check to see if the schematic has not been converted to the symbol library table
122 // method for looking up symbols.
123
124 wxFileName prjSymLibTableFileName( Prj().GetProjectPath(),
126
127 // Delete the existing project symbol library table.
128 if( prjSymLibTableFileName.FileExists() )
129 wxRemoveFile( prjSymLibTableFileName.GetFullPath() );
130
134
136
137 // Remove all of the libraries from the legacy library list.
138 wxString paths;
139 wxArrayString libNames;
140
141 SYMBOL_LIBS::SetLibNamesAndPaths( &Prj(), paths, libNames );
142
143 // Reload the cache symbol library.
146
147 Raise();
148 m_remapped = true;
149}
150
151
152size_t DIALOG_SYMBOL_REMAP::getLibsNotInGlobalSymbolLibTable( std::vector< SYMBOL_LIB* >& aLibs )
153{
155
156 for( SYMBOL_LIBS_BASE::iterator it = libs->begin(); it != libs->end(); ++it )
157 {
158 // Ignore the cache library.
159 if( it->IsCache() )
160 continue;
161
162 // Check for the obvious library name.
163 wxString libFileName = it->GetFullFileName();
164
165 if( !SYMBOL_LIB_TABLE::GetGlobalLibTable().FindRowByURI( libFileName ) )
166 aLibs.push_back( &(*it) );
167 }
168
169 return aLibs.size();
170}
171
172
174{
175 std::vector<SYMBOL_LIB*> libs;
176
178 {
179 wxBusyCursor busy;
180 SYMBOL_LIB_TABLE libTable;
181 std::vector<wxString> libNames = SYMBOL_LIB_TABLE::GetGlobalLibTable().GetLogicalLibs();
182 wxString msg;
183
184 for( SYMBOL_LIB* lib : libs )
185 {
186 wxString libName = lib->GetName();
187 int libNameInc = 1;
188 int libNameLen = libName.Length();
189
190 // Spaces in the file name will break the symbol name because they are not
191 // quoted in the symbol library file format.
192 libName.Replace( wxS( " " ), wxS( "-" ) );
193
194 // Don't create duplicate table entries.
195 while( alg::contains( libNames, libName ) )
196 {
197 libName = libName.Left( libNameLen );
198 libName << libNameInc;
199 libNameInc++;
200 }
201
202 wxString type = SCH_IO_MGR::ShowType( SCH_IO_MGR::SCH_LEGACY );
203 wxFileName fn( lib->GetFullFileName() );
204
205 // Use environment variable substitution where possible. This is based solely
206 // on the internal user environment variable list. Checking against all of the
207 // system wide environment variables is probably not a good idea.
208 wxString normalizedPath = NormalizePath( fn, &Pgm().GetLocalEnvVariables(), &Prj() );
209 wxFileName normalizedFn( normalizedPath );
210
211 // Don't add symbol libraries that do not exist.
212 if( normalizedFn.Normalize(FN_NORMALIZE_FLAGS | wxPATH_NORM_ENV_VARS )
213 && normalizedFn.FileExists() )
214 {
215 msg.Printf( _( "Adding library '%s', file '%s' to project symbol library table." ),
216 libName,
217 normalizedPath );
218 aReporter.Report( msg, RPT_SEVERITY_INFO );
219
220 libTable.InsertRow( new SYMBOL_LIB_TABLE_ROW( libName, normalizedPath, type ) );
221 }
222 else
223 {
224 msg.Printf( _( "Library '%s' not found." ), normalizedPath );
225 aReporter.Report( msg, RPT_SEVERITY_WARNING );
226 }
227 }
228
229 // Don't save empty project symbol library table.
230 if( !libTable.IsEmpty() )
231 {
232 wxFileName fn( Prj().GetProjectPath(), SYMBOL_LIB_TABLE::GetSymbolLibTableFileName() );
233
234 try
235 {
236 FILE_OUTPUTFORMATTER formatter( fn.GetFullPath() );
237 libTable.Format( &formatter, 0 );
238 }
239 catch( const IO_ERROR& ioe )
240 {
241 msg.Printf( _( "Error writing project symbol library table.\n %s" ), ioe.What() );
242 aReporter.ReportTail( msg, RPT_SEVERITY_ERROR );
243 }
244
245 aReporter.ReportTail( _( "Created project symbol library table.\n" ),
247 }
248 }
249}
250
251
253{
254 wxBusyCursor busy;
255 wxString msg;
256 SCH_SCREENS schematic( m_frame->Schematic().Root() );
257 SCH_SYMBOL* symbol;
258 SCH_SCREEN* screen;
259
260 for( screen = schematic.GetFirst(); screen; screen = schematic.GetNext() )
261 {
262 for( EDA_ITEM* item : screen->Items().OfType( SCH_SYMBOL_T ) )
263 {
264 symbol = dynamic_cast<SCH_SYMBOL*>( item );
265
266 wxCHECK2( symbol, continue );
267
268 if( !remapSymbolToLibTable( symbol ) )
269 {
270 msg.Printf( _( "No symbol %s found in symbol library table." ),
271 symbol->GetLibId().GetLibItemName().wx_str() );
272 aReporter.Report( msg, RPT_SEVERITY_WARNING );
273 }
274 else
275 {
276 msg.Printf( _( "Symbol %s mapped to symbol library '%s'." ),
277 symbol->GetLibId().GetLibItemName().wx_str(),
278 symbol->GetLibId().GetLibNickname().wx_str() );
279 aReporter.Report( msg, RPT_SEVERITY_ACTION );
280 screen->SetContentModified();
281 }
282 }
283 }
284
285 aReporter.Report( _( "Symbol library table mapping complete!" ), RPT_SEVERITY_INFO );
286 schematic.UpdateSymbolLinks();
287}
288
289
291{
292 wxCHECK_MSG( aSymbol != nullptr, false, "Null pointer passed to remapSymbolToLibTable." );
293 wxCHECK_MSG( aSymbol->GetLibId().GetLibNickname().empty(), false,
294 "Cannot remap symbol that is already mapped." );
295 wxCHECK_MSG( !aSymbol->GetLibId().GetLibItemName().empty(), false,
296 "The symbol LIB_ID name is empty." );
297
299
300 for( SYMBOL_LIBS_BASE::iterator it = libs->begin(); it != libs->end(); ++it )
301 {
302 // Ignore the cache library.
303 if( it->IsCache() )
304 continue;
305
306 LIB_SYMBOL* alias = it->FindSymbol( aSymbol->GetLibId().GetLibItemName().wx_str() );
307
308 // Found in the same library as the old look up method assuming the user didn't
309 // change the libraries or library ordering since the last time the schematic was
310 // loaded.
311 if( alias )
312 {
313 // Find the same library in the symbol library table using the full path and file name.
314 wxString libFileName = it->GetFullFileName();
315
316 const LIB_TABLE_ROW* row = PROJECT_SCH::SchSymbolLibTable( &Prj() )->FindRowByURI( libFileName );
317
318 if( row )
319 {
320 LIB_ID id = aSymbol->GetLibId();
321
322 id.SetLibNickname( row->GetNickName() );
323
324 // Don't resolve symbol library links now.
325 aSymbol->SetLibId( id );
326 return true;
327 }
328 }
329 }
330
331 return false;
332}
333
334
336{
337 static wxString backupFolder = "rescue-backup";
338
339 wxString tmp;
340 wxString errorMsg;
341 wxFileName srcFileName;
342 wxFileName destFileName;
343 wxFileName backupPath;
344 SCH_SCREENS schematic( m_frame->Schematic().Root() );
345
346 // Copy backup files to different folder so as not to pollute the project folder.
347 destFileName.SetPath( Prj().GetProjectPath() );
348 destFileName.AppendDir( backupFolder );
349 backupPath = destFileName;
350
351 if( !destFileName.DirExists() )
352 {
353 if( !destFileName.Mkdir() )
354 {
355 errorMsg.Printf( _( "Cannot create project remap back up folder '%s'." ),
356 destFileName.GetPath() );
357
358 wxMessageDialog dlg( this, errorMsg, _( "Backup Error" ),
359 wxYES_NO | wxCENTRE | wxRESIZE_BORDER | wxICON_QUESTION );
360 dlg.SetYesNoLabels( wxMessageDialog::ButtonLabel( _( "Continue with Rescue" ) ),
361 wxMessageDialog::ButtonLabel( _( "Abort Rescue" ) ) );
362
363 if( dlg.ShowModal() == wxID_NO )
364 return false;
365 }
366 }
367
368 {
369 wxBusyCursor busy;
370
371 // Time stamp to append to file name in case multiple remappings are performed.
372 wxString timeStamp = wxDateTime::Now().Format( "-%Y-%m-%d-%H-%M-%S" );
373
374 // Back up symbol library table.
375 srcFileName.SetPath( Prj().GetProjectPath() );
376 srcFileName.SetName( SYMBOL_LIB_TABLE::GetSymbolLibTableFileName() );
377 destFileName = srcFileName;
378 destFileName.AppendDir( backupFolder );
379 destFileName.SetName( destFileName.GetName() + timeStamp );
380
381 tmp.Printf( _( "Backing up file '%s' to '%s'." ),
382 srcFileName.GetFullPath(),
383 destFileName.GetFullPath() );
384 aReporter.Report( tmp, RPT_SEVERITY_INFO );
385
386 if( wxFileName::Exists( srcFileName.GetFullPath() )
387 && !wxCopyFile( srcFileName.GetFullPath(), destFileName.GetFullPath() ) )
388 {
389 tmp.Printf( _( "Failed to back up file '%s'.\n" ),
390 srcFileName.GetFullPath() );
391 errorMsg += tmp;
392 }
393
394 // Back up the schematic files.
395 for( SCH_SCREEN* screen = schematic.GetFirst(); screen; screen = schematic.GetNext() )
396 {
397 destFileName = screen->GetFileName();
398 destFileName.SetName( destFileName.GetName() + timeStamp );
399
400 // Check for nest hierarchical schematic paths.
401 if( destFileName.GetPath() != backupPath.GetPath() )
402 {
403 destFileName.SetPath( backupPath.GetPath() );
404
405 wxArrayString srcDirs = wxFileName( screen->GetFileName() ).GetDirs();
406 wxArrayString destDirs = wxFileName( Prj().GetProjectPath() ).GetDirs();
407
408 for( size_t i = destDirs.GetCount(); i < srcDirs.GetCount(); i++ )
409 destFileName.AppendDir( srcDirs[i] );
410 }
411 else
412 {
413 destFileName.AppendDir( backupFolder );
414 }
415
416 tmp.Printf( _( "Backing up file '%s' to '%s'." ),
417 screen->GetFileName(),
418 destFileName.GetFullPath() );
419 aReporter.Report( tmp, RPT_SEVERITY_INFO );
420
421 if( !destFileName.DirExists() && !destFileName.Mkdir( wxS_DIR_DEFAULT, wxPATH_MKDIR_FULL ) )
422 {
423 tmp.Printf( _( "Failed to create backup folder '%s'.\n" ), destFileName.GetPath() );
424 errorMsg += tmp;
425 continue;
426 }
427
428 if( wxFileName::Exists( screen->GetFileName() )
429 && !wxCopyFile( screen->GetFileName(), destFileName.GetFullPath() ) )
430 {
431 tmp.Printf( _( "Failed to back up file '%s'.\n" ), screen->GetFileName() );
432 errorMsg += tmp;
433 }
434 }
435
436 // Back up the project file.
437 destFileName = Prj().GetProjectFullName();
438 destFileName.SetName( destFileName.GetName() + timeStamp );
439 destFileName.AppendDir( backupFolder );
440
441 tmp.Printf( _( "Backing up file '%s' to '%s'." ),
442 Prj().GetProjectFullName(),
443 destFileName.GetFullPath() );
444 aReporter.Report( tmp, RPT_SEVERITY_INFO );
445
446 if( wxFileName::Exists( Prj().GetProjectFullName() )
447 && !wxCopyFile( Prj().GetProjectFullName(), destFileName.GetFullPath() ) )
448 {
449 tmp.Printf( _( "Failed to back up file '%s'.\n" ), Prj().GetProjectFullName() );
450 errorMsg += tmp;
451 }
452
453 // Back up the cache library.
454 srcFileName.SetPath( Prj().GetProjectPath() );
455 srcFileName.SetName( Prj().GetProjectName() + wxS( "-cache" ) );
456 srcFileName.SetExt( FILEEXT::LegacySymbolLibFileExtension );
457
458 destFileName = srcFileName;
459 destFileName.SetName( destFileName.GetName() + timeStamp );
460 destFileName.AppendDir( backupFolder );
461
462 tmp.Printf( _( "Backing up file '%s' to '%s'." ),
463 srcFileName.GetFullPath(),
464 destFileName.GetFullPath() );
465 aReporter.Report( tmp, RPT_SEVERITY_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 if it exists.
475 srcFileName.SetName( Prj().GetProjectName() + wxS( "-rescue" ) );
476 destFileName.SetName( srcFileName.GetName() + timeStamp );
477
478 tmp.Printf( _( "Backing up file '%s' to '%s'." ),
479 srcFileName.GetFullPath(),
480 destFileName.GetFullPath() );
481 aReporter.Report( tmp, RPT_SEVERITY_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 // Back up the rescue symbol library document file if it exists.
491 srcFileName.SetExt( FILEEXT::LegacySymbolDocumentFileExtension );
492 destFileName.SetExt( srcFileName.GetExt() );
493
494 tmp.Printf( _( "Backing up file '%s' to '%s'." ),
495 srcFileName.GetFullPath(),
496 destFileName.GetFullPath() );
497 aReporter.Report( tmp, RPT_SEVERITY_INFO );
498
499 if( srcFileName.Exists()
500 && !wxCopyFile( srcFileName.GetFullPath(), destFileName.GetFullPath() ) )
501 {
502 tmp.Printf( _( "Failed to back up file '%s'.\n" ), srcFileName.GetFullPath() );
503 errorMsg += tmp;
504 }
505 }
506
507 if( !errorMsg.IsEmpty() )
508 {
509 wxMessageDialog dlg( this, _( "Some of the project files could not be backed up." ),
510 _( "Backup Error" ),
511 wxYES_NO | wxCENTRE | wxRESIZE_BORDER | wxICON_QUESTION );
512 errorMsg.Trim();
513 dlg.SetExtendedMessage( errorMsg );
514 dlg.SetYesNoLabels( wxMessageDialog::ButtonLabel( _( "Continue with Rescue" ) ),
515 wxMessageDialog::ButtonLabel( _( "Abort Rescue" ) ) );
516
517 if( dlg.ShowModal() == wxID_NO )
518 return false;
519 }
520
521 return true;
522}
523
524
525void DIALOG_SYMBOL_REMAP::OnUpdateUIRemapButton( wxUpdateUIEvent& aEvent )
526{
527 aEvent.Enable( !m_remapped );
528}
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
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:475
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:77
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:432
A logical library item identifier and consists of various portions much like a URI.
Definition: lib_id.h:49
int SetLibNickname(const UTF8 &aLibNickname)
Override the logical library name portion of the LIB_ID to aLibNickname.
Definition: lib_id.cpp:99
const UTF8 & GetLibItemName() const
Definition: lib_id.h:102
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:99
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.
const LIB_TABLE_ROW * FindRowByURI(const wxString &aURI)
static SYMBOL_LIB_TABLE * SchSymbolLibTable(PROJECT *aProject)
Accessor for project symbol library table.
static SYMBOL_LIBS * SchLibs(PROJECT *aProject)
Definition: project_sch.cpp:90
virtual const wxString GetProjectFullName() const
Return the full path and name of the project.
Definition: project.cpp:129
virtual const wxString GetProjectPath() const
Return the full path of the project.
Definition: project.cpp:135
virtual void SetElem(ELEM_T aIndex, _ELEM *aElem)
Definition: project.cpp:309
@ ELEM_SYMBOL_LIB_TABLE
Definition: project.h:228
@ ELEM_SCH_SYMBOL_LIBS
Definition: project.h:225
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:105
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 and update other data struc...
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:82
Container class that holds multiple SCH_SCREEN objects in a hierarchy.
Definition: sch_screen.h:704
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:109
Schematic symbol object.
Definition: sch_symbol.h:109
void SetLibId(const LIB_ID &aName)
Definition: sch_symbol.cpp:287
const LIB_ID & GetLibId() const
Definition: sch_symbol.h:203
A collection of SYMBOL_LIB objects.
static void SetLibNamesAndPaths(PROJECT *aProject, const wxString &aPaths, const wxArrayString &aNames)
Hold a record identifying a symbol library accessed by the appropriate symbol library SCH_IO object i...
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.
Object used to load, save, search, and otherwise manipulate symbol library files.
Symbol library viewer main window.
bool empty() const
Definition: utf8.h:103
wxString wx_str() const
Definition: utf8.cpp:45
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:332
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
static const std::string LegacySymbolLibFileExtension
static const std::string LegacySymbolDocumentFileExtension
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:100
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:119
Definition for symbol library class.
@ SCH_SYMBOL_T
Definition: typeinfo.h:156
Definition of file extensions used in Kicad.
#define FN_NORMALIZE_FLAGS
Default flags to pass to wxFileName::Normalize().
Definition: wx_filename.h:39