From d22003578efa1a590377a3f35d5462998c686088 Mon Sep 17 00:00:00 2001 From: Jeff Young Date: Wed, 6 May 2020 20:49:58 +0100 Subject: [PATCH] Use standard OK/Cancel paradigm rather than Apply/Cancel. Apply/Cancel puts the buttons in a different order on some platforms. Fixes https://gitlab.com/kicad/code/kicad/issues/4332 (cherry picked from commit 52d1c93777b565e7cb489dee2af4954b03b81965) --- pcbnew/dialogs/dialog_exchange_footprints.cpp | 6 +- pcbnew/dialogs/dialog_exchange_footprints.h | 2 +- .../dialog_exchange_footprints_base.cpp | 102 +++++++++--------- .../dialog_exchange_footprints_base.fbp | 5 +- .../dialogs/dialog_exchange_footprints_base.h | 18 ++-- 5 files changed, 67 insertions(+), 66 deletions(-) diff --git a/pcbnew/dialogs/dialog_exchange_footprints.cpp b/pcbnew/dialogs/dialog_exchange_footprints.cpp index 47a77bdcc9..f279403850 100644 --- a/pcbnew/dialogs/dialog_exchange_footprints.cpp +++ b/pcbnew/dialogs/dialog_exchange_footprints.cpp @@ -139,8 +139,8 @@ DIALOG_EXCHANGE_FOOTPRINTS::DIALOG_EXCHANGE_FOOTPRINTS( PCB_EDIT_FRAME* aParent, // Ensure m_closeButton (with id = wxID_CANCEL) has the right label // (to fix automatic renaming of button label ) m_sdbSizerCancel->SetLabel( _( "Close" ) ); - - m_sdbSizerApply->SetDefault(); + m_sdbSizerOK->SetLabel( verb ); + m_sdbSizerOK->SetDefault(); // Now all widgets have the size fixed, call FinishDialogSettings FinishDialogSettings(); @@ -266,7 +266,7 @@ void DIALOG_EXCHANGE_FOOTPRINTS::OnMatchIDClicked( wxCommandEvent& event ) } -void DIALOG_EXCHANGE_FOOTPRINTS::OnApplyClicked( wxCommandEvent& event ) +void DIALOG_EXCHANGE_FOOTPRINTS::OnOKClicked( wxCommandEvent& event ) { wxBusyCursor dummy; diff --git a/pcbnew/dialogs/dialog_exchange_footprints.h b/pcbnew/dialogs/dialog_exchange_footprints.h index 5657e33049..ae7987ddfe 100644 --- a/pcbnew/dialogs/dialog_exchange_footprints.h +++ b/pcbnew/dialogs/dialog_exchange_footprints.h @@ -53,7 +53,7 @@ private: void OnMatchRefClicked( wxCommandEvent& event ) override; void OnMatchValueClicked( wxCommandEvent& event ) override; void OnMatchIDClicked( wxCommandEvent& event ) override; - void OnApplyClicked( wxCommandEvent& event ) override; + void OnOKClicked( wxCommandEvent& event ) override; void ViewAndSelectFootprint( wxCommandEvent& event ) override; wxRadioButton* getRadioButtonForMode(); diff --git a/pcbnew/dialogs/dialog_exchange_footprints_base.cpp b/pcbnew/dialogs/dialog_exchange_footprints_base.cpp index 203414a79b..f4a2dd33b5 100644 --- a/pcbnew/dialogs/dialog_exchange_footprints_base.cpp +++ b/pcbnew/dialogs/dialog_exchange_footprints_base.cpp @@ -14,122 +14,122 @@ DIALOG_EXCHANGE_FOOTPRINTS_BASE::DIALOG_EXCHANGE_FOOTPRINTS_BASE( 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 ); - + m_mainSizer = new wxBoxSizer( wxVERTICAL ); - + m_upperSizer = new wxGridBagSizer( 0, 0 ); m_upperSizer->SetFlexibleDirection( wxBOTH ); m_upperSizer->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED ); - + m_matchAll = new wxRadioButton( this, wxID_ANY, _("%s all footprints on board"), wxDefaultPosition, wxDefaultSize, 0 ); m_upperSizer->Add( m_matchAll, wxGBPosition( 0, 0 ), wxGBSpan( 1, 2 ), wxEXPAND|wxALL, 5 ); - + m_matchSelected = new wxRadioButton( this, wxID_ANY, _("%s selected footprint"), wxDefaultPosition, wxDefaultSize, 0 ); m_upperSizer->Add( m_matchSelected, wxGBPosition( 1, 0 ), wxGBSpan( 1, 1 ), wxALL, 5 ); - + m_matchSpecifiedRef = new wxRadioButton( this, wxID_ANY, _("%s footprints matching reference:"), wxDefaultPosition, wxDefaultSize, 0 ); m_upperSizer->Add( m_matchSpecifiedRef, wxGBPosition( 2, 0 ), wxGBSpan( 1, 1 ), wxALL|wxEXPAND, 5 ); - + m_specifiedRef = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_PROCESS_ENTER ); m_specifiedRef->SetMinSize( wxSize( 200,-1 ) ); - + m_upperSizer->Add( m_specifiedRef, wxGBPosition( 2, 1 ), wxGBSpan( 1, 1 ), wxBOTTOM|wxRIGHT|wxTOP|wxEXPAND, 5 ); - + m_matchSpecifiedValue = new wxRadioButton( this, wxID_ANY, _("%s footprints matching value:"), wxDefaultPosition, wxDefaultSize, 0 ); m_upperSizer->Add( m_matchSpecifiedValue, wxGBPosition( 3, 0 ), wxGBSpan( 1, 1 ), wxEXPAND|wxALL, 5 ); - + m_specifiedValue = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_PROCESS_ENTER ); m_upperSizer->Add( m_specifiedValue, wxGBPosition( 3, 1 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxEXPAND|wxTOP|wxBOTTOM|wxRIGHT, 5 ); - + m_matchSpecifiedID = new wxRadioButton( this, wxID_ANY, _("%s footprints with identifier:"), wxDefaultPosition, wxDefaultSize, 0 ); m_upperSizer->Add( m_matchSpecifiedID, wxGBPosition( 4, 0 ), wxGBSpan( 1, 2 ), wxLEFT|wxRIGHT|wxTOP|wxEXPAND, 5 ); - - + + m_upperSizer->AddGrowableCol( 1 ); - + m_mainSizer->Add( m_upperSizer, 0, wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 10 ); - + wxBoxSizer* bSizer4; bSizer4 = new wxBoxSizer( wxHORIZONTAL ); - + m_specifiedID = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_PROCESS_ENTER ); m_specifiedID->SetMinSize( wxSize( 500,-1 ) ); - + bSizer4->Add( m_specifiedID, 1, wxALIGN_CENTER_VERTICAL|wxLEFT, 5 ); - + m_specifiedIDBrowseButton = new wxBitmapButton( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, wxBU_AUTODRAW ); m_specifiedIDBrowseButton->SetMinSize( wxSize( 30,29 ) ); - + bSizer4->Add( m_specifiedIDBrowseButton, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 2 ); - - + + m_mainSizer->Add( bSizer4, 0, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 10 ); - + m_changeSizer = new wxBoxSizer( wxVERTICAL ); - + wxStaticLine* staticline1; staticline1 = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL ); m_changeSizer->Add( staticline1, 0, wxEXPAND|wxBOTTOM, 5 ); - + wxStaticText* newIdLabel; newIdLabel = new wxStaticText( this, wxID_ANY, _("New footprint identifier:"), wxDefaultPosition, wxDefaultSize, 0 ); newIdLabel->Wrap( -1 ); m_changeSizer->Add( newIdLabel, 0, wxLEFT|wxRIGHT|wxTOP|wxEXPAND, 5 ); - + wxBoxSizer* bSizer3; bSizer3 = new wxBoxSizer( wxHORIZONTAL ); - + m_newID = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); m_newID->SetMinSize( wxSize( 500,-1 ) ); - + bSizer3->Add( m_newID, 1, wxALIGN_CENTER_VERTICAL, 5 ); - + m_newIDBrowseButton = new wxBitmapButton( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, wxBU_AUTODRAW ); m_newIDBrowseButton->SetMinSize( wxSize( 30,29 ) ); - + bSizer3->Add( m_newIDBrowseButton, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 2 ); - - + + m_changeSizer->Add( bSizer3, 1, wxEXPAND|wxLEFT, 5 ); - - + + m_mainSizer->Add( m_changeSizer, 0, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 10 ); - + m_updateOptionsSizer = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Update Options") ), wxVERTICAL ); - + m_removeExtraBox = new wxCheckBox( m_updateOptionsSizer->GetStaticBox(), wxID_ANY, _("Remove text items which are not in library footprint"), wxDefaultPosition, wxDefaultSize, 0 ); m_removeExtraBox->SetToolTip( _("Removes fields that do not occur in the original library symbols") ); - + m_updateOptionsSizer->Add( m_removeExtraBox, 0, wxBOTTOM|wxRIGHT, 5 ); - + m_resetTextItemLayers = new wxCheckBox( m_updateOptionsSizer->GetStaticBox(), wxID_ANY, _("Reset text layers and visibilities"), wxDefaultPosition, wxDefaultSize, 0 ); m_updateOptionsSizer->Add( m_resetTextItemLayers, 0, wxBOTTOM|wxRIGHT, 5 ); - + m_resetTextItemEffects = new wxCheckBox( m_updateOptionsSizer->GetStaticBox(), wxID_ANY, _("Reset text sizes, styles and positions"), wxDefaultPosition, wxDefaultSize, 0 ); m_updateOptionsSizer->Add( m_resetTextItemEffects, 0, wxBOTTOM|wxRIGHT, 5 ); - - + + m_mainSizer->Add( m_updateOptionsSizer, 0, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 10 ); - + m_MessageWindow = new WX_HTML_REPORT_PANEL( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ); m_MessageWindow->SetMinSize( wxSize( -1,240 ) ); - + m_mainSizer->Add( m_MessageWindow, 5, wxEXPAND|wxRIGHT|wxLEFT, 10 ); - + m_sdbSizer = new wxStdDialogButtonSizer(); - m_sdbSizerApply = new wxButton( this, wxID_APPLY ); - m_sdbSizer->AddButton( m_sdbSizerApply ); + m_sdbSizerOK = new wxButton( this, wxID_OK ); + m_sdbSizer->AddButton( m_sdbSizerOK ); m_sdbSizerCancel = new wxButton( this, wxID_CANCEL ); m_sdbSizer->AddButton( m_sdbSizerCancel ); m_sdbSizer->Realize(); - + m_mainSizer->Add( m_sdbSizer, 0, wxEXPAND|wxALL, 5 ); - - + + this->SetSizer( m_mainSizer ); this->Layout(); m_mainSizer->Fit( this ); - + // Connect Events this->Connect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( DIALOG_EXCHANGE_FOOTPRINTS_BASE::updateMatchModeRadioButtons ) ); m_matchAll->Connect( wxEVT_COMMAND_RADIOBUTTON_SELECTED, wxCommandEventHandler( DIALOG_EXCHANGE_FOOTPRINTS_BASE::OnMatchAllClicked ), NULL, this ); @@ -145,7 +145,7 @@ DIALOG_EXCHANGE_FOOTPRINTS_BASE::DIALOG_EXCHANGE_FOOTPRINTS_BASE( wxWindow* pare m_specifiedID->Connect( wxEVT_COMMAND_TEXT_ENTER, wxCommandEventHandler( DIALOG_EXCHANGE_FOOTPRINTS_BASE::OnMatchIDClicked ), NULL, this ); m_specifiedIDBrowseButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EXCHANGE_FOOTPRINTS_BASE::ViewAndSelectFootprint ), NULL, this ); m_newIDBrowseButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EXCHANGE_FOOTPRINTS_BASE::ViewAndSelectFootprint ), NULL, this ); - m_sdbSizerApply->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EXCHANGE_FOOTPRINTS_BASE::OnApplyClicked ), NULL, this ); + m_sdbSizerOK->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EXCHANGE_FOOTPRINTS_BASE::OnOKClicked ), NULL, this ); } DIALOG_EXCHANGE_FOOTPRINTS_BASE::~DIALOG_EXCHANGE_FOOTPRINTS_BASE() @@ -165,6 +165,6 @@ DIALOG_EXCHANGE_FOOTPRINTS_BASE::~DIALOG_EXCHANGE_FOOTPRINTS_BASE() m_specifiedID->Disconnect( wxEVT_COMMAND_TEXT_ENTER, wxCommandEventHandler( DIALOG_EXCHANGE_FOOTPRINTS_BASE::OnMatchIDClicked ), NULL, this ); m_specifiedIDBrowseButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EXCHANGE_FOOTPRINTS_BASE::ViewAndSelectFootprint ), NULL, this ); m_newIDBrowseButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EXCHANGE_FOOTPRINTS_BASE::ViewAndSelectFootprint ), NULL, this ); - m_sdbSizerApply->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EXCHANGE_FOOTPRINTS_BASE::OnApplyClicked ), NULL, this ); - + m_sdbSizerOK->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EXCHANGE_FOOTPRINTS_BASE::OnOKClicked ), NULL, this ); + } diff --git a/pcbnew/dialogs/dialog_exchange_footprints_base.fbp b/pcbnew/dialogs/dialog_exchange_footprints_base.fbp index 45c1171e15..d9d75a70aa 100644 --- a/pcbnew/dialogs/dialog_exchange_footprints_base.fbp +++ b/pcbnew/dialogs/dialog_exchange_footprints_base.fbp @@ -1682,12 +1682,12 @@ wxEXPAND|wxALL 0 - 1 + 0 1 0 0 0 - 0 + 1 0 0 @@ -1701,6 +1701,7 @@ + OnOKClicked diff --git a/pcbnew/dialogs/dialog_exchange_footprints_base.h b/pcbnew/dialogs/dialog_exchange_footprints_base.h index e92658ded0..999644de70 100644 --- a/pcbnew/dialogs/dialog_exchange_footprints_base.h +++ b/pcbnew/dialogs/dialog_exchange_footprints_base.h @@ -44,7 +44,7 @@ class WX_HTML_REPORT_PANEL; class DIALOG_EXCHANGE_FOOTPRINTS_BASE : public DIALOG_SHIM { private: - + protected: wxBoxSizer* m_mainSizer; wxGridBagSizer* m_upperSizer; @@ -66,9 +66,9 @@ class DIALOG_EXCHANGE_FOOTPRINTS_BASE : public DIALOG_SHIM wxCheckBox* m_resetTextItemEffects; WX_HTML_REPORT_PANEL* m_MessageWindow; wxStdDialogButtonSizer* m_sdbSizer; - wxButton* m_sdbSizerApply; + wxButton* m_sdbSizerOK; wxButton* m_sdbSizerCancel; - + // Virtual event handlers, overide them in your derived class virtual void updateMatchModeRadioButtons( wxUpdateUIEvent& event ) { event.Skip(); } virtual void OnMatchAllClicked( wxCommandEvent& event ) { event.Skip(); } @@ -77,14 +77,14 @@ class DIALOG_EXCHANGE_FOOTPRINTS_BASE : public DIALOG_SHIM virtual void OnMatchValueClicked( wxCommandEvent& event ) { event.Skip(); } virtual void OnMatchIDClicked( wxCommandEvent& event ) { event.Skip(); } virtual void ViewAndSelectFootprint( wxCommandEvent& event ) { event.Skip(); } - virtual void OnApplyClicked( wxCommandEvent& event ) { event.Skip(); } - - + virtual void OnOKClicked( wxCommandEvent& event ) { event.Skip(); } + + public: - - DIALOG_EXCHANGE_FOOTPRINTS_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("%s"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER ); + + DIALOG_EXCHANGE_FOOTPRINTS_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("%s"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER ); ~DIALOG_EXCHANGE_FOOTPRINTS_BASE(); - + }; #endif //__DIALOG_EXCHANGE_FOOTPRINTS_BASE_H__