diff --git a/pcbnew/dialogs/dialog_move_exact.cpp b/pcbnew/dialogs/dialog_move_exact.cpp index 0c8ede4f35..3da9ab6ac1 100644 --- a/pcbnew/dialogs/dialog_move_exact.cpp +++ b/pcbnew/dialogs/dialog_move_exact.cpp @@ -2,8 +2,7 @@ * This program source code file is part of KiCad, a free EDA CAD application. * * Copyright (C) 2014 John Beard, john.j.beard@gmail.com - * Copyright (C) 1992-2014 KiCad Developers, see AUTHORS.txt for contributors. - * Copyright (C) 2017 KiCad Developers, see CHANGELOG.TXT for contributors. + * Copyright (C) 2018 KiCad Developers, see AUTHORS.txt for contributors. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -268,10 +267,13 @@ void DIALOG_MOVE_EXACT::OnClear( wxCommandEvent& event ) if( entry ) entry->SetValue( "0" ); + + // Keep m_stdButtonsOK focused to allow enter key actiavte the OK button + m_stdButtonsOK->SetFocus(); } -void DIALOG_MOVE_EXACT::OnOkClick( wxCommandEvent& event ) +bool DIALOG_MOVE_EXACT::TransferDataFromWindow() { m_rotation = DoubleValueFromString( DEGREES, m_rotEntry->GetValue() ); m_origin = static_cast( m_originChooser->GetSelection() ); @@ -326,8 +328,10 @@ void DIALOG_MOVE_EXACT::OnOkClick( wxCommandEvent& event ) m_options.origin = m_origin; m_options.anchor = static_cast( m_anchorChoice->GetSelection() ); m_options.overrideAnchor = m_cbOverride->IsChecked(); - event.Skip(); + return true; } + + return false; } diff --git a/pcbnew/dialogs/dialog_move_exact.h b/pcbnew/dialogs/dialog_move_exact.h index 6804aab76d..ce18bdb160 100644 --- a/pcbnew/dialogs/dialog_move_exact.h +++ b/pcbnew/dialogs/dialog_move_exact.h @@ -2,8 +2,7 @@ * This program source code file is part of KiCad, a free EDA CAD application. * * Copyright (C) 2014 John Beard, john.j.beard@gmail.com - * Copyright (C) 1992-2014 KiCad Developers, see AUTHORS.txt for contributors. - * Copyright (C) 2017 KiCad Developers, see CHANGELOG.TXT for contributors. + * Copyright (C) 2018 KiCad Developers, see AUTHORS.txt for contributors. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -26,8 +25,8 @@ #ifndef __DIALOG_MOVE_EXACT__ #define __DIALOG_MOVE_EXACT__ -// Include the wxFormBuider header base: #include +// Include the wxFormBuider header base: #include enum MOVE_EXACT_ORIGIN @@ -89,7 +88,8 @@ private: void OnOriginChanged( wxCommandEvent& event ) override; void OnOverrideChanged( wxCommandEvent& event ) override; - void OnOkClick( wxCommandEvent& event ) override; + // Automatically called when clicking on the OK button + bool TransferDataFromWindow() override; /** * Convert a given Cartesian point into a polar representation. diff --git a/pcbnew/dialogs/dialog_move_exact_base.cpp b/pcbnew/dialogs/dialog_move_exact_base.cpp index 86400c5018..fe3c8b81e1 100644 --- a/pcbnew/dialogs/dialog_move_exact_base.cpp +++ b/pcbnew/dialogs/dialog_move_exact_base.cpp @@ -1,8 +1,8 @@ /////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version Nov 22 2017) +// C++ code generated with wxFormBuilder (version Aug 4 2017) // http://www.wxformbuilder.org/ // -// PLEASE DO *NOT* EDIT THIS FILE! +// PLEASE DO "NOT" EDIT THIS FILE! /////////////////////////////////////////////////////////////////////////// #include "widgets/text_ctrl_eval.h" @@ -112,10 +112,8 @@ DIALOG_MOVE_EXACT_BASE::DIALOG_MOVE_EXACT_BASE( wxWindow* parent, wxWindowID id, this->SetSizer( bMainSizer ); this->Layout(); - bMainSizer->Fit( this ); // Connect Events - this->Connect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( DIALOG_MOVE_EXACT_BASE::OnClose ) ); m_polarCoords->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_MOVE_EXACT_BASE::OnPolarChanged ), NULL, this ); m_xEntry->Connect( wxEVT_KILL_FOCUS, wxFocusEventHandler( DIALOG_MOVE_EXACT_BASE::OnTextFocusLost ), NULL, this ); m_clearX->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_MOVE_EXACT_BASE::OnClear ), NULL, this ); @@ -125,13 +123,11 @@ DIALOG_MOVE_EXACT_BASE::DIALOG_MOVE_EXACT_BASE( wxWindow* parent, wxWindowID id, m_clearRot->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_MOVE_EXACT_BASE::OnClear ), NULL, this ); m_originChooser->Connect( wxEVT_COMMAND_RADIOBOX_SELECTED, wxCommandEventHandler( DIALOG_MOVE_EXACT_BASE::OnOriginChanged ), NULL, this ); m_cbOverride->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_MOVE_EXACT_BASE::OnOverrideChanged ), NULL, this ); - m_stdButtonsOK->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_MOVE_EXACT_BASE::OnOkClick ), NULL, this ); } DIALOG_MOVE_EXACT_BASE::~DIALOG_MOVE_EXACT_BASE() { // Disconnect Events - this->Disconnect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( DIALOG_MOVE_EXACT_BASE::OnClose ) ); m_polarCoords->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_MOVE_EXACT_BASE::OnPolarChanged ), NULL, this ); m_xEntry->Disconnect( wxEVT_KILL_FOCUS, wxFocusEventHandler( DIALOG_MOVE_EXACT_BASE::OnTextFocusLost ), NULL, this ); m_clearX->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_MOVE_EXACT_BASE::OnClear ), NULL, this ); @@ -141,6 +137,5 @@ DIALOG_MOVE_EXACT_BASE::~DIALOG_MOVE_EXACT_BASE() m_clearRot->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_MOVE_EXACT_BASE::OnClear ), NULL, this ); m_originChooser->Disconnect( wxEVT_COMMAND_RADIOBOX_SELECTED, wxCommandEventHandler( DIALOG_MOVE_EXACT_BASE::OnOriginChanged ), NULL, this ); m_cbOverride->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_MOVE_EXACT_BASE::OnOverrideChanged ), NULL, this ); - m_stdButtonsOK->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_MOVE_EXACT_BASE::OnOkClick ), NULL, this ); } diff --git a/pcbnew/dialogs/dialog_move_exact_base.fbp b/pcbnew/dialogs/dialog_move_exact_base.fbp index 99d80f14bb..cbb91c3da8 100644 --- a/pcbnew/dialogs/dialog_move_exact_base.fbp +++ b/pcbnew/dialogs/dialog_move_exact_base.fbp @@ -44,7 +44,7 @@ -1,-1 DIALOG_MOVE_EXACT_BASE - -1,-1 + 427,250 wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER DIALOG_SHIM; dialog_shim.h Move Item @@ -61,7 +61,7 @@ - OnClose + @@ -1624,7 +1624,7 @@ - OnOkClick + diff --git a/pcbnew/dialogs/dialog_move_exact_base.h b/pcbnew/dialogs/dialog_move_exact_base.h index a799d9fab7..29db62806f 100644 --- a/pcbnew/dialogs/dialog_move_exact_base.h +++ b/pcbnew/dialogs/dialog_move_exact_base.h @@ -1,8 +1,8 @@ /////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version Nov 22 2017) +// C++ code generated with wxFormBuilder (version Aug 4 2017) // http://www.wxformbuilder.org/ // -// PLEASE DO *NOT* EDIT THIS FILE! +// PLEASE DO "NOT" EDIT THIS FILE! /////////////////////////////////////////////////////////////////////////// #ifndef __DIALOG_MOVE_EXACT_BASE_H__ @@ -11,6 +11,7 @@ #include #include #include +class DIALOG_SHIM; class TEXT_CTRL_EVAL; #include "dialog_shim.h" @@ -64,18 +65,16 @@ class DIALOG_MOVE_EXACT_BASE : public DIALOG_SHIM wxButton* m_stdButtonsCancel; // Virtual event handlers, overide them in your derived class - virtual void OnClose( wxCloseEvent& event ) { event.Skip(); } virtual void OnPolarChanged( wxCommandEvent& event ) { event.Skip(); } virtual void OnTextFocusLost( wxFocusEvent& event ) { event.Skip(); } virtual void OnClear( wxCommandEvent& event ) { event.Skip(); } virtual void OnOriginChanged( wxCommandEvent& event ) { event.Skip(); } virtual void OnOverrideChanged( wxCommandEvent& event ) { event.Skip(); } - virtual void OnOkClick( wxCommandEvent& event ) { event.Skip(); } public: - DIALOG_MOVE_EXACT_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Move Item"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER ); + DIALOG_MOVE_EXACT_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Move Item"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 427,250 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER ); ~DIALOG_MOVE_EXACT_BASE(); }; diff --git a/pcbnew/globaleditpad.cpp b/pcbnew/globaleditpad.cpp index 4791c2a42a..1ed389f875 100644 --- a/pcbnew/globaleditpad.cpp +++ b/pcbnew/globaleditpad.cpp @@ -1,8 +1,8 @@ /* * This program source code file is part of KiCad, a free EDA CAD application. * - * Copyright (C) 2009-2007 Jean-Pierre Charras, jp.charras at wanadoo.fr - * Copyright (C) 1992-2012 KiCad Developers, see AUTHORS.txt for contributors. + * Copyright (C) 2009-2018 Jean-Pierre Charras, jp.charras at wanadoo.fr + * Copyright (C) 1992-2018 KiCad Developers, see AUTHORS.txt for contributors. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License