Reimplement close for Annotation dialog.

wxWidgets auto-dialog-handling for modeless dialogs just hides
them.

Fixes: lp:1785526
* https://bugs.launchpad.net/kicad/+bug/1785526
This commit is contained in:
Jeff Young 2018-08-06 21:45:01 +01:00
parent 539ca5aa3b
commit bea98d8265
4 changed files with 27 additions and 7 deletions

View File

@ -63,6 +63,8 @@ private:
/// Initialises member variables /// Initialises member variables
void InitValues(); void InitValues();
void OnClearAnnotationCmpClick( wxCommandEvent& event ) override; void OnClearAnnotationCmpClick( wxCommandEvent& event ) override;
void OnCloseClick( wxCommandEvent& event ) override;
void OnClose( wxCloseEvent& event ) override;
void OnApplyClick( wxCommandEvent& event ) override; void OnApplyClick( wxCommandEvent& event ) override;
// User functions: // 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 ) void DIALOG_ANNOTATE::OnApplyClick( wxCommandEvent& event )
{ {
wxString message; wxString message;

View File

@ -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/ // http://www.wxformbuilder.org/
// //
// PLEASE DO "NOT" EDIT THIS FILE! // PLEASE DO *NOT* EDIT THIS FILE!
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
#include "wx_html_report_panel.h" #include "wx_html_report_panel.h"
@ -144,14 +144,18 @@ DIALOG_ANNOTATE_BASE::DIALOG_ANNOTATE_BASE( wxWindow* parent, wxWindowID id, con
bmainSizer->Fit( this ); bmainSizer->Fit( this );
// Connect Events // 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_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 ); m_sdbSizer1OK->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_ANNOTATE_BASE::OnApplyClick ), NULL, this );
} }
DIALOG_ANNOTATE_BASE::~DIALOG_ANNOTATE_BASE() DIALOG_ANNOTATE_BASE::~DIALOG_ANNOTATE_BASE()
{ {
// Disconnect Events // 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_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 ); m_sdbSizer1OK->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_ANNOTATE_BASE::OnApplyClick ), NULL, this );
} }

View File

@ -61,7 +61,7 @@
<event name="OnAuiPaneRestore"></event> <event name="OnAuiPaneRestore"></event>
<event name="OnAuiRender"></event> <event name="OnAuiRender"></event>
<event name="OnChar"></event> <event name="OnChar"></event>
<event name="OnClose"></event> <event name="OnClose">OnClose</event>
<event name="OnEnterWindow"></event> <event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event> <event name="OnEraseBackground"></event>
<event name="OnHibernate"></event> <event name="OnHibernate"></event>
@ -1373,7 +1373,7 @@
<property name="name">m_sdbSizer1</property> <property name="name">m_sdbSizer1</property>
<property name="permission">protected</property> <property name="permission">protected</property>
<event name="OnApplyButtonClick"></event> <event name="OnApplyButtonClick"></event>
<event name="OnCancelButtonClick"></event> <event name="OnCancelButtonClick">OnCloseClick</event>
<event name="OnContextHelpButtonClick"></event> <event name="OnContextHelpButtonClick"></event>
<event name="OnHelpButtonClick"></event> <event name="OnHelpButtonClick"></event>
<event name="OnNoButtonClick"></event> <event name="OnNoButtonClick"></event>

View File

@ -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/ // http://www.wxformbuilder.org/
// //
// PLEASE DO "NOT" EDIT THIS FILE! // PLEASE DO *NOT* EDIT THIS FILE!
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
#ifndef __DIALOG_ANNOTATE_BASE_H__ #ifndef __DIALOG_ANNOTATE_BASE_H__
@ -11,7 +11,6 @@
#include <wx/artprov.h> #include <wx/artprov.h>
#include <wx/xrc/xmlres.h> #include <wx/xrc/xmlres.h>
#include <wx/intl.h> #include <wx/intl.h>
class DIALOG_SHIM;
class WX_HTML_REPORT_PANEL; class WX_HTML_REPORT_PANEL;
#include "dialog_shim.h" #include "dialog_shim.h"
@ -70,7 +69,9 @@ class DIALOG_ANNOTATE_BASE : public DIALOG_SHIM
wxButton* m_sdbSizer1Cancel; wxButton* m_sdbSizer1Cancel;
// Virtual event handlers, overide them in your derived class // 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 OnClearAnnotationCmpClick( wxCommandEvent& event ) { event.Skip(); }
virtual void OnCloseClick( wxCommandEvent& event ) { event.Skip(); }
virtual void OnApplyClick( wxCommandEvent& event ) { event.Skip(); } virtual void OnApplyClick( wxCommandEvent& event ) { event.Skip(); }