本文整理汇总了C++中LIB_PART::GetReferenceField方法的典型用法代码示例。如果您正苦于以下问题:C++ LIB_PART::GetReferenceField方法的具体用法?C++ LIB_PART::GetReferenceField怎么用?C++ LIB_PART::GetReferenceField使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LIB_PART
的用法示例。
在下文中一共展示了LIB_PART::GetReferenceField方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SaveOneSymbol
void LIB_EDIT_FRAME::SaveOneSymbol()
{
wxString msg;
PROJECT& prj = Prj();
SEARCH_STACK* search = prj.SchSearchS();
LIB_PART* part = GetCurPart();
if( !part || part->GetDrawItemList().empty() )
return;
wxString default_path = prj.GetRString( PROJECT::SCH_LIB_PATH );
if( !default_path )
default_path = search->LastVisitedPath();
wxFileDialog dlg( this, _( "Export Symbol Drawings" ), default_path,
part->GetName(), SchematicSymbolFileWildcard,
wxFD_SAVE | wxFD_OVERWRITE_PROMPT );
if( dlg.ShowModal() == wxID_CANCEL )
return;
wxFileName fn = dlg.GetPath();
/* The GTK file chooser doesn't return the file extension added to
* file name so add it here. */
if( fn.GetExt().IsEmpty() )
fn.SetExt( SchematicSymbolFileExtension );
prj.SetRString( PROJECT::SCH_LIB_PATH, fn.GetPath() );
msg.Printf( _( "Saving symbol in '%s'" ), GetChars( fn.GetPath() ) );
SetStatusText( msg );
wxString line;
// File header
line << wxT( LIBFILE_IDENT ) << wxT( " " ) << LIB_VERSION_MAJOR
<< wxT( "." ) << LIB_VERSION_MINOR << wxT( " SYMBOL " )
<< wxT( "Date: " ) << DateAndTime() << wxT( "\n" );
// Component name comment and definition.
line << wxT( "# SYMBOL " ) << part->GetName() << wxT( "\n#\nDEF " )
<< part->GetName() << wxT( " " );
if( !part->GetReferenceField().GetText().IsEmpty() )
line << part->GetReferenceField().GetText() << wxT( " " );
else
line << wxT( "~ " );
line << 0 << wxT( " " ) << part->GetPinNameOffset() << wxT( " " );
if( part->ShowPinNumbers() )
line << wxT( "Y " );
else
line << wxT( "N " );
if( part->ShowPinNames() )
line << wxT( "Y " );
else
line << wxT( "N " );
line << wxT( "1 0 N\n" );
try
{
FILE_OUTPUTFORMATTER formatter( fn.GetFullPath() );
try
{
formatter.Print( 0, "%s", TO_UTF8( line ) );
part->GetReferenceField().Save( formatter );
part->GetValueField().Save( formatter );
formatter.Print( 0, "DRAW\n" );
LIB_ITEMS& drawList = part->GetDrawItemList();
for( LIB_ITEM& item : drawList )
{
if( item.Type() == LIB_FIELD_T )
continue;
// Don't save unused parts or alternate body styles.
if( m_unit && item.GetUnit() && ( item.GetUnit() != m_unit ) )
continue;
if( m_convert && item.GetConvert() && ( item.GetConvert() != m_convert ) )
continue;
item.Save( formatter );
}
formatter.Print( 0, "ENDDRAW\n" );
formatter.Print( 0, "ENDDEF\n" );
}
catch( const IO_ERROR& ioe )
{
msg.Printf( _( "An error occurred attempting to save symbol file '%s'" ),
GetChars( fn.GetFullPath() ) );
DisplayError( this, msg );
}
//.........这里部分代码省略.........