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()
{
// Update the ratsnest with new changes

View File

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

View File

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