本文整理汇总了C++中EDA_ITEM::GetFlags方法的典型用法代码示例。如果您正苦于以下问题:C++ EDA_ITEM::GetFlags方法的具体用法?C++ EDA_ITEM::GetFlags怎么用?C++ EDA_ITEM::GetFlags使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类EDA_ITEM
的用法示例。
在下文中一共展示了EDA_ITEM::GetFlags方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetConnection
int SCH_SCREEN::GetConnection( const wxPoint& aPosition, PICKED_ITEMS_LIST& aList,
bool aFullConnection )
{
SCH_ITEM* item;
EDA_ITEM* tmp;
EDA_ITEMS list;
// Clear flags member for all items.
ClearDrawingState();
BreakSegmentsOnJunctions();
if( GetNode( aPosition, list ) == 0 )
return 0;
for( size_t i = 0; i < list.size(); i++ )
{
item = (SCH_ITEM*) list[ i ];
item->SetFlags( SELECTEDNODE | STRUCT_DELETED );
/* Put this structure in the picked list: */
ITEM_PICKER picker( item, UR_DELETED );
aList.PushItem( picker );
}
// Mark all wires, junctions, .. connected to the item(s) found.
if( aFullConnection )
{
SCH_LINE* segment;
for( item = m_drawList.begin(); item; item = item->Next() )
{
if( !(item->GetFlags() & SELECTEDNODE) )
continue;
if( item->Type() != SCH_LINE_T )
continue;
MarkConnections( (SCH_LINE*) item );
}
// Search all attached wires (i.e wire with one new dangling end )
for( item = m_drawList.begin(); item; item = item->Next() )
{
bool noconnect = false;
if( item->GetFlags() & STRUCT_DELETED )
continue; // Already seen
if( !(item->GetFlags() & CANDIDATE) )
continue; // not a candidate
if( item->Type() != SCH_LINE_T )
continue;
item->SetFlags( SKIP_STRUCT );
segment = (SCH_LINE*) item;
/* If the wire start point is connected to a wire that was already found
* and now is not connected, add the wire to the list. */
for( tmp = m_drawList.begin(); tmp; tmp = tmp->Next() )
{
// Ensure tmp is a previously deleted segment:
if( ( tmp->GetFlags() & STRUCT_DELETED ) == 0 )
continue;
if( tmp->Type() != SCH_LINE_T )
continue;
SCH_LINE* testSegment = (SCH_LINE*) tmp;
// Test for segment connected to the previously deleted segment:
if( testSegment->IsEndPoint( segment->GetStartPoint() ) )
break;
}
// when tmp != NULL, segment is a new candidate:
// put it in deleted list if
// the start point is not connected to an other item (like pin)
if( tmp && !CountConnectedItems( segment->GetStartPoint(), true ) )
noconnect = true;
/* If the wire end point is connected to a wire that has already been found
* and now is not connected, add the wire to the list. */
for( tmp = m_drawList.begin(); tmp; tmp = tmp->Next() )
{
// Ensure tmp is a previously deleted segment:
if( ( tmp->GetFlags() & STRUCT_DELETED ) == 0 )
continue;
if( tmp->Type() != SCH_LINE_T )
continue;
SCH_LINE* testSegment = (SCH_LINE*) tmp;
// Test for segment connected to the previously deleted segment:
if( testSegment->IsEndPoint( segment->GetEndPoint() ) )
break;
}
//.........这里部分代码省略.........
示例2: OnLeftDClick
/**
* Function OnLeftDClick
* called on a double click event from the drawpanel mouse handler
* if an editable item is found (text, component)
* Call the suitable dialog editor.
* Id a create command is in progress:
* validate and finish the command
*/
void SCH_EDIT_FRAME::OnLeftDClick( wxDC* aDC, const wxPoint& aPosition )
{
EDA_ITEM* item = GetScreen()->GetCurItem();
switch( GetToolId() )
{
case ID_NO_TOOL_SELECTED:
if( ( item == NULL ) || ( item->GetFlags() == 0 ) )
{
item = LocateAndShowItem( aPosition );
}
if( ( item == NULL ) || ( item->GetFlags() != 0 ) )
break;
switch( item->Type() )
{
case SCH_SHEET_T:
m_CurrentSheet->push_back( (SCH_SHEET*) item );
DisplayCurrentSheet();
break;
case SCH_COMPONENT_T:
EditComponent( (SCH_COMPONENT*) item );
GetCanvas()->MoveCursorToCrossHair();
if( item->GetFlags() == 0 )
GetScreen()->SetCurItem( NULL );
GetCanvas()->Refresh();
break;
case SCH_TEXT_T:
case SCH_LABEL_T:
case SCH_GLOBAL_LABEL_T:
case SCH_HIERARCHICAL_LABEL_T:
EditSchematicText( (SCH_TEXT*) item );
break;
case SCH_BITMAP_T:
EditImage( (SCH_BITMAP*) item );
break;
case SCH_FIELD_T:
EditComponentFieldText( (SCH_FIELD*) item );
GetCanvas()->MoveCursorToCrossHair();
break;
case SCH_MARKER_T:
( (SCH_MARKER*) item )->DisplayMarkerInfo( this );
break;
default:
break;
}
break;
case ID_BUS_BUTT:
case ID_WIRE_BUTT:
case ID_LINE_COMMENT_BUTT:
if( item && item->IsNew() )
EndSegment( aDC );
break;
}
}
示例3: OnMouseEvent
void EDA_DRAW_PANEL::OnMouseEvent( wxMouseEvent& event )
{
int localbutt = 0;
BASE_SCREEN* screen = GetScreen();
if( !screen )
return;
/* Adjust value to filter mouse displacement before consider the drag
* mouse is really a drag command, not just a movement while click
*/
#define MIN_DRAG_COUNT_FOR_START_BLOCK_COMMAND 5
if( event.Leaving() )
m_canStartBlock = -1;
if( !IsMouseCaptured() ) // No mouse capture in progress.
SetAutoPanRequest( false );
if( GetParent()->IsActive() )
SetFocus();
else
return;
if( !event.IsButton() && !event.Moving() && !event.Dragging() )
return;
if( event.RightDown() )
{
OnRightClick( event );
return;
}
if( m_ignoreMouseEvents )
return;
if( event.LeftDown() )
localbutt = GR_M_LEFT_DOWN;
if( event.ButtonDClick( 1 ) )
localbutt = GR_M_LEFT_DOWN | GR_M_DCLICK;
if( event.MiddleDown() )
localbutt = GR_M_MIDDLE_DOWN;
INSTALL_UNBUFFERED_DC( DC, this );
DC.SetBackground( *wxBLACK_BRUSH );
// Compute the cursor position in drawing (logical) units.
GetParent()->SetMousePosition( event.GetLogicalPosition( DC ) );
int kbstat = 0;
if( event.ShiftDown() )
kbstat |= GR_KB_SHIFT;
if( event.ControlDown() )
kbstat |= GR_KB_CTRL;
if( event.AltDown() )
kbstat |= GR_KB_ALT;
// Calling Double Click and Click functions :
if( localbutt == (int) ( GR_M_LEFT_DOWN | GR_M_DCLICK ) )
{
if( m_ClickTimer )
{
m_ClickTimer->Stop();
wxDELETE( m_ClickTimer );
}
GetParent()->OnLeftDClick( &DC, GetParent()->RefPos( true ) );
// inhibit a response to the mouse left button release,
// because we have a double click, and we do not want a new
// OnLeftClick command at end of this Double Click
m_ignoreNextLeftButtonRelease = true;
}
else if( event.LeftUp() )
{
// A block command is in progress: a left up is the end of block
// or this is the end of a double click, already seen
// Note also m_ignoreNextLeftButtonRelease can be set by
// the call to OnLeftClick(), so do not change it after calling OnLeftClick
bool ignoreEvt = m_ignoreNextLeftButtonRelease;
m_ignoreNextLeftButtonRelease = false;
if( screen->m_BlockLocate.GetState() == STATE_NO_BLOCK && !ignoreEvt )
{
EDA_ITEM* item = screen->GetCurItem();
m_CursorClickPos = GetParent()->RefPos( true );
// If we have an item already selected, or we are using a tool,
// we won't use the disambiguation menu so process the click immediately
if( ( item && item->GetFlags() ) || GetParent()->GetToolId() != ID_NO_TOOL_SELECTED )
GetParent()->OnLeftClick( &DC, m_CursorClickPos );
else
{
wxDELETE( m_ClickTimer );
m_ClickTimer = new wxTimer(this, ID_MOUSE_DOUBLECLICK);
m_ClickTimer->StartOnce( m_doubleClickInterval );
//.........这里部分代码省略.........