本文整理汇总了C++中BOARD_ITEM::IsNew方法的典型用法代码示例。如果您正苦于以下问题:C++ BOARD_ITEM::IsNew方法的具体用法?C++ BOARD_ITEM::IsNew怎么用?C++ BOARD_ITEM::IsNew使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BOARD_ITEM
的用法示例。
在下文中一共展示了BOARD_ITEM::IsNew方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: OnLeftDClick
/*
* Called on a mouse left button double click
*/
void FOOTPRINT_EDIT_FRAME::OnLeftDClick( wxDC* DC, const wxPoint& MousePos )
{
BOARD_ITEM* item = GetCurItem();
switch( GetToolId() )
{
case ID_NO_TOOL_SELECTED:
if( ( item == NULL ) || ( item->GetFlags() == 0 ) )
{
item = ModeditLocateAndDisplay();
}
if( ( item == NULL ) || ( item->GetFlags() != 0 ) )
break;
// Item found
SetCurItem( item );
OnEditItemRequest( DC, item );
break; // end case 0
case ID_PCB_ADD_LINE_BUTT:
{
if( item && item->IsNew() )
{
End_Edge_Module( (EDGE_MODULE*) item );
SetCurItem( NULL );
m_canvas->Refresh();
}
break;
}
default:
break;
}
}
示例2: OnLeftClick
void FOOTPRINT_EDIT_FRAME::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
{
BOARD_ITEM* item = GetCurItem();
m_canvas->CrossHairOff( DC );
if( GetToolId() == ID_NO_TOOL_SELECTED )
{
if( item && item->GetFlags() ) // Move item command in progress
{
switch( item->Type() )
{
case PCB_MODULE_TEXT_T:
PlaceTexteModule( static_cast<TEXTE_MODULE*>( item ), DC );
break;
case PCB_MODULE_EDGE_T:
SaveCopyInUndoList( GetBoard()->m_Modules, UR_MODEDIT );
Place_EdgeMod( static_cast<EDGE_MODULE*>( item ) );
break;
case PCB_PAD_T:
PlacePad( static_cast<D_PAD*>( item ), DC );
break;
default:
{
wxString msg;
msg.Printf( wxT( "WinEDA_ModEditFrame::OnLeftClick err:Struct %d, m_Flag %X" ),
item->Type(), item->GetFlags() );
DisplayError( this, msg );
item->ClearFlags();
break;
}
}
}
else
{
if( !wxGetKeyState( WXK_SHIFT ) && !wxGetKeyState( WXK_ALT )
&& !wxGetKeyState( WXK_CONTROL ) )
item = ModeditLocateAndDisplay();
SetCurItem( item );
}
}
item = GetCurItem();
bool no_item_edited = item == NULL || item->GetFlags() == 0;
switch( GetToolId() )
{
case ID_NO_TOOL_SELECTED:
break;
case ID_MODEDIT_CIRCLE_TOOL:
case ID_MODEDIT_ARC_TOOL:
case ID_MODEDIT_LINE_TOOL:
if( no_item_edited )
{
STROKE_T shape = S_SEGMENT;
if( GetToolId() == ID_MODEDIT_CIRCLE_TOOL )
shape = S_CIRCLE;
if( GetToolId() == ID_MODEDIT_ARC_TOOL )
shape = S_ARC;
SetCurItem( Begin_Edge_Module( (EDGE_MODULE*) NULL, DC, shape ) );
}
else if( item->IsNew() )
{
if( ( (EDGE_MODULE*) item )->GetShape() == S_CIRCLE )
{
End_Edge_Module( (EDGE_MODULE*) item );
SetCurItem( NULL );
m_canvas->Refresh();
}
else if( ( (EDGE_MODULE*) item )->GetShape() == S_ARC )
{
End_Edge_Module( (EDGE_MODULE*) item );
SetCurItem( NULL );
m_canvas->Refresh();
}
else if( ( (EDGE_MODULE*) item )->GetShape() == S_SEGMENT )
{
SetCurItem( Begin_Edge_Module( (EDGE_MODULE*) item, DC, S_SEGMENT ) );
}
else
{
wxMessageBox( wxT( "ProcessCommand error: unknown shape" ) );
}
}
break;
case ID_MODEDIT_DELETE_TOOL:
if( ! no_item_edited ) // Item in edit, cannot delete it
break;
item = ModeditLocateAndDisplay();
//.........这里部分代码省略.........
示例3: OnLeftClick
/* Handle the left button mouse click, when a tool is active
*/
void PCB_EDIT_FRAME::OnLeftClick( wxDC* aDC, const wxPoint& aPosition )
{
BOARD_ITEM* DrawStruct = GetCurItem();
bool exit = false;
bool no_tool = GetToolId() == ID_NO_TOOL_SELECTED;
if( no_tool || ( DrawStruct && DrawStruct->GetFlags() ) )
{
m_canvas->SetAutoPanRequest( false );
if( DrawStruct && DrawStruct->GetFlags() ) // Command in progress
{
m_canvas->SetIgnoreMouseEvents( true );
m_canvas->CrossHairOff( aDC );
switch( DrawStruct->Type() )
{
case PCB_ZONE_AREA_T:
if( DrawStruct->IsNew() )
{
m_canvas->SetAutoPanRequest( true );
Begin_Zone( aDC );
}
else
{
End_Move_Zone_Corner_Or_Outlines( aDC, (ZONE_CONTAINER*) DrawStruct );
}
exit = true;
break;
case PCB_TRACE_T:
case PCB_VIA_T:
if( DrawStruct->IsDragging() )
{
PlaceDraggedOrMovedTrackSegment( (TRACK*) DrawStruct, aDC );
exit = true;
}
break;
case PCB_TEXT_T:
Place_Texte_Pcb( (TEXTE_PCB*) DrawStruct, aDC );
exit = true;
break;
case PCB_MODULE_TEXT_T:
PlaceTexteModule( (TEXTE_MODULE*) DrawStruct, aDC );
exit = true;
break;
case PCB_PAD_T:
PlacePad( (D_PAD*) DrawStruct, aDC );
exit = true;
break;
case PCB_MODULE_T:
PlaceModule( (MODULE*) DrawStruct, aDC );
exit = true;
break;
case PCB_TARGET_T:
PlaceTarget( (PCB_TARGET*) DrawStruct, aDC );
exit = true;
break;
case PCB_LINE_T:
if( no_tool ) // when no tools: existing item moving.
{
Place_DrawItem( (DRAWSEGMENT*) DrawStruct, aDC );
exit = true;
}
break;
case PCB_DIMENSION_T:
if( ! DrawStruct->IsNew() )
{ // We are moving the text of an existing dimension. Place it
PlaceDimensionText( (DIMENSION*) DrawStruct, aDC );
exit = true;
}
break;
default:
DisplayError( this,
wxT( "PCB_EDIT_FRAME::OnLeftClick() err: DrawType %d m_Flags != 0" ),
DrawStruct->Type() );
exit = true;
break;
}
m_canvas->SetIgnoreMouseEvents( false );
m_canvas->CrossHairOn( aDC );
if( exit )
return;
}
else if( !wxGetKeyState( WXK_SHIFT ) && !wxGetKeyState( WXK_ALT )
//.........这里部分代码省略.........
示例4: OnLeftDClick
/*
* Called on a mouse left button double click
*/
void FOOTPRINT_EDIT_FRAME::OnLeftDClick( wxDC* DC, const wxPoint& MousePos )
{
BOARD_ITEM* item = GetCurItem();
switch( GetToolId() )
{
case ID_NO_TOOL_SELECTED:
if( ( item == NULL ) || ( item->GetFlags() == 0 ) )
{
item = ModeditLocateAndDisplay();
}
if( ( item == NULL ) || ( item->GetFlags() != 0 ) )
break;
// Item found
SetCurItem( item );
switch( item->Type() )
{
case PCB_PAD_T:
InstallPadOptionsFrame( (D_PAD*) item );
m_canvas->MoveCursorToCrossHair();
break;
case PCB_MODULE_T:
{
DIALOG_MODULE_MODULE_EDITOR dialog( this, (MODULE*) item );
int ret = dialog.ShowModal();
GetScreen()->GetCurItem()->ClearFlags();
m_canvas->MoveCursorToCrossHair();
if( ret > 0 )
m_canvas->Refresh();
}
break;
case PCB_MODULE_TEXT_T:
InstallTextModOptionsFrame( (TEXTE_MODULE*) item, DC );
m_canvas->MoveCursorToCrossHair();
break;
case PCB_MODULE_EDGE_T :
m_canvas->MoveCursorToCrossHair();
InstallFootprintBodyItemPropertiesDlg( (EDGE_MODULE*) item );
m_canvas->Refresh();
break;
default:
break;
}
break; // end case 0
case ID_PCB_ADD_LINE_BUTT:
{
if( item && item->IsNew() )
{
End_Edge_Module( (EDGE_MODULE*) item );
SetCurItem( NULL );
m_canvas->Refresh();
}
break;
}
default:
break;
}
}
示例5: OnLeftDClick
/* handle the double click on the mouse left button
*/
void PCB_EDIT_FRAME::OnLeftDClick( wxDC* aDC, const wxPoint& aPosition )
{
BOARD_ITEM* DrawStruct = GetCurItem();
switch( GetToolId() )
{
case ID_NO_TOOL_SELECTED:
if( (DrawStruct == NULL) || (DrawStruct->GetFlags() == 0) )
{
DrawStruct = PcbGeneralLocateAndDisplay();
}
if( (DrawStruct == NULL) || (DrawStruct->GetFlags() != 0) )
break;
SendMessageToEESCHEMA( DrawStruct );
// An item is found
SetCurItem( DrawStruct );
switch( DrawStruct->Type() )
{
case PCB_TRACE_T:
case PCB_VIA_T:
if( DrawStruct->IsNew() )
{
if( End_Route( (TRACK*) DrawStruct, aDC ) )
m_canvas->SetAutoPanRequest( false );
}
else if( DrawStruct->GetFlags() == 0 )
{
Edit_TrackSegm_Width( aDC, (TRACK*) DrawStruct );
}
break;
case PCB_TEXT_T:
case PCB_PAD_T:
case PCB_MODULE_T:
case PCB_TARGET_T:
case PCB_DIMENSION_T:
case PCB_MODULE_TEXT_T:
OnEditItemRequest( aDC, DrawStruct );
m_canvas->MoveCursorToCrossHair();
break;
case PCB_LINE_T:
OnEditItemRequest( aDC, DrawStruct );
break;
case PCB_ZONE_AREA_T:
if( DrawStruct->GetFlags() )
break;
OnEditItemRequest( aDC, DrawStruct );
break;
default:
break;
}
break; // end case 0
case ID_TRACK_BUTT:
if( DrawStruct && DrawStruct->IsNew() )
{
if( End_Route( (TRACK*) DrawStruct, aDC ) )
m_canvas->SetAutoPanRequest( false );
}
break;
case ID_PCB_ZONES_BUTT:
case ID_PCB_KEEPOUT_AREA_BUTT:
if( End_Zone( aDC ) )
{
m_canvas->SetAutoPanRequest( false );
SetCurItem( NULL );
}
break;
case ID_PCB_ADD_LINE_BUTT:
case ID_PCB_ARC_BUTT:
case ID_PCB_CIRCLE_BUTT:
if( DrawStruct == NULL )
break;
if( DrawStruct->Type() != PCB_LINE_T )
{
DisplayError( this, wxT( "DrawStruct Type error" ) );
m_canvas->SetAutoPanRequest( false );
break;
}
if( DrawStruct->IsNew() )
{
End_Edge( (DRAWSEGMENT*) DrawStruct, aDC );
//.........这里部分代码省略.........