PNS: Actually implement the AbortRouting API

Fixes https://gitlab.com/kicad/code/kicad/-/issues/9425
This commit is contained in:
Jon Evans 2021-10-31 16:06:57 -04:00
parent 22ba640c2b
commit 153594b9ea
3 changed files with 23 additions and 3 deletions

View File

@ -705,6 +705,15 @@ void ROUTER::CommitRouting()
} }
void ROUTER::AbortRouting()
{
if( m_state == ROUTE_TRACK )
m_placer->AbortPlacement();
StopRouting();
}
void ROUTER::StopRouting() void ROUTER::StopRouting()
{ {
// Update the ratsnest with new changes // Update the ratsnest with new changes

View File

@ -148,6 +148,7 @@ public:
void UndoLastSegment(); void UndoLastSegment();
void CommitRouting(); void CommitRouting();
void StopRouting(); void StopRouting();
void AbortRouting();
void ClearViewDecorations(); void ClearViewDecorations();
NODE* GetWorld() const { return m_world.get(); } NODE* GetWorld() const { return m_world.get(); }

View File

@ -1144,6 +1144,8 @@ void ROUTER_TOOL::performRouting()
// Set initial cursor // Set initial cursor
setCursor(); setCursor();
bool abortRouting = false;
while( TOOL_EVENT* evt = Wait() ) while( TOOL_EVENT* evt = Wait() )
{ {
setCursor(); setCursor();
@ -1234,8 +1236,13 @@ void ROUTER_TOOL::performRouting()
|| evt->IsUndoRedo() || evt->IsUndoRedo()
|| evt->IsAction( &PCB_ACTIONS::routerInlineDrag ) ) || evt->IsAction( &PCB_ACTIONS::routerInlineDrag ) )
{ {
if( evt->IsCancelInteractive() && !m_router->RoutingInProgress() ) if( evt->IsCancelInteractive() )
m_cancelled = true; {
if( m_router->RoutingInProgress() )
abortRouting = true;
else
m_cancelled = true;
}
if( evt->IsActivate() && !evt->IsMoveTool() ) if( evt->IsActivate() && !evt->IsMoveTool() )
m_cancelled = true; m_cancelled = true;
@ -1252,7 +1259,10 @@ void ROUTER_TOOL::performRouting()
} }
} }
m_router->CommitRouting(); if( abortRouting )
m_router->AbortRouting();
else
m_router->CommitRouting();
finishInteractive(); finishInteractive();
} }