Don't prevent immediate actions while router active
Immediate actions that can take place are useful. We should only be
preventing immediate actions while actively routing or dragging
Fixes https://gitlab.com/kicad/code/kicad/issues/12311
(cherry picked from commit 91fbb5c957
)
This commit is contained in:
parent
29cadaf54e
commit
440d324c9e
|
@ -242,6 +242,13 @@ bool TOOL_EVENT::IsMoveTool() const
|
|||
}
|
||||
|
||||
|
||||
bool TOOL_EVENT::IsEditorTool() const
|
||||
{
|
||||
return ( m_commandStr
|
||||
&& m_commandStr.value().find( "InteractiveEdit" ) != GetCommandStr()->npos );
|
||||
}
|
||||
|
||||
|
||||
bool TOOL_EVENT::IsSimulator() const
|
||||
{
|
||||
return( m_commandStr.is_initialized()
|
||||
|
|
|
@ -419,6 +419,13 @@ public:
|
|||
*/
|
||||
bool IsMoveTool() const;
|
||||
|
||||
/**
|
||||
* Indicate if the event is asking for an editor tool.
|
||||
*
|
||||
* Used to allow deleting an element without de-activating the current tool.
|
||||
*/
|
||||
bool IsEditorTool() const;
|
||||
|
||||
/**
|
||||
* Indicate if the event is from the simulator.
|
||||
*/
|
||||
|
|
|
@ -1399,7 +1399,7 @@ int ROUTER_TOOL::MainLoop( const TOOL_EVENT& aEvent )
|
|||
}
|
||||
else if( evt->IsActivate() )
|
||||
{
|
||||
if( evt->IsMoveTool() )
|
||||
if( evt->IsMoveTool() || evt->IsEditorTool() )
|
||||
{
|
||||
// leave ourselves on the stack so we come back after the move
|
||||
break;
|
||||
|
|
|
@ -263,12 +263,11 @@ bool EDIT_TOOL::invokeInlineRouter( int aDragMode )
|
|||
}
|
||||
|
||||
|
||||
|
||||
bool EDIT_TOOL::isRouterActive() const
|
||||
{
|
||||
ROUTER_TOOL* router = m_toolMgr->GetTool<ROUTER_TOOL>();
|
||||
|
||||
return router && router->IsToolActive();
|
||||
return router && router->RoutingInProgress();
|
||||
}
|
||||
|
||||
|
||||
|
@ -1763,12 +1762,17 @@ int EDIT_TOOL::Flip( const TOOL_EVENT& aEvent )
|
|||
|
||||
int EDIT_TOOL::Remove( const TOOL_EVENT& aEvent )
|
||||
{
|
||||
PCB_BASE_EDIT_FRAME* editFrame = getEditFrame<PCB_BASE_EDIT_FRAME>();
|
||||
|
||||
if( isRouterActive() )
|
||||
{
|
||||
m_toolMgr->RunAction( PCB_ACTIONS::routerUndoLastSegment, true );
|
||||
return 0;
|
||||
}
|
||||
|
||||
std::string tool = aEvent.GetCommandStr().value();
|
||||
editFrame->PushTool( tool );
|
||||
|
||||
std::vector<BOARD_ITEM*> lockedItems;
|
||||
Activate();
|
||||
|
||||
|
@ -1808,6 +1812,7 @@ int EDIT_TOOL::Remove( const TOOL_EVENT& aEvent )
|
|||
{
|
||||
wxBell();
|
||||
canvas()->Refresh();
|
||||
editFrame->PopTool( tool );
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -1978,6 +1983,7 @@ int EDIT_TOOL::Remove( const TOOL_EVENT& aEvent )
|
|||
else
|
||||
m_commit->Push( _( "Delete" ) );
|
||||
|
||||
editFrame->PopTool( tool );
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue