A couple of temp hacks for LibEdit <esc> processing while in transition.

Fixes: lp:1828004
* https://bugs.launchpad.net/kicad/+bug/1828004
This commit is contained in:
Jeff Young 2019-05-07 11:30:30 +01:00
parent 11ec7d4651
commit f40408187e
2 changed files with 19 additions and 1 deletions

View File

@ -38,6 +38,8 @@
#include <functional>
#include <sch_sheet.h>
#include <pgm_base.h>
#include <tools/sch_actions.h> // JEY TODO: temp LibEdit requirement
#include <tools/sch_selection_tool.h> // JEY TODO: temp LibEdit requirement
using namespace std::placeholders;
@ -614,7 +616,12 @@ void SCH_DRAW_PANEL::OnKeyEvent( wxKeyEvent& event )
if( IsMouseCaptured() )
EndMouseCapture();
else
GetParent()->GetToolManager()->RunAction( ACTIONS::cancelInteractive, true );
{
if( SCH_CONDITIONS::Idle( GetParent()->GetToolManager()->GetTool<SCH_SELECTION_TOOL>()->GetSelection() ) )
GetParent()->GetToolManager()->RunAction( SCH_ACTIONS::selectionActivate, true );
else
GetParent()->GetToolManager()->RunAction( ACTIONS::cancelInteractive, true );
}
keyWasHandled = true; // The key is captured: the key event will be not skipped
break;

View File

@ -264,6 +264,17 @@ void SCH_SELECTION_TOOL::Reset( RESET_REASON aReason )
int SCH_SELECTION_TOOL::Main( const TOOL_EVENT& aEvent )
{
// JEY TODO: temp hack for LibEdit legacy selection tool
if( m_isLibEdit )
{
LIB_EDIT_FRAME* libEditFrame = (LIB_EDIT_FRAME*) m_frame;
wxCommandEvent selectArrow;
selectArrow.SetId( ID_NO_TOOL_SELECTED );
libEditFrame->OnSelectTool( selectArrow );
return 0;
}
// Main loop: keep receiving events
while( OPT_TOOL_EVENT evt = Wait() )
{