KiCad PCB EDA Suite
Loading...
Searching...
No Matches
dialog_symbol_remap.cpp
Go to the documentation of this file.
1
4
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 The 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
37#include <core/kicad_algo.h>
38#include <symbol_viewer_frame.h>
39#include <project_rescue.h>
40#include <sch_io/sch_io_mgr.h>
41#include <sch_symbol.h>
42#include <sch_screen.h>
43#include <sch_edit_frame.h>
44#include <schematic.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 = wxString::Format( _( "Remapping is not possible because you have "
64 "insufficient 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
83 m_htmlCtrl->AppendToPage( text );
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
95 if( !backupProject( m_messagePanel->Reporter() ) )
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(), FILEEXT::SymbolLibraryTableFileName );
125
126 // Delete the existing project symbol library table.
127 if( prjSymLibTableFileName.FileExists() )
128 wxRemoveFile( prjSymLibTableFileName.GetFullPath() );
129
132 // TODO(JE) re-enable this
133 //PROJECT_SCH::SchSymbolLibTable( &Prj() );
134
136
137 // Remove all of the libraries from the legacy library list.
138 wxString paths;
139 wxArrayString libNames;
140
141 LEGACY_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< LEGACY_SYMBOL_LIB* >& aLibs )
153{
155
157 {
158 // Ignore the cache library.
159 if( lib.IsCache() )
160 continue;
161
162 // Check for the obvious library name.
163 wxString libFileName = lib.GetFullFileName();
164
165 if( !mgr.FindRowByURI( LIBRARY_TABLE_TYPE::SYMBOL, libFileName ) )
166 aLibs.push_back( &lib );
167 }
168
169 return aLibs.size();
170}
171
172
174{
176
177 std::optional<LIBRARY_TABLE*> optTable =
179 wxCHECK( optTable, /* void */ );
180 LIBRARY_TABLE* projectTable = *optTable;
181
182 std::vector<LEGACY_SYMBOL_LIB*> libs;
183
185 {
186 wxBusyCursor busy;
187 std::vector<wxString> libNames = adapter->GetLibraryNames();
188
189 for( LEGACY_SYMBOL_LIB* lib : libs )
190 {
191 wxString libName = lib->GetName();
192 int libNameInc = 1;
193 int libNameLen = libName.Length();
194
195 // Spaces in the file name will break the symbol name because they are not
196 // quoted in the symbol library file format.
197 libName.Replace( wxS( " " ), wxS( "-" ) );
198
199 // Don't create duplicate table entries.
200 while( alg::contains( libNames, libName ) )
201 {
202 libName = libName.Left( libNameLen );
203 libName << libNameInc;
204 libNameInc++;
205 }
206
207 wxString type = SCH_IO_MGR::ShowType( SCH_IO_MGR::SCH_LEGACY );
208 wxFileName fn( lib->GetFullFileName() );
209
210 // Use environment variable substitution where possible. This is based solely
211 // on the internal user environment variable list. Checking against all of the
212 // system wide environment variables is probably not a good idea.
213 wxString normalizedPath = NormalizePath( fn, &Pgm().GetLocalEnvVariables(), &Prj() );
214 wxFileName normalizedFn( normalizedPath );
215
216 // Don't add symbol libraries that do not exist.
217 if( normalizedFn.Normalize(FN_NORMALIZE_FLAGS | wxPATH_NORM_ENV_VARS )
218 && normalizedFn.FileExists() )
219 {
220 aReporter.Report( wxString::Format( _( "Adding library '%s', file '%s' to project "
221 "symbol library table." ),
222 libName,
223 normalizedPath ),
225
226 LIBRARY_TABLE_ROW& newRow = projectTable->InsertRow();
227 newRow.SetNickname( libName );
228 newRow.SetURI( normalizedPath );
229 newRow.SetType( type );
230 }
231 else
232 {
233 aReporter.Report( wxString::Format( _( "Library '%s' not found." ),
234 normalizedPath ),
236 }
237 }
238
239 // Don't save empty project symbol library table.
240 if( !projectTable->Rows().empty() )
241 {
242 projectTable->Save().map_error(
243 [&aReporter]( const LIBRARY_ERROR& aError )
244 {
245 aReporter.ReportTail( wxString::Format( _( "Error saving project-specific library table:\n\n%s" ),
246 aError.message ) );
247 } );
248
249 // Trigger a reload of the table and cancel an in-progress background load
251
252 aReporter.ReportTail( _( "Created project symbol library table.\n" ),
254 }
255 }
256}
257
258
260{
261 wxBusyCursor busy;
262 SCH_SCREENS schematic( m_frame->Schematic().Root() );
263 SCH_SYMBOL* symbol;
264 SCH_SCREEN* screen;
265
266 for( screen = schematic.GetFirst(); screen; screen = schematic.GetNext() )
267 {
268 for( EDA_ITEM* item : screen->Items().OfType( SCH_SYMBOL_T ) )
269 {
270 symbol = dynamic_cast<SCH_SYMBOL*>( item );
271
272 wxCHECK2( symbol, continue );
273
274 if( !remapSymbolToLibTable( symbol ) )
275 {
276 aReporter.Report( wxString::Format( _( "No symbol %s found in symbol library "
277 "table." ),
278 symbol->GetLibId().GetLibItemName().wx_str() ),
280 }
281 else
282 {
283 aReporter.Report( wxString::Format( _( "Symbol %s mapped to symbol library '%s'." ),
284 symbol->GetLibId().GetLibItemName().wx_str(),
285 symbol->GetLibId().GetLibNickname().wx_str() ),
287
288 screen->SetContentModified();
289 }
290 }
291 }
292
293 aReporter.Report( _( "Symbol library table mapping complete!" ), RPT_SEVERITY_INFO );
294 schematic.UpdateSymbolLinks();
295}
296
297
299{
300 wxCHECK_MSG( aSymbol != nullptr, false, "Null pointer passed to remapSymbolToLibTable." );
301 wxCHECK_MSG( aSymbol->GetLibId().GetLibNickname().empty(), false,
302 "Cannot remap symbol that is already mapped." );
303 wxCHECK_MSG( !aSymbol->GetLibId().GetLibItemName().empty(), false,
304 "The symbol LIB_ID name is empty." );
305
307 {
308 // Ignore the cache library.
309 if( lib.IsCache() )
310 continue;
311
312 LIB_SYMBOL* alias = lib.FindSymbol( aSymbol->GetLibId().GetLibItemName().wx_str() );
313
314 // Found in the same library as the old look up method assuming the user didn't
315 // change the libraries or library ordering since the last time the schematic was
316 // loaded.
317 if( alias )
318 {
319 // Find the same library in the symbol library table using the full path and file name.
320 wxString libFileName = lib.GetFullFileName();
321
322 if( std::optional<wxString> nickname =
323 PROJECT_SCH::SymbolLibAdapter( &Prj() )->FindLibraryByURI( libFileName ) )
324 {
325 LIB_ID id = aSymbol->GetLibId();
326
327 id.SetLibNickname( *nickname );
328
329 // Don't resolve symbol library links now.
330 aSymbol->SetLibId( id );
331 return true;
332 }
333 }
334 }
335
336 return false;
337}
338
339
341{
342 static wxString backupFolder = "rescue-backup";
343
344 wxString errorMsg;
345 wxFileName srcFileName;
346 wxFileName destFileName;
347 wxFileName backupPath;
348 SCH_SCREENS schematic( m_frame->Schematic().Root() );
349
350 // Copy backup files to different folder so as not to pollute the project folder.
351 destFileName.SetPath( Prj().GetProjectPath() );
352 destFileName.AppendDir( backupFolder );
353 backupPath = destFileName;
354
355 if( !destFileName.DirExists() )
356 {
357 if( !destFileName.Mkdir() )
358 {
359 errorMsg.Printf( _( "Cannot create project remap back up folder '%s'." ),
360 destFileName.GetPath() );
361
362 wxMessageDialog dlg( this, errorMsg, _( "Backup Error" ),
363 wxYES_NO | wxCENTRE | wxRESIZE_BORDER | wxICON_QUESTION );
364 dlg.SetYesNoLabels( wxMessageDialog::ButtonLabel( _( "Continue with Rescue" ) ),
365 wxMessageDialog::ButtonLabel( _( "Abort Rescue" ) ) );
366
367 if( dlg.ShowModal() == wxID_NO )
368 return false;
369 }
370 }
371
372 {
373 wxBusyCursor busy;
374
375 // Time stamp to append to file name in case multiple remappings are performed.
376 wxString timeStamp = wxDateTime::Now().Format( "-%Y-%m-%d-%H-%M-%S" );
377
378 // Back up symbol library table.
379 srcFileName.SetPath( Prj().GetProjectPath() );
380 srcFileName.SetName( FILEEXT::SymbolLibraryTableFileName );
381 destFileName = srcFileName;
382 destFileName.AppendDir( backupFolder );
383 destFileName.SetName( destFileName.GetName() + timeStamp );
384
385 aReporter.Report( wxString::Format( _( "Backing up file '%s' to '%s'." ),
386 srcFileName.GetFullPath(),
387 destFileName.GetFullPath() ),
389
390 if( wxFileName::Exists( srcFileName.GetFullPath() )
391 && !wxCopyFile( srcFileName.GetFullPath(), destFileName.GetFullPath() ) )
392 {
393 errorMsg += wxString::Format( _( "Failed to back up file '%s'.\n" ),
394 srcFileName.GetFullPath() );
395 }
396
397 // Back up the schematic files.
398 for( SCH_SCREEN* screen = schematic.GetFirst(); screen; screen = schematic.GetNext() )
399 {
400 destFileName = screen->GetFileName();
401 destFileName.SetName( destFileName.GetName() + timeStamp );
402
403 // Check for nest hierarchical schematic paths.
404 if( destFileName.GetPath() != backupPath.GetPath() )
405 {
406 destFileName.SetPath( backupPath.GetPath() );
407
408 wxArrayString srcDirs = wxFileName( screen->GetFileName() ).GetDirs();
409 wxArrayString destDirs = wxFileName( Prj().GetProjectPath() ).GetDirs();
410
411 for( size_t i = destDirs.GetCount(); i < srcDirs.GetCount(); i++ )
412 destFileName.AppendDir( srcDirs[i] );
413 }
414 else
415 {
416 destFileName.AppendDir( backupFolder );
417 }
418
419 aReporter.Report( wxString::Format( _( "Backing up file '%s' to '%s'." ),
420 screen->GetFileName(),
421 destFileName.GetFullPath() ),
423
424 if( !destFileName.DirExists()
425 && !destFileName.Mkdir( wxS_DIR_DEFAULT, wxPATH_MKDIR_FULL ) )
426 {
427 errorMsg += wxString::Format( _( "Failed to create backup folder '%s'.\n" ),
428 destFileName.GetPath() );
429 continue;
430 }
431
432 if( wxFileName::Exists( screen->GetFileName() )
433 && !wxCopyFile( screen->GetFileName(), destFileName.GetFullPath() ) )
434 {
435 errorMsg += wxString::Format( _( "Failed to back up file '%s'.\n" ),
436 screen->GetFileName() );
437 }
438 }
439
440 // Back up the project file.
441 destFileName = Prj().GetProjectFullName();
442 destFileName.SetName( destFileName.GetName() + timeStamp );
443 destFileName.AppendDir( backupFolder );
444
445 aReporter.Report( wxString::Format( _( "Backing up file '%s' to '%s'." ),
446 Prj().GetProjectFullName(),
447 destFileName.GetFullPath() ),
449
450 if( wxFileName::Exists( Prj().GetProjectFullName() )
451 && !wxCopyFile( Prj().GetProjectFullName(), destFileName.GetFullPath() ) )
452 {
453 errorMsg += wxString::Format( _( "Failed to back up file '%s'.\n" ),
454 Prj().GetProjectFullName() );
455 }
456
457 // Back up the cache library.
458 srcFileName.SetPath( Prj().GetProjectPath() );
459 srcFileName.SetName( Prj().GetProjectName() + wxS( "-cache" ) );
460 srcFileName.SetExt( FILEEXT::LegacySymbolLibFileExtension );
461
462 destFileName = srcFileName;
463 destFileName.SetName( destFileName.GetName() + timeStamp );
464 destFileName.AppendDir( backupFolder );
465
466 aReporter.Report( wxString::Format( _( "Backing up file '%s' to '%s'." ),
467 srcFileName.GetFullPath(),
468 destFileName.GetFullPath() ),
470
471 if( srcFileName.Exists()
472 && !wxCopyFile( srcFileName.GetFullPath(), destFileName.GetFullPath() ) )
473 {
474 errorMsg += wxString::Format( _( "Failed to back up file '%s'.\n" ),
475 srcFileName.GetFullPath() );
476 }
477
478 // Back up the old (2007) cache library.
479 srcFileName.SetPath( Prj().GetProjectPath() );
480 srcFileName.SetName( Prj().GetProjectName() + wxS( ".cache" ) );
481 srcFileName.SetExt( FILEEXT::LegacySymbolLibFileExtension );
482
483 destFileName = srcFileName;
484 destFileName.SetName( destFileName.GetName() + timeStamp );
485 destFileName.AppendDir( backupFolder );
486
487 aReporter.Report( wxString::Format( _( "Backing up file '%s' to '%s'." ),
488 srcFileName.GetFullPath(),
489 destFileName.GetFullPath() ),
491
492 if( srcFileName.Exists()
493 && !wxCopyFile( srcFileName.GetFullPath(), destFileName.GetFullPath() ) )
494 {
495 errorMsg += wxString::Format( _( "Failed to back up file '%s'.\n" ),
496 srcFileName.GetFullPath() );
497 }
498
499 // Back up the rescue symbol library if it exists.
500 srcFileName.SetName( Prj().GetProjectName() + wxS( "-rescue" ) );
501 destFileName.SetName( srcFileName.GetName() + timeStamp );
502
503 aReporter.Report( wxString::Format( _( "Backing up file '%s' to '%s'." ),
504 srcFileName.GetFullPath(),
505 destFileName.GetFullPath() ),
507
508 if( srcFileName.Exists()
509 && !wxCopyFile( srcFileName.GetFullPath(), destFileName.GetFullPath() ) )
510 {
511 errorMsg += wxString::Format( _( "Failed to back up file '%s'.\n" ),
512 srcFileName.GetFullPath() );
513 }
514
515 // Back up the rescue symbol library document file if it exists.
516 srcFileName.SetExt( FILEEXT::LegacySymbolDocumentFileExtension );
517 destFileName.SetExt( srcFileName.GetExt() );
518
519 aReporter.Report( wxString::Format( _( "Backing up file '%s' to '%s'." ),
520 srcFileName.GetFullPath(),
521 destFileName.GetFullPath() ),
523
524 if( srcFileName.Exists()
525 && !wxCopyFile( srcFileName.GetFullPath(), destFileName.GetFullPath() ) )
526 {
527 errorMsg += wxString::Format( _( "Failed to back up file '%s'.\n" ),
528 srcFileName.GetFullPath() );
529 }
530 }
531
532 if( !errorMsg.IsEmpty() )
533 {
534 wxMessageDialog dlg( this, _( "Some of the project files could not be backed up." ),
535 _( "Backup Error" ),
536 wxYES_NO | wxCENTRE | wxRESIZE_BORDER | wxICON_QUESTION );
537 errorMsg.Trim();
538 dlg.SetExtendedMessage( errorMsg );
539 dlg.SetYesNoLabels( wxMessageDialog::ButtonLabel( _( "Continue with Rescue" ) ),
540 wxMessageDialog::ButtonLabel( _( "Abort Rescue" ) ) );
541
542 if( dlg.ShowModal() == wxID_NO )
543 return false;
544 }
545
546 return true;
547}
548
549
550void DIALOG_SYMBOL_REMAP::OnUpdateUIRemapButton( wxUpdateUIEvent& aEvent )
551{
552 aEvent.Enable( !m_remapped );
553}
void SetContentModified(bool aModified=true)
Definition base_screen.h:59
DIALOG_SYMBOL_REMAP_BASE(wxWindow *parent, wxWindowID id=wxID_ANY, const wxString &title=_("Remap Symbols"), const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, long style=wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER)
WX_HTML_REPORT_PANEL * m_messagePanel
void OnUpdateUIRemapButton(wxUpdateUIEvent &aEvent) override
void remapSymbolsToLibTable(REPORTER &aReporter)
size_t getLibsNotInGlobalSymbolLibTable(std::vector< LEGACY_SYMBOL_LIB * > &aLibs)
Add libraries found in the legacy library list to aLibs that are not found in the global symbol libra...
SCH_EDIT_FRAME * m_frame
void createProjectSymbolLibTable(REPORTER &aReporter)
bool remapSymbolToLibTable(SCH_SYMBOL *aSymbol)
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:98
EE_TYPE OfType(KICAD_T aType) const
Definition sch_rtree.h:241
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.
virtual KIWAY_PLAYER * Player(FRAME_T aFrameType, bool doCreate=true, wxTopLevelWindow *aParent=nullptr)
Return the KIWAY_PLAYER* given a FRAME_T.
Definition kiway.cpp:403
static void SetLibNamesAndPaths(PROJECT *aProject, const wxString &aPaths, const wxArrayString &aNames)
Object used to load, save, search, and otherwise manipulate symbol library files.
std::vector< wxString > GetLibraryNames() const
Returns a list of library nicknames that are available (skips any that failed to load)
std::optional< LIBRARY_TABLE * > Table(LIBRARY_TABLE_TYPE aType, LIBRARY_TABLE_SCOPE aScope)
Retrieves a given table; creating a new empty project table if a valid project is loaded and the give...
std::optional< LIBRARY_TABLE_ROW * > FindRowByURI(LIBRARY_TABLE_TYPE aType, const wxString &aUri, LIBRARY_TABLE_SCOPE aScope=LIBRARY_TABLE_SCOPE::BOTH) const
void ProjectChanged()
Notify all adapters that the project has changed.
void SetNickname(const wxString &aNickname)
void SetType(const wxString &aType)
void SetURI(const wxString &aUri)
LIBRARY_RESULT< void > Save()
LIBRARY_TABLE_ROW & InsertRow()
Builds a new row and inserts it at the end of the table; returning a reference to the row.
const std::vector< LIBRARY_TABLE_ROW > & Rows() const
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:100
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:85
virtual LIBRARY_MANAGER & GetLibraryManager() const
Definition pgm_base.h:130
static SYMBOL_LIBRARY_ADAPTER * SymbolLibAdapter(PROJECT *aProject)
Accessor for project symbol library manager adapter.
static LEGACY_SYMBOL_LIBS * LegacySchLibs(PROJECT *aProject)
Returns the list of symbol libraries from a legacy (pre-5.x) design This is only used from the remapp...
virtual const wxString GetProjectFullName() const
Return the full path and name of the project.
Definition project.cpp:159
virtual void SetElem(PROJECT::ELEM aIndex, _ELEM *aElem)
Definition project.cpp:378
virtual const wxString GetProjectPath() const
Return the full path of the project.
Definition project.cpp:165
@ LEGACY_SYMBOL_LIBS
Definition project.h:75
@ SYMBOL_LIB_TABLE
Definition project.h:78
A pure virtual class used to derive REPORTER objects from.
Definition reporter.h:73
virtual REPORTER & Report(const wxString &aText, SEVERITY aSeverity=RPT_SEVERITY_UNDEFINED)
Report a string with a given severity.
Definition reporter.h:102
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:112
static bool RescueProject(wxWindow *aParent, RESCUER &aRescuer, bool aRunningOnDemand)
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.
Container class that holds multiple SCH_SCREEN objects in a hierarchy.
Definition sch_screen.h:728
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()
Get the full RTree, usually for iterating.
Definition sch_screen.h:117
Schematic symbol object.
Definition sch_symbol.h:76
void SetLibId(const LIB_ID &aName)
const LIB_ID & GetLibId() const override
Definition sch_symbol.h:165
An interface to the global shared library manager that is schematic-specific and linked to one projec...
Symbol library viewer main window.
bool empty() const
Definition utf8.h:110
wxString wx_str() const
Definition utf8.cpp:45
void DisplayInfoMessage(wxWindow *aParent, const wxString &aMessage, const wxString &aExtraInfo)
Display an informational message box with aMessage.
Definition confirm.cpp:230
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:73
Helper functions to substitute paths with environmental variables.
@ FRAME_SCH_VIEWER
Definition frame_type.h:36
static const std::string SymbolLibraryTableFileName
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:946
see class PGM_BASE
@ RPT_SEVERITY_WARNING
@ RPT_SEVERITY_INFO
@ RPT_SEVERITY_ACTION
wxString message
@ SCH_SYMBOL_T
Definition typeinfo.h:176
Definition of file extensions used in Kicad.
#define FN_NORMALIZE_FLAGS
Default flags to pass to wxFileName::Normalize().
Definition wx_filename.h:39