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

int APP_SINGLE_TOP::OnExit ( )
inlineoverride

Definition at line 171 of file single_top.cpp.

References PGM_SINGLE_TOP::OnPgmExit(), and program.

172  {
173  // Fixes segfault when wxPython scripting is enabled.
174 #if defined( KICAD_SCRIPTING_WXPYTHON )
175  program.OnPgmExit();
176 #endif
177  return wxApp::OnExit();
178  }
void OnPgmExit()
Definition: single_top.cpp:66
PGM_SINGLE_TOP program
bool APP_SINGLE_TOP::OnInit ( )
inlineoverride

Definition at line 140 of file single_top.cpp.

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

141  {
142  // Force wxHtmlWinParser initialization when a wxHtmlWindow is used only
143  // in a shared modules (.so or .dll file)
144  // Otherwise the Html text is displayed as plain text.
145  HtmlModule html_init;
146 
147  try
148  {
149  return program.OnPgmInit();
150  }
151  catch( const std::exception& e )
152  {
153  wxLogError( wxT( "Unhandled exception class: %s what: %s" ),
154  GetChars( FROM_UTF8( typeid(e).name() )),
155  GetChars( FROM_UTF8( e.what() ) ) );
156  }
157  catch( const IO_ERROR& ioe )
158  {
159  wxLogError( GetChars( ioe.What() ) );
160  }
161  catch(...)
162  {
163  wxLogError( wxT( "Unhandled exception of unknown type" ) );
164  }
165 
166  program.OnPgmExit();
167 
168  return false;
169  }
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:53
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:92
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
int APP_SINGLE_TOP::OnRun ( )
inlineoverride

Definition at line 180 of file single_top.cpp.

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

181  {
182  int ret = -1;
183 
184  try
185  {
186  ret = wxApp::OnRun();
187  }
188  catch( const std::exception& e )
189  {
190  wxLogError( wxT( "Unhandled exception class: %s what: %s" ),
191  GetChars( FROM_UTF8( typeid(e).name() )),
192  GetChars( FROM_UTF8( e.what() ) ) );
193  }
194  catch( const IO_ERROR& ioe )
195  {
196  wxLogError( GetChars( ioe.What() ) );
197  }
198  catch(...)
199  {
200  wxLogError( wxT( "Unhandled exception of unknown type" ) );
201  }
202 
203  // Works properly when wxPython scripting is disabled.
204 #if !defined( KICAD_SCRIPTING_WXPYTHON )
205  program.OnPgmExit();
206 #endif
207  return ret;
208  }
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:53
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:92
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

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