本文整理汇总了C++中PCB_EDIT_FRAME::UndoRedoBlock方法的典型用法代码示例。如果您正苦于以下问题:C++ PCB_EDIT_FRAME::UndoRedoBlock方法的具体用法?C++ PCB_EDIT_FRAME::UndoRedoBlock怎么用?C++ PCB_EDIT_FRAME::UndoRedoBlock使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PCB_EDIT_FRAME
的用法示例。
在下文中一共展示了PCB_EDIT_FRAME::UndoRedoBlock方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: InlineDrag
int ROUTER_TOOL::InlineDrag( const TOOL_EVENT& aEvent )
{
const BOARD_CONNECTED_ITEM* item = aEvent.Parameter<const BOARD_CONNECTED_ITEM*>();
PCB_EDIT_FRAME* frame = getEditFrame<PCB_EDIT_FRAME>();
VIEW_CONTROLS* ctls = getViewControls();
m_toolMgr->RunAction( COMMON_ACTIONS::selectionClear, true );
Activate();
m_router->SyncWorld();
m_startItem = m_router->GetWorld()->FindItemByParent( item );
if( m_startItem && m_startItem->IsLocked() )
{
if( !IsOK( m_frame, _( "The item is locked. Do you want to continue?" ) ) )
return false;
}
VECTOR2I p0 = ctls->GetCursorPosition();
bool dragStarted = m_router->StartDragging( p0, m_startItem );
if( !dragStarted )
return 0;
ctls->ForceCursorPosition( false );
ctls->SetAutoPan( true );
frame->UndoRedoBlock( true );
while( OPT_TOOL_EVENT evt = Wait() )
{
if( evt->IsCancel() )
{
break;
}
else if( evt->IsMotion() || evt->IsDrag( BUT_LEFT ) )
{
updateEndItem( *evt );
m_router->Move( m_endSnapPoint, m_endItem );
}
else if( evt->IsMouseUp( BUT_LEFT ) || evt->IsClick( BUT_LEFT ) )
{
updateEndItem( *evt );
m_router->FixRoute( m_endSnapPoint, m_endItem );
break;
}
}
if( m_router->RoutingInProgress() )
m_router->StopRouting();
ctls->SetAutoPan( false );
ctls->ShowCursor( false );
frame->UndoRedoBlock( false );
return 0;
}
示例2: InlineDrag
int ROUTER_TOOL::InlineDrag( const TOOL_EVENT& aEvent )
{
const BOARD_CONNECTED_ITEM *item = aEvent.Parameter<const BOARD_CONNECTED_ITEM*>();
PCB_EDIT_FRAME* frame = getEditFrame<PCB_EDIT_FRAME>();
VIEW_CONTROLS* ctls = getViewControls();
m_toolMgr->RunAction( COMMON_ACTIONS::selectionClear, true );
Activate();
m_router->SyncWorld();
m_router->SetView( getView() );
m_startItem = m_router->GetWorld()->FindItemByParent( item );
VECTOR2I p0 = ctls->GetCursorPosition();
bool dragStarted = m_router->StartDragging( p0, m_startItem );
if( !dragStarted )
return 0;
ctls->ForceCursorPosition( false );
ctls->SetAutoPan( true );
frame->UndoRedoBlock( true );
bool saveUndoBuffer = true;
while( OPT_TOOL_EVENT evt = Wait() )
{
p0 = ctls->GetCursorPosition();
if( evt->IsCancel() )
{
saveUndoBuffer = false;
break;
}
else if( evt->IsMotion() || evt->IsDrag( BUT_LEFT ) )
{
m_router->Move( p0, NULL );
}
else if( evt->IsMouseUp( BUT_LEFT ) || evt->IsClick( BUT_LEFT ) )
{
saveUndoBuffer = m_router->FixRoute( p0, NULL );
break;
}
}
if( m_router->RoutingInProgress() )
m_router->StopRouting();
if( saveUndoBuffer )
{
frame->SaveCopyInUndoList( m_router->GetUndoBuffer(), UR_UNSPECIFIED );
m_router->ClearUndoBuffer();
frame->OnModify();
}
ctls->SetAutoPan( false );
ctls->ShowCursor( false );
frame->UndoRedoBlock( false );
return 0;
}
示例3: mainLoop
int ROUTER_TOOL::mainLoop( PNS_ROUTER_MODE aMode )
{
PCB_EDIT_FRAME* frame = getEditFrame<PCB_EDIT_FRAME>();
BOARD* board = getModel<BOARD>();
// Deselect all items
m_toolMgr->RunAction( COMMON_ACTIONS::selectionClear, true );
Activate();
m_router->SetMode( aMode );
m_ctls->SetSnapping( true );
m_ctls->ShowCursor( true );
frame->UndoRedoBlock( true );
m_startSnapPoint = getViewControls()->GetCursorPosition();
std::auto_ptr<ROUTER_TOOL_MENU> ctxMenu( new ROUTER_TOOL_MENU( board, aMode ) );
SetContextMenu( ctxMenu.get() );
// Main loop: keep receiving events
while( OPT_TOOL_EVENT evt = Wait() )
{
if( m_needsSync )
{
m_router->SyncWorld();
m_router->SetView( getView() );
m_needsSync = false;
}
if( evt->IsCancel() || evt->IsActivate() )
break; // Finish
else if( evt->IsMotion() )
updateStartItem( *evt );
else if( evt->IsClick( BUT_LEFT ) || evt->IsAction( &ACT_NewTrack ) )
{
updateStartItem( *evt );
if( evt->Modifier( MD_CTRL ) )
performDragging();
else
performRouting();
}
else if( evt->IsAction( &ACT_Drag ) )
{
updateStartItem( *evt );
performDragging();
}
handleCommonEvents( *evt );
}
frame->SetToolID( ID_NO_TOOL_SELECTED, wxCURSOR_DEFAULT, wxEmptyString );
frame->UndoRedoBlock( false );
// Store routing settings till the next invocation
m_savedSettings = m_router->Settings();
m_savedSizes = m_router->Sizes();
return 0;
}