本文整理汇总了C++中LIB_COMPONENT::GetName方法的典型用法代码示例。如果您正苦于以下问题:C++ LIB_COMPONENT::GetName方法的具体用法?C++ LIB_COMPONENT::GetName怎么用?C++ LIB_COMPONENT::GetName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LIB_COMPONENT
的用法示例。
在下文中一共展示了LIB_COMPONENT::GetName方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: RedrawActiveWindow
/**
* Function RedrawActiveWindow
* Display the current selected component.
* If the component is an alias, the ROOT component is displayed
*/
void LIB_VIEW_FRAME::RedrawActiveWindow( wxDC* DC, bool EraseBg )
{
LIB_COMPONENT* component;
LIB_ALIAS* entry;
CMP_LIBRARY* lib;
wxString msg;
wxString tmp;
lib = CMP_LIBRARY::FindLibrary( m_libraryName );
if( lib == NULL )
return;
entry = lib->FindEntry( m_entryName );
if( entry == NULL )
return;
component = entry->GetComponent();
m_canvas->DrawBackGround( DC );
if( !entry->IsRoot() )
{
if( component == NULL ) // Should not occur
return;
// Temporarily change the name field text to reflect the alias name.
msg = entry->GetName();
tmp = component->GetName();
component->SetName( msg );
if( m_unit < 1 )
m_unit = 1;
if( m_convert < 1 )
m_convert = 1;
}
else
{
msg = _( "None" );
}
component->Draw( m_canvas, DC, wxPoint( 0, 0 ), m_unit, m_convert, GR_DEFAULT_DRAWMODE );
/* Redraw the cursor */
m_canvas->DrawCrossHair( DC );
if( !tmp.IsEmpty() )
component->SetName( tmp );
ClearMsgPanel();
AppendMsgPanel( _( "Part" ), component->GetName(), BLUE, 6 );
AppendMsgPanel( _( "Alias" ), msg, RED, 6 );
AppendMsgPanel( _( "Description" ), entry->GetDescription(), CYAN, 6 );
AppendMsgPanel( _( "Key words" ), entry->GetKeyWords(), DARKDARKGRAY );
}
示例2: initDlg
/* Initialize state of check boxes and texts
*/
void DIALOG_EDIT_COMPONENT_IN_LIBRARY::initDlg()
{
m_AliasLocation = -1;
LIB_COMPONENT* component = m_Parent->GetComponent();
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_NoteBook->SetSelection( m_lastOpenedPage );
m_stdSizerButtonOK->SetDefault();
}
示例3: AddAliasOfPart
/* Add a new name to the alias list box
* New name cannot be the root name, and must not exists
*/
void DIALOG_EDIT_COMPONENT_IN_LIBRARY::AddAliasOfPart( wxCommandEvent& event )
{
wxString aliasname;
LIB_COMPONENT* component = m_Parent->GetComponent();
CMP_LIBRARY* library = m_Parent->GetLibrary();
if( component == NULL )
return;
wxTextEntryDialog dlg( this, _( "New alias:" ), _( "Component Alias" ), aliasname );
if( dlg.ShowModal() != wxID_OK )
return; // cancelled by user
aliasname = dlg.GetValue( );
aliasname.Replace( wxT( " " ), wxT( "_" ) );
if( aliasname.IsEmpty() )
return;
if( m_PartAliasListCtrl->FindString( aliasname ) != wxNOT_FOUND )
{
wxString msg;
msg.Printf( _( "Alias or component name <%s> already in use." ),
GetChars( aliasname ) );
DisplayError( this, msg );
return;
}
if( library && library->FindEntry( aliasname ) != NULL )
{
wxString msg;
msg.Printf( _( "Alias or component name <%s> already exists in library <%s>." ),
GetChars( aliasname ),
GetChars( library->GetName() ) );
DisplayError( this, msg );
return;
}
m_PartAliasListCtrl->Append( aliasname );
if( m_Parent->GetAliasName().CmpNoCase( component->GetName() ) == 0 )
m_ButtonDeleteAllAlias->Enable( true );
m_ButtonDeleteOneAlias->Enable( true );
}
示例4: OnPlotCurrentComponent
void LIB_EDIT_FRAME::OnPlotCurrentComponent( wxCommandEvent& event )
{
LIB_COMPONENT* cmp = GetComponent();
wxString FullFileName;
wxString file_ext;
wxString mask;
if( cmp == NULL )
{
wxMessageBox( _( "No component" ) );
return;
}
switch( event.GetId() )
{
case ID_LIBEDIT_GEN_PNG_FILE:
{
bool fmt_is_jpeg = false; // could be selectable later. so keep this option.
file_ext = fmt_is_jpeg ? wxT( "jpg" ) : wxT( "png" );
mask = wxT( "*." ) + file_ext;
wxFileName fn( cmp->GetName() );
fn.SetExt( file_ext );
FullFileName = EDA_FileSelector( _( "Filename:" ), wxGetCwd(),
fn.GetFullName(), file_ext, mask, this,
wxFD_SAVE, true );
if( FullFileName.IsEmpty() )
return;
// calling wxYield is mandatory under Linux, after closing the file selector dialog
// to refresh the screen before creating the PNG or JPEG image from screen
wxYield();
CreatePNGorJPEGFile( FullFileName, fmt_is_jpeg );
}
break;
case ID_LIBEDIT_GEN_SVG_FILE:
{
file_ext = wxT( "svg" );
mask = wxT( "*." ) + file_ext;
wxFileName fn( cmp->GetName() );
fn.SetExt( file_ext );
FullFileName = EDA_FileSelector( _( "Filename:" ), wxGetCwd(),
fn.GetFullName(), file_ext, mask, this,
wxFD_SAVE, true );
if( FullFileName.IsEmpty() )
return;
PAGE_INFO pageSave = GetScreen()->GetPageSettings();
PAGE_INFO pageTemp = pageSave;
wxSize componentSize = m_component->GetBoundingBox( m_unit, m_convert ).GetSize();
// Add a small margin to the plot bounding box
pageTemp.SetWidthMils( int( componentSize.x * 1.2 ) );
pageTemp.SetHeightMils( int( componentSize.y * 1.2 ) );
GetScreen()->SetPageSettings( pageTemp );
SVG_Print_Component( FullFileName );
GetScreen()->SetPageSettings( pageSave );
}
break;
}
}
示例5: OnOkClick
void DIALOG_EDIT_COMPONENT_IN_LIBRARY::OnOkClick( wxCommandEvent& event )
{
/* Update the doc, keyword and doc filename strings */
int index;
LIB_ALIAS* alias;
LIB_COMPONENT* component = m_Parent->GetComponent();
if( component == NULL )
{
EndModal( wxID_CANCEL );
return;
}
m_Parent->SaveCopyInUndoList( component );
alias = component->GetAlias( m_Parent->GetAliasName() );
wxCHECK_RET( alias != NULL,
wxT( "Alias \"" ) + m_Parent->GetAliasName() + wxT( "\" of component \"" ) +
component->GetName() + wxT( "\" does not exist." ) );
alias->SetDescription( m_DocCtrl->GetValue() );
alias->SetKeyWords( m_KeywordsCtrl->GetValue() );
alias->SetDocFileName( m_DocfileCtrl->GetValue() );
component->SetAliases( m_PartAliasListCtrl->GetStrings() );
index = m_SelNumberOfUnits->GetValue();
ChangeNbUnitsPerPackage( index );
if( m_AsConvertButt->GetValue() )
{
if( !m_Parent->GetShowDeMorgan() )
{
m_Parent->SetShowDeMorgan( true );
SetUnsetConvert();
}
}
else
{
if( m_Parent->GetShowDeMorgan() )
{
m_Parent->SetShowDeMorgan( false );
SetUnsetConvert();
}
}
component->SetShowPinNumbers( m_ShowPinNumButt->GetValue() );
component->SetShowPinNames( m_ShowPinNameButt->GetValue() );
if( m_PinsNameInsideButt->GetValue() == false )
component->SetPinNameOffset( 0 ); // pin text outside the body (name is on the pin)
else
{
component->SetPinNameOffset( m_SetSkew->GetValue() );
// Ensure component->m_TextInside != 0, because the meaning is "text outside".
if( component->GetPinNameOffset() == 0 )
component->SetPinNameOffset( 20 ); // give a reasonnable value
}
if( m_OptionPower->GetValue() == true )
component->SetPower();
else
component->SetNormal();
/* Set the option "Units locked".
* Obviously, cannot be true if there is only one part */
component->LockUnits( m_OptionPartsLocked->GetValue() );
if( component->GetPartCount() <= 1 )
component->LockUnits( false );
/* Update the footprint filter list */
component->GetFootPrints().Clear();
component->GetFootPrints() = m_FootprintFilterListBox->GetStrings();
EndModal( wxID_OK );
}