Only reserve hotkeys for focused textCtrls that are editabled.

Otherwise just send Ctrl-C to the disabled control, and everything
else to the tool framework.

Fixes https://gitlab.com/kicad/code/kicad/issues/4801
This commit is contained in:
Jeff Young
2020-07-14 13:30:43 +01:00
parent 7f991ce855
commit e9da02e2d5
6 changed files with 35 additions and 50 deletions
+3 -16
View File
@@ -26,31 +26,18 @@
#include <textentry_tricks.h>
#include <dialog_shim.h>
bool TEXTENTRY_TRICKS::isCtrl( int aChar, const wxKeyEvent& e )
{
return e.GetKeyCode() == aChar && e.ControlDown() && !e.AltDown() &&
!e.ShiftDown() && !e.MetaDown();
}
bool TEXTENTRY_TRICKS::isShiftCtrl( int aChar, const wxKeyEvent& e )
{
return e.GetKeyCode() == aChar && e.ControlDown() && !e.AltDown() &&
e.ShiftDown() && !e.MetaDown();
}
void TEXTENTRY_TRICKS::OnCharHook( wxTextEntry* aTextEntry, wxKeyEvent& aEvent )
{
if( isCtrl( 'X', aEvent ) )
if( aEvent.GetModifiers() == wxMOD_CONTROL && aEvent.GetKeyCode() == 'X' )
{
aTextEntry->Cut();
}
else if( isCtrl( 'C', aEvent ) )
else if( aEvent.GetModifiers() == wxMOD_CONTROL && aEvent.GetKeyCode() == 'C' )
{
aTextEntry->Copy();
}
else if( isCtrl( 'V', aEvent ) )
else if( aEvent.GetModifiers() == wxMOD_CONTROL && aEvent.GetKeyCode() == 'V' )
{
aTextEntry->Paste();
}