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 ); } }
scp_result scp_sys_search(sc_memory_context *context, scp_operand *param1, scp_operand *param2, scp_operand_pair *parameters, sc_uint32 param_count, scp_operand *param4, scp_bool full_only) { scp_bool flag2; sc_uint32 i; if (param1->param_type != SCP_FIXED) { return print_error("scp_sys_search", "Parameter 1 must have FIXED modifier"); } if (SC_FALSE == sc_memory_is_element(context, param1->addr)) { return print_error("scp_sys_search", "Parameter 1 has modifier FIXED, but has not value"); } if (param2->param_type == SCP_FIXED) { if (SC_FALSE == sc_memory_is_element(context, param1->addr)) { return print_error("scp_sys_search", "Parameter 2 has modifier FIXED, but has not value"); } } else { flag2 = SCP_TRUE; } for (i = 0; i < param_count; i++) { if (parameters[i].operand1->param_type == SCP_ASSIGN || parameters[i].operand2->param_type == SCP_ASSIGN) { return print_error("scp_sys_search", "All elements of parameter set must have FIXED modifier"); } if (SC_FALSE == sc_memory_is_element(context, parameters[i].operand1->addr) || SC_FALSE == sc_memory_is_element(context, parameters[i].operand2->addr)) { return print_error("scp_sys_search", "All elements of parameter set must have value"); } } if (param4 != nullptr) { if (param4->param_type == SCP_FIXED) { if (SC_FALSE == sc_memory_is_element(context, param1->addr)) { return print_error("scp_sys_search", "Parameter 4 has modifier FIXED, but has not value"); } } else { param4->addr = sc_memory_node_new(context, scp_type_const); } } if (flag2 == SCP_TRUE) { param2->addr = sc_memory_node_new(context, scp_type_const); } return sys_search(context, param1, param2, parameters, param_count, param4, full_only); }
void KICAD_MANAGER_FRAME::CreateNewProject( const wxFileName& aProjectFileName ) { wxCHECK_RET( aProjectFileName.DirExists() && aProjectFileName.IsDirWritable(), "Project folder must exist and be writable to create a new project." ); // Init project filename. This clears all elements from the project object. SetProjectFileName( aProjectFileName.GetFullPath() ); // Copy kicad.pro file from template folder. if( !aProjectFileName.FileExists() ) { wxString srcFileName = sys_search().FindValidPath( "kicad.pro" ); // Create a minimal project (.pro) file if the template project file could not be copied. if( !wxFileName::FileExists( srcFileName ) || !wxCopyFile( srcFileName, aProjectFileName.GetFullPath() ) ) { Prj().ConfigSave( PgmTop().SysSearch(), GeneralGroupName, s_KicadManagerParams ); } } // Ensure a "stub" for a schematic root sheet and a board exist. // It will avoid messages from the schematic editor or the board editor to create a new file // And forces the user to create main files under the right name for the project manager wxFileName fn( aProjectFileName.GetFullPath() ); fn.SetExt( SchematicFileExtension ); // If a <project>.sch file does not exist, create a "stub" file ( minimal schematic file ) if( !fn.FileExists() ) { wxFile file( fn.GetFullPath(), wxFile::write ); if( file.IsOpened() ) file.Write( wxT( "EESchema Schematic File Version 2\n" "EELAYER 25 0\nEELAYER END\n$EndSCHEMATC\n" ) ); // wxFile dtor will close the file } // If a <project>.kicad_pcb or <project>.brd file does not exist, // create a .kicad_pcb "stub" file fn.SetExt( KiCadPcbFileExtension ); wxFileName leg_fn( fn ); leg_fn.SetExt( LegacyPcbFileExtension ); if( !fn.FileExists() && !leg_fn.FileExists() ) { wxFile file( fn.GetFullPath(), wxFile::write ); if( file.IsOpened() ) file.Write( wxT( "(kicad_pcb (version 4) (host kicad \"dummy file\") )\n" ) ); // wxFile dtor will close the file } }
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 }