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 <env_vars.h>
39#include <file_history.h>
40#include <hotkeys_basic.h>
41#include <kiway.h>
42#include <macros.h>
43#include <paths.h>
44#include <richio.h>
48#include <systemdirsappend.h>
49#include <thread_pool.h>
50#include <trace_helpers.h>
52#include <confirm.h>
53
54#include <git/git_backend.h>
55#include <git/libgit_backend.h>
56#include <stdexcept>
57
58#include "pgm_kicad.h"
59#include "kicad_manager_frame.h"
60
61#include <kiplatform/app.h>
63
64#ifdef KICAD_IPC_API
65#include <api/api_server.h>
66#endif
67
68// a dummy to quiet linking with EDA_BASE_FRAME::config();
69#include <kiface_base.h>
70
72
73
75{
76 // This function should never be called. It is only referenced from
77 // EDA_BASE_FRAME::config() and this is only provided to satisfy the linker,
78 // not to be actually called.
79 wxLogFatalError( wxT( "Unexpected call to Kiface() in kicad/kicad.cpp" ) );
80
81 throw std::logic_error( "Unexpected call to Kiface() in kicad/kicad.cpp" );
82}
83
84
86
88{
89 return program;
90}
91
92
94{
95 App().SetAppDisplayName( wxT( "KiCad" ) );
96
97#if defined(DEBUG)
98 wxString absoluteArgv0 = wxStandardPaths::Get().GetExecutablePath();
99
100 if( !wxIsAbsolutePath( absoluteArgv0 ) )
101 {
102 wxLogError( wxT( "No meaningful argv[0]" ) );
103 return false;
104 }
105#endif
106
107 // Initialize the git backend before trying to initialize individual programs
109 GetGitBackend()->Init();
110
111 static const wxCmdLineEntryDesc desc[] = {
112 { wxCMD_LINE_OPTION, "f", "frame", "Frame to load", wxCMD_LINE_VAL_STRING, 0 },
113 { wxCMD_LINE_SWITCH, "n", "new", "New instance of KiCad, does not attempt to load previously open files",
114 wxCMD_LINE_VAL_NONE, 0 },
115#ifndef __WXOSX__
116 { wxCMD_LINE_SWITCH, nullptr, "software-rendering", "Use software rendering instead of OpenGL",
117 wxCMD_LINE_VAL_NONE, 0 },
118#endif
119 { wxCMD_LINE_PARAM, nullptr, nullptr, "File to load", wxCMD_LINE_VAL_STRING,
120 wxCMD_LINE_PARAM_MULTIPLE | wxCMD_LINE_PARAM_OPTIONAL },
121 { wxCMD_LINE_NONE, nullptr, nullptr, nullptr, wxCMD_LINE_VAL_NONE, 0 }
122 };
123
124 wxCmdLineParser parser( App().argc, App().argv );
125 parser.SetDesc( desc );
126 parser.Parse( false );
127
128 FRAME_T appType = KICAD_MAIN_FRAME_T;
129
130 const struct
131 {
132 wxString name;
133 FRAME_T type;
134 } frameTypes[] = { { wxT( "pcb" ), FRAME_PCB_EDITOR },
135 { wxT( "fpedit" ), FRAME_FOOTPRINT_EDITOR },
136 { wxT( "sch" ), FRAME_SCH },
137 { wxT( "calc" ), FRAME_CALC },
138 { wxT( "bm2cmp" ), FRAME_BM2CMP },
139 { wxT( "ds" ), FRAME_PL_EDITOR },
140 { wxT( "gerb" ), FRAME_GERBER },
141 { wxT( "" ), FRAME_T_COUNT } };
142
143 wxString frameName;
144
145 if( parser.Found( "frame", &frameName ) )
146 {
147 appType = FRAME_T_COUNT;
148
149 for( const auto& it : frameTypes )
150 {
151 if( it.name == frameName )
152 appType = it.type;
153 }
154
155 if( appType == FRAME_T_COUNT )
156 {
157 wxLogError( wxT( "Unknown frame: %s" ), frameName );
158 // Clean up
159 OnPgmExit();
160 return false;
161 }
162 }
163
164 if( appType == KICAD_MAIN_FRAME_T )
165 {
166 Kiway.SetCtlBits( KFCTL_CPP_PROJECT_SUITE );
167 }
168 else
169 {
170 Kiway.SetCtlBits( KFCTL_STANDALONE );
171 }
172
173#ifndef __WXMAC__
174 if( parser.Found( "software-rendering" ) )
175 {
176 wxSetEnv( "KICAD_SOFTWARE_RENDERING", "1" );
177 }
178#endif
179
180 bool skipPythonInit = false;
181
182 if( appType == FRAME_BM2CMP || appType == FRAME_PL_EDITOR || appType == FRAME_GERBER
183 || appType == FRAME_CALC )
184 skipPythonInit = true;
185
186 if( !InitPgm( false, skipPythonInit ) )
187 return false;
188
189
190 m_bm.InitSettings( new KICAD_SETTINGS );
193 m_bm.Init();
194
195
196 // Add search paths to feed the PGM_KICAD::SysSearch() function,
197 // currently limited in support to only look for project templates
198 {
199 SEARCH_STACK bases;
200
201 SystemDirsAppend( &bases );
202
203 for( unsigned i = 0; i < bases.GetCount(); ++i )
204 {
205 wxFileName fn( bases[i], wxEmptyString );
206
207 // Add KiCad template file path to search path list.
208 fn.AppendDir( wxT( "template" ) );
209
210 // Only add path if exists and can be read by the user.
211 if( fn.DirExists() && fn.IsDirReadable() )
212 m_bm.m_search.AddPaths( fn.GetPath() );
213 }
214
215 // The versioned TEMPLATE_DIR takes precedence over the search stack template path.
216 if( std::optional<wxString> v = ENV_VAR::GetVersionedEnvVarValue( GetLocalEnvVariables(),
217 wxT( "TEMPLATE_DIR" ) ) )
218 {
219 if( !v->IsEmpty() )
220 m_bm.m_search.Insert( *v, 0 );
221 }
222
223 // We've been adding system (installed default) search paths so far, now for user paths
224 // The default user search path is inside KIPLATFORM::ENV::GetDocumentsPath()
225 m_bm.m_search.Insert( PATHS::GetUserTemplatesPath(), 0 );
226
227 // ...but the user can override that default with the KICAD_USER_TEMPLATE_DIR env var
228 ENV_VAR_MAP_CITER it = GetLocalEnvVariables().find( "KICAD_USER_TEMPLATE_DIR" );
229
230 if( it != GetLocalEnvVariables().end() && it->second.GetValue() != wxEmptyString )
231 m_bm.m_search.Insert( it->second.GetValue(), 0 );
232 }
233
234 wxFrame* frame = nullptr;
235 KIWAY_PLAYER* playerFrame = nullptr;
236 KICAD_MANAGER_FRAME* managerFrame = nullptr;
237
238 if( appType == KICAD_MAIN_FRAME_T )
239 {
240 managerFrame = new KICAD_MANAGER_FRAME( nullptr, wxT( "KiCad" ), wxDefaultPosition,
241 wxWindow::FromDIP( wxSize( 775, -1 ), NULL ) );
242 frame = managerFrame;
243
244 STARTWIZARD startWizard;
245 startWizard.CheckAndRun( frame );
246 }
247 else
248 {
249 // Use KIWAY to create a top window, which registers its existence also.
250 // "TOP_FRAME" is a macro that is passed on compiler command line from CMake,
251 // and is one of the types in FRAME_T.
252 playerFrame = Kiway.Player( appType, true );
253 frame = playerFrame;
254
255 if( frame == nullptr )
256 {
257 return false;
258 }
259 }
260
261 App().SetTopWindow( frame );
262
263 if( playerFrame )
264 App().SetAppDisplayName( playerFrame->GetAboutTitle() );
265
266 Kiway.SetTop( frame );
267
268 KIPLATFORM::ENV::SetAppDetailsForWindow( frame, '"' + wxStandardPaths::Get().GetExecutablePath() + '"' + " -n",
269 frame->GetTitle() );
270
271 KICAD_SETTINGS* settings = static_cast<KICAD_SETTINGS*>( PgmSettings() );
272
274
275#ifdef KICAD_IPC_API
276 m_api_server = std::make_unique<KICAD_API_SERVER>();
277 m_api_common_handler = std::make_unique<API_HANDLER_COMMON>();
278 m_api_server->RegisterHandler( m_api_common_handler.get() );
279#endif
280
281 wxString projToLoad;
282
283 HideSplash();
284
285 if( playerFrame && parser.GetParamCount() )
286 {
287 // Now after the frame processing, the rest of the positional args are files
288 std::vector<wxString> fileArgs;
289 /*
290 gerbview handles multiple project data files, i.e. gerber files on
291 cmd line. Others currently do not, they handle only one. For common
292 code simplicity we simply pass all the arguments in however, each
293 program module can do with them what they want, ignore, complain
294 whatever. We don't establish policy here, as this is a multi-purpose
295 launcher.
296 */
297
298 for( size_t i = 0; i < parser.GetParamCount(); i++ )
299 fileArgs.push_back( parser.GetParam( i ) );
300
301 // special attention to a single argument: argv[1] (==argSet[0])
302 if( fileArgs.size() == 1 )
303 {
304 wxFileName argv1( fileArgs[0] );
305
306#if defined( PGM_DATA_FILE_EXT )
307 // PGM_DATA_FILE_EXT, if present, may be different for each compile,
308 // it may come from CMake on the compiler command line, but often does not.
309 // This facility is mostly useful for those program footprints
310 // supporting a single argv[1].
311 if( !argv1.GetExt() )
312 argv1.SetExt( wxT( PGM_DATA_FILE_EXT ) );
313#endif
314 argv1.MakeAbsolute();
315
316 fileArgs[0] = argv1.GetFullPath();
317 }
318
319 // Use the KIWAY_PLAYER::OpenProjectFiles() API function:
320 if( !playerFrame->OpenProjectFiles( fileArgs ) )
321 {
322 // OpenProjectFiles() API asks that it report failure to the UI.
323 // Nothing further to say here.
324
325 // We've already initialized things at this point, but wx won't call OnExit if
326 // we fail out. Call our own cleanup routine here to ensure the relevant resources
327 // are freed at the right time (if they aren't, segfaults will occur).
328 OnPgmExit();
329
330 // Fail the process startup if the file could not be opened,
331 // although this is an optional choice, one that can be reversed
332 // also in the KIFACE specific OpenProjectFiles() return value.
333 return false;
334 }
335 }
336 else if( managerFrame )
337 {
338 if( parser.GetParamCount() > 0 )
339 {
340 wxFileName tmp = parser.GetParam( 0 );
341
342 if( tmp.GetExt() != FILEEXT::ProjectFileExtension && tmp.GetExt() != FILEEXT::LegacyProjectFileExtension )
343 {
344 DisplayErrorMessage( nullptr, wxString::Format( _( "File '%s'\n"
345 "does not appear to be a KiCad project file." ),
346 tmp.GetFullPath() ) );
347 }
348 else
349 {
350 projToLoad = tmp.GetFullPath();
351 }
352 }
353
354 // If no file was given as an argument, check that there was a file open.
355 if( projToLoad.IsEmpty() && settings->m_OpenProjects.size() && !parser.FoundSwitch( "new" ) )
356 {
357 wxString last_pro = settings->m_OpenProjects.front();
358 settings->m_OpenProjects.erase( settings->m_OpenProjects.begin() );
359
360 if( wxFileExists( last_pro ) )
361 {
362 // Try to open the last opened project,
363 // if a project name is not given when starting Kicad
364 projToLoad = last_pro;
365 }
366 }
367
368 bool loaded = false;
369
370 // Do not attempt to load a non-existent project file.
371 if( !projToLoad.empty() )
372 {
373 wxFileName fn( projToLoad );
374
375 if( fn.Exists() && ( fn.GetExt() == FILEEXT::ProjectFileExtension
376 || fn.GetExt() == FILEEXT::LegacyProjectFileExtension ) )
377 {
378 fn.MakeAbsolute();
379
380 if( appType == KICAD_MAIN_FRAME_T )
381 loaded = managerFrame->LoadProject( fn );
382 }
383 }
384
385 if( !loaded && appType == KICAD_MAIN_FRAME_T )
386 managerFrame->PreloadAllLibraries();
387 }
388
389 frame->Show( true );
390 frame->Raise();
391
392#ifdef KICAD_IPC_API
393 m_api_server->SetReadyToReply();
394#endif
395
396 return true;
397}
398
399
401{
402 return 0;
403}
404
405
407{
408 // Abort and wait on any background jobs
409 GetKiCadThreadPool().purge();
410 GetKiCadThreadPool().wait();
411
412 Kiway.OnKiwayEnd();
413
414#ifdef KICAD_IPC_API
415 m_api_server.reset();
416#endif
417
419 {
421 m_settings_manager->Save();
422 }
423
424 // Destroy everything in PGM_KICAD,
425 // especially wxSingleInstanceCheckerImpl earlier than wxApp and earlier
426 // than static destruction would.
427 Destroy();
429 delete GetGitBackend();
430 SetGitBackend( nullptr );
431}
432
433
434void PGM_KICAD::MacOpenFile( const wxString& aFileName )
435{
436#if defined(__WXMAC__)
437
438 KICAD_MANAGER_FRAME* frame = (KICAD_MANAGER_FRAME*) App().GetTopWindow();
439
440 if( !aFileName.empty() && wxFileExists( aFileName ) )
441 frame->LoadProject( wxFileName( aFileName ) );
442
443#endif
444}
445
446
448{
449 // unlike a normal destructor, this is designed to be called more
450 // than once safely:
451
452 m_bm.End();
453
455}
456
457
459
460#ifdef NDEBUG
461// Define a custom assertion handler
462void CustomAssertHandler(const wxString& file,
463 int line,
464 const wxString& func,
465 const wxString& cond,
466 const wxString& msg)
467{
468 Pgm().HandleAssert( file, line, func, cond, msg );
469}
470#endif
471
475struct APP_KICAD : public wxApp
476{
477 APP_KICAD() : wxApp()
478 {
479 SetPgm( &program );
480
481 // Init the environment each platform wants
483 }
484
485
486 bool OnInit() override
487 {
488#ifdef NDEBUG
489 // These checks generate extra assert noise
490 wxSizerFlags::DisableConsistencyChecks();
491 wxDISABLE_DEBUG_SUPPORT();
492 wxSetAssertHandler( CustomAssertHandler );
493#endif
494
495 // Perform platform-specific init tasks
496 if( !KIPLATFORM::APP::Init() )
497 return false;
498
499#ifndef DEBUG
500 // Enable logging traces to the console in release build.
501 // This is usually disabled, but it can be useful for users to run to help
502 // debug issues and other problems.
503 if( wxGetEnv( wxS( "KICAD_ENABLE_WXTRACE" ), nullptr ) )
504 {
505 wxLog::EnableLogging( true );
506 wxLog::SetLogLevel( wxLOG_Trace );
507 }
508#endif
509
510 if( !program.OnPgmInit() )
511 {
512 program.OnPgmExit();
513 return false;
514 }
515
516 return true;
517 }
518
519 int OnExit() override
520 {
521 program.OnPgmExit();
522
523 // Avoid wxLog crashing when used in destructors.
524 wxLog::EnableLogging( false );
525
526 return wxApp::OnExit();
527 }
528
529
530 int OnRun() override
531 {
532 try
533 {
534 return wxApp::OnRun();
535 }
536 catch(...)
537 {
538 Pgm().HandleException( std::current_exception() );
539 }
540
541 return -1;
542 }
543
544
545 void OnUnhandledException() override
546 {
547 Pgm().HandleException( std::current_exception(), true );
548 }
549
550
551 int FilterEvent( wxEvent& aEvent ) override
552 {
553 if( aEvent.GetEventType() == wxEVT_SHOW )
554 {
555 wxShowEvent& event = static_cast<wxShowEvent&>( aEvent );
556 wxDialog* dialog = dynamic_cast<wxDialog*>( event.GetEventObject() );
557
558 std::vector<void*>& dlgs = Pgm().m_ModalDialogs;
559
560 if( dialog )
561 {
562 if( event.IsShown() && dialog->IsModal() )
563 {
564 dlgs.push_back( dialog );
565 }
566 // Under GTK, sometimes the modal flag is cleared before hiding
567 else if( !event.IsShown() && !dlgs.empty() )
568 {
569 // If we close the expected dialog, remove it from our stack
570 if( dlgs.back() == dialog )
571 dlgs.pop_back();
572 // If an out-of-order, remove all dialogs added after the closed one
573 else if( auto it = std::find( dlgs.begin(), dlgs.end(), dialog ) ; it != dlgs.end() )
574 dlgs.erase( it, dlgs.end() );
575 }
576 }
577 }
578
579 return Event_Skip;
580 }
581
582#if defined( DEBUG )
586 bool ProcessEvent( wxEvent& aEvent ) override
587 {
588 if( aEvent.GetEventType() == wxEVT_CHAR || aEvent.GetEventType() == wxEVT_CHAR_HOOK )
589 {
590 wxKeyEvent* keyEvent = static_cast<wxKeyEvent*>( &aEvent );
591
592 if( keyEvent )
593 {
594 wxLogTrace( kicadTraceKeyEvent, "APP_KICAD::ProcessEvent %s", dump( *keyEvent ) );
595 }
596 }
597
598 aEvent.Skip();
599 return false;
600 }
601
609 bool OnExceptionInMainLoop() override
610 {
611 try
612 {
613 throw;
614 }
615 catch(...)
616 {
617 Pgm().HandleException( std::current_exception() );
618 }
619
620 return false; // continue on. Return false to abort program
621 }
622#endif
623
629#if defined( __WXMAC__ )
630 void MacOpenFile( const wxString& aFileName ) override
631 {
632 Pgm().MacOpenFile( aFileName );
633 }
634#endif
635};
636
637IMPLEMENT_APP( APP_KICAD )
638
639
640// The C++ project manager supports one open PROJECT, so Prj() calls within
641// this link image need this function.
643{
644 return Kiway.Prj();
645}
646
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:295
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 wxApp & App()
Return a bare naked wxApp which may come from wxPython, SINGLE_TOP, or kicad.exe.
Definition pgm_base.cpp:206
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:185
bool InitPgm(bool aHeadless=false, bool aSkipPyInit=false, bool aIsUnitTest=false)
Initialize this program.
Definition pgm_base.cpp:322
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::vector< void * > m_ModalDialogs
Definition pgm_base.h:392
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:131
void HideSplash()
Definition pgm_base.cpp:311
virtual LIBRARY_MANAGER & GetLibraryManager() const
Definition pgm_base.h:133
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:93
void Destroy()
Definition kicad.cpp:447
void MacOpenFile(const wxString &aFileName) override
Specific to MacOSX (not used under Linux or Windows).
Definition kicad.cpp:434
void OnPgmExit()
Definition kicad.cpp:406
APP_SETTINGS_BASE * PgmSettings()
Definition pgm_kicad.h:59
int OnPgmRun()
Definition kicad.cpp:400
BIN_MOD m_bm
Definition pgm_kicad.h:72
Container for project specific data.
Definition project.h:65
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)
void DisplayErrorMessage(wxWindow *aParent, const wxString &aText, const wxString &aExtraInfo)
Display an error message with aMessage.
Definition confirm.cpp:202
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:87
PROJECT & Prj()
Definition kicad.cpp:642
static PGM_KICAD program
Definition kicad.cpp:85
KIFACE_BASE & Kiface()
Global KIFACE_BASE "get" accessor.
Definition kicad.cpp:74
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 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:476
int OnRun() override
Definition kicad.cpp:530
APP_KICAD()
Definition kicad.cpp:477
bool OnInit() override
Definition kicad.cpp:486
int OnExit() override
Definition kicad.cpp:519
void OnUnhandledException() override
Definition kicad.cpp:545
int FilterEvent(wxEvent &aEvent) override
Definition kicad.cpp:551
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.