KiCad PCB EDA Suite
Loading...
Searching...
No Matches
eeschema.cpp
Go to the documentation of this file.
1/*
2 * This program source code file is part of KiCad, a free EDA CAD application.
3 *
4 * Copyright (C) 2004 Jean-Pierre Charras, [email protected]
5 * Copyright (C) 2008 Wayne Stambaugh <[email protected]>
6 * Copyright (C) 2004-2024 KiCad Developers, see change_log.txt for contributors.
7 *
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License
10 * as published by the Free Software Foundation; either version 2
11 * of the License, or (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, you may find one here:
20 * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
21 * or you may search the http://www.gnu.org website for the version 2 license,
22 * or you may write to the Free Software Foundation, Inc.,
23 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
24 */
25
26#include <pgm_base.h>
27#include <kiface_base.h>
29#include <confirm.h>
30#include <gestfich.h>
31#include <eda_dde.h>
33#include "eeschema_helpers.h"
34#include <eeschema_settings.h>
35#include <sch_edit_frame.h>
36#include <symbol_edit_frame.h>
37#include <symbol_viewer_frame.h>
39#include <symbol_lib_table.h>
44#include <kiway.h>
47#include <sexpr/sexpr.h>
48#include <sexpr/sexpr_parser.h>
49#include <kiface_ids.h>
51#include <wx/ffile.h>
53
54#include <schematic.h>
55#include <connection_graph.h>
65#include <sim/simulator_frame.h>
66
67#include <wx/crt.h>
68
69// The main sheet of the project
71
72
73namespace SCH {
74
75
76static std::unique_ptr<SCHEMATIC> readSchematicFromFile( const std::string& aFilename )
77{
78 auto pi = SCH_IO_MGR::FindPlugin( SCH_IO_MGR::SCH_KICAD );
79 std::unique_ptr<SCHEMATIC> schematic = std::make_unique<SCHEMATIC>( nullptr );
80
81 auto &manager = Pgm().GetSettingsManager();
82
83 manager.LoadProject( "" );
84 schematic->Reset();
85 schematic->SetProject( &manager.Prj() );
86 schematic->SetRoot( pi->LoadSchematicFile( aFilename, schematic.get() ) );
87 schematic->CurrentSheet().push_back( &schematic->Root() );
88
89 SCH_SCREENS screens( schematic->Root() );
90
91 for( SCH_SCREEN* screen = screens.GetFirst(); screen; screen = screens.GetNext() )
92 screen->UpdateLocalLibSymbolLinks();
93
94 SCH_SHEET_LIST sheets = schematic->GetSheets();
95
96 // Restore all of the loaded symbol instances from the root sheet screen.
97 sheets.UpdateSymbolInstanceData( schematic->RootScreen()->GetSymbolInstances() );
98
99 if( schematic->RootScreen()->GetFileFormatVersionAtLoad() < 20230221 )
100 for( SCH_SCREEN* screen = screens.GetFirst(); screen; screen = screens.GetNext() )
101 screen->FixLegacyPowerSymbolMismatches();
102
103 for( SCH_SCREEN* screen = screens.GetFirst(); screen; screen = screens.GetNext() )
104 screen->MigrateSimModels();
105
106 sheets.AnnotatePowerSymbols();
107
108 // NOTE: This is required for multi-unit symbols to be correct
109 for( SCH_SHEET_PATH& sheet : sheets )
110 sheet.UpdateAllScreenReferences();
111
112 // NOTE: SchematicCleanUp is not called; QA schematics must already be clean or else
113 // SchematicCleanUp must be freed from its UI dependencies.
114
115 schematic->ConnectionGraph()->Recalculate( sheets, true );
116
117 return schematic;
118}
119
120
121bool generateSchematicNetlist( const wxString& aFilename, std::string& aNetlist )
122{
123 std::unique_ptr<SCHEMATIC> schematic = readSchematicFromFile( aFilename.ToStdString() );
124 NETLIST_EXPORTER_KICAD exporter( schematic.get() );
125 STRING_FORMATTER formatter;
126
127 exporter.Format( &formatter, GNL_ALL | GNL_OPT_KICAD );
128 aNetlist = formatter.GetString();
129
130 return true;
131}
132
133
134static struct IFACE : public KIFACE_BASE, public UNITS_PROVIDER
135{
136 // Of course all are virtual overloads, implementations of the KIFACE.
137
138 IFACE( const char* aName, KIWAY::FACE_T aType ) :
139 KIFACE_BASE( aName, aType ),
141 {}
142
143 bool OnKifaceStart( PGM_BASE* aProgram, int aCtlBits, KIWAY* aKiway ) override;
144
145 void Reset() override;
146
147 void OnKifaceEnd() override;
148
149 wxWindow* CreateKiWindow( wxWindow* aParent, int aClassId, KIWAY* aKiway,
150 int aCtlBits = 0 ) override
151 {
152 switch( aClassId )
153 {
154 case FRAME_SCH:
155 {
156 SCH_EDIT_FRAME* frame = new SCH_EDIT_FRAME( aKiway, aParent );
157
159
160 if( Kiface().IsSingle() )
161 {
162 // only run this under single_top, not under a project manager.
164 }
165
166 return frame;
167 }
168
170 {
171 SYMBOL_EDIT_FRAME* frame = new SYMBOL_EDIT_FRAME( aKiway, aParent );
172 return frame;
173 }
174
175 case FRAME_SIMULATOR:
176 {
177 SIMULATOR_FRAME* frame = new SIMULATOR_FRAME( aKiway, aParent );
178 return frame;
179 }
181 case FRAME_SCH_VIEWER:
182 {
183 SYMBOL_VIEWER_FRAME* frame = new SYMBOL_VIEWER_FRAME( aKiway, aParent );
184 return frame;
185 }
186
188 {
189 SYMBOL_CHOOSER_FRAME* frame = new SYMBOL_CHOOSER_FRAME( aKiway, aParent );
190 return frame;
191 }
192
194 InvokeSchEditSymbolLibTable( aKiway, aParent );
195 // Dialog has completed; nothing to return.
196 return nullptr;
197
199 {
200 SETTINGS_MANAGER& mgr = Pgm().GetSettingsManager();
202
203 return new PANEL_SYM_DISPLAY_OPTIONS( aParent, cfg );
205
207 {
208 SETTINGS_MANAGER& mgr = Pgm().GetSettingsManager();
210 EDA_BASE_FRAME* frame = aKiway->Player( FRAME_SCH_SYMBOL_EDITOR, false );
211
212 if( !frame )
213 frame = aKiway->Player( FRAME_SCH_VIEWER, false );
214
215 if( !frame )
216 frame = aKiway->Player( FRAME_SCH, false );
217
218 if( frame )
219 SetUserUnits( frame->GetUserUnits() );
220
221 return new PANEL_GRID_SETTINGS( aParent, this, frame, cfg, FRAME_SCH_SYMBOL_EDITOR );
222 }
223
225 {
226 EDA_BASE_FRAME* frame = aKiway->Player( FRAME_SCH_SYMBOL_EDITOR, false );
227
228 if( !frame )
229 frame = aKiway->Player( FRAME_SCH_VIEWER, false );
230
231 if( !frame )
232 frame = aKiway->Player( FRAME_SCH, false );
233
234 if( frame )
235 SetUserUnits( frame->GetUserUnits() );
236
237 return new PANEL_SYM_EDITING_OPTIONS( aParent, this, frame );
238 }
239
240 case PANEL_SYM_COLORS:
241 return new PANEL_SYM_COLOR_SETTINGS( aParent );
242
244 {
245 SETTINGS_MANAGER& mgr = Pgm().GetSettingsManager();
247
248 return new PANEL_EESCHEMA_DISPLAY_OPTIONS( aParent, cfg );
249 }
250
251 case PANEL_SCH_GRIDS:
252 {
253 SETTINGS_MANAGER& mgr = Pgm().GetSettingsManager();
255 EDA_BASE_FRAME* frame = aKiway->Player( FRAME_SCH, false );
256
257 if( !frame )
258 frame = aKiway->Player( FRAME_SCH_SYMBOL_EDITOR, false );
259
260 if( !frame )
261 frame = aKiway->Player( FRAME_SCH_VIEWER, false );
262
263 if( frame )
264 SetUserUnits( frame->GetUserUnits() );
265
266 return new PANEL_GRID_SETTINGS( aParent, this, frame, cfg, FRAME_SCH );
267 }
268
270 {
271 EDA_BASE_FRAME* frame = aKiway->Player( FRAME_SCH, false );
272
273 if( !frame )
274 frame = aKiway->Player( FRAME_SCH_SYMBOL_EDITOR, false );
275
276 if( !frame )
277 frame = aKiway->Player( FRAME_SCH_VIEWER, false );
278
279 if( frame )
280 SetUserUnits( frame->GetUserUnits() );
281
282 return new PANEL_EESCHEMA_EDITING_OPTIONS( aParent, this, frame );
283 }
284
286 {
287 EDA_BASE_FRAME* schSettingsProvider = aKiway->Player( FRAME_SCH, false );
288
289 return new PANEL_EESCHEMA_ANNOTATION_OPTIONS( aParent, schSettingsProvider );
290 }
291
292 case PANEL_SCH_COLORS:
293 return new PANEL_EESCHEMA_COLOR_SETTINGS( aParent );
294
296 return new PANEL_TEMPLATE_FIELDNAMES( aParent, nullptr );
297
299 return new PANEL_SIMULATOR_PREFERENCES( aParent );
300
301 default:
302 return nullptr;
303 }
304 }
305
316 void* IfaceOrAddress( int aDataId ) override
317 {
318 switch( aDataId )
319 {
321 return (void*) generateSchematicNetlist;
322 }
323
324 return nullptr;
325 }
326
332 void SaveFileAs( const wxString& aProjectBasePath, const wxString& aProjectName,
333 const wxString& aNewProjectBasePath, const wxString& aNewProjectName,
334 const wxString& aSrcFilePath, wxString& aErrors ) override;
335
336
337 int HandleJob( JOB* aJob ) override;
338
339private:
340 bool loadGlobalLibTable();
341
342 std::unique_ptr<EESCHEMA_JOBS_HANDLER> m_jobHandler;
343
344} kiface( "eeschema", KIWAY::FACE_SCH );
345
346} // namespace
347
348using namespace SCH;
349
351
352
354
355
356// KIFACE_GETTER's actual spelling is a substitution macro found in kiway.h.
357// KIFACE_GETTER will not have name mangling due to declaration in kiway.h.
358KIFACE_API KIFACE* KIFACE_GETTER( int* aKIFACEversion, int aKiwayVersion, PGM_BASE* aProgram )
359{
360 process = aProgram;
361 return &kiface;
362}
363
364
366{
367 wxASSERT( process ); // KIFACE_GETTER has already been called.
368 return *process;
369}
370
371
372// Similar to PGM_BASE& Pgm(), but return nullptr when a *.ki_face is run from
373// a python script or something else.
375{
376 return process;
377}
378
379
380bool IFACE::OnKifaceStart( PGM_BASE* aProgram, int aCtlBits, KIWAY* aKiway )
381{
382 // This is process-level-initialization, not project-level-initialization of the DSO.
383 // Do nothing in here pertinent to a project!
385
386 // Register the symbol editor settings as well because they share a KiFACE and need to be
387 // loaded prior to use to avoid threading deadlocks
389 aProgram->GetSettingsManager().RegisterSettings( symSettings ); // manager takes ownership
390
391 // We intentionally register KifaceSettings after SYMBOL_EDITOR_SETTINGS
392 // In legacy configs, many settings were in a single editor config nd the migration routine
393 // for the main editor file will try and call into the now separate settings stores
394 // to move the settings into them
396
397 start_common( aCtlBits );
398
399 if( !loadGlobalLibTable() )
400 {
401 // we didnt get anywhere deregister the settings
402 aProgram->GetSettingsManager().FlushAndRelease( symSettings, false );
403 aProgram->GetSettingsManager().FlushAndRelease( KifaceSettings(), false );
404 return false;
405 }
406
407 m_jobHandler = std::make_unique<EESCHEMA_JOBS_HANDLER>( aKiway );
408
410 {
411 m_jobHandler->SetReporter( &CLI_REPORTER::GetInstance() );
412 m_jobHandler->SetProgressReporter( &CLI_PROGRESS_REPORTER::GetInstance() );
413 }
414
415 return true;
416}
417
418
420{
422}
423
424
426{
428
429 if( !fn.FileExists() )
430 {
431 if( !( m_start_flags & KFCTL_CLI ) )
432 {
433 // Ensure the splash screen does not hide the dialog:
434 Pgm().HideSplash();
435
436 DIALOG_GLOBAL_SYM_LIB_TABLE_CONFIG symDialog( nullptr );
437
438 if( symDialog.ShowModal() != wxID_OK )
439 return false;
440 }
441 }
442 else
443 {
444 try
445 {
446 // The global table is not related to a specific project. All projects
447 // will use the same global table. So the KIFACE::OnKifaceStart() contract
448 // of avoiding anything project specific is not violated here.
450 return false;
451 }
452 catch( const IO_ERROR& ioe )
453 {
454 // if we are here, a incorrect global symbol library table was found.
455 // Incorrect global symbol library table is not a fatal error:
456 // the user just has to edit the (partially) loaded table.
457 wxString msg =
458 _( "An error occurred attempting to load the global symbol library table.\n"
459 "Please edit this global symbol library table in Preferences menu." );
460
461 DisplayErrorMessage( nullptr, msg, ioe.What() );
462 }
463 }
464
465 return true;
466}
467
468
470{
471 end_common();
472}
473
474
475static void traverseSEXPR( SEXPR::SEXPR* aNode,
476 const std::function<void( SEXPR::SEXPR* )>& aVisitor )
477{
478 aVisitor( aNode );
479
480 if( aNode->IsList() )
481 {
482 for( unsigned i = 0; i < aNode->GetNumberOfChildren(); i++ )
483 traverseSEXPR( aNode->GetChild( i ), aVisitor );
484 }
485}
486
487
488void IFACE::SaveFileAs( const wxString& aProjectBasePath, const wxString& aProjectName,
489 const wxString& aNewProjectBasePath, const wxString& aNewProjectName,
490 const wxString& aSrcFilePath, wxString& aErrors )
491{
492 wxFileName destFile( aSrcFilePath );
493 wxString destPath = destFile.GetPathWithSep();
494 wxUniChar pathSep = wxFileName::GetPathSeparator();
495 wxString ext = destFile.GetExt();
496
497 if( destPath.StartsWith( aProjectBasePath + pathSep ) )
498 destPath.Replace( aProjectBasePath, aNewProjectBasePath, false );
499
500 destFile.SetPath( destPath );
501
506 {
507 if( destFile.GetName() == aProjectName )
508 {
509 destFile.SetName( aNewProjectName );
510 }
511 else if( destFile.GetName() == aNewProjectName )
512 {
513 wxString msg;
514
515 if( !aErrors.empty() )
516 aErrors += wxS( "\n" );
517
518 msg.Printf( _( "Cannot copy file '%s' as it will be overwritten by the new root "
519 "sheet file." ), destFile.GetFullPath() );
520 aErrors += msg;
521 return;
522 }
523
524 // Sheet paths when auto-generated are relative to the root, so those will stay
525 // pointing to whatever they were pointing at.
526 // The author can create their own absolute and relative sheet paths. Absolute
527 // sheet paths aren't an issue, and relative ones will continue to work as long
528 // as the author didn't include any '..'s. If they did, it's still not clear
529 // whether they should be adjusted or not (as the author may be duplicating an
530 // entire tree with several projects within it), so we leave this as an exercise
531 // to the author.
532
533 KiCopyFile( aSrcFilePath, destFile.GetFullPath(), aErrors );
534 }
536 {
537 // Symbols are not project-specific. Keep their source names.
538 KiCopyFile( aSrcFilePath, destFile.GetFullPath(), aErrors );
539 }
543 {
544 if( destFile.GetName() == aProjectName + wxS( "-cache" ) )
545 destFile.SetName( aNewProjectName + wxS( "-cache" ) );
546
547 if( destFile.GetName() == aProjectName + wxS( "-rescue" ) )
548 destFile.SetName( aNewProjectName + wxS( "-rescue" ) );
549
550 KiCopyFile( aSrcFilePath, destFile.GetFullPath(), aErrors );
551 }
552 else if( ext == FILEEXT::NetlistFileExtension )
553 {
554 bool success = false;
555
556 if( destFile.GetName() == aProjectName )
557 destFile.SetName( aNewProjectName );
558
559 try
560 {
561 SEXPR::PARSER parser;
562 std::unique_ptr<SEXPR::SEXPR> sexpr( parser.ParseFromFile( TO_UTF8( aSrcFilePath ) ) );
563
564 traverseSEXPR( sexpr.get(), [&]( SEXPR::SEXPR* node )
565 {
566 if( node->IsList() && node->GetNumberOfChildren() > 1
567 && node->GetChild( 0 )->IsSymbol()
568 && node->GetChild( 0 )->GetSymbol() == "source" )
569 {
570 auto pathNode = dynamic_cast<SEXPR::SEXPR_STRING*>( node->GetChild( 1 ) );
571 auto symNode = dynamic_cast<SEXPR::SEXPR_SYMBOL*>( node->GetChild( 1 ) );
572 wxString path;
573
574 if( pathNode )
575 path = pathNode->m_value;
576 else if( symNode )
577 path = symNode->m_value;
578
579 if( path == aProjectName + wxS( ".sch" ) )
580 path = aNewProjectName + wxS( ".sch" );
581 else if( path == aProjectBasePath + "/" + aProjectName + wxS( ".sch" ) )
582 path = aNewProjectBasePath + "/" + aNewProjectName + wxS( ".sch" );
583 else if( path.StartsWith( aProjectBasePath ) )
584 path.Replace( aProjectBasePath, aNewProjectBasePath, false );
585
586 if( pathNode )
587 pathNode->m_value = path;
588 else if( symNode )
589 symNode->m_value = path;
590 }
591 } );
592
593 wxFFile destNetList( destFile.GetFullPath(), "wb" );
594
595 if( destNetList.IsOpened() )
596 success = destNetList.Write( sexpr->AsString( 0 ) );
597
598 // wxFFile dtor will close the file
599 }
600 catch( ... )
601 {
602 success = false;
603 }
604
605 if( !success )
606 {
607 wxString msg;
608
609 if( !aErrors.empty() )
610 aErrors += wxS( "\n" );
611
612 msg.Printf( _( "Cannot copy file '%s'." ), destFile.GetFullPath() );
613 aErrors += msg;
614 }
615 }
616 else if( destFile.GetName() == wxS( "sym-lib-table" ) )
617 {
618 SYMBOL_LIB_TABLE symbolLibTable;
619 symbolLibTable.Load( aSrcFilePath );
620
621 for( unsigned i = 0; i < symbolLibTable.GetCount(); i++ )
622 {
623 LIB_TABLE_ROW& row = symbolLibTable.At( i );
624 wxString uri = row.GetFullURI();
625
626 uri.Replace( wxS( "/" ) + aProjectName + wxS( "-cache.lib" ),
627 wxS( "/" ) + aNewProjectName + wxS( "-cache.lib" ) );
628 uri.Replace( wxS( "/" ) + aProjectName + wxS( "-rescue.lib" ),
629 wxS( "/" ) + aNewProjectName + wxS( "-rescue.lib" ) );
630 uri.Replace( wxS( "/" ) + aProjectName + wxS( ".lib" ),
631 wxS( "/" ) + aNewProjectName + wxS( ".lib" ) );
632
633 row.SetFullURI( uri );
634 }
635
636 try
637 {
638 symbolLibTable.Save( destFile.GetFullPath() );
639 }
640 catch( ... )
641 {
642 wxString msg;
643
644 if( !aErrors.empty() )
645 aErrors += "\n";
646
647 msg.Printf( _( "Cannot copy file '%s'." ), destFile.GetFullPath() );
648 aErrors += msg;
649 }
650 }
651 else
652 {
653 wxFAIL_MSG( wxS( "Unexpected filetype for Eeschema::SaveFileAs()" ) );
654 }
655}
656
657
659{
660 return m_jobHandler->RunJob( aJob );
661}
constexpr EDA_IU_SCALE schIUScale
Definition: base_units.h:111
KIFACE_BASE & Kiface()
Global KIFACE_BASE "get" accessor.
APP_SETTINGS_BASE is a settings class that should be derived for each standalone KiCad application.
Definition: app_settings.h:92
static PROGRESS_REPORTER & GetInstance()
static REPORTER & GetInstance()
Definition: reporter.cpp:146
The base frame for deriving all KiCad main window classes.
static void SetSchEditFrame(SCH_EDIT_FRAME *aSchEditFrame)
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
An simple container class that lets us dispatch output jobs to kifaces.
Definition: job.h:32
A KIFACE implementation.
Definition: kiface_base.h:39
void InitSettings(APP_SETTINGS_BASE *aSettings)
Definition: kiface_base.h:97
void end_common()
Common things to do for a top program module, during OnKifaceEnd();.
Definition: kiface_base.cpp:42
APP_SETTINGS_BASE * KifaceSettings() const
Definition: kiface_base.h:95
bool start_common(int aCtlBits)
Common things to do for a top program module, during OnKifaceStart().
Definition: kiface_base.cpp:32
int m_start_flags
flags provided in OnKifaceStart()
Definition: kiface_base.h:125
bool IsSingle() const
Is this KIFACE running under single_top?
Definition: kiface_base.h:107
void CreateServer(int service, bool local=true)
Definition: eda_dde.cpp:43
A minimalistic software bus for communications between various DLLs/DSOs (DSOs) within the same KiCad...
Definition: kiway.h:279
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
FACE_T
Known KIFACE implementations.
Definition: kiway.h:285
@ FACE_SCH
eeschema DSO
Definition: kiway.h:286
Hold a record identifying a library accessed by the appropriate plug in object in the LIB_TABLE.
void SetFullURI(const wxString &aFullURI)
Change the full URI for the library.
const wxString GetFullURI(bool aSubstituted=false) const
Return the full location specifying URI for the LIB, either in original UI form or in environment var...
LIB_TABLE_ROW & At(unsigned aIndex)
Get the 'n'th LIB_TABLE_ROW object.
void Load(const wxString &aFileName)
Load the library table using the path defined by aFileName aFallBackTable.
unsigned GetCount() const
Get the number of rows contained in the table.
void Save(const wxString &aFileName) const
Write this library table to aFileName in s-expression form.
Generate the KiCad netlist format supported by Pcbnew.
void Format(OUTPUTFORMATTER *aOutputFormatter, int aCtl)
Output this s-expression netlist into aOutputFormatter.
Container for data for KiCad programs.
Definition: pgm_base.h:96
virtual SETTINGS_MANAGER & GetSettingsManager() const
Definition: pgm_base.h:136
Schematic editor (Eeschema) main window.
Container class that holds multiple SCH_SCREEN objects in a hierarchy.
Definition: sch_screen.h:704
SCH_SCREEN * GetNext()
SCH_SCREEN * GetFirst()
A container for handling SCH_SHEET_PATH objects in a flattened hierarchy.
void AnnotatePowerSymbols()
Silently annotate the not yet annotated power symbols of the entire hierarchy of the sheet path list.
void UpdateSymbolInstanceData(const std::vector< SCH_SYMBOL_INSTANCE > &aSymbolInstances)
Update all of the symbol instance information using aSymbolInstances.
Handle access to a stack of flattened SCH_SHEET objects by way of a path for creating a flattened sch...
Sheet symbol placed in a schematic, and is the entry point for a sub schematic.
Definition: sch_sheet.h:57
T * GetAppSettings()
Returns a handle to the a given settings by type If the settings have already been loaded,...
T * RegisterSettings(T *aSettings, bool aLoadNow=true)
Takes ownership of the pointer passed in.
void FlushAndRelease(JSON_SETTINGS *aSettings, bool aSave=true)
If the given settings object is registered, save it to disk and unregister it.
std::unique_ptr< SEXPR > ParseFromFile(const std::string &aFilename)
size_t GetNumberOfChildren() const
Definition: sexpr.cpp:70
bool IsList() const
Definition: sexpr.h:49
SEXPR * GetChild(size_t aIndex) const
Definition: sexpr.cpp:48
The SIMULATOR_FRAME holds the main user-interface for running simulations.
Implement an OUTPUTFORMATTER to a memory buffer.
Definition: richio.h:433
const std::string & GetString()
Definition: richio.h:456
Symbol library viewer main window.
The symbol library editor main window.
static SYMBOL_LIB_TABLE & GetGlobalLibTable()
static wxString GetGlobalTableFileName()
Fetch the global symbol library table file name.
static bool LoadGlobalTable(SYMBOL_LIB_TABLE &aTable)
Load the global symbol library table into aTable.
Symbol library viewer main window.
EDA_UNITS GetUserUnits() const
void SetUserUnits(EDA_UNITS aUnits)
void DisplayErrorMessage(wxWindow *aParent, const wxString &aText, const wxString &aExtraInfo)
Display an error message with aMessage.
Definition: confirm.cpp:305
This file is part of the common library.
#define _(s)
DDE server & client.
#define KICAD_SCH_PORT_SERVICE_NUMBER
Scripting window listens for commands for other apps.
Definition: eda_dde.h:43
EDA_UNITS
Definition: eda_units.h:46
static PGM_BASE * process
Definition: eeschema.cpp:350
SCH_SHEET * g_RootSheet
Definition: eeschema.cpp:70
PGM_BASE & Pgm()
The global Program "get" accessor.
Definition: eeschema.cpp:365
KIFACE_BASE & Kiface()
Global KIFACE_BASE "get" accessor.
Definition: eeschema.cpp:353
static void traverseSEXPR(SEXPR::SEXPR *aNode, const std::function< void(SEXPR::SEXPR *)> &aVisitor)
Definition: eeschema.cpp:475
PGM_BASE * PgmOrNull()
similar to PGM_BASE& Pgm(), but return a reference that can be nullptr when running a shared lib from...
Definition: eeschema.cpp:374
@ PANEL_SYM_EDIT_GRIDS
Definition: frame_type.h:73
@ FRAME_SCH_SYMBOL_EDITOR
Definition: frame_type.h:35
@ PANEL_SCH_FIELD_NAME_TEMPLATES
Definition: frame_type.h:82
@ FRAME_SCH_VIEWER
Definition: frame_type.h:36
@ PANEL_SCH_DISP_OPTIONS
Definition: frame_type.h:77
@ PANEL_SCH_SIMULATOR
Definition: frame_type.h:83
@ FRAME_SCH
Definition: frame_type.h:34
@ FRAME_SIMULATOR
Definition: frame_type.h:38
@ PANEL_SYM_EDIT_OPTIONS
Definition: frame_type.h:74
@ PANEL_SCH_EDIT_OPTIONS
Definition: frame_type.h:79
@ PANEL_SYM_DISP_OPTIONS
Definition: frame_type.h:72
@ DIALOG_SCH_LIBRARY_TABLE
Definition: frame_type.h:115
@ PANEL_SYM_COLORS
Definition: frame_type.h:75
@ PANEL_SCH_ANNO_OPTIONS
Definition: frame_type.h:80
@ PANEL_SCH_GRIDS
Definition: frame_type.h:78
@ PANEL_SCH_COLORS
Definition: frame_type.h:81
@ FRAME_SYMBOL_CHOOSER
Definition: frame_type.h:37
void KiCopyFile(const wxString &aSrcPath, const wxString &aDestPath, wxString &aErrors)
Definition: gestfich.cpp:305
static const std::string LegacySchematicFileExtension
static const std::string NetlistFileExtension
static const std::string SchematicSymbolFileExtension
static const std::string KiCadSchematicFileExtension
static const std::string LegacySymbolLibFileExtension
static const std::string KiCadSymbolLibFileExtension
static const std::string BackupFileSuffix
static const std::string LegacySymbolDocumentFileExtension
#define KIFACE_API
Definition: import_export.h:51
@ KIFACE_NETLIST_SCHEMATIC
Definition: kiface_ids.h:56
#define KFCTL_CLI
Running as CLI app.
Definition: kiway.h:160
#define KIFACE_GETTER
Definition: kiway.h:111
Definition: eeschema.cpp:73
static std::unique_ptr< SCHEMATIC > readSchematicFromFile(const std::string &aFilename)
Definition: eeschema.cpp:76
SCH::IFACE KIFACE_BASE, UNITS_PROVIDER kiface("eeschema", KIWAY::FACE_SCH)
bool generateSchematicNetlist(const wxString &aFilename, std::string &aNetlist)
Definition: eeschema.cpp:121
#define GNL_ALL
@ GNL_OPT_KICAD
void InvokeSchEditSymbolLibTable(KIWAY *aKiway, wxWindow *aParent)
see class PGM_BASE
KIWAY Kiway & Pgm(), KFCTL_STANDALONE
The global Program "get" accessor.
Definition: single_top.cpp:119
#define TO_UTF8(wxstring)
Convert a wxString to a UTF8 encoded C string for all wxWidgets build modes.
Definition: string_utils.h:391
bool OnKifaceStart(PGM_BASE *aProgram, int aCtlBits, KIWAY *aKiway) override
Typically start_common() is called from here.
Implement a participant in the KIWAY alchemy.
Definition: kiway.h:151
bool OnKifaceStart(PGM_BASE *aProgram, int aCtlBits, KIWAY *aKiway) override
Typically start_common() is called from here.
Definition: eeschema.cpp:380
void SaveFileAs(const wxString &aProjectBasePath, const wxString &aProjectName, const wxString &aNewProjectBasePath, const wxString &aNewProjectName, const wxString &aSrcFilePath, wxString &aErrors) override
Saving a file under a different name is delegated to the various KIFACEs because the project doesn't ...
Definition: eeschema.cpp:488
wxWindow * CreateKiWindow(wxWindow *aParent, int aClassId, KIWAY *aKiway, int aCtlBits=0) override
Create a wxWindow for the current project.
Definition: eeschema.cpp:149
IFACE(const char *aName, KIWAY::FACE_T aType)
Definition: eeschema.cpp:138
void Reset() override
Reloads global state.
Definition: eeschema.cpp:419
void * IfaceOrAddress(int aDataId) override
Return a pointer to the requested object.
Definition: eeschema.cpp:316
std::unique_ptr< EESCHEMA_JOBS_HANDLER > m_jobHandler
Definition: eeschema.cpp:342
bool loadGlobalLibTable()
Definition: eeschema.cpp:425
void OnKifaceEnd() override
Called just once just before the DSO is to be unloaded.
Definition: eeschema.cpp:469
int HandleJob(JOB *aJob) override
Definition: eeschema.cpp:658
Definition of file extensions used in Kicad.