KiCad PCB EDA Suite
Loading...
Searching...
No Matches
PGM_BASE Class Referenceabstract

Container for data for KiCad programs. More...

#include <pgm_base.h>

Inheritance diagram for PGM_BASE:
PGM_KICAD PGM_SINGLE_TOP PGM_TEST_FRAME

Public Member Functions

 PGM_BASE ()
 
virtual ~PGM_BASE ()
 
void BuildArgvUtf8 ()
 Builds the UTF8 based argv variable.
 
BS::thread_pool & GetThreadPool ()
 
GL_CONTEXT_MANAGERGetGLContextManager ()
 
virtual void MacOpenFile (const wxString &aFileName)=0
 Specific to MacOSX (not used under Linux or Windows).
 
virtual SETTINGS_MANAGERGetSettingsManager () const
 
virtual COMMON_SETTINGSGetCommonSettings () const
 
virtual BACKGROUND_JOBS_MONITORGetBackgroundJobMonitor () const
 
virtual NOTIFICATIONS_MANAGERGetNotificationsManager () const
 
virtual void SetTextEditor (const wxString &aFileName)
 
virtual const wxString & GetTextEditor (bool aCanShowFileChooser=true)
 Return the path to the preferred text editor application.
 
virtual const wxString AskUserForPreferredEditor (const wxString &aDefaultEditor=wxEmptyString)
 Show a dialog that instructs the user to select a new preferred editor.
 
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.
 
virtual bool SetLanguage (wxString &aErrMsg, bool first_time=false)
 Set the dictionary file name for internationalization.
 
bool SetDefaultLanguage (wxString &aErrMsg)
 Set the default language without reference to any preferences.
 
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).
 
virtual int GetSelectedLanguageIdentifier () const
 
virtual wxString GetLanguageTag ()
 
virtual void SetLanguagePath ()
 
virtual void ReadPdfBrowserInfos ()
 Read the PDF browser choice from the common configuration.
 
virtual void WritePdfBrowserInfos ()
 Save the PDF browser choice to the common configuration.
 
virtual bool SetLocalEnvVariable (const wxString &aName, const wxString &aValue)
 Set the environment variable aName to aValue.
 
virtual void SetLocalEnvVariables ()
 Update the local environment with the contents of the current ENV_VAR_MAP stored in the COMMON_SETTINGS.
 
virtual ENV_VAR_MAPGetLocalEnvVariables () const
 
virtual wxApp & App ()
 Return a bare naked wxApp which may come from wxPython, SINGLE_TOP, or kicad.exe.
 
bool InitPgm (bool aHeadless=false, bool aSkipPyInit=false, bool aIsUnitTest=false)
 Initialize this program.
 
void Destroy ()
 
void SaveCommonSettings ()
 Save the program (process) settings subset which are stored .kicad_common.
 
void HandleException (std::exception_ptr aPtr)
 A exception handler to be used at the top level if exceptions bubble up that for.
 
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.
 
bool IsGUI ()
 Determine if the application is running with a GUI.
 
void ShowSplash ()
 
void HideSplash ()
 
std::unique_ptr< wxSingleInstanceChecker > & SingleInstance ()
 Allow access to the wxSingleInstanceChecker to test for other running KiCads.
 

Public Attributes

bool m_Printing
 wxWidgets on MSW tends to crash if you spool up more than one print job at a time.
 
std::vector< void * > m_ModalDialogs
 
bool m_Quitting
 
bool m_PropertyGridInitialized
 

Static Public Attributes

static const wxChar workingDirKey []
 

Protected Member Functions

void loadCommonSettings ()
 Load internal settings from COMMON_SETTINGS.
 
void setLanguageId (int aId)
 Trap all changes in here, simplifies debugging.
 

Protected Attributes

std::unique_ptr< SETTINGS_MANAGERm_settings_manager
 
std::unique_ptr< BACKGROUND_JOBS_MONITORm_background_jobs_monitor
 
std::unique_ptr< NOTIFICATIONS_MANAGERm_notifications_manager
 
std::unique_ptr< SCRIPTING > m_python_scripting
 
std::unique_ptr< wxSingleInstanceChecker > m_pgm_checker
 Check if there is another copy of Kicad running at the same time.
 
wxString m_kicad_env
 The KICAD system environment variable.
 
wxLocale * m_locale
 
int m_language_id
 
bool m_use_system_pdf_browser
 
wxString m_pdf_browser
 Filename of the app selected for browsing PDFs.
 
wxString m_text_editor
 
KICAD_SINGLETON m_singleton
 
char ** m_argvUtf8
 argv parameters converted to utf8 form because wxWidgets has opinions.
 
int m_argcUtf8
 
wxSplashScreen * m_splash
 

Detailed Description

Container for data for KiCad programs.

The functions are virtual so we can do cross module calls without linking to them. This used to be a wxApp derivative, but that is difficult under wxPython which shapes the wxApp. So now this is a "side-car" (like a motorcycle side-car) object with a back pointer into the wxApp which initializes it.

  • OnPgmStart() is virtual, may be overridden, and parallels wxApp::OnInit(), from where it should called.
  • OnPgmEnd() is virtual, may be overridden, and parallels wxApp::OnExit(), from where it should be called.

Definition at line 102 of file pgm_base.h.

Constructor & Destructor Documentation

◆ PGM_BASE()

◆ ~PGM_BASE()

PGM_BASE::~PGM_BASE ( )
virtual

Definition at line 153 of file pgm_base.cpp.

References Destroy(), HideSplash(), m_argcUtf8, m_argvUtf8, and m_locale.

Member Function Documentation

◆ App()

wxApp & PGM_BASE::App ( )
virtual

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

This should return what wxGetApp() returns.

Definition at line 182 of file pgm_base.cpp.

Referenced by BuildArgvUtf8(), DIALOG_SHIM::DIALOG_SHIM(), drawShapes(), InitPgm(), PGM_SINGLE_TOP::MacOpenFile(), PGM_KICAD::MacOpenFile(), PGM_TEST_FRAME::MacOpenFile(), PGM_KICAD::OnPgmInit(), playground_main_func(), PROJECT_SCH::SchLibs(), SetTopFrame(), and DIALOG_DRC::updateUI().

◆ AskUserForPreferredEditor()

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

Show 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
the full path of the editor, or an empty string if no editor was chosen.

Definition at line 232 of file pgm_base.cpp.

References _, name, and path.

Referenced by GetTextEditor(), and PANEL_COMMON_SETTINGS::OnTextEditorClick().

◆ BuildArgvUtf8()

void PGM_BASE::BuildArgvUtf8 ( )

Builds the UTF8 based argv variable.

Definition at line 412 of file pgm_base.cpp.

References App(), m_argcUtf8, and m_argvUtf8.

◆ Destroy()

void PGM_BASE::Destroy ( )

◆ ForceSystemPdfBrowser()

virtual void PGM_BASE::ForceSystemPdfBrowser ( bool  aFlg)
inlinevirtual

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

Definition at line 193 of file pgm_base.h.

Referenced by PGM_BASE(), and PANEL_COMMON_SETTINGS::TransferDataFromWindow().

◆ GetBackgroundJobMonitor()

◆ GetCommonSettings()

COMMON_SETTINGS * PGM_BASE::GetCommonSettings ( ) const
virtual

Definition at line 689 of file pgm_base.cpp.

References m_settings_manager.

Referenced by ACTION_TOOLBAR_PALETTE::AddAction(), KIUI::AddBitmapToMenuItem(), SYMBOL_TREE_MODEL_ADAPTER::AddLibraries(), DESIGN_BLOCK_TREE_MODEL_ADAPTER::AddLibraries(), FP_TREE_MODEL_ADAPTER::AddLibraries(), DIALOG_FOOTPRINT_CHOOSER::build3DCanvas(), CVPCB_MAINFRAME::BuildLibrariesList(), PROJECT_PCB::Cleanup3DCache(), TOOLS_HOLDER::CommonSettingsChanged(), EDA_BASE_FRAME::CommonSettingsChanged(), EDA_DRAW_FRAME::CommonSettingsChanged(), KICAD_MANAGER_FRAME::CommonSettingsChanged(), DESIGN_BLOCK_PREVIEW_WIDGET::DESIGN_BLOCK_PREVIEW_WIDGET(), DIALOG_EXPORT_STEP::DIALOG_EXPORT_STEP(), GERBVIEW_FRAME::GERBVIEW_FRAME(), EDA_BASE_FRAME::GetAutoSaveInterval(), GetLocalEnvVariables(), WX_AUI_TOOLBAR_ART::GetToolSize(), EDA_DRAW_PANEL_GAL::GetVcSettings(), SCH_DRAWING_TOOLS::ImportSheet(), InitPgm(), KIGFX::PCB_RENDER_SETTINGS::LoadColors(), EDA_3D_VIEWER_FRAME::loadCommonSettings(), loadCommonSettings(), PANEL_PREVIEW_3D_MODEL::loadSettings(), KIGFX::WX_VIEW_CONTROLS::LoadSettings(), EDA_BASE_FRAME::LoadSettings(), EDA_DRAW_FRAME::LoadSettings(), APP_SETTINGS_BASE::MigrateFromLegacy(), EESCHEMA_SETTINGS::MigrateFromLegacy(), GERBVIEW_SETTINGS::MigrateFromLegacy(), PROJECT_TREE_PANE::onGitCommit(), DIALOG_CONFIGURE_PATHS::OnGridCellChanging(), KICAD_MANAGER_FRAME::OnIdle(), BITMAP_BUTTON::OnPaint(), SYMBOL_EDITOR_CONTROL::OpenDirectory(), FOOTPRINT_EDITOR_CONTROL::OpenDirectory(), PANEL_EESCHEMA_COLOR_SETTINGS::PANEL_EESCHEMA_COLOR_SETTINGS(), PANEL_SETUP_NETCLASSES::PANEL_SETUP_NETCLASSES(), PANEL_SETUP_RULES::PANEL_SETUP_RULES(), PANEL_SYMBOL_CHOOSER::PANEL_SYMBOL_CHOOSER(), PROJECT::PinLibrary(), BOARD_EDITOR_CONTROL::PlaceFootprint(), SCH_DRAWING_TOOLS::PlaceImage(), DRAWING_TOOL::PlaceReferenceImage(), SCH_DRAWING_TOOLS::PlaceSymbol(), DRAWING_TOOL::PlaceText(), ReadPdfBrowserInfos(), SCH_EDIT_FRAME::ReCreateHToolbar(), PCB_EDIT_FRAME::ReCreateHToolbar(), SYMBOL_VIEWER_FRAME::ReCreateLibList(), FOOTPRINT_VIEWER_FRAME::ReCreateLibraryList(), SAVE_AS_DIALOG::SAVE_AS_DIALOG(), SaveCommonSettings(), PCB_BASE_FRAME::SelectLibrary(), SCH_BASE_FRAME::SelectLibraryFromList(), SetLanguage(), SetLocalEnvVariables(), PANEL_PACKAGES_VIEW::SetSashOnIdle(), SetTextEditor(), SYMBOL_PREVIEW_WIDGET::SYMBOL_PREVIEW_WIDGET(), SYMBOL_TREE_SYNCHRONIZING_ADAPTER::Sync(), FP_TREE_SYNCHRONIZING_ADAPTER::Sync(), BITMAP_STORE::ThemeChanged(), PANEL_GIT_REPOS::TransferDataFromWindow(), PANEL_COMMON_SETTINGS::TransferDataFromWindow(), PANEL_MOUSE_SETTINGS::TransferDataFromWindow(), PANEL_GIT_REPOS::TransferDataToWindow(), PANEL_COMMON_SETTINGS::TransferDataToWindow(), PANEL_MOUSE_SETTINGS::TransferDataToWindow(), PANEL_PCBNEW_ACTION_PLUGINS::TransferDataToWindow(), SCH_DRAWING_TOOLS::TwoClickPlace(), SYMBOL_EDITOR_DRAWING_TOOLS::TwoClickPlace(), PCB_CONTROL::unfilledZoneCheck(), PROJECT::UnpinLibrary(), WritePdfBrowserInfos(), PANEL_PACKAGES_VIEW::~PANEL_PACKAGES_VIEW(), PANEL_SETUP_NETCLASSES::~PANEL_SETUP_NETCLASSES(), and PANEL_SETUP_RULES::~PANEL_SETUP_RULES().

◆ GetExecutablePath()

◆ GetGLContextManager()

◆ GetKicadEnvVariable()

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

Definition at line 170 of file pgm_base.h.

Referenced by FindKicadFile().

◆ GetLanguageTag()

wxString PGM_BASE::GetLanguageTag ( )
virtual
Returns
the current selected language in rfc3066 format

Definition at line 853 of file pgm_base.cpp.

References m_language_id.

Referenced by UPDATE_MANAGER::CheckForUpdate().

◆ GetLocale()

virtual wxLocale * PGM_BASE::GetLocale ( )
inlinevirtual

◆ GetLocalEnvVariables()

◆ GetNotificationsManager()

virtual NOTIFICATIONS_MANAGER & PGM_BASE::GetNotificationsManager ( ) const
inlinevirtual

◆ GetPdfBrowserName()

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

◆ GetSelectedLanguageIdentifier()

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

Definition at line 229 of file pgm_base.h.

Referenced by InitTables(), and EDA_BASE_FRAME::setupUIConditions().

◆ GetSettingsManager()

virtual SETTINGS_MANAGER & PGM_BASE::GetSettingsManager ( ) const
inlinevirtual

Definition at line 125 of file pgm_base.h.

Referenced by PANEL_DESIGN_BLOCK_LIB_TABLE::browseLibrariesHandler(), PANEL_FP_LIB_TABLE::browseLibrariesHandler(), PANEL_SYM_LIB_TABLE::browseLibrariesHandler(), DIALOG_FOOTPRINT_CHOOSER::build3DCanvas(), FOOTPRINT_CHOOSER_FRAME::build3DCanvas(), PCB_NET_INSPECTOR_PANEL::buildColumns(), PCB_NET_INSPECTOR_PANEL::buildNetsList(), UPDATE_MANAGER::CheckForUpdate(), KICAD_MANAGER_FRAME::CloseProject(), EDA_BASE_FRAME::commonInit(), SCH_EDIT_FRAME::CommonSettingsChanged(), SYMBOL_VIEWER_FRAME::CommonSettingsChanged(), GERBVIEW_FRAME::CommonSettingsChanged(), PL_EDITOR_FRAME::CommonSettingsChanged(), FOOTPRINT_EDIT_FRAME::CommonSettingsChanged(), FOOTPRINT_EDIT_FRAME::config(), PANEL_SYMBOL_CHOOSER::constructRightPanel(), BMP2CMP::IFACE::CreateKiWindow(), SCH::IFACE::CreateKiWindow(), PCB::IFACE::CreateKiWindow(), DESIGN_BLOCK_PREVIEW_WIDGET::DESIGN_BLOCK_PREVIEW_WIDGET(), DIALOG_FOOTPRINT_WIZARD_LIST::DIALOG_FOOTPRINT_WIZARD_LIST(), SYMBOL_PREVIEW_WIDGET::DisplayPart(), SYMBOL_PREVIEW_WIDGET::DisplaySymbol(), SYMBOL_EDITOR_DRAWING_TOOLS::doDrawShape(), SCH_MOVE_TOOL::doMoveSelection(), CLI::JOBSET_RUN_COMMAND::doPerform(), GRID_CELL_LAYER_RENDERER::Draw(), BIN_MOD::End(), EVT_TOOL_RANGE(), GERBVIEW_DRAW_PANEL_GAL::GERBVIEW_DRAW_PANEL_GAL(), PCB_EDITOR_CONDITIONS::get45degModeFunc(), PCB_EDIT_FRAME::GetActionPluginButtonVisible(), PCBNEW_JOBS_HANDLER::getBoard(), BOARD_ADAPTER::GetBoardEditorCopperLayerColors(), SCH_MARKER::getColor(), PCB_MARKER::getColor(), FOOTPRINT_CHOOSER_FRAME::GetColorSettings(), EDA_DRAW_FRAME::GetColorSettings(), DISPLAY_FOOTPRINTS_FRAME::GetColorSettings(), SCH_BASE_FRAME::GetColorSettings(), SYMBOL_EDIT_FRAME::GetColorSettings(), GERBVIEW_FRAME::GetColorSettings(), FOOTPRINT_EDIT_FRAME::GetColorSettings(), FOOTPRINT_VIEWER_FRAME::GetColorSettings(), FOOTPRINT_WIZARD_FRAME::GetColorSettings(), PCB_BASE_EDIT_FRAME::GetColorSettings(), SCH_ITEM::GetDefaultFont(), PCB_BASE_FRAME::GetFootprintEditorSettings(), DRC_TEST_PROVIDER_CLEARANCE_BASE::GetGraphicsHandler(), GetLastPinLength(), GetLastPinNameSize(), GetLastPinNumSize(), PCB_LAYER_PRESENTATION::getLayerColor(), GetLayerColor(), BOARD_ADAPTER::GetLayerColors(), DISPLAY_FOOTPRINTS_FRAME::GetMagneticItemsSettings(), PCB_EDIT_FRAME::GetOrderedActionPlugins(), PCB_BASE_FRAME::GetPcbNewSettings(), GetPgmSettings(), KICAD_MANAGER_FRAME::GetProjectFileName(), EESCHEMA_JOBS_HANDLER::getSchematic(), FOOTPRINT_EDIT_FRAME::GetSettings(), SCH_BASE_FRAME::GetViewerSettingsBase(), PCB_BASE_FRAME::GetViewerSettingsBase(), DISPLAY_FOOTPRINTS_FRAME::GetViewerSettingsBase(), DISPLAY_FOOTPRINTS_FRAME::GetWindowSettings(), gvconfig(), API_HANDLER_COMMON::handleExpandTextVariables(), API_HANDLER_COMMON::handleGetNetClasses(), API_HANDLER_COMMON::handleGetTextVariables(), HandleJobConfig(), API_HANDLER_COMMON::handleSetNetClasses(), API_HANDLER_COMMON::handleSetTextVariables(), IfaceOrAddress(), DIALOG_EXPORT_2581::Init(), DIALOG_EXPORT_ODBPP::Init(), init_unit_test(), DIALOG_PLOT_SCHEMATIC::initDlg(), InitPgm(), EESCHEMA_JOBS_HANDLER::InitRenderSettings(), PCB_TOOL_BASE::Is45Limited(), PCBNEW_JOBS_HANDLER::JobExportRender(), EESCHEMA_JOBS_HANDLER::JobSymExportSvg(), PCBNEW_PRINTOUT_SETTINGS::Load(), PANEL_EESCHEMA_EDITING_OPTIONS::loadEEschemaSettings(), DESIGN_BLOCK_LIB_TABLE::LoadGlobalTable(), FP_LIB_TABLE::LoadGlobalTable(), SYMBOL_LIB_TABLE::LoadGlobalTable(), loadKicadProject(), KICAD_MANAGER_FRAME::LoadProject(), PANEL_PREVIEW_3D_MODEL::loadSettings(), PCB_TEST_FRAME_BASE::LoadSettings(), SYMBOL_VIEWER_FRAME::LoadSettings(), FOOTPRINT_VIEWER_FRAME::LoadSettings(), PCB_VIEWER_TOOLS::MeasureTool(), EESCHEMA_SETTINGS::MigrateFromLegacy(), GERBVIEW_SETTINGS::MigrateFromLegacy(), FOOTPRINT_EDITOR_SETTINGS::MigrateFromLegacy(), PCBNEW_SETTINGS::MigrateFromLegacy(), PCB_NET_INSPECTOR_PANEL::netFilterMatches(), FOOTPRINT_PREVIEW_PANEL::New(), KICAD_MANAGER_CONTROL::NewFromTemplate(), PCB_NET_INSPECTOR_PANEL::OnBoardChanged(), PCB_NET_INSPECTOR_PANEL::OnConfigButton(), LIB_TREE::onDetailsLink(), PANEL_PACKAGES_VIEW::OnDownloadVersionClicked(), CV::IFACE::OnKifaceStart(), SCH::IFACE::OnKifaceStart(), GERBV::IFACE::OnKifaceStart(), PGE::IFACE::OnKifaceStart(), PCBCALC::IFACE::OnKifaceStart(), PCB::IFACE::OnKifaceStart(), DIALOG_PCM::OnManageRepositoriesClicked(), DIALOG_CONFIG_EQUFILES::OnOkClick(), PGM_KICAD::OnPgmInit(), PANEL_COLOR_SETTINGS::OnThemeChanged(), PANEL_DESIGN_BLOCK_CHOOSER::PANEL_DESIGN_BLOCK_CHOOSER(), PANEL_DESIGN_BLOCK_LIB_TABLE::PANEL_DESIGN_BLOCK_LIB_TABLE(), PANEL_EESCHEMA_COLOR_SETTINGS::PANEL_EESCHEMA_COLOR_SETTINGS(), PANEL_FP_EDITOR_COLOR_SETTINGS::PANEL_FP_EDITOR_COLOR_SETTINGS(), PANEL_FP_LIB_TABLE::PANEL_FP_LIB_TABLE(), PANEL_FP_PROPERTIES_3D_MODEL::PANEL_FP_PROPERTIES_3D_MODEL(), PANEL_GERBVIEW_COLOR_SETTINGS::PANEL_GERBVIEW_COLOR_SETTINGS(), PANEL_GERBVIEW_DISPLAY_OPTIONS::PANEL_GERBVIEW_DISPLAY_OPTIONS(), PANEL_PCBNEW_COLOR_SETTINGS::PANEL_PCBNEW_COLOR_SETTINGS(), PANEL_SYM_LIB_TABLE::PANEL_SYM_LIB_TABLE(), PANEL_SYMBOL_CHOOSER::PANEL_SYMBOL_CHOOSER(), PANEL_TEMPLATE_FIELDNAMES::PANEL_TEMPLATE_FIELDNAMES(), PROJECT::PinLibrary(), PL_DRAW_PANEL_GAL::PL_DRAW_PANEL_GAL(), EXPORT_SVG::Plot(), SCH_PLOTTER::Plot(), SCH_SHEET::Plot(), DIALOG_PLOT::Plot(), PCB_PLOTTER::PlotJobToPlotOpts(), POSITION_RELATIVE_TOOL::PositionRelativeInteractively(), SCH_PRINTOUT::PrintPage(), KIWAY::Prj(), EDA_3D_VIEWER_FRAME::Process_Special_Functions(), PIN_LAYOUT_CACHE::recomputeCaches(), BOARD_ADAPTER::ReloadColorSettings(), EDA_3D_CANVAS::RenderEngineChanged(), SCH_EDIT_TOOL::RepeatDrawItem(), SYMBOL_EDITOR_PIN_TOOL::RepeatPin(), PCBNEW_PRINTOUT_SETTINGS::Save(), PANEL_COLOR_SETTINGS::saveCurrentTheme(), SaveFileAs(), PCB_NET_INSPECTOR_PANEL::SaveSettings(), EDA_3D_VIEWER_FRAME::SaveSettings(), SYMBOL_VIEWER_FRAME::SaveSettings(), GERBVIEW_FRAME::SaveSettings(), SCH_DRAW_PANEL::SCH_DRAW_PANEL(), SCHEMATIC_SETTINGS::SCHEMATIC_SETTINGS(), PCB_TEST_FRAME_BASE::SetBoard(), SetLanguage(), BOARD_ADAPTER::SetLayerColors(), PANEL_SYM_LIB_TABLE::setupGrid(), PANEL_FP_LIB_TABLE::setupGrid(), PIN_TABLE_DATA_MODEL::SetValue(), KICAD_MANAGER_CONTROL::ShowPluginManager(), EDA_BASE_FRAME::ShowPreferences(), SCH_EDIT_FRAME::ShowSchematicSetupDialog(), SYMBOL_EDIT_FRAME::SYMBOL_EDIT_FRAME(), SYMBOL_PREVIEW_WIDGET::SYMBOL_PREVIEW_WIDGET(), EDA_3D_VIEWER_FRAME::ToggleAppearanceManager(), DRAWING_TOOL::ToggleHV45Mode(), PANEL_3D_DISPLAY_OPTIONS::TransferDataFromWindow(), PANEL_3D_OPENGL_OPTIONS::TransferDataFromWindow(), PANEL_3D_RAYTRACING_OPTIONS::TransferDataFromWindow(), PANEL_PACKAGES_AND_UPDATES::TransferDataFromWindow(), PANEL_EESCHEMA_ANNOTATION_OPTIONS::TransferDataFromWindow(), PANEL_EESCHEMA_COLOR_SETTINGS::TransferDataFromWindow(), PANEL_EESCHEMA_DISPLAY_OPTIONS::TransferDataFromWindow(), PANEL_EESCHEMA_EDITING_OPTIONS::TransferDataFromWindow(), PANEL_SIMULATOR_PREFERENCES::TransferDataFromWindow(), PANEL_SYM_COLOR_SETTINGS::TransferDataFromWindow(), PANEL_SYM_DISPLAY_OPTIONS::TransferDataFromWindow(), PANEL_SYM_EDITING_OPTIONS::TransferDataFromWindow(), PANEL_TEMPLATE_FIELDNAMES::TransferDataFromWindow(), PANEL_GERBVIEW_COLOR_SETTINGS::TransferDataFromWindow(), PANEL_GERBVIEW_DISPLAY_OPTIONS::TransferDataFromWindow(), PANEL_GERBVIEW_EXCELLON_SETTINGS::TransferDataFromWindow(), PANEL_COMMON_SETTINGS::TransferDataFromWindow(), PANEL_PLUGIN_SETTINGS::TransferDataFromWindow(), DIALOG_UPDATE_CHECK_PROMPT::TransferDataFromWindow(), PANEL_PL_EDITOR_COLOR_SETTINGS::TransferDataFromWindow(), DIALOG_EXPORT_2581::TransferDataFromWindow(), DIALOG_EXPORT_ODBPP::TransferDataFromWindow(), PANEL_EDIT_OPTIONS::TransferDataFromWindow(), PANEL_FP_EDITOR_COLOR_SETTINGS::TransferDataFromWindow(), PANEL_PCB_DISPLAY_OPTIONS::TransferDataFromWindow(), PANEL_PCBNEW_COLOR_SETTINGS::TransferDataFromWindow(), PANEL_3D_DISPLAY_OPTIONS::TransferDataToWindow(), PANEL_3D_OPENGL_OPTIONS::TransferDataToWindow(), PANEL_3D_RAYTRACING_OPTIONS::TransferDataToWindow(), PANEL_PACKAGES_AND_UPDATES::TransferDataToWindow(), DIALOG_LIB_SYMBOL_PROPERTIES::TransferDataToWindow(), PANEL_EESCHEMA_ANNOTATION_OPTIONS::TransferDataToWindow(), PANEL_EESCHEMA_DISPLAY_OPTIONS::TransferDataToWindow(), PANEL_EESCHEMA_EDITING_OPTIONS::TransferDataToWindow(), PANEL_SIMULATOR_PREFERENCES::TransferDataToWindow(), PANEL_SYM_COLOR_SETTINGS::TransferDataToWindow(), PANEL_SYM_DISPLAY_OPTIONS::TransferDataToWindow(), PANEL_SYM_EDITING_OPTIONS::TransferDataToWindow(), PANEL_GERBVIEW_DISPLAY_OPTIONS::TransferDataToWindow(), PANEL_GERBVIEW_EXCELLON_SETTINGS::TransferDataToWindow(), PANEL_PLUGIN_SETTINGS::TransferDataToWindow(), PANEL_PL_EDITOR_COLOR_SETTINGS::TransferDataToWindow(), PANEL_EDIT_OPTIONS::TransferDataToWindow(), PANEL_PCB_DISPLAY_OPTIONS::TransferDataToWindow(), SYMBOL_EDITOR_DRAWING_TOOLS::TwoClickPlace(), PROJECT::UnpinLibrary(), PCB_DRAW_PANEL_GAL::UpdateColors(), DRAWING_TOOL::UpdateStatusBar(), KIGFX::PCB_PAINTER::viewer_settings(), DIALOG_FOOTPRINT_WIZARD_LIST::~DIALOG_FOOTPRINT_WIZARD_LIST(), PANEL_FOOTPRINT_CHOOSER::~PANEL_FOOTPRINT_CHOOSER(), and SYMBOL_EDIT_FRAME::~SYMBOL_EDIT_FRAME().

◆ GetTextEditor()

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

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 196 of file pgm_base.cpp.

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

Referenced by KICAD_MANAGER_CONTROL::Execute(), DIALOG_CONFIG_EQUFILES::OnEditEquFile(), DIALOG_BOM::OnEditGenerator(), PROJECT_TREE_PANE::onOpenSelectedFileWithTextEditor(), SYMBOL_EDITOR_CONTROL::OpenWithTextEditor(), FOOTPRINT_EDITOR_CONTROL::OpenWithTextEditor(), and GERBVIEW_INSPECTION_TOOL::ShowSource().

◆ GetThreadPool()

BS::thread_pool & PGM_BASE::GetThreadPool ( )
inline

Definition at line 113 of file pgm_base.h.

◆ HandleAssert()

void PGM_BASE::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.

This lets us have a common set of assert handling, including triggering sentry reports.

Parameters
aFilethe file path of the assert.
aLinethe line number of the assert.
aFuncthe function name the assert is within.
aCondthe condition of the assert.
aMsgthe attached assert message (can be empty).

Definition at line 1007 of file pgm_base.cpp.

◆ HandleException()

void PGM_BASE::HandleException ( std::exception_ptr  aPtr)

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.

Parameters
aPtrPass the std::current_exception() from within the catch block.

Definition at line 950 of file pgm_base.cpp.

References From_UTF8(), name, and IO_ERROR::What().

Referenced by KIWAY::KiFACE(), APP_SINGLE_TOP::OnInit(), APP_SINGLE_TOP::OnRun(), APP_KICAD::OnRun(), APP_KICAD_CLI::OnRun(), and KIWAY::Player().

◆ HideSplash()

◆ InitPgm()

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

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 457 of file pgm_base.cpp.

References _, App(), DisplayErrorMessage(), COMMON_SETTINGS::API::enable_server, PATHS::EnsurePathExists(), PATHS::EnsureUserPathsExist(), ADVANCED_CFG::GetCfg(), GetCommonSettings(), PATHS::GetInstanceCheckerPath(), GetMajorMinorVersion(), GetNotificationsManager(), GetSettingsManager(), KICAD_CURL::Init(), KICAD_SINGLETON::Init(), COMMON_SETTINGS::InitializeEnvironment(), NOTIFICATIONS_MANAGER::Load(), SETTINGS_MANAGER::Load(), loadCommonSettings(), SETTINGS_MANAGER::LoadProject(), COMMON_SETTINGS::m_Api, m_background_jobs_monitor, m_kicad_env, m_notifications_manager, m_pgm_checker, m_python_scripting, m_settings_manager, m_singleton, COMMON_SETTINGS::API::python_interpreter, ReadPdfBrowserInfos(), SetDefaultLanguage(), SetLanguage(), SetLanguagePath(), ShowSplash(), UNIX_STRING_DIR_SEP, WarnUserIfOperatingSystemUnsupported(), WIN_STRING_DIR_SEP, and wxPGGlobalVars.

Referenced by init_unit_test(), main(), and PGM_KICAD::OnPgmInit().

◆ IsGUI()

bool PGM_BASE::IsGUI ( )

Determine if the application is running with a GUI.

Returns
true if there is a GUI and false otherwise.

Definition at line 941 of file pgm_base.cpp.

◆ IsKicadEnvVariableDefined()

virtual bool PGM_BASE::IsKicadEnvVariableDefined ( ) const
inlinevirtual

Definition at line 168 of file pgm_base.h.

◆ loadCommonSettings()

void PGM_BASE::loadCommonSettings ( )
protected

◆ MacOpenFile()

virtual void PGM_BASE::MacOpenFile ( const wxString &  aFileName)
pure virtual

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

MacOSX requires it for file association.

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

Implemented in PGM_SINGLE_TOP, PGM_KICAD, and PGM_TEST_FRAME.

◆ ReadPdfBrowserInfos()

void PGM_BASE::ReadPdfBrowserInfos ( )
virtual

Read the PDF browser choice from the common configuration.

Definition at line 1056 of file pgm_base.cpp.

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

Referenced by InitPgm(), PANEL_COMMON_SETTINGS::OnPDFViewerClick(), and OpenPDF().

◆ SaveCommonSettings()

void PGM_BASE::SaveCommonSettings ( )

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

Definition at line 680 of file pgm_base.cpp.

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

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

◆ SetDefaultLanguage()

bool PGM_BASE::SetDefaultLanguage ( wxString &  aErrMsg)

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 796 of file pgm_base.cpp.

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

Referenced by InitPgm().

◆ SetLanguage()

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

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 695 of file pgm_base.cpp.

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

Referenced by InitPgm(), and KIWAY::SetLanguage().

◆ setLanguageId()

void PGM_BASE::setLanguageId ( int  aId)
inlineprotected

Trap all changes in here, simplifies debugging.

Definition at line 391 of file pgm_base.h.

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

◆ SetLanguageIdentifier()

void PGM_BASE::SetLanguageIdentifier ( int  menu_id)
virtual

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 837 of file pgm_base.cpp.

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

Referenced by KIWAY::SetLanguage().

◆ SetLanguagePath()

void PGM_BASE::SetLanguagePath ( )
virtual

Definition at line 871 of file pgm_base.cpp.

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

Referenced by InitPgm().

◆ SetLocalEnvVariable()

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

Set 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 888 of file pgm_base.cpp.

References traceEnvVars.

Referenced by loadCommonSettings().

◆ SetLocalEnvVariables()

void PGM_BASE::SetLocalEnvVariables ( )
virtual

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

See also
GetLocalEnvVariables()

Definition at line 919 of file pgm_base.cpp.

References GetCommonSettings(), and traceEnvVars.

Referenced by DIALOG_CONFIGURE_PATHS::TransferDataFromWindow().

◆ SetPdfBrowserName()

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

◆ SetTextEditor()

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

◆ ShowSplash()

void PGM_BASE::ShowSplash ( )

Definition at line 427 of file pgm_base.cpp.

References KiBitmap(), and m_splash.

Referenced by InitPgm().

◆ SingleInstance()

std::unique_ptr< wxSingleInstanceChecker > & PGM_BASE::SingleInstance ( )
inline

Allow access to the wxSingleInstanceChecker to test for other running KiCads.

Definition at line 370 of file pgm_base.h.

◆ UseSystemPdfBrowser()

virtual bool PGM_BASE::UseSystemPdfBrowser ( ) const
inlinevirtual
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 185 of file pgm_base.h.

◆ WritePdfBrowserInfos()

void PGM_BASE::WritePdfBrowserInfos ( )
virtual

Member Data Documentation

◆ m_argcUtf8

int PGM_BASE::m_argcUtf8
protected

Definition at line 439 of file pgm_base.h.

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

◆ m_argvUtf8

char** PGM_BASE::m_argvUtf8
protected

argv parameters converted to utf8 form because wxWidgets has opinions.

This will return argv as either force converted to ASCII in char* or wchar_t only.

Definition at line 437 of file pgm_base.h.

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

◆ m_background_jobs_monitor

std::unique_ptr<BACKGROUND_JOBS_MONITOR> PGM_BASE::m_background_jobs_monitor
protected

Definition at line 401 of file pgm_base.h.

Referenced by InitPgm().

◆ m_kicad_env

wxString PGM_BASE::m_kicad_env
protected

The KICAD system environment variable.

Definition at line 414 of file pgm_base.h.

Referenced by InitPgm().

◆ m_language_id

int PGM_BASE::m_language_id
protected

Definition at line 417 of file pgm_base.h.

Referenced by GetLanguageTag(), SetDefaultLanguage(), and SetLanguage().

◆ m_locale

wxLocale* PGM_BASE::m_locale
protected

Definition at line 416 of file pgm_base.h.

Referenced by PGM_BASE(), SetDefaultLanguage(), SetLanguage(), and ~PGM_BASE().

◆ m_ModalDialogs

std::vector<void*> PGM_BASE::m_ModalDialogs

◆ m_notifications_manager

std::unique_ptr<NOTIFICATIONS_MANAGER> PGM_BASE::m_notifications_manager
protected

Definition at line 402 of file pgm_base.h.

Referenced by InitPgm().

◆ m_pdf_browser

wxString PGM_BASE::m_pdf_browser
protected

Filename of the app selected for browsing PDFs.

Definition at line 420 of file pgm_base.h.

◆ m_pgm_checker

std::unique_ptr<wxSingleInstanceChecker> PGM_BASE::m_pgm_checker
protected

Check if there is another copy of Kicad running at the same time.

Definition at line 407 of file pgm_base.h.

Referenced by Destroy(), and InitPgm().

◆ m_Printing

bool PGM_BASE::m_Printing

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

Definition at line 378 of file pgm_base.h.

Referenced by DIALOG_PRINT_GENERIC::onPrintButtonClick(), PGM_BASE(), and DIALOG_PRINT_USING_PRINTER::TransferDataFromWindow().

◆ m_PropertyGridInitialized

bool PGM_BASE::m_PropertyGridInitialized

Definition at line 384 of file pgm_base.h.

Referenced by PGM_BASE(), and PROPERTIES_PANEL::PROPERTIES_PANEL().

◆ m_python_scripting

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

Definition at line 404 of file pgm_base.h.

Referenced by InitPgm().

◆ m_Quitting

bool PGM_BASE::m_Quitting

Definition at line 382 of file pgm_base.h.

Referenced by KICAD_MANAGER_FRAME::doCloseWindow(), and PGM_BASE().

◆ m_settings_manager

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

◆ m_singleton

KICAD_SINGLETON PGM_BASE::m_singleton
protected

Definition at line 424 of file pgm_base.h.

Referenced by InitPgm().

◆ m_splash

wxSplashScreen* PGM_BASE::m_splash
protected

Definition at line 441 of file pgm_base.h.

Referenced by HideSplash(), PGM_BASE(), and ShowSplash().

◆ m_text_editor

wxString PGM_BASE::m_text_editor
protected

Definition at line 422 of file pgm_base.h.

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

◆ m_use_system_pdf_browser

bool PGM_BASE::m_use_system_pdf_browser
protected

Definition at line 419 of file pgm_base.h.

Referenced by ReadPdfBrowserInfos(), and WritePdfBrowserInfos().

◆ workingDirKey

const wxChar PGM_BASE::workingDirKey[]
static

Definition at line 279 of file pgm_base.h.


The documentation for this class was generated from the following files: