Make esc dismiss net and layer selector popups.
This commit is contained in:
parent
e5ff4f8582
commit
666da3849b
|
@ -187,6 +187,7 @@ set( COMMON_WIDGET_SRCS
|
|||
widgets/grid_icon_text_helpers.cpp
|
||||
widgets/grid_text_button_helpers.cpp
|
||||
widgets/indicator_icon.cpp
|
||||
widgets/layer_box_selector.cpp
|
||||
widgets/lib_tree.cpp
|
||||
widgets/mathplot.cpp
|
||||
widgets/paged_dialog.cpp
|
||||
|
@ -290,7 +291,6 @@ set( COMMON_SRCS
|
|||
kiway_express.cpp
|
||||
kiway_holder.cpp
|
||||
kiway_player.cpp
|
||||
layer_box_selector.cpp
|
||||
lib_id.cpp
|
||||
lib_table_base.cpp
|
||||
lib_table_keywords.cpp
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
#include <wx/ownerdrw.h>
|
||||
#include <wx/menuitem.h>
|
||||
|
||||
#include <layer_box_selector.h>
|
||||
#include <widgets/layer_box_selector.h>
|
||||
|
||||
LAYER_SELECTOR::LAYER_SELECTOR()
|
||||
{
|
||||
|
@ -84,6 +84,8 @@ LAYER_BOX_SELECTOR::LAYER_BOX_SELECTOR( wxWindow* parent, wxWindowID id,
|
|||
|
||||
if( choices != NULL )
|
||||
ResyncBitmapOnly();
|
||||
|
||||
GetParent()->Connect( wxEVT_CHAR_HOOK, wxKeyEventHandler( LAYER_BOX_SELECTOR::onKeyDown ), NULL, this );
|
||||
}
|
||||
|
||||
|
||||
|
@ -97,6 +99,14 @@ LAYER_BOX_SELECTOR::LAYER_BOX_SELECTOR( wxWindow* parent, wxWindowID id,
|
|||
|
||||
if( !choices.IsEmpty() )
|
||||
ResyncBitmapOnly();
|
||||
|
||||
GetParent()->Connect( wxEVT_CHAR_HOOK, wxKeyEventHandler( LAYER_BOX_SELECTOR::onKeyDown ), NULL, this );
|
||||
}
|
||||
|
||||
|
||||
LAYER_BOX_SELECTOR::~LAYER_BOX_SELECTOR()
|
||||
{
|
||||
GetParent()->Disconnect( wxEVT_CHAR_HOOK, wxKeyEventHandler( LAYER_BOX_SELECTOR::onKeyDown ), NULL, this );
|
||||
}
|
||||
|
||||
|
||||
|
@ -124,7 +134,7 @@ int LAYER_BOX_SELECTOR::SetLayerSelection( LAYER_NUM layer )
|
|||
|
||||
for( int i = 0; i < elements; i++ )
|
||||
{
|
||||
if( GetClientData( i ) == (void*)(intptr_t) layer )
|
||||
if( GetClientData( (unsigned) i ) == (void*)(intptr_t) layer )
|
||||
{
|
||||
if( GetSelection() != i ) // Element (i) is not selected
|
||||
{
|
||||
|
@ -153,3 +163,11 @@ void LAYER_BOX_SELECTOR::ResyncBitmapOnly()
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
void LAYER_BOX_SELECTOR::onKeyDown( wxKeyEvent& aEvent )
|
||||
{
|
||||
if( aEvent.GetKeyCode() == WXK_ESCAPE && IsPopupShown() )
|
||||
Dismiss();
|
||||
else
|
||||
aEvent.Skip();
|
||||
}
|
|
@ -73,10 +73,19 @@ public:
|
|||
Connect( wxEVT_LEFT_DOWN, wxMouseEventHandler( NET_SELECTOR_POPUP::onCapturedMouseClick ), NULL, this );
|
||||
m_netListBox->Connect( wxEVT_LEFT_DOWN, wxMouseEventHandler( NET_SELECTOR_POPUP::onListBoxMouseClick ), NULL, this );
|
||||
m_filterCtrl->Connect( wxEVT_TEXT, wxCommandEventHandler( NET_SELECTOR_POPUP::onFilterEdit ), NULL, this );
|
||||
GetParent()->Connect( wxEVT_CHAR_HOOK, wxKeyEventHandler( NET_SELECTOR_POPUP::onKeyDown ), NULL, this );
|
||||
|
||||
rebuildList();
|
||||
}
|
||||
|
||||
~NET_SELECTOR_POPUP()
|
||||
{
|
||||
Disconnect( wxEVT_LEFT_DOWN, wxMouseEventHandler( NET_SELECTOR_POPUP::onCapturedMouseClick ), NULL, this );
|
||||
m_netListBox->Disconnect( wxEVT_LEFT_DOWN, wxMouseEventHandler( NET_SELECTOR_POPUP::onListBoxMouseClick ), NULL, this );
|
||||
m_filterCtrl->Disconnect( wxEVT_TEXT, wxCommandEventHandler( NET_SELECTOR_POPUP::onFilterEdit ), NULL, this );
|
||||
GetParent()->Disconnect( wxEVT_CHAR_HOOK, wxKeyEventHandler( NET_SELECTOR_POPUP::onKeyDown ), NULL, this );
|
||||
}
|
||||
|
||||
void SetSelectedNetcode( int aNetcode ) { m_selectedNet = aNetcode; }
|
||||
int GetSelectedNetcode() { return m_selectedNet; }
|
||||
|
||||
|
@ -219,6 +228,15 @@ protected:
|
|||
aEvent.Skip();
|
||||
}
|
||||
|
||||
// Intercept escape key; pass on everything else
|
||||
void onKeyDown( wxKeyEvent& aEvent )
|
||||
{
|
||||
if( aEvent.GetKeyCode() == WXK_ESCAPE )
|
||||
m_cancelled = true;
|
||||
else
|
||||
aEvent.Skip();
|
||||
}
|
||||
|
||||
protected:
|
||||
int m_popupWidth;
|
||||
int m_maxPopupHeight;
|
||||
|
|
|
@ -78,7 +78,7 @@ set( GERBVIEW_EXTRA_SRCS
|
|||
../common/base_screen.cpp
|
||||
../common/base_units.cpp
|
||||
../common/eda_text.cpp
|
||||
../common/layer_box_selector.cpp
|
||||
../common/widgets/layer_box_selector.cpp
|
||||
../common/lset.cpp
|
||||
../common/settings.cpp
|
||||
../pcbnew/layer_widget.cpp
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
#ifndef GBR_LAYER_BOX_SELECTOR_H
|
||||
#define GBR_LAYER_BOX_SELECTOR_H 1
|
||||
|
||||
#include <layer_box_selector.h>
|
||||
#include <widgets/layer_box_selector.h>
|
||||
|
||||
|
||||
// class to display a layer list in GerbView.
|
||||
|
|
|
@ -85,6 +85,8 @@ public:
|
|||
const wxPoint& pos, const wxSize& size,
|
||||
const wxArrayString& choices );
|
||||
|
||||
~LAYER_BOX_SELECTOR() override;
|
||||
|
||||
// Get Current Item #
|
||||
int GetChoice();
|
||||
|
||||
|
@ -100,6 +102,9 @@ public:
|
|||
|
||||
// Reload the Layers bitmaps colors
|
||||
void ResyncBitmapOnly();
|
||||
|
||||
private:
|
||||
void onKeyDown( wxKeyEvent& aEvent );
|
||||
};
|
||||
|
||||
#endif // LAYER_BOX_SELECTOR_H
|
|
@ -96,7 +96,7 @@ static const LSET std_pad_layers[] =
|
|||
void PCB_BASE_FRAME::InstallPadOptionsFrame( D_PAD* aPad )
|
||||
{
|
||||
DIALOG_PAD_PROPERTIES dlg( this, aPad );
|
||||
dlg.ShowQuasiModal(); // QuasiModal required for NET_SELECTOR
|
||||
dlg.ShowModal(); // QuasiModal required for NET_SELECTOR
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
#include <pcb_edit_frame.h>
|
||||
#include <class_board.h>
|
||||
#include <wx/textctrl.h>
|
||||
#include <layer_box_selector.h>
|
||||
#include <widgets/layer_box_selector.h>
|
||||
#include <pcb_layer_box_selector.h>
|
||||
|
||||
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
#ifndef PCB_LAYER_BOX_SELECTOR_H
|
||||
#define PCB_LAYER_BOX_SELECTOR_H
|
||||
|
||||
#include <layer_box_selector.h>
|
||||
#include <widgets/layer_box_selector.h>
|
||||
|
||||
class PCB_BASE_FRAME;
|
||||
|
||||
|
|
|
@ -32,7 +32,7 @@
|
|||
#include <class_drawpanel.h>
|
||||
#include <confirm.h>
|
||||
#include <pcb_base_frame.h>
|
||||
#include <layer_box_selector.h>
|
||||
#include <widgets/layer_box_selector.h>
|
||||
#include <class_board.h>
|
||||
#include <dialogs/dialog_layer_selection_base.h>
|
||||
|
||||
|
|
Loading…
Reference in New Issue