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
131
133
134 // Remove all of the libraries from the legacy library list.
135 wxString paths;
136 wxArrayString libNames;
137
138 LEGACY_SYMBOL_LIBS::SetLibNamesAndPaths( &Prj(), paths, libNames );
139
140 // Reload the cache symbol library.
143
144 Raise();
145 m_remapped = true;
146}
147
148
149size_t DIALOG_SYMBOL_REMAP::getLibsNotInGlobalSymbolLibTable( std::vector< LEGACY_SYMBOL_LIB* >& aLibs )
150{
152
154 {
155 // Ignore the cache library.
156 if( lib.IsCache() )
157 continue;
158
159 // Check for the obvious library name.
160 wxString libFileName = lib.GetFullFileName();
161
162 if( !mgr.FindRowByURI( LIBRARY_TABLE_TYPE::SYMBOL, libFileName ) )
163 aLibs.push_back( &lib );
164 }
165
166 return aLibs.size();
167}
168
169
171{
174
175 std::optional<LIBRARY_TABLE*> optTable = manager.Table( LIBRARY_TABLE_TYPE::SYMBOL, LIBRARY_TABLE_SCOPE::PROJECT );
176 wxCHECK( optTable, /* void */ );
177 LIBRARY_TABLE* projectTable = *optTable;
178
179 std::vector<LEGACY_SYMBOL_LIB*> libs;
180
182 {
183 wxBusyCursor busy;
184 std::vector<wxString> libNames = adapter->GetLibraryNames();
185
186 for( LEGACY_SYMBOL_LIB* lib : libs )
187 {
188 wxString libName = lib->GetName();
189 int libNameInc = 1;
190 int libNameLen = libName.Length();
191
192 // Spaces in the file name will break the symbol name because they are not
193 // quoted in the symbol library file format.
194 libName.Replace( wxS( " " ), wxS( "-" ) );
195
196 // Don't create duplicate table entries.
197 while( alg::contains( libNames, libName ) )
198 {
199 libName = libName.Left( libNameLen );
200 libName << libNameInc;
201 libNameInc++;
202 }
203
204 wxString type = SCH_IO_MGR::ShowType( SCH_IO_MGR::SCH_LEGACY );
205 wxFileName fn( lib->GetFullFileName() );
206
207 // Use environment variable substitution where possible. This is based solely
208 // on the internal user environment variable list. Checking against all of the
209 // system wide environment variables is probably not a good idea.
210 wxString normalizedPath = NormalizePath( fn, &Pgm().GetLocalEnvVariables(), &Prj() );
211 wxFileName normalizedFn( normalizedPath );
212
213 // Don't add symbol libraries that do not exist.
214 if( normalizedFn.Normalize(FN_NORMALIZE_FLAGS | wxPATH_NORM_ENV_VARS )
215 && normalizedFn.FileExists() )
216 {
217 aReporter.Report( wxString::Format( _( "Adding library '%s', file '%s' to project "
218 "symbol library table." ),
219 libName,
220 normalizedPath ),
222
223 LIBRARY_TABLE_ROW& newRow = projectTable->InsertRow();
224 newRow.SetNickname( libName );
225 newRow.SetURI( normalizedPath );
226 newRow.SetType( type );
227 }
228 else
229 {
230 aReporter.Report( wxString::Format( _( "Library '%s' not found." ), normalizedPath ),
232 }
233 }
234
235 // Don't save empty project symbol library table.
236 if( !projectTable->Rows().empty() )
237 {
238 projectTable->Save().map_error(
239 [&aReporter]( const LIBRARY_ERROR& aError )
240 {
241 aReporter.ReportTail( _( "Error saving library table:\n\n" ) + aError.message );
242 } );
243
244 // Trigger a reload of the table and cancel an in-progress background load
246
247 aReporter.ReportTail( _( "Created project symbol library table.\n" ), RPT_SEVERITY_INFO );
248 }
249 }
250}
251
252
254{
255 wxBusyCursor busy;
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 aReporter.Report( wxString::Format( _( "No symbol %s found in symbol library "
271 "table." ),
272 symbol->GetLibId().GetLibItemName().wx_str() ),
274 }
275 else
276 {
277 aReporter.Report( wxString::Format( _( "Symbol %s mapped to symbol library '%s'." ),
278 symbol->GetLibId().GetLibItemName().wx_str(),
279 symbol->GetLibId().GetLibNickname().wx_str() ),
281
282 screen->SetContentModified();
283 }
284 }
285 }
286
287 aReporter.Report( _( "Symbol library table mapping complete!" ), RPT_SEVERITY_INFO );
288 schematic.UpdateSymbolLinks();
289}
290
291
293{
294 wxCHECK_MSG( aSymbol != nullptr, false, "Null pointer passed to remapSymbolToLibTable." );
295 wxCHECK_MSG( aSymbol->GetLibId().GetLibNickname().empty(), false,
296 "Cannot remap symbol that is already mapped." );
297 wxCHECK_MSG( !aSymbol->GetLibId().GetLibItemName().empty(), false,
298 "The symbol LIB_ID name is empty." );
299
301 {
302 // Ignore the cache library.
303 if( lib.IsCache() )
304 continue;
305
306 LIB_SYMBOL* alias = lib.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 = lib.GetFullFileName();
315
316 if( std::optional<wxString> nickname =
317 PROJECT_SCH::SymbolLibAdapter( &Prj() )->FindLibraryByURI( libFileName ) )
318 {
319 LIB_ID id = aSymbol->GetLibId();
320
321 id.SetLibNickname( *nickname );
322
323 // Don't resolve symbol library links now.
324 aSymbol->SetLibId( id );
325 return true;
326 }
327 }
328 }
329
330 return false;
331}
332
333
335{
336 static wxString backupFolder = "rescue-backup";
337
338 wxString errorMsg;
339 wxFileName srcFileName;
340 wxFileName destFileName;
341 wxFileName backupPath;
342 SCH_SCREENS schematic( m_frame->Schematic().Root() );
343
344 // Copy backup files to different folder so as not to pollute the project folder.
345 destFileName.SetPath( Prj().GetProjectPath() );
346 destFileName.AppendDir( backupFolder );
347 backupPath = destFileName;
348
349 if( !destFileName.DirExists() )
350 {
351 if( !destFileName.Mkdir() )
352 {
353 errorMsg.Printf( _( "Cannot create project remap back up folder '%s'." ),
354 destFileName.GetPath() );
355
356 wxMessageDialog dlg( this, errorMsg, _( "Backup Error" ),
357 wxYES_NO | wxCENTRE | wxRESIZE_BORDER | wxICON_QUESTION );
358 dlg.SetYesNoLabels( wxMessageDialog::ButtonLabel( _( "Continue with Rescue" ) ),
359 wxMessageDialog::ButtonLabel( _( "Abort Rescue" ) ) );
360
361 if( dlg.ShowModal() == wxID_NO )
362 return false;
363 }
364 }
365
366 {
367 wxBusyCursor busy;
368
369 // Time stamp to append to file name in case multiple remappings are performed.
370 wxString timeStamp = wxDateTime::Now().Format( "-%Y-%m-%d-%H-%M-%S" );
371
372 // Back up symbol library table.
373 srcFileName.SetPath( Prj().GetProjectPath() );
374 srcFileName.SetName( FILEEXT::SymbolLibraryTableFileName );
375 destFileName = srcFileName;
376 destFileName.AppendDir( backupFolder );
377 destFileName.SetName( destFileName.GetName() + timeStamp );
378
379 aReporter.Report( wxString::Format( _( "Backing up file '%s' to '%s'." ),
380 srcFileName.GetFullPath(),
381 destFileName.GetFullPath() ),
383
384 if( wxFileName::Exists( srcFileName.GetFullPath() )
385 && !wxCopyFile( srcFileName.GetFullPath(), destFileName.GetFullPath() ) )
386 {
387 errorMsg += wxString::Format( _( "Failed to back up file '%s'.\n" ),
388 srcFileName.GetFullPath() );
389 }
390
391 // Back up the schematic files.
392 for( SCH_SCREEN* screen = schematic.GetFirst(); screen; screen = schematic.GetNext() )
393 {
394 destFileName = screen->GetFileName();
395 destFileName.SetName( destFileName.GetName() + timeStamp );
396
397 // Check for nest hierarchical schematic paths.
398 if( destFileName.GetPath() != backupPath.GetPath() )
399 {
400 destFileName.SetPath( backupPath.GetPath() );
401
402 wxArrayString srcDirs = wxFileName( screen->GetFileName() ).GetDirs();
403 wxArrayString destDirs = wxFileName( Prj().GetProjectPath() ).GetDirs();
404
405 for( size_t i = destDirs.GetCount(); i < srcDirs.GetCount(); i++ )
406 destFileName.AppendDir( srcDirs[i] );
407 }
408 else
409 {
410 destFileName.AppendDir( backupFolder );
411 }
412
413 aReporter.Report( wxString::Format( _( "Backing up file '%s' to '%s'." ),
414 screen->GetFileName(),
415 destFileName.GetFullPath() ),
417
418 if( !destFileName.DirExists()
419 && !destFileName.Mkdir( wxS_DIR_DEFAULT, wxPATH_MKDIR_FULL ) )
420 {
421 errorMsg += wxString::Format( _( "Failed to create backup folder '%s'.\n" ),
422 destFileName.GetPath() );
423 continue;
424 }
425
426 if( wxFileName::Exists( screen->GetFileName() )
427 && !wxCopyFile( screen->GetFileName(), destFileName.GetFullPath() ) )
428 {
429 errorMsg += wxString::Format( _( "Failed to back up file '%s'.\n" ),
430 screen->GetFileName() );
431 }
432 }
433
434 // Back up the project file.
435 destFileName = Prj().GetProjectFullName();
436 destFileName.SetName( destFileName.GetName() + timeStamp );
437 destFileName.AppendDir( backupFolder );
438
439 aReporter.Report( wxString::Format( _( "Backing up file '%s' to '%s'." ),
440 Prj().GetProjectFullName(),
441 destFileName.GetFullPath() ),
443
444 if( wxFileName::Exists( Prj().GetProjectFullName() )
445 && !wxCopyFile( Prj().GetProjectFullName(), destFileName.GetFullPath() ) )
446 {
447 errorMsg += wxString::Format( _( "Failed to back up file '%s'.\n" ),
448 Prj().GetProjectFullName() );
449 }
450
451 // Back up the cache library.
452 srcFileName.SetPath( Prj().GetProjectPath() );
453 srcFileName.SetName( Prj().GetProjectName() + wxS( "-cache" ) );
454 srcFileName.SetExt( FILEEXT::LegacySymbolLibFileExtension );
455
456 destFileName = srcFileName;
457 destFileName.SetName( destFileName.GetName() + timeStamp );
458 destFileName.AppendDir( backupFolder );
459
460 aReporter.Report( wxString::Format( _( "Backing up file '%s' to '%s'." ),
461 srcFileName.GetFullPath(),
462 destFileName.GetFullPath() ),
464
465 if( srcFileName.Exists()
466 && !wxCopyFile( srcFileName.GetFullPath(), destFileName.GetFullPath() ) )
467 {
468 errorMsg += wxString::Format( _( "Failed to back up file '%s'.\n" ),
469 srcFileName.GetFullPath() );
470 }
471
472 // Back up the old (2007) cache library.
473 srcFileName.SetPath( Prj().GetProjectPath() );
474 srcFileName.SetName( Prj().GetProjectName() + wxS( ".cache" ) );
475 srcFileName.SetExt( FILEEXT::LegacySymbolLibFileExtension );
476
477 destFileName = srcFileName;
478 destFileName.SetName( destFileName.GetName() + timeStamp );
479 destFileName.AppendDir( backupFolder );
480
481 aReporter.Report( wxString::Format( _( "Backing up file '%s' to '%s'." ),
482 srcFileName.GetFullPath(),
483 destFileName.GetFullPath() ),
485
486 if( srcFileName.Exists()
487 && !wxCopyFile( srcFileName.GetFullPath(), destFileName.GetFullPath() ) )
488 {
489 errorMsg += wxString::Format( _( "Failed to back up file '%s'.\n" ),
490 srcFileName.GetFullPath() );
491 }
492
493 // Back up the rescue symbol library if it exists.
494 srcFileName.SetName( Prj().GetProjectName() + wxS( "-rescue" ) );
495 destFileName.SetName( srcFileName.GetName() + timeStamp );
496
497 aReporter.Report( wxString::Format( _( "Backing up file '%s' to '%s'." ),
498 srcFileName.GetFullPath(),
499 destFileName.GetFullPath() ),
501
502 if( srcFileName.Exists()
503 && !wxCopyFile( srcFileName.GetFullPath(), destFileName.GetFullPath() ) )
504 {
505 errorMsg += wxString::Format( _( "Failed to back up file '%s'.\n" ),
506 srcFileName.GetFullPath() );
507 }
508
509 // Back up the rescue symbol library document file if it exists.
510 srcFileName.SetExt( FILEEXT::LegacySymbolDocumentFileExtension );
511 destFileName.SetExt( srcFileName.GetExt() );
512
513 aReporter.Report( wxString::Format( _( "Backing up file '%s' to '%s'." ),
514 srcFileName.GetFullPath(),
515 destFileName.GetFullPath() ),
517
518 if( srcFileName.Exists()
519 && !wxCopyFile( srcFileName.GetFullPath(), destFileName.GetFullPath() ) )
520 {
521 errorMsg += wxString::Format( _( "Failed to back up file '%s'.\n" ),
522 srcFileName.GetFullPath() );
523 }
524 }
525
526 if( !errorMsg.IsEmpty() )
527 {
528 wxMessageDialog dlg( this, _( "Some of the project files could not be backed up." ),
529 _( "Backup Error" ),
530 wxYES_NO | wxCENTRE | wxRESIZE_BORDER | wxICON_QUESTION );
531 errorMsg.Trim();
532 dlg.SetExtendedMessage( errorMsg );
533 dlg.SetYesNoLabels( wxMessageDialog::ButtonLabel( _( "Continue with Rescue" ) ),
534 wxMessageDialog::ButtonLabel( _( "Abort Rescue" ) ) );
535
536 if( dlg.ShowModal() == wxID_NO )
537 return false;
538 }
539
540 return true;
541}
542
543
544void DIALOG_SYMBOL_REMAP::OnUpdateUIRemapButton( wxUpdateUIEvent& aEvent )
545{
546 aEvent.Enable( !m_remapped );
547}
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:83
virtual LIBRARY_MANAGER & GetLibraryManager() const
Definition pgm_base.h:131
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:161
virtual void SetElem(PROJECT::ELEM aIndex, _ELEM *aElem)
Definition project.cpp:380
virtual const wxString GetProjectPath() const
Return the full path of the project.
Definition project.cpp:167
@ LEGACY_SYMBOL_LIBS
Definition project.h:72
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:109
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