From e3f205a3c4a0ae7dbe2924c5338a5f4e4a032af1 Mon Sep 17 00:00:00 2001 From: Michael Kavanagh Date: Fri, 1 Jan 2021 17:30:47 +0000 Subject: [PATCH] Minor eeschema annotate dialog flow optimisation Fixes https://gitlab.com/kicad/code/kicad/issues/4700 --- eeschema/dialogs/dialog_annotate.cpp | 9 +++++++++ eeschema/dialogs/dialog_annotate_base.cpp | 18 +++++++++++++++++- eeschema/dialogs/dialog_annotate_base.fbp | 11 ++++++++--- eeschema/dialogs/dialog_annotate_base.h | 3 ++- 4 files changed, 36 insertions(+), 5 deletions(-) diff --git a/eeschema/dialogs/dialog_annotate.cpp b/eeschema/dialogs/dialog_annotate.cpp index 3c93ed7809..8c2da826c3 100644 --- a/eeschema/dialogs/dialog_annotate.cpp +++ b/eeschema/dialogs/dialog_annotate.cpp @@ -50,6 +50,7 @@ private: /// Initialises member variables void InitValues(); + void OnOptionChanged( wxCommandEvent& event ) override; void OnClearAnnotationClick( wxCommandEvent& event ) override; void OnCloseClick( wxCommandEvent& event ) override; void OnClose( wxCloseEvent& event ) override; @@ -188,6 +189,7 @@ void DIALOG_ANNOTATE::OnApplyClick( wxCommandEvent& event ) m_Parent->GetCanvas()->Refresh(); m_btnClear->Enable(); + m_sdbSizer1Cancel->SetDefault(); // Don't close dialog if there are things the user needs to address if( reporter.HasMessage() ) @@ -211,6 +213,13 @@ void DIALOG_ANNOTATE::OnClearAnnotationClick( wxCommandEvent& event ) } +void DIALOG_ANNOTATE::OnOptionChanged( wxCommandEvent& event ) +{ + m_sdbSizer1OK->Enable( true ); + m_sdbSizer1OK->SetDefault(); +} + + bool DIALOG_ANNOTATE::GetLevel() { return m_rbScope->GetSelection() == 0; diff --git a/eeschema/dialogs/dialog_annotate_base.cpp b/eeschema/dialogs/dialog_annotate_base.cpp index 11416463e9..548af9e7ba 100644 --- a/eeschema/dialogs/dialog_annotate_base.cpp +++ b/eeschema/dialogs/dialog_annotate_base.cpp @@ -1,5 +1,5 @@ /////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version 3.9.0 Nov 1 2020) +// C++ code generated with wxFormBuilder (version Oct 26 2018) // http://www.wxformbuilder.org/ // // PLEASE DO *NOT* EDIT THIS FILE! @@ -148,6 +148,14 @@ DIALOG_ANNOTATE_BASE::DIALOG_ANNOTATE_BASE( wxWindow* parent, wxWindowID id, con // Connect Events this->Connect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( DIALOG_ANNOTATE_BASE::OnClose ) ); + m_rbScope->Connect( wxEVT_COMMAND_RADIOBOX_SELECTED, wxCommandEventHandler( DIALOG_ANNOTATE_BASE::OnOptionChanged ), NULL, this ); + m_rbSortBy_X_Position->Connect( wxEVT_COMMAND_RADIOBUTTON_SELECTED, wxCommandEventHandler( DIALOG_ANNOTATE_BASE::OnOptionChanged ), NULL, this ); + m_rbSortBy_Y_Position->Connect( wxEVT_COMMAND_RADIOBUTTON_SELECTED, wxCommandEventHandler( DIALOG_ANNOTATE_BASE::OnOptionChanged ), NULL, this ); + m_rbOptions->Connect( wxEVT_COMMAND_RADIOBOX_SELECTED, wxCommandEventHandler( DIALOG_ANNOTATE_BASE::OnOptionChanged ), NULL, this ); + m_rbFirstFree->Connect( wxEVT_COMMAND_RADIOBUTTON_SELECTED, wxCommandEventHandler( DIALOG_ANNOTATE_BASE::OnOptionChanged ), NULL, this ); + m_textNumberAfter->Connect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( DIALOG_ANNOTATE_BASE::OnOptionChanged ), NULL, this ); + m_rbSheetX100->Connect( wxEVT_COMMAND_RADIOBUTTON_SELECTED, wxCommandEventHandler( DIALOG_ANNOTATE_BASE::OnOptionChanged ), NULL, this ); + m_rbSheetX1000->Connect( wxEVT_COMMAND_RADIOBUTTON_SELECTED, wxCommandEventHandler( DIALOG_ANNOTATE_BASE::OnOptionChanged ), NULL, this ); m_btnClear->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_ANNOTATE_BASE::OnClearAnnotationClick ), NULL, this ); m_sdbSizer1Cancel->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_ANNOTATE_BASE::OnCloseClick ), NULL, this ); m_sdbSizer1OK->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_ANNOTATE_BASE::OnApplyClick ), NULL, this ); @@ -157,6 +165,14 @@ DIALOG_ANNOTATE_BASE::~DIALOG_ANNOTATE_BASE() { // Disconnect Events this->Disconnect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( DIALOG_ANNOTATE_BASE::OnClose ) ); + m_rbScope->Disconnect( wxEVT_COMMAND_RADIOBOX_SELECTED, wxCommandEventHandler( DIALOG_ANNOTATE_BASE::OnOptionChanged ), NULL, this ); + m_rbSortBy_X_Position->Disconnect( wxEVT_COMMAND_RADIOBUTTON_SELECTED, wxCommandEventHandler( DIALOG_ANNOTATE_BASE::OnOptionChanged ), NULL, this ); + m_rbSortBy_Y_Position->Disconnect( wxEVT_COMMAND_RADIOBUTTON_SELECTED, wxCommandEventHandler( DIALOG_ANNOTATE_BASE::OnOptionChanged ), NULL, this ); + m_rbOptions->Disconnect( wxEVT_COMMAND_RADIOBOX_SELECTED, wxCommandEventHandler( DIALOG_ANNOTATE_BASE::OnOptionChanged ), NULL, this ); + m_rbFirstFree->Disconnect( wxEVT_COMMAND_RADIOBUTTON_SELECTED, wxCommandEventHandler( DIALOG_ANNOTATE_BASE::OnOptionChanged ), NULL, this ); + m_textNumberAfter->Disconnect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( DIALOG_ANNOTATE_BASE::OnOptionChanged ), NULL, this ); + m_rbSheetX100->Disconnect( wxEVT_COMMAND_RADIOBUTTON_SELECTED, wxCommandEventHandler( DIALOG_ANNOTATE_BASE::OnOptionChanged ), NULL, this ); + m_rbSheetX1000->Disconnect( wxEVT_COMMAND_RADIOBUTTON_SELECTED, wxCommandEventHandler( DIALOG_ANNOTATE_BASE::OnOptionChanged ), NULL, this ); m_btnClear->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_ANNOTATE_BASE::OnClearAnnotationClick ), NULL, this ); m_sdbSizer1Cancel->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_ANNOTATE_BASE::OnCloseClick ), NULL, this ); m_sdbSizer1OK->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_ANNOTATE_BASE::OnApplyClick ), NULL, this ); diff --git a/eeschema/dialogs/dialog_annotate_base.fbp b/eeschema/dialogs/dialog_annotate_base.fbp index a28d26f49e..73814ca340 100644 --- a/eeschema/dialogs/dialog_annotate_base.fbp +++ b/eeschema/dialogs/dialog_annotate_base.fbp @@ -14,7 +14,6 @@ dialog_annotate_base 1000 none - 1 dialog_annotate_base @@ -26,7 +25,6 @@ 1 1 UI - 0 0 0 @@ -211,6 +209,7 @@ + OnOptionChanged @@ -296,6 +295,7 @@ + OnOptionChanged @@ -439,6 +439,7 @@ + OnOptionChanged @@ -577,6 +578,7 @@ + OnOptionChanged @@ -671,6 +673,7 @@ + OnOptionChanged @@ -738,6 +741,7 @@ + OnOptionChanged @@ -805,6 +809,7 @@ + OnOptionChanged @@ -872,6 +877,7 @@ + OnOptionChanged @@ -961,7 +967,6 @@ - 0 diff --git a/eeschema/dialogs/dialog_annotate_base.h b/eeschema/dialogs/dialog_annotate_base.h index 590faaa6a3..503021e1fb 100644 --- a/eeschema/dialogs/dialog_annotate_base.h +++ b/eeschema/dialogs/dialog_annotate_base.h @@ -1,5 +1,5 @@ /////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version 3.9.0 Nov 1 2020) +// C++ code generated with wxFormBuilder (version Oct 26 2018) // http://www.wxformbuilder.org/ // // PLEASE DO *NOT* EDIT THIS FILE! @@ -69,6 +69,7 @@ class DIALOG_ANNOTATE_BASE : public DIALOG_SHIM // Virtual event handlers, overide them in your derived class virtual void OnClose( wxCloseEvent& event ) { event.Skip(); } + virtual void OnOptionChanged( wxCommandEvent& event ) { event.Skip(); } virtual void OnClearAnnotationClick( wxCommandEvent& event ) { event.Skip(); } virtual void OnCloseClick( wxCommandEvent& event ) { event.Skip(); } virtual void OnApplyClick( wxCommandEvent& event ) { event.Skip(); }