From abd8927d712247ed65b3ceb9a48c5d41eca282e7 Mon Sep 17 00:00:00 2001 From: Seth Hillbrand Date: Sun, 3 Jun 2018 19:10:01 -0700 Subject: [PATCH] Dimension Edit window passes default action Processing enter from within the dimension editor window is only set to the default action for top-level items. Within the sizer, enter is handled by the first registered button (Cancel) unless explicitly set. Fixes: lp:1774035 * https://bugs.launchpad.net/kicad/+bug/1774035 --- .../dialogs/dialog_dimension_editor_base.cpp | 10 +++ .../dialogs/dialog_dimension_editor_base.fbp | 66 +++++++++---------- 2 files changed, 43 insertions(+), 33 deletions(-) diff --git a/pcbnew/dialogs/dialog_dimension_editor_base.cpp b/pcbnew/dialogs/dialog_dimension_editor_base.cpp index 2ed6c4e758..02d80ed331 100644 --- a/pcbnew/dialogs/dialog_dimension_editor_base.cpp +++ b/pcbnew/dialogs/dialog_dimension_editor_base.cpp @@ -114,12 +114,22 @@ DIALOG_DIMENSION_EDITOR_BASE::DIALOG_DIMENSION_EDITOR_BASE( wxWindow* parent, wx this->Centre( wxBOTH ); // Connect Events + m_TxtSizeXCtrl->Connect( wxEVT_COMMAND_TEXT_ENTER, wxCommandEventHandler( DIALOG_DIMENSION_EDITOR_BASE::OnOKClick ), NULL, this ); + m_TxtSizeYCtrl->Connect( wxEVT_COMMAND_TEXT_ENTER, wxCommandEventHandler( DIALOG_DIMENSION_EDITOR_BASE::OnOKClick ), NULL, this ); + m_TxtWidthCtrl->Connect( wxEVT_COMMAND_TEXT_ENTER, wxCommandEventHandler( DIALOG_DIMENSION_EDITOR_BASE::OnOKClick ), NULL, this ); + m_textCtrlPosX->Connect( wxEVT_COMMAND_TEXT_ENTER, wxCommandEventHandler( DIALOG_DIMENSION_EDITOR_BASE::OnOKClick ), NULL, this ); + m_textCtrlPosY->Connect( wxEVT_COMMAND_TEXT_ENTER, wxCommandEventHandler( DIALOG_DIMENSION_EDITOR_BASE::OnOKClick ), NULL, this ); m_sdbSizerBtsOK->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_DIMENSION_EDITOR_BASE::OnOKClick ), NULL, this ); } DIALOG_DIMENSION_EDITOR_BASE::~DIALOG_DIMENSION_EDITOR_BASE() { // Disconnect Events + m_TxtSizeXCtrl->Disconnect( wxEVT_COMMAND_TEXT_ENTER, wxCommandEventHandler( DIALOG_DIMENSION_EDITOR_BASE::OnOKClick ), NULL, this ); + m_TxtSizeYCtrl->Disconnect( wxEVT_COMMAND_TEXT_ENTER, wxCommandEventHandler( DIALOG_DIMENSION_EDITOR_BASE::OnOKClick ), NULL, this ); + m_TxtWidthCtrl->Disconnect( wxEVT_COMMAND_TEXT_ENTER, wxCommandEventHandler( DIALOG_DIMENSION_EDITOR_BASE::OnOKClick ), NULL, this ); + m_textCtrlPosX->Disconnect( wxEVT_COMMAND_TEXT_ENTER, wxCommandEventHandler( DIALOG_DIMENSION_EDITOR_BASE::OnOKClick ), NULL, this ); + m_textCtrlPosY->Disconnect( wxEVT_COMMAND_TEXT_ENTER, wxCommandEventHandler( DIALOG_DIMENSION_EDITOR_BASE::OnOKClick ), NULL, this ); m_sdbSizerBtsOK->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_DIMENSION_EDITOR_BASE::OnOKClick ), NULL, this ); } diff --git a/pcbnew/dialogs/dialog_dimension_editor_base.fbp b/pcbnew/dialogs/dialog_dimension_editor_base.fbp index 7b888770c9..15411ce3e9 100644 --- a/pcbnew/dialogs/dialog_dimension_editor_base.fbp +++ b/pcbnew/dialogs/dialog_dimension_editor_base.fbp @@ -286,11 +286,11 @@ bSizerLeft wxVERTICAL none - + 5 wxTOP|wxRIGHT|wxLEFT 0 - + 1 1 1 @@ -369,11 +369,11 @@ - + 5 wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND 0 - + 1 1 1 @@ -454,17 +454,17 @@ - + OnOKClick - + 5 wxRIGHT|wxLEFT 0 - + 1 1 1 @@ -543,11 +543,11 @@ - + 5 wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND 0 - + 1 1 1 @@ -628,17 +628,17 @@ - + OnOKClick - + 5 wxTOP|wxRIGHT|wxLEFT 0 - + 1 1 1 @@ -717,11 +717,11 @@ - + 5 wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND 0 - + 1 1 1 @@ -802,17 +802,17 @@ - + OnOKClick - + 5 wxTOP|wxRIGHT|wxLEFT 0 - + 1 1 1 @@ -891,11 +891,11 @@ - + 5 wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND 0 - + 1 1 1 @@ -976,17 +976,17 @@ - + OnOKClick - + 5 wxRIGHT|wxLEFT 0 - + 1 1 1 @@ -1065,11 +1065,11 @@ - + 5 wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT 0 - + 1 1 1 @@ -1150,7 +1150,7 @@ - + OnOKClick @@ -1158,20 +1158,20 @@ - + 5 wxALIGN_CENTER_VERTICAL|wxALL 0 - + bSizerRight wxVERTICAL none - + 5 wxALL|wxEXPAND 0 - + 1 1 1 @@ -1257,11 +1257,11 @@ - + 5 wxTOP|wxRIGHT|wxLEFT 0 - + 1 1 1 @@ -1340,11 +1340,11 @@ - + 5 wxBOTTOM|wxRIGHT|wxLEFT 0 - + 1 1 1