A better solution to discarding pending shove operations
Fixes https://gitlab.com/kicad/code/kicad/-/issues/9553
This commit is contained in:
parent
0234ae3003
commit
59807d8d26
|
@ -1468,6 +1468,13 @@ bool LINE_PLACER::HasPlacedAnything() const
|
|||
|
||||
bool LINE_PLACER::CommitPlacement()
|
||||
{
|
||||
if( Settings().Mode() == PNS::RM_Shove || Settings().Mode() == PNS::RM_Smart )
|
||||
{
|
||||
m_shove->RewindToLastLockedNode();
|
||||
m_lastNode = m_shove->CurrentNode();
|
||||
m_lastNode->KillChildren();
|
||||
}
|
||||
|
||||
if( m_lastNode )
|
||||
Router()->CommitRouting( m_lastNode );
|
||||
|
||||
|
|
|
@ -705,15 +705,6 @@ void ROUTER::CommitRouting()
|
|||
}
|
||||
|
||||
|
||||
void ROUTER::AbortRouting()
|
||||
{
|
||||
if( m_state == ROUTE_TRACK )
|
||||
m_placer->AbortPlacement();
|
||||
|
||||
StopRouting();
|
||||
}
|
||||
|
||||
|
||||
void ROUTER::StopRouting()
|
||||
{
|
||||
// Update the ratsnest with new changes
|
||||
|
|
|
@ -148,7 +148,6 @@ public:
|
|||
void UndoLastSegment();
|
||||
void CommitRouting();
|
||||
void StopRouting();
|
||||
void AbortRouting();
|
||||
void ClearViewDecorations();
|
||||
|
||||
NODE* GetWorld() const { return m_world.get(); }
|
||||
|
|
|
@ -1838,6 +1838,18 @@ bool SHOVE::RewindSpringbackTo( NODE* aNode )
|
|||
}
|
||||
|
||||
|
||||
bool SHOVE::RewindToLastLockedNode()
|
||||
{
|
||||
if( m_nodeStack.empty() )
|
||||
return false;
|
||||
|
||||
while( !m_nodeStack.back().m_locked && m_nodeStack.size() > 1 )
|
||||
m_nodeStack.pop_back();
|
||||
|
||||
return m_nodeStack.back().m_locked;
|
||||
}
|
||||
|
||||
|
||||
void SHOVE::UnlockSpringbackNode( NODE* aNode )
|
||||
{
|
||||
auto iter = m_nodeStack.begin();
|
||||
|
|
|
@ -88,6 +88,7 @@ public:
|
|||
bool AddLockedSpringbackNode( NODE* aNode );
|
||||
void UnlockSpringbackNode( NODE* aNode );
|
||||
bool RewindSpringbackTo( NODE* aNode );
|
||||
bool RewindToLastLockedNode();
|
||||
|
||||
private:
|
||||
typedef std::vector<SHAPE_LINE_CHAIN> HULL_SET;
|
||||
|
|
|
@ -1144,8 +1144,6 @@ void ROUTER_TOOL::performRouting()
|
|||
// Set initial cursor
|
||||
setCursor();
|
||||
|
||||
bool abortRouting = false;
|
||||
|
||||
while( TOOL_EVENT* evt = Wait() )
|
||||
{
|
||||
setCursor();
|
||||
|
@ -1236,13 +1234,8 @@ void ROUTER_TOOL::performRouting()
|
|||
|| evt->IsUndoRedo()
|
||||
|| evt->IsAction( &PCB_ACTIONS::routerInlineDrag ) )
|
||||
{
|
||||
if( evt->IsCancelInteractive() )
|
||||
{
|
||||
if( m_router->RoutingInProgress() )
|
||||
abortRouting = true;
|
||||
else
|
||||
if( evt->IsCancelInteractive() && !m_router->RoutingInProgress() )
|
||||
m_cancelled = true;
|
||||
}
|
||||
|
||||
if( evt->IsActivate() && !evt->IsMoveTool() )
|
||||
m_cancelled = true;
|
||||
|
@ -1259,9 +1252,6 @@ void ROUTER_TOOL::performRouting()
|
|||
}
|
||||
}
|
||||
|
||||
if( abortRouting )
|
||||
m_router->AbortRouting();
|
||||
else
|
||||
m_router->CommitRouting();
|
||||
|
||||
finishInteractive();
|
||||
|
|
Loading…
Reference in New Issue