Make OK default in inspectors (and hook up to close window).
Fixes https://gitlab.com/kicad/code/kicad/issues/7831
This commit is contained in:
parent
a677998f47
commit
f24f0d93a5
|
@ -11,7 +11,7 @@
|
|||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
DIALOG_HTML_REPORTER::DIALOG_HTML_REPORTER( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : wxDialog( parent, id, title, pos, size, style )
|
||||
DIALOG_HTML_REPORTER::DIALOG_HTML_REPORTER( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : DIALOG_SHIM( parent, id, title, pos, size, style )
|
||||
{
|
||||
this->SetSizeHints( wxDefaultSize, wxDefaultSize );
|
||||
|
||||
|
@ -39,11 +39,13 @@ DIALOG_HTML_REPORTER::DIALOG_HTML_REPORTER( wxWindow* parent, wxWindowID id, con
|
|||
|
||||
// Connect Events
|
||||
m_Reporter->Connect( wxEVT_COMMAND_HTML_LINK_CLICKED, wxHtmlLinkEventHandler( DIALOG_HTML_REPORTER::OnErrorLinkClicked ), NULL, this );
|
||||
m_sdbSizerOK->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_HTML_REPORTER::OnOK ), NULL, this );
|
||||
}
|
||||
|
||||
DIALOG_HTML_REPORTER::~DIALOG_HTML_REPORTER()
|
||||
{
|
||||
// Disconnect Events
|
||||
m_Reporter->Disconnect( wxEVT_COMMAND_HTML_LINK_CLICKED, wxHtmlLinkEventHandler( DIALOG_HTML_REPORTER::OnErrorLinkClicked ), NULL, this );
|
||||
m_sdbSizerOK->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_HTML_REPORTER::OnOK ), NULL, this );
|
||||
|
||||
}
|
||||
|
|
|
@ -47,7 +47,7 @@
|
|||
<property name="pos"></property>
|
||||
<property name="size"></property>
|
||||
<property name="style">wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER</property>
|
||||
<property name="subclass">; ; forward_declare</property>
|
||||
<property name="subclass">DIALOG_SHIM; dialog_shim.h; forward_declare</property>
|
||||
<property name="title">Report</property>
|
||||
<property name="tooltip"></property>
|
||||
<property name="window_extra_style"></property>
|
||||
|
@ -133,6 +133,7 @@
|
|||
<property name="minimum_size"></property>
|
||||
<property name="name">m_sdbSizer</property>
|
||||
<property name="permission">protected</property>
|
||||
<event name="OnOKButtonClick">OnOK</event>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
|
|
|
@ -12,6 +12,7 @@
|
|||
#include <wx/intl.h>
|
||||
class WX_HTML_REPORT_BOX;
|
||||
|
||||
#include "dialog_shim.h"
|
||||
#include <wx/html/htmlwin.h>
|
||||
#include <wx/gdicmn.h>
|
||||
#include <wx/font.h>
|
||||
|
@ -28,7 +29,7 @@ class WX_HTML_REPORT_BOX;
|
|||
///////////////////////////////////////////////////////////////////////////////
|
||||
/// Class DIALOG_HTML_REPORTER
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
class DIALOG_HTML_REPORTER : public wxDialog
|
||||
class DIALOG_HTML_REPORTER : public DIALOG_SHIM
|
||||
{
|
||||
private:
|
||||
|
||||
|
@ -38,6 +39,7 @@ class DIALOG_HTML_REPORTER : public wxDialog
|
|||
|
||||
// Virtual event handlers, overide them in your derived class
|
||||
virtual void OnErrorLinkClicked( wxHtmlLinkEvent& event ) { event.Skip(); }
|
||||
virtual void OnOK( wxCommandEvent& event ) { event.Skip(); }
|
||||
|
||||
|
||||
public:
|
||||
|
|
|
@ -36,6 +36,7 @@ DIALOG_CONSTRAINTS_REPORTER::DIALOG_CONSTRAINTS_REPORTER( PCB_EDIT_FRAME* aParen
|
|||
|
||||
void DIALOG_CONSTRAINTS_REPORTER::FinishInitialization()
|
||||
{
|
||||
m_sdbSizerOK->SetDefault();
|
||||
finishDialogSettings();
|
||||
}
|
||||
|
||||
|
|
|
@ -37,6 +37,11 @@ public:
|
|||
|
||||
void FinishInitialization();
|
||||
|
||||
void OnOK( wxCommandEvent& event ) override
|
||||
{
|
||||
Close();
|
||||
}
|
||||
|
||||
void OnErrorLinkClicked( wxHtmlLinkEvent& event );
|
||||
|
||||
void DeleteAllPages();
|
||||
|
|
|
@ -35,8 +35,14 @@ DIALOG_CONSTRAINTS_REPORTER_BASE::DIALOG_CONSTRAINTS_REPORTER_BASE( wxWindow* pa
|
|||
bMainSizer->Fit( this );
|
||||
|
||||
this->Centre( wxBOTH );
|
||||
|
||||
// Connect Events
|
||||
m_sdbSizerOK->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_CONSTRAINTS_REPORTER_BASE::OnOK ), NULL, this );
|
||||
}
|
||||
|
||||
DIALOG_CONSTRAINTS_REPORTER_BASE::~DIALOG_CONSTRAINTS_REPORTER_BASE()
|
||||
{
|
||||
// Disconnect Events
|
||||
m_sdbSizerOK->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_CONSTRAINTS_REPORTER_BASE::OnOK ), NULL, this );
|
||||
|
||||
}
|
||||
|
|
|
@ -133,6 +133,7 @@
|
|||
<property name="minimum_size"></property>
|
||||
<property name="name">m_sdbSizer</property>
|
||||
<property name="permission">protected</property>
|
||||
<event name="OnOKButtonClick">OnOK</event>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
|
|
|
@ -36,6 +36,10 @@ class DIALOG_CONSTRAINTS_REPORTER_BASE : public DIALOG_SHIM
|
|||
wxStdDialogButtonSizer* m_sdbSizer;
|
||||
wxButton* m_sdbSizerOK;
|
||||
|
||||
// Virtual event handlers, overide them in your derived class
|
||||
virtual void OnOK( wxCommandEvent& event ) { event.Skip(); }
|
||||
|
||||
|
||||
public:
|
||||
|
||||
DIALOG_CONSTRAINTS_REPORTER_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Constraints Resolution Report"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
|
||||
|
|
|
@ -41,10 +41,18 @@ public:
|
|||
DIALOG_INSPECTION_REPORTER( PCB_EDIT_FRAME* aFrame ) :
|
||||
DIALOG_HTML_REPORTER( aFrame ),
|
||||
m_frame( aFrame )
|
||||
{ }
|
||||
{
|
||||
m_sdbSizerOK->SetDefault();
|
||||
SetInitialFocus( m_sdbSizerOK );
|
||||
}
|
||||
|
||||
void OnErrorLinkClicked( wxHtmlLinkEvent& event ) override;
|
||||
|
||||
void OnOK( wxCommandEvent& event ) override
|
||||
{
|
||||
Close();
|
||||
}
|
||||
|
||||
protected:
|
||||
PCB_EDIT_FRAME* m_frame;
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue