KiCad PCB EDA Suite
Loading...
Searching...
No Matches
pgm_base.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 (C) 2008 Wayne Stambaugh <[email protected]>
6 * Copyright The KiCad Developers, see AUTHORS.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
32
33#include <wx/html/htmlwin.h>
34#include <wx/fs_zip.h>
35#include <wx/dir.h>
36#include <wx/filename.h>
37#include <wx/msgdlg.h>
38#include <wx/propgrid/propgrid.h>
39#include <wx/snglinst.h>
40#include <wx/stdpaths.h>
41#include <wx/sysopt.h>
42#include <wx/filedlg.h>
43#include <wx/ffile.h>
44#include <wx/tooltip.h>
45
46#include <advanced_config.h>
47#include <app_monitor.h>
49#include <bitmaps.h>
50#include <build_version.h>
51#include <common.h>
52#include <confirm.h>
53#include <core/arraydim.h>
54#include <id.h>
56#include <kiplatform/policy.h>
58#include <macros.h>
60#include <paths.h>
61#include <pgm_base.h>
63#include <policy_keys.h>
64#include <python_scripting.h>
67#include <string_utils.h>
68#include <systemdirsappend.h>
69#include <thread_pool.h>
70#include <trace_helpers.h>
71
72#include <widgets/kistatusbar.h>
73#include <widgets/wx_splash.h>
74
75#ifdef KICAD_IPC_API
77#include <api/api_server.h>
78#include <python_manager.h>
79#endif
80
81#ifdef _MSC_VER
82#include <winrt/base.h>
83#endif
93#undef _
94#define _(s) s
96{
97 { wxLANGUAGE_DEFAULT, ID_LANGUAGE_DEFAULT, _( "Default" ), false },
98 { wxLANGUAGE_ARABIC, ID_LANGUAGE_ARABIC, wxT( "العربية" ), true },
99 { wxLANGUAGE_INDONESIAN, ID_LANGUAGE_INDONESIAN, wxT( "Bahasa Indonesia" ), true },
100 { wxLANGUAGE_BULGARIAN, ID_LANGUAGE_BULGARIAN, wxT( "Български" ), true },
101 { wxLANGUAGE_CATALAN, ID_LANGUAGE_CATALAN, wxT( "Català" ), true },
102 { wxLANGUAGE_CZECH, ID_LANGUAGE_CZECH, wxT( "Čeština" ), true },
103 { wxLANGUAGE_DANISH, ID_LANGUAGE_DANISH, wxT( "Dansk" ), true },
104 { wxLANGUAGE_GERMAN, ID_LANGUAGE_GERMAN, wxT( "Deutsch" ), true },
105 { wxLANGUAGE_GREEK, ID_LANGUAGE_GREEK, wxT( "Ελληνικά" ), true },
106 { wxLANGUAGE_ENGLISH, ID_LANGUAGE_ENGLISH, wxT( "English" ), true },
107 { wxLANGUAGE_SPANISH, ID_LANGUAGE_SPANISH, wxT( "Español" ), true },
108 { wxLANGUAGE_SPANISH_MEXICAN, ID_LANGUAGE_SPANISH_MEXICAN,
109 wxT( "Español (Latinoamericano)" ), true },
110 { wxLANGUAGE_FRENCH, ID_LANGUAGE_FRENCH, wxT( "Français" ), true },
111 { wxLANGUAGE_HEBREW, ID_LANGUAGE_HEBREW, wxT( "עברית" ), true },
112 { wxLANGUAGE_KOREAN, ID_LANGUAGE_KOREAN, wxT( "한국어"), true },
113 { wxLANGUAGE_ITALIAN, ID_LANGUAGE_ITALIAN, wxT( "Italiano" ), true },
114 { wxLANGUAGE_LATVIAN, ID_LANGUAGE_LATVIAN, wxT( "Latviešu" ), true },
115 { wxLANGUAGE_LITHUANIAN, ID_LANGUAGE_LITHUANIAN, wxT( "Lietuvių" ), true },
116 { wxLANGUAGE_HUNGARIAN, ID_LANGUAGE_HUNGARIAN, wxT( "Magyar" ), true },
117 { wxLANGUAGE_DUTCH, ID_LANGUAGE_DUTCH, wxT( "Nederlands" ), true },
118 { wxLANGUAGE_NORWEGIAN_BOKMAL, ID_LANGUAGE_NORWEGIAN_BOKMAL, wxT( "Norsk Bokmål" ), true },
119 { wxLANGUAGE_JAPANESE, ID_LANGUAGE_JAPANESE, wxT( "日本語" ), true },
120 { wxLANGUAGE_THAI, ID_LANGUAGE_THAI, wxT( "ภาษาไทย" ), true },
121 { wxLANGUAGE_POLISH, ID_LANGUAGE_POLISH, wxT( "Polski" ), true },
122 { wxLANGUAGE_PORTUGUESE, ID_LANGUAGE_PORTUGUESE, wxT( "Português" ),true },
123 { wxLANGUAGE_PORTUGUESE_BRAZILIAN, ID_LANGUAGE_PORTUGUESE_BRAZILIAN,
124 wxT( "Português (Brasil)" ), true },
125 { wxLANGUAGE_ROMANIAN, ID_LANGUAGE_ROMANIAN, wxT( "Română" ), true },
126 { wxLANGUAGE_RUSSIAN, ID_LANGUAGE_RUSSIAN, wxT( "Русский" ), true },
127 { wxLANGUAGE_SERBIAN, ID_LANGUAGE_SERBIAN, wxT( "Српски" ), true },
128 { wxLANGUAGE_SLOVAK, ID_LANGUAGE_SLOVAK, wxT( "Slovenčina" ), true },
129 { wxLANGUAGE_SLOVENIAN, ID_LANGUAGE_SLOVENIAN, wxT( "Slovenščina" ), true },
130 { wxLANGUAGE_FINNISH, ID_LANGUAGE_FINNISH, wxT( "Suomi" ), true },
131 { wxLANGUAGE_SWEDISH, ID_LANGUAGE_SWEDISH, wxT( "Svenska" ), true },
132 { wxLANGUAGE_VIETNAMESE, ID_LANGUAGE_VIETNAMESE, wxT( "Tiếng Việt" ), true },
133 { wxLANGUAGE_TAMIL, ID_LANGUAGE_TAMIL, wxT( "தமிழ்" ), true },
134 { wxLANGUAGE_TURKISH, ID_LANGUAGE_TURKISH, wxT( "Türkçe" ), true },
135 { wxLANGUAGE_UKRAINIAN, ID_LANGUAGE_UKRAINIAN, wxT( "Українська" ), true },
136 { wxLANGUAGE_CHINESE_SIMPLIFIED, ID_LANGUAGE_CHINESE_SIMPLIFIED,
137 wxT( "简体中文" ), true },
138 { wxLANGUAGE_CHINESE_TRADITIONAL, ID_LANGUAGE_CHINESE_TRADITIONAL,
139 wxT( "繁體中文" ), true },
140 { 0, 0, "", false } // Sentinel
141};
142#undef _
143#define _(s) wxGetTranslation((s))
144
145
147{
148 return *m_singleton.m_ThreadPool;
149}
150
151
153{
154 m_locale = nullptr;
155 m_Printing = false;
156 m_Quitting = false;
157 m_argcUtf8 = 0;
158 m_argvUtf8 = nullptr;
159 m_splash = nullptr;
161
162 setLanguageId( wxLANGUAGE_DEFAULT );
163
164 ForceSystemPdfBrowser( false );
165}
166
167
169{
170 HideSplash();
171 Destroy();
172
173 for( int n = 0; n < m_argcUtf8; n++ )
174 {
175 free( m_argvUtf8[n] );
176 }
177
178 delete[] m_argvUtf8;
179
180 delete m_locale;
181 m_locale = nullptr;
182}
183
184
186{
188
190
191 m_pgm_checker.reset();
192
193#ifdef _MSC_VER
194 winrt::uninit_apartment();
195#endif
196
197 // Shut down the thread pool explicitly here, before static destruction begins.
198 // On macOS, if the thread pool destructor runs during static destruction
199 // (via __cxa_finalize_ranges), the condition variables may be in an invalid state,
200 // causing a crash. By destroying the thread pool here, we ensure it's cleaned up
201 // while the C++ runtime is still in a valid state.
202 m_singleton.Shutdown();
203}
204
205
207{
208 wxASSERT( wxTheApp );
209 return *wxTheApp;
210}
211
212
213void PGM_BASE::SetTextEditor( const wxString& aFileName )
214{
215 m_text_editor = aFileName;
217}
218
219
220const wxString& PGM_BASE::GetTextEditor( bool aCanShowFileChooser )
221{
222 wxString editorname = m_text_editor;
223
224 if( !editorname )
225 {
226 if( !wxGetEnv( wxT( "EDITOR" ), &editorname ) )
227 {
228 // If there is no EDITOR variable set, try the desktop default
229#ifdef __WXMAC__
230 editorname = wxT( "/usr/bin/open -e" );
231#elif __WXX11__
232 editorname = wxT( "/usr/bin/xdg-open" );
233#endif
234 }
235 }
236
237 // If we still don't have an editor name show a dialog asking the user to select one
238 if( !editorname && aCanShowFileChooser )
239 {
240 DisplayInfoMessage( nullptr, _( "No default editor found, you must choose one." ) );
241
242 editorname = AskUserForPreferredEditor();
243 }
244
245 // If we finally have a new editor name request it to be copied to m_text_editor and
246 // saved to the preferences file.
247 if( !editorname.IsEmpty() )
248 SetTextEditor( editorname );
249
250 // m_text_editor already has the same value that editorname, or empty if no editor was
251 // found/chosen.
252 return m_text_editor;
253}
254
255
256const wxString PGM_BASE::AskUserForPreferredEditor( const wxString& aDefaultEditor )
257{
258 // Create a mask representing the executable files in the current platform
259#ifdef __WINDOWS__
260 wxString mask( _( "Executable file" ) + wxT( " (*.exe)|*.exe" ) );
261#else
262 wxString mask( _( "Executable file" ) + wxT( " (*)|*" ) );
263#endif
264
265 // Extract the path, name and extension from the default editor (even if the editor's
266 // name was empty, this method will succeed and return empty strings).
267 wxString path, name, ext;
268 wxFileName::SplitPath( aDefaultEditor, &path, &name, &ext );
269
270 // Show the modal editor and return the file chosen (may be empty if the user cancels
271 // the dialog).
272 return wxFileSelector( _( "Select Preferred Editor" ), path, name, wxT( "." ) + ext,
273 mask, wxFD_OPEN | wxFD_FILE_MUST_EXIST, nullptr );
274}
275
276
278{
279 const wxArrayString& argArray = App().argv.GetArguments();
280 m_argcUtf8 = argArray.size();
281
282 m_argvUtf8 = new char*[m_argcUtf8 + 1];
283 for( int n = 0; n < m_argcUtf8; n++ )
284 {
285 m_argvUtf8[n] = wxStrdup( argArray[n].ToUTF8() );
286 }
287
288 m_argvUtf8[m_argcUtf8] = NULL; // null terminator at end of argv
289}
290
291
293{
294 // Disabling until we change to load each DSO at startup rather than lazy-load when needed.
295 // Note that once the splash screen is re-enabled, there are some remaining bugs to fix:
296 // Any wxWidgets error dialogs that appear during startup are hidden by the splash screen,
297 // so we either need to prevent these from happening (probably not feasible) or else change
298 // the error-handling path to make sure errors go on top of the splash.
299#if 0
300 if( m_splash )
301 return;
302
303 m_splash = new WX_SPLASH( KiBitmap( BITMAPS::splash ), wxSPLASH_CENTRE_ON_SCREEN, 0,
304 NULL, -1, wxDefaultPosition, wxDefaultSize,
305 wxBORDER_NONE | wxSTAY_ON_TOP );
306 wxYield();
307#endif
308}
309
310
312{
313 if( !m_splash )
314 return;
315
316 m_splash->Close( true );
317 m_splash->Destroy();
318 m_splash = nullptr;
319}
320
321
322bool PGM_BASE::InitPgm( bool aHeadless, bool aSkipPyInit, bool aIsUnitTest )
323{
324#if defined( __WXMAC__ )
325 // Set the application locale to the system default
326 wxLogNull noLog;
327 wxLocale loc;
328 loc.Init();
329#endif
330
331 // Just make sure we init precreate any folders early for later code
332 // In particular, the user cache path is the most likely to be hit by startup code
334
336
338
339 // Initialize the singleton instance
340 m_singleton.Init();
341
342 wxString pgm_name;
343
345 if( App().argc == 0 )
346 pgm_name = wxT( "kicad" );
347 else
348 pgm_name = wxFileName( App().argv[0] ).GetName().Lower();
349
350 APP_MONITOR::SENTRY::Instance()->AddTag( "kicad.app", pgm_name );
351
352 wxInitAllImageHandlers();
353
354#if !wxCHECK_VERSION( 3, 3, 0 )
355 // Without this the wxPropertyGridManager segfaults on Windows.
356 if( !wxPGGlobalVars )
357 wxPGInitResourceModule();
358#endif
359
360#ifndef __WINDOWS__
361 if( wxString( wxGetenv( "HOME" ) ).IsEmpty() )
362 {
363 DisplayErrorMessage( nullptr, _( "Environment variable HOME is empty. "
364 "Unable to continue." ) );
365 return false;
366 }
367#endif
368
369 // Ensure the instance checker directory exists
370 // It should be globally writable because it is shared between all users on Linux, and so on a
371 // multi-user machine, other need to be able to access it to check for the lock files or make
372 // their own lock files.
373 wxString instanceCheckerDir = PATHS::GetInstanceCheckerPath();
374 PATHS::EnsurePathExists( instanceCheckerDir );
375 wxChmod( instanceCheckerDir,
376 wxPOSIX_USER_READ | wxPOSIX_USER_WRITE | wxPOSIX_USER_EXECUTE |
377 wxPOSIX_GROUP_READ | wxPOSIX_GROUP_WRITE | wxPOSIX_GROUP_EXECUTE |
378 wxPOSIX_OTHERS_READ | wxPOSIX_OTHERS_WRITE | wxPOSIX_OTHERS_EXECUTE );
379
380 wxString instanceCheckerName = wxString::Format( wxS( "%s-%s" ), pgm_name,
382
383 m_pgm_checker = std::make_unique<wxSingleInstanceChecker>();
384 m_pgm_checker->Create( instanceCheckerName, instanceCheckerDir );
385
386 // Init KiCad environment
387 // the environment variable KICAD (if exists) gives the kicad path:
388 // something like set KICAD=d:\kicad
389 bool isDefined = wxGetEnv( wxT( "KICAD" ), &m_kicad_env );
390
391 if( isDefined ) // ensure m_kicad_env ends by "/"
392 {
394
395 if( !m_kicad_env.IsEmpty() && m_kicad_env.Last() != '/' )
397 }
398
399 // Init parameters for configuration
400 App().SetVendorName( wxT( "KiCad" ) );
401 App().SetAppName( pgm_name );
402
403 // Analyze the command line & initialize the binary path
404 wxString tmp;
406 SetDefaultLanguage( tmp );
407
408#ifdef _MSC_VER
409 if( !wxGetEnv( "FONTCONFIG_PATH", NULL ) )
410 {
411 // We need to set this because the internal fontconfig logic
412 // seems to search relative to the dll rather the other logic it
413 // has to look for the /etc folder above the dll
414 // Also don't set it because we need it in QA cli tests to be set by ctest
415 wxSetEnv( "FONTCONFIG_PATH", PATHS::GetWindowsFontConfigDir() );
416 }
417#endif
418
419#ifdef _MSC_VER
420 winrt::init_apartment(winrt::apartment_type::single_threaded);
421#endif
422
423 m_settings_manager = std::make_unique<SETTINGS_MANAGER>();
424 m_library_manager = std::make_unique<LIBRARY_MANAGER>();
425 m_background_jobs_monitor = std::make_unique<BACKGROUND_JOBS_MONITOR>();
426 m_notifications_manager = std::make_unique<NOTIFICATIONS_MANAGER>();
427
428#ifdef KICAD_IPC_API
429 m_plugin_manager = std::make_unique<API_PLUGIN_MANAGER>( &App() );
430#endif
431
432 // Our unit test mocks break if we continue
433 // A bug caused InitPgm to terminate early in unit tests and the mocks are...simplistic
434 // TODO fix the unit tests so this can be removed
435 if( aIsUnitTest )
436 return false;
437
438 // Something got in the way of settings load: can't continue
439 if( !m_settings_manager->IsOK() )
440 return false;
441
442 // Set up built-in environment variables (and override them from the system environment if set)
443 COMMON_SETTINGS* commonSettings = GetCommonSettings();
444 commonSettings->InitializeEnvironment();
445
446 // Load color settings after env is initialized
447 m_settings_manager->ReloadColorSettings();
448
449 // Load common settings from disk after setting up env vars
450 GetSettingsManager().Load( commonSettings );
451
452#ifdef KICAD_IPC_API
453 // If user doesn't have a saved Python interpreter, try (potentially again) to find one
454 if( commonSettings->m_Api.python_interpreter.IsEmpty() )
455 commonSettings->m_Api.python_interpreter = PYTHON_MANAGER::FindPythonInterpreter();
456#endif
457
458 // Init user language *before* calling loadSettings, because
459 // env vars could be incorrectly initialized on Linux
460 // (if the value contains some non ASCII7 chars, the env var is not initialized)
461 SetLanguage( tmp, true );
462
463 // Now that translations are available, inform the user if the OS is unsupported
465
467
468 ReadPdfBrowserInfos(); // needs GetCommonSettings()
469
471
472 // Create the python scripting stuff
473 // Skip it for applications that do not use it
474 if( !aSkipPyInit )
475 m_python_scripting = std::make_unique<SCRIPTING>();
476
477 // TODO(JE): Remove this if apps are refactored to not assume Prj() always works
478 // Need to create a project early for now (it can have an empty path for the moment)
480
481#ifdef KICAD_IPC_API
482 if( commonSettings->m_Api.enable_server )
483 m_plugin_manager->ReloadPlugins();
484#endif
485
486 // This sets the maximum tooltip display duration to 10s (up from 5) but only affects
487 // Windows as other platforms display tooltips while the mouse is not moving
488 if( !aHeadless )
489 {
490 wxToolTip::Enable( true );
491 wxToolTip::SetAutoPop( 10000 );
492 }
493
494 if( ADVANCED_CFG::GetCfg().m_UpdateUIEventInterval != 0 )
495 wxUpdateUIEvent::SetUpdateInterval( ADVANCED_CFG::GetCfg().m_UpdateUIEventInterval );
496
497 // Now the application can safely start, show the splash screen
498 if( !aHeadless )
499 ShowSplash();
500
501 return true;
502}
503
504
506{
508
509 for( const std::pair<wxString, ENV_VAR_ITEM> it : GetCommonSettings()->m_Env.vars )
510 {
511 wxLogTrace( traceEnvVars, wxT( "PGM_BASE::loadSettings: Found entry %s = %s" ),
512 it.first, it.second.GetValue() );
513
514 // Do not store the env var PROJECT_VAR_NAME ("KIPRJMOD") definition if for some reason
515 // it is found in config. (It is reserved and defined as project path)
516 if( it.first == PROJECT_VAR_NAME )
517 continue;
518
519 // Don't set bogus empty entries in the environment
520 if( it.first.IsEmpty() )
521 continue;
522
523 // Do not overwrite vars set by the system environment with values from the settings file
524 if( it.second.GetDefinedExternally() )
525 continue;
526
527 SetLocalEnvVariable( it.first, it.second.GetValue() );
528 }
529}
530
531
533{
534 // GetCommonSettings() is not initialized until fairly late in the
535 // process startup: InitPgm(), so test before using:
536 if( GetCommonSettings() )
537 GetCommonSettings()->m_System.working_dir = wxGetCwd();
538}
539
540
542{
543 return m_settings_manager ? m_settings_manager->GetCommonSettings() : nullptr;
544}
545
546
547bool PGM_BASE::SetLanguage( wxString& aErrMsg, bool first_time )
548{
549 // Suppress wxWidgets error popups if locale is not found
550 wxLogNull doNotLog;
551
552 if( first_time )
553 {
554 setLanguageId( wxLANGUAGE_DEFAULT );
555
556 // First time SetLanguage is called, the user selected language id is set
557 // from common user config settings
558 wxString languageSel = GetCommonSettings()->m_System.language;
559
560 // Search for the current selection
561 for( unsigned ii = 0; LanguagesList[ii].m_KI_Lang_Identifier != 0; ii++ )
562 {
563 if( LanguagesList[ii].m_Lang_Label == languageSel )
564 {
565 setLanguageId( LanguagesList[ii].m_WX_Lang_Identifier );
566 break;
567 }
568 }
569 }
570
571 // dictionary file name without extend (full name is kicad.mo)
572 wxString dictionaryName( wxT( "kicad" ) );
573
574 delete m_locale;
575 m_locale = new wxLocale;
576
577 // don't use wxLOCALE_LOAD_DEFAULT flag so that Init() doesn't return
578 // false just because it failed to load wxstd catalog
579 if( !m_locale->Init( m_language_id ) )
580 {
581 wxLogTrace( traceLocale, wxT( "This language is not supported by the system." ) );
582
583 setLanguageId( wxLANGUAGE_DEFAULT );
584 delete m_locale;
585
586 m_locale = new wxLocale;
587 m_locale->Init( wxLANGUAGE_DEFAULT );
588
589 aErrMsg = _( "This language is not supported by the operating system." );
590 return false;
591 }
592 else if( !first_time )
593 {
594 wxLogTrace( traceLocale, wxT( "Search for dictionary %s.mo in %s" ) ,
595 dictionaryName, m_locale->GetName() );
596 }
597
598 if( !first_time )
599 {
600 // If we are here, the user has selected another language.
601 // Therefore the new preferred language name is stored in common config.
602 // Do NOT store the wxWidgets language Id, it can change between wxWidgets
603 // versions, for a given language
604 wxString languageSel;
605
606 // Search for the current selection language name
607 for( unsigned ii = 0; LanguagesList[ii].m_KI_Lang_Identifier != 0; ii++ )
608 {
609 if( LanguagesList[ii].m_WX_Lang_Identifier == m_language_id )
610 {
611 languageSel = LanguagesList[ii].m_Lang_Label;
612 break;
613 }
614 }
615
617 cfg->m_System.language = languageSel;
618 cfg->SaveToFile( GetSettingsManager().GetPathForSettingsFile( cfg ) );
619 }
620
621 // Try adding the dictionary if it is not currently loaded
622 if( !m_locale->IsLoaded( dictionaryName ) )
623 m_locale->AddCatalog( dictionaryName );
624
625 // Verify the Kicad dictionary was loaded properly
626 // However, for the English language, the dictionary is not mandatory, as
627 // all messages are already in English, just restricted to ASCII7 chars,
628 // the verification is skipped.
629 if( !m_locale->IsLoaded( dictionaryName ) && m_language_id != wxLANGUAGE_ENGLISH )
630 {
631 wxLogTrace( traceLocale, wxT( "Unable to load dictionary %s.mo in %s" ),
632 dictionaryName, m_locale->GetName() );
633
634 setLanguageId( wxLANGUAGE_DEFAULT );
635 delete m_locale;
636
637 m_locale = new wxLocale;
638 m_locale->Init( wxLANGUAGE_DEFAULT );
639
640 aErrMsg = _( "The KiCad language file for this language is not installed." );
641 return false;
642 }
643
644 return true;
645}
646
647
648bool PGM_BASE::SetDefaultLanguage( wxString& aErrMsg )
649{
650 // Suppress error popups from wxLocale
651 wxLogNull doNotLog;
652
653 setLanguageId( wxLANGUAGE_DEFAULT );
654
655 // dictionary file name without extend (full name is kicad.mo)
656 wxString dictionaryName( wxT( "kicad" ) );
657
658 delete m_locale;
659 m_locale = new wxLocale;
660 m_locale->Init();
661
662 // Try adding the dictionary if it is not currently loaded
663 if( !m_locale->IsLoaded( dictionaryName ) )
664 m_locale->AddCatalog( dictionaryName );
665
666 // Verify the Kicad dictionary was loaded properly
667 // However, for the English language, the dictionary is not mandatory, as
668 // all messages are already in English, just restricted to ASCII7 chars,
669 // the verification is skipped.
670 if( !m_locale->IsLoaded( dictionaryName ) && m_language_id != wxLANGUAGE_ENGLISH )
671 {
672 wxLogTrace( traceLocale, wxT( "Unable to load dictionary %s.mo in %s" ),
673 dictionaryName, m_locale->GetName() );
674
675 setLanguageId( wxLANGUAGE_DEFAULT );
676 delete m_locale;
677
678 m_locale = new wxLocale;
679 m_locale->Init();
680
681 aErrMsg = _( "The KiCad language file for this language is not installed." );
682 return false;
683 }
684
685 return true;
686}
687
688
690{
691 wxLogTrace( traceLocale, wxT( "Select language ID %d from %d possible languages." ),
692 menu_id, (int)arrayDim( LanguagesList )-1 );
693
694 for( unsigned ii = 0; LanguagesList[ii].m_KI_Lang_Identifier != 0; ii++ )
695 {
696 if( menu_id == LanguagesList[ii].m_KI_Lang_Identifier )
697 {
698 setLanguageId( LanguagesList[ii].m_WX_Lang_Identifier );
699 break;
700 }
701 }
702}
703
704
706{
707 const wxLanguageInfo* langInfo = wxLocale::GetLanguageInfo( m_language_id );
708
709 if( !langInfo )
710 {
711 return "";
712 }
713 else
714 {
715 wxString str = langInfo->GetCanonicalWithRegion();
716 str.Replace( "_", "-" );
717
718 return str;
719 }
720}
721
722
724{
725#ifdef _MSC_VER
726 wxLocale::AddCatalogLookupPathPrefix( PATHS::GetWindowsBaseSharePath() + wxT( "locale" ) );
727#endif
728 wxLocale::AddCatalogLookupPathPrefix( PATHS::GetLocaleDataPath() );
729
730 if( wxGetEnv( wxT( "KICAD_RUN_FROM_BUILD_DIR" ), nullptr ) )
731 {
732 wxFileName fn( Pgm().GetExecutablePath() );
733 fn.RemoveLastDir();
734 fn.AppendDir( wxT( "translation" ) );
735 wxLocale::AddCatalogLookupPathPrefix( fn.GetPath() );
736 }
737}
738
739
740bool PGM_BASE::SetLocalEnvVariable( const wxString& aName, const wxString& aValue )
741{
742 wxString env;
743
744 if( aName.IsEmpty() )
745 {
746 wxLogTrace( traceEnvVars,
747 wxT( "PGM_BASE::SetLocalEnvVariable: Attempt to set empty variable to "
748 "value %s" ),
749 aValue );
750 return false;
751 }
752
753 // Check to see if the environment variable is already set.
754 if( wxGetEnv( aName, &env ) )
755 {
756 wxLogTrace( traceEnvVars,
757 wxT( "PGM_BASE::SetLocalEnvVariable: Environment variable %s already set "
758 "to %s" ),
759 aName, env );
760 return env == aValue;
761 }
762
763 wxLogTrace( traceEnvVars,
764 wxT( "PGM_BASE::SetLocalEnvVariable: Setting local environment variable %s to %s" ),
765 aName, aValue );
766
767 return wxSetEnv( aName, aValue );
768}
769
770
772{
773 // Overwrites externally defined environment variable until the next time the application
774 // is run.
775 for( const std::pair<wxString, ENV_VAR_ITEM> m_local_env_var : GetCommonSettings()->m_Env.vars )
776 {
777 wxLogTrace( traceEnvVars,
778 wxT( "PGM_BASE::SetLocalEnvVariables: Setting local environment variable %s "
779 "to %s" ),
780 m_local_env_var.first,
781 m_local_env_var.second.GetValue() );
782 wxSetEnv( m_local_env_var.first, m_local_env_var.second.GetValue() );
783 }
784}
785
786
791
792
794{
795 if( !wxTheApp )
796 return false;
797
798 return wxTheApp->IsGUI();
799}
800
801
802void PGM_BASE::HandleException( std::exception_ptr aPtr, bool aUnhandled )
803{
804 try
805 {
806 if( aPtr )
807 std::rethrow_exception( aPtr );
808 }
809 catch( const IO_ERROR& ioe )
810 {
811 wxLogError( ioe.What() );
812
813 if( aUnhandled )
814 {
815 // Log this IO_ERROR escaped our usual uses (bad)
816 APP_MONITOR::SENTRY::Instance()->LogException( ioe.What(), aUnhandled );
817 }
818 }
819 catch( const std::exception& e )
820 {
821 APP_MONITOR::SENTRY::Instance()->LogException( e.what(), aUnhandled );
822
823 wxLogError( wxT( "Unhandled exception class: %s what: %s" ),
824 From_UTF8( typeid( e ).name() ), From_UTF8( e.what() ) );
825 }
826 catch( ... )
827 {
828 // We really shouldn't have these but just in case...
829 wxLogError( wxT( "Unhandled exception of unknown type" ) );
830
831 if( aUnhandled )
832 {
833 APP_MONITOR::SENTRY::Instance()->LogException( "Unhandled exception of unknown type", aUnhandled );
834 }
835 }
836}
837
838
839void PGM_BASE::HandleAssert( const wxString& aFile, int aLine, const wxString& aFunc,
840 const wxString& aCond, const wxString& aMsg )
841{
842 wxString assertStr;
843
844 // Log the assertion details to standard log
845 if( !aMsg.empty() )
846 {
847 assertStr = wxString::Format( "Assertion failed at %s:%d in %s: %s - %s", aFile, aLine,
848 aFunc, aCond, aMsg );
849 }
850 else
851 {
852 assertStr = wxString::Format( "Assertion failed at %s:%d in %s: %s", aFile, aLine, aFunc,
853 aCond );
854 }
855
856#ifndef NDEBUG
857 wxLogError( assertStr );
858#endif
859
860#ifdef KICAD_USE_SENTRY
861 APP_MONITOR::ASSERT_CACHE_KEY key = { aFile, aLine, aFunc, aCond };
862 APP_MONITOR::SENTRY::Instance()->LogAssert( key, assertStr );
863#endif
864}
865
866
867const wxString& PGM_BASE::GetExecutablePath() const
868{
870}
871
872
878
879
885
886
888{
889 // TODO(JE) much of this code can be shared across the 3 preloads
890 constexpr static int interval = 150;
891 constexpr static int timeLimit = 120000;
892
893 if( m_libraryPreloadInProgress.load() )
894 return;
895
897 Pgm().GetBackgroundJobMonitor().Create( _( "Loading Design Block Libraries" ) );
898
899 auto preload =
900 [this, aKiway]() -> void
901 {
902 std::shared_ptr<BACKGROUND_JOB_REPORTER> reporter =
904
905 DESIGN_BLOCK_LIBRARY_ADAPTER* adapter = aKiway->Prj().DesignBlockLibs();
906
907 int elapsed = 0;
908
909 reporter->Report( _( "Loading Design Block Libraries" ) );
910 adapter->AsyncLoad();
911
912 while( true )
913 {
914 if( m_libraryPreloadAbort.load() )
915 {
916 m_libraryPreloadAbort.store( false );
917 break;
918 }
919
920 std::this_thread::sleep_for( std::chrono::milliseconds( interval ) );
921
922 if( std::optional<float> loadStatus = adapter->AsyncLoadProgress() )
923 {
924 float progress = *loadStatus;
925 reporter->SetCurrentProgress( progress );
926
927 if( progress >= 1 )
928 break;
929 }
930 else
931 {
932 reporter->SetCurrentProgress( 1 );
933 break;
934 }
935
936 elapsed += interval;
937
938 if( elapsed > timeLimit )
939 break;
940 }
941
942 adapter->BlockUntilLoaded();
943
946 m_libraryPreloadInProgress.store( false );
947
948 std::string payload = "";
949 aKiway->ExpressMail( FRAME_SCH, MAIL_RELOAD_LIB, payload, nullptr, true );
950 aKiway->ExpressMail( FRAME_PCB_EDITOR, MAIL_RELOAD_LIB, payload, nullptr, true );
951 };
952
954 m_libraryPreloadInProgress.store( true );
955 m_libraryPreloadReturn = tp.submit_task( preload );
956}
957
958
960{
961 std::lock_guard<std::mutex> lock( m_libraryLoadStatusBarsMutex );
962
963 wxLogTrace( traceLibraries, "RegisterLibraryLoadStatusBar: statusBar=%p", aStatusBar );
964
965 if( std::find( m_libraryLoadStatusBars.begin(), m_libraryLoadStatusBars.end(), aStatusBar )
966 == m_libraryLoadStatusBars.end() )
967 {
968 m_libraryLoadStatusBars.push_back( aStatusBar );
969 wxLogTrace( traceLibraries, " -> registered, total count=%zu",
971 }
972 else
973 {
974 wxLogTrace( traceLibraries, " -> already registered" );
975 }
976}
977
978
980{
981 std::lock_guard<std::mutex> lock( m_libraryLoadStatusBarsMutex );
982
983 wxLogTrace( traceLibraries, "UnregisterLibraryLoadStatusBar: statusBar=%p", aStatusBar );
984
986 std::remove( m_libraryLoadStatusBars.begin(), m_libraryLoadStatusBars.end(),
987 aStatusBar ),
989
990 wxLogTrace( traceLibraries, " -> remaining count=%zu", m_libraryLoadStatusBars.size() );
991}
992
993
994void PGM_BASE::AddLibraryLoadMessages( const std::vector<LOAD_MESSAGE>& aMessages )
995{
996 wxLogTrace( traceLibraries, "AddLibraryLoadMessages: message_count=%zu", aMessages.size() );
997
998 if( aMessages.empty() )
999 return;
1000
1001 std::lock_guard<std::mutex> lock( m_libraryLoadStatusBarsMutex );
1002
1003 wxLogTrace( traceLibraries, " -> registered status bars=%zu",
1004 m_libraryLoadStatusBars.size() );
1005
1006 for( KISTATUSBAR* statusBar : m_libraryLoadStatusBars )
1007 {
1008 if( statusBar )
1009 {
1010 wxLogTrace( traceLibraries, " -> forwarding to statusBar=%p", statusBar );
1011 statusBar->AddLoadWarningMessages( aMessages );
1012 }
1013 }
1014}
1015
1016
1018{
1019 std::lock_guard<std::mutex> lock( m_libraryLoadStatusBarsMutex );
1020
1021 wxLogTrace( traceLibraries, "ClearLibraryLoadMessages: status bars=%zu",
1022 m_libraryLoadStatusBars.size() );
1023
1024 for( KISTATUSBAR* statusBar : m_libraryLoadStatusBars )
1025 {
1026 if( statusBar )
1027 statusBar->ClearLoadWarningMessages();
1028 }
1029}
1030
1031
1033
1034
1036{
1037 wxASSERT( process ); // KIFACE_GETTER has already been called.
1038 return *process;
1039}
1040
1041
1042// Similar to PGM_BASE& Pgm(), but return nullptr when a *.ki_face is run from a python script.
1044{
1045 return process;
1046}
1047
1048
1049void SetPgm( PGM_BASE* pgm )
1050{
1051 process = pgm;
1052}
const char * name
constexpr std::size_t arrayDim(T const (&)[N]) noexcept
Returns # of elements in an array.
Definition arraydim.h:31
wxBitmap KiBitmap(BITMAPS aBitmap, int aHeightTag)
Construct a wxBitmap from an image identifier Returns the image from the active theme if the image ha...
Definition bitmap.cpp:104
wxString GetMajorMinorVersion()
Get only the major and minor version in a string major.minor.
static const ADVANCED_CFG & GetCfg()
Get the singleton instance's config, which is shared by all consumers.
void LogAssert(const ASSERT_CACHE_KEY &aKey, const wxString &aMsg)
void LogException(const wxString &aMsg, bool aUnhandled)
void AddTag(const wxString &aKey, const wxString &aValue)
static SENTRY * Instance()
std::shared_ptr< BACKGROUND_JOB > Create(const wxString &aName)
Creates a background job with the given name.
void Remove(std::shared_ptr< BACKGROUND_JOB > job)
Removes the given background job from any lists and frees it.
void InitializeEnvironment()
Creates the built-in environment variables and sets their default values.
Hold an error message and may be used when throwing exceptions containing meaningful error messages.
virtual const wxString What() const
A composite of Problem() and Where()
virtual bool SaveToFile(const wxString &aDirectory="", bool aForce=false)
Calls Store() and then writes the contents of the JSON document to a file.
static void Cleanup()
Call curl_global_cleanup for the application.
static void Init()
Call curl_global_init for the application.
A minimalistic software bus for communications between various DLLs/DSOs (DSOs) within the same KiCad...
Definition kiway.h:295
virtual void ExpressMail(FRAME_T aDestination, MAIL_T aCommand, std::string &aPayload, wxWindow *aSource=nullptr, bool aFromOtherThread=false)
Send aPayload to aDestination from aSource.
Definition kiway.cpp:505
virtual PROJECT & Prj() const
Return the PROJECT associated with this KIWAY.
Definition kiway.cpp:207
std::optional< float > AsyncLoadProgress() const
Returns async load progress between 0.0 and 1.0, or nullopt if load is not in progress.
void AsyncLoad()
Loads all available libraries for this adapter type in the background.
void Load()
Load notifications stored from disk.
static wxString GetInstanceCheckerPath()
Gets the path used for wxSingleInstanceChecker lock files.
Definition paths.cpp:487
static void EnsureUserPathsExist()
Ensures/creates user default paths.
Definition paths.cpp:535
static bool EnsurePathExists(const wxString &aPath, bool aPathToFile=false)
Attempts to create a given path if it does not exist.
Definition paths.cpp:508
static wxString GetLocaleDataPath()
Gets the locales translation data path.
Definition paths.cpp:357
static const wxString & GetExecutablePath()
Definition paths.cpp:661
Container for data for KiCad programs.
Definition pgm_base.h:109
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:206
std::unique_ptr< NOTIFICATIONS_MANAGER > m_notifications_manager
Definition pgm_base.h:414
void PreloadDesignBlockLibraries(KIWAY *aKiway)
Starts a background job to preload the global and project design block libraries.
Definition pgm_base.cpp:887
int m_argcUtf8
Definition pgm_base.h:451
virtual ENV_VAR_MAP & GetLocalEnvVariables() const
Definition pgm_base.cpp:787
std::unique_ptr< LIBRARY_MANAGER > m_library_manager
Definition pgm_base.h:412
bool m_Printing
wxWidgets on MSW tends to crash if you spool up more than one print job at a time.
Definition pgm_base.h:390
void setLanguageId(int aId)
Trap all changes in here, simplifies debugging.
Definition pgm_base.h:403
std::unique_ptr< SETTINGS_MANAGER > m_settings_manager
Definition pgm_base.h:411
void loadCommonSettings()
Load internal settings from COMMON_SETTINGS.
Definition pgm_base.cpp:505
virtual void SetPdfBrowserName(const wxString &aFileName)
Definition pgm_base.h:186
std::vector< KISTATUSBAR * > m_libraryLoadStatusBars
Definition pgm_base.h:460
wxLocale * m_locale
Definition pgm_base.h:428
void Destroy()
Definition pgm_base.cpp:185
wxSplashScreen * m_splash
Definition pgm_base.h:453
virtual BACKGROUND_JOBS_MONITOR & GetBackgroundJobMonitor() const
Definition pgm_base.h:137
bool InitPgm(bool aHeadless=false, bool aSkipPyInit=false, bool aIsUnitTest=false)
Initialize this program.
Definition pgm_base.cpp:322
char ** m_argvUtf8
argv parameters converted to utf8 form because wxWidgets has opinions.
Definition pgm_base.h:449
BS::priority_thread_pool & GetThreadPool()
Definition pgm_base.cpp:146
void UnregisterLibraryLoadStatusBar(KISTATUSBAR *aStatusBar)
Unregister a status bar from receiving library load warning messages.
Definition pgm_base.cpp:979
virtual void ReadPdfBrowserInfos()
Read the PDF browser choice from the common configuration.
Definition pgm_base.cpp:873
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
bool IsGUI()
Determine if the application is running with a GUI.
Definition pgm_base.cpp:793
bool m_use_system_pdf_browser
Definition pgm_base.h:431
bool m_Quitting
Definition pgm_base.h:394
void RegisterLibraryLoadStatusBar(KISTATUSBAR *aStatusBar)
Register a status bar to receive library load warning messages.
Definition pgm_base.cpp:959
std::future< void > m_libraryPreloadReturn
Definition pgm_base.h:456
virtual NOTIFICATIONS_MANAGER & GetNotificationsManager() const
Definition pgm_base.h:142
std::shared_ptr< BACKGROUND_JOB > m_libraryPreloadBackgroundJob
Definition pgm_base.h:455
void BuildArgvUtf8()
Builds the UTF8 based argv variable.
Definition pgm_base.cpp:277
virtual const wxString & GetPdfBrowserName() const
Definition pgm_base.h:184
std::atomic_bool m_libraryPreloadAbort
Definition pgm_base.h:458
void ClearLibraryLoadMessages()
Clear library load messages from all registered status bars.
virtual void SetTextEditor(const wxString &aFileName)
Definition pgm_base.cpp:213
std::unique_ptr< wxSingleInstanceChecker > m_pgm_checker
Check if there is another copy of Kicad running at the same time.
Definition pgm_base.h:419
virtual bool SetLocalEnvVariable(const wxString &aName, const wxString &aValue)
Set the environment variable aName to aValue.
Definition pgm_base.cpp:740
wxString m_kicad_env
The KICAD system environment variable.
Definition pgm_base.h:426
virtual void ForceSystemPdfBrowser(bool aFlg)
Force the use of system PDF browser, even if a preferred PDF browser is set.
Definition pgm_base.h:201
virtual void SetLocalEnvVariables()
Update the local environment with the contents of the current ENV_VAR_MAP stored in the COMMON_SETTIN...
Definition pgm_base.cpp:771
virtual void SetLanguagePath()
Definition pgm_base.cpp:723
bool SetDefaultLanguage(wxString &aErrMsg)
Set the default language without reference to any preferences.
Definition pgm_base.cpp:648
void ShowSplash()
Definition pgm_base.cpp:292
wxString m_text_editor
Definition pgm_base.h:434
std::atomic_bool m_libraryPreloadInProgress
Definition pgm_base.h:457
virtual ~PGM_BASE()
Definition pgm_base.cpp:168
std::unique_ptr< SCRIPTING > m_python_scripting
Definition pgm_base.h:416
virtual void SetLanguageIdentifier(int menu_id)
Set in .m_language_id member the wxWidgets language identifier ID from the KiCad menu id (internal me...
Definition pgm_base.cpp:689
int m_language_id
Definition pgm_base.h:429
std::unique_ptr< BACKGROUND_JOBS_MONITOR > m_background_jobs_monitor
Definition pgm_base.h:413
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 wxString GetLanguageTag()
Definition pgm_base.cpp:705
virtual const wxString & GetTextEditor(bool aCanShowFileChooser=true)
Return the path to the preferred text editor application.
Definition pgm_base.cpp:220
virtual const wxString & GetExecutablePath() const
Definition pgm_base.cpp:867
void AddLibraryLoadMessages(const std::vector< LOAD_MESSAGE > &aMessages)
Add library load messages to all registered status bars.
Definition pgm_base.cpp:994
virtual SETTINGS_MANAGER & GetSettingsManager() const
Definition pgm_base.h:131
void HideSplash()
Definition pgm_base.cpp:311
virtual void WritePdfBrowserInfos()
Save the PDF browser choice to the common configuration.
Definition pgm_base.cpp:880
void SaveCommonSettings()
Save the program (process) settings subset which are stored .kicad_common.
Definition pgm_base.cpp:532
bool m_PropertyGridInitialized
Definition pgm_base.h:396
KICAD_SINGLETON m_singleton
Definition pgm_base.h:436
std::mutex m_libraryLoadStatusBarsMutex
Definition pgm_base.h:461
virtual const wxString AskUserForPreferredEditor(const wxString &aDefaultEditor=wxEmptyString)
Show a dialog that instructs the user to select a new preferred editor.
Definition pgm_base.cpp:256
virtual bool SetLanguage(wxString &aErrMsg, bool first_time=false)
Set the dictionary file name for internationalization.
Definition pgm_base.cpp:547
virtual DESIGN_BLOCK_LIBRARY_ADAPTER * DesignBlockLibs()
Return the table of design block libraries.
Definition project.cpp:427
bool LoadProject(const wxString &aFullPath, bool aSetActive=true)
Load a project or sets up a new project with a specified path.
bool WarnUserIfOperatingSystemUnsupported()
Checks if the operating system is explicitly unsupported and displays a disclaimer message box.
Definition common.cpp:782
The common library.
void DisplayInfoMessage(wxWindow *aParent, const wxString &aMessage, const wxString &aExtraInfo)
Display an informational message box with aMessage.
Definition confirm.cpp:230
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)
@ FRAME_PCB_EDITOR
Definition frame_type.h:42
@ FRAME_SCH
Definition frame_type.h:34
#define WIN_STRING_DIR_SEP
Definition gestfich.h:38
#define UNIX_STRING_DIR_SEP
Definition gestfich.h:37
const wxChar *const traceLibraries
Flag to enable library table and library manager tracing.
const wxChar *const traceLocale
Flag to enable locale debug output.
const wxChar *const traceEnvVars
Flag to enable debug output of environment variable operations.
@ ID_LANGUAGE_SWEDISH
Definition id.h:101
@ ID_LANGUAGE_CATALAN
Definition id.h:90
@ ID_LANGUAGE_NORWEGIAN_BOKMAL
Definition id.h:108
@ ID_LANGUAGE_CHINESE_SIMPLIFIED
Definition id.h:91
@ ID_LANGUAGE_GERMAN
Definition id.h:75
@ ID_LANGUAGE_DUTCH
Definition id.h:93
@ ID_LANGUAGE_GREEK
Definition id.h:76
@ ID_LANGUAGE_HUNGARIAN
Definition id.h:86
@ ID_LANGUAGE_LITHUANIAN
Definition id.h:97
@ ID_LANGUAGE_TAMIL
Definition id.h:109
@ ID_LANGUAGE_PORTUGUESE_BRAZILIAN
Definition id.h:80
@ ID_LANGUAGE_DEFAULT
Definition id.h:68
@ ID_LANGUAGE_POLISH
Definition id.h:87
@ ID_LANGUAGE_THAI
Definition id.h:100
@ ID_LANGUAGE_JAPANESE
Definition id.h:94
@ ID_LANGUAGE_VIETNAMESE
Definition id.h:98
@ ID_LANGUAGE_ITALIAN
Definition id.h:83
@ ID_LANGUAGE_KOREAN
Definition id.h:89
@ ID_LANGUAGE_SERBIAN
Definition id.h:99
@ ID_LANGUAGE_RUSSIAN
Definition id.h:78
@ ID_LANGUAGE_CZECH
Definition id.h:88
@ ID_LANGUAGE_LATVIAN
Definition id.h:96
@ ID_LANGUAGE_SLOVENIAN
Definition id.h:84
@ ID_LANGUAGE_SPANISH
Definition id.h:73
@ ID_LANGUAGE_PORTUGUESE
Definition id.h:79
@ ID_LANGUAGE_ENGLISH
Definition id.h:69
@ ID_LANGUAGE_SPANISH_MEXICAN
Definition id.h:74
@ ID_LANGUAGE_SLOVAK
Definition id.h:85
@ ID_LANGUAGE_CHINESE_TRADITIONAL
Definition id.h:92
@ ID_LANGUAGE_FINNISH
Definition id.h:71
@ ID_LANGUAGE_BULGARIAN
Definition id.h:95
@ ID_LANGUAGE_ARABIC
Definition id.h:103
@ ID_LANGUAGE_UKRAINIAN
Definition id.h:102
@ ID_LANGUAGE_TURKISH
Definition id.h:81
@ ID_LANGUAGE_DANISH
Definition id.h:67
@ ID_LANGUAGE_FRENCH
Definition id.h:70
@ ID_LANGUAGE_HEBREW
Definition id.h:72
@ ID_LANGUAGE_ROMANIAN
Definition id.h:107
@ ID_LANGUAGE_INDONESIAN
Definition id.h:82
std::map< wxString, ENV_VAR_ITEM > ENV_VAR_MAP
This file contains miscellaneous commonly used macros and functions.
@ MAIL_RELOAD_LIB
Definition mail_type.h:57
thread_pool< 1 > priority_thread_pool
Definition singleton.h:31
void SetPgm(PGM_BASE *pgm)
static PGM_BASE * process
PGM_BASE & Pgm()
The global program "get" accessor.
PGM_BASE * PgmOrNull()
Return a reference that can be nullptr when running a shared lib from a script, not from a kicad app.
LANGUAGE_DESCR LanguagesList[]
An array containing all the languages that KiCad supports.
Definition pgm_base.cpp:95
#define _(s)
Current list of languages supported by KiCad.
Definition pgm_base.cpp:94
see class PGM_BASE
KICOMMON_API LANGUAGE_DESCR LanguagesList[]
An array containing all the languages that KiCad supports.
Definition pgm_base.cpp:95
KICOMMON_API PGM_BASE & Pgm()
The global program "get" accessor.
#define PROJECT_VAR_NAME
A variable name whose value holds the current project directory.
Definition project.h:41
APIIMPORT wxPGGlobalVarsClass * wxPGGlobalVars
wxString From_UTF8(const char *cstring)
This struct represents a key being used for the std::set that deduplicates asserts during this runnin...
Definition app_monitor.h:90
A small class to handle the list of existing translations.
Definition pgm_base.h:75
System directories search utilities.
std::string path
thread_pool & GetKiCadThreadPool()
Get a reference to the current thread pool.
static thread_pool * tp
BS::priority_thread_pool thread_pool
Definition thread_pool.h:31
wxLogTrace helper definitions.