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