Commit 0d9373ca authored by Maciej Suminski's avatar Maciej Suminski

Undo/report support for track dragging (PNS).

parent d7ac3682
...@@ -373,13 +373,9 @@ void PNS_ROUTER::ClearWorld() ...@@ -373,13 +373,9 @@ void PNS_ROUTER::ClearWorld()
if( m_placer ) if( m_placer )
delete m_placer; delete m_placer;
if( m_previewItems )
delete m_previewItems;
m_clearanceFunc = NULL; m_clearanceFunc = NULL;
m_world = NULL; m_world = NULL;
m_placer = NULL; m_placer = NULL;
m_previewItems = NULL;
} }
......
...@@ -621,8 +621,6 @@ void ROUTER_TOOL::performRouting() ...@@ -621,8 +621,6 @@ void ROUTER_TOOL::performRouting()
m_needsSync = true; m_needsSync = true;
} }
m_settings = m_router->Settings();
ctls->SetAutoPan( false ); ctls->SetAutoPan( false );
ctls->ForceCursorPosition( false ); ctls->ForceCursorPosition( false );
highlightNet( false ); highlightNet( false );
...@@ -683,6 +681,8 @@ int ROUTER_TOOL::Main( TOOL_EVENT& aEvent ) ...@@ -683,6 +681,8 @@ int ROUTER_TOOL::Main( TOOL_EVENT& aEvent )
ctls->ShowCursor( false ); ctls->ShowCursor( false );
getEditFrame<PCB_EDIT_FRAME>()->SetToolID( ID_NO_TOOL_SELECTED, wxCURSOR_DEFAULT, wxEmptyString ); getEditFrame<PCB_EDIT_FRAME>()->SetToolID( ID_NO_TOOL_SELECTED, wxCURSOR_DEFAULT, wxEmptyString );
// Store routing settings till the next invocation
m_settings = m_router->Settings();
delete ctxMenu; delete ctxMenu;
return 0; return 0;
...@@ -691,6 +691,8 @@ int ROUTER_TOOL::Main( TOOL_EVENT& aEvent ) ...@@ -691,6 +691,8 @@ int ROUTER_TOOL::Main( TOOL_EVENT& aEvent )
void ROUTER_TOOL::performDragging() void ROUTER_TOOL::performDragging()
{ {
PCB_EDIT_FRAME* frame = getEditFrame<PCB_EDIT_FRAME>();
bool saveUndoBuffer = true;
VIEW_CONTROLS* ctls = getViewControls(); VIEW_CONTROLS* ctls = getViewControls();
bool dragStarted = m_router->StartDragging( m_startSnapPoint, m_startItem ); bool dragStarted = m_router->StartDragging( m_startSnapPoint, m_startItem );
...@@ -708,6 +710,11 @@ void ROUTER_TOOL::performDragging() ...@@ -708,6 +710,11 @@ void ROUTER_TOOL::performDragging()
{ {
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 );
...@@ -726,6 +733,19 @@ void ROUTER_TOOL::performDragging() ...@@ -726,6 +733,19 @@ void ROUTER_TOOL::performDragging()
if( m_router->RoutingInProgress() ) if( m_router->RoutingInProgress() )
m_router->StopRouting(); m_router->StopRouting();
if( saveUndoBuffer )
{
// Save the recent changes in the undo buffer
frame->SaveCopyInUndoList( m_router->GetUndoBuffer(), UR_UNSPECIFIED );
m_router->ClearUndoBuffer();
frame->OnModify();
}
else
{
// It was interrupted by TA_UNDO_REDO event, so we have to sync the world now
m_needsSync = true;
}
ctls->SetAutoPan( false ); ctls->SetAutoPan( false );
ctls->ForceCursorPosition( false ); ctls->ForceCursorPosition( false );
highlightNet( false ); highlightNet( 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