KiCad PCB EDA Suite
Loading...
Searching...
No Matches
kicad.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-2015 Jean-Pierre Charras, jp.charras at wanadoo.fr
5 * Copyright The KiCad Developers, see AUTHORS.txt for contributors.
6 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation; either version 2
10 * of the License, or (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, you may find one here:
19 * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
20 * or you may search the http://www.gnu.org website for the version 2 license,
21 * or you may write to the Free Software Foundation, Inc.,
22 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
23 */
24
29
30
31#include <wx/filename.h>
32#include <wx/log.h>
33#include <wx/app.h>
34#include <wx/stdpaths.h>
35#include <wx/msgdlg.h>
36#include <wx/cmdline.h>
37
38#include <common.h>
39#include <env_vars.h>
40#include <file_history.h>
41#include <hotkeys_basic.h>
42#include <kiway.h>
43#include <macros.h>
44#include <paths.h>
45#include <richio.h>
50#include <systemdirsappend.h>
51#include <thread_pool.h>
52#include <trace_helpers.h>
54#include <confirm.h>
55
56#include <git/git_backend.h>
57#include <git/libgit_backend.h>
58#include <stdexcept>
59
60#include "pgm_kicad.h"
61#include "kicad_manager_frame.h"
62
63#include <kiplatform/app.h>
65
66#ifdef KICAD_IPC_API
67#include <api/api_server.h>
68#endif
69
70// a dummy to quiet linking with EDA_BASE_FRAME::config();
71#include <kiface_base.h>
72
74
75
77{
78 // This function should never be called. It is only referenced from
79 // EDA_BASE_FRAME::config() and this is only provided to satisfy the linker,
80 // not to be actually called.
81 wxLogFatalError( wxT( "Unexpected call to Kiface() in kicad/kicad.cpp" ) );
82
83 throw std::logic_error( "Unexpected call to Kiface() in kicad/kicad.cpp" );
84}
85
86
88
90{
91 return program;
92}
93
94
96{
97 App().SetAppDisplayName( wxT( "KiCad" ) );
98
99#if defined(DEBUG)
100 wxString absoluteArgv0 = wxStandardPaths::Get().GetExecutablePath();
101
102 if( !wxIsAbsolutePath( absoluteArgv0 ) )
103 {
104 wxLogError( wxT( "No meaningful argv[0]" ) );
105 return false;
106 }
107#endif
108
109 // Initialize the git backend before trying to initialize individual programs
111 GetGitBackend()->Init();
112
113 static const wxCmdLineEntryDesc desc[] = {
114 { wxCMD_LINE_OPTION, "f", "frame", "Frame to load", wxCMD_LINE_VAL_STRING, 0 },
115 { wxCMD_LINE_SWITCH, "n", "new", "New instance of KiCad, does not attempt to load previously open files",
116 wxCMD_LINE_VAL_NONE, 0 },
117#ifndef __WXOSX__
118 { wxCMD_LINE_SWITCH, nullptr, "software-rendering", "Use software rendering instead of OpenGL",
119 wxCMD_LINE_VAL_NONE, 0 },
120#endif
121 { wxCMD_LINE_PARAM, nullptr, nullptr, "File to load", wxCMD_LINE_VAL_STRING,
122 wxCMD_LINE_PARAM_MULTIPLE | wxCMD_LINE_PARAM_OPTIONAL },
123 { wxCMD_LINE_NONE, nullptr, nullptr, nullptr, wxCMD_LINE_VAL_NONE, 0 }
124 };
125
126 wxCmdLineParser parser( App().argc, App().argv );
127 parser.SetDesc( desc );
128 parser.Parse( false );
129
130 FRAME_T appType = KICAD_MAIN_FRAME_T;
131
132 const struct
133 {
134 wxString name;
135 FRAME_T type;
136 } frameTypes[] = { { wxT( "pcb" ), FRAME_PCB_EDITOR },
137 { wxT( "fpedit" ), FRAME_FOOTPRINT_EDITOR },
138 { wxT( "sch" ), FRAME_SCH },
139 { wxT( "calc" ), FRAME_CALC },
140 { wxT( "bm2cmp" ), FRAME_BM2CMP },
141 { wxT( "ds" ), FRAME_PL_EDITOR },
142 { wxT( "gerb" ), FRAME_GERBER },
143 { wxT( "" ), FRAME_T_COUNT } };
144
145 wxString frameName;
146
147 if( parser.Found( "frame", &frameName ) )
148 {
149 appType = FRAME_T_COUNT;
150
151 for( const auto& it : frameTypes )
152 {
153 if( it.name == frameName )
154 appType = it.type;
155 }
156
157 if( appType == FRAME_T_COUNT )
158 {
159 wxLogError( wxT( "Unknown frame: %s" ), frameName );
160 // Clean up
161 OnPgmExit();
162 return false;
163 }
164 }
165
166 if( appType == KICAD_MAIN_FRAME_T )
167 {
168 Kiway.SetCtlBits( KFCTL_CPP_PROJECT_SUITE );
169 }
170 else
171 {
172 Kiway.SetCtlBits( KFCTL_STANDALONE );
173 }
174
175#ifndef __WXMAC__
176 if( parser.Found( "software-rendering" ) )
177 {
178 wxSetEnv( "KICAD_SOFTWARE_RENDERING", "1" );
179 }
180#endif
181
182 if( !InitPgm( false ) )
183 return false;
184
185
186 m_bm.InitSettings( new KICAD_SETTINGS );
189 m_bm.Init();
190
191 if( const COMMON_SETTINGS* cfg = Pgm().GetCommonSettings() )
192 {
193 if( cfg->m_Appearance.app_theme == APP_THEME::DARK )
195 else if( cfg->m_Appearance.app_theme == APP_THEME::AUTO )
197 }
198
199 // Add search paths to feed the PGM_KICAD::SysSearch() function,
200 // currently limited in support to only look for project templates
201 {
202 SEARCH_STACK bases;
203
204 SystemDirsAppend( &bases );
205
206 for( unsigned i = 0; i < bases.GetCount(); ++i )
207 {
208 wxFileName fn( bases[i], wxEmptyString );
209
210 // Add KiCad template file path to search path list.
211 fn.AppendDir( wxT( "template" ) );
212
213 // Only add path if exists and can be read by the user.
214 if( fn.DirExists() && fn.IsDirReadable() )
215 m_bm.m_search.AddPaths( fn.GetPath() );
216 }
217
218 auto insertExpanded = [&]( const wxString& aValue )
219 {
220 wxString resolved = ExpandEnvVarSubstitutions( aValue, nullptr );
221
222 // Skip values that still contain unresolved variable references so we don't
223 // pollute the search stack with paths like "${MISSING}/templates".
224 if( resolved.Contains( wxT( "${" ) ) || resolved.Contains( wxT( "$(" ) ) )
225 return;
226
227 m_bm.m_search.Insert( resolved, 0 );
228 };
229
230 // The versioned TEMPLATE_DIR takes precedence over the search stack template path.
231 if( std::optional<wxString> v = ENV_VAR::GetVersionedEnvVarValue( GetLocalEnvVariables(),
232 wxT( "TEMPLATE_DIR" ) ) )
233 {
234 if( !v->IsEmpty() )
235 insertExpanded( *v );
236 }
237
238 // We've been adding system (installed default) search paths so far, now for user paths
239 // The default user search path is inside KIPLATFORM::ENV::GetDocumentsPath()
240 m_bm.m_search.Insert( PATHS::GetUserTemplatesPath(), 0 );
241
242 // ...but the user can override that default with the KICAD_USER_TEMPLATE_DIR env var.
243 // The value may itself reference other KiCad path variables, so expand them here.
244 ENV_VAR_MAP_CITER it = GetLocalEnvVariables().find( "KICAD_USER_TEMPLATE_DIR" );
245
246 if( it != GetLocalEnvVariables().end() && it->second.GetValue() != wxEmptyString )
247 insertExpanded( it->second.GetValue() );
248 }
249
250 wxFrame* frame = nullptr;
251 KIWAY_PLAYER* playerFrame = nullptr;
252 KICAD_MANAGER_FRAME* managerFrame = nullptr;
253
254 if( appType == KICAD_MAIN_FRAME_T )
255 {
256 managerFrame = new KICAD_MANAGER_FRAME( nullptr, wxT( "KiCad" ), wxDefaultPosition,
257 wxWindow::FromDIP( wxSize( 775, -1 ), NULL ) );
258 frame = managerFrame;
259
260 STARTWIZARD startWizard;
261 startWizard.CheckAndRun( frame );
262 }
263 else
264 {
265 // Use KIWAY to create a top window, which registers its existence also.
266 // "TOP_FRAME" is a macro that is passed on compiler command line from CMake,
267 // and is one of the types in FRAME_T.
268 playerFrame = Kiway.Player( appType, true );
269 frame = playerFrame;
270
271 if( frame == nullptr )
272 {
273 return false;
274 }
275 }
276
277 App().SetTopWindow( frame );
278
279 if( playerFrame )
280 App().SetAppDisplayName( playerFrame->GetAboutTitle() );
281
282 Kiway.SetTop( frame );
283
284 KIPLATFORM::ENV::SetAppDetailsForWindow( frame, '"' + wxStandardPaths::Get().GetExecutablePath() + '"' + " -n",
285 frame->GetTitle() );
286
287 KICAD_SETTINGS* settings = static_cast<KICAD_SETTINGS*>( PgmSettings() );
288
290
291#ifdef KICAD_IPC_API
292 m_api_server = std::make_unique<KICAD_API_SERVER>();
293 m_api_common_handler = std::make_unique<API_HANDLER_COMMON>();
294 m_api_server->RegisterHandler( m_api_common_handler.get() );
295#endif
296
297 wxString projToLoad;
298
299 HideSplash();
300
301 if( playerFrame && parser.GetParamCount() )
302 {
303 // Now after the frame processing, the rest of the positional args are files
304 std::vector<wxString> fileArgs;
305 /*
306 gerbview handles multiple project data files, i.e. gerber files on
307 cmd line. Others currently do not, they handle only one. For common
308 code simplicity we simply pass all the arguments in however, each
309 program module can do with them what they want, ignore, complain
310 whatever. We don't establish policy here, as this is a multi-purpose
311 launcher.
312 */
313
314 for( size_t i = 0; i < parser.GetParamCount(); i++ )
315 fileArgs.push_back( parser.GetParam( i ) );
316
317 // special attention to a single argument: argv[1] (==argSet[0])
318 if( fileArgs.size() == 1 )
319 {
320 wxFileName argv1( fileArgs[0] );
321
322#if defined( PGM_DATA_FILE_EXT )
323 // PGM_DATA_FILE_EXT, if present, may be different for each compile,
324 // it may come from CMake on the compiler command line, but often does not.
325 // This facility is mostly useful for those program footprints
326 // supporting a single argv[1].
327 if( !argv1.GetExt() )
328 argv1.SetExt( wxT( PGM_DATA_FILE_EXT ) );
329#endif
330 argv1.MakeAbsolute();
331
332 fileArgs[0] = argv1.GetFullPath();
333 }
334
335 // Use the KIWAY_PLAYER::OpenProjectFiles() API function:
336 if( !playerFrame->OpenProjectFiles( fileArgs ) )
337 {
338 // OpenProjectFiles() API asks that it report failure to the UI.
339 // Nothing further to say here.
340
341 // We've already initialized things at this point, but wx won't call OnExit if
342 // we fail out. Call our own cleanup routine here to ensure the relevant resources
343 // are freed at the right time (if they aren't, segfaults will occur).
344 OnPgmExit();
345
346 // Fail the process startup if the file could not be opened,
347 // although this is an optional choice, one that can be reversed
348 // also in the KIFACE specific OpenProjectFiles() return value.
349 return false;
350 }
351 }
352 else if( managerFrame )
353 {
354 if( parser.GetParamCount() > 0 )
355 {
356 wxFileName tmp = parser.GetParam( 0 );
357
358 if( tmp.GetExt() != FILEEXT::ProjectFileExtension && tmp.GetExt() != FILEEXT::LegacyProjectFileExtension )
359 {
360 DisplayErrorMessage( nullptr, wxString::Format( _( "File '%s'\n"
361 "does not appear to be a KiCad project file." ),
362 tmp.GetFullPath() ) );
363 }
364 else
365 {
366 projToLoad = tmp.GetFullPath();
367 }
368 }
369
370 // If no file was given as an argument, check that there was a file open.
371 if( projToLoad.IsEmpty() && settings->m_OpenProjects.size() && !parser.FoundSwitch( "new" ) )
372 {
373 wxString last_pro = settings->m_OpenProjects.front();
374 settings->m_OpenProjects.erase( settings->m_OpenProjects.begin() );
375
376 if( wxFileExists( last_pro ) )
377 {
378 // Try to open the last opened project,
379 // if a project name is not given when starting Kicad
380 projToLoad = last_pro;
381 }
382 }
383
384 bool loaded = false;
385
386 // Do not attempt to load a non-existent project file.
387 if( !projToLoad.empty() )
388 {
389 wxFileName fn( projToLoad );
390
391 if( fn.Exists() && ( fn.GetExt() == FILEEXT::ProjectFileExtension
392 || fn.GetExt() == FILEEXT::LegacyProjectFileExtension ) )
393 {
394 fn.MakeAbsolute();
395
396 if( appType == KICAD_MAIN_FRAME_T )
397 loaded = managerFrame->LoadProject( fn );
398 }
399 }
400
401 if( !loaded && appType == KICAD_MAIN_FRAME_T )
402 managerFrame->PreloadAllLibraries();
403 }
404
405 frame->Show( true );
406 frame->Raise();
407
408#ifdef KICAD_IPC_API
409 m_api_server->SetReadyToReply();
410#endif
411
412 return true;
413}
414
415
417{
418 return 0;
419}
420
421
423{
424 // Signal all background library preloads to abort before waiting for the thread pool.
425 // The design block preload runs on the global thread pool and checks this flag; without
426 // setting it here the pool wait below can block for up to 120 seconds.
427 m_libraryPreloadAbort.store( true );
428
429 // Abort and wait on any background jobs
430 GetKiCadThreadPool().purge();
431 GetKiCadThreadPool().wait();
432
433 Kiway.OnKiwayEnd();
434
435#ifdef KICAD_IPC_API
436 m_api_server.reset();
437#endif
438
440 {
442 m_settings_manager->Save();
443 }
444
445 // Destroy everything in PGM_KICAD,
446 // especially wxSingleInstanceCheckerImpl earlier than wxApp and earlier
447 // than static destruction would.
448 Destroy();
450 delete GetGitBackend();
451 SetGitBackend( nullptr );
452}
453
454
455void PGM_KICAD::MacOpenFile( const wxString& aFileName )
456{
457#if defined(__WXMAC__)
458
459 KICAD_MANAGER_FRAME* frame = (KICAD_MANAGER_FRAME*) App().GetTopWindow();
460
461 if( !aFileName.empty() && wxFileExists( aFileName ) )
462 frame->LoadProject( wxFileName( aFileName ) );
463
464#endif
465}
466
467
469{
470 // unlike a normal destructor, this is designed to be called more
471 // than once safely:
472
473 m_bm.End();
474
476}
477
478
480
481#ifdef NDEBUG
482// Define a custom assertion handler
483void CustomAssertHandler(const wxString& file,
484 int line,
485 const wxString& func,
486 const wxString& cond,
487 const wxString& msg)
488{
489 Pgm().HandleAssert( file, line, func, cond, msg );
490}
491#endif
492
496struct APP_KICAD : public wxApp
497{
498 APP_KICAD() : wxApp()
499 {
500 SetPgm( &program );
501
502 // Init the environment each platform wants
504 }
505
506
507 bool OnInit() override
508 {
509#ifdef NDEBUG
510 // These checks generate extra assert noise
511 wxSizerFlags::DisableConsistencyChecks();
512 wxDISABLE_DEBUG_SUPPORT();
513 wxSetAssertHandler( CustomAssertHandler );
514#endif
515
516 // Perform platform-specific init tasks
517 if( !KIPLATFORM::APP::Init() )
518 return false;
519
520#ifndef DEBUG
521 // Enable logging traces to the console in release build.
522 // This is usually disabled, but it can be useful for users to run to help
523 // debug issues and other problems.
524 if( wxGetEnv( wxS( "KICAD_ENABLE_WXTRACE" ), nullptr ) )
525 {
526 wxLog::EnableLogging( true );
527 wxLog::SetLogLevel( wxLOG_Trace );
528 }
529#endif
530
531 if( !program.OnPgmInit() )
532 {
533 program.OnPgmExit();
534 return false;
535 }
536
537 return true;
538 }
539
540 int OnExit() override
541 {
542 // Drain wxPendingDelete (frames deferred via Destroy()) before tearing down
543 // PGM_BASE singletons. On macOS the dock-quit path leaves frames in this
544 // queue at OnExit() time, and their canvas destructors call into
545 // Pgm().GetGLContextManager(). Running OnPgmExit() first would null that
546 // pointer out from under them. See https://gitlab.com/kicad/code/kicad/-/issues/23373
547 int ret = wxApp::OnExit();
548
549 // Avoid wxLog crashing when used in destructors invoked from OnPgmExit().
550 wxLog::EnableLogging( false );
551
552 program.OnPgmExit();
553 return ret;
554 }
555
556
557 int OnRun() override
558 {
559 try
560 {
561 return wxApp::OnRun();
562 }
563 catch(...)
564 {
565 Pgm().HandleException( std::current_exception() );
566 }
567
568 return -1;
569 }
570
571
572 void OnUnhandledException() override
573 {
574 Pgm().HandleException( std::current_exception(), true );
575 }
576
577
578 int FilterEvent( wxEvent& aEvent ) override
579 {
580 if( aEvent.GetEventType() == wxEVT_SHOW )
581 {
582 wxShowEvent& event = static_cast<wxShowEvent&>( aEvent );
583 wxDialog* dialog = dynamic_cast<wxDialog*>( event.GetEventObject() );
584
585 std::vector<void*>& dlgs = Pgm().m_ModalDialogs;
586
587 if( dialog )
588 {
589 if( event.IsShown() && dialog->IsModal() )
590 {
591 dlgs.push_back( dialog );
592 }
593 // Under GTK, sometimes the modal flag is cleared before hiding
594 else if( !event.IsShown() && !dlgs.empty() )
595 {
596 // If we close the expected dialog, remove it from our stack
597 if( dlgs.back() == dialog )
598 dlgs.pop_back();
599 // If an out-of-order, remove all dialogs added after the closed one
600 else if( auto it = std::find( dlgs.begin(), dlgs.end(), dialog ) ; it != dlgs.end() )
601 dlgs.erase( it, dlgs.end() );
602 }
603 }
604 }
605
606 return Event_Skip;
607 }
608
609#if defined( DEBUG )
613 bool ProcessEvent( wxEvent& aEvent ) override
614 {
615 if( aEvent.GetEventType() == wxEVT_CHAR || aEvent.GetEventType() == wxEVT_CHAR_HOOK )
616 {
617 wxKeyEvent* keyEvent = static_cast<wxKeyEvent*>( &aEvent );
618
619 if( keyEvent )
620 {
621 wxLogTrace( kicadTraceKeyEvent, "APP_KICAD::ProcessEvent %s", dump( *keyEvent ) );
622 }
623 }
624
625 aEvent.Skip();
626 return false;
627 }
628
636 bool OnExceptionInMainLoop() override
637 {
638 try
639 {
640 throw;
641 }
642 catch(...)
643 {
644 Pgm().HandleException( std::current_exception() );
645 }
646
647 return false; // continue on. Return false to abort program
648 }
649#endif
650
656#if defined( __WXMAC__ )
657 void MacOpenFile( const wxString& aFileName ) override
658 {
659 Pgm().MacOpenFile( aFileName );
660 }
661#endif
662};
663
664IMPLEMENT_APP( APP_KICAD )
665
666
667// The C++ project manager supports one open PROJECT, so Prj() calls within
668// this link image need this function.
670{
671 return Kiway.Prj();
672}
673
const char * name
wxString GetAboutTitle() const
virtual void Shutdown()=0
virtual void Init()=0
The main KiCad project manager frame.
bool LoadProject(const wxFileName &aProjectFileName)
Loads a new project.
std::vector< wxString > m_OpenProjects
A KIFACE implementation.
Definition kiface_base.h:39
A wxFrame capable of the OpenProjectFiles function, meaning it can load a portion of a KiCad project.
virtual bool OpenProjectFiles(const std::vector< wxString > &aFileList, int aCtl=0)
Open a project or set of files given by aFileList.
A minimalistic software bus for communications between various DLLs/DSOs (DSOs) within the same KiCad...
Definition kiway.h:315
void LoadGlobalTables(std::initializer_list< LIBRARY_TABLE_TYPE > aTablesToLoad={})
(Re)loads the global library tables in the given list, or all tables if no list is given
static wxString GetUserTemplatesPath()
Gets the user path for custom templates.
Definition paths.cpp:71
virtual COMMON_SETTINGS * GetCommonSettings() const
Definition pgm_base.cpp:541
virtual wxApp & App()
Return a bare naked wxApp which may come from wxPython, SINGLE_TOP, or kicad.exe.
Definition pgm_base.cpp:211
virtual ENV_VAR_MAP & GetLocalEnvVariables() const
Definition pgm_base.cpp:787
virtual void MacOpenFile(const wxString &aFileName)=0
Specific to MacOSX (not used under Linux or Windows).
std::unique_ptr< SETTINGS_MANAGER > m_settings_manager
Definition pgm_base.h:411
void Destroy()
Definition pgm_base.cpp:190
void HandleException(std::exception_ptr aPtr, bool aUnhandled=false)
A exception handler to be used at the top level if exceptions bubble up that for.
Definition pgm_base.cpp:802
std::atomic_bool m_libraryPreloadAbort
Definition pgm_base.h:456
std::vector< void * > m_ModalDialogs
Definition pgm_base.h:392
bool InitPgm(bool aHeadless=false, bool aIsUnitTest=false)
Initialize this program.
Definition pgm_base.cpp:327
void HandleAssert(const wxString &aFile, int aLine, const wxString &aFunc, const wxString &aCond, const wxString &aMsg)
A common assert handler to be used between single_top and kicad.
Definition pgm_base.cpp:839
virtual const wxString & GetExecutablePath() const
Definition pgm_base.cpp:867
virtual SETTINGS_MANAGER & GetSettingsManager() const
Definition pgm_base.h:130
void HideSplash()
Definition pgm_base.cpp:316
virtual LIBRARY_MANAGER & GetLibraryManager() const
Definition pgm_base.h:132
void SaveCommonSettings()
Save the program (process) settings subset which are stored .kicad_common.
Definition pgm_base.cpp:532
PGM_KICAD extends PGM_BASE to bring in FileHistory() and PdfBrowser() which were moved from EDA_APP i...
Definition pgm_kicad.h:42
bool OnPgmInit()
Definition kicad.cpp:95
void Destroy()
Definition kicad.cpp:468
void MacOpenFile(const wxString &aFileName) override
Specific to MacOSX (not used under Linux or Windows).
Definition kicad.cpp:455
void OnPgmExit()
Definition kicad.cpp:422
APP_SETTINGS_BASE * PgmSettings()
Definition pgm_kicad.h:59
int OnPgmRun()
Definition kicad.cpp:416
BIN_MOD m_bm
Definition pgm_kicad.h:72
Container for project specific data.
Definition project.h:66
Look for files in a number of paths.
T * RegisterSettings(T *aSettings, bool aLoadNow=true)
Take ownership of the pointer passed in.
void SetKiway(KIWAY *aKiway)
Associate this setting manager with the given Kiway.
void CheckAndRun(wxWindow *parent)
const wxString ExpandEnvVarSubstitutions(const wxString &aString, const PROJECT *aProject)
Replace any environment variable & text variable references with their values.
Definition common.cpp:708
The common library.
void DisplayErrorMessage(wxWindow *aParent, const wxString &aText, const wxString &aExtraInfo)
Display an error message with aMessage.
Definition confirm.cpp:221
This file is part of the common library.
#define _(s)
Functions related to environment variables, including help functions.
FRAME_T
The set of EDA_BASE_FRAME derivatives, typically stored in EDA_BASE_FRAME::m_Ident.
Definition frame_type.h:33
@ FRAME_PCB_EDITOR
Definition frame_type.h:42
@ FRAME_CALC
Definition frame_type.h:63
@ FRAME_BM2CMP
Definition frame_type.h:61
@ FRAME_SCH
Definition frame_type.h:34
@ FRAME_T_COUNT
Definition frame_type.h:70
@ FRAME_PL_EDITOR
Definition frame_type.h:59
@ FRAME_FOOTPRINT_EDITOR
Definition frame_type.h:43
@ FRAME_GERBER
Definition frame_type.h:57
@ KICAD_MAIN_FRAME_T
Definition frame_type.h:68
void SetGitBackend(GIT_BACKEND *aBackend)
GIT_BACKEND * GetGitBackend()
static const std::string ProjectFileExtension
static const std::string LegacyProjectFileExtension
const wxChar *const kicadTraceKeyEvent
Flag to enable wxKeyEvent debug tracing.
std::map< wxString, ENV_VAR_ITEM >::const_iterator ENV_VAR_MAP_CITER
PGM_KICAD & PgmTop()
Definition kicad.cpp:89
PROJECT & Prj()
Definition kicad.cpp:669
static PGM_KICAD program
Definition kicad.cpp:87
KIFACE_BASE & Kiface()
Global KIFACE_BASE "get" accessor.
Definition kicad.cpp:76
KIWAY Kiway(KFCTL_CPP_PROJECT_SUITE)
#define KFCTL_CPP_PROJECT_SUITE
Running under C++ project mgr, possibly with others.
Definition kiway.h:164
#define KFCTL_STANDALONE
Running as a standalone Top.
Definition kiway.h:163
This file contains miscellaneous commonly used macros and functions.
KICOMMON_API std::optional< wxString > GetVersionedEnvVarValue(const std::map< wxString, ENV_VAR_ITEM > &aMap, const wxString &aBaseName)
Attempt to retrieve the value of a versioned environment variable, such as KICAD8_TEMPLATE_DIR.
Definition env_vars.cpp:86
bool Init()
Perform application-specific initialization tasks.
Definition unix/app.cpp:40
void EnableDarkMode(bool aForce)
Definition unix/app.cpp:58
void Init()
Perform environment initialization tasks.
void SetAppDetailsForWindow(wxWindow *aWindow, const wxString &aRelaunchCommand, const wxString &aRelaunchDisplayName)
Sets the relaunch command for taskbar pins, this is intended for Windows.
void SetPgm(PGM_BASE *pgm)
PGM_BASE & Pgm()
The global program "get" accessor.
PGM_SINGLE_TOP program
KIWAY Kiway(KFCTL_STANDALONE)
Not publicly visible because most of the action is in PGM_KICAD these days.
Definition kicad.cpp:497
int OnRun() override
Definition kicad.cpp:557
APP_KICAD()
Definition kicad.cpp:498
bool OnInit() override
Definition kicad.cpp:507
int OnExit() override
Definition kicad.cpp:540
void OnUnhandledException() override
Definition kicad.cpp:572
int FilterEvent(wxEvent &aEvent) override
Definition kicad.cpp:578
void SystemDirsAppend(SEARCH_STACK *aSearchStack)
Append system places to aSearchStack in a platform specific way and pertinent to KiCad programs.
System directories search utilities.
VECTOR2I end
thread_pool & GetKiCadThreadPool()
Get a reference to the current thread pool.
wxString dump(const wxArrayString &aArray)
Debug helper for printing wxArrayString contents.
wxLogTrace helper definitions.
Definition of file extensions used in Kicad.