Commit 5fea60d2 authored by Maciej Suminski's avatar Maciej Suminski

Fixed undo/redo while routing with the PNS error.

parent 510fee13
...@@ -290,6 +290,7 @@ void ROUTER_TOOL::updateEndItem( TOOL_EVENT& aEvent ) ...@@ -290,6 +290,7 @@ void ROUTER_TOOL::updateEndItem( TOOL_EVENT& aEvent )
void ROUTER_TOOL::startRouting() void ROUTER_TOOL::startRouting()
{ {
bool saveUndoBuffer = true;
VIEW_CONTROLS* ctls = getViewControls(); VIEW_CONTROLS* ctls = getViewControls();
int width = getDefaultWidth( m_startItem ? m_startItem->GetNet() : -1 ); int width = getDefaultWidth( m_startItem ? m_startItem->GetNet() : -1 );
...@@ -317,16 +318,16 @@ void ROUTER_TOOL::startRouting() ...@@ -317,16 +318,16 @@ void ROUTER_TOOL::startRouting()
{ {
if( evt->IsCancel() ) if( evt->IsCancel() )
break; break;
else if( evt->Action() == TA_UNDO_REDO )
{
saveUndoBuffer = false;
break;
}
else if( evt->IsMotion() ) else if( evt->IsMotion() )
{ {
updateEndItem( *evt ); updateEndItem( *evt );
m_router->Move( m_endSnapPoint, m_endItem ); m_router->Move( m_endSnapPoint, m_endItem );
} }
else if( evt->Action() == TA_UNDO_REDO )
{
std::cout << "syncing the world while routing, I am going to craaaaaaaaaaaash!" << std::endl;
m_router->SyncWorld();
}
else if( evt->IsClick( BUT_LEFT ) ) else if( evt->IsClick( BUT_LEFT ) )
{ {
updateEndItem( *evt ); updateEndItem( *evt );
...@@ -376,9 +377,17 @@ void ROUTER_TOOL::startRouting() ...@@ -376,9 +377,17 @@ void ROUTER_TOOL::startRouting()
m_router->StopRouting(); m_router->StopRouting();
// Save the recent changes in the undo buffer if( saveUndoBuffer )
getEditFrame<PCB_EDIT_FRAME>()->SaveCopyInUndoList( m_router->GetLastChanges(), UR_UNSPECIFIED ); {
getEditFrame<PCB_EDIT_FRAME>()->OnModify(); // Save the recent changes in the undo buffer
getEditFrame<PCB_EDIT_FRAME>()->SaveCopyInUndoList( m_router->GetLastChanges(), UR_UNSPECIFIED );
getEditFrame<PCB_EDIT_FRAME>()->OnModify();
}
else
{
// It was interrupted by TA_UNDO_REDO event, so we have to sync the world now
m_router->SyncWorld();
}
ctls->SetAutoPan( false ); ctls->SetAutoPan( false );
ctls->ForceCursorPosition( false ); ctls->ForceCursorPosition( false );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment