KiCad PCB EDA Suite
APP_KICAD_CLI Struct Reference

Not publicly visible because most of the action is in PGM_KICAD these days. More...

Inheritance diagram for APP_KICAD_CLI:

Public Member Functions

 APP_KICAD_CLI ()
 
bool OnInit () override
 
int OnExit () override
 
int OnRun () override
 
int FilterEvent (wxEvent &aEvent) override
 

Detailed Description

Not publicly visible because most of the action is in PGM_KICAD these days.

Definition at line 440 of file kicad_cli.cpp.

Constructor & Destructor Documentation

◆ APP_KICAD_CLI()

APP_KICAD_CLI::APP_KICAD_CLI ( )
inline

Definition at line 442 of file kicad_cli.cpp.

442 : wxAppConsole()
443 {
444 // Init the environment each platform wants
446 }
void Init()
Perform environment initialization tasks.

References KIPLATFORM::ENV::Init().

Member Function Documentation

◆ FilterEvent()

int APP_KICAD_CLI::FilterEvent ( wxEvent &  aEvent)
inlineoverride

Definition at line 499 of file kicad_cli.cpp.

500 {
501 if( aEvent.GetEventType() == wxEVT_SHOW )
502 {
503 wxShowEvent& event = static_cast<wxShowEvent&>( aEvent );
504 wxDialog* dialog = dynamic_cast<wxDialog*>( event.GetEventObject() );
505
506 std::vector<void*>& dlgs = Pgm().m_ModalDialogs;
507
508 if( dialog )
509 {
510 if( event.IsShown() && dialog->IsModal() )
511 {
512 dlgs.push_back( dialog );
513 }
514 // Under GTK, sometimes the modal flag is cleared before hiding
515 else if( !event.IsShown() && !dlgs.empty() )
516 {
517 // If we close the expected dialog, remove it from our stack
518 if( dlgs.back() == dialog )
519 dlgs.pop_back();
520 // If an out-of-order, remove all dialogs added after the closed one
521 else if( auto it = std::find( dlgs.begin(), dlgs.end(), dialog ) ; it != dlgs.end() )
522 dlgs.erase( it, dlgs.end() );
523 }
524 }
525 }
526
527 return Event_Skip;
528 }
std::vector< void * > m_ModalDialogs
Definition: pgm_base.h:311
PGM_BASE & Pgm()
The global Program "get" accessor.
Definition: kicad_cli.cpp:94

References PGM_BASE::m_ModalDialogs, and Pgm().

◆ OnExit()

int APP_KICAD_CLI::OnExit ( )
inlineoverride

Definition at line 464 of file kicad_cli.cpp.

465 {
467
468#if defined( __FreeBSD__ )
469 // Avoid wxLog crashing when used in destructors.
470 wxLog::EnableLogging( false );
471#endif
472
473 return wxAppConsole::OnExit();
474 }
void OnPgmExit()
Definition: kicad.cpp:366
static PGM_KICAD program
Definition: kicad_cli.cpp:91

References PGM_KICAD::OnPgmExit(), and program.

◆ OnInit()

bool APP_KICAD_CLI::OnInit ( )
inlineoverride

Definition at line 449 of file kicad_cli.cpp.

450 {
451 // Perform platform-specific init tasks
452 if( !KIPLATFORM::APP::Init() )
453 return false;
454
455 if( !program.OnPgmInit() )
456 {
458 return false;
459 }
460
461 return true;
462 }
bool OnPgmInit()
Definition: kicad.cpp:94
bool Init()
Perform application-specific initialization tasks.
Definition: gtk/app.cpp:40

References KIPLATFORM::APP::Init(), PGM_KICAD::OnPgmExit(), PGM_KICAD::OnPgmInit(), and program.

◆ OnRun()

int APP_KICAD_CLI::OnRun ( )
inlineoverride

Definition at line 476 of file kicad_cli.cpp.

477 {
478 try
479 {
480 return program.OnPgmRun();
481 }
482 catch( const std::exception& e )
483 {
484 wxLogError( wxT( "Unhandled exception class: %s what: %s" ),
485 FROM_UTF8( typeid( e ).name() ), FROM_UTF8( e.what() ) );
486 }
487 catch( const IO_ERROR& ioe )
488 {
489 wxLogError( ioe.What() );
490 }
491 catch( ... )
492 {
493 wxLogError( wxT( "Unhandled exception of unknown type" ) );
494 }
495
496 return -1;
497 }
const char * name
Definition: DXF_plotter.cpp:56
Hold an error message and may be used when throwing exceptions containing meaningful error messages.
Definition: ki_exception.h:76
virtual const wxString What() const
A composite of Problem() and Where()
Definition: exceptions.cpp:30
int OnPgmRun()
Definition: kicad.cpp:360
static wxString FROM_UTF8(const char *cstring)
Convert a UTF8 encoded C string to a wxString for all wxWidgets build modes.
Definition: macros.h:110

References FROM_UTF8(), name, PGM_KICAD::OnPgmRun(), program, and IO_ERROR::What().


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