From c7447f9be640299516bc985e0f0e5731d1146c85 Mon Sep 17 00:00:00 2001 From: Marek Roszko Date: Thu, 30 Dec 2021 11:36:01 -0500 Subject: [PATCH] Remove UpdateUI from preferences pdf viewer option --- common/dialogs/panel_common_settings.cpp | 42 +++++++++++-------- common/dialogs/panel_common_settings_base.cpp | 10 ++--- common/dialogs/panel_common_settings_base.fbp | 11 +++-- common/dialogs/panel_common_settings_base.h | 7 ++-- include/dialogs/panel_common_settings.h | 5 ++- 5 files changed, 46 insertions(+), 29 deletions(-) diff --git a/common/dialogs/panel_common_settings.cpp b/common/dialogs/panel_common_settings.cpp index 470625bcb2..25f6a11fbe 100644 --- a/common/dialogs/panel_common_settings.cpp +++ b/common/dialogs/panel_common_settings.cpp @@ -144,32 +144,32 @@ PANEL_COMMON_SETTINGS::PANEL_COMMON_SETTINGS( DIALOG_SHIM* aDialog, wxWindow* aP if( m_iconScaleSlider ) { - m_iconScaleSlider->Connect( wxEVT_SCROLL_TOP, - wxScrollEventHandler( PANEL_COMMON_SETTINGS::OnScaleSlider ), + m_iconScaleSlider->Connect( wxEVT_SCROLL_TOP, + wxScrollEventHandler( PANEL_COMMON_SETTINGS::OnScaleSlider ), nullptr, this ); - m_iconScaleSlider->Connect( wxEVT_SCROLL_BOTTOM, - wxScrollEventHandler( PANEL_COMMON_SETTINGS::OnScaleSlider ), + m_iconScaleSlider->Connect( wxEVT_SCROLL_BOTTOM, + wxScrollEventHandler( PANEL_COMMON_SETTINGS::OnScaleSlider ), nullptr, this ); - m_iconScaleSlider->Connect( wxEVT_SCROLL_LINEUP, - wxScrollEventHandler( PANEL_COMMON_SETTINGS::OnScaleSlider ), + m_iconScaleSlider->Connect( wxEVT_SCROLL_LINEUP, + wxScrollEventHandler( PANEL_COMMON_SETTINGS::OnScaleSlider ), nullptr, this ); m_iconScaleSlider->Connect( wxEVT_SCROLL_LINEDOWN, - wxScrollEventHandler( PANEL_COMMON_SETTINGS::OnScaleSlider ), + wxScrollEventHandler( PANEL_COMMON_SETTINGS::OnScaleSlider ), nullptr, this ); m_iconScaleSlider->Connect( wxEVT_SCROLL_PAGEUP, - wxScrollEventHandler( PANEL_COMMON_SETTINGS::OnScaleSlider ), + wxScrollEventHandler( PANEL_COMMON_SETTINGS::OnScaleSlider ), nullptr, this ); m_iconScaleSlider->Connect( wxEVT_SCROLL_PAGEDOWN, - wxScrollEventHandler( PANEL_COMMON_SETTINGS::OnScaleSlider ), + wxScrollEventHandler( PANEL_COMMON_SETTINGS::OnScaleSlider ), nullptr, this ); - m_iconScaleSlider->Connect( wxEVT_SCROLL_THUMBTRACK, - wxScrollEventHandler( PANEL_COMMON_SETTINGS::OnScaleSlider ), + m_iconScaleSlider->Connect( wxEVT_SCROLL_THUMBTRACK, + wxScrollEventHandler( PANEL_COMMON_SETTINGS::OnScaleSlider ), nullptr, this ); - m_iconScaleSlider->Connect( wxEVT_SCROLL_THUMBRELEASE, - wxScrollEventHandler( PANEL_COMMON_SETTINGS::OnScaleSlider ), + m_iconScaleSlider->Connect( wxEVT_SCROLL_THUMBRELEASE, + wxScrollEventHandler( PANEL_COMMON_SETTINGS::OnScaleSlider ), nullptr, this ); m_iconScaleSlider->Connect( wxEVT_SCROLL_CHANGED, - wxScrollEventHandler( PANEL_COMMON_SETTINGS::OnScaleSlider ), + wxScrollEventHandler( PANEL_COMMON_SETTINGS::OnScaleSlider ), nullptr, this ); m_iconScaleAuto->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( PANEL_COMMON_SETTINGS::OnIconScaleAuto ), @@ -241,6 +241,7 @@ bool PANEL_COMMON_SETTINGS::TransferDataToWindow() m_defaultPDFViewer->SetValue( Pgm().UseSystemPdfBrowser() ); m_otherPDFViewer->SetValue( !Pgm().UseSystemPdfBrowser() ); m_PDFViewerPath->SetValue( Pgm().GetPdfBrowserName() ); + setPdfViewerPathState(); return true; } @@ -320,6 +321,7 @@ void PANEL_COMMON_SETTINGS::ResetPanel() m_defaultPDFViewer->SetValue( defaultSettings.m_System.use_system_pdf_viewer ); m_otherPDFViewer->SetValue( !defaultSettings.m_System.use_system_pdf_viewer ); m_PDFViewerPath->SetValue( defaultSettings.m_System.pdf_viewer_name ); + setPdfViewerPathState(); } @@ -471,8 +473,14 @@ void PANEL_COMMON_SETTINGS::OnPDFViewerClick( wxCommandEvent& event ) } -void PANEL_COMMON_SETTINGS::onUpdateUIPdfPath( wxUpdateUIEvent& event ) +void PANEL_COMMON_SETTINGS::OnRadioButtonPdfViewer( wxCommandEvent& event ) { - // Used by both the m_pdfViewerBtn and m_PDFViewerPath - event.Enable( m_otherPDFViewer->GetValue() ); + setPdfViewerPathState(); } + + +void PANEL_COMMON_SETTINGS::setPdfViewerPathState() +{ + m_PDFViewerPath->Enable( m_otherPDFViewer->GetValue() ); + m_pdfViewerBtn->Enable( m_otherPDFViewer->GetValue() ); +} \ No newline at end of file diff --git a/common/dialogs/panel_common_settings_base.cpp b/common/dialogs/panel_common_settings_base.cpp index 9e7af0a304..26bb6969b3 100644 --- a/common/dialogs/panel_common_settings_base.cpp +++ b/common/dialogs/panel_common_settings_base.cpp @@ -1,5 +1,5 @@ /////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version Oct 26 2018) +// C++ code generated with wxFormBuilder (version 3.10.0-4761b0c) // http://www.wxformbuilder.org/ // // PLEASE DO *NOT* EDIT THIS FILE! @@ -346,9 +346,9 @@ PANEL_COMMON_SETTINGS_BASE::PANEL_COMMON_SETTINGS_BASE( wxWindow* parent, wxWind // Connect Events m_textEditorBtn->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_COMMON_SETTINGS_BASE::OnTextEditorClick ), NULL, this ); - m_PDFViewerPath->Connect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( PANEL_COMMON_SETTINGS_BASE::onUpdateUIPdfPath ), NULL, this ); + m_defaultPDFViewer->Connect( wxEVT_COMMAND_RADIOBUTTON_SELECTED, wxCommandEventHandler( PANEL_COMMON_SETTINGS_BASE::OnRadioButtonPdfViewer ), NULL, this ); + m_otherPDFViewer->Connect( wxEVT_COMMAND_RADIOBUTTON_SELECTED, wxCommandEventHandler( PANEL_COMMON_SETTINGS_BASE::OnRadioButtonPdfViewer ), NULL, this ); m_pdfViewerBtn->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_COMMON_SETTINGS_BASE::OnPDFViewerClick ), NULL, this ); - m_pdfViewerBtn->Connect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( PANEL_COMMON_SETTINGS_BASE::onUpdateUIPdfPath ), NULL, this ); m_canvasScaleAuto->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( PANEL_COMMON_SETTINGS_BASE::OnCanvasScaleAuto ), NULL, this ); } @@ -356,9 +356,9 @@ PANEL_COMMON_SETTINGS_BASE::~PANEL_COMMON_SETTINGS_BASE() { // Disconnect Events m_textEditorBtn->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_COMMON_SETTINGS_BASE::OnTextEditorClick ), NULL, this ); - m_PDFViewerPath->Disconnect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( PANEL_COMMON_SETTINGS_BASE::onUpdateUIPdfPath ), NULL, this ); + m_defaultPDFViewer->Disconnect( wxEVT_COMMAND_RADIOBUTTON_SELECTED, wxCommandEventHandler( PANEL_COMMON_SETTINGS_BASE::OnRadioButtonPdfViewer ), NULL, this ); + m_otherPDFViewer->Disconnect( wxEVT_COMMAND_RADIOBUTTON_SELECTED, wxCommandEventHandler( PANEL_COMMON_SETTINGS_BASE::OnRadioButtonPdfViewer ), NULL, this ); m_pdfViewerBtn->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_COMMON_SETTINGS_BASE::OnPDFViewerClick ), NULL, this ); - m_pdfViewerBtn->Disconnect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( PANEL_COMMON_SETTINGS_BASE::onUpdateUIPdfPath ), NULL, this ); m_canvasScaleAuto->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( PANEL_COMMON_SETTINGS_BASE::OnCanvasScaleAuto ), NULL, this ); } diff --git a/common/dialogs/panel_common_settings_base.fbp b/common/dialogs/panel_common_settings_base.fbp index c4b81192f1..e5dc3ee334 100644 --- a/common/dialogs/panel_common_settings_base.fbp +++ b/common/dialogs/panel_common_settings_base.fbp @@ -1,6 +1,6 @@ - + C++ @@ -14,6 +14,7 @@ panel_common_settings_base 1000 none + 1 PanelCommonSettings @@ -25,6 +26,7 @@ 1 1 UI + 0 1 0 @@ -46,6 +48,7 @@ -1,-1 RESETTABLE_PANEL; widgets/resettable_panel.h; Not forward_declare + 0 wxTAB_TRAVERSAL @@ -515,6 +518,7 @@ + 0 @@ -658,6 +662,7 @@ + OnRadioButtonPdfViewer @@ -733,6 +738,7 @@ + OnRadioButtonPdfViewer @@ -797,7 +803,6 @@ - onUpdateUIPdfPath @@ -813,6 +818,7 @@ + 0 @@ -871,7 +877,6 @@ OnPDFViewerClick - onUpdateUIPdfPath diff --git a/common/dialogs/panel_common_settings_base.h b/common/dialogs/panel_common_settings_base.h index a7a8ebc509..36335a01ad 100644 --- a/common/dialogs/panel_common_settings_base.h +++ b/common/dialogs/panel_common_settings_base.h @@ -1,5 +1,5 @@ /////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version Oct 26 2018) +// C++ code generated with wxFormBuilder (version 3.10.0-4761b0c) // http://www.wxformbuilder.org/ // // PLEASE DO *NOT* EDIT THIS FILE! @@ -89,9 +89,9 @@ class PANEL_COMMON_SETTINGS_BASE : public RESETTABLE_PANEL wxSpinCtrl* m_backupLimitTotalSize; wxStaticText* m_staticText17; - // Virtual event handlers, overide them in your derived class + // Virtual event handlers, override them in your derived class virtual void OnTextEditorClick( wxCommandEvent& event ) { event.Skip(); } - virtual void onUpdateUIPdfPath( wxUpdateUIEvent& event ) { event.Skip(); } + virtual void OnRadioButtonPdfViewer( wxCommandEvent& event ) { event.Skip(); } virtual void OnPDFViewerClick( wxCommandEvent& event ) { event.Skip(); } virtual void OnCanvasScaleAuto( wxCommandEvent& event ) { event.Skip(); } @@ -99,6 +99,7 @@ class PANEL_COMMON_SETTINGS_BASE : public RESETTABLE_PANEL public: PANEL_COMMON_SETTINGS_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxTAB_TRAVERSAL, const wxString& name = wxEmptyString ); + ~PANEL_COMMON_SETTINGS_BASE(); }; diff --git a/include/dialogs/panel_common_settings.h b/include/dialogs/panel_common_settings.h index 3aba49136a..7b02e9cbf2 100644 --- a/include/dialogs/panel_common_settings.h +++ b/include/dialogs/panel_common_settings.h @@ -50,7 +50,7 @@ protected: void OnIconScaleAuto( wxCommandEvent& aEvent ); void OnTextEditorClick( wxCommandEvent& event ) override; void OnPDFViewerClick( wxCommandEvent& event ) override; - void onUpdateUIPdfPath( wxUpdateUIEvent& event ) override; + void OnRadioButtonPdfViewer( wxCommandEvent& event ) override; /** * Event fired when the canvas scale field is modified @@ -62,6 +62,9 @@ protected: */ void OnCanvasScaleAuto( wxCommandEvent& aEvent ) override; +private: + void setPdfViewerPathState(); + protected: DIALOG_SHIM* m_dialog;