diff --git a/pcbnew/dialogs/dialog_layer_selection_base.cpp b/pcbnew/dialogs/dialog_layer_selection_base.cpp
index ac3c91ce29..89e9d58f66 100644
--- a/pcbnew/dialogs/dialog_layer_selection_base.cpp
+++ b/pcbnew/dialogs/dialog_layer_selection_base.cpp
@@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////
-// C++ code generated with wxFormBuilder (version v3.8.0)
+// C++ code generated with wxFormBuilder (version 3.9.0 Apr 22 2021)
// http://www.wxformbuilder.org/
//
// PLEASE DO *NOT* EDIT THIS FILE!
@@ -88,6 +88,7 @@ DIALOG_LAYER_SELECTION_BASE::DIALOG_LAYER_SELECTION_BASE( wxWindow* parent, wxWi
this->Centre( wxBOTH );
// Connect Events
+ this->Connect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( DIALOG_LAYER_SELECTION_BASE::OnMouseMove ) );
m_leftGridLayers->Connect( wxEVT_GRID_CELL_LEFT_CLICK, wxGridEventHandler( DIALOG_LAYER_SELECTION_BASE::OnLeftGridCellClick ), NULL, this );
m_leftGridLayers->Connect( wxEVT_LEFT_UP, wxMouseEventHandler( DIALOG_LAYER_SELECTION_BASE::OnLeftButtonReleased ), NULL, this );
m_rightGridLayers->Connect( wxEVT_GRID_CELL_LEFT_CLICK, wxGridEventHandler( DIALOG_LAYER_SELECTION_BASE::OnRightGridCellClick ), NULL, this );
@@ -97,6 +98,7 @@ DIALOG_LAYER_SELECTION_BASE::DIALOG_LAYER_SELECTION_BASE( wxWindow* parent, wxWi
DIALOG_LAYER_SELECTION_BASE::~DIALOG_LAYER_SELECTION_BASE()
{
// Disconnect Events
+ this->Disconnect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( DIALOG_LAYER_SELECTION_BASE::OnMouseMove ) );
m_leftGridLayers->Disconnect( wxEVT_GRID_CELL_LEFT_CLICK, wxGridEventHandler( DIALOG_LAYER_SELECTION_BASE::OnLeftGridCellClick ), NULL, this );
m_leftGridLayers->Disconnect( wxEVT_LEFT_UP, wxMouseEventHandler( DIALOG_LAYER_SELECTION_BASE::OnLeftButtonReleased ), NULL, this );
m_rightGridLayers->Disconnect( wxEVT_GRID_CELL_LEFT_CLICK, wxGridEventHandler( DIALOG_LAYER_SELECTION_BASE::OnRightGridCellClick ), NULL, this );
diff --git a/pcbnew/dialogs/dialog_layer_selection_base.fbp b/pcbnew/dialogs/dialog_layer_selection_base.fbp
index 6c52b20044..2c76405f2f 100644
--- a/pcbnew/dialogs/dialog_layer_selection_base.fbp
+++ b/pcbnew/dialogs/dialog_layer_selection_base.fbp
@@ -14,6 +14,7 @@
dialog_layer_selection_base
1000
none
+
1
dialog_layer_selection_base
@@ -25,6 +26,7 @@
1
1
UI
+ 0
0
0
-
+
0
wxAUI_MGR_DEFAULT
@@ -277,34 +280,34 @@
-
+
bSizerMain
wxVERTICAL
none
-
+
5
wxALL|wxEXPAND
1
-
+
bSizerUpper
wxHORIZONTAL
none
-
+
5
wxEXPAND|wxRIGHT|wxLEFT
1
-
+
bSizerLeft
wxVERTICAL
none
-
+
5
wxTOP|wxRIGHT|wxLEFT
0
-
+
1
1
1
@@ -361,11 +364,11 @@
-1
-
+
5
wxALL|wxEXPAND
0
-
+
1
1
1
@@ -452,20 +455,20 @@
-
+
5
wxEXPAND|wxRIGHT|wxLEFT
1
-
+
bSizerRight
wxVERTICAL
none
-
+
5
wxTOP|wxRIGHT|wxLEFT
0
-
+
1
1
1
@@ -522,11 +525,11 @@
-1
-
+
5
wxALL|wxEXPAND
0
-
+
1
1
1
@@ -615,11 +618,11 @@
-
+
5
wxEXPAND | wxALL
0
-
+
1
1
1
@@ -673,11 +676,11 @@
-
+
5
wxBOTTOM|wxRIGHT|wxLEFT|wxALIGN_RIGHT
0
-
+
0
1
0
diff --git a/pcbnew/dialogs/dialog_layer_selection_base.h b/pcbnew/dialogs/dialog_layer_selection_base.h
index f08d676543..b25ce302b5 100644
--- a/pcbnew/dialogs/dialog_layer_selection_base.h
+++ b/pcbnew/dialogs/dialog_layer_selection_base.h
@@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////
-// C++ code generated with wxFormBuilder (version v3.8.0)
+// C++ code generated with wxFormBuilder (version 3.9.0 Apr 22 2021)
// http://www.wxformbuilder.org/
//
// PLEASE DO *NOT* EDIT THIS FILE!
@@ -39,7 +39,8 @@ class DIALOG_LAYER_SELECTION_BASE : public DIALOG_SHIM
wxGrid* m_leftGridLayers;
wxGrid* m_rightGridLayers;
- // Virtual event handlers, overide them in your derived class
+ // Virtual event handlers, override them in your derived class
+ virtual void OnMouseMove( wxUpdateUIEvent& event ) { event.Skip(); }
virtual void OnLeftGridCellClick( wxGridEvent& event ) { event.Skip(); }
virtual void OnLeftButtonReleased( wxMouseEvent& event ) { event.Skip(); }
virtual void OnRightGridCellClick( wxGridEvent& event ) { event.Skip(); }
@@ -69,7 +70,7 @@ class DIALOG_COPPER_LAYER_PAIR_SELECTION_BASE : public DIALOG_SHIM
wxButton* m_sdbSizerOK;
wxButton* m_sdbSizerCancel;
- // Virtual event handlers, overide them in your derived class
+ // Virtual event handlers, override them in your derived class
virtual void OnLeftGridCellClick( wxGridEvent& event ) { event.Skip(); }
virtual void OnRightGridCellClick( wxGridEvent& event ) { event.Skip(); }
diff --git a/pcbnew/sel_layer.cpp b/pcbnew/sel_layer.cpp
index 16c61ef8e6..c1d501e5f9 100644
--- a/pcbnew/sel_layer.cpp
+++ b/pcbnew/sel_layer.cpp
@@ -80,15 +80,16 @@ class PCB_ONE_LAYER_SELECTOR : public PCB_LAYER_SELECTOR, public DIALOG_LAYER_SE
{
public:
PCB_ONE_LAYER_SELECTOR( PCB_BASE_FRAME* aParent, BOARD * aBrd, PCB_LAYER_ID aDefaultLayer,
- LSET aNotAllowedLayersMask );
+ LSET aNotAllowedLayersMask, bool aHideCheckBoxes = false );
~PCB_ONE_LAYER_SELECTOR();
LAYER_NUM GetLayerSelection() { return m_layerSelected; }
private:
// Event handlers
- void OnLeftGridCellClick( wxGridEvent& event ) override;
- void OnRightGridCellClick( wxGridEvent& event ) override;
+ void OnLeftGridCellClick( wxGridEvent& aEvent ) override;
+ void OnRightGridCellClick( wxGridEvent& aEvent ) override;
+ void OnMouseMove( wxUpdateUIEvent& aEvent ) override;
// Will close the dialog on ESC key
void onCharHook( wxKeyEvent& event );
@@ -105,7 +106,8 @@ private:
PCB_ONE_LAYER_SELECTOR::PCB_ONE_LAYER_SELECTOR( PCB_BASE_FRAME* aParent, BOARD* aBrd,
PCB_LAYER_ID aDefaultLayer,
- LSET aNotAllowedLayersMask ) :
+ LSET aNotAllowedLayersMask,
+ bool aHideCheckBoxes ) :
PCB_LAYER_SELECTOR( aParent ),
DIALOG_LAYER_SELECTION_BASE( aParent )
{
@@ -121,6 +123,12 @@ PCB_ONE_LAYER_SELECTOR::PCB_ONE_LAYER_SELECTOR( PCB_BASE_FRAME* aParent, BOARD*
m_rightGridLayers->SetColFormatBool( SELECT_COLNUM );
buildList();
+ if( aHideCheckBoxes )
+ {
+ m_leftGridLayers->HideCol( SELECT_COLNUM );
+ m_rightGridLayers->HideCol( SELECT_COLNUM );
+ }
+
Connect( wxEVT_CHAR_HOOK, wxKeyEventHandler( PCB_ONE_LAYER_SELECTOR::onCharHook ) );
Layout();
@@ -135,6 +143,41 @@ PCB_ONE_LAYER_SELECTOR::~PCB_ONE_LAYER_SELECTOR()
}
+void PCB_ONE_LAYER_SELECTOR::OnMouseMove( wxUpdateUIEvent& aEvent )
+{
+ /// We have to assign this in UpdateUI events because the wxGrid is not properly receiving
+ /// MouseMove events. It seems to only get them on the edges. So, for now we use this
+ /// workaround
+
+ wxPoint mouse_pos = wxGetMousePosition();
+ wxPoint left_pos = m_leftGridLayers->ScreenToClient( mouse_pos );
+ wxPoint right_pos = m_rightGridLayers->ScreenToClient( mouse_pos );
+
+ if( m_leftGridLayers->HitTest( left_pos ) == wxHT_WINDOW_INSIDE )
+ {
+ int row = m_leftGridLayers->YToRow( left_pos.y );
+
+ if( row != wxNOT_FOUND && row < static_cast( m_layersIdLeftColumn.size() ) )
+ {
+ m_layerSelected = m_layersIdLeftColumn[ row ];
+ m_leftGridLayers->SelectBlock( row, LAYERNAME_COLNUM, row, LAYERNAME_COLNUM);
+ return;
+ }
+ }
+
+ if( m_rightGridLayers->HitTest( right_pos ) == wxHT_WINDOW_INSIDE )
+ {
+ int row = m_rightGridLayers->YToRow( right_pos.y );
+
+ if( row == wxNOT_FOUND || row >= static_cast( m_layersIdRightColumn.size() ) )
+ return;
+
+ m_layerSelected = m_layersIdRightColumn[ row ];
+ m_rightGridLayers->SelectBlock( row, LAYERNAME_COLNUM, row, LAYERNAME_COLNUM);
+ }
+}
+
+
void PCB_ONE_LAYER_SELECTOR::onCharHook( wxKeyEvent& event )
{
if( event.GetKeyCode() == WXK_ESCAPE )
@@ -231,7 +274,7 @@ void PCB_ONE_LAYER_SELECTOR::OnRightGridCellClick( wxGridEvent& event )
PCB_LAYER_ID PCB_BASE_FRAME::SelectOneLayer( PCB_LAYER_ID aDefaultLayer, LSET aNotAllowedLayersMask,
wxPoint aDlgPosition )
{
- PCB_ONE_LAYER_SELECTOR dlg( this, GetBoard(), aDefaultLayer, aNotAllowedLayersMask );
+ PCB_ONE_LAYER_SELECTOR dlg( this, GetBoard(), aDefaultLayer, aNotAllowedLayersMask, true );
if( aDlgPosition != wxDefaultPosition )
{