void EDA_BASE_FRAME::GetKicadHelp( wxCommandEvent& event ) { const SEARCH_STACK& search = sys_search(); /* We have to get document for beginners, * or the full specific doc * if event id is wxID_INDEX, we want the document for beginners. * else the specific doc file (its name is in Kiface().GetHelpFileName()) * The document for beginners is the same for all KiCad utilities */ if( event.GetId() == wxID_INDEX ) { // List of possible names for Getting Started in KiCad const wxChar* names[2] = { wxT( "getting_started_in_kicad" ), wxT( "Getting_Started_in_KiCad" ) }; wxString helpFile; // Search for "getting_started_in_kicad.html" or "getting_started_in_kicad.pdf" // or "Getting_Started_in_KiCad.html" or "Getting_Started_in_KiCad.pdf" for( unsigned ii = 0; ii < DIM( names ); ii++ ) { helpFile = SearchHelpFileFullPath( search, names[ii] ); if( !helpFile.IsEmpty() ) break; } if( !helpFile ) { wxString msg = wxString::Format( _( "Html or pdf help file \n'%s'\n or\n'%s' could not be found." ), names[0], names[1] ); wxMessageBox( msg ); } else { GetAssociatedDocument( this, helpFile ); } return; } wxString base_name = help_name(); wxString helpFile = SearchHelpFileFullPath( search, base_name ); if( !helpFile ) { wxString msg = wxString::Format( _( "Help file '%s' could not be found." ), GetChars( base_name ) ); wxMessageBox( msg ); } else { GetAssociatedDocument( this, helpFile ); } }
void EDA_BASE_FRAME::GetKicadHelp( wxCommandEvent& event ) { const SEARCH_STACK& search = sys_search(); /* We have to get document for beginners, * or the full specific doc * if event id is wxID_INDEX, we want the document for beginners. * else the specific doc file (its name is in Kiface().GetHelpFileName()) * The document for beginners is the same for all KiCad utilities */ if( event.GetId() == wxID_INDEX ) { // Search for "getting_started_in_kicad.pdf" or "Getting_Started_in_KiCad.pdf" wxString helpFile = SearchHelpFileFullPath( search, wxT( "getting_started_in_kicad.pdf" ) ); if( !helpFile ) helpFile = SearchHelpFileFullPath( search, wxT( "Getting_Started_in_KiCad.pdf" ) ); if( !helpFile ) { wxString msg = wxString::Format( _( "Help file '%s' could not be found." ), wxT( "getting_started_in_kicad.pdf" ) ); wxMessageBox( msg ); } else { GetAssociatedDocument( this, helpFile ); } return; } wxString base_name = help_name(); #if defined ONLINE_HELP_FILES_FORMAT_IS_HTML wxHtmlHelpController* hc = Pgm().GetHtmlHelpController(); wxString helpFile = SearchHelpFileFullPath( search, ); if( !!helpFile ) { hc->UseConfig( Pgm().CommonSettings() ); hc->SetTitleFormat( wxT( "KiCad Help" ) ); hc->AddBook( helpFile ); } hc->DisplayContents(); hc->Display( helpFile ); #elif defined ONLINE_HELP_FILES_FORMAT_IS_PDF wxString helpFile = SearchHelpFileFullPath( search, base_name ); if( !helpFile ) { wxString msg = wxString::Format( _( "Help file '%s' could not be found." ), GetChars( base_name ) ); wxMessageBox( msg ); } else { GetAssociatedDocument( this, helpFile ); } #else # error Help files format not defined #endif }