cvpcb: Allow the escape key to close the window

Fixes: lp:1830483
* https://bugs.launchpad.net/kicad/+bug/1830483
This commit is contained in:
Ian McInerney 2019-06-20 23:13:36 +01:00 committed by Wayne Stambaugh
parent f5284ced54
commit 1d66aad4df
3 changed files with 17 additions and 0 deletions

View File

@ -56,5 +56,6 @@ enum id_cvpcb_frm
ID_CVPCB_EQUFILES_LIST_EDIT,
ID_CVPCB_LIB_TABLE_EDIT,
ID_CVPCB_FILTER_TEXT_EDIT,
ID_CVPCB_ESCAPE_KEY,
ID_TB_MEASUREMENT_TOOL
};

View File

@ -95,6 +95,9 @@ BEGIN_EVENT_TABLE( CVPCB_MAINFRAME, KIWAY_PLAYER )
EVT_CLOSE( CVPCB_MAINFRAME::OnCloseWindow )
EVT_SIZE( CVPCB_MAINFRAME::OnSize )
// Handle the escape key
EVT_TOOL( ID_CVPCB_ESCAPE_KEY, CVPCB_MAINFRAME::OnEscapeKey )
// UI event handlers
EVT_UPDATE_UI( ID_CVPCB_FOOTPRINT_DISPLAY_FILTERED_LIST, CVPCB_MAINFRAME::OnFilterFPbyKeywords )
EVT_UPDATE_UI( ID_CVPCB_FOOTPRINT_DISPLAY_PIN_FILTERED_LIST,
@ -228,6 +231,12 @@ CVPCB_MAINFRAME::CVPCB_MAINFRAME( KIWAY* aKiway, wxWindow* aParent ) :
m_compListBox->Connect( wxEVT_RIGHT_DOWN,
wxMouseEventHandler( CVPCB_MAINFRAME::OnComponentRightClick ),
NULL, this );
// Add an accelerator to make escape close the window
wxAcceleratorEntry entries[1];
entries[0].Set( wxACCEL_NORMAL, WXK_ESCAPE, ID_CVPCB_ESCAPE_KEY );
wxAcceleratorTable accel( 1, entries );
SetAcceleratorTable( accel );
}
@ -384,6 +393,12 @@ void CVPCB_MAINFRAME::ToPreviousNA( wxCommandEvent& event )
}
void CVPCB_MAINFRAME::OnEscapeKey( wxCommandEvent& aEvent )
{
Close( false );
}
void CVPCB_MAINFRAME::OnOK( wxCommandEvent& aEvent )
{
SaveFootprintAssociation( false );

View File

@ -122,6 +122,7 @@ public:
void OnCloseWindow( wxCloseEvent& Event );
void OnSize( wxSizeEvent& SizeEvent );
void OnKeyDown( wxKeyEvent& aEvent );
void OnEscapeKey( wxCommandEvent& aEvent );
void ReCreateHToolbar();
virtual void ReCreateMenuBar() override;
void ShowChangedLanguage() override;