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-2023 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>
38#include <transform.h>
39#include <symbol_lib_table.h>
43#include <kiway.h>
46#include <sexpr/sexpr.h>
47#include <sexpr/sexpr_parser.h>
48#include <kiface_ids.h>
50#include <wx/ffile.h>
52
53#include <schematic.h>
54#include <connection_graph.h>
64#include <sim/simulator_frame.h>
65
66#include <wx/crt.h>
67
68// The main sheet of the project
70
71
72namespace SCH {
73
74
75static std::unique_ptr<SCHEMATIC> readSchematicFromFile( const std::string& aFilename )
76{
77 auto pi = SCH_IO_MGR::FindPlugin( SCH_IO_MGR::SCH_KICAD );
78 std::unique_ptr<SCHEMATIC> schematic = std::make_unique<SCHEMATIC>( nullptr );
79
80 auto &manager = Pgm().GetSettingsManager();
81
82 manager.LoadProject( "" );
83 schematic->Reset();
84 schematic->SetProject( &manager.Prj() );
85 schematic->SetRoot( pi->LoadSchematicFile( aFilename, schematic.get() ) );
86 schematic->CurrentSheet().push_back( &schematic->Root() );
87
88 SCH_SCREENS screens( schematic->Root() );
89
90 for( SCH_SCREEN* screen = screens.GetFirst(); screen; screen = screens.GetNext() )
91 screen->UpdateLocalLibSymbolLinks();
92
93 SCH_SHEET_LIST sheets = schematic->GetSheets();
94
95 // Restore all of the loaded symbol instances from the root sheet screen.
96 sheets.UpdateSymbolInstanceData( schematic->RootScreen()->GetSymbolInstances() );
97
98 if( schematic->RootScreen()->GetFileFormatVersionAtLoad() < 20230221 )
99 for( SCH_SCREEN* screen = screens.GetFirst(); screen; screen = screens.GetNext() )
100 screen->FixLegacyPowerSymbolMismatches();
101
102 for( SCH_SCREEN* screen = screens.GetFirst(); screen; screen = screens.GetNext() )
103 screen->MigrateSimModels();
104
105 sheets.AnnotatePowerSymbols();
106
107 // NOTE: This is required for multi-unit symbols to be correct
108 for( SCH_SHEET_PATH& sheet : sheets )
109 sheet.UpdateAllScreenReferences();
110
111 // NOTE: SchematicCleanUp is not called; QA schematics must already be clean or else
112 // SchematicCleanUp must be freed from its UI dependencies.
113
114 schematic->ConnectionGraph()->Recalculate( sheets, true );
115
116 return schematic;
117}
118
119
120bool generateSchematicNetlist( const wxString& aFilename, wxString& aNetlist )
121{
122 std::unique_ptr<SCHEMATIC> schematic = readSchematicFromFile( aFilename.ToStdString() );
123 NETLIST_EXPORTER_KICAD exporter( schematic.get() );
124 STRING_FORMATTER formatter;
125
126 exporter.Format( &formatter, GNL_ALL | GNL_OPT_KICAD );
127 aNetlist = formatter.GetString();
128
129 return true;
130}
131
132
133static struct IFACE : public KIFACE_BASE, public UNITS_PROVIDER
134{
135 // Of course all are virtual overloads, implementations of the KIFACE.
136
137 IFACE( const char* aName, KIWAY::FACE_T aType ) :
138 KIFACE_BASE( aName, aType ),
140 {}
141
142 bool OnKifaceStart( PGM_BASE* aProgram, int aCtlBits ) override;
143
144 void Reset() override;
145
146 void OnKifaceEnd() override;
147
148 wxWindow* CreateKiWindow( wxWindow* aParent, int aClassId, KIWAY* aKiway,
149 int aCtlBits = 0 ) override
150 {
151 switch( aClassId )
152 {
153 case FRAME_SCH:
154 {
155 SCH_EDIT_FRAME* frame = new SCH_EDIT_FRAME( aKiway, aParent );
156
158
159 if( Kiface().IsSingle() )
160 {
161 // only run this under single_top, not under a project manager.
163 }
164
165 return frame;
166 }
167
169 {
170 SYMBOL_EDIT_FRAME* frame = new SYMBOL_EDIT_FRAME( aKiway, aParent );
171 return frame;
172 }
174 case FRAME_SIMULATOR:
175 {
176 SIMULATOR_FRAME* frame = new SIMULATOR_FRAME( aKiway, aParent );
177 return frame;
178 }
179
180 case FRAME_SCH_VIEWER:
182 {
183 SYMBOL_VIEWER_FRAME* frame = new SYMBOL_VIEWER_FRAME( aKiway, aParent,
184 FRAME_T( aClassId ) );
185 return frame;
186 }
187
189 InvokeSchEditSymbolLibTable( aKiway, aParent );
190 // Dialog has completed; nothing to return.
191 return nullptr;
192
195 SETTINGS_MANAGER& mgr = Pgm().GetSettingsManager();
198 return new PANEL_SYM_DISPLAY_OPTIONS( aParent, cfg );
200
202 {
203 SETTINGS_MANAGER& mgr = Pgm().GetSettingsManager();
205 EDA_BASE_FRAME* frame = aKiway->Player( FRAME_SCH_SYMBOL_EDITOR, false );
206
207 if( !frame )
208 frame = aKiway->Player( FRAME_SCH_VIEWER, false );
209
210 if( !frame )
211 frame = aKiway->Player( FRAME_SCH, false );
212
213 if( frame )
214 SetUserUnits( frame->GetUserUnits() );
215
216 return new PANEL_GRID_SETTINGS( aParent, this, frame, cfg, FRAME_SCH_SYMBOL_EDITOR );
217 }
218
220 {
221 EDA_BASE_FRAME* frame = aKiway->Player( FRAME_SCH_SYMBOL_EDITOR, false );
222
223 if( !frame )
224 frame = aKiway->Player( FRAME_SCH_VIEWER, false );
225
226 if( !frame )
227 frame = aKiway->Player( FRAME_SCH, false );
228
229 if( frame )
230 SetUserUnits( frame->GetUserUnits() );
231
232 return new PANEL_SYM_EDITING_OPTIONS( aParent, this, frame );
233 }
234
235 case PANEL_SYM_COLORS:
236 return new PANEL_SYM_COLOR_SETTINGS( aParent );
237
239 {
240 SETTINGS_MANAGER& mgr = Pgm().GetSettingsManager();
242
243 return new PANEL_EESCHEMA_DISPLAY_OPTIONS( aParent, cfg );
244 }
245
246 case PANEL_SCH_GRIDS:
247 {
248 SETTINGS_MANAGER& mgr = Pgm().GetSettingsManager();
250 EDA_BASE_FRAME* frame = aKiway->Player( FRAME_SCH, false );
251
252 if( !frame )
253 frame = aKiway->Player( FRAME_SCH_SYMBOL_EDITOR, false );
254
255 if( !frame )
256 frame = aKiway->Player( FRAME_SCH_VIEWER, false );
257
258 if( frame )
259 SetUserUnits( frame->GetUserUnits() );
260
261 return new PANEL_GRID_SETTINGS( aParent, this, frame, cfg, FRAME_SCH );
262 }
263
265 {
266 EDA_BASE_FRAME* frame = aKiway->Player( FRAME_SCH, false );
267
268 if( !frame )
269 frame = aKiway->Player( FRAME_SCH_SYMBOL_EDITOR, false );
270
271 if( !frame )
272 frame = aKiway->Player( FRAME_SCH_VIEWER, false );
273
274 if( frame )
275 SetUserUnits( frame->GetUserUnits() );
276
277 return new PANEL_EESCHEMA_EDITING_OPTIONS( aParent, this, frame );
278 }
279
281 {
282 EDA_BASE_FRAME* schSettingsProvider = aKiway->Player( FRAME_SCH, false );
283
284 return new PANEL_EESCHEMA_ANNOTATION_OPTIONS( aParent, schSettingsProvider );
285 }
286
287 case PANEL_SCH_COLORS:
288 return new PANEL_EESCHEMA_COLOR_SETTINGS( aParent );
289
291 return new PANEL_TEMPLATE_FIELDNAMES( aParent, nullptr );
292
293 default:
294 return nullptr;
295 }
296 }
297
308 void* IfaceOrAddress( int aDataId ) override
309 {
310 switch( aDataId )
311 {
313 return (void*) generateSchematicNetlist;
314 }
315
316 return nullptr;
317 }
318
324 void SaveFileAs( const wxString& aProjectBasePath, const wxString& aProjectName,
325 const wxString& aNewProjectBasePath, const wxString& aNewProjectName,
326 const wxString& aSrcFilePath, wxString& aErrors ) override;
327
328
329 int HandleJob( JOB* aJob ) override;
330
331private:
332 bool loadGlobalLibTable();
333
334 std::unique_ptr<EESCHEMA_JOBS_HANDLER> m_jobHandler;
335
336} kiface( "eeschema", KIWAY::FACE_SCH );
337
338} // namespace
339
340using namespace SCH;
341
343
344
346
347
348// KIFACE_GETTER's actual spelling is a substitution macro found in kiway.h.
349// KIFACE_GETTER will not have name mangling due to declaration in kiway.h.
350KIFACE_API KIFACE* KIFACE_GETTER( int* aKIFACEversion, int aKiwayVersion, PGM_BASE* aProgram )
351{
352 process = aProgram;
353 return &kiface;
354}
355
356
358{
359 wxASSERT( process ); // KIFACE_GETTER has already been called.
360 return *process;
361}
362
363// Similar to PGM_BASE& Pgm(), but return nullptr when a *.ki_face is run from
364// a python script or something else.
366{
367 return process;
368}
369
370
371bool IFACE::OnKifaceStart( PGM_BASE* aProgram, int aCtlBits )
372{
373 // This is process-level-initialization, not project-level-initialization of the DSO.
374 // Do nothing in here pertinent to a project!
376 // Register the symbol editor settings as well because they share a KiFACE and need to be
377 // loaded prior to use to avoid threading deadlocks
379
380 // We intentionally register KifaceSettings after SYMBOL_EDITOR_SETTINGS
381 // In legacy configs, many settings were in a single editor config nd the migration routine
382 // for the main editor file will try and call into the now separate settings stores
383 // to move the settings into them
385
386 start_common( aCtlBits );
387
388 if( !loadGlobalLibTable() )
389 return false;
390
391 m_jobHandler = std::make_unique<EESCHEMA_JOBS_HANDLER>();
392
394 {
395 m_jobHandler->SetReporter( &CLI_REPORTER::GetInstance() );
396 m_jobHandler->SetProgressReporter( &CLI_PROGRESS_REPORTER::GetInstance() );
397 }
398
399 return true;
400}
401
402
404{
406}
407
408
410{
412
413 if( !fn.FileExists() )
414 {
415 if( !( m_start_flags & KFCTL_CLI ) )
416 {
417 // Ensure the splash screen does not hide the dialog:
418 Pgm().HideSplash();
419
420 DIALOG_GLOBAL_SYM_LIB_TABLE_CONFIG symDialog( nullptr );
421
422 if( symDialog.ShowModal() != wxID_OK )
423 return false;
424 }
425 }
426 else
427 {
428 try
429 {
430 // The global table is not related to a specific project. All projects
431 // will use the same global table. So the KIFACE::OnKifaceStart() contract
432 // of avoiding anything project specific is not violated here.
434 return false;
435 }
436 catch( const IO_ERROR& ioe )
437 {
438 // if we are here, a incorrect global symbol library table was found.
439 // Incorrect global symbol library table is not a fatal error:
440 // the user just has to edit the (partially) loaded table.
441 wxString msg =
442 _( "An error occurred attempting to load the global symbol library table.\n"
443 "Please edit this global symbol library table in Preferences menu." );
444
445 DisplayErrorMessage( nullptr, msg, ioe.What() );
446 }
447 }
448
449 return true;
450}
451
452
454{
455 end_common();
456}
457
458
459static void traverseSEXPR( SEXPR::SEXPR* aNode,
460 const std::function<void( SEXPR::SEXPR* )>& aVisitor )
461{
462 aVisitor( aNode );
463
464 if( aNode->IsList() )
465 {
466 for( unsigned i = 0; i < aNode->GetNumberOfChildren(); i++ )
467 traverseSEXPR( aNode->GetChild( i ), aVisitor );
468 }
469}
470
471
472void IFACE::SaveFileAs( const wxString& aProjectBasePath, const wxString& aProjectName,
473 const wxString& aNewProjectBasePath, const wxString& aNewProjectName,
474 const wxString& aSrcFilePath, wxString& aErrors )
475{
476 wxFileName destFile( aSrcFilePath );
477 wxString destPath = destFile.GetPathWithSep();
478 wxUniChar pathSep = wxFileName::GetPathSeparator();
479 wxString ext = destFile.GetExt();
480
481 if( destPath.StartsWith( aProjectBasePath + pathSep ) )
482 destPath.Replace( aProjectBasePath, aNewProjectBasePath, false );
483
484 destFile.SetPath( destPath );
485
486 if( ext == LegacySchematicFileExtension ||
490 {
491 if( destFile.GetName() == aProjectName )
492 {
493 destFile.SetName( aNewProjectName );
494 }
495 else if( destFile.GetName() == aNewProjectName )
496 {
497 wxString msg;
498
499 if( !aErrors.empty() )
500 aErrors += wxS( "\n" );
501
502 msg.Printf( _( "Cannot copy file '%s' as it will be overwritten by the new root "
503 "sheet file." ), destFile.GetFullPath() );
504 aErrors += msg;
505 return;
506 }
507
508 // Sheet paths when auto-generated are relative to the root, so those will stay
509 // pointing to whatever they were pointing at.
510 // The author can create their own absolute and relative sheet paths. Absolute
511 // sheet paths aren't an issue, and relative ones will continue to work as long
512 // as the author didn't include any '..'s. If they did, it's still not clear
513 // whether they should be adjusted or not (as the author may be duplicating an
514 // entire tree with several projects within it), so we leave this as an exercise
515 // to the author.
516
517 KiCopyFile( aSrcFilePath, destFile.GetFullPath(), aErrors );
518 }
519 else if( ext == SchematicSymbolFileExtension )
520 {
521 // Symbols are not project-specific. Keep their source names.
522 KiCopyFile( aSrcFilePath, destFile.GetFullPath(), aErrors );
523 }
526 {
527 if( destFile.GetName() == aProjectName + wxS( "-cache" ) )
528 destFile.SetName( aNewProjectName + wxS( "-cache" ) );
529
530 if( destFile.GetName() == aProjectName + wxS( "-rescue" ) )
531 destFile.SetName( aNewProjectName + wxS( "-rescue" ) );
532
533 KiCopyFile( aSrcFilePath, destFile.GetFullPath(), aErrors );
534 }
535 else if( ext == NetlistFileExtension )
536 {
537 bool success = false;
538
539 if( destFile.GetName() == aProjectName )
540 destFile.SetName( aNewProjectName );
541
542 try
543 {
544 SEXPR::PARSER parser;
545 std::unique_ptr<SEXPR::SEXPR> sexpr( parser.ParseFromFile( TO_UTF8( aSrcFilePath ) ) );
546
547 traverseSEXPR( sexpr.get(), [&]( SEXPR::SEXPR* node )
548 {
549 if( node->IsList() && node->GetNumberOfChildren() > 1
550 && node->GetChild( 0 )->IsSymbol()
551 && node->GetChild( 0 )->GetSymbol() == "source" )
552 {
553 auto pathNode = dynamic_cast<SEXPR::SEXPR_STRING*>( node->GetChild( 1 ) );
554 auto symNode = dynamic_cast<SEXPR::SEXPR_SYMBOL*>( node->GetChild( 1 ) );
555 wxString path;
556
557 if( pathNode )
558 path = pathNode->m_value;
559 else if( symNode )
560 path = symNode->m_value;
561
562 if( path == aProjectName + wxS( ".sch" ) )
563 path = aNewProjectName + wxS( ".sch" );
564 else if( path == aProjectBasePath + "/" + aProjectName + wxS( ".sch" ) )
565 path = aNewProjectBasePath + "/" + aNewProjectName + wxS( ".sch" );
566 else if( path.StartsWith( aProjectBasePath ) )
567 path.Replace( aProjectBasePath, aNewProjectBasePath, false );
568
569 if( pathNode )
570 pathNode->m_value = path;
571 else if( symNode )
572 symNode->m_value = path;
573 }
574 } );
575
576 wxFFile destNetList( destFile.GetFullPath(), "wb" );
577
578 if( destNetList.IsOpened() )
579 success = destNetList.Write( sexpr->AsString( 0 ) );
580
581 // wxFFile dtor will close the file
582 }
583 catch( ... )
584 {
585 success = false;
586 }
587
588 if( !success )
589 {
590 wxString msg;
591
592 if( !aErrors.empty() )
593 aErrors += wxS( "\n" );
594
595 msg.Printf( _( "Cannot copy file '%s'." ), destFile.GetFullPath() );
596 aErrors += msg;
597 }
598 }
599 else if( destFile.GetName() == wxS( "sym-lib-table" ) )
600 {
601 SYMBOL_LIB_TABLE symbolLibTable;
602 symbolLibTable.Load( aSrcFilePath );
603
604 for( unsigned i = 0; i < symbolLibTable.GetCount(); i++ )
605 {
606 LIB_TABLE_ROW& row = symbolLibTable.At( i );
607 wxString uri = row.GetFullURI();
608
609 uri.Replace( wxS( "/" ) + aProjectName + wxS( "-cache.lib" ),
610 wxS( "/" ) + aNewProjectName + wxS( "-cache.lib" ) );
611 uri.Replace( wxS( "/" ) + aProjectName + wxS( "-rescue.lib" ),
612 wxS( "/" ) + aNewProjectName + wxS( "-rescue.lib" ) );
613 uri.Replace( wxS( "/" ) + aProjectName + wxS( ".lib" ),
614 wxS( "/" ) + aNewProjectName + wxS( ".lib" ) );
615
616 row.SetFullURI( uri );
617 }
618
619 try
620 {
621 symbolLibTable.Save( destFile.GetFullPath() );
622 }
623 catch( ... )
624 {
625 wxString msg;
626
627 if( !aErrors.empty() )
628 aErrors += "\n";
629
630 msg.Printf( _( "Cannot copy file '%s'." ), destFile.GetFullPath() );
631 aErrors += msg;
632 }
633 }
634 else
635 {
636 wxFAIL_MSG( wxS( "Unexpected filetype for Eeschema::SaveFileAs()" ) );
637 }
638}
639
641{
642 return m_jobHandler->RunJob( aJob );
643}
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:76
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:99
virtual SETTINGS_MANAGER & GetSettingsManager() const
Definition: pgm_base.h:139
Schematic editor (Eeschema) main window.
Container class that holds multiple SCH_SCREEN objects in a hierarchy.
Definition: sch_screen.h:673
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.
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:427
const std::string & GetString()
Definition: richio.h:450
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:307
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:44
static PGM_BASE * process
Definition: eeschema.cpp:342
SCH_SHEET * g_RootSheet
Definition: eeschema.cpp:69
PGM_BASE & Pgm()
The global Program "get" accessor.
Definition: eeschema.cpp:357
KIFACE_BASE & Kiface()
Global KIFACE_BASE "get" accessor.
Definition: eeschema.cpp:345
static void traverseSEXPR(SEXPR::SEXPR *aNode, const std::function< void(SEXPR::SEXPR *)> &aVisitor)
Definition: eeschema.cpp:459
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:365
FRAME_T
The set of EDA_BASE_FRAME derivatives, typically stored in EDA_BASE_FRAME::m_Ident.
Definition: frame_type.h:33
@ PANEL_SYM_EDIT_GRIDS
Definition: frame_type.h:69
@ FRAME_SCH_SYMBOL_EDITOR
Definition: frame_type.h:35
@ PANEL_SCH_FIELD_NAME_TEMPLATES
Definition: frame_type.h:78
@ FRAME_SCH_VIEWER
Definition: frame_type.h:36
@ PANEL_SCH_DISP_OPTIONS
Definition: frame_type.h:73
@ FRAME_SCH
Definition: frame_type.h:34
@ FRAME_SCH_VIEWER_MODAL
Definition: frame_type.h:37
@ FRAME_SIMULATOR
Definition: frame_type.h:38
@ PANEL_SYM_EDIT_OPTIONS
Definition: frame_type.h:70
@ PANEL_SCH_EDIT_OPTIONS
Definition: frame_type.h:75
@ PANEL_SYM_DISP_OPTIONS
Definition: frame_type.h:68
@ DIALOG_SCH_LIBRARY_TABLE
Definition: frame_type.h:108
@ PANEL_SYM_COLORS
Definition: frame_type.h:71
@ PANEL_SCH_ANNO_OPTIONS
Definition: frame_type.h:76
@ PANEL_SCH_GRIDS
Definition: frame_type.h:74
@ PANEL_SCH_COLORS
Definition: frame_type.h:77
void KiCopyFile(const wxString &aSrcPath, const wxString &aDestPath, wxString &aErrors)
Definition: gestfich.cpp:216
const std::string BackupFileSuffix
const std::string KiCadSymbolLibFileExtension
const std::string LegacySchematicFileExtension
const std::string LegacySymbolDocumentFileExtension
const std::string NetlistFileExtension
const std::string KiCadSchematicFileExtension
const std::string SchematicSymbolFileExtension
const std::string LegacySymbolLibFileExtension
#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:72
static std::unique_ptr< SCHEMATIC > readSchematicFromFile(const std::string &aFilename)
Definition: eeschema.cpp:75
bool generateSchematicNetlist(const wxString &aFilename, wxString &aNetlist)
Definition: eeschema.cpp:120
SCH::IFACE KIFACE_BASE, UNITS_PROVIDER kiface("eeschema", KIWAY::FACE_SCH)
#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:115
#define TO_UTF8(wxstring)
Convert a wxString to a UTF8 encoded C string for all wxWidgets build modes.
Definition: string_utils.h:378
bool OnKifaceStart(PGM_BASE *aProgram, int aCtlBits) override
Typically start_common() is called from here.
Implement a participant in the KIWAY alchemy.
Definition: kiway.h:151
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:472
bool OnKifaceStart(PGM_BASE *aProgram, int aCtlBits) override
Typically start_common() is called from here.
Definition: eeschema.cpp:371
wxWindow * CreateKiWindow(wxWindow *aParent, int aClassId, KIWAY *aKiway, int aCtlBits=0) override
Create a wxWindow for the current project.
Definition: eeschema.cpp:148
IFACE(const char *aName, KIWAY::FACE_T aType)
Definition: eeschema.cpp:137
void Reset() override
Reloads global state.
Definition: eeschema.cpp:403
void * IfaceOrAddress(int aDataId) override
Return a pointer to the requested object.
Definition: eeschema.cpp:308
std::unique_ptr< EESCHEMA_JOBS_HANDLER > m_jobHandler
Definition: eeschema.cpp:334
bool loadGlobalLibTable()
Definition: eeschema.cpp:409
void OnKifaceEnd() override
Called just once just before the DSO is to be unloaded.
Definition: eeschema.cpp:453
int HandleJob(JOB *aJob) override
Definition: eeschema.cpp:640
Definition of file extensions used in Kicad.