Not all SCH_DRAW_PANELs have a selection tool.
Fixes: lp:1829981 * https://bugs.launchpad.net/kicad/+bug/1829981
This commit is contained in:
parent
0047f88f82
commit
1f2bdf895e
|
@ -278,8 +278,9 @@ void SCH_DRAW_PANEL::OnCharHook( wxKeyEvent& event )
|
||||||
|
|
||||||
void SCH_DRAW_PANEL::OnKeyEvent( wxKeyEvent& event )
|
void SCH_DRAW_PANEL::OnKeyEvent( wxKeyEvent& event )
|
||||||
{
|
{
|
||||||
int localkey = event.GetKeyCode();
|
SCH_BASE_FRAME* frame = (SCH_BASE_FRAME*) m_parent;
|
||||||
bool keyWasHandled = false;
|
int localkey = event.GetKeyCode();
|
||||||
|
bool keyWasHandled = false;
|
||||||
|
|
||||||
if( localkey == WXK_ESCAPE )
|
if( localkey == WXK_ESCAPE )
|
||||||
{
|
{
|
||||||
|
@ -287,12 +288,19 @@ void SCH_DRAW_PANEL::OnKeyEvent( wxKeyEvent& event )
|
||||||
|
|
||||||
EE_SELECTION_TOOL* selTool = GetParent()->GetToolManager()->GetTool<EE_SELECTION_TOOL>();
|
EE_SELECTION_TOOL* selTool = GetParent()->GetToolManager()->GetTool<EE_SELECTION_TOOL>();
|
||||||
|
|
||||||
if( EE_CONDITIONS::Idle( selTool->GetSelection() ) )
|
if( selTool )
|
||||||
GetParent()->GetToolManager()->RunAction( EE_ACTIONS::selectionActivate, true );
|
{
|
||||||
else
|
if( EE_CONDITIONS::Idle( selTool->GetSelection() ) )
|
||||||
GetParent()->GetToolManager()->RunAction( ACTIONS::cancelInteractive, true );
|
GetParent()->GetToolManager()->RunAction( EE_ACTIONS::selectionActivate, true );
|
||||||
|
else
|
||||||
|
GetParent()->GetToolManager()->RunAction( ACTIONS::cancelInteractive, true );
|
||||||
|
|
||||||
keyWasHandled = true; // The key is captured: the key event will be not skipped
|
keyWasHandled = true; // The key is captured: the key event will be not skipped
|
||||||
|
}
|
||||||
|
else if( frame->IsModal() )
|
||||||
|
{
|
||||||
|
frame->DismissModal( wxID_CANCEL );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Normalize keys code to easily handle keys from Ctrl+A to Ctrl+Z
|
/* Normalize keys code to easily handle keys from Ctrl+A to Ctrl+Z
|
||||||
|
|
|
@ -228,10 +228,8 @@ public:
|
||||||
*/
|
*/
|
||||||
bool Destroy() override;
|
bool Destroy() override;
|
||||||
|
|
||||||
protected:
|
|
||||||
|
|
||||||
bool IsModal() { return m_modal; }
|
bool IsModal() { return m_modal; }
|
||||||
void SetModal( bool aIsModal ) { m_modal = aIsModal; }
|
void SetModal( bool aIsModal ) { m_modal = aIsModal; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function IsDismissed
|
* Function IsDismissed
|
||||||
|
@ -243,6 +241,8 @@ protected:
|
||||||
|
|
||||||
void DismissModal( bool aRetVal, const wxString& aResult = wxEmptyString );
|
void DismissModal( bool aRetVal, const wxString& aResult = wxEmptyString );
|
||||||
|
|
||||||
|
protected:
|
||||||
|
|
||||||
/// event handler, routes to derivative specific virtual KiwayMailIn()
|
/// event handler, routes to derivative specific virtual KiwayMailIn()
|
||||||
void kiway_express( KIWAY_EXPRESS& aEvent );
|
void kiway_express( KIWAY_EXPRESS& aEvent );
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue