本文整理汇总了C++中FP_LIB_TABLE::Save方法的典型用法代码示例。如果您正苦于以下问题:C++ FP_LIB_TABLE::Save方法的具体用法?C++ FP_LIB_TABLE::Save怎么用?C++ FP_LIB_TABLE::Save使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FP_LIB_TABLE
的用法示例。
在下文中一共展示了FP_LIB_TABLE::Save方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: InvokePcbLibTableEditor
void InvokePcbLibTableEditor( KIWAY* aKiway, wxWindow* aCaller )
{
FP_LIB_TABLE* globalTable = &GFootprintTable;
wxString globalTablePath = FP_LIB_TABLE::GetGlobalTableFileName();
FP_LIB_TABLE* projectTable = aKiway->Prj().PcbFootprintLibs();
wxString projectTablePath = aKiway->Prj().FootprintLibTblName();
wxString msg;
DIALOG_EDIT_LIBRARY_TABLES dlg( aCaller, _( "Footprint Libraries" ) );
dlg.SetKiway( &dlg, aKiway );
dlg.InstallPanel( new PANEL_FP_LIB_TABLE( &dlg, globalTable, globalTablePath,
projectTable, projectTablePath,
aKiway->Prj().GetProjectPath() ) );
if( dlg.ShowModal() == wxID_CANCEL )
return;
if( dlg.m_GlobalTableChanged )
{
try
{
globalTable->Save( globalTablePath );
}
catch( const IO_ERROR& ioe )
{
msg.Printf( _( "Error saving global library table:\n\n%s" ), ioe.What() );
wxMessageBox( msg, _( "File Save Error" ), wxOK | wxICON_ERROR );
}
}
if( dlg.m_ProjectTableChanged )
{
try
{
projectTable->Save( projectTablePath );
}
catch( const IO_ERROR& ioe )
{
msg.Printf( _( "Error saving project-specific library table:\n\n%s" ), ioe.What() );
wxMessageBox( msg, _( "File Save Error" ), wxOK | wxICON_ERROR );
}
}
auto editor = (FOOTPRINT_EDIT_FRAME*) aKiway->Player( FRAME_PCB_MODULE_EDITOR, false );
if( editor )
editor->SyncLibraryTree( true );
auto viewer = (FOOTPRINT_VIEWER_FRAME*) aKiway->Player( FRAME_PCB_MODULE_VIEWER, false );
if( viewer )
viewer->ReCreateLibraryList();
}
示例2: LoadGlobalTable
bool FP_LIB_TABLE::LoadGlobalTable( FP_LIB_TABLE& aTable ) throw (IO_ERROR, PARSE_ERROR )
{
bool tableExists = true;
wxFileName fn = GetGlobalTableFileName();
if( !fn.FileExists() )
{
tableExists = false;
if( !fn.DirExists() && !fn.Mkdir( 0x777, wxPATH_MKDIR_FULL ) )
{
THROW_IO_ERROR( wxString::Format( _( "Cannot create global library table path '%s'." ),
GetChars( fn.GetPath() ) ) );
}
// Attempt to copy the default global file table from the KiCad
// template folder to the user's home configuration path.
wxString fileName = Kiface().KifaceSearch().FindValidPath( global_tbl_name );
// The fallback is to create an empty global footprint table for the user to populate.
if( fileName.IsEmpty() || !::wxCopyFile( fileName, fn.GetFullPath(), false ) )
{
FP_LIB_TABLE emptyTable;
emptyTable.Save( fn.GetFullPath() );
}
}
aTable.Load( fn.GetFullPath() );
return tableExists;
}