KiCad PCB EDA Suite
APP_SINGLE_TOP Struct Reference

Struct APP_SINGLE_TOP implements a bare naked wxApp (so that we don't become dependent on functionality in a wxApp derivative that we cannot deliver under wxPython). More...

Inheritance diagram for APP_SINGLE_TOP:

Public Member Functions

bool OnInit () override
 
int OnExit () override
 
int OnRun () override
 

Detailed Description

Struct APP_SINGLE_TOP implements a bare naked wxApp (so that we don't become dependent on functionality in a wxApp derivative that we cannot deliver under wxPython).

Definition at line 124 of file single_top.cpp.

Member Function Documentation

◆ OnExit()

int APP_SINGLE_TOP::OnExit ( )
inlineoverride

Definition at line 182 of file single_top.cpp.

183  {
184  // Fixes segfault when wxPython scripting is enabled.
185 #if defined( KICAD_SCRIPTING_WXPYTHON )
186  program.OnPgmExit();
187 #endif
188  return wxApp::OnExit();
189  }
void OnPgmExit()
Definition: single_top.cpp:66
PGM_SINGLE_TOP program

References PGM_SINGLE_TOP::OnPgmExit(), and program.

◆ OnInit()

bool APP_SINGLE_TOP::OnInit ( )
inlineoverride

Definition at line 151 of file single_top.cpp.

152  {
153  // Force wxHtmlWinParser initialization when a wxHtmlWindow is used only
154  // in a shared modules (.so or .dll file)
155  // Otherwise the Html text is displayed as plain text.
156  HtmlModule html_init;
157 
158  try
159  {
160  return program.OnPgmInit();
161  }
162  catch( const std::exception& e )
163  {
164  wxLogError( wxT( "Unhandled exception class: %s what: %s" ),
165  GetChars( FROM_UTF8( typeid(e).name() )),
166  GetChars( FROM_UTF8( e.what() ) ) );
167  }
168  catch( const IO_ERROR& ioe )
169  {
170  wxLogError( GetChars( ioe.What() ) );
171  }
172  catch(...)
173  {
174  wxLogError( wxT( "Unhandled exception of unknown type" ) );
175  }
176 
177  program.OnPgmExit();
178 
179  return false;
180  }
static wxString FROM_UTF8(const char *cstring)
function FROM_UTF8 converts a UTF8 encoded C string to a wxString for all wxWidgets build modes.
Definition: macros.h:61
void OnPgmExit()
Definition: single_top.cpp:66
virtual const wxString What() const
A composite of Problem() and Where()
Definition: exceptions.cpp:33
static const wxChar * GetChars(const wxString &s)
Function GetChars returns a wxChar* to the actual wxChar* data within a wxString, and is helpful for ...
Definition: macros.h:100
const char * name
Definition: DXF_plotter.cpp:61
PGM_SINGLE_TOP program
Struct IO_ERROR is a class used to hold an error message and may be used when throwing exceptions con...
Definition: ki_exception.h:76

References FROM_UTF8(), GetChars(), name, PGM_SINGLE_TOP::OnPgmExit(), PGM_SINGLE_TOP::OnPgmInit(), program, and IO_ERROR::What().

◆ OnRun()

int APP_SINGLE_TOP::OnRun ( )
inlineoverride

Definition at line 191 of file single_top.cpp.

192  {
193  int ret = -1;
194 
195  try
196  {
197  ret = wxApp::OnRun();
198  }
199  catch( const std::exception& e )
200  {
201  wxLogError( wxT( "Unhandled exception class: %s what: %s" ),
202  GetChars( FROM_UTF8( typeid(e).name() )),
203  GetChars( FROM_UTF8( e.what() ) ) );
204  }
205  catch( const IO_ERROR& ioe )
206  {
207  wxLogError( GetChars( ioe.What() ) );
208  }
209  catch(...)
210  {
211  wxLogError( wxT( "Unhandled exception of unknown type" ) );
212  }
213 
214  // Works properly when wxPython scripting is disabled.
215 #if !defined( KICAD_SCRIPTING_WXPYTHON )
216  program.OnPgmExit();
217 #endif
218  return ret;
219  }
static wxString FROM_UTF8(const char *cstring)
function FROM_UTF8 converts a UTF8 encoded C string to a wxString for all wxWidgets build modes.
Definition: macros.h:61
void OnPgmExit()
Definition: single_top.cpp:66
virtual const wxString What() const
A composite of Problem() and Where()
Definition: exceptions.cpp:33
static const wxChar * GetChars(const wxString &s)
Function GetChars returns a wxChar* to the actual wxChar* data within a wxString, and is helpful for ...
Definition: macros.h:100
const char * name
Definition: DXF_plotter.cpp:61
PGM_SINGLE_TOP program
Struct IO_ERROR is a class used to hold an error message and may be used when throwing exceptions con...
Definition: ki_exception.h:76

References FROM_UTF8(), GetChars(), name, PGM_SINGLE_TOP::OnPgmExit(), program, and IO_ERROR::What().


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