diff --git a/eeschema/dialogs/dialog_annotate.cpp b/eeschema/dialogs/dialog_annotate.cpp index e6f3a7f178..59f1d9c9bb 100644 --- a/eeschema/dialogs/dialog_annotate.cpp +++ b/eeschema/dialogs/dialog_annotate.cpp @@ -63,6 +63,8 @@ private: /// Initialises member variables void InitValues(); void OnClearAnnotationCmpClick( wxCommandEvent& event ) override; + void OnCloseClick( wxCommandEvent& event ) override; + void OnClose( wxCloseEvent& event ) override; void OnApplyClick( wxCommandEvent& event ) override; // User functions: @@ -180,6 +182,19 @@ void DIALOG_ANNOTATE::InitValues() } +// This is a modeless dialog so we have to handle these ourselves. +void DIALOG_ANNOTATE::OnCloseClick( wxCommandEvent& event ) +{ + Close(); +} + + +void DIALOG_ANNOTATE::OnClose( wxCloseEvent& event ) +{ + Destroy(); +} + + void DIALOG_ANNOTATE::OnApplyClick( wxCommandEvent& event ) { wxString message; diff --git a/eeschema/dialogs/dialog_annotate_base.cpp b/eeschema/dialogs/dialog_annotate_base.cpp index d94eacf95a..b87623ebdf 100644 --- a/eeschema/dialogs/dialog_annotate_base.cpp +++ b/eeschema/dialogs/dialog_annotate_base.cpp @@ -1,8 +1,8 @@ /////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version Aug 4 2017) +// C++ code generated with wxFormBuilder (version Dec 30 2017) // http://www.wxformbuilder.org/ // -// PLEASE DO "NOT" EDIT THIS FILE! +// PLEASE DO *NOT* EDIT THIS FILE! /////////////////////////////////////////////////////////////////////////// #include "wx_html_report_panel.h" @@ -144,14 +144,18 @@ DIALOG_ANNOTATE_BASE::DIALOG_ANNOTATE_BASE( wxWindow* parent, wxWindowID id, con bmainSizer->Fit( this ); // Connect Events + this->Connect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( DIALOG_ANNOTATE_BASE::OnClose ) ); m_btnClear->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_ANNOTATE_BASE::OnClearAnnotationCmpClick ), 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 ); } DIALOG_ANNOTATE_BASE::~DIALOG_ANNOTATE_BASE() { // Disconnect Events + this->Disconnect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( DIALOG_ANNOTATE_BASE::OnClose ) ); m_btnClear->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_ANNOTATE_BASE::OnClearAnnotationCmpClick ), 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 24280433f7..454200b8fb 100644 --- a/eeschema/dialogs/dialog_annotate_base.fbp +++ b/eeschema/dialogs/dialog_annotate_base.fbp @@ -61,7 +61,7 @@ - + OnClose @@ -1373,7 +1373,7 @@ m_sdbSizer1 protected - + OnCloseClick diff --git a/eeschema/dialogs/dialog_annotate_base.h b/eeschema/dialogs/dialog_annotate_base.h index f7fab7c2e1..7ea011d4af 100644 --- a/eeschema/dialogs/dialog_annotate_base.h +++ b/eeschema/dialogs/dialog_annotate_base.h @@ -1,8 +1,8 @@ /////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version Aug 4 2017) +// C++ code generated with wxFormBuilder (version Dec 30 2017) // http://www.wxformbuilder.org/ // -// PLEASE DO "NOT" EDIT THIS FILE! +// PLEASE DO *NOT* EDIT THIS FILE! /////////////////////////////////////////////////////////////////////////// #ifndef __DIALOG_ANNOTATE_BASE_H__ @@ -11,7 +11,6 @@ #include #include #include -class DIALOG_SHIM; class WX_HTML_REPORT_PANEL; #include "dialog_shim.h" @@ -70,7 +69,9 @@ class DIALOG_ANNOTATE_BASE : public DIALOG_SHIM wxButton* m_sdbSizer1Cancel; // Virtual event handlers, overide them in your derived class + virtual void OnClose( wxCloseEvent& event ) { event.Skip(); } virtual void OnClearAnnotationCmpClick( wxCommandEvent& event ) { event.Skip(); } + virtual void OnCloseClick( wxCommandEvent& event ) { event.Skip(); } virtual void OnApplyClick( wxCommandEvent& event ) { event.Skip(); }