KiCad PCB EDA Suite
PGM_SINGLE_TOP Struct Reference

Struct PGM_SINGLE_TOP implements PGM_BASE with its own OnPgmInit() and OnPgmExit(). More...

Inheritance diagram for PGM_SINGLE_TOP:
PGM_BASE

Public Member Functions

bool OnPgmInit ()
 
void OnPgmExit ()
 
void MacOpenFile (const wxString &aFileName) override
 Specific to MacOSX (not used under Linux or Windows). More...
 
void BuildArgvUtf8 ()
 Builds the UTF8 based argv variable. More...
 
virtual SETTINGS_MANAGERGetSettingsManager () const
 
virtual COMMON_SETTINGSGetCommonSettings () const
 
virtual void SetTextEditor (const wxString &aFileName)
 
virtual const wxString & GetTextEditor (bool aCanShowFileChooser=true)
 Return the path to the preferred text editor application. More...
 
virtual const wxString AskUserForPreferredEditor (const wxString &aDefaultEditor=wxEmptyString)
 Shows a dialog that instructs the user to select a new preferred editor. More...
 
virtual bool IsKicadEnvVariableDefined () const
 
virtual const wxString & GetKicadEnvVariable () const
 
virtual const wxString & GetExecutablePath () const
 
virtual wxLocale * GetLocale ()
 
virtual const wxString & GetPdfBrowserName () const
 
virtual void SetPdfBrowserName (const wxString &aFileName)
 
virtual bool UseSystemPdfBrowser () const
 
virtual void ForceSystemPdfBrowser (bool aFlg)
 Force the use of system PDF browser, even if a preferred PDF browser is set. More...
 
virtual bool SetLanguage (wxString &aErrMsg, bool first_time=false)
 Set the dictionary file name for internationalization. More...
 
bool SetDefaultLanguage (wxString &aErrMsg)
 Set the default language without reference to any preferences. More...
 
virtual void SetLanguageIdentifier (int menu_id)
 Set in .m_language_id member the wxWidgets language identifier ID from the KiCad menu id (internal menu identifier). More...
 
virtual int GetSelectedLanguageIdentifier () const
 
virtual void SetLanguagePath ()
 
virtual void ReadPdfBrowserInfos ()
 Read the PDF browser choice from the common configuration. More...
 
virtual void WritePdfBrowserInfos ()
 Save the PDF browser choice to the common configuration. More...
 
virtual bool SetLocalEnvVariable (const wxString &aName, const wxString &aValue)
 Sets the environment variable aName to aValue. More...
 
virtual void SetLocalEnvVariables ()
 Updates the local environment with the contents of the current ENV_VAR_MAP stored in the COMMON_SETTINGS. More...
 
virtual ENV_VAR_MAPGetLocalEnvVariables () const
 
virtual wxApp & App ()
 Returns a bare naked wxApp which may come from wxPython, SINGLE_TOP, or kicad.exe. More...
 
bool InitPgm (bool aHeadless=false, bool aSkipPyInit=false, bool aIsUnitTest=false)
 Initialize this program. More...
 
void Destroy ()
 
void SaveCommonSettings ()
 Save the program (process) settings subset which are stored .kicad_common. More...
 

Public Attributes

bool m_Printing
 wxWidgets on MSW tends to crash if you spool up more than one print job at a time. More...
 
int m_ModalDialogCount
 
bool m_Quitting
 

Static Public Attributes

static const wxChar workingDirKey []
 

Protected Member Functions

void loadCommonSettings ()
 Loads internal settings from COMMON_SETTINGS. More...
 
void setLanguageId (int aId)
 Trap all changes in here, simplifies debugging. More...
 
bool setExecutablePath ()
 Find the path to the executable and stores it in PGM_BASE::m_bin_dir. More...
 

Protected Attributes

std::unique_ptr< SETTINGS_MANAGERm_settings_manager
 
std::unique_ptr< SCRIPTING > m_python_scripting
 
wxString m_bin_dir
 
wxString m_kicad_env
 full path to this program More...
 
wxLocale * m_locale
 The KICAD system environment variable. More...
 
int m_language_id
 
bool m_use_system_pdf_browser
 
wxString m_pdf_browser
 
wxString m_text_editor
 Filename of the app selected for browsing PDFs. More...
 
char ** m_argvUtf8
 
int m_argcUtf8
 argv parameters converted to utf8 form, because wxwidgets has opinions and will return argv as either force converted to ascii in char* or wchar_t only More...
 

Detailed Description

Struct PGM_SINGLE_TOP implements PGM_BASE with its own OnPgmInit() and OnPgmExit().

Definition at line 66 of file single_top.cpp.

Member Function Documentation

◆ App()

wxApp & PGM_BASE::App ( )
virtualinherited

Returns a bare naked wxApp which may come from wxPython, SINGLE_TOP, or kicad.exe.

This should return what wxGetApp() returns.

Definition at line 161 of file pgm_base.cpp.

162{
163 wxASSERT( wxTheApp );
164 return *wxTheApp;
165}

Referenced by PGM_BASE::BuildArgvUtf8(), PGM_BASE::InitPgm(), MacOpenFile(), PGM_KICAD::MacOpenFile(), PGM_TEST_FRAME::MacOpenFile(), and PGM_KICAD::OnPgmInit().

◆ AskUserForPreferredEditor()

const wxString PGM_BASE::AskUserForPreferredEditor ( const wxString &  aDefaultEditor = wxEmptyString)
virtualinherited

Shows a dialog that instructs the user to select a new preferred editor.

Parameters
aDefaultEditorDefault full path for the default editor this dialog should show by default.
Returns
Returns the full path of the editor, or an empty string if no editor was chosen.

Definition at line 211 of file pgm_base.cpp.

212{
213 // Create a mask representing the executable files in the current platform
214#ifdef __WINDOWS__
215 wxString mask( _( "Executable file" ) + wxT( " (*.exe)|*.exe" ) );
216#else
217 wxString mask( _( "Executable file" ) + wxT( " (*)|*" ) );
218#endif
219
220 // Extract the path, name and extension from the default editor (even if the editor's
221 // name was empty, this method will succeed and return empty strings).
222 wxString path, name, ext;
223 wxFileName::SplitPath( aDefaultEditor, &path, &name, &ext );
224
225 // Show the modal editor and return the file chosen (may be empty if the user cancels
226 // the dialog).
227 return wxFileSelector( _( "Select Preferred Editor" ), path, name, wxT( "." ) + ext,
228 mask, wxFD_OPEN | wxFD_FILE_MUST_EXIST, nullptr );
229}
const char * name
Definition: DXF_plotter.cpp:56
#define _(s)
Current list of languages supported by KiCad.
Definition: pgm_base.cpp:118

References _, name, and path.

Referenced by PGM_BASE::GetTextEditor().

◆ BuildArgvUtf8()

void PGM_BASE::BuildArgvUtf8 ( )
inherited

Builds the UTF8 based argv variable.

Definition at line 382 of file pgm_base.cpp.

383{
384 const wxArrayString& argArray = App().argv.GetArguments();
385 m_argcUtf8 = argArray.size();
386
387 m_argvUtf8 = new char*[m_argcUtf8 + 1];
388 for( int n = 0; n < m_argcUtf8; n++ )
389 {
390 m_argvUtf8[n] = wxStrdup( argArray[n].ToUTF8() );
391 }
392
393 m_argvUtf8[m_argcUtf8] = NULL; // null terminator at end of argv
394}
virtual wxApp & App()
Returns a bare naked wxApp which may come from wxPython, SINGLE_TOP, or kicad.exe.
Definition: pgm_base.cpp:161
int m_argcUtf8
argv parameters converted to utf8 form, because wxwidgets has opinions and will return argv as either...
Definition: pgm_base.h:354
char ** m_argvUtf8
Definition: pgm_base.h:351

References PGM_BASE::App(), PGM_BASE::m_argcUtf8, and PGM_BASE::m_argvUtf8.

◆ Destroy()

void PGM_BASE::Destroy ( )
inherited

Definition at line 149 of file pgm_base.cpp.

150{
151#ifdef KICAD_USE_SENTRY
152 sentry_close();
153#endif
154
155 // unlike a normal destructor, this is designed to be called more than once safely:
156 delete m_locale;
157 m_locale = nullptr;
158}
wxLocale * m_locale
The KICAD system environment variable.
Definition: pgm_base.h:337

References PGM_BASE::m_locale.

Referenced by PGM_KICAD::Destroy(), OnPgmExit(), PGM_TEST_FRAME::OnPgmExit(), and PGM_BASE::~PGM_BASE().

◆ ForceSystemPdfBrowser()

virtual void PGM_BASE::ForceSystemPdfBrowser ( bool  aFlg)
inlinevirtualinherited

Force the use of system PDF browser, even if a preferred PDF browser is set.

Definition at line 186 of file pgm_base.h.

186{ m_use_system_pdf_browser = aFlg; }
bool m_use_system_pdf_browser
Definition: pgm_base.h:340

References PGM_BASE::m_use_system_pdf_browser.

Referenced by PGM_BASE::PGM_BASE().

◆ GetCommonSettings()

COMMON_SETTINGS * PGM_BASE::GetCommonSettings ( ) const
virtualinherited

◆ GetExecutablePath()

virtual const wxString & PGM_BASE::GetExecutablePath ( ) const
inlinevirtualinherited

Definition at line 165 of file pgm_base.h.

165{ return m_bin_dir; }
wxString m_bin_dir
Definition: pgm_base.h:334

References PGM_BASE::m_bin_dir.

Referenced by OnPgmInit(), and PGM_BASE::SetLanguagePath().

◆ GetKicadEnvVariable()

virtual const wxString & PGM_BASE::GetKicadEnvVariable ( ) const
inlinevirtualinherited

Definition at line 163 of file pgm_base.h.

163{ return m_kicad_env; }
wxString m_kicad_env
full path to this program
Definition: pgm_base.h:335

References PGM_BASE::m_kicad_env.

◆ GetLocale()

virtual wxLocale * PGM_BASE::GetLocale ( )
inlinevirtualinherited

Definition at line 167 of file pgm_base.h.

167{ return m_locale; }

References PGM_BASE::m_locale.

◆ GetLocalEnvVariables()

ENV_VAR_MAP & PGM_BASE::GetLocalEnvVariables ( ) const
virtualinherited

Definition at line 822 of file pgm_base.cpp.

823{
824 return GetCommonSettings()->m_Env.vars;
825}
ENVIRONMENT m_Env
virtual COMMON_SETTINGS * GetCommonSettings() const
Definition: pgm_base.cpp:607

References PGM_BASE::GetCommonSettings(), COMMON_SETTINGS::m_Env, and COMMON_SETTINGS::ENVIRONMENT::vars.

Referenced by FILENAME_RESOLVER::GetKicadPaths(), and PGM_KICAD::OnPgmInit().

◆ GetPdfBrowserName()

virtual const wxString & PGM_BASE::GetPdfBrowserName ( ) const
inlinevirtualinherited

Definition at line 169 of file pgm_base.h.

169{ return m_pdf_browser; }
wxString m_pdf_browser
Definition: pgm_base.h:341

References PGM_BASE::m_pdf_browser.

Referenced by PGM_BASE::WritePdfBrowserInfos().

◆ GetSelectedLanguageIdentifier()

virtual int PGM_BASE::GetSelectedLanguageIdentifier ( ) const
inlinevirtualinherited
Returns
the wxWidgets language identifier Id of the language currently selected.

Definition at line 220 of file pgm_base.h.

220{ return m_language_id; }
int m_language_id
Definition: pgm_base.h:338

References PGM_BASE::m_language_id.

◆ GetSettingsManager()

◆ GetTextEditor()

const wxString & PGM_BASE::GetTextEditor ( bool  aCanShowFileChooser = true)
virtualinherited

Return the path to the preferred text editor application.

Parameters
aCanShowFileChooserIf no editor is currently set and this argument is 'true' then this method will show a file chooser dialog asking for the editor's executable.
Returns
Returns the full path of the editor, or an empty string if no editor has been set.

Definition at line 175 of file pgm_base.cpp.

176{
177 wxString editorname = m_text_editor;
178
179 if( !editorname )
180 {
181 if( !wxGetEnv( wxT( "EDITOR" ), &editorname ) )
182 {
183 // If there is no EDITOR variable set, try the desktop default
184#ifdef __WXMAC__
185 editorname = wxT( "/usr/bin/open -e" );
186#elif __WXX11__
187 editorname = wxT( "/usr/bin/xdg-open" );
188#endif
189 }
190 }
191
192 // If we still don't have an editor name show a dialog asking the user to select one
193 if( !editorname && aCanShowFileChooser )
194 {
195 DisplayInfoMessage( nullptr, _( "No default editor found, you must choose one." ) );
196
197 editorname = AskUserForPreferredEditor();
198 }
199
200 // If we finally have a new editor name request it to be copied to m_text_editor and
201 // saved to the preferences file.
202 if( !editorname.IsEmpty() )
203 SetTextEditor( editorname );
204
205 // m_text_editor already has the same value that editorname, or empty if no editor was
206 // found/chosen.
207 return m_text_editor;
208}
virtual void SetTextEditor(const wxString &aFileName)
Definition: pgm_base.cpp:168
wxString m_text_editor
Filename of the app selected for browsing PDFs.
Definition: pgm_base.h:343
virtual const wxString AskUserForPreferredEditor(const wxString &aDefaultEditor=wxEmptyString)
Shows a dialog that instructs the user to select a new preferred editor.
Definition: pgm_base.cpp:211
void DisplayInfoMessage(wxWindow *aParent, const wxString &aMessage, const wxString &aExtraInfo)
Display an informational message box with aMessage.
Definition: confirm.cpp:320

References _, PGM_BASE::AskUserForPreferredEditor(), DisplayInfoMessage(), PGM_BASE::m_text_editor, and PGM_BASE::SetTextEditor().

◆ InitPgm()

bool PGM_BASE::InitPgm ( bool  aHeadless = false,
bool  aSkipPyInit = false,
bool  aIsUnitTest = false 
)
inherited

Initialize this program.

Initialize the process in a KiCad standard way using some generalized techniques:

  • Default paths (help, libs, bin) and configuration file names
  • Language and locale
  • fonts
Note
Do not initialize anything relating to DSOs or projects.
Parameters
aHeadlessIf true, run in headless mode (e.g. for unit tests)
aSkipPyInitIf true, do not init python stuff. Useful in application that do not use python, to disable python dependency at run time
Returns
true if success, false if failure and program is to terminate.

Should never happen but boost unit_test isn't playing nicely in some cases

Definition at line 397 of file pgm_base.cpp.

398{
399 // Just make sure we init precreate any folders early for later code
400 // In particular, the user cache path is the most likely to be hit by startup code
402
403#ifdef KICAD_USE_SENTRY
404 sentryInit();
405#endif
406 wxString pgm_name;
407
409 if( App().argc == 0 )
410 pgm_name = wxT( "kicad" );
411 else
412 pgm_name = wxFileName( App().argv[0] ).GetName().Lower();
413
414#ifdef KICAD_USE_SENTRY
415 sentry_set_tag( "kicad.app", pgm_name.c_str() );
416#endif
417
418 wxInitAllImageHandlers();
419
420 // Without this the wxPropertyGridManager segfaults on Windows.
421 if( !wxPGGlobalVars )
422 wxPGInitResourceModule();
423
424#ifndef __WINDOWS__
425 if( wxString( wxGetenv( "HOME" ) ).IsEmpty() )
426 {
427 DisplayErrorMessage( nullptr, _( "Environment variable HOME is empty. "
428 "Unable to continue." ) );
429 return false;
430 }
431#endif
432
433 // Init KiCad environment
434 // the environment variable KICAD (if exists) gives the kicad path:
435 // something like set KICAD=d:\kicad
436 bool isDefined = wxGetEnv( wxT( "KICAD" ), &m_kicad_env );
437
438 if( isDefined ) // ensure m_kicad_env ends by "/"
439 {
441
442 if( !m_kicad_env.IsEmpty() && m_kicad_env.Last() != '/' )
444 }
445
446 // Init parameters for configuration
447 App().SetVendorName( wxT( "KiCad" ) );
448 App().SetAppName( pgm_name );
449
450 // Install some image handlers, mainly for help
451 if( wxImage::FindHandler( wxBITMAP_TYPE_PNG ) == nullptr )
452 wxImage::AddHandler( new wxPNGHandler );
453
454 if( wxImage::FindHandler( wxBITMAP_TYPE_GIF ) == nullptr )
455 wxImage::AddHandler( new wxGIFHandler );
456
457 if( wxImage::FindHandler( wxBITMAP_TYPE_JPEG ) == nullptr )
458 wxImage::AddHandler( new wxJPEGHandler );
459
460 wxFileSystem::AddHandler( new wxZipFSHandler );
461
462 // Analyze the command line & initialize the binary path
463 wxString tmp;
466 SetDefaultLanguage( tmp );
467
468 m_settings_manager = std::make_unique<SETTINGS_MANAGER>( aHeadless );
469
470 // Our unit test mocks break if we continue
471 // A bug caused InitPgm to terminate early in unit tests and the mocks are...simplistic
472 // TODO fix the unit tests so this can be removed
473 if( aIsUnitTest )
474 return false;
475
476 // Something got in the way of settings load: can't continue
477 if( !m_settings_manager->IsOK() )
478 return false;
479
480 // Set up built-in environment variables (and override them from the system environment if set)
482
483 // Load color settings after env is initialized
484 m_settings_manager->ReloadColorSettings();
485
486 // Load common settings from disk after setting up env vars
488
489 // Init user language *before* calling loadSettings, because
490 // env vars could be incorrectly initialized on Linux
491 // (if the value contains some non ASCII7 chars, the env var is not initialized)
492 SetLanguage( tmp, true );
493
494 // Now that translations are available, inform the user if the OS is unsupported
496
498
499#ifdef KICAD_USE_SENTRY
500 sentryPrompt();
501#endif
502
503 ReadPdfBrowserInfos(); // needs GetCommonSettings()
504
505 // Create the python scripting stuff
506 // Skip it fot applications that do not use it
507 if( !aSkipPyInit )
508 m_python_scripting = std::make_unique<SCRIPTING>();
509
510 // TODO(JE): Remove this if apps are refactored to not assume Prj() always works
511 // Need to create a project early for now (it can have an empty path for the moment)
513
514 // This sets the maximum tooltip display duration to 10s (up from 5) but only affects
515 // Windows as other platforms display tooltips while the mouse is not moving
516 if( !aHeadless )
517 {
518 wxToolTip::Enable( true );
519 wxToolTip::SetAutoPop( 10000 );
520 }
521
522 if( ADVANCED_CFG::GetCfg().m_UpdateUIEventInterval != 0 )
523 wxUpdateUIEvent::SetUpdateInterval( ADVANCED_CFG::GetCfg().m_UpdateUIEventInterval );
524
525 return true;
526}
static const ADVANCED_CFG & GetCfg()
Get the singleton instance's config, which is shared by all consumers.
void InitializeEnvironment()
Creates the built-in environment variables and sets their default values.
static void EnsureUserPathsExist()
Ensures/creates user default paths.
Definition: paths.cpp:369
bool setExecutablePath()
Find the path to the executable and stores it in PGM_BASE::m_bin_dir.
Definition: pgm_base.cpp:529
void loadCommonSettings()
Loads internal settings from COMMON_SETTINGS.
Definition: pgm_base.cpp:571
virtual void ReadPdfBrowserInfos()
Read the PDF browser choice from the common configuration.
Definition: eda_doc.cpp:37
virtual void SetLanguagePath()
Definition: pgm_base.cpp:764
bool SetDefaultLanguage(wxString &aErrMsg)
Set the default language without reference to any preferences.
Definition: pgm_base.cpp:710
std::unique_ptr< SCRIPTING > m_python_scripting
Definition: pgm_base.h:332
virtual SETTINGS_MANAGER & GetSettingsManager() const
Definition: pgm_base.h:134
virtual bool SetLanguage(wxString &aErrMsg, bool first_time=false)
Set the dictionary file name for internationalization.
Definition: pgm_base.cpp:613
bool LoadProject(const wxString &aFullPath, bool aSetActive=true)
Loads 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:603
void DisplayErrorMessage(wxWindow *aParent, const wxString &aText, const wxString &aExtraInfo)
Display an error message with aMessage.
Definition: confirm.cpp:299
#define WIN_STRING_DIR_SEP
Definition: gestfich.h:36
#define UNIX_STRING_DIR_SEP
Definition: gestfich.h:35
APIIMPORT wxPGGlobalVarsClass * wxPGGlobalVars

References _, PGM_BASE::App(), DisplayErrorMessage(), PATHS::EnsureUserPathsExist(), ADVANCED_CFG::GetCfg(), PGM_BASE::GetCommonSettings(), PGM_BASE::GetSettingsManager(), COMMON_SETTINGS::InitializeEnvironment(), SETTINGS_MANAGER::Load(), PGM_BASE::loadCommonSettings(), SETTINGS_MANAGER::LoadProject(), PGM_BASE::m_kicad_env, PGM_BASE::m_python_scripting, PGM_BASE::m_settings_manager, PGM_BASE::ReadPdfBrowserInfos(), PGM_BASE::SetDefaultLanguage(), PGM_BASE::setExecutablePath(), PGM_BASE::SetLanguage(), PGM_BASE::SetLanguagePath(), UNIX_STRING_DIR_SEP, WarnUserIfOperatingSystemUnsupported(), WIN_STRING_DIR_SEP, and wxPGGlobalVars.

Referenced by PGM_KICAD::OnPgmInit().

◆ IsKicadEnvVariableDefined()

virtual bool PGM_BASE::IsKicadEnvVariableDefined ( ) const
inlinevirtualinherited

Definition at line 161 of file pgm_base.h.

161{ return !m_kicad_env.IsEmpty(); }

References PGM_BASE::m_kicad_env.

◆ loadCommonSettings()

void PGM_BASE::loadCommonSettings ( )
protectedinherited

Loads internal settings from COMMON_SETTINGS.

Definition at line 571 of file pgm_base.cpp.

572{
574
575 for( const std::pair<wxString, ENV_VAR_ITEM> it : GetCommonSettings()->m_Env.vars )
576 {
577 wxLogTrace( traceEnvVars, wxT( "PGM_BASE::loadSettings: Found entry %s = %s" ),
578 it.first, it.second.GetValue() );
579
580 // Do not store the env var PROJECT_VAR_NAME ("KIPRJMOD") definition if for some reason
581 // it is found in config. (It is reserved and defined as project path)
582 if( it.first == PROJECT_VAR_NAME )
583 continue;
584
585 // Don't set bogus empty entries in the environment
586 if( it.first.IsEmpty() )
587 continue;
588
589 // Do not overwrite vars set by the system environment with values from the settings file
590 if( it.second.GetDefinedExternally() )
591 continue;
592
593 SetLocalEnvVariable( it.first, it.second.GetValue() );
594 }
595}
virtual bool SetLocalEnvVariable(const wxString &aName, const wxString &aValue)
Sets the environment variable aName to aValue.
Definition: pgm_base.cpp:778
const wxChar *const traceEnvVars
Flag to enable debug output of environment variable operations.
#define PROJECT_VAR_NAME
A variable name whose value holds the current project directory.
Definition: project.h:39

References PGM_BASE::GetCommonSettings(), COMMON_SETTINGS::m_System, PGM_BASE::m_text_editor, PROJECT_VAR_NAME, PGM_BASE::SetLocalEnvVariable(), COMMON_SETTINGS::SYSTEM::text_editor, and traceEnvVars.

Referenced by PGM_BASE::InitPgm().

◆ MacOpenFile()

void PGM_SINGLE_TOP::MacOpenFile ( const wxString &  aFileName)
inlineoverridevirtual

Specific to MacOSX (not used under Linux or Windows).

MacOSX requires it for file association.

See also
http://wiki.wxwidgets.org/WxMac-specific_topics

Implements PGM_BASE.

Definition at line 85 of file single_top.cpp.

86 {
87 wxFileName filename( aFileName );
88
89 if( filename.FileExists() )
90 {
91 #if 0
92 // this pulls in EDA_DRAW_FRAME type info, which we don't want in
93 // the single_top link image.
94 KIWAY_PLAYER* frame = dynamic_cast<KIWAY_PLAYER*>( App().GetTopWindow() );
95 #else
96 KIWAY_PLAYER* frame = (KIWAY_PLAYER*) App().GetTopWindow();
97 #endif
98 if( frame )
99 {
100 if( wxWindow* blocking_win = frame->Kiway().GetBlockingDialog() )
101 blocking_win->Close( true );
102
103 frame->OpenProjectFiles( std::vector<wxString>( 1, aFileName ) );
104 }
105 }
106 }
KIWAY & Kiway() const
Return a reference to the KIWAY that this object has an opportunity to participate in.
Definition: kiway_holder.h:53
A wxFrame capable of the OpenProjectFiles function, meaning it can load a portion of a KiCad project.
Definition: kiway_player.h:66
virtual bool OpenProjectFiles(const std::vector< wxString > &aFileList, int aCtl=0)
Open a project or set of files given by aFileList.
Definition: kiway_player.h:118
wxWindow * GetBlockingDialog()
Gets the window pointer to the blocking dialog (to send it signals)
Definition: kiway.cpp:617

References PGM_BASE::App(), KIWAY::GetBlockingDialog(), KIWAY_HOLDER::Kiway(), and KIWAY_PLAYER::OpenProjectFiles().

◆ OnPgmExit()

void PGM_SINGLE_TOP::OnPgmExit ( )
inline

Definition at line 70 of file single_top.cpp.

71 {
73
75 {
77 m_settings_manager->Save();
78 }
79
80 // Destroy everything in PGM_BASE, especially wxSingleInstanceCheckerImpl
81 // earlier than wxApp and earlier than static destruction would.
83 }
void OnKiwayEnd()
Definition: kiway.cpp:680
void Destroy()
Definition: pgm_base.cpp:149
void SaveCommonSettings()
Save the program (process) settings subset which are stored .kicad_common.
Definition: pgm_base.cpp:598
KIWAY Kiway

References PGM_BASE::Destroy(), Kiway, PGM_BASE::m_settings_manager, KIWAY::OnKiwayEnd(), and PGM_BASE::SaveCommonSettings().

Referenced by APP_SINGLE_TOP::OnExit(), and APP_SINGLE_TOP::OnInit().

◆ OnPgmInit()

bool PGM_SINGLE_TOP::OnPgmInit ( )

Definition at line 277 of file single_top.cpp.

278{
279#if defined(DEBUG)
280 wxString absoluteArgv0 = wxStandardPaths::Get().GetExecutablePath();
281
282 if( !wxIsAbsolutePath( absoluteArgv0 ) )
283 {
284 wxLogError( wxT( "No meaningful argv[0]" ) );
285 return false;
286 }
287#endif
288
289 // Not all kicad applications use the python stuff. skip python init
290 // for these apps.
291 bool skip_python_initialization = false;
292#if defined( BITMAP_2_CMP ) || defined( PL_EDITOR ) || defined( GERBVIEW ) ||\
293 defined( PCB_CALCULATOR_BUILD )
294 skip_python_initialization = true;
295#endif
296
297 if( !InitPgm( false, skip_python_initialization ) )
298 {
299 // Clean up
300 OnPgmExit();
301 return false;
302 }
303
304#if !defined(BUILD_KIWAY_DLL)
305
306 // Only bitmap2component and pcb_calculator use this code currently, as they
307 // are not split to use single_top as a link image separate from a *.kiface.
308 // i.e. they are single part link images so don't need to load a *.kiface.
309
310 // Get the getter, it is statically linked into this binary image.
311 KIFACE_GETTER_FUNC* ki_getter = &KIFACE_GETTER;
312
313 int kiface_version;
314
315 // Get the KIFACE.
316 KIFACE* kiface = ki_getter( &kiface_version, KIFACE_VERSION, this );
317
318 // Trick the KIWAY into thinking it loaded a KIFACE, by recording the KIFACE
319 // in the KIWAY. It needs to be there for KIWAY::OnKiwayEnd() anyways.
320 Kiway.set_kiface( KIWAY::KifaceType( TOP_FRAME ), kiface );
321#endif
322
323 // Tell the settings manager about the current Kiway
325
326 // Use KIWAY to create a top window, which registers its existence also.
327 // "TOP_FRAME" is a macro that is passed on compiler command line from CMake,
328 // and is one of the types in FRAME_T.
329 KIWAY_PLAYER* frame = Kiway.Player( TOP_FRAME, true );
330
331 if( frame == nullptr )
332 {
333 return false;
334 }
335
336 Kiway.SetTop( frame );
337
338 App().SetTopWindow( frame ); // wxApp gets a face.
339 App().SetAppDisplayName( frame->GetAboutTitle() );
340
341 // Allocate a slice of time to show the frame and update wxWidgets widgets
342 // (especially setting valid sizes) after creating frame and before calling
343 // OpenProjectFiles() that can update/use some widgets.
344 // The 2 calls to wxSafeYield are needed on wxGTK for best results.
345 wxSafeYield();
346 frame->Show();
347 wxSafeYield();
348
349 // Now after the frame processing, the rest of the positional args are files
350 std::vector<wxString> fileArgs;
351
352
353 static const wxCmdLineEntryDesc desc[] = {
354 { wxCMD_LINE_PARAM, nullptr, nullptr, "File to load", wxCMD_LINE_VAL_STRING,
355 wxCMD_LINE_PARAM_MULTIPLE | wxCMD_LINE_PARAM_OPTIONAL },
356 { wxCMD_LINE_NONE, nullptr, nullptr, nullptr, wxCMD_LINE_VAL_NONE, 0 }
357 };
358
359 wxCmdLineParser parser( App().argc, App().argv );
360 parser.SetDesc( desc );
361 parser.Parse( false );
362 if( parser.GetParamCount() )
363 {
364 /*
365 gerbview handles multiple project data files, i.e. gerber files on
366 cmd line. Others currently do not, they handle only one. For common
367 code simplicity we simply pass all the arguments in however, each
368 program module can do with them what they want, ignore, complain
369 whatever. We don't establish policy here, as this is a multi-purpose
370 launcher.
371 */
372
373 for( size_t i = 0; i < parser.GetParamCount(); i++ )
374 fileArgs.push_back( parser.GetParam( i ) );
375
376 // special attention to a single argument: argv[1] (==argSet[0])
377 if( fileArgs.size() == 1 )
378 {
379 wxFileName argv1( fileArgs[0] );
380
381#if defined(PGM_DATA_FILE_EXT)
382 // PGM_DATA_FILE_EXT, if present, may be different for each compile,
383 // it may come from CMake on the compiler command line, but often does not.
384 // This facility is mostly useful for those program footprints
385 // supporting a single argv[1].
386 if( !argv1.GetExt() )
387 argv1.SetExt( wxT( PGM_DATA_FILE_EXT ) );
388#endif
389 argv1.MakeAbsolute();
390
391 fileArgs[0] = argv1.GetFullPath();
392 }
393
394 // Use the KIWAY_PLAYER::OpenProjectFiles() API function:
395 if( !frame->OpenProjectFiles( fileArgs ) )
396 {
397 // OpenProjectFiles() API asks that it report failure to the UI.
398 // Nothing further to say here.
399
400 // We've already initialized things at this point, but wx won't call OnExit if
401 // we fail out. Call our own cleanup routine here to ensure the relevant resources
402 // are freed at the right time (if they aren't, segfaults will occur).
403 OnPgmExit();
404
405 // Fail the process startup if the file could not be opened,
406 // although this is an optional choice, one that can be reversed
407 // also in the KIFACE specific OpenProjectFiles() return value.
408 return false;
409 }
410 }
411
412 return true;
413}
const wxString & GetAboutTitle() const
virtual KIWAY_PLAYER * Player(FRAME_T aFrameType, bool doCreate=true, wxTopLevelWindow *aParent=nullptr)
Return the KIWAY_PLAYER* given a FRAME_T.
Definition: kiway.cpp:394
static FACE_T KifaceType(FRAME_T aFrameType)
A simple mapping function which returns the FACE_T which is known to implement aFrameType.
Definition: kiway.cpp:332
bool set_kiface(FACE_T aFaceType, KIFACE *aKiface)
Definition: kiway.h:436
void SetTop(wxFrame *aTop)
Tell this KIWAY about the top most frame in the program and optionally allows it to play the role of ...
Definition: kiway.cpp:84
bool InitPgm(bool aHeadless=false, bool aSkipPyInit=false, bool aIsUnitTest=false)
Initialize this program.
Definition: pgm_base.cpp:397
void SetKiway(KIWAY *aKiway)
Associate this setting manager with the given Kiway.
return & kiface
Definition: cvpcb.cpp:112
KIFACE * KIFACE_GETTER_FUNC(int *aKIFACEversion, int aKIWAYversion, PGM_BASE *aProgram)
Point to the one and only KIFACE export.
Definition: kiway.h:492
#define KIFACE_GETTER
Definition: kiway.h:111
#define KIFACE_VERSION
The KIWAY and KIFACE classes are used to communicate between various process modules,...
Definition: kiway.h:110
Implement a participant in the KIWAY alchemy.
Definition: kiway.h:151
void OnPgmExit()
Definition: single_top.cpp:70

References EDA_BASE_FRAME::GetAboutTitle(), PGM_BASE::GetExecutablePath(), GetSettingsManager(), kiface, KIFACE_GETTER, KIFACE_VERSION, KIWAY::KifaceType(), Kiway, KIWAY_PLAYER::OpenProjectFiles(), KIWAY::Player(), KIWAY::set_kiface(), SETTINGS_MANAGER::SetKiway(), and KIWAY::SetTop().

Referenced by APP_SINGLE_TOP::OnInit().

◆ ReadPdfBrowserInfos()

void PGM_BASE::ReadPdfBrowserInfos ( )
virtualinherited

Read the PDF browser choice from the common configuration.

Definition at line 37 of file eda_doc.cpp.

38{
39 SetPdfBrowserName( GetCommonSettings()->m_System.pdf_viewer_name );
41}
virtual void SetPdfBrowserName(const wxString &aFileName)
Definition: pgm_base.h:171

References PGM_BASE::GetCommonSettings(), COMMON_SETTINGS::m_System, PGM_BASE::m_use_system_pdf_browser, PGM_BASE::SetPdfBrowserName(), and COMMON_SETTINGS::SYSTEM::use_system_pdf_viewer.

Referenced by PGM_BASE::InitPgm().

◆ SaveCommonSettings()

void PGM_BASE::SaveCommonSettings ( )
inherited

Save the program (process) settings subset which are stored .kicad_common.

Definition at line 598 of file pgm_base.cpp.

599{
600 // GetCommonSettings() is not initialized until fairly late in the
601 // process startup: InitPgm(), so test before using:
602 if( GetCommonSettings() )
603 GetCommonSettings()->m_System.working_dir = wxGetCwd();
604}

References PGM_BASE::GetCommonSettings(), COMMON_SETTINGS::m_System, and COMMON_SETTINGS::SYSTEM::working_dir.

Referenced by OnPgmExit(), and PGM_KICAD::OnPgmExit().

◆ SetDefaultLanguage()

bool PGM_BASE::SetDefaultLanguage ( wxString &  aErrMsg)
inherited

Set the default language without reference to any preferences.

Can be used to set the language for dialogs that show before preferences are loaded

Parameters
aErrMsgString to return the error message(s) in
Returns
false if the language could not be set

Definition at line 710 of file pgm_base.cpp.

711{
712 setLanguageId( wxLANGUAGE_DEFAULT );
713
714 // dictionary file name without extend (full name is kicad.mo)
715 wxString dictionaryName( wxT( "kicad" ) );
716
717 delete m_locale;
718 m_locale = new wxLocale;
719 m_locale->Init();
720
721 // Try adding the dictionary if it is not currently loaded
722 if( !m_locale->IsLoaded( dictionaryName ) )
723 m_locale->AddCatalog( dictionaryName );
724
725 // Verify the Kicad dictionary was loaded properly
726 // However, for the English language, the dictionary is not mandatory, as
727 // all messages are already in English, just restricted to ASCII7 chars,
728 // the verification is skipped.
729 if( !m_locale->IsLoaded( dictionaryName ) && m_language_id != wxLANGUAGE_ENGLISH )
730 {
731 wxLogTrace( traceLocale, wxT( "Unable to load dictionary %s.mo in %s" ),
732 dictionaryName, m_locale->GetName() );
733
734 setLanguageId( wxLANGUAGE_DEFAULT );
735 delete m_locale;
736
737 m_locale = new wxLocale;
738 m_locale->Init();
739
740 aErrMsg = _( "The KiCad language file for this language is not installed." );
741 return false;
742 }
743
744 return true;
745}
void setLanguageId(int aId)
Trap all changes in here, simplifies debugging.
Definition: pgm_base.h:314
const wxChar *const traceLocale
Flag to enable locale debug output.

References _, PGM_BASE::m_language_id, PGM_BASE::m_locale, PGM_BASE::setLanguageId(), and traceLocale.

Referenced by PGM_BASE::InitPgm().

◆ setExecutablePath()

bool PGM_BASE::setExecutablePath ( )
protectedinherited

Find the path to the executable and stores it in PGM_BASE::m_bin_dir.

Returns
true if success, else false.

Definition at line 529 of file pgm_base.cpp.

530{
531 m_bin_dir = wxStandardPaths::Get().GetExecutablePath();
532
533#ifdef __WXMAC__
534 // On OSX Pgm().GetExecutablePath() will always point to main
535 // bundle directory, e.g., /Applications/kicad.app/
536
537 wxFileName fn( m_bin_dir );
538
539 if( fn.GetName() == wxT( "kicad" ) || fn.GetName() == wxT( "kicad-cli" ) )
540 {
541 // kicad launcher, so just remove the Contents/MacOS part
542 fn.RemoveLastDir();
543 fn.RemoveLastDir();
544 }
545 else
546 {
547 // standalone binaries live in Contents/Applications/<standalone>.app/Contents/MacOS
548 fn.RemoveLastDir();
549 fn.RemoveLastDir();
550 fn.RemoveLastDir();
551 fn.RemoveLastDir();
552 fn.RemoveLastDir();
553 }
554
555 m_bin_dir = fn.GetPath() + wxT( "/" );
556#else
557 // Use unix notation for paths. I am not sure this is a good idea,
558 // but it simplifies compatibility between Windows and Unices.
559 // However it is a potential problem in path handling under Windows.
561
562 // Remove file name form command line:
563 while( m_bin_dir.Last() != '/' && !m_bin_dir.IsEmpty() )
564 m_bin_dir.RemoveLast();
565#endif
566
567 return true;
568}

References PGM_BASE::m_bin_dir, UNIX_STRING_DIR_SEP, and WIN_STRING_DIR_SEP.

Referenced by PGM_BASE::InitPgm().

◆ SetLanguage()

bool PGM_BASE::SetLanguage ( wxString &  aErrMsg,
bool  first_time = false 
)
virtualinherited

Set the dictionary file name for internationalization.

The files are in kicad/internat/xx or kicad/internat/xx_XX and are named kicad.mo

Parameters
aErrMsgis the string to return the error message it.
first_timemust be set to true the first time this function is called, false otherwise.
Returns
false if there was an error setting the language.

Definition at line 613 of file pgm_base.cpp.

614{
615 if( first_time )
616 {
617 setLanguageId( wxLANGUAGE_DEFAULT );
618 // First time SetLanguage is called, the user selected language id is set
619 // from common user config settings
620 wxString languageSel = GetCommonSettings()->m_System.language;
621
622 // Search for the current selection
623 for( unsigned ii = 0; LanguagesList[ii].m_KI_Lang_Identifier != 0; ii++ )
624 {
625 if( LanguagesList[ii].m_Lang_Label == languageSel )
626 {
627 setLanguageId( LanguagesList[ii].m_WX_Lang_Identifier );
628 break;
629 }
630 }
631 }
632
633 // dictionary file name without extend (full name is kicad.mo)
634 wxString dictionaryName( wxT( "kicad" ) );
635
636 delete m_locale;
637 m_locale = new wxLocale;
638
639 // don't use wxLOCALE_LOAD_DEFAULT flag so that Init() doesn't return
640 // false just because it failed to load wxstd catalog
641 if( !m_locale->Init( m_language_id, wxLOCALE_DONT_LOAD_DEFAULT ) )
642 {
643 wxLogTrace( traceLocale, wxT( "This language is not supported by the system." ) );
644
645 setLanguageId( wxLANGUAGE_DEFAULT );
646 delete m_locale;
647
648 m_locale = new wxLocale;
649 m_locale->Init( wxLANGUAGE_DEFAULT, wxLOCALE_DONT_LOAD_DEFAULT);
650
651 aErrMsg = _( "This language is not supported by the operating system." );
652 return false;
653 }
654 else if( !first_time )
655 {
656 wxLogTrace( traceLocale, wxT( "Search for dictionary %s.mo in %s" ) ,
657 dictionaryName, m_locale->GetName() );
658 }
659
660 if( !first_time )
661 {
662 // If we are here, the user has selected another language.
663 // Therefore the new preferred language name is stored in common config.
664 // Do NOT store the wxWidgets language Id, it can change between wxWidgets
665 // versions, for a given language
666 wxString languageSel;
667
668 // Search for the current selection language name
669 for( unsigned ii = 0; LanguagesList[ii].m_KI_Lang_Identifier != 0; ii++ )
670 {
671 if( LanguagesList[ii].m_WX_Lang_Identifier == m_language_id )
672 {
673 languageSel = LanguagesList[ii].m_Lang_Label;
674 break;
675 }
676 }
677
679 cfg->m_System.language = languageSel;
680 cfg->SaveToFile( GetSettingsManager().GetPathForSettingsFile( cfg ) );
681 }
682
683 // Try adding the dictionary if it is not currently loaded
684 if( !m_locale->IsLoaded( dictionaryName ) )
685 m_locale->AddCatalog( dictionaryName );
686
687 // Verify the Kicad dictionary was loaded properly
688 // However, for the English language, the dictionary is not mandatory, as
689 // all messages are already in English, just restricted to ASCII7 chars,
690 // the verification is skipped.
691 if( !m_locale->IsLoaded( dictionaryName ) && m_language_id != wxLANGUAGE_ENGLISH )
692 {
693 wxLogTrace( traceLocale, wxT( "Unable to load dictionary %s.mo in %s" ),
694 dictionaryName, m_locale->GetName() );
695
696 setLanguageId( wxLANGUAGE_DEFAULT );
697 delete m_locale;
698
699 m_locale = new wxLocale;
700 m_locale->Init( wxLANGUAGE_DEFAULT, wxLOCALE_DONT_LOAD_DEFAULT);
701
702 aErrMsg = _( "The KiCad language file for this language is not installed." );
703 return false;
704 }
705
706 return true;
707}
virtual bool SaveToFile(const wxString &aDirectory="", bool aForce=false)
LANGUAGE_DESCR LanguagesList[]
An array containing all the languages that KiCad supports.
Definition: pgm_base.cpp:83
int m_KI_Lang_Identifier
KiCad identifier used in menu selection (See id.h)
Definition: pgm_base.h:65
wxString m_Lang_Label
Labels used in menus.
Definition: pgm_base.h:68

References _, PGM_BASE::GetCommonSettings(), PGM_BASE::GetSettingsManager(), COMMON_SETTINGS::SYSTEM::language, LanguagesList, LANGUAGE_DESCR::m_KI_Lang_Identifier, LANGUAGE_DESCR::m_Lang_Label, PGM_BASE::m_language_id, PGM_BASE::m_locale, COMMON_SETTINGS::m_System, JSON_SETTINGS::SaveToFile(), PGM_BASE::setLanguageId(), and traceLocale.

Referenced by PGM_BASE::InitPgm().

◆ setLanguageId()

void PGM_BASE::setLanguageId ( int  aId)
inlineprotectedinherited

Trap all changes in here, simplifies debugging.

Definition at line 314 of file pgm_base.h.

314{ m_language_id = aId; }

References PGM_BASE::m_language_id.

Referenced by PGM_BASE::PGM_BASE(), PGM_BASE::SetDefaultLanguage(), PGM_BASE::SetLanguage(), and PGM_BASE::SetLanguageIdentifier().

◆ SetLanguageIdentifier()

void PGM_BASE::SetLanguageIdentifier ( int  menu_id)
virtualinherited

Set in .m_language_id member the wxWidgets language identifier ID from the KiCad menu id (internal menu identifier).

Parameters
menu_idThe KiCad menuitem id (returned by Menu Event, when clicking on a menu item)

Definition at line 748 of file pgm_base.cpp.

749{
750 wxLogTrace( traceLocale, wxT( "Select language ID %d from %d possible languages." ),
751 menu_id, (int)arrayDim( LanguagesList )-1 );
752
753 for( unsigned ii = 0; LanguagesList[ii].m_KI_Lang_Identifier != 0; ii++ )
754 {
755 if( menu_id == LanguagesList[ii].m_KI_Lang_Identifier )
756 {
757 setLanguageId( LanguagesList[ii].m_WX_Lang_Identifier );
758 break;
759 }
760 }
761}
constexpr std::size_t arrayDim(T const (&)[N]) noexcept
Returns # of elements in an array.
Definition: arraydim.h:31

References arrayDim(), LanguagesList, LANGUAGE_DESCR::m_KI_Lang_Identifier, PGM_BASE::setLanguageId(), and traceLocale.

◆ SetLanguagePath()

void PGM_BASE::SetLanguagePath ( )
virtualinherited

Definition at line 764 of file pgm_base.cpp.

765{
766 wxLocale::AddCatalogLookupPathPrefix( PATHS::GetLocaleDataPath() );
767
768 if( wxGetEnv( wxT( "KICAD_RUN_FROM_BUILD_DIR" ), nullptr ) )
769 {
770 wxFileName fn( Pgm().GetExecutablePath() );
771 fn.RemoveLastDir();
772 fn.AppendDir( wxT( "translation" ) );
773 wxLocale::AddCatalogLookupPathPrefix( fn.GetPath() );
774 }
775}
static wxString GetLocaleDataPath()
Gets the locales translation data path.
Definition: paths.cpp:252
virtual const wxString & GetExecutablePath() const
Definition: pgm_base.h:165
KIWAY Kiway & Pgm(), KFCTL_STANDALONE
The global Program "get" accessor.
Definition: single_top.cpp:111

References PGM_BASE::GetExecutablePath(), PATHS::GetLocaleDataPath(), and Pgm().

Referenced by PGM_BASE::InitPgm().

◆ SetLocalEnvVariable()

bool PGM_BASE::SetLocalEnvVariable ( const wxString &  aName,
const wxString &  aValue 
)
virtualinherited

Sets the environment variable aName to aValue.

This function first checks to see if the environment variable aName is already defined. If it is not defined, then the environment variable aName is set to a value. Otherwise, the environment variable is left unchanged. This allows the user to override environment variables for testing purposes.

Parameters
aNameis a wxString containing the environment variable name.
aValueis a wxString containing the environment variable value.
Returns
true if the environment variable Name was set to aValue.

Definition at line 778 of file pgm_base.cpp.

779{
780 wxString env;
781
782 if( aName.IsEmpty() )
783 {
784 wxLogTrace( traceEnvVars,
785 wxT( "PGM_BASE::SetLocalEnvVariable: Attempt to set empty variable to value %s" ),
786 aValue );
787 return false;
788 }
789
790 // Check to see if the environment variable is already set.
791 if( wxGetEnv( aName, &env ) )
792 {
793 wxLogTrace( traceEnvVars,
794 wxT( "PGM_BASE::SetLocalEnvVariable: Environment variable %s already set to %s" ),
795 aName, env );
796 return env == aValue;
797 }
798
799 wxLogTrace( traceEnvVars,
800 wxT( "PGM_BASE::SetLocalEnvVariable: Setting local environment variable %s to %s" ),
801 aName, aValue );
802
803 return wxSetEnv( aName, aValue );
804}

References traceEnvVars.

Referenced by PGM_BASE::loadCommonSettings().

◆ SetLocalEnvVariables()

void PGM_BASE::SetLocalEnvVariables ( )
virtualinherited

Updates the local environment with the contents of the current ENV_VAR_MAP stored in the COMMON_SETTINGS.

See also
GetLocalEnvVariables()

Definition at line 807 of file pgm_base.cpp.

808{
809 // Overwrites externally defined environment variable until the next time the application
810 // is run.
811 for( const std::pair<wxString, ENV_VAR_ITEM> m_local_env_var : GetCommonSettings()->m_Env.vars )
812 {
813 wxLogTrace( traceEnvVars,
814 wxT( "PGM_BASE::SetLocalEnvVariables: Setting local environment variable %s to %s" ),
815 m_local_env_var.first,
816 m_local_env_var.second.GetValue() );
817 wxSetEnv( m_local_env_var.first, m_local_env_var.second.GetValue() );
818 }
819}

References PGM_BASE::GetCommonSettings(), and traceEnvVars.

◆ SetPdfBrowserName()

virtual void PGM_BASE::SetPdfBrowserName ( const wxString &  aFileName)
inlinevirtualinherited

Definition at line 171 of file pgm_base.h.

171{ m_pdf_browser = aFileName; }

References PGM_BASE::m_pdf_browser.

Referenced by PGM_BASE::ReadPdfBrowserInfos().

◆ SetTextEditor()

void PGM_BASE::SetTextEditor ( const wxString &  aFileName)
virtualinherited

◆ UseSystemPdfBrowser()

virtual bool PGM_BASE::UseSystemPdfBrowser ( ) const
inlinevirtualinherited
Returns
true if the PDF browser is the default (system) PDF browser and false if the PDF browser is the preferred (selected) browser, else returns false if there is no selected browser.

Definition at line 178 of file pgm_base.h.

179 {
180 return m_use_system_pdf_browser || m_pdf_browser.IsEmpty();
181 }

References PGM_BASE::m_pdf_browser, and PGM_BASE::m_use_system_pdf_browser.

◆ WritePdfBrowserInfos()

void PGM_BASE::WritePdfBrowserInfos ( )
virtualinherited

Member Data Documentation

◆ m_argcUtf8

int PGM_BASE::m_argcUtf8
protectedinherited

argv parameters converted to utf8 form, because wxwidgets has opinions and will return argv as either force converted to ascii in char* or wchar_t only

Definition at line 354 of file pgm_base.h.

Referenced by PGM_BASE::BuildArgvUtf8(), PGM_BASE::PGM_BASE(), and PGM_BASE::~PGM_BASE().

◆ m_argvUtf8

char** PGM_BASE::m_argvUtf8
protectedinherited

Definition at line 351 of file pgm_base.h.

Referenced by PGM_BASE::BuildArgvUtf8(), PGM_BASE::PGM_BASE(), and PGM_BASE::~PGM_BASE().

◆ m_bin_dir

wxString PGM_BASE::m_bin_dir
protectedinherited

Definition at line 334 of file pgm_base.h.

Referenced by PGM_BASE::GetExecutablePath(), and PGM_BASE::setExecutablePath().

◆ m_kicad_env

wxString PGM_BASE::m_kicad_env
protectedinherited

full path to this program

Definition at line 335 of file pgm_base.h.

Referenced by PGM_BASE::GetKicadEnvVariable(), PGM_BASE::InitPgm(), and PGM_BASE::IsKicadEnvVariableDefined().

◆ m_language_id

int PGM_BASE::m_language_id
protectedinherited

◆ m_locale

wxLocale* PGM_BASE::m_locale
protectedinherited

The KICAD system environment variable.

Definition at line 337 of file pgm_base.h.

Referenced by PGM_BASE::Destroy(), PGM_BASE::GetLocale(), PGM_BASE::PGM_BASE(), PGM_BASE::SetDefaultLanguage(), and PGM_BASE::SetLanguage().

◆ m_ModalDialogCount

int PGM_BASE::m_ModalDialogCount
inherited

◆ m_pdf_browser

wxString PGM_BASE::m_pdf_browser
protectedinherited

◆ m_Printing

bool PGM_BASE::m_Printing
inherited

wxWidgets on MSW tends to crash if you spool up more than one print job at a time.

Definition at line 303 of file pgm_base.h.

Referenced by BOARD::ComputeBoundingBox(), and PGM_BASE::PGM_BASE().

◆ m_python_scripting

std::unique_ptr<SCRIPTING> PGM_BASE::m_python_scripting
protectedinherited

Definition at line 332 of file pgm_base.h.

Referenced by PGM_BASE::InitPgm().

◆ m_Quitting

bool PGM_BASE::m_Quitting
inherited

Definition at line 307 of file pgm_base.h.

Referenced by PGM_BASE::PGM_BASE().

◆ m_settings_manager

std::unique_ptr<SETTINGS_MANAGER> PGM_BASE::m_settings_manager
protectedinherited

◆ m_text_editor

wxString PGM_BASE::m_text_editor
protectedinherited

Filename of the app selected for browsing PDFs.

Definition at line 343 of file pgm_base.h.

Referenced by PGM_BASE::GetTextEditor(), PGM_BASE::loadCommonSettings(), and PGM_BASE::SetTextEditor().

◆ m_use_system_pdf_browser

bool PGM_BASE::m_use_system_pdf_browser
protectedinherited

◆ workingDirKey

const wxChar PGM_BASE::workingDirKey[]
staticinherited

Definition at line 264 of file pgm_base.h.


The documentation for this struct was generated from the following file: