cvpcb: Allow the escape key to close the window
Fixes: lp:1830483 * https://bugs.launchpad.net/kicad/+bug/1830483
This commit is contained in:
parent
f5284ced54
commit
1d66aad4df
|
@ -56,5 +56,6 @@ enum id_cvpcb_frm
|
||||||
ID_CVPCB_EQUFILES_LIST_EDIT,
|
ID_CVPCB_EQUFILES_LIST_EDIT,
|
||||||
ID_CVPCB_LIB_TABLE_EDIT,
|
ID_CVPCB_LIB_TABLE_EDIT,
|
||||||
ID_CVPCB_FILTER_TEXT_EDIT,
|
ID_CVPCB_FILTER_TEXT_EDIT,
|
||||||
|
ID_CVPCB_ESCAPE_KEY,
|
||||||
ID_TB_MEASUREMENT_TOOL
|
ID_TB_MEASUREMENT_TOOL
|
||||||
};
|
};
|
||||||
|
|
|
@ -95,6 +95,9 @@ BEGIN_EVENT_TABLE( CVPCB_MAINFRAME, KIWAY_PLAYER )
|
||||||
EVT_CLOSE( CVPCB_MAINFRAME::OnCloseWindow )
|
EVT_CLOSE( CVPCB_MAINFRAME::OnCloseWindow )
|
||||||
EVT_SIZE( CVPCB_MAINFRAME::OnSize )
|
EVT_SIZE( CVPCB_MAINFRAME::OnSize )
|
||||||
|
|
||||||
|
// Handle the escape key
|
||||||
|
EVT_TOOL( ID_CVPCB_ESCAPE_KEY, CVPCB_MAINFRAME::OnEscapeKey )
|
||||||
|
|
||||||
// UI event handlers
|
// UI event handlers
|
||||||
EVT_UPDATE_UI( ID_CVPCB_FOOTPRINT_DISPLAY_FILTERED_LIST, CVPCB_MAINFRAME::OnFilterFPbyKeywords )
|
EVT_UPDATE_UI( ID_CVPCB_FOOTPRINT_DISPLAY_FILTERED_LIST, CVPCB_MAINFRAME::OnFilterFPbyKeywords )
|
||||||
EVT_UPDATE_UI( ID_CVPCB_FOOTPRINT_DISPLAY_PIN_FILTERED_LIST,
|
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,
|
m_compListBox->Connect( wxEVT_RIGHT_DOWN,
|
||||||
wxMouseEventHandler( CVPCB_MAINFRAME::OnComponentRightClick ),
|
wxMouseEventHandler( CVPCB_MAINFRAME::OnComponentRightClick ),
|
||||||
NULL, this );
|
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 )
|
void CVPCB_MAINFRAME::OnOK( wxCommandEvent& aEvent )
|
||||||
{
|
{
|
||||||
SaveFootprintAssociation( false );
|
SaveFootprintAssociation( false );
|
||||||
|
|
|
@ -122,6 +122,7 @@ public:
|
||||||
void OnCloseWindow( wxCloseEvent& Event );
|
void OnCloseWindow( wxCloseEvent& Event );
|
||||||
void OnSize( wxSizeEvent& SizeEvent );
|
void OnSize( wxSizeEvent& SizeEvent );
|
||||||
void OnKeyDown( wxKeyEvent& aEvent );
|
void OnKeyDown( wxKeyEvent& aEvent );
|
||||||
|
void OnEscapeKey( wxCommandEvent& aEvent );
|
||||||
void ReCreateHToolbar();
|
void ReCreateHToolbar();
|
||||||
virtual void ReCreateMenuBar() override;
|
virtual void ReCreateMenuBar() override;
|
||||||
void ShowChangedLanguage() override;
|
void ShowChangedLanguage() override;
|
||||||
|
|
Loading…
Reference in New Issue