本文整理汇总了C++中FP_LIB_TABLE::FootprintLoad方法的典型用法代码示例。如果您正苦于以下问题:C++ FP_LIB_TABLE::FootprintLoad方法的具体用法?C++ FP_LIB_TABLE::FootprintLoad怎么用?C++ FP_LIB_TABLE::FootprintLoad使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FP_LIB_TABLE
的用法示例。
在下文中一共展示了FP_LIB_TABLE::FootprintLoad方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: load
void FOOTPRINT_INFO::load()
{
FP_LIB_TABLE* fptable = m_owner->GetTable();
wxASSERT( fptable );
std::auto_ptr<MODULE> m( fptable->FootprintLoad( m_nickname, m_fpname ) );
if( m.get() == NULL ) // Should happen only with malformed/broken libraries
{
m_pad_count = 0;
m_unique_pad_count = 0;
}
else
{
m_pad_count = m->GetPadCount( DO_NOT_INCLUDE_NPTH );
m_unique_pad_count = m->GetUniquePadCount( DO_NOT_INCLUDE_NPTH );
m_keywords = m->GetKeywords();
m_doc = m->GetDescription();
// tell ensure_loaded() I'm loaded.
m_loaded = true;
}
}
示例2: SaveFootprintInLibrary
bool FOOTPRINT_EDIT_FRAME::SaveFootprintInLibrary( const wxString& aLibrary,
MODULE* aModule,
bool aOverwrite,
bool aDisplayDialog )
{
if( aModule == NULL )
return false;
SetMsgPanel( aModule );
// Legacy libraries are readable, but modifying legacy format is not allowed
// So prompt the user if he try to add/replace a footprint in a legacy lib
wxString libfullname = Prj().PcbFootprintLibs()->FindRow( aLibrary )->GetFullURI();
IO_MGR::PCB_FILE_T piType = IO_MGR::GuessPluginTypeFromLibPath( libfullname );
if( piType == IO_MGR::LEGACY )
{
DisplayInfoMessage( this, INFO_LEGACY_LIB_WARN_EDIT );
return false;
}
// Ask what to use as the footprint name in the library
wxString footprintName = aModule->GetFPID().GetFootprintName();
if( aDisplayDialog )
{
wxTextEntryDialog dlg( this, _( "Name:" ), FMT_SAVE_MODULE, footprintName );
if( dlg.ShowModal() != wxID_OK )
return false; // canceled by user
footprintName = dlg.GetValue();
footprintName.Trim( true );
footprintName.Trim( false );
if( footprintName.IsEmpty() )
return false;
if( ! MODULE::IsLibNameValid( footprintName ) )
{
wxString msg = wxString::Format(
_("Error:\none of invalid chars '%s' found\nin '%s'" ),
MODULE::StringLibNameInvalidChars( true ),
GetChars( footprintName ) );
DisplayError( NULL, msg );
return false;
}
aModule->SetFPID( FPID( footprintName ) );
}
// Ensure this footprint has a libname
if( footprintName.IsEmpty() )
{
footprintName = wxT("noname");
aModule->SetFPID( FPID( footprintName ) );
}
bool module_exists = false;
try
{
FP_LIB_TABLE* tbl = Prj().PcbFootprintLibs();
MODULE* m = tbl->FootprintLoad( aLibrary, footprintName );
if( m )
{
delete m;
module_exists = true;
// an existing footprint is found in current lib
if( aDisplayDialog )
{
wxString msg = wxString::Format( FMT_MOD_EXISTS,
footprintName.GetData(), aLibrary.GetData() );
SetStatusText( msg );
}
if( !aOverwrite )
{
// Do not save the given footprint: an old one exists
return true;
}
}
// this always overwrites any existing footprint, but should yell on its
// own if the library or footprint is not writable.
tbl->FootprintSave( aLibrary, aModule );
}
catch( const IO_ERROR& ioe )
{
DisplayError( this, ioe.errorText );
return false;
}
//.........这里部分代码省略.........