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 m_locale = nullptr;
149 m_Printing = false;
150 m_Quitting = false;
151 m_argcUtf8 = 0;
152 m_argvUtf8 = nullptr;
153 m_splash = nullptr;
155
156 setLanguageId( wxLANGUAGE_DEFAULT );
157
158 ForceSystemPdfBrowser( false );
159}
160
161
163{
164 HideSplash();
165 Destroy();
166
167 for( int n = 0; n < m_argcUtf8; n++ )
168 {
169 free( m_argvUtf8[n] );
170 }
171
172 delete[] m_argvUtf8;
173
174 delete m_locale;
175 m_locale = nullptr;
176}
177
178
180{
182
184
185 m_pgm_checker.reset();
186
187#ifdef _MSC_VER
188 winrt::uninit_apartment();
189#endif
190
191 // Shut down the thread pool explicitly here, before static destruction begins.
192 // On macOS, if the thread pool destructor runs during static destruction
193 // (via __cxa_finalize_ranges), the condition variables may be in an invalid state,
194 // causing a crash. By destroying the thread pool here, we ensure it's cleaned up
195 // while the C++ runtime is still in a valid state.
196 m_singleton.Shutdown();
197}
198
199
201{
202 wxASSERT( wxTheApp );
203 return *wxTheApp;
204}
205
206
207void PGM_BASE::SetTextEditor( const wxString& aFileName )
208{
209 m_text_editor = aFileName;
211}
212
213
214const wxString& PGM_BASE::GetTextEditor( bool aCanShowFileChooser )
215{
216 wxString editorname = m_text_editor;
217
218 if( !editorname )
219 {
220 if( !wxGetEnv( wxT( "EDITOR" ), &editorname ) )
221 {
222 // If there is no EDITOR variable set, try the desktop default
223#ifdef __WXMAC__
224 editorname = wxT( "/usr/bin/open -e" );
225#elif __WXX11__
226 editorname = wxT( "/usr/bin/xdg-open" );
227#endif
228 }
229 }
230
231 // If we still don't have an editor name show a dialog asking the user to select one
232 if( !editorname && aCanShowFileChooser )
233 {
234 DisplayInfoMessage( nullptr, _( "No default editor found, you must choose one." ) );
235
236 editorname = AskUserForPreferredEditor();
237 }
238
239 // If we finally have a new editor name request it to be copied to m_text_editor and
240 // saved to the preferences file.
241 if( !editorname.IsEmpty() )
242 SetTextEditor( editorname );
243
244 // m_text_editor already has the same value that editorname, or empty if no editor was
245 // found/chosen.
246 return m_text_editor;
247}
248
249
250const wxString PGM_BASE::AskUserForPreferredEditor( const wxString& aDefaultEditor )
251{
252 // Create a mask representing the executable files in the current platform
253#ifdef __WINDOWS__
254 wxString mask( _( "Executable file" ) + wxT( " (*.exe)|*.exe" ) );
255#else
256 wxString mask( _( "Executable file" ) + wxT( " (*)|*" ) );
257#endif
258
259 // Extract the path, name and extension from the default editor (even if the editor's
260 // name was empty, this method will succeed and return empty strings).
261 wxString path, name, ext;
262 wxFileName::SplitPath( aDefaultEditor, &path, &name, &ext );
263
264 // Show the modal editor and return the file chosen (may be empty if the user cancels
265 // the dialog).
266 return wxFileSelector( _( "Select Preferred Editor" ), path, name, wxT( "." ) + ext,
267 mask, wxFD_OPEN | wxFD_FILE_MUST_EXIST, nullptr );
268}
269
270
272{
273 const wxArrayString& argArray = App().argv.GetArguments();
274 m_argcUtf8 = argArray.size();
275
276 m_argvUtf8 = new char*[m_argcUtf8 + 1];
277 for( int n = 0; n < m_argcUtf8; n++ )
278 {
279 m_argvUtf8[n] = wxStrdup( argArray[n].ToUTF8() );
280 }
281
282 m_argvUtf8[m_argcUtf8] = NULL; // null terminator at end of argv
283}
284
285
287{
288 // Disabling until we change to load each DSO at startup rather than lazy-load when needed.
289 // Note that once the splash screen is re-enabled, there are some remaining bugs to fix:
290 // Any wxWidgets error dialogs that appear during startup are hidden by the splash screen,
291 // so we either need to prevent these from happening (probably not feasible) or else change
292 // the error-handling path to make sure errors go on top of the splash.
293#if 0
294 if( m_splash )
295 return;
296
297 m_splash = new WX_SPLASH( KiBitmap( BITMAPS::splash ), wxSPLASH_CENTRE_ON_SCREEN, 0,
298 NULL, -1, wxDefaultPosition, wxDefaultSize,
299 wxBORDER_NONE | wxSTAY_ON_TOP );
300 wxYield();
301#endif
302}
303
304
306{
307 if( !m_splash )
308 return;
309
310 m_splash->Close( true );
311 m_splash->Destroy();
312 m_splash = nullptr;
313}
314
315
316bool PGM_BASE::InitPgm( bool aHeadless, bool aSkipPyInit, bool aIsUnitTest )
317{
318#if defined( __WXMAC__ )
319 // Set the application locale to the system default
320 wxLogNull noLog;
321 wxLocale loc;
322 loc.Init();
323#endif
324
325 // Just make sure we init precreate any folders early for later code
326 // In particular, the user cache path is the most likely to be hit by startup code
328
330
332
333 // Initialize the singleton instance
334 m_singleton.Init();
335
336 wxString pgm_name;
337
339 if( App().argc == 0 )
340 pgm_name = wxT( "kicad" );
341 else
342 pgm_name = wxFileName( App().argv[0] ).GetName().Lower();
343
344 APP_MONITOR::SENTRY::Instance()->AddTag( "kicad.app", pgm_name );
345
346 wxInitAllImageHandlers();
347
348#if !wxCHECK_VERSION( 3, 3, 0 )
349 // Without this the wxPropertyGridManager segfaults on Windows.
350 if( !wxPGGlobalVars )
351 wxPGInitResourceModule();
352#endif
353
354#ifndef __WINDOWS__
355 if( wxString( wxGetenv( "HOME" ) ).IsEmpty() )
356 {
357 DisplayErrorMessage( nullptr, _( "Environment variable HOME is empty. "
358 "Unable to continue." ) );
359 return false;
360 }
361#endif
362
363 // Ensure the instance checker directory exists
364 // It should be globally writable because it is shared between all users on Linux, and so on a
365 // multi-user machine, other need to be able to access it to check for the lock files or make
366 // their own lock files.
367 wxString instanceCheckerDir = PATHS::GetInstanceCheckerPath();
368 PATHS::EnsurePathExists( instanceCheckerDir );
369 wxChmod( instanceCheckerDir,
370 wxPOSIX_USER_READ | wxPOSIX_USER_WRITE | wxPOSIX_USER_EXECUTE |
371 wxPOSIX_GROUP_READ | wxPOSIX_GROUP_WRITE | wxPOSIX_GROUP_EXECUTE |
372 wxPOSIX_OTHERS_READ | wxPOSIX_OTHERS_WRITE | wxPOSIX_OTHERS_EXECUTE );
373
374 wxString instanceCheckerName = wxString::Format( wxS( "%s-%s" ), pgm_name,
376
377 m_pgm_checker = std::make_unique<wxSingleInstanceChecker>();
378 m_pgm_checker->Create( instanceCheckerName, instanceCheckerDir );
379
380 // Init KiCad environment
381 // the environment variable KICAD (if exists) gives the kicad path:
382 // something like set KICAD=d:\kicad
383 bool isDefined = wxGetEnv( wxT( "KICAD" ), &m_kicad_env );
384
385 if( isDefined ) // ensure m_kicad_env ends by "/"
386 {
388
389 if( !m_kicad_env.IsEmpty() && m_kicad_env.Last() != '/' )
391 }
392
393 // Init parameters for configuration
394 App().SetVendorName( wxT( "KiCad" ) );
395 App().SetAppName( pgm_name );
396
397 // Install some image handlers, mainly for help
398 if( wxImage::FindHandler( wxBITMAP_TYPE_PNG ) == nullptr )
399 wxImage::AddHandler( new wxPNGHandler );
400
401 if( wxImage::FindHandler( wxBITMAP_TYPE_GIF ) == nullptr )
402 wxImage::AddHandler( new wxGIFHandler );
403
404 if( wxImage::FindHandler( wxBITMAP_TYPE_JPEG ) == nullptr )
405 wxImage::AddHandler( new wxJPEGHandler );
406
407 wxFileSystem::AddHandler( new wxZipFSHandler );
408
409 // Analyze the command line & initialize the binary path
410 wxString tmp;
412 SetDefaultLanguage( tmp );
413
414#ifdef _MSC_VER
415 if( !wxGetEnv( "FONTCONFIG_PATH", NULL ) )
416 {
417 // We need to set this because the internal fontconfig logic
418 // seems to search relative to the dll rather the other logic it
419 // has to look for the /etc folder above the dll
420 // Also don't set it because we need it in QA cli tests to be set by ctest
421 wxSetEnv( "FONTCONFIG_PATH", PATHS::GetWindowsFontConfigDir() );
422 }
423#endif
424
425#ifdef _MSC_VER
426 winrt::init_apartment(winrt::apartment_type::single_threaded);
427#endif
428
429 m_settings_manager = std::make_unique<SETTINGS_MANAGER>();
430 m_library_manager = std::make_unique<LIBRARY_MANAGER>();
431 m_background_jobs_monitor = std::make_unique<BACKGROUND_JOBS_MONITOR>();
432 m_notifications_manager = std::make_unique<NOTIFICATIONS_MANAGER>();
433
434#ifdef KICAD_IPC_API
435 m_plugin_manager = std::make_unique<API_PLUGIN_MANAGER>( &App() );
436#endif
437
438 // Our unit test mocks break if we continue
439 // A bug caused InitPgm to terminate early in unit tests and the mocks are...simplistic
440 // TODO fix the unit tests so this can be removed
441 if( aIsUnitTest )
442 return false;
443
444 // Something got in the way of settings load: can't continue
445 if( !m_settings_manager->IsOK() )
446 return false;
447
448 // Set up built-in environment variables (and override them from the system environment if set)
449 COMMON_SETTINGS* commonSettings = GetCommonSettings();
450 commonSettings->InitializeEnvironment();
451
452 // Load color settings after env is initialized
453 m_settings_manager->ReloadColorSettings();
454
455 // Load common settings from disk after setting up env vars
456 GetSettingsManager().Load( commonSettings );
457
458#ifdef KICAD_IPC_API
459 // If user doesn't have a saved Python interpreter, try (potentially again) to find one
460 if( commonSettings->m_Api.python_interpreter.IsEmpty() )
461 commonSettings->m_Api.python_interpreter = PYTHON_MANAGER::FindPythonInterpreter();
462#endif
463
464 // Init user language *before* calling loadSettings, because
465 // env vars could be incorrectly initialized on Linux
466 // (if the value contains some non ASCII7 chars, the env var is not initialized)
467 SetLanguage( tmp, true );
468
469 // Now that translations are available, inform the user if the OS is unsupported
471
473
474 ReadPdfBrowserInfos(); // needs GetCommonSettings()
475
477
478 // Create the python scripting stuff
479 // Skip it for applications that do not use it
480 if( !aSkipPyInit )
481 m_python_scripting = std::make_unique<SCRIPTING>();
482
483 // TODO(JE): Remove this if apps are refactored to not assume Prj() always works
484 // Need to create a project early for now (it can have an empty path for the moment)
486
487#ifdef KICAD_IPC_API
488 if( commonSettings->m_Api.enable_server )
489 m_plugin_manager->ReloadPlugins();
490#endif
491
492 // This sets the maximum tooltip display duration to 10s (up from 5) but only affects
493 // Windows as other platforms display tooltips while the mouse is not moving
494 if( !aHeadless )
495 {
496 wxToolTip::Enable( true );
497 wxToolTip::SetAutoPop( 10000 );
498 }
499
500 if( ADVANCED_CFG::GetCfg().m_UpdateUIEventInterval != 0 )
501 wxUpdateUIEvent::SetUpdateInterval( ADVANCED_CFG::GetCfg().m_UpdateUIEventInterval );
502
503 // Now the application can safely start, show the splash screen
504 if( !aHeadless )
505 ShowSplash();
506
507 return true;
508}
509
510
512{
514
515 for( const std::pair<wxString, ENV_VAR_ITEM> it : GetCommonSettings()->m_Env.vars )
516 {
517 wxLogTrace( traceEnvVars, wxT( "PGM_BASE::loadSettings: Found entry %s = %s" ),
518 it.first, it.second.GetValue() );
519
520 // Do not store the env var PROJECT_VAR_NAME ("KIPRJMOD") definition if for some reason
521 // it is found in config. (It is reserved and defined as project path)
522 if( it.first == PROJECT_VAR_NAME )
523 continue;
524
525 // Don't set bogus empty entries in the environment
526 if( it.first.IsEmpty() )
527 continue;
528
529 // Do not overwrite vars set by the system environment with values from the settings file
530 if( it.second.GetDefinedExternally() )
531 continue;
532
533 SetLocalEnvVariable( it.first, it.second.GetValue() );
534 }
535}
536
537
539{
540 // GetCommonSettings() is not initialized until fairly late in the
541 // process startup: InitPgm(), so test before using:
542 if( GetCommonSettings() )
543 GetCommonSettings()->m_System.working_dir = wxGetCwd();
544}
545
546
548{
549 return m_settings_manager ? m_settings_manager->GetCommonSettings() : nullptr;
550}
551
552
553bool PGM_BASE::SetLanguage( wxString& aErrMsg, bool first_time )
554{
555 // Suppress wxWidgets error popups if locale is not found
556 wxLogNull doNotLog;
557
558 if( first_time )
559 {
560 setLanguageId( wxLANGUAGE_DEFAULT );
561
562 // First time SetLanguage is called, the user selected language id is set
563 // from common user config settings
564 wxString languageSel = GetCommonSettings()->m_System.language;
565
566 // Search for the current selection
567 for( unsigned ii = 0; LanguagesList[ii].m_KI_Lang_Identifier != 0; ii++ )
568 {
569 if( LanguagesList[ii].m_Lang_Label == languageSel )
570 {
571 setLanguageId( LanguagesList[ii].m_WX_Lang_Identifier );
572 break;
573 }
574 }
575 }
576
577 // dictionary file name without extend (full name is kicad.mo)
578 wxString dictionaryName( wxT( "kicad" ) );
579
580 delete m_locale;
581 m_locale = new wxLocale;
582
583 // don't use wxLOCALE_LOAD_DEFAULT flag so that Init() doesn't return
584 // false just because it failed to load wxstd catalog
585 if( !m_locale->Init( m_language_id ) )
586 {
587 wxLogTrace( traceLocale, wxT( "This language is not supported by the system." ) );
588
589 setLanguageId( wxLANGUAGE_DEFAULT );
590 delete m_locale;
591
592 m_locale = new wxLocale;
593 m_locale->Init( wxLANGUAGE_DEFAULT );
594
595 aErrMsg = _( "This language is not supported by the operating system." );
596 return false;
597 }
598 else if( !first_time )
599 {
600 wxLogTrace( traceLocale, wxT( "Search for dictionary %s.mo in %s" ) ,
601 dictionaryName, m_locale->GetName() );
602 }
603
604 if( !first_time )
605 {
606 // If we are here, the user has selected another language.
607 // Therefore the new preferred language name is stored in common config.
608 // Do NOT store the wxWidgets language Id, it can change between wxWidgets
609 // versions, for a given language
610 wxString languageSel;
611
612 // Search for the current selection language name
613 for( unsigned ii = 0; LanguagesList[ii].m_KI_Lang_Identifier != 0; ii++ )
614 {
615 if( LanguagesList[ii].m_WX_Lang_Identifier == m_language_id )
616 {
617 languageSel = LanguagesList[ii].m_Lang_Label;
618 break;
619 }
620 }
621
623 cfg->m_System.language = languageSel;
624 cfg->SaveToFile( GetSettingsManager().GetPathForSettingsFile( cfg ) );
625 }
626
627 // Try adding the dictionary if it is not currently loaded
628 if( !m_locale->IsLoaded( dictionaryName ) )
629 m_locale->AddCatalog( dictionaryName );
630
631 // Verify the Kicad dictionary was loaded properly
632 // However, for the English language, the dictionary is not mandatory, as
633 // all messages are already in English, just restricted to ASCII7 chars,
634 // the verification is skipped.
635 if( !m_locale->IsLoaded( dictionaryName ) && m_language_id != wxLANGUAGE_ENGLISH )
636 {
637 wxLogTrace( traceLocale, wxT( "Unable to load dictionary %s.mo in %s" ),
638 dictionaryName, m_locale->GetName() );
639
640 setLanguageId( wxLANGUAGE_DEFAULT );
641 delete m_locale;
642
643 m_locale = new wxLocale;
644 m_locale->Init( wxLANGUAGE_DEFAULT );
645
646 aErrMsg = _( "The KiCad language file for this language is not installed." );
647 return false;
648 }
649
650 return true;
651}
652
653
654bool PGM_BASE::SetDefaultLanguage( wxString& aErrMsg )
655{
656 // Suppress error popups from wxLocale
657 wxLogNull doNotLog;
658
659 setLanguageId( wxLANGUAGE_DEFAULT );
660
661 // dictionary file name without extend (full name is kicad.mo)
662 wxString dictionaryName( wxT( "kicad" ) );
663
664 delete m_locale;
665 m_locale = new wxLocale;
666 m_locale->Init();
667
668 // Try adding the dictionary if it is not currently loaded
669 if( !m_locale->IsLoaded( dictionaryName ) )
670 m_locale->AddCatalog( dictionaryName );
671
672 // Verify the Kicad dictionary was loaded properly
673 // However, for the English language, the dictionary is not mandatory, as
674 // all messages are already in English, just restricted to ASCII7 chars,
675 // the verification is skipped.
676 if( !m_locale->IsLoaded( dictionaryName ) && m_language_id != wxLANGUAGE_ENGLISH )
677 {
678 wxLogTrace( traceLocale, wxT( "Unable to load dictionary %s.mo in %s" ),
679 dictionaryName, m_locale->GetName() );
680
681 setLanguageId( wxLANGUAGE_DEFAULT );
682 delete m_locale;
683
684 m_locale = new wxLocale;
685 m_locale->Init();
686
687 aErrMsg = _( "The KiCad language file for this language is not installed." );
688 return false;
689 }
690
691 return true;
692}
693
694
696{
697 wxLogTrace( traceLocale, wxT( "Select language ID %d from %d possible languages." ),
698 menu_id, (int)arrayDim( LanguagesList )-1 );
699
700 for( unsigned ii = 0; LanguagesList[ii].m_KI_Lang_Identifier != 0; ii++ )
701 {
702 if( menu_id == LanguagesList[ii].m_KI_Lang_Identifier )
703 {
704 setLanguageId( LanguagesList[ii].m_WX_Lang_Identifier );
705 break;
706 }
707 }
708}
709
710
712{
713 const wxLanguageInfo* langInfo = wxLocale::GetLanguageInfo( m_language_id );
714
715 if( !langInfo )
716 {
717 return "";
718 }
719 else
720 {
721 wxString str = langInfo->GetCanonicalWithRegion();
722 str.Replace( "_", "-" );
723
724 return str;
725 }
726}
727
728
730{
731#ifdef _MSC_VER
732 wxLocale::AddCatalogLookupPathPrefix( PATHS::GetWindowsBaseSharePath() + wxT( "locale" ) );
733#endif
734 wxLocale::AddCatalogLookupPathPrefix( PATHS::GetLocaleDataPath() );
735
736 if( wxGetEnv( wxT( "KICAD_RUN_FROM_BUILD_DIR" ), nullptr ) )
737 {
738 wxFileName fn( Pgm().GetExecutablePath() );
739 fn.RemoveLastDir();
740 fn.AppendDir( wxT( "translation" ) );
741 wxLocale::AddCatalogLookupPathPrefix( fn.GetPath() );
742 }
743}
744
745
746bool PGM_BASE::SetLocalEnvVariable( const wxString& aName, const wxString& aValue )
747{
748 wxString env;
749
750 if( aName.IsEmpty() )
751 {
752 wxLogTrace( traceEnvVars,
753 wxT( "PGM_BASE::SetLocalEnvVariable: Attempt to set empty variable to "
754 "value %s" ),
755 aValue );
756 return false;
757 }
758
759 // Check to see if the environment variable is already set.
760 if( wxGetEnv( aName, &env ) )
761 {
762 wxLogTrace( traceEnvVars,
763 wxT( "PGM_BASE::SetLocalEnvVariable: Environment variable %s already set "
764 "to %s" ),
765 aName, env );
766 return env == aValue;
767 }
768
769 wxLogTrace( traceEnvVars,
770 wxT( "PGM_BASE::SetLocalEnvVariable: Setting local environment variable %s to %s" ),
771 aName, aValue );
772
773 return wxSetEnv( aName, aValue );
774}
775
776
778{
779 // Overwrites externally defined environment variable until the next time the application
780 // is run.
781 for( const std::pair<wxString, ENV_VAR_ITEM> m_local_env_var : GetCommonSettings()->m_Env.vars )
782 {
783 wxLogTrace( traceEnvVars,
784 wxT( "PGM_BASE::SetLocalEnvVariables: Setting local environment variable %s "
785 "to %s" ),
786 m_local_env_var.first,
787 m_local_env_var.second.GetValue() );
788 wxSetEnv( m_local_env_var.first, m_local_env_var.second.GetValue() );
789 }
790}
791
792
797
798
800{
801 if( !wxTheApp )
802 return false;
803
804 return wxTheApp->IsGUI();
805}
806
807
808void PGM_BASE::HandleException( std::exception_ptr aPtr, bool aUnhandled )
809{
810 try
811 {
812 if( aPtr )
813 std::rethrow_exception( aPtr );
814 }
815 catch( const IO_ERROR& ioe )
816 {
817 wxLogError( ioe.What() );
818
819 if( aUnhandled )
820 {
821 // Log this IO_ERROR escaped our usual uses (bad)
823 }
824 }
825 catch( const std::exception& e )
826 {
828
829 wxLogError( wxT( "Unhandled exception class: %s what: %s" ),
830 From_UTF8( typeid( e ).name() ), From_UTF8( e.what() ) );
831 }
832 catch( ... )
833 {
834 // We really shouldn't have these but just in case...
835 wxLogError( wxT( "Unhandled exception of unknown type" ) );
836
837 if( aUnhandled )
838 {
839 APP_MONITOR::SENTRY::Instance()->LogException( "Unhandled exception of unknown type" );
840 }
841 }
842}
843
844
845void PGM_BASE::HandleAssert( const wxString& aFile, int aLine, const wxString& aFunc,
846 const wxString& aCond, const wxString& aMsg )
847{
848 wxString assertStr;
849
850 // Log the assertion details to standard log
851 if( !aMsg.empty() )
852 {
853 assertStr = wxString::Format( "Assertion failed at %s:%d in %s: %s - %s", aFile, aLine,
854 aFunc, aCond, aMsg );
855 }
856 else
857 {
858 assertStr = wxString::Format( "Assertion failed at %s:%d in %s: %s", aFile, aLine, aFunc,
859 aCond );
860 }
861
862#ifndef NDEBUG
863 wxLogError( assertStr );
864#endif
865
866#ifdef KICAD_USE_SENTRY
867 APP_MONITOR::ASSERT_CACHE_KEY key = { aFile, aLine, aFunc, aCond };
868 APP_MONITOR::SENTRY::Instance()->LogAssert( key, assertStr );
869#endif
870}
871
872
873const wxString& PGM_BASE::GetExecutablePath() const
874{
876}
877
878
884
885
891
892
894{
895 // TODO(JE) much of this code can be shared across the 3 preloads
896 constexpr static int interval = 150;
897 constexpr static int timeLimit = 120000;
898
899 if( m_libraryPreloadInProgress.load() )
900 return;
901
903 Pgm().GetBackgroundJobMonitor().Create( _( "Loading Design Block Libraries" ) );
904
905 auto preload =
906 [this, aKiway]() -> void
907 {
908 std::shared_ptr<BACKGROUND_JOB_REPORTER> reporter =
910
911 DESIGN_BLOCK_LIBRARY_ADAPTER* adapter = aKiway->Prj().DesignBlockLibs();
912
913 int elapsed = 0;
914
915 reporter->Report( _( "Loading Design Block Libraries" ) );
916 adapter->AsyncLoad();
917
918 while( true )
919 {
920 if( m_libraryPreloadAbort.load() )
921 {
922 m_libraryPreloadAbort.store( false );
923 break;
924 }
925
926 std::this_thread::sleep_for( std::chrono::milliseconds( interval ) );
927
928 if( std::optional<float> loadStatus = adapter->AsyncLoadProgress() )
929 {
930 float progress = *loadStatus;
931 reporter->SetCurrentProgress( progress );
932
933 if( progress >= 1 )
934 break;
935 }
936 else
937 {
938 reporter->SetCurrentProgress( 1 );
939 break;
940 }
941
942 elapsed += interval;
943
944 if( elapsed > timeLimit )
945 break;
946 }
947
948 adapter->BlockUntilLoaded();
949
952 m_libraryPreloadInProgress.store( false );
953
954 std::string payload = "";
955 aKiway->ExpressMail( FRAME_SCH, MAIL_RELOAD_LIB, payload, nullptr, true );
956 aKiway->ExpressMail( FRAME_PCB_EDITOR, MAIL_RELOAD_LIB, payload, nullptr, true );
957 };
958
960 m_libraryPreloadInProgress.store( true );
961 m_libraryPreloadReturn = tp.submit_task( preload );
962}
963
964
966{
967 std::lock_guard<std::mutex> lock( m_libraryLoadStatusBarsMutex );
968
969 wxLogTrace( traceLibraries, "RegisterLibraryLoadStatusBar: statusBar=%p", aStatusBar );
970
971 if( std::find( m_libraryLoadStatusBars.begin(), m_libraryLoadStatusBars.end(), aStatusBar )
972 == m_libraryLoadStatusBars.end() )
973 {
974 m_libraryLoadStatusBars.push_back( aStatusBar );
975 wxLogTrace( traceLibraries, " -> registered, total count=%zu",
977 }
978 else
979 {
980 wxLogTrace( traceLibraries, " -> already registered" );
981 }
982}
983
984
986{
987 std::lock_guard<std::mutex> lock( m_libraryLoadStatusBarsMutex );
988
989 wxLogTrace( traceLibraries, "UnregisterLibraryLoadStatusBar: statusBar=%p", aStatusBar );
990
992 std::remove( m_libraryLoadStatusBars.begin(), m_libraryLoadStatusBars.end(),
993 aStatusBar ),
995
996 wxLogTrace( traceLibraries, " -> remaining count=%zu", m_libraryLoadStatusBars.size() );
997}
998
999
1000void PGM_BASE::AddLibraryLoadMessages( const std::vector<LOAD_MESSAGE>& aMessages )
1001{
1002 wxLogTrace( traceLibraries, "AddLibraryLoadMessages: message_count=%zu", aMessages.size() );
1003
1004 if( aMessages.empty() )
1005 return;
1006
1007 std::lock_guard<std::mutex> lock( m_libraryLoadStatusBarsMutex );
1008
1009 wxLogTrace( traceLibraries, " -> registered status bars=%zu",
1010 m_libraryLoadStatusBars.size() );
1011
1012 for( KISTATUSBAR* statusBar : m_libraryLoadStatusBars )
1013 {
1014 if( statusBar )
1015 {
1016 wxLogTrace( traceLibraries, " -> forwarding to statusBar=%p", statusBar );
1017 statusBar->AddLoadWarningMessages( aMessages );
1018 }
1019 }
1020}
1021
1022
1024{
1025 std::lock_guard<std::mutex> lock( m_libraryLoadStatusBarsMutex );
1026
1027 wxLogTrace( traceLibraries, "ClearLibraryLoadMessages: status bars=%zu",
1028 m_libraryLoadStatusBars.size() );
1029
1030 for( KISTATUSBAR* statusBar : m_libraryLoadStatusBars )
1031 {
1032 if( statusBar )
1033 statusBar->ClearLoadWarningMessages();
1034 }
1035}
1036
1037
1039
1040
1042{
1043 wxASSERT( process ); // KIFACE_GETTER has already been called.
1044 return *process;
1045}
1046
1047
1048// Similar to PGM_BASE& Pgm(), but return nullptr when a *.ki_face is run from a python script.
1050{
1051 return process;
1052}
1053
1054
1055void SetPgm( PGM_BASE* pgm )
1056{
1057 process = pgm;
1058}
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)
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.
void AsyncLoad() override
Loads all available libraries for this adapter type in the background.
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:294
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:507
virtual PROJECT & Prj() const
Return the PROJECT associated with this KIWAY.
Definition kiway.cpp:200
std::optional< float > AsyncLoadProgress() const
Returns async load progress between 0.0 and 1.0, or nullopt if load is not in progress.
void Load()
Load notifications stored from disk.
static wxString GetInstanceCheckerPath()
Gets the path used for wxSingleInstanceChecker lock files.
Definition paths.cpp:457
static void EnsureUserPathsExist()
Ensures/creates user default paths.
Definition paths.cpp:505
static bool EnsurePathExists(const wxString &aPath, bool aPathToFile=false)
Attempts to create a given path if it does not exist.
Definition paths.cpp:478
static wxString GetLocaleDataPath()
Gets the locales translation data path.
Definition paths.cpp:318
static const wxString & GetExecutablePath()
Definition paths.cpp:649
Container for data for KiCad programs.
Definition pgm_base.h:110
virtual COMMON_SETTINGS * GetCommonSettings() const
Definition pgm_base.cpp:547
virtual wxApp & App()
Return a bare naked wxApp which may come from wxPython, SINGLE_TOP, or kicad.exe.
Definition pgm_base.cpp:200
std::unique_ptr< NOTIFICATIONS_MANAGER > m_notifications_manager
Definition pgm_base.h:415
void PreloadDesignBlockLibraries(KIWAY *aKiway)
Starts a background job to preload the global and project design block libraries.
Definition pgm_base.cpp:893
int m_argcUtf8
Definition pgm_base.h:452
virtual ENV_VAR_MAP & GetLocalEnvVariables() const
Definition pgm_base.cpp:793
std::unique_ptr< LIBRARY_MANAGER > m_library_manager
Definition pgm_base.h:413
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:391
void setLanguageId(int aId)
Trap all changes in here, simplifies debugging.
Definition pgm_base.h:404
std::unique_ptr< SETTINGS_MANAGER > m_settings_manager
Definition pgm_base.h:412
void loadCommonSettings()
Load internal settings from COMMON_SETTINGS.
Definition pgm_base.cpp:511
virtual void SetPdfBrowserName(const wxString &aFileName)
Definition pgm_base.h:187
std::vector< KISTATUSBAR * > m_libraryLoadStatusBars
Definition pgm_base.h:461
wxLocale * m_locale
Definition pgm_base.h:429
void Destroy()
Definition pgm_base.cpp:179
wxSplashScreen * m_splash
Definition pgm_base.h:454
virtual BACKGROUND_JOBS_MONITOR & GetBackgroundJobMonitor() const
Definition pgm_base.h:138
bool InitPgm(bool aHeadless=false, bool aSkipPyInit=false, bool aIsUnitTest=false)
Initialize this program.
Definition pgm_base.cpp:316
char ** m_argvUtf8
argv parameters converted to utf8 form because wxWidgets has opinions.
Definition pgm_base.h:450
void UnregisterLibraryLoadStatusBar(KISTATUSBAR *aStatusBar)
Unregister a status bar from receiving library load warning messages.
Definition pgm_base.cpp:985
virtual void ReadPdfBrowserInfos()
Read the PDF browser choice from the common configuration.
Definition pgm_base.cpp:879
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:808
bool IsGUI()
Determine if the application is running with a GUI.
Definition pgm_base.cpp:799
bool m_use_system_pdf_browser
Definition pgm_base.h:432
bool m_Quitting
Definition pgm_base.h:395
void RegisterLibraryLoadStatusBar(KISTATUSBAR *aStatusBar)
Register a status bar to receive library load warning messages.
Definition pgm_base.cpp:965
std::future< void > m_libraryPreloadReturn
Definition pgm_base.h:457
virtual NOTIFICATIONS_MANAGER & GetNotificationsManager() const
Definition pgm_base.h:143
std::shared_ptr< BACKGROUND_JOB > m_libraryPreloadBackgroundJob
Definition pgm_base.h:456
void BuildArgvUtf8()
Builds the UTF8 based argv variable.
Definition pgm_base.cpp:271
virtual const wxString & GetPdfBrowserName() const
Definition pgm_base.h:185
std::atomic_bool m_libraryPreloadAbort
Definition pgm_base.h:459
void ClearLibraryLoadMessages()
Clear library load messages from all registered status bars.
virtual void SetTextEditor(const wxString &aFileName)
Definition pgm_base.cpp:207
std::unique_ptr< wxSingleInstanceChecker > m_pgm_checker
Check if there is another copy of Kicad running at the same time.
Definition pgm_base.h:420
virtual bool SetLocalEnvVariable(const wxString &aName, const wxString &aValue)
Set the environment variable aName to aValue.
Definition pgm_base.cpp:746
wxString m_kicad_env
The KICAD system environment variable.
Definition pgm_base.h:427
virtual void ForceSystemPdfBrowser(bool aFlg)
Force the use of system PDF browser, even if a preferred PDF browser is set.
Definition pgm_base.h:202
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:777
virtual void SetLanguagePath()
Definition pgm_base.cpp:729
bool SetDefaultLanguage(wxString &aErrMsg)
Set the default language without reference to any preferences.
Definition pgm_base.cpp:654
void ShowSplash()
Definition pgm_base.cpp:286
wxString m_text_editor
Definition pgm_base.h:435
std::atomic_bool m_libraryPreloadInProgress
Definition pgm_base.h:458
virtual ~PGM_BASE()
Definition pgm_base.cpp:162
std::unique_ptr< SCRIPTING > m_python_scripting
Definition pgm_base.h:417
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:695
int m_language_id
Definition pgm_base.h:430
std::unique_ptr< BACKGROUND_JOBS_MONITOR > m_background_jobs_monitor
Definition pgm_base.h:414
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:845
virtual wxString GetLanguageTag()
Definition pgm_base.cpp:711
virtual const wxString & GetTextEditor(bool aCanShowFileChooser=true)
Return the path to the preferred text editor application.
Definition pgm_base.cpp:214
virtual const wxString & GetExecutablePath() const
Definition pgm_base.cpp:873
void AddLibraryLoadMessages(const std::vector< LOAD_MESSAGE > &aMessages)
Add library load messages to all registered status bars.
virtual SETTINGS_MANAGER & GetSettingsManager() const
Definition pgm_base.h:132
void HideSplash()
Definition pgm_base.cpp:305
virtual void WritePdfBrowserInfos()
Save the PDF browser choice to the common configuration.
Definition pgm_base.cpp:886
void SaveCommonSettings()
Save the program (process) settings subset which are stored .kicad_common.
Definition pgm_base.cpp:538
bool m_PropertyGridInitialized
Definition pgm_base.h:397
KICAD_SINGLETON m_singleton
Definition pgm_base.h:437
std::mutex m_libraryLoadStatusBarsMutex
Definition pgm_base.h:462
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:250
virtual bool SetLanguage(wxString &aErrMsg, bool first_time=false)
Set the dictionary file name for internationalization.
Definition pgm_base.cpp:553
virtual DESIGN_BLOCK_LIBRARY_ADAPTER * DesignBlockLibs()
Return the table of design block libraries.
Definition project.cpp:417
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:912
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
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:76
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.