本文整理汇总了C++中LIB_COMPONENT类的典型用法代码示例。如果您正苦于以下问题:C++ LIB_COMPONENT类的具体用法?C++ LIB_COMPONENT怎么用?C++ LIB_COMPONENT使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了LIB_COMPONENT类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: _
void DIALOG_EDIT_COMPONENT_IN_LIBRARY::DeleteAliasOfPart( wxCommandEvent& event )
{
wxString aliasname = m_PartAliasListCtrl->GetStringSelection();
if( aliasname.IsEmpty() )
return;
if( aliasname.CmpNoCase( m_Parent->GetAliasName() ) == 0 )
{
wxString msg;
msg.Printf( _( "Alias <%s> cannot be removed while it is being edited!" ),
GetChars( aliasname ) );
DisplayError( this, msg );
return;
}
m_PartAliasListCtrl->Delete( m_PartAliasListCtrl->GetSelection() );
LIB_COMPONENT* component = m_Parent->GetComponent();
if( component )
component->RemoveAlias( aliasname );
if( m_PartAliasListCtrl->IsEmpty() )
{
m_ButtonDeleteAllAlias->Enable( false );
m_ButtonDeleteOneAlias->Enable( false );
}
}
示例2: SetUnsetConvert
/*
* Set or clear the component alternate body style ( DeMorgan ).
*/
bool DIALOG_EDIT_COMPONENT_IN_LIBRARY::SetUnsetConvert()
{
LIB_COMPONENT* component = m_Parent->GetComponent();
if( component == NULL || ( m_Parent->GetShowDeMorgan() == component->HasConversion() ) )
return false;
if( m_Parent->GetShowDeMorgan() )
{
if( !IsOK( this, _( "Add new pins for alternate body style ( DeMorgan ) to component?" ) ) )
return false;
}
else if( component->HasConversion() )
{
if( !IsOK( this, _( "Delete alternate body style (DeMorgan) draw items from component?" ) ) )
{
m_Parent->SetShowDeMorgan( true );
return false;
}
}
component->SetConversion( m_Parent->GetShowDeMorgan() );
m_Parent->OnModify();
return true;
}
示例3: 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 );
}
示例4: GetPin
LIB_PIN* SCH_SCREEN::GetPin( const wxPoint& aPosition, SCH_COMPONENT** aComponent,
bool aEndPointOnly ) const
{
SCH_ITEM* item;
SCH_COMPONENT* component = NULL;
LIB_PIN* pin = NULL;
for( item = m_drawList.begin(); item != NULL; item = item->Next() )
{
if( item->Type() != SCH_COMPONENT_T )
continue;
component = (SCH_COMPONENT*) item;
if( aEndPointOnly )
{
pin = NULL;
LIB_COMPONENT* entry = CMP_LIBRARY::FindLibraryComponent( component->GetLibName() );
if( entry == NULL )
continue;
for( pin = entry->GetNextPin(); pin != NULL; pin = entry->GetNextPin( pin ) )
{
// Skip items not used for this part.
if( component->GetUnit() && pin->GetUnit() &&
( pin->GetUnit() != component->GetUnit() ) )
continue;
if( component->GetConvert() && pin->GetConvert() &&
( pin->GetConvert() != component->GetConvert() ) )
continue;
if(component->GetPinPhysicalPosition( pin ) == aPosition )
break;
}
if( pin )
break;
}
else
{
pin = (LIB_PIN*) component->GetDrawItem( aPosition, LIB_PIN_T );
if( pin )
break;
}
}
if( pin && aComponent )
*aComponent = component;
return pin;
}
示例5:
CMP_LIBRARY::~CMP_LIBRARY()
{
for( LIB_ALIAS_MAP::iterator it=aliases.begin(); it!=aliases.end(); it++ )
{
LIB_ALIAS* alias = (*it).second;
LIB_COMPONENT* component = alias->GetComponent();
alias = component->RemoveAlias( alias );
if( alias == NULL )
delete component;
}
}
示例6: 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;
}
示例7: 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();
}
示例8: 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 );
}
示例9: BestZoom
double LIB_VIEW_FRAME::BestZoom()
{
/* Please, note: wxMSW before version 2.9 seems have
* problems with zoom values < 1 ( i.e. userscale > 1) and needs to be patched:
* edit file <wxWidgets>/src/msw/dc.cpp
* search for line static const int VIEWPORT_EXTENT = 1000;
* and replace by static const int VIEWPORT_EXTENT = 10000;
*/
LIB_COMPONENT* component = NULL;
double bestzoom = 16.0; // default value for bestzoom
CMP_LIBRARY* lib = CMP_LIBRARY::FindLibrary( m_libraryName );
if( lib )
component = lib->FindComponent( m_entryName );
if( component == NULL )
{
SetScrollCenterPosition( wxPoint( 0, 0 ) );
return bestzoom;
}
wxSize size = m_canvas->GetClientSize();
EDA_RECT BoundaryBox = component->GetBoundingBox( m_unit, m_convert );
// Reserve a 10% margin around component bounding box.
double margin_scale_factor = 0.8;
double zx =(double) BoundaryBox.GetWidth() /
( margin_scale_factor * (double)size.x );
double zy = (double) BoundaryBox.GetHeight() /
( margin_scale_factor * (double)size.y);
// Calculates the best zoom
bestzoom = std::max( zx, zy );
// keep it >= minimal existing zoom (can happen for very small components
// like small power symbols
if( bestzoom < GetScreen()->m_ZoomList[0] )
bestzoom = GetScreen()->m_ZoomList[0];
SetScrollCenterPosition( BoundaryBox.Centre() );
return bestzoom;
}
示例10: wxCHECK_MSG
LIB_ALIAS* CMP_LIBRARY::RemoveEntry( LIB_ALIAS* aEntry )
{
wxCHECK_MSG( aEntry != NULL, NULL, wxT( "NULL pointer cannot be removed from library." ) );
LIB_ALIAS_MAP::iterator it = aliases.find( aEntry->GetName() );
if( it == aliases.end() )
return NULL;
// If the entry pointer doesn't match the name it is mapped to in the library, we
// have done something terribly wrong.
wxCHECK_MSG( (*it).second == aEntry, NULL,
wxT( "Pointer mismatch while attempting to remove entry <" ) +
aEntry->GetName() + wxT( "> from library <" ) + GetName() + wxT( ">." ) );
LIB_ALIAS* alias = (LIB_ALIAS*) aEntry;
LIB_COMPONENT* component = alias->GetComponent();
alias = component->RemoveAlias( alias );
if( alias == NULL )
{
delete component;
if( aliases.size() > 1 )
{
LIB_ALIAS_MAP::iterator next = it;
next++;
if( next == aliases.end() )
next = aliases.begin();
alias = (*next).second;
}
}
aliases.erase( it );
isModified = true;
return alias;
}
示例11: CopyDocFromRootToAlias
void DIALOG_EDIT_COMPONENT_IN_LIBRARY::CopyDocFromRootToAlias( wxCommandEvent& event )
{
if( m_Parent == NULL )
return;
LIB_ALIAS* parent_alias;
LIB_COMPONENT* component = m_Parent->GetComponent();
if( component == NULL )
return;
// search for the main alias: this is the first alias in alias list
// something like the main component
parent_alias = component->GetAlias( 0 );
if( parent_alias == NULL ) // Should never occur (bug)
return;
m_DocCtrl->SetValue( parent_alias->GetDescription() );
m_DocfileCtrl->SetValue( parent_alias->GetDocFileName() );
m_KeywordsCtrl->SetValue( parent_alias->GetKeyWords() );
}
示例12: InitPanelDoc
void DIALOG_EDIT_COMPONENT_IN_LIBRARY::InitPanelDoc()
{
LIB_ALIAS* alias;
LIB_COMPONENT* component = m_Parent->GetComponent();
if( component == NULL )
return;
wxString aliasname = m_Parent->GetAliasName();
if( aliasname.IsEmpty() )
return;
alias = component->GetAlias( aliasname );
if( alias != NULL )
{
m_DocCtrl->SetValue( alias->GetDescription() );
m_KeywordsCtrl->SetValue( alias->GetKeyWords() );
m_DocfileCtrl->SetValue( alias->GetDocFileName() );
}
}
示例13: 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 );
}
示例14: 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 ) );
}
示例15: ReCreateHToolbar
void LIB_VIEW_FRAME::ReCreateHToolbar()
{
int ii;
wxString msg;
CMP_LIBRARY* lib;
LIB_COMPONENT* component = NULL;
LIB_ALIAS* entry = NULL;
bool asdeMorgan = false;
if( m_mainToolBar == NULL )
{
m_mainToolBar = new wxAuiToolBar( this, ID_H_TOOLBAR, wxDefaultPosition, wxDefaultSize,
wxAUI_TB_DEFAULT_STYLE | wxAUI_TB_HORZ_LAYOUT );
// Set up toolbar
m_mainToolBar->AddTool( ID_LIBVIEW_SELECT_LIB, wxEmptyString,
KiBitmap( library_xpm ),
_( "Select library to browse" ) );
m_mainToolBar->AddTool( ID_LIBVIEW_SELECT_PART, wxEmptyString,
KiBitmap( add_component_xpm ),
_( "Select component to browse" ) );
m_mainToolBar->AddSeparator();
m_mainToolBar->AddTool( ID_LIBVIEW_PREVIOUS, wxEmptyString,
KiBitmap( lib_previous_xpm ),
_( "Display previous component" ) );
m_mainToolBar->AddTool( ID_LIBVIEW_NEXT, wxEmptyString,
KiBitmap( lib_next_xpm ),
_( "Display next component" ) );
m_mainToolBar->AddSeparator();
msg = AddHotkeyName( _( "Zoom in" ), s_Viewlib_Hokeys_Descr,
HK_ZOOM_IN, IS_COMMENT );
m_mainToolBar->AddTool( ID_ZOOM_IN, wxEmptyString,
KiBitmap( zoom_in_xpm ), msg );
msg = AddHotkeyName( _( "Zoom out" ), s_Viewlib_Hokeys_Descr,
HK_ZOOM_OUT, IS_COMMENT );
m_mainToolBar->AddTool( ID_ZOOM_OUT, wxEmptyString,
KiBitmap( zoom_out_xpm ), msg );
msg = AddHotkeyName( _( "Redraw view" ), s_Viewlib_Hokeys_Descr,
HK_ZOOM_REDRAW, IS_COMMENT );
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() )
//.........这里部分代码省略.........