Remove UpdateUI from preferences pdf viewer option

This commit is contained in:
Marek Roszko 2021-12-30 11:36:01 -05:00
parent e75d283007
commit c7447f9be6
5 changed files with 46 additions and 29 deletions

View File

@ -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() );
}

View File

@ -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 );
}

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<wxFormBuilder_Project>
<FileVersion major="1" minor="15" />
<FileVersion major="1" minor="16" />
<object class="Project" expanded="1">
<property name="class_decoration"></property>
<property name="code_generation">C++</property>
@ -14,6 +14,7 @@
<property name="file">panel_common_settings_base</property>
<property name="first_id">1000</property>
<property name="help_provider">none</property>
<property name="image_path_wrapper_function_name"></property>
<property name="indent_with_spaces"></property>
<property name="internationalize">1</property>
<property name="name">PanelCommonSettings</property>
@ -25,6 +26,7 @@
<property name="skip_php_events">1</property>
<property name="skip_python_events">1</property>
<property name="ui_table">UI</property>
<property name="use_array_enum">0</property>
<property name="use_enum">1</property>
<property name="use_microsoft_bom">0</property>
<object class="Panel" expanded="1">
@ -46,6 +48,7 @@
<property name="size">-1,-1</property>
<property name="subclass">RESETTABLE_PANEL; widgets/resettable_panel.h; Not forward_declare</property>
<property name="tooltip"></property>
<property name="two_step_creation">0</property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style">wxTAB_TRAVERSAL</property>
@ -515,6 +518,7 @@
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="auth_needed">0</property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="bitmap"></property>
@ -658,6 +662,7 @@
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnRadioButton">OnRadioButtonPdfViewer</event>
</object>
</object>
</object>
@ -733,6 +738,7 @@
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnRadioButton">OnRadioButtonPdfViewer</event>
</object>
</object>
<object class="sizeritem" expanded="1">
@ -797,7 +803,6 @@
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnUpdateUI">onUpdateUIPdfPath</event>
</object>
</object>
<object class="sizeritem" expanded="1">
@ -813,6 +818,7 @@
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="auth_needed">0</property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="bitmap"></property>
@ -871,7 +877,6 @@
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnButtonClick">OnPDFViewerClick</event>
<event name="OnUpdateUI">onUpdateUIPdfPath</event>
</object>
</object>
</object>

View File

@ -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();
};

View File

@ -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;