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 108 of file single_top.cpp.

Member Function Documentation

int APP_SINGLE_TOP::OnExit ( )
inlineoverride

Definition at line 150 of file single_top.cpp.

References PGM_SINGLE_TOP::OnPgmExit(), and program.

151  {
152  // Fixes segfault when wxPython scripting is enabled.
153 #if defined( KICAD_SCRIPTING_WXPYTHON )
154  program.OnPgmExit();
155 #endif
156  return wxApp::OnExit();
157  }
void OnPgmExit()
Definition: single_top.cpp:65
PGM_SINGLE_TOP program
bool APP_SINGLE_TOP::OnInit ( )
inlineoverride

Definition at line 124 of file single_top.cpp.

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

125  {
126  try
127  {
128  return program.OnPgmInit();
129  }
130  catch( const std::exception& e )
131  {
132  wxLogError( wxT( "Unhandled exception class: %s what: %s" ),
133  GetChars( FROM_UTF8( typeid(e).name() )),
134  GetChars( FROM_UTF8( e.what() ) ) );
135  }
136  catch( const IO_ERROR& ioe )
137  {
138  wxLogError( GetChars( ioe.What() ) );
139  }
140  catch(...)
141  {
142  wxLogError( wxT( "Unhandled exception of unknown type" ) );
143  }
144 
145  program.OnPgmExit();
146 
147  return false;
148  }
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:65
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
PGM_SINGLE_TOP program
const char * name
Struct IO_ERROR is a class used to hold an error message and may be used when throwing exceptions con...
Definition: ki_exception.h:47
int APP_SINGLE_TOP::OnRun ( )
inlineoverride

Definition at line 159 of file single_top.cpp.

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

160  {
161  int ret = -1;
162 
163  try
164  {
165  ret = wxApp::OnRun();
166  }
167  catch( const std::exception& e )
168  {
169  wxLogError( wxT( "Unhandled exception class: %s what: %s" ),
170  GetChars( FROM_UTF8( typeid(e).name() )),
171  GetChars( FROM_UTF8( e.what() ) ) );
172  }
173  catch( const IO_ERROR& ioe )
174  {
175  wxLogError( GetChars( ioe.What() ) );
176  }
177  catch(...)
178  {
179  wxLogError( wxT( "Unhandled exception of unknown type" ) );
180  }
181 
182  // Works properly when wxPython scripting is disabled.
183 #if !defined( KICAD_SCRIPTING_WXPYTHON )
184  program.OnPgmExit();
185 #endif
186  return ret;
187  }
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:65
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
PGM_SINGLE_TOP program
const char * name
Struct IO_ERROR is a class used to hold an error message and may be used when throwing exceptions con...
Definition: ki_exception.h:47

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