本文整理汇总了C++中LIB_COMPONENT::GetPartCount方法的典型用法代码示例。如果您正苦于以下问题:C++ LIB_COMPONENT::GetPartCount方法的具体用法?C++ LIB_COMPONENT::GetPartCount怎么用?C++ LIB_COMPONENT::GetPartCount使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LIB_COMPONENT
的用法示例。
在下文中一共展示了LIB_COMPONENT::GetPartCount方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: InitBasicPanel
/*
* create the basic panel for component properties editing
*/
void DIALOG_EDIT_COMPONENT_IN_LIBRARY::InitBasicPanel()
{
LIB_COMPONENT* component = m_Parent->GetComponent();
if( m_Parent->GetShowDeMorgan() )
m_AsConvertButt->SetValue( true );
/* Default values for a new component. */
if( component == NULL )
{
m_ShowPinNumButt->SetValue( true );
m_ShowPinNameButt->SetValue( true );
m_PinsNameInsideButt->SetValue( true );
m_SelNumberOfUnits->SetValue( 1 );
m_SetSkew->SetValue( 40 );
m_OptionPower->SetValue( false );
m_OptionPartsLocked->SetValue( false );
return;
}
m_ShowPinNumButt->SetValue( component->ShowPinNumbers() );
m_ShowPinNameButt->SetValue( component->ShowPinNames() );
m_PinsNameInsideButt->SetValue( component->GetPinNameOffset() != 0 );
m_SelNumberOfUnits->SetValue( component->GetPartCount() );
m_SetSkew->SetValue( component->GetPinNameOffset() );
m_OptionPower->SetValue( component->IsPower() );
m_OptionPartsLocked->SetValue( component->UnitsLocked() && component->GetPartCount() > 1 );
}
示例2: ChangeNbUnitsPerPackage
/*
* Change the number of parts per package.
*/
bool DIALOG_EDIT_COMPONENT_IN_LIBRARY::ChangeNbUnitsPerPackage( int MaxUnit )
{
LIB_COMPONENT* component = m_Parent->GetComponent();
if( component == NULL || component->GetPartCount() == MaxUnit || MaxUnit < 1 )
return false;
if( MaxUnit < component->GetPartCount()
&& !IsOK( this, _( "Delete extra parts from component?" ) ) )
return false;
component->SetPartCount( MaxUnit );
return true;
}
示例3: ReCreateHToolbar
//.........这里部分代码省略.........
m_mainToolBar->AddTool( ID_ZOOM_REDRAW, wxEmptyString,
KiBitmap( zoom_redraw_xpm ), msg );
msg = AddHotkeyName( _( "Zoom auto" ), s_Viewlib_Hokeys_Descr,
HK_ZOOM_AUTO, IS_COMMENT );
m_mainToolBar->AddTool( ID_ZOOM_PAGE, wxEmptyString,
KiBitmap( zoom_fit_in_page_xpm ), msg );
m_mainToolBar->AddSeparator();
m_mainToolBar->AddTool( ID_LIBVIEW_DE_MORGAN_NORMAL_BUTT, wxEmptyString,
KiBitmap( morgan1_xpm ),
_( "Show as \"De Morgan\" normal part" ),
wxITEM_CHECK );
m_mainToolBar->AddTool( ID_LIBVIEW_DE_MORGAN_CONVERT_BUTT, wxEmptyString,
KiBitmap( morgan2_xpm ),
_( "Show as \"De Morgan\" convert part" ),
wxITEM_CHECK );
m_mainToolBar->AddSeparator();
m_selpartBox = new wxComboBox( m_mainToolBar, ID_LIBVIEW_SELECT_PART_NUMBER,
wxEmptyString, wxDefaultPosition,
wxSize( 150, -1 ), 0, NULL, wxCB_READONLY );
m_mainToolBar->AddControl( m_selpartBox );
m_mainToolBar->AddSeparator();
m_mainToolBar->AddTool( ID_LIBVIEW_VIEWDOC, wxEmptyString,
KiBitmap( datasheet_xpm ),
_( "View component documents" ) );
m_mainToolBar->EnableTool( ID_LIBVIEW_VIEWDOC, false );
if( m_semaphore )
{
// The library browser is called from a "load component" command
m_mainToolBar->AddSeparator();
m_mainToolBar->AddTool( ID_LIBVIEW_CMP_EXPORT_TO_SCHEMATIC,
wxEmptyString, KiBitmap( export_xpm ),
_( "Insert component in schematic" ) );
}
// after adding the buttons to the toolbar, must call Realize() to
// reflect the changes
m_mainToolBar->Realize();
}
if( (m_libraryName != wxEmptyString) && (m_entryName != wxEmptyString) )
{
lib = CMP_LIBRARY::FindLibrary( m_libraryName );
if( lib != NULL )
{
component = lib->FindComponent( m_entryName );
if( component && component->HasConversion() )
asdeMorgan = true;
entry = lib->FindEntry( m_entryName );
}
}
// Must be AFTER Realize():
m_mainToolBar->EnableTool( ID_LIBVIEW_DE_MORGAN_CONVERT_BUTT, asdeMorgan );
m_mainToolBar->EnableTool( ID_LIBVIEW_DE_MORGAN_NORMAL_BUTT, asdeMorgan );
if( asdeMorgan )
{
bool normal = m_convert <= 1;
m_mainToolBar->ToggleTool( ID_LIBVIEW_DE_MORGAN_NORMAL_BUTT,normal );
m_mainToolBar->ToggleTool( ID_LIBVIEW_DE_MORGAN_CONVERT_BUTT, !normal );
}
else
{
m_mainToolBar->ToggleTool( ID_LIBVIEW_DE_MORGAN_NORMAL_BUTT, true );
m_mainToolBar->ToggleTool( ID_LIBVIEW_DE_MORGAN_CONVERT_BUTT, false );
}
int parts_count = 1;
if( component )
parts_count = std::max( component->GetPartCount(), 1 );
m_selpartBox->Clear();
for( ii = 0; ii < parts_count; ii++ )
{
wxString msg;
msg.Printf( _( "Unit %c" ), 'A' + ii );
m_selpartBox->Append( msg );
}
m_selpartBox->SetSelection( (m_unit > 0 ) ? m_unit - 1 : 0 );
m_selpartBox->Enable( parts_count > 1 );
m_mainToolBar->EnableTool( ID_LIBVIEW_VIEWDOC,
entry && ( entry->GetDocFileName() != wxEmptyString ) );
m_mainToolBar->Refresh();
}
示例4: 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 );
}
示例5: AddMenusForEditComponent
void AddMenusForEditComponent( wxMenu* PopMenu, SCH_COMPONENT* Component )
{
if( Component->Type() != SCH_COMPONENT_T )
{
wxASSERT( 0 );
return;
}
wxString msg;
LIB_ALIAS* libEntry;
LIB_COMPONENT* libComponent = NULL;
libEntry = CMP_LIBRARY::FindLibraryEntry( Component->GetLibName() );
if( libEntry )
libComponent = libEntry->GetComponent();
wxMenu* editmenu = new wxMenu;
msg = AddHotkeyName( _( "Edit" ), s_Schematic_Hokeys_Descr, HK_EDIT );
AddMenuItem( editmenu, ID_SCH_EDIT_ITEM, msg, KiBitmap( edit_component_xpm ) );
if( libComponent && libComponent->IsNormal() )
{
msg = AddHotkeyName( _( "Value" ), s_Schematic_Hokeys_Descr,
HK_EDIT_COMPONENT_VALUE );
AddMenuItem( editmenu, ID_SCH_EDIT_COMPONENT_VALUE, msg,
KiBitmap( edit_comp_value_xpm ) );
msg = AddHotkeyName( _( "Reference" ), s_Schematic_Hokeys_Descr,
HK_EDIT_COMPONENT_REFERENCE );
AddMenuItem( editmenu, ID_SCH_EDIT_COMPONENT_REFERENCE, msg,
KiBitmap( edit_comp_ref_xpm ) );
msg = AddHotkeyName( _( "Footprint" ), s_Schematic_Hokeys_Descr,
HK_EDIT_COMPONENT_FOOTPRINT );
AddMenuItem( editmenu, ID_SCH_EDIT_COMPONENT_FOOTPRINT, msg,
KiBitmap( edit_comp_footprint_xpm ) );
}
if( libComponent && libComponent->HasConversion() )
AddMenuItem( editmenu, ID_POPUP_SCH_EDIT_CONVERT_CMP, _( "Convert" ),
KiBitmap( component_select_alternate_shape_xpm ) );
if( libComponent && ( libComponent->GetPartCount() >= 2 ) )
{
wxMenu* sel_unit_menu = new wxMenu; int ii;
for( ii = 0; ii < libComponent->GetPartCount(); ii++ )
{
wxString num_unit;
int unit = Component->GetUnit();
num_unit.Printf( _( "Unit %d %c" ), ii + 1,
"?ABCDEFGHIJKLMNOPQRSTUVWXYZ"[ ii + 1 ] );
wxMenuItem * item = sel_unit_menu->Append( ID_POPUP_SCH_SELECT_UNIT1 + ii,
num_unit, wxEmptyString,
wxITEM_CHECK );
if( unit == ii + 1 )
item->Check(true);
}
AddMenuItem( editmenu, sel_unit_menu, ID_POPUP_SCH_SELECT_UNIT_CMP,
_( "Unit" ), KiBitmap( component_select_unit_xpm ) );
}
if( !Component->GetFlags() )
{
AddMenuItem( editmenu, ID_POPUP_SCH_CALL_LIBEDIT_AND_LOAD_CMP,
_( "Edit with Library Editor" ),
KiBitmap( libedit_xpm ) );
}
AddMenuItem( PopMenu, editmenu, ID_SCH_EDIT_ITEM,
_( "Edit Component" ), KiBitmap( edit_component_xpm ) );
}