本文整理汇总了C++中LIB_PIN::GetMsgPanelInfo方法的典型用法代码示例。如果您正苦于以下问题:C++ LIB_PIN::GetMsgPanelInfo方法的具体用法?C++ LIB_PIN::GetMsgPanelInfo怎么用?C++ LIB_PIN::GetMsgPanelInfo使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LIB_PIN
的用法示例。
在下文中一共展示了LIB_PIN::GetMsgPanelInfo方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: OnEditPin
//.........这里部分代码省略.........
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( );
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 );
}
示例2: RepeatPinItem
// Create a new pin based on the previous pin with an incremented pin number.
void LIB_EDIT_FRAME::RepeatPinItem( wxDC* DC, LIB_PIN* SourcePin )
{
wxString msg;
LIB_PART* part = GetCurPart();
if( !part || !SourcePin || SourcePin->Type() != LIB_PIN_T )
return;
LIB_PIN* pin = (LIB_PIN*) SourcePin->Clone();
pin->ClearFlags();
pin->SetFlags( IS_NEW );
wxPoint step;
switch( pin->GetOrientation() )
{
case PIN_UP:
step.x = GetRepeatPinStep();
break;
case PIN_DOWN:
step.x = GetRepeatPinStep();
break;
case PIN_LEFT:
step.y = - GetRepeatPinStep();
break;
case PIN_RIGHT:
step.y = - GetRepeatPinStep();
break;
}
pin->Move( pin->GetPosition() + step );
wxString nextName = pin->GetName();
IncrementLabelMember( nextName, GetRepeatDeltaLabel() );
pin->SetName( nextName );
pin->PinStringNum( msg );
IncrementLabelMember( msg, GetRepeatDeltaLabel() );
pin->SetPinNumFromString( msg );
m_drawItem = pin;
if( SynchronizePins() )
pin->SetFlags( IS_LINKED );
wxPoint savepos = GetCrossHairPosition();
m_canvas->CrossHairOff( DC );
SetCrossHairPosition( wxPoint( pin->GetPosition().x, -pin->GetPosition().y ) );
// Add this new pin in list, and creates pins for others parts if needed
m_drawItem = pin;
ClearTempCopyComponent();
PlacePin();
m_lastDrawItem = pin;
SetCrossHairPosition( savepos );
m_canvas->CrossHairOn( DC );
MSG_PANEL_ITEMS items;
pin->GetMsgPanelInfo( items );
SetMsgPanel( items );
OnModify( );
}
示例3: LocateAndShowItem
SCH_ITEM* SCH_EDIT_FRAME::LocateAndShowItem( const wxPoint& aPosition, const KICAD_T aFilterList[],
int aHotKeyCommandId )
{
SCH_ITEM* item;
wxString msg;
LIB_PIN* Pin = NULL;
SCH_COMPONENT* LibItem = NULL;
wxPoint gridPosition = GetNearestGridPosition( aPosition );
// Check the on grid position first. There is more likely to be multiple items on
// grid than off grid.
item = LocateItem( gridPosition, aFilterList, aHotKeyCommandId );
// If the user aborted the clarification context menu, don't show it again at the
// off grid position.
if( !item && m_canvas->GetAbortRequest() )
{
m_canvas->SetAbortRequest( false );
return NULL;
}
if( !item && (aPosition != gridPosition) )
item = LocateItem( aPosition, aFilterList, aHotKeyCommandId );
if( !item )
{
m_canvas->SetAbortRequest( false ); // Just in case the user aborted the context menu.
return NULL;
}
// Cross probing to Pcbnew if a pin or a component is found
switch( item->Type() )
{
case SCH_FIELD_T:
case LIB_FIELD_T:
LibItem = (SCH_COMPONENT*) item->GetParent();
SendMessageToPCBNEW( item, LibItem );
break;
case SCH_COMPONENT_T:
LibItem = (SCH_COMPONENT*) item;
SendMessageToPCBNEW( item, LibItem );
break;
case LIB_PIN_T:
Pin = (LIB_PIN*) item;
LibItem = (SCH_COMPONENT*) LocateItem( aPosition, SCH_COLLECTOR::ComponentsOnly );
break;
default:
;
}
if( Pin )
{
// Force display pin information (the previous display could be a component info)
MSG_PANEL_ITEMS items;
Pin->GetMsgPanelInfo( items );
if( LibItem )
items.push_back( MSG_PANEL_ITEM( LibItem->GetRef( m_CurrentSheet ),
LibItem->GetField( VALUE )->GetShownText(), DARKCYAN ) );
SetMsgPanel( items );
// Cross probing:2 - pin found, and send a locate pin command to Pcbnew (highlight net)
SendMessageToPCBNEW( Pin, LibItem );
}
return item;
}
示例4: LocateAndShowItem
SCH_ITEM* SCH_EDIT_FRAME::LocateAndShowItem( const wxPoint& aPosition, const KICAD_T aFilterList[],
int aHotKeyCommandId,
bool* aClarificationMenuCancelled )
{
SCH_ITEM* item;
LIB_PIN* Pin = NULL;
SCH_COMPONENT* component = NULL;
wxPoint gridPosition = GetNearestGridPosition( aPosition );
// Check the on grid position first. There is more likely to be multiple items on
// grid than off grid.
m_canvas->SetAbortRequest( false ); // be sure a old abort request in not pending
item = LocateItem( gridPosition, aFilterList, aHotKeyCommandId );
// If the user aborted the clarification context menu, don't show it again at the
// off grid position.
if( !item && m_canvas->GetAbortRequest() )
{
if( aClarificationMenuCancelled )
*aClarificationMenuCancelled = true;
m_canvas->SetAbortRequest( false );
return NULL;
}
if( !item && (aPosition != gridPosition) )
item = LocateItem( aPosition, aFilterList, aHotKeyCommandId );
if( !item )
{
if( aClarificationMenuCancelled )
*aClarificationMenuCancelled = m_canvas->GetAbortRequest();
m_canvas->SetAbortRequest( false ); // Just in case the user aborted the context menu.
return NULL;
}
// Cross probing to Pcbnew if a pin or a component is found
switch( item->Type() )
{
case SCH_FIELD_T:
case LIB_FIELD_T:
component = (SCH_COMPONENT*) item->GetParent();
SendMessageToPCBNEW( item, component );
break;
case SCH_COMPONENT_T:
component = (SCH_COMPONENT*) item;
SendMessageToPCBNEW( item, component );
break;
case LIB_PIN_T:
Pin = (LIB_PIN*) item;
component = (SCH_COMPONENT*) LocateItem( aPosition, SCH_COLLECTOR::ComponentsOnly );
break;
/* case SCH_SHEET_T: */
/* // This may lag on larger projects */
/* SendMessageToPCBNEW( item, nullptr ); */
/* break; */
default:
;
}
if( Pin )
{
// Force display pin information (the previous display could be a component info)
MSG_PANEL_ITEMS items;
Pin->GetMsgPanelInfo( m_UserUnits, items, component );
SetMsgPanel( items );
// Cross probing:2 - pin found, and send a locate pin command to Pcbnew (highlight net)
SendMessageToPCBNEW( Pin, component );
}
return item;
}
示例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.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 );
}