本文整理汇总了C++中BOARD_ITEM::IsTrack方法的典型用法代码示例。如果您正苦于以下问题:C++ BOARD_ITEM::IsTrack方法的具体用法?C++ BOARD_ITEM::IsTrack怎么用?C++ BOARD_ITEM::IsTrack使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BOARD_ITEM
的用法示例。
在下文中一共展示了BOARD_ITEM::IsTrack方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: OnHotKey
//.........这里部分代码省略.........
case HK_RESET_GRID_ORIGIN:
PCBNEW_CONTROL::SetGridOrigin( GetGalCanvas()->GetView(), this,
new KIGFX::ORIGIN_VIEWITEM( GetGridOrigin(), UR_TRANSIENT ),
wxPoint( 0, 0 ) );
m_canvas->Refresh();
break;
case HK_SWITCH_UNITS:
evt_type = (GetUserUnits() == INCHES) ?
ID_TB_OPTIONS_SELECT_UNIT_MM : ID_TB_OPTIONS_SELECT_UNIT_INCH;
break;
case HK_SWITCH_TRACK_DISPLAY_MODE:
displ_opts->m_DisplayPcbTrackFill = !displ_opts->m_DisplayPcbTrackFill;
m_canvas->Refresh();
break;
case HK_DELETE:
OnHotkeyDeleteItem( aDC );
break;
case HK_BACK_SPACE:
if( IsCopperLayer( GetActiveLayer() ) )
{
if( !itemCurrentlyEdited )
{
// no track is currently being edited - select a segment and remove it.
// @todo: possibly? pass the HK command code to PcbGeneralLocateAndDisplay()
// so it can restrict its search to specific item types.
BOARD_ITEM * item = PcbGeneralLocateAndDisplay();
// don't let backspace delete modules!!
if( item && item->IsTrack() )
{
Delete_Segment( aDC, (TRACK*) item );
SetCurItem( NULL );
}
OnModify();
}
else if( GetCurItem()->IsTrack() )
{
// then an element is being edited - remove the last segment.
// simple lines for debugger:
TRACK* track = (TRACK*) GetCurItem();
track = Delete_Segment( aDC, track );
SetCurItem( track );
OnModify();
}
}
break;
case HK_GET_AND_MOVE_FOOTPRINT:
if( !itemCurrentlyEdited )
evt_type = ID_POPUP_PCB_GET_AND_MOVE_MODULE_REQUEST;
break;
case HK_FIND_ITEM:
if( !itemCurrentlyEdited )
evt_type = ID_FIND_ITEMS;
break;
示例2: OnHotkeyDeleteItem
bool PCB_EDIT_FRAME::OnHotkeyDeleteItem( wxDC* aDC )
{
BOARD_ITEM* item = GetCurItem();
bool ItemFree = (item == NULL) || (item->GetFlags() == 0);
switch( GetToolId() )
{
case ID_TRACK_BUTT:
if( !IsCopperLayer ( GetActiveLayer() ) )
return false;
if( ItemFree )
{
item = PcbGeneralLocateAndDisplay();
if( item && !item->IsTrack() )
return false;
Delete_Track( aDC, (TRACK*) item );
}
else if( item->IsTrack( ) )
{
// simple lines for debugger:
TRACK* track = (TRACK*) item;
track = Delete_Segment( aDC, track );
SetCurItem( track );
OnModify();
return true;
}
break;
case ID_PCB_MODULE_BUTT:
if( ItemFree )
{
wxPoint pos = RefPos( false );
MODULE* module = GetBoard()->GetFootprint( pos, UNDEFINED_LAYER, false );
if( module == NULL || module->IsLocked() )
return false;
RemoveStruct( module, aDC );
}
else
return false;
break;
default:
if( ItemFree )
{
item = PcbGeneralLocateAndDisplay();
// Shouldn't there be a check for locked tracks and vias here?
if( item == NULL || (item->Type() == PCB_MODULE_T && (MODULE*)item->IsLocked()) )
return false;
RemoveStruct( item, aDC );
}
else
return false;
}
OnModify();
SetCurItem( NULL );
return true;
}