本文整理汇总了C++中LIB_PART::GetAliasCount方法的典型用法代码示例。如果您正苦于以下问题:C++ LIB_PART::GetAliasCount方法的具体用法?C++ LIB_PART::GetAliasCount怎么用?C++ LIB_PART::GetAliasCount使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LIB_PART
的用法示例。
在下文中一共展示了LIB_PART::GetAliasCount方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: initDlg
/* Initialize state of check boxes and texts
*/
void DIALOG_EDIT_COMPONENT_IN_LIBRARY::initDlg()
{
m_AliasLocation = -1;
LIB_PART* component = m_Parent->GetCurPart();
if( component == NULL )
{
SetTitle( _( "Library Component Properties" ) );
return;
}
wxString title;
bool isRoot = m_Parent->GetAliasName().CmpNoCase( component->GetName() ) == 0;
if( !isRoot )
{
title.Printf( _( "Properties for %s (alias of %s)" ),
GetChars( m_Parent->GetAliasName() ),
GetChars( component->GetName() ) );
}
else
title.Printf( _( "Properties for %s" ), GetChars( component->GetName() ) );
SetTitle( title );
InitPanelDoc();
InitBasicPanel();
if( isRoot && component->GetAliasCount() == 1 )
m_ButtonDeleteAllAlias->Enable( false );
/* Place list of alias names in listbox */
m_PartAliasListCtrl->Append( component->GetAliasNames( false ) );
if( component->GetAliasCount() <= 1 )
{
m_ButtonDeleteAllAlias->Enable( false );
m_ButtonDeleteOneAlias->Enable( false );
}
/* Read the Footprint Filter list */
m_FootprintFilterListBox->Append( component->GetFootPrints() );
if( component->GetFootPrints().GetCount() == 0 )
{
m_ButtonDeleteAllFootprintFilter->Enable( false );
m_ButtonDeleteOneFootprintFilter->Enable( false );
m_buttonEditOneFootprintFilter->Enable( false );
}
m_NoteBook->SetSelection( m_lastOpenedPage );
m_stdSizerButtonOK->SetDefault();
}
示例2: SetHtmlDesc
void SetHtmlDesc()
{
wxString raw_desc;
if( m_part->IsRoot() )
{
raw_desc = m_part->GetDescription();
}
else
{
LIB_PART* root = m_part->GetPart();
for( size_t i = 0; i < root->GetAliasCount(); ++i )
{
LIB_ALIAS* alias = root->GetAlias( i );
if( alias && !alias->GetDescription().empty() )
{
raw_desc = alias->GetDescription();
break;
}
}
}
m_html.Replace( "__DESC__", wxString::Format( DescFormat, EscapedHTML( raw_desc ) ) );
}
示例3: OnUpdateSelectAlias
void LIB_EDIT_FRAME::OnUpdateSelectAlias( wxUpdateUIEvent& event )
{
if( m_aliasSelectBox == NULL )
return;
LIB_PART* part = GetCurPart();
// Using the typical event.Enable() call doesn't seem to work with wxGTK
// so use the pointer to alias combobox to directly enable or disable.
m_aliasSelectBox->Enable( part && part->GetAliasCount() > 1 );
}
示例4: OnViewEntryDoc
void LIB_EDIT_FRAME::OnViewEntryDoc( wxCommandEvent& event )
{
LIB_PART* part = GetCurPart();
if( !part )
return;
wxString filename;
if( part->GetAliasCount() > 1 )
{
ACTION_MENU popup;
wxString msg;
int id = 0;
for( LIB_ALIAS* alias : part->GetAliases() )
{
msg.Printf( wxT( "%s (%s)" ), alias->GetName(), alias->GetDocFileName() );
popup.Append( id++, msg );
}
PopupMenu( &popup );
if( popup.GetSelected() >= 0 )
filename = part->GetAlias( (unsigned) popup.GetSelected() )->GetDocFileName();
}
else
filename = part->GetAlias( 0 )->GetDocFileName();
if( !filename.IsEmpty() && filename != wxT( "~" ) )
{
SEARCH_STACK* lib_search = Prj().SchSearchS();
GetAssociatedDocument( this, filename, lib_search );
}
}
示例5: EditField
void LIB_EDIT_FRAME::EditField( LIB_FIELD* aField )
{
wxString newFieldValue;
wxString title;
wxString caption;
wxString oldName;
if( aField == NULL )
return;
LIB_PART* parent = aField->GetParent();
wxASSERT( parent );
// Editing the component value field is equivalent to creating a new component based
// on the current component. Set the dialog message to inform the user.
if( aField->GetId() == VALUE )
{
caption = _( "Component Name" );
title = _( "Enter a name to create a new component based on this one." );
}
else
{
caption.Printf( _( "Edit Field %s" ), GetChars( aField->GetName() ) );
title.Printf( _( "Enter a new value for the %s field." ),
GetChars( aField->GetName().Lower() ) );
}
DIALOG_LIB_EDIT_ONE_FIELD dlg( this, caption, aField );
// The dialog may invoke a kiway player for footprint fields
// so we must use a quasimodal dialog.
if( dlg.ShowQuasiModal() != wxID_OK )
return;
newFieldValue = dlg.GetText();
wxString fieldText = aField->GetFullText( m_unit );
/* If the value field is changed, this is equivalent to creating a new component from
* the old one. Rename the component and remove any conflicting aliases to prevent name
* errors when updating the library.
*/
if( aField->GetId() == VALUE && newFieldValue != aField->GetText() )
{
wxString msg;
PART_LIB* lib = GetCurLib();
// Test the current library for name conflicts.
if( lib && lib->FindAlias( newFieldValue ) )
{
msg.Printf( _(
"The name '%s' conflicts with an existing entry in the component library '%s'.\n\n"
"Do you wish to replace the current component in the library with this one?" ),
GetChars( newFieldValue ),
GetChars( lib->GetName() )
);
int rsp = wxMessageBox( msg, _( "Confirm" ),
wxYES_NO | wxICON_QUESTION | wxNO_DEFAULT, this );
if( rsp == wxNO )
return;
}
// Test the current component for name conflicts.
if( parent->HasAlias( newFieldValue ) )
{
msg.Printf( _( "The current component already has an alias named '%s'.\n\n"
"Do you wish to remove this alias from the component?" ),
GetChars( newFieldValue ) );
int rsp = wxMessageBox( msg, _( "Confirm" ), wxYES_NO | wxICON_QUESTION, this );
if( rsp == wxNO )
return;
parent->RemoveAlias( newFieldValue );
}
parent->SetName( newFieldValue );
// Test the library for any conflicts with the any aliases in the current component.
if( parent->GetAliasCount() > 1 && lib && lib->Conflicts( parent ) )
{
msg.Printf( _(
"The new component contains alias names that conflict with entries in the "
"component library '%s'.\n\n"
"Do you wish to remove all of the conflicting aliases from this component?" ),
GetChars( lib->GetName() )
);
int rsp = wxMessageBox( msg, _( "Confirm" ), wxYES_NO | wxICON_QUESTION, this );
if( rsp == wxNO )
{
parent->SetName( fieldText );
return;
}
//.........这里部分代码省略.........
示例6: makeLibParts
XNODE* NETLIST_EXPORTER_GENERIC::makeLibParts()
{
XNODE* xlibparts = node( wxT( "libparts" ) ); // auto_ptr
wxString sLibpart = wxT( "libpart" );
wxString sLib = wxT( "lib" );
wxString sPart = wxT( "part" );
wxString sAliases = wxT( "aliases" );
wxString sAlias = wxT( "alias" );
wxString sPins = wxT( "pins" ); // key for library component pins list
wxString sPin = wxT( "pin" ); // key for one library component pin descr
wxString sPinNum = wxT( "num" ); // key for one library component pin num
wxString sPinName = wxT( "name" ); // key for one library component pin name
wxString sPinType = wxT( "type" ); // key for one library component pin electrical type
wxString sName = wxT( "name" );
wxString sField = wxT( "field" );
wxString sFields = wxT( "fields" );
wxString sDescr = wxT( "description" );
wxString sDocs = wxT( "docs" );
wxString sFprints = wxT( "footprints" );
wxString sFp = wxT( "fp" );
LIB_PINS pinList;
LIB_FIELDS fieldList;
m_Libraries.clear();
for( std::set<LIB_PART*>::iterator it = m_LibParts.begin(); it!=m_LibParts.end(); ++it )
{
LIB_PART* lcomp = *it;
PART_LIB* library = lcomp->GetLib();
m_Libraries.insert( library ); // inserts component's library if unique
XNODE* xlibpart;
xlibparts->AddChild( xlibpart = node( sLibpart ) );
xlibpart->AddAttribute( sLib, library->GetLogicalName() );
xlibpart->AddAttribute( sPart, lcomp->GetName() );
if( lcomp->GetAliasCount() )
{
wxArrayString aliases = lcomp->GetAliasNames( false );
if( aliases.GetCount() )
{
XNODE* xaliases = node( sAliases );
xlibpart->AddChild( xaliases );
for( unsigned i=0; i<aliases.GetCount(); ++i )
{
xaliases->AddChild( node( sAlias, aliases[i] ) );
}
}
}
//----- show the important properties -------------------------
if( !lcomp->GetAlias( 0 )->GetDescription().IsEmpty() )
xlibpart->AddChild( node( sDescr, lcomp->GetAlias( 0 )->GetDescription() ) );
if( !lcomp->GetAlias( 0 )->GetDocFileName().IsEmpty() )
xlibpart->AddChild( node( sDocs, lcomp->GetAlias( 0 )->GetDocFileName() ) );
// Write the footprint list
if( lcomp->GetFootPrints().GetCount() )
{
XNODE* xfootprints;
xlibpart->AddChild( xfootprints = node( sFprints ) );
for( unsigned i=0; i<lcomp->GetFootPrints().GetCount(); ++i )
{
xfootprints->AddChild( node( sFp, lcomp->GetFootPrints()[i] ) );
}
}
//----- show the fields here ----------------------------------
fieldList.clear();
lcomp->GetFields( fieldList );
XNODE* xfields;
xlibpart->AddChild( xfields = node( sFields ) );
for( unsigned i=0; i<fieldList.size(); ++i )
{
if( !fieldList[i].GetText().IsEmpty() )
{
XNODE* xfield;
xfields->AddChild( xfield = node( sField, fieldList[i].GetText() ) );
xfield->AddAttribute( sName, fieldList[i].GetName(false) );
}
}
//----- show the pins here ------------------------------------
pinList.clear();
lcomp->GetPins( pinList, 0, 0 );
/* we must erase redundant Pins references in pinList
* These redundant pins exist because some pins
* are found more than one time when a component has
* multiple parts per package or has 2 representations (DeMorgan conversion)
* For instance, a 74ls00 has DeMorgan conversion, with different pin shapes,
* and therefore each pin appears 2 times in the list.
* Common pins (VCC, GND) can also be found more than once.
*/
//.........这里部分代码省略.........