KiCad PCB EDA Suite
|
PGM_KICAD extends PGM_BASE to bring in FileHistory() and PdfBrowser() which were moved from EDA_APP into KIFACE_BASE. More...
#include <pgm_kicad.h>
Public Member Functions | |
PGM_KICAD () | |
~PGM_KICAD () throw () | |
bool | OnPgmInit () |
void | OnPgmExit () |
int | OnPgmRun () |
void | MacOpenFile (const wxString &aFileName) override |
Specific to MacOSX (not used under Linux or Windows). More... | |
APP_SETTINGS_BASE * | PgmSettings () |
SEARCH_STACK & | SysSearch () |
wxString | GetHelpFileName () |
void | Destroy () |
void | BuildArgvUtf8 () |
Builds the UTF8 based argv variable. More... | |
virtual SETTINGS_MANAGER & | GetSettingsManager () const |
virtual COMMON_SETTINGS * | GetCommonSettings () 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 wxString | GetLanguageTag () |
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_MAP & | GetLocalEnvVariables () 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 | SaveCommonSettings () |
Save the program (process) settings subset which are stored .kicad_common. More... | |
void | HandleException (std::exception_ptr aPtr) |
A exception handler to be used at the top level if exceptions bubble up that for. More... | |
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. More... | |
bool | IsGUI () |
Determine if the application is running with a GUI. 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... | |
std::vector< void * > | m_ModalDialogs |
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 | |
BIN_MOD | m_bm |
std::unique_ptr< SETTINGS_MANAGER > | m_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... | |
PGM_KICAD extends PGM_BASE to bring in FileHistory() and PdfBrowser() which were moved from EDA_APP into KIFACE_BASE.
KIFACE_BASE is not applicable in the project manager since it is not a KIFACE. This header is in the kicad directory since nobody else needs to know about it.
Definition at line 37 of file pgm_kicad.h.
|
inline |
Definition at line 40 of file pgm_kicad.h.
|
inline |
Definition at line 44 of file pgm_kicad.h.
References Destroy().
|
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 167 of file pgm_base.cpp.
Referenced by PGM_BASE::BuildArgvUtf8(), PGM_BASE::InitPgm(), PGM_SINGLE_TOP::MacOpenFile(), MacOpenFile(), PGM_TEST_FRAME::MacOpenFile(), and OnPgmInit().
|
virtualinherited |
Shows a dialog that instructs the user to select a new preferred editor.
aDefaultEditor | Default full path for the default editor this dialog should show by default. |
Definition at line 217 of file pgm_base.cpp.
Referenced by PGM_BASE::GetTextEditor().
|
inherited |
Builds the UTF8 based argv variable.
Definition at line 387 of file pgm_base.cpp.
References PGM_BASE::App(), PGM_BASE::m_argcUtf8, and PGM_BASE::m_argvUtf8.
void PGM_KICAD::Destroy | ( | ) |
Definition at line 396 of file kicad.cpp.
References PGM_BASE::Destroy(), BIN_MOD::End(), and m_bm.
Referenced by OnPgmExit(), and ~PGM_KICAD().
|
inlinevirtualinherited |
Force the use of system PDF browser, even if a preferred PDF browser is set.
Definition at line 188 of file pgm_base.h.
References PGM_BASE::m_use_system_pdf_browser.
Referenced by PGM_BASE::PGM_BASE().
|
virtualinherited |
Definition at line 621 of file pgm_base.cpp.
References PGM_BASE::m_settings_manager.
Referenced by PGM_BASE::GetLocalEnvVariables(), PGM_BASE::InitPgm(), PGM_BASE::loadCommonSettings(), PGM_BASE::ReadPdfBrowserInfos(), PGM_BASE::SaveCommonSettings(), PGM_BASE::SetLanguage(), PGM_BASE::SetLocalEnvVariables(), PGM_BASE::SetTextEditor(), and PGM_BASE::WritePdfBrowserInfos().
|
inlinevirtualinherited |
Definition at line 167 of file pgm_base.h.
References PGM_BASE::m_bin_dir.
Referenced by PGM_SINGLE_TOP::OnPgmInit(), and PGM_BASE::SetLanguagePath().
|
inline |
Definition at line 59 of file pgm_kicad.h.
References m_bm, and BIN_MOD::m_help_file.
Referenced by KICAD_MANAGER_FRAME::help_name().
|
inlinevirtualinherited |
Definition at line 165 of file pgm_base.h.
References PGM_BASE::m_kicad_env.
|
virtualinherited |
Definition at line 784 of file pgm_base.cpp.
References PGM_BASE::m_language_id.
|
inlinevirtualinherited |
Definition at line 169 of file pgm_base.h.
References PGM_BASE::m_locale.
|
virtualinherited |
Definition at line 862 of file pgm_base.cpp.
References PGM_BASE::GetCommonSettings(), COMMON_SETTINGS::m_Env, and COMMON_SETTINGS::ENVIRONMENT::vars.
Referenced by BOOST_AUTO_TEST_CASE(), BOOST_FIXTURE_TEST_CASE(), FILENAME_RESOLVER::GetKicadPaths(), and OnPgmInit().
|
inlinevirtualinherited |
Definition at line 171 of file pgm_base.h.
References PGM_BASE::m_pdf_browser.
Referenced by PGM_BASE::WritePdfBrowserInfos().
|
inlinevirtualinherited |
Definition at line 222 of file pgm_base.h.
References PGM_BASE::m_language_id.
|
inlinevirtualinherited |
Definition at line 136 of file pgm_base.h.
References PGM_BASE::m_settings_manager.
Referenced by PGM_BASE::InitPgm(), LIB_PIN::LIB_PIN(), CV::IFACE::OnKifaceStart(), SCH::IFACE::OnKifaceStart(), GERBV::IFACE::OnKifaceStart(), PGE::IFACE::OnKifaceStart(), PCBCALC::IFACE::OnKifaceStart(), PCB::IFACE::OnKifaceStart(), OnPgmInit(), and PGM_BASE::SetLanguage().
|
virtualinherited |
Return the path to the preferred text editor application.
aCanShowFileChooser | If 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. |
Definition at line 181 of file pgm_base.cpp.
References _, PGM_BASE::AskUserForPreferredEditor(), DisplayInfoMessage(), PGM_BASE::m_text_editor, and PGM_BASE::SetTextEditor().
|
inherited |
A common assert handler to be used between single_top and kicad.
This lets us have a common set of assert handling, including triggering sentry reports
aFile | the file path of the assert |
aLine | the line number of the assert |
aFunc | the function name the assert is within |
aCond | the condition of the assert |
aMsg | the attached assert message (can be empty) |
Definition at line 921 of file pgm_base.cpp.
Referenced by CustomAssertHandler().
|
inherited |
A exception handler to be used at the top level if exceptions bubble up that for.
The purpose is to have a central place to log a wxWidgets error message and/or sentry report
aPtr | Pass the std::current_exception() from within the catch block |
Definition at line 886 of file pgm_base.cpp.
References FROM_UTF8(), name, and IO_ERROR::What().
Referenced by APP_KICAD::OnRun(), and APP_KICAD_CLI::OnRun().
|
inherited |
Initialize this program.
Initialize the process in a KiCad standard way using some generalized techniques:
aHeadless | If true, run in headless mode (e.g. for unit tests) |
aSkipPyInit | If true, do not init python stuff. Useful in application that do not use python, to disable python dependency at run time |
Should never happen but boost unit_test isn't playing nicely in some cases
Definition at line 402 of file pgm_base.cpp.
References _, PGM_BASE::App(), DisplayErrorMessage(), PATHS::EnsureUserPathsExist(), ADVANCED_CFG::GetCfg(), PGM_BASE::GetCommonSettings(), PGM_BASE::GetSettingsManager(), KICAD_CURL::Init(), 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 OnPgmInit().
|
inherited |
Determine if the application is running with a GUI.
Definition at line 868 of file pgm_base.cpp.
References KICAD_CLI_APP_NAME.
|
inlinevirtualinherited |
Definition at line 163 of file pgm_base.h.
References PGM_BASE::m_kicad_env.
|
protectedinherited |
Loads internal settings from COMMON_SETTINGS.
Definition at line 585 of file pgm_base.cpp.
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().
|
overridevirtual |
Specific to MacOSX (not used under Linux or Windows).
MacOSX requires it for file association.
Implements PGM_BASE.
Definition at line 383 of file kicad.cpp.
References PGM_BASE::App(), and KICAD_MANAGER_FRAME::LoadProject().
void PGM_KICAD::OnPgmExit | ( | ) |
Definition at line 366 of file kicad.cpp.
References Destroy(), Kiway, PGM_BASE::m_settings_manager, KIWAY::OnKiwayEnd(), and PGM_BASE::SaveCommonSettings().
Referenced by APP_KICAD::OnExit(), APP_KICAD_CLI::OnExit(), APP_KICAD::OnInit(), APP_KICAD_CLI::OnInit(), and OnPgmInit().
bool PGM_KICAD::OnPgmInit | ( | ) |
Definition at line 94 of file kicad.cpp.
References _, SEARCH_STACK::AddPaths(), PGM_BASE::App(), FRAME_BM2CMP, FRAME_CALC, FRAME_FOOTPRINT_EDITOR, FRAME_GERBER, FRAME_PCB_EDITOR, FRAME_PL_EDITOR, FRAME_SCH, FRAME_T_COUNT, EDA_BASE_FRAME::GetAboutTitle(), PGM_BASE::GetLocalEnvVariables(), PGM_BASE::GetSettingsManager(), PATHS::GetUserTemplatesPath(), BIN_MOD::Init(), PGM_BASE::InitPgm(), BIN_MOD::InitSettings(), KFCTL_CPP_PROJECT_SUITE, KFCTL_STANDALONE, KICAD_MAIN_FRAME_T, Kiway, LegacyProjectFileExtension, KICAD_MANAGER_FRAME::LoadProject(), m_bm, KICAD_SETTINGS::m_OpenProjects, BIN_MOD::m_search, name, OnPgmExit(), KIWAY_PLAYER::OpenProjectFiles(), PgmSettings(), KIWAY::Player(), ProjectFileExtension, SETTINGS_MANAGER::RegisterSettings(), KIWAY::SetCtlBits(), SETTINGS_MANAGER::SetKiway(), KIWAY::SetTop(), and SystemDirsAppend().
Referenced by APP_KICAD::OnInit(), and APP_KICAD_CLI::OnInit().
int PGM_KICAD::OnPgmRun | ( | ) |
Definition at line 360 of file kicad.cpp.
Referenced by APP_KICAD_CLI::OnRun().
|
inline |
Definition at line 55 of file pgm_kicad.h.
References m_bm, and BIN_MOD::m_config.
Referenced by KICAD_MANAGER_FRAME::config(), and OnPgmInit().
|
virtualinherited |
Read the PDF browser choice from the common configuration.
Definition at line 37 of file eda_doc.cpp.
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().
|
inherited |
Save the program (process) settings subset which are stored .kicad_common.
Definition at line 612 of file pgm_base.cpp.
References PGM_BASE::GetCommonSettings(), COMMON_SETTINGS::m_System, and COMMON_SETTINGS::SYSTEM::working_dir.
Referenced by PGM_SINGLE_TOP::OnPgmExit(), and OnPgmExit().
|
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
aErrMsg | String to return the error message(s) in |
Definition at line 727 of file pgm_base.cpp.
References _, PGM_BASE::m_language_id, PGM_BASE::m_locale, PGM_BASE::setLanguageId(), and traceLocale.
Referenced by PGM_BASE::InitPgm().
|
protectedinherited |
Find the path to the executable and stores it in PGM_BASE::m_bin_dir.
Definition at line 543 of file pgm_base.cpp.
References PGM_BASE::m_bin_dir, UNIX_STRING_DIR_SEP, and WIN_STRING_DIR_SEP.
Referenced by PGM_BASE::InitPgm().
|
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
aErrMsg | is the string to return the error message it. |
first_time | must be set to true the first time this function is called, false otherwise. |
Definition at line 627 of file pgm_base.cpp.
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().
|
inlineprotectedinherited |
Trap all changes in here, simplifies debugging.
Definition at line 369 of file pgm_base.h.
References PGM_BASE::m_language_id.
Referenced by PGM_BASE::PGM_BASE(), PGM_BASE::SetDefaultLanguage(), PGM_BASE::SetLanguage(), and PGM_BASE::SetLanguageIdentifier().
|
virtualinherited |
Set in .m_language_id member the wxWidgets language identifier ID from the KiCad menu id (internal menu identifier).
menu_id | The KiCad menuitem id (returned by Menu Event, when clicking on a menu item) |
Definition at line 768 of file pgm_base.cpp.
References arrayDim(), LanguagesList, LANGUAGE_DESCR::m_KI_Lang_Identifier, PGM_BASE::setLanguageId(), and traceLocale.
|
virtualinherited |
Definition at line 804 of file pgm_base.cpp.
References PGM_BASE::GetExecutablePath(), PATHS::GetLocaleDataPath(), and Pgm().
Referenced by PGM_BASE::InitPgm().
|
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.
aName | is a wxString containing the environment variable name. |
aValue | is a wxString containing the environment variable value. |
Definition at line 818 of file pgm_base.cpp.
References traceEnvVars.
Referenced by PGM_BASE::loadCommonSettings().
|
virtualinherited |
Updates the local environment with the contents of the current ENV_VAR_MAP stored in the COMMON_SETTINGS.
Definition at line 847 of file pgm_base.cpp.
References PGM_BASE::GetCommonSettings(), and traceEnvVars.
|
inlinevirtualinherited |
Definition at line 173 of file pgm_base.h.
References PGM_BASE::m_pdf_browser.
Referenced by PGM_BASE::ReadPdfBrowserInfos().
|
virtualinherited |
Definition at line 174 of file pgm_base.cpp.
References PGM_BASE::GetCommonSettings(), COMMON_SETTINGS::m_System, PGM_BASE::m_text_editor, and COMMON_SETTINGS::SYSTEM::text_editor.
Referenced by PGM_BASE::GetTextEditor().
|
inline |
Definition at line 57 of file pgm_kicad.h.
References m_bm, and BIN_MOD::m_search.
Referenced by KICAD_MANAGER_FRAME::sys_search().
|
inlinevirtualinherited |
Definition at line 180 of file pgm_base.h.
References PGM_BASE::m_pdf_browser, and PGM_BASE::m_use_system_pdf_browser.
|
virtualinherited |
Save the PDF browser choice to the common configuration.
Definition at line 44 of file eda_doc.cpp.
References PGM_BASE::GetCommonSettings(), PGM_BASE::GetPdfBrowserName(), COMMON_SETTINGS::m_System, PGM_BASE::m_use_system_pdf_browser, COMMON_SETTINGS::SYSTEM::pdf_viewer_name, and COMMON_SETTINGS::SYSTEM::use_system_pdf_viewer.
|
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 409 of file pgm_base.h.
Referenced by PGM_BASE::BuildArgvUtf8(), PGM_BASE::PGM_BASE(), and PGM_BASE::~PGM_BASE().
|
protectedinherited |
Definition at line 406 of file pgm_base.h.
Referenced by PGM_BASE::BuildArgvUtf8(), PGM_BASE::PGM_BASE(), and PGM_BASE::~PGM_BASE().
|
protectedinherited |
Definition at line 389 of file pgm_base.h.
Referenced by PGM_BASE::GetExecutablePath(), and PGM_BASE::setExecutablePath().
|
protected |
Definition at line 68 of file pgm_kicad.h.
Referenced by Destroy(), GetHelpFileName(), OnPgmInit(), PgmSettings(), and SysSearch().
|
protectedinherited |
full path to this program
Definition at line 390 of file pgm_base.h.
Referenced by PGM_BASE::GetKicadEnvVariable(), PGM_BASE::InitPgm(), and PGM_BASE::IsKicadEnvVariableDefined().
|
protectedinherited |
Definition at line 393 of file pgm_base.h.
Referenced by PGM_BASE::GetLanguageTag(), PGM_BASE::GetSelectedLanguageIdentifier(), PGM_BASE::SetDefaultLanguage(), PGM_BASE::SetLanguage(), and PGM_BASE::setLanguageId().
|
protectedinherited |
The KICAD system environment variable.
Definition at line 392 of file pgm_base.h.
Referenced by PGM_BASE::Destroy(), PGM_BASE::GetLocale(), PGM_BASE::PGM_BASE(), PGM_BASE::SetDefaultLanguage(), and PGM_BASE::SetLanguage().
|
inherited |
Definition at line 360 of file pgm_base.h.
Referenced by APP_KICAD::FilterEvent().
|
protectedinherited |
Definition at line 396 of file pgm_base.h.
Referenced by PGM_BASE::GetPdfBrowserName(), PGM_BASE::SetPdfBrowserName(), and PGM_BASE::UseSystemPdfBrowser().
|
inherited |
wxWidgets on MSW tends to crash if you spool up more than one print job at a time.
Definition at line 358 of file pgm_base.h.
Referenced by BOARD::ComputeBoundingBox(), and PGM_BASE::PGM_BASE().
|
protectedinherited |
Definition at line 387 of file pgm_base.h.
Referenced by PGM_BASE::InitPgm().
|
inherited |
Definition at line 362 of file pgm_base.h.
Referenced by PGM_BASE::PGM_BASE().
|
protectedinherited |
Definition at line 385 of file pgm_base.h.
Referenced by PGM_BASE::GetCommonSettings(), PGM_BASE::GetSettingsManager(), PGM_BASE::InitPgm(), PGM_SINGLE_TOP::OnPgmExit(), and OnPgmExit().
|
protectedinherited |
Filename of the app selected for browsing PDFs.
Definition at line 398 of file pgm_base.h.
Referenced by PGM_BASE::GetTextEditor(), PGM_BASE::loadCommonSettings(), and PGM_BASE::SetTextEditor().
|
protectedinherited |
Definition at line 395 of file pgm_base.h.
Referenced by PGM_BASE::ForceSystemPdfBrowser(), PGM_BASE::ReadPdfBrowserInfos(), PGM_BASE::UseSystemPdfBrowser(), and PGM_BASE::WritePdfBrowserInfos().
|
staticinherited |
Definition at line 271 of file pgm_base.h.