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

Member Function Documentation

◆ OnExit()

int APP_SINGLE_TOP::OnExit ( )
inlineoverride

Definition at line 194 of file single_top.cpp.

195  {
196  // Fixes segfault when wxPython scripting is enabled.
197 #if defined( KICAD_SCRIPTING_WXPYTHON )
198  program.OnPgmExit();
199 #endif
200  return wxApp::OnExit();
201  }
void OnPgmExit()
Definition: single_top.cpp:68
PGM_SINGLE_TOP program

References PGM_SINGLE_TOP::OnPgmExit(), and program.

◆ OnInit()

bool APP_SINGLE_TOP::OnInit ( )
inlineoverride

Definition at line 157 of file single_top.cpp.

158  {
159  // Force wxHtmlWinParser initialization when a wxHtmlWindow is used only
160  // in a shared modules (.so or .dll file)
161  // Otherwise the Html text is displayed as plain text.
162  HtmlModule html_init;
163 
164  try
165  {
166  if( !program.OnPgmInit() )
167  {
168  program.OnPgmExit();
169  return false;
170  }
171 
172  return true;
173  }
174  catch( const std::exception& e )
175  {
176  wxLogError( wxT( "Unhandled exception class: %s what: %s" ),
177  GetChars( FROM_UTF8( typeid(e).name() )),
178  GetChars( FROM_UTF8( e.what() ) ) );
179  }
180  catch( const IO_ERROR& ioe )
181  {
182  wxLogError( GetChars( ioe.What() ) );
183  }
184  catch(...)
185  {
186  wxLogError( wxT( "Unhandled exception of unknown type" ) );
187  }
188 
189  program.OnPgmExit();
190 
191  return false;
192  }
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:114
void OnPgmExit()
Definition: single_top.cpp:68
virtual const wxString What() const
A composite of Problem() and Where()
Definition: exceptions.cpp:29
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:153
const char * name
Definition: DXF_plotter.cpp:60
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 203 of file single_top.cpp.

204  {
205  int ret = -1;
206 
207  try
208  {
209  ret = wxApp::OnRun();
210  }
211  catch( const std::exception& e )
212  {
213  wxLogError( wxT( "Unhandled exception class: %s what: %s" ),
214  GetChars( FROM_UTF8( typeid(e).name() )),
215  GetChars( FROM_UTF8( e.what() ) ) );
216  }
217  catch( const IO_ERROR& ioe )
218  {
219  wxLogError( GetChars( ioe.What() ) );
220  }
221  catch(...)
222  {
223  wxLogError( wxT( "Unhandled exception of unknown type" ) );
224  }
225 
226  // Works properly when wxPython scripting is disabled.
227 #if !defined( KICAD_SCRIPTING_WXPYTHON )
228  program.OnPgmExit();
229 #endif
230  return ret;
231  }
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:114
void OnPgmExit()
Definition: single_top.cpp:68
virtual const wxString What() const
A composite of Problem() and Where()
Definition: exceptions.cpp:29
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:153
const char * name
Definition: DXF_plotter.cpp:60
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: