diff --git a/kicad/pcm/dialogs/dialog_pcm.cpp b/kicad/pcm/dialogs/dialog_pcm.cpp index a1586a381e..112a111ff4 100644 --- a/kicad/pcm/dialogs/dialog_pcm.cpp +++ b/kicad/pcm/dialogs/dialog_pcm.cpp @@ -132,12 +132,14 @@ DIALOG_PCM::DIALOG_PCM( wxWindow* parent ) : DIALOG_PCM_BASE( parent ) m_sdbSizer1OK->SetLabel( _( "Close" ) ); m_sdbSizer1Cancel->SetLabel( _( "Discard Changes" ) ); m_sdbSizer1Apply->SetLabel( _( "Apply Changes" ) ); + m_sdbSizer1->Layout(); SetDefaultItem( m_sdbSizer1OK ); Bind( wxEVT_CLOSE_WINDOW, &DIALOG_PCM::OnCloseWindow, this ); - + m_sdbSizer1Cancel->Bind( wxEVT_UPDATE_UI, &DIALOG_PCM::OnUpdateEventButtons, this ); + m_sdbSizer1Apply->Bind( wxEVT_UPDATE_UI, &DIALOG_PCM::OnUpdateEventButtons, this ); SETTINGS_MANAGER& mgr = Pgm().GetSettingsManager(); KICAD_SETTINGS* app_settings = mgr.GetAppSettings(); @@ -166,6 +168,12 @@ DIALOG_PCM::~DIALOG_PCM() } +void DIALOG_PCM::OnUpdateEventButtons( wxUpdateUIEvent& event ) +{ + event.Enable( !m_pendingActions.empty() ); +} + + void DIALOG_PCM::OnCloseClicked( wxCommandEvent& event ) { if( m_pendingActions.size() == 0 diff --git a/kicad/pcm/dialogs/dialog_pcm.h b/kicad/pcm/dialogs/dialog_pcm.h index 6ed799f34f..bc4ef89bb0 100644 --- a/kicad/pcm/dialogs/dialog_pcm.h +++ b/kicad/pcm/dialogs/dialog_pcm.h @@ -67,6 +67,9 @@ public: ///< Discards selected pending actions void OnDiscardActionClicked( wxCommandEvent& event ) override; + ///< Handles modification of the buttons' status + void OnUpdateEventButtons( wxUpdateUIEvent& event ); + private: /** * @brief Gets package data from PCM and displays it on repository tab