本文整理汇总了C++中LIB_ITEM::GetFlags方法的典型用法代码示例。如果您正苦于以下问题:C++ LIB_ITEM::GetFlags方法的具体用法?C++ LIB_ITEM::GetFlags怎么用?C++ LIB_ITEM::GetFlags使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LIB_ITEM
的用法示例。
在下文中一共展示了LIB_ITEM::GetFlags方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: copySelectedItems
void LIB_EDIT_FRAME::copySelectedItems()
{
LIB_PART* part = GetCurPart();
if( !part )
return;
m_clipboard.ClearListAndDeleteItems(); // delete previous saved list, if exists
m_clipboard.SetLastCursorPosition( GetScreen()->m_BlockLocate.GetEnd() ); // store the reference point
for( LIB_ITEM& item : part->GetDrawItems() )
{
// We *do not* copy fields because they are unique for the whole component
// so skip them (do not duplicate) if they are flagged selected.
if( item.Type() == LIB_FIELD_T )
item.ClearFlags( SELECTED );
if( !item.IsSelected() )
continue;
// Do not clear the 'selected' flag. It is required to have items drawn when they are pasted.
LIB_ITEM* copy = (LIB_ITEM*) item.Clone();
copy->SetFlags( copy->GetFlags() | UR_TRANSIENT );
ITEM_PICKER picker( copy, UR_NEW );
m_clipboard.PushItem( picker );
}
}
示例2: OnLeftClick
void LIB_EDIT_FRAME::OnLeftClick( wxDC* DC, const wxPoint& aPosition )
{
LIB_ITEM* item = m_drawItem;
if( m_component == NULL ) // No component loaded !
return;
if( item == NULL || item->GetFlags() == 0 )
{
item = LocateItemUsingCursor( aPosition );
if( item )
{
item->DisplayInfo( this );
}
else
{
DisplayCmpDoc();
if( m_canvas->GetAbortRequest() )
m_canvas->SetAbortRequest( false );
}
}
switch( GetToolId() )
{
case ID_NO_TOOL_SELECTED:
if( item && item->GetFlags() ) // moved object
{
switch( item->Type() )
{
case LIB_PIN_T:
PlacePin( DC );
break;
default:
EndDrawGraphicItem( DC );
break;
}
}
break;
case ID_LIBEDIT_PIN_BUTT:
if( m_drawItem == NULL || m_drawItem->GetFlags() == 0 )
{
CreatePin( DC );
}
else
{
PlacePin( DC );
}
break;
case ID_LIBEDIT_BODY_LINE_BUTT:
case ID_LIBEDIT_BODY_ARC_BUTT:
case ID_LIBEDIT_BODY_CIRCLE_BUTT:
case ID_LIBEDIT_BODY_RECT_BUTT:
case ID_LIBEDIT_BODY_TEXT_BUTT:
if( m_drawItem == NULL || m_drawItem->GetFlags() == 0 )
{
m_drawItem = CreateGraphicItem( m_component, DC );
}
else if( m_drawItem )
{
if( m_drawItem->IsNew() )
GraphicItemBeginDraw( DC );
else
EndDrawGraphicItem( DC );
}
break;
case ID_LIBEDIT_DELETE_ITEM_BUTT:
m_drawItem = LocateItemUsingCursor( aPosition );
if( m_drawItem )
deleteItem( DC );
else
DisplayCmpDoc();
break;
case ID_LIBEDIT_ANCHOR_ITEM_BUTT:
SaveCopyInUndoList( m_component );
PlaceAnchor();
SetToolID( ID_NO_TOOL_SELECTED, m_canvas->GetDefaultCursor(), wxEmptyString );
break;
default:
wxFAIL_MSG( wxString::Format( wxT( "Unhandled command ID %d" ), GetToolId() ) );
SetToolID( ID_NO_TOOL_SELECTED, m_canvas->GetDefaultCursor(), wxEmptyString );
break;
}
}