本文整理汇总了C++中LIB_PIN::GetConvert方法的典型用法代码示例。如果您正苦于以下问题:C++ LIB_PIN::GetConvert方法的具体用法?C++ LIB_PIN::GetConvert怎么用?C++ LIB_PIN::GetConvert使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LIB_PIN
的用法示例。
在下文中一共展示了LIB_PIN::GetConvert方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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; item = item->Next() )
{
if( item->Type() != SCH_COMPONENT_T )
continue;
component = (SCH_COMPONENT*) item;
if( aEndPointOnly )
{
pin = NULL;
LIB_PART* part = Prj().SchLibs()->FindLibPart( component->GetPartName() );
if( !part )
continue;
for( pin = part->GetNextPin(); pin; pin = part->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;
}
示例2: 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;
}
示例3: GlobalSetPins
/* aMasterPin is the "template" pin
* aId is a param to select what should be mofified:
* - aId = ID_POPUP_LIBEDIT_PIN_GLOBAL_CHANGE_PINNAMESIZE_ITEM:
* Change pins text name size
* - aId = ID_POPUP_LIBEDIT_PIN_GLOBAL_CHANGE_PINNUMSIZE_ITEM:
* Change pins text num size
* - aId = ID_POPUP_LIBEDIT_PIN_GLOBAL_CHANGE_PINSIZE_ITEM:
* Change pins length.
*
* If aMasterPin is selected ( .m_flag == IS_SELECTED ),
* only the other selected pins are modified
*/
void LIB_EDIT_FRAME::GlobalSetPins( LIB_PIN* aMasterPin, int aId )
{
LIB_PART* part = GetCurPart();
if( !part || !aMasterPin )
return;
if( aMasterPin->Type() != LIB_PIN_T )
return;
OnModify( );
bool selected = aMasterPin->IsSelected();
for( LIB_PIN* pin = part->GetNextPin(); pin; pin = part->GetNextPin( pin ) )
{
if( pin->GetConvert() && pin->GetConvert() != m_convert )
continue;
// Is it the "selected mode" ?
if( selected && !pin->IsSelected() )
continue;
switch( aId )
{
case ID_POPUP_LIBEDIT_PIN_GLOBAL_CHANGE_PINNUMSIZE_ITEM:
pin->SetNumberTextSize( aMasterPin->GetNumberTextSize() );
break;
case ID_POPUP_LIBEDIT_PIN_GLOBAL_CHANGE_PINNAMESIZE_ITEM:
pin->SetNameTextSize( aMasterPin->GetNameTextSize() );
break;
case ID_POPUP_LIBEDIT_PIN_GLOBAL_CHANGE_PINSIZE_ITEM:
pin->SetLength( aMasterPin->GetLength() );
break;
}
// Clear the flag IS_CHANGED, which was set by previous changes (if any)
// but not used here.
pin->ClearFlags( IS_CHANGED );
}
}
示例4: findAllInstancesOfComponent
void NETLIST_EXPORTER::findAllInstancesOfComponent( SCH_COMPONENT* aComponent,
LIB_PART* aEntry,
SCH_SHEET_PATH* aSheetPath )
{
wxString ref = aComponent->GetRef( aSheetPath );
wxString ref2;
SCH_SHEET_LIST sheetList;
for( SCH_SHEET_PATH* sheet = sheetList.GetFirst(); sheet; sheet = sheetList.GetNext() )
{
for( EDA_ITEM* item = sheet->LastDrawList(); item; item = item->Next() )
{
if( item->Type() != SCH_COMPONENT_T )
continue;
SCH_COMPONENT* comp2 = (SCH_COMPONENT*) item;
ref2 = comp2->GetRef( sheet );
if( ref2.CmpNoCase( ref ) != 0 )
continue;
int unit2 = comp2->GetUnitSelection( sheet ); // slow
for( LIB_PIN* pin = aEntry->GetNextPin(); pin; pin = aEntry->GetNextPin( pin ) )
{
wxASSERT( pin->Type() == LIB_PIN_T );
if( pin->GetUnit() && pin->GetUnit() != unit2 )
continue;
if( pin->GetConvert() && pin->GetConvert() != comp2->GetConvert() )
continue;
// A suitable pin is found: add it to the current list
addPinToComponentPinList( comp2, sheet, pin );
}
}
}
}
示例5: OnEditPin
void LIB_EDIT_FRAME::OnEditPin( wxCommandEvent& event )
{
if( m_drawItem == NULL || m_drawItem->Type() != LIB_PIN_T )
return;
STATUS_FLAGS item_flags = m_drawItem->GetFlags(); // save flags to restore them after editing
LIB_PIN* pin = (LIB_PIN*) m_drawItem;
DIALOG_LIB_EDIT_PIN dlg( this, pin );
wxString units = GetUnitsLabel( g_UserUnit );
dlg.SetDlgUnitsLabel( units );
dlg.SetOrientationList( LIB_PIN::GetOrientationNames(), LIB_PIN::GetOrientationSymbols() );
dlg.SetOrientation( LIB_PIN::GetOrientationCodeIndex( pin->GetOrientation() ) );
dlg.SetStyle( pin->GetShape() );
dlg.SetElectricalType( pin->GetType() );
dlg.SetPinName( pin->GetName() );
dlg.SetPinNameTextSize( StringFromValue( g_UserUnit, pin->GetNameTextSize() ) );
dlg.SetPinPositionX( StringFromValue( g_UserUnit, pin->GetPosition().x ) );
dlg.SetPinPositionY( StringFromValue( g_UserUnit, -pin->GetPosition().y ) );
dlg.SetPadName( pin->GetNumberString() );
dlg.SetPadNameTextSize( StringFromValue( g_UserUnit, pin->GetNumberTextSize() ) );
dlg.SetLength( StringFromValue( g_UserUnit, pin->GetLength() ) );
dlg.SetAddToAllParts( pin->GetUnit() == 0 );
dlg.SetAddToAllBodyStyles( pin->GetConvert() == 0 );
dlg.SetVisible( pin->IsVisible() );
/* This ugly hack fixes a bug in wxWidgets 2.8.7 and likely earlier
* versions for the flex grid sizer in wxGTK that prevents the last
* column from being sized correctly. It doesn't cause any problems
* on win32 so it doesn't need to wrapped in ugly #ifdef __WXGTK__
* #endif.
*/
dlg.Layout();
dlg.Fit();
dlg.SetMinSize( dlg.GetSize() );
if( dlg.ShowModal() == wxID_CANCEL )
{
if( pin->IsNew() )
{
pin->SetFlags( IS_CANCELLED );
m_canvas->EndMouseCapture();
}
return;
}
// Test the pin position validity: to avoid issues in schematic,
// it must be on a 50 mils grid
wxPoint pinpos;
pinpos.x = ValueFromString( g_UserUnit, dlg.GetPinPositionX() );
pinpos.y = -ValueFromString( g_UserUnit, dlg.GetPinPositionY() );
const int acceptable_mingrid = 50;
if( (pinpos.x % acceptable_mingrid) || (pinpos.y % acceptable_mingrid) )
{
wxString msg;
msg.Printf( _( "This pin is not on a %d mils grid\n"
"It will be not easy to connect in schematic\n"
"Do you want to continue?"), acceptable_mingrid );
if( !IsOK( this, msg ) )
return;
}
// Save the pin properties to use for the next new pin.
LastPinNameSize = ValueFromString( g_UserUnit, dlg.GetPinNameTextSize() );
LastPinNumSize = ValueFromString( g_UserUnit, dlg.GetPadNameTextSize() );
LastPinOrient = LIB_PIN::GetOrientationCode( dlg.GetOrientation() );
LastPinLength = ValueFromString( g_UserUnit, dlg.GetLength() );
LastPinShape = dlg.GetStyle();
LastPinType = dlg.GetElectricalType();
LastPinCommonConvert = dlg.GetAddToAllBodyStyles();
LastPinCommonUnit = dlg.GetAddToAllParts();
LastPinVisible = dlg.GetVisible();
pin->EnableEditMode( true, m_editPinsPerPartOrConvert );
pin->SetName( dlg.GetPinName() );
pin->SetNameTextSize( GetLastPinNameSize() );
pin->SetNumber( dlg.GetPadName() );
pin->SetNumberTextSize( GetLastPinNumSize() );
pin->SetOrientation( LastPinOrient );
pin->SetLength( GetLastPinLength() );
pin->SetPinPosition( pinpos );
pin->SetType( LastPinType );
pin->SetShape( LastPinShape );
pin->SetConversion( ( LastPinCommonConvert ) ? 0 : m_convert );
pin->SetPartNumber( ( LastPinCommonUnit ) ? 0 : m_unit );
pin->SetVisible( LastPinVisible );
if( pin->IsModified() || pin->IsNew() )
{
if( !pin->InEditMode() )
SaveCopyInUndoList( pin->GetParent() );
OnModify( );
//.........这里部分代码省略.........
示例6: OnCheckComponent
void LIB_EDIT_FRAME::OnCheckComponent( wxCommandEvent& event )
{
LIB_PART* part = GetCurPart();
if( !part )
return;
const int MIN_GRID_SIZE = 25;
LIB_PINS pinList;
part->GetPins( pinList );
if( pinList.size() == 0 )
{
DisplayInfoMessage( this, _( "No pins!" ) );
return;
}
// Sort pins by pin num, so 2 duplicate pins
// (pins with the same number) will be consecutive in list
sort( pinList.begin(), pinList.end(), sort_by_pin_number );
// Test for duplicates:
DIALOG_DISPLAY_HTML_TEXT_BASE error_display( this, wxID_ANY,
_( "Marker Information" ),
wxDefaultPosition,
wxSize( 750, 600 ) );
int dup_error = 0;
for( unsigned ii = 1; ii < pinList.size(); ii++ )
{
wxString stringPinNum, stringCurrPinNum;
LIB_PIN* curr_pin = pinList[ii];
LIB_PIN* pin = pinList[ii - 1];
if( pin->GetNumber() != curr_pin->GetNumber()
|| pin->GetConvert() != curr_pin->GetConvert()
|| pin->GetUnit() != curr_pin->GetUnit() )
continue;
dup_error++;
pin->PinStringNum( stringPinNum );
/* TODO I dare someone to find a way to make happy translators on
this thing! Lorenzo */
curr_pin->PinStringNum( stringCurrPinNum );
wxString msg = wxString::Format( _(
"<b>Duplicate pin %s</b> \"%s\" at location <b>(%.3f, %.3f)</b>"
" conflicts with pin %s \"%s\" at location <b>(%.3f, %.3f)</b>" ),
GetChars( stringCurrPinNum ),
GetChars( curr_pin->GetName() ),
curr_pin->GetPosition().x / 1000.0,
-curr_pin->GetPosition().y / 1000.0,
GetChars( stringPinNum ),
GetChars( pin->GetName() ),
pin->GetPosition().x / 1000.0,
-pin->GetPosition().y / 1000.0
);
if( part->GetUnitCount() > 1 )
{
msg += wxString::Format( _( " in part %c" ), 'A' + curr_pin->GetUnit() - 1 );
}
if( m_showDeMorgan )
{
if( curr_pin->GetConvert() )
msg += _( " of converted" );
else
msg += _( " of normal" );
}
msg += wxT( ".<br>" );
error_display.m_htmlWindow->AppendToPage( msg );
}
// Test for off grid pins:
int offgrid_error = 0;
for( unsigned ii = 0; ii < pinList.size(); ii++ )
{
LIB_PIN* pin = pinList[ii];
if( ( (pin->GetPosition().x % MIN_GRID_SIZE) == 0 ) &&
( (pin->GetPosition().y % MIN_GRID_SIZE) == 0 ) )
continue;
// "pin" is off grid here.
offgrid_error++;
wxString stringPinNum;
pin->PinStringNum( stringPinNum );
wxString msg = wxString::Format( _(
"<b>Off grid pin %s</b> \"%s\" at location <b>(%.3f, %.3f)</b>" ),
GetChars( stringPinNum ),
//.........这里部分代码省略.........
示例7: OnEditPin
void LIB_EDIT_FRAME::OnEditPin( wxCommandEvent& event )
{
if( m_drawItem == NULL || m_drawItem->Type() != LIB_PIN_T )
return;
STATUS_FLAGS item_flags = m_drawItem->GetFlags(); // save flags to restore them after editing
LIB_PIN* pin = (LIB_PIN*) m_drawItem;
DIALOG_LIB_EDIT_PIN dlg( this, pin );
wxString units = GetUnitsLabel( g_UserUnit );
dlg.SetOrientationList( LIB_PIN::GetOrientationNames(), LIB_PIN::GetOrientationSymbols() );
dlg.SetOrientation( LIB_PIN::GetOrientationCodeIndex( pin->GetOrientation() ) );
dlg.SetStyleList( LIB_PIN::GetStyleNames(), LIB_PIN::GetStyleSymbols() );
dlg.SetStyle( LIB_PIN::GetStyleCodeIndex( pin->GetShape() ) );
dlg.SetElectricalTypeList( LIB_PIN::GetElectricalTypeNames(),
LIB_PIN::GetElectricalTypeSymbols() );
dlg.SetElectricalType( pin->GetType() );
dlg.SetName( pin->GetName() );
dlg.SetNameTextSize( ReturnStringFromValue( g_UserUnit, pin->GetNameTextSize() ) );
dlg.SetNameTextSizeUnits( units );
dlg.SetPadName( pin->GetNumberString() );
dlg.SetPadNameTextSize( ReturnStringFromValue( g_UserUnit, pin->GetNumberTextSize() ) );
dlg.SetPadNameTextSizeUnits( units );
dlg.SetLength( ReturnStringFromValue( g_UserUnit, pin->GetLength() ) );
dlg.SetLengthUnits( units );
dlg.SetAddToAllParts( pin->GetUnit() == 0 );
dlg.SetAddToAllBodyStyles( pin->GetConvert() == 0 );
dlg.SetVisible( pin->IsVisible() );
/* This ugly hack fixes a bug in wxWidgets 2.8.7 and likely earlier
* versions for the flex grid sizer in wxGTK that prevents the last
* column from being sized correctly. It doesn't cause any problems
* on win32 so it doesn't need to wrapped in ugly #ifdef __WXGTK__
* #endif.
*/
dlg.Layout();
dlg.Fit();
dlg.SetMinSize( dlg.GetSize() );
// dlg.SetLastSizeAndPosition(); // done in DIALOG_SHIM::Show()
if( dlg.ShowModal() == wxID_CANCEL )
{
if( pin->IsNew() )
{
pin->SetFlags( IS_CANCELLED );
m_canvas->EndMouseCapture();
}
return;
}
// Save the pin properties to use for the next new pin.
LastPinNameSize = ReturnValueFromString( g_UserUnit, dlg.GetNameTextSize() );
LastPinNumSize = ReturnValueFromString( g_UserUnit, dlg.GetPadNameTextSize() );
LastPinOrient = LIB_PIN::GetOrientationCode( dlg.GetOrientation() );
LastPinLength = ReturnValueFromString( g_UserUnit, dlg.GetLength() );
LastPinShape = LIB_PIN::GetStyleCode( dlg.GetStyle() );
LastPinType = dlg.GetElectricalType();
LastPinCommonConvert = dlg.GetAddToAllBodyStyles();
LastPinCommonUnit = dlg.GetAddToAllParts();
LastPinVisible = dlg.GetVisible();
pin->EnableEditMode( true, m_editPinsPerPartOrConvert );
pin->SetName( dlg.GetName() );
pin->SetNameTextSize( LastPinNameSize );
pin->SetNumber( dlg.GetPadName() );
pin->SetNumberTextSize( LastPinNumSize );
pin->SetOrientation( LastPinOrient );
pin->SetLength( LastPinLength );
pin->SetType( LastPinType );
pin->SetShape( LastPinShape );
pin->SetConversion( ( LastPinCommonConvert ) ? 0 : m_convert );
pin->SetPartNumber( ( LastPinCommonUnit ) ? 0 : m_unit );
pin->SetVisible( LastPinVisible );
if( pin->IsModified() || pin->IsNew() )
{
if( !pin->InEditMode() )
SaveCopyInUndoList( pin->GetParent() );
OnModify( );
MSG_PANEL_ITEMS items;
pin->GetMsgPanelInfo( items );
SetMsgPanel( items );
m_canvas->Refresh();
}
pin->EnableEditMode( false, m_editPinsPerPartOrConvert );
// Restore pin flags, that can be changed by the dialog editor
pin->ClearFlags();
pin->SetFlags( item_flags );
}