From 4f678a919c03f46e55c841ab6a1826d703d64545 Mon Sep 17 00:00:00 2001 From: Maciej Suminski Date: Fri, 30 May 2014 15:31:30 +0200 Subject: [PATCH] Fixed invisible buttons in PNS settings dialog (at least for some GTK themes). --- pcbnew/dialogs/dialog_pns_settings_base.cpp | 28 +-- pcbnew/dialogs/dialog_pns_settings_base.fbp | 247 ++++---------------- pcbnew/dialogs/dialog_pns_settings_base.h | 9 +- 3 files changed, 60 insertions(+), 224 deletions(-) diff --git a/pcbnew/dialogs/dialog_pns_settings_base.cpp b/pcbnew/dialogs/dialog_pns_settings_base.cpp index b675f8fd9d..82318f7e32 100644 --- a/pcbnew/dialogs/dialog_pns_settings_base.cpp +++ b/pcbnew/dialogs/dialog_pns_settings_base.cpp @@ -89,20 +89,16 @@ DIALOG_PNS_SETTINGS_BASE::DIALOG_PNS_SETTINGS_BASE( wxWindow* parent, wxWindowID bEffort->Add( bSlider, 1, wxEXPAND, 5 ); - bOptions->Add( bEffort, 1, wxALL|wxEXPAND, 5 ); + bOptions->Add( bEffort, 1, wxEXPAND, 5 ); - wxBoxSizer* bButtons; - bButtons = new wxBoxSizer( wxHORIZONTAL ); + m_stdButtons = new wxStdDialogButtonSizer(); + m_stdButtonsOK = new wxButton( this, wxID_OK ); + m_stdButtons->AddButton( m_stdButtonsOK ); + m_stdButtonsCancel = new wxButton( this, wxID_CANCEL ); + m_stdButtons->AddButton( m_stdButtonsCancel ); + m_stdButtons->Realize(); - m_ok = new wxButton( this, wxID_OK, _("OK"), wxDefaultPosition, wxDefaultSize, 0 ); - m_ok->SetDefault(); - bButtons->Add( m_ok, 1, wxALL, 5 ); - - m_cancel = new wxButton( this, wxID_CANCEL, _("Cancel"), wxDefaultPosition, wxDefaultSize, 0 ); - bButtons->Add( m_cancel, 1, wxALL, 5 ); - - - bOptions->Add( bButtons, 1, wxEXPAND, 5 ); + bOptions->Add( m_stdButtons, 1, wxEXPAND, 5 ); bMainSizer->Add( bOptions, 1, wxEXPAND, 5 ); @@ -113,15 +109,15 @@ DIALOG_PNS_SETTINGS_BASE::DIALOG_PNS_SETTINGS_BASE( wxWindow* parent, wxWindowID // Connect Events this->Connect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( DIALOG_PNS_SETTINGS_BASE::OnClose ) ); - m_ok->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PNS_SETTINGS_BASE::OnOkClick ), NULL, this ); - m_cancel->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PNS_SETTINGS_BASE::OnCancelClick ), NULL, this ); + m_stdButtonsCancel->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PNS_SETTINGS_BASE::OnCancelClick ), NULL, this ); + m_stdButtonsOK->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PNS_SETTINGS_BASE::OnOkClick ), NULL, this ); } DIALOG_PNS_SETTINGS_BASE::~DIALOG_PNS_SETTINGS_BASE() { // Disconnect Events this->Disconnect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( DIALOG_PNS_SETTINGS_BASE::OnClose ) ); - m_ok->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PNS_SETTINGS_BASE::OnOkClick ), NULL, this ); - m_cancel->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PNS_SETTINGS_BASE::OnCancelClick ), NULL, this ); + m_stdButtonsCancel->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PNS_SETTINGS_BASE::OnCancelClick ), NULL, this ); + m_stdButtonsOK->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PNS_SETTINGS_BASE::OnOkClick ), NULL, this ); } diff --git a/pcbnew/dialogs/dialog_pns_settings_base.fbp b/pcbnew/dialogs/dialog_pns_settings_base.fbp index dd008e9e25..729449a9c0 100644 --- a/pcbnew/dialogs/dialog_pns_settings_base.fbp +++ b/pcbnew/dialogs/dialog_pns_settings_base.fbp @@ -42,7 +42,7 @@ DIALOG_PNS_SETTINGS_BASE - 289,504 + 313,528 wxDEFAULT_DIALOG_STYLE Interactive Router settings @@ -193,11 +193,11 @@ wxVERTICAL none - + 5 wxALL 0 - + 1 1 1 @@ -281,11 +281,11 @@ - + 5 wxALL 0 - + 1 1 1 @@ -369,11 +369,11 @@ - + 5 wxALL 0 - + 1 1 1 @@ -457,11 +457,11 @@ - + 5 wxALL 0 - + 1 1 1 @@ -545,11 +545,11 @@ - + 5 wxALL 0 - + 1 1 1 @@ -633,11 +633,11 @@ - + 5 wxALL 0 - + 1 1 1 @@ -721,11 +721,11 @@ - + 5 wxALL 0 - + 1 1 1 @@ -809,11 +809,11 @@ - + 5 - wxALL|wxEXPAND + wxEXPAND 1 - + bEffort wxHORIZONTAL @@ -901,21 +901,21 @@ - + 5 wxEXPAND 0 - + 0 protected 0 - + 5 wxEXPAND 1 - + bSlider wxVERTICAL @@ -1028,11 +1028,11 @@ - + 5 wxEXPAND 1 - + bSliderLabels wxHORIZONTAL @@ -1223,187 +1223,26 @@ 5 wxEXPAND 1 - + + 0 + 1 + 0 + 0 + 0 + 1 + 0 + 0 - bButtons - wxHORIZONTAL - none - - 5 - wxALL - 1 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_OK - OK - - 0 - - - 0 - - 1 - m_ok - 1 - - - protected - 1 - - Resizable - 1 - - - - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - OnOkClick - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxALL - 1 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_CANCEL - Cancel - - 0 - - - 0 - - 1 - m_cancel - 1 - - - protected - 1 - - Resizable - 1 - - - - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - OnCancelClick - - - - - - - - - - - - - - - - - - - - - - - - - + m_stdButtons + protected + + OnCancelClick + + + + OnOkClick + + diff --git a/pcbnew/dialogs/dialog_pns_settings_base.h b/pcbnew/dialogs/dialog_pns_settings_base.h index ceb135dc58..e67d0a72a6 100644 --- a/pcbnew/dialogs/dialog_pns_settings_base.h +++ b/pcbnew/dialogs/dialog_pns_settings_base.h @@ -48,18 +48,19 @@ class DIALOG_PNS_SETTINGS_BASE : public wxDialog wxSlider* m_effort; wxStaticText* m_lowLabel; wxStaticText* m_highLabel; - wxButton* m_ok; - wxButton* m_cancel; + wxStdDialogButtonSizer* m_stdButtons; + wxButton* m_stdButtonsOK; + wxButton* m_stdButtonsCancel; // Virtual event handlers, overide them in your derived class virtual void OnClose( wxCloseEvent& event ) { event.Skip(); } - virtual void OnOkClick( wxCommandEvent& event ) { event.Skip(); } virtual void OnCancelClick( wxCommandEvent& event ) { event.Skip(); } + virtual void OnOkClick( wxCommandEvent& event ) { event.Skip(); } public: - DIALOG_PNS_SETTINGS_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Interactive Router settings"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 289,504 ), long style = wxDEFAULT_DIALOG_STYLE ); + DIALOG_PNS_SETTINGS_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Interactive Router settings"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 313,528 ), long style = wxDEFAULT_DIALOG_STYLE ); ~DIALOG_PNS_SETTINGS_BASE(); };