Debug code to try and catch Undo/SyncWorld mismatch.

Fixes https://gitlab.com/kicad/code/kicad/issues/12640
This commit is contained in:
Jeff Young 2022-10-14 13:24:43 +01:00
parent 07d9671126
commit 6357c83a8c
1 changed files with 50 additions and 2 deletions

View File

@ -1363,7 +1363,6 @@ void ROUTER_TOOL::performRouting()
break;
}
else if( evt->IsCancelInteractive() || evt->IsActivate()
|| evt->IsUndoRedo()
|| evt->IsAction( &PCB_ACTIONS::routerInlineDrag ) )
{
if( evt->IsCancelInteractive() && !m_router->RoutingInProgress() )
@ -1374,6 +1373,12 @@ void ROUTER_TOOL::performRouting()
break;
}
else if( evt->IsUndoRedo() )
{
// We're in an UndoRedoBlock. If we get here, something's broken.
wxFAIL;
break;
}
else if( evt->IsClick( BUT_RIGHT ) )
{
m_menu.ShowContextMenu( selection() );
@ -1807,7 +1812,7 @@ void ROUTER_TOOL::performDragging( int aMode )
{
m_menu.ShowContextMenu( selection() );
}
else if( evt->IsCancelInteractive() || evt->IsActivate() || evt->IsUndoRedo() )
else if( evt->IsCancelInteractive() || evt->IsActivate() )
{
if( evt->IsCancelInteractive() && !m_startItem )
m_cancelled = true;
@ -1817,6 +1822,35 @@ void ROUTER_TOOL::performDragging( int aMode )
break;
}
else if( evt->IsUndoRedo() )
{
// We're in an UndoRedoBlock. If we get here, something's broken.
wxFAIL;
break;
}
else if( evt->Category() == TC_COMMAND )
{
// disallow editing commands
if( evt->IsAction( &ACTIONS::cut )
|| evt->IsAction( &ACTIONS::copy )
|| evt->IsAction( &ACTIONS::paste )
|| evt->IsAction( &ACTIONS::pasteSpecial ) )
{
wxBell();
}
// treat an undo as an escape
else if( evt->IsAction( &ACTIONS::undo ) )
{
if( m_startItem )
break;
else
wxBell();
}
else
{
evt->SetPassEvent();
}
}
else
{
evt->SetPassEvent();
@ -2183,6 +2217,12 @@ int ROUTER_TOOL::InlineDrag( const TOOL_EVENT& aEvent )
m_router->FixRoute( m_endSnapPoint, m_endItem );
break;
}
else if( evt->IsUndoRedo() )
{
// We're in an UndoRedoBlock. If we get here, something's broken.
wxFAIL;
break;
}
else if( evt->Category() == TC_COMMAND )
{
// disallow editing commands
@ -2193,6 +2233,14 @@ int ROUTER_TOOL::InlineDrag( const TOOL_EVENT& aEvent )
{
wxBell();
}
// treat an undo as an escape
else if( evt->IsAction( &ACTIONS::undo ) )
{
if( wasLocked )
item->SetLocked( true );
break;
}
else
{
evt->SetPassEvent();