From 899c8ccc8ddafd2b0ab8296897f67bae8d3bfa91 Mon Sep 17 00:00:00 2001 From: Jeff Young Date: Fri, 24 May 2019 19:29:38 +0100 Subject: [PATCH] Highlight currently active inspector Apply button. --- pagelayout_editor/dialogs/properties_frame_base.cpp | 2 ++ pagelayout_editor/dialogs/properties_frame_base.fbp | 2 +- pagelayout_editor/dialogs/properties_frame_base.h | 1 + pagelayout_editor/properties_frame.cpp | 13 +++++++++++++ pagelayout_editor/properties_frame.h | 1 + 5 files changed, 18 insertions(+), 1 deletion(-) diff --git a/pagelayout_editor/dialogs/properties_frame_base.cpp b/pagelayout_editor/dialogs/properties_frame_base.cpp index adae1b3215..69666dccc3 100644 --- a/pagelayout_editor/dialogs/properties_frame_base.cpp +++ b/pagelayout_editor/dialogs/properties_frame_base.cpp @@ -670,6 +670,7 @@ PANEL_PROPERTIES_BASE::PANEL_PROPERTIES_BASE( wxWindow* parent, wxWindowID id, c this->Layout(); // Connect Events + m_notebook->Connect( wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED, wxNotebookEventHandler( PANEL_PROPERTIES_BASE::OnPageChanged ), NULL, this ); m_buttonOK->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_PROPERTIES_BASE::OnAcceptPrms ), NULL, this ); m_buttonDefault->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_PROPERTIES_BASE::OnSetDefaultValues ), NULL, this ); m_buttonGeneralOptsOK->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_PROPERTIES_BASE::OnAcceptPrms ), NULL, this ); @@ -678,6 +679,7 @@ PANEL_PROPERTIES_BASE::PANEL_PROPERTIES_BASE( wxWindow* parent, wxWindowID id, c PANEL_PROPERTIES_BASE::~PANEL_PROPERTIES_BASE() { // Disconnect Events + m_notebook->Disconnect( wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED, wxNotebookEventHandler( PANEL_PROPERTIES_BASE::OnPageChanged ), NULL, this ); m_buttonOK->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_PROPERTIES_BASE::OnAcceptPrms ), NULL, this ); m_buttonDefault->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_PROPERTIES_BASE::OnSetDefaultValues ), NULL, this ); m_buttonGeneralOptsOK->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_PROPERTIES_BASE::OnAcceptPrms ), NULL, this ); diff --git a/pagelayout_editor/dialogs/properties_frame_base.fbp b/pagelayout_editor/dialogs/properties_frame_base.fbp index 82c8f8845c..6346f773f4 100644 --- a/pagelayout_editor/dialogs/properties_frame_base.fbp +++ b/pagelayout_editor/dialogs/properties_frame_base.fbp @@ -156,7 +156,7 @@ - + OnPageChanged diff --git a/pagelayout_editor/dialogs/properties_frame_base.h b/pagelayout_editor/dialogs/properties_frame_base.h index 44b4f25ab3..c94d057cda 100644 --- a/pagelayout_editor/dialogs/properties_frame_base.h +++ b/pagelayout_editor/dialogs/properties_frame_base.h @@ -145,6 +145,7 @@ class PANEL_PROPERTIES_BASE : public wxPanel wxButton* m_buttonGeneralOptsOK; // Virtual event handlers, overide them in your derived class + virtual void OnPageChanged( wxNotebookEvent& event ) { event.Skip(); } virtual void OnAcceptPrms( wxCommandEvent& event ) { event.Skip(); } virtual void OnSetDefaultValues( wxCommandEvent& event ) { event.Skip(); } diff --git a/pagelayout_editor/properties_frame.cpp b/pagelayout_editor/properties_frame.cpp index 29392815c2..987724c52a 100644 --- a/pagelayout_editor/properties_frame.cpp +++ b/pagelayout_editor/properties_frame.cpp @@ -40,6 +40,8 @@ PROPERTIES_FRAME::PROPERTIES_FRAME( PL_EDITOR_FRAME* aParent ): infoFont.SetSymbolicSize( wxFONTSIZE_X_SMALL ); m_staticTextSizeInfo->SetFont( infoFont ); m_staticTextInfoThickness->SetFont( infoFont ); + + m_buttonOK->SetDefault(); } @@ -48,6 +50,17 @@ PROPERTIES_FRAME::~PROPERTIES_FRAME() } +void PROPERTIES_FRAME::OnPageChanged( wxNotebookEvent& event ) +{ + if( event.GetSelection() == 0 ) + m_buttonOK->SetDefault(); + else + m_buttonGeneralOptsOK->SetDefault(); + + event.Skip(); +} + + wxSize PROPERTIES_FRAME::GetMinSize() const { return wxSize( 150, -1 ); diff --git a/pagelayout_editor/properties_frame.h b/pagelayout_editor/properties_frame.h index 63275a2cc6..1fd1f609ff 100644 --- a/pagelayout_editor/properties_frame.h +++ b/pagelayout_editor/properties_frame.h @@ -47,6 +47,7 @@ public: ~PROPERTIES_FRAME(); // Event functions + void OnPageChanged( wxNotebookEvent& event ) override; void OnAcceptPrms( wxCommandEvent& event ) override; void OnSetDefaultValues( wxCommandEvent& event ) override;