From 75e46a0037510000db724e504fe031cf91adbfc1 Mon Sep 17 00:00:00 2001 From: Seth Hillbrand Date: Fri, 30 Oct 2020 10:40:13 -0700 Subject: [PATCH] Fix sizing of Configure Paths On GTK, the grid shoudl not be marked dirty unless the size of the grid actually changes. Doing so prevents focus loss on the edit field --- common/dialogs/dialog_configure_paths.cpp | 13 ++++--------- common/dialogs/dialog_configure_paths_base.cpp | 4 +--- common/dialogs/dialog_configure_paths_base.fbp | 10 +--------- common/dialogs/dialog_configure_paths_base.h | 4 ++-- include/dialogs/dialog_configure_paths.h | 2 +- 5 files changed, 9 insertions(+), 24 deletions(-) diff --git a/common/dialogs/dialog_configure_paths.cpp b/common/dialogs/dialog_configure_paths.cpp index 4c1246da9f..e9b9fb29f9 100644 --- a/common/dialogs/dialog_configure_paths.cpp +++ b/common/dialogs/dialog_configure_paths.cpp @@ -58,6 +58,7 @@ DIALOG_CONFIGURE_PATHS::DIALOG_CONFIGURE_PATHS( wxWindow* aParent, FILENAME_RESO m_errorRow( -1 ), m_errorCol( -1 ), m_resolver( aResolver ), + m_gridWidth( 0 ), m_gridWidthsDirty( true ), m_helpDialog( nullptr ) { @@ -507,14 +508,6 @@ void DIALOG_CONFIGURE_PATHS::OnGridCellRightClick( wxGridEvent& aEvent ) } -void DIALOG_CONFIGURE_PATHS::OnGridCellChange( wxGridEvent& aEvent ) -{ - m_gridWidthsDirty = true; - - aEvent.Skip(); -} - - void DIALOG_CONFIGURE_PATHS::OnUpdateUI( wxUpdateUIEvent& event ) { if( m_gridWidthsDirty ) @@ -536,6 +529,7 @@ void DIALOG_CONFIGURE_PATHS::OnUpdateUI( wxUpdateUIEvent& event ) m_SearchPaths->SetColSize( SP_DESC_COL, width - ( m_SearchPaths->GetColSize( SP_ALIAS_COL ) + m_SearchPaths->GetColSize( SP_PATH_COL ) ) ); + m_gridWidth = m_EnvVars->GetSize().GetX(); m_gridWidthsDirty = false; } @@ -564,7 +558,8 @@ void DIALOG_CONFIGURE_PATHS::OnUpdateUI( wxUpdateUIEvent& event ) void DIALOG_CONFIGURE_PATHS::OnGridSize( wxSizeEvent& event ) { - m_gridWidthsDirty = true; + if( event.GetSize().GetX() != m_gridWidth ) + m_gridWidthsDirty = true; event.Skip(); } diff --git a/common/dialogs/dialog_configure_paths_base.cpp b/common/dialogs/dialog_configure_paths_base.cpp index b1630727fa..89e52fc3ed 100644 --- a/common/dialogs/dialog_configure_paths_base.cpp +++ b/common/dialogs/dialog_configure_paths_base.cpp @@ -1,5 +1,5 @@ /////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version 3.9.0 Jun 3 2020) +// C++ code generated with wxFormBuilder (version 3.9.0 Jul 27 2020) // http://www.wxformbuilder.org/ // // PLEASE DO *NOT* EDIT THIS FILE! @@ -152,7 +152,6 @@ DIALOG_CONFIGURE_PATHS_BASE::DIALOG_CONFIGURE_PATHS_BASE( wxWindow* parent, wxWi // Connect Events this->Connect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( DIALOG_CONFIGURE_PATHS_BASE::OnUpdateUI ) ); - m_EnvVars->Connect( wxEVT_GRID_CELL_CHANGED, wxGridEventHandler( DIALOG_CONFIGURE_PATHS_BASE::OnGridCellChange ), NULL, this ); m_EnvVars->Connect( wxEVT_SIZE, wxSizeEventHandler( DIALOG_CONFIGURE_PATHS_BASE::OnGridSize ), NULL, this ); m_btnAddEnvVar->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_CONFIGURE_PATHS_BASE::OnAddEnvVar ), NULL, this ); m_btnDeleteEnvVar->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_CONFIGURE_PATHS_BASE::OnRemoveEnvVar ), NULL, this ); @@ -169,7 +168,6 @@ DIALOG_CONFIGURE_PATHS_BASE::~DIALOG_CONFIGURE_PATHS_BASE() { // Disconnect Events this->Disconnect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( DIALOG_CONFIGURE_PATHS_BASE::OnUpdateUI ) ); - m_EnvVars->Disconnect( wxEVT_GRID_CELL_CHANGED, wxGridEventHandler( DIALOG_CONFIGURE_PATHS_BASE::OnGridCellChange ), NULL, this ); m_EnvVars->Disconnect( wxEVT_SIZE, wxSizeEventHandler( DIALOG_CONFIGURE_PATHS_BASE::OnGridSize ), NULL, this ); m_btnAddEnvVar->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_CONFIGURE_PATHS_BASE::OnAddEnvVar ), NULL, this ); m_btnDeleteEnvVar->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_CONFIGURE_PATHS_BASE::OnRemoveEnvVar ), NULL, this ); diff --git a/common/dialogs/dialog_configure_paths_base.fbp b/common/dialogs/dialog_configure_paths_base.fbp index 3c057879b2..2626a392e2 100644 --- a/common/dialogs/dialog_configure_paths_base.fbp +++ b/common/dialogs/dialog_configure_paths_base.fbp @@ -14,7 +14,6 @@ dialog_configure_paths_base 1000 none - 1 DIALOG_CONFIGURE_PATHS_BASE @@ -26,7 +25,6 @@ 1 1 UI - 0 0 0 @@ -55,6 +53,7 @@ + OnWindowSize OnUpdateUI @@ -159,7 +158,6 @@ - OnGridCellChange OnGridSize @@ -185,7 +183,6 @@ - 0 @@ -269,7 +266,6 @@ - 0 @@ -458,7 +454,6 @@ - 0 @@ -532,7 +527,6 @@ - 0 @@ -606,7 +600,6 @@ - 0 @@ -690,7 +683,6 @@ - 0 diff --git a/common/dialogs/dialog_configure_paths_base.h b/common/dialogs/dialog_configure_paths_base.h index 0eadbb4bc9..8348640bcb 100644 --- a/common/dialogs/dialog_configure_paths_base.h +++ b/common/dialogs/dialog_configure_paths_base.h @@ -1,5 +1,5 @@ /////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version 3.9.0 Jun 3 2020) +// C++ code generated with wxFormBuilder (version 3.9.0 Jul 27 2020) // http://www.wxformbuilder.org/ // // PLEASE DO *NOT* EDIT THIS FILE! @@ -55,10 +55,10 @@ class DIALOG_CONFIGURE_PATHS_BASE : public DIALOG_SHIM // Virtual event handlers, overide them in your derived class virtual void OnUpdateUI( wxUpdateUIEvent& event ) { event.Skip(); } - virtual void OnGridCellChange( wxGridEvent& event ) { event.Skip(); } virtual void OnGridSize( wxSizeEvent& event ) { event.Skip(); } virtual void OnAddEnvVar( wxCommandEvent& event ) { event.Skip(); } virtual void OnRemoveEnvVar( wxCommandEvent& event ) { event.Skip(); } + virtual void OnGridCellChange( wxGridEvent& event ) { event.Skip(); } virtual void OnGridCellRightClick( wxGridEvent& event ) { event.Skip(); } virtual void OnAddSearchPath( wxCommandEvent& event ) { event.Skip(); } virtual void OnSearchPathMoveUp( wxCommandEvent& event ) { event.Skip(); } diff --git a/include/dialogs/dialog_configure_paths.h b/include/dialogs/dialog_configure_paths.h index 3f8051a076..0c6ed8682c 100644 --- a/include/dialogs/dialog_configure_paths.h +++ b/include/dialogs/dialog_configure_paths.h @@ -48,7 +48,6 @@ public: protected: // Various button callbacks void OnGridCellRightClick( wxGridEvent& event ) override; - void OnGridCellChange( wxGridEvent& event ) override; void OnGridSize( wxSizeEvent& event ) override; void OnUpdateUI( wxUpdateUIEvent& event ) override; void OnGridCellChanging( wxGridEvent& event ); @@ -73,6 +72,7 @@ private: wxString m_curdir; wxTextValidator m_aliasValidator; + int m_gridWidth; bool m_gridWidthsDirty; HTML_MESSAGE_BOX* m_helpDialog;