Don't pass Cancel event where there was a specific action cancelled.
For instance, if during a move the user hits ESC they only want the move cancelled, not (for instance) the selection dropped. Fixes https://gitlab.com/kicad/code/kicad/issues/5356
This commit is contained in:
parent
d122321162
commit
1138c32bf3
|
@ -88,9 +88,14 @@ int PICKER_TOOL::Main( const TOOL_EVENT& aEvent )
|
||||||
// Activating a new tool may have alternate finalization from canceling the current
|
// Activating a new tool may have alternate finalization from canceling the current
|
||||||
// tool
|
// tool
|
||||||
if( evt->IsActivate() )
|
if( evt->IsActivate() )
|
||||||
|
{
|
||||||
finalize_state = END_ACTIVATE;
|
finalize_state = END_ACTIVATE;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
|
evt->SetPassEvent( false );
|
||||||
finalize_state = EVT_CANCEL;
|
finalize_state = EVT_CANCEL;
|
||||||
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -204,7 +204,10 @@ int LIB_MOVE_TOOL::Main( const TOOL_EVENT& aEvent )
|
||||||
else if( evt->IsCancelInteractive() || evt->IsActivate() )
|
else if( evt->IsCancelInteractive() || evt->IsActivate() )
|
||||||
{
|
{
|
||||||
if( m_moveInProgress )
|
if( m_moveInProgress )
|
||||||
|
{
|
||||||
|
evt->SetPassEvent( false );
|
||||||
restore_state = true;
|
restore_state = true;
|
||||||
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -352,7 +352,10 @@ int SCH_MOVE_TOOL::Main( const TOOL_EVENT& aEvent )
|
||||||
else if( evt->IsCancelInteractive() )
|
else if( evt->IsCancelInteractive() )
|
||||||
{
|
{
|
||||||
if( m_moveInProgress )
|
if( m_moveInProgress )
|
||||||
|
{
|
||||||
|
evt->SetPassEvent( false );
|
||||||
restore_state = true;
|
restore_state = true;
|
||||||
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -253,7 +253,7 @@ public:
|
||||||
///> be passed on to subsequent tools on the stack. Defaults to true for TC_MESSAGES; false
|
///> be passed on to subsequent tools on the stack. Defaults to true for TC_MESSAGES; false
|
||||||
///> for everything else.
|
///> for everything else.
|
||||||
bool PassEvent() const { return m_passEvent; }
|
bool PassEvent() const { return m_passEvent; }
|
||||||
void SetPassEvent() { m_passEvent = true; }
|
void SetPassEvent( bool aPass = true ) { m_passEvent = aPass; }
|
||||||
|
|
||||||
///> Returns if it this event has a valid position (true for mouse events and context-menu
|
///> Returns if it this event has a valid position (true for mouse events and context-menu
|
||||||
///> or hotkey-based command events)
|
///> or hotkey-based command events)
|
||||||
|
|
|
@ -192,7 +192,10 @@ int PL_EDIT_TOOL::Main( const TOOL_EVENT& aEvent )
|
||||||
else if( evt->IsCancelInteractive() || evt->IsActivate() )
|
else if( evt->IsCancelInteractive() || evt->IsActivate() )
|
||||||
{
|
{
|
||||||
if( m_moveInProgress )
|
if( m_moveInProgress )
|
||||||
|
{
|
||||||
|
evt->SetPassEvent( false );
|
||||||
restore_state = true;
|
restore_state = true;
|
||||||
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -573,6 +573,9 @@ int EDIT_TOOL::doMoveSelection( TOOL_EVENT aEvent, bool aPickReference )
|
||||||
|
|
||||||
else if( evt->IsCancelInteractive() || evt->IsActivate() )
|
else if( evt->IsCancelInteractive() || evt->IsActivate() )
|
||||||
{
|
{
|
||||||
|
if( m_dragging && evt->IsCancelInteractive() )
|
||||||
|
evt->SetPassEvent( false );
|
||||||
|
|
||||||
restore_state = true; // Canceling the tool means that items have to be restored
|
restore_state = true; // Canceling the tool means that items have to be restored
|
||||||
break; // Finish
|
break; // Finish
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue