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
This commit is contained in:
Seth Hillbrand 2020-10-30 10:40:13 -07:00
parent 536bba294b
commit 75e46a0037
5 changed files with 9 additions and 24 deletions

View File

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

View File

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

View File

@ -14,7 +14,6 @@
<property name="file">dialog_configure_paths_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">DIALOG_CONFIGURE_PATHS_BASE</property>
@ -26,7 +25,6 @@
<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">0</property>
<property name="use_microsoft_bom">0</property>
<object class="Dialog" expanded="1">
@ -55,6 +53,7 @@
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnSize">OnWindowSize</event>
<event name="OnUpdateUI">OnUpdateUI</event>
<object class="wxBoxSizer" expanded="1">
<property name="minimum_size"></property>
@ -159,7 +158,6 @@
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnGridCellChange">OnGridCellChange</event>
<event name="OnSize">OnGridSize</event>
</object>
</object>
@ -185,7 +183,6 @@
<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>
@ -269,7 +266,6 @@
<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>
@ -458,7 +454,6 @@
<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>
@ -532,7 +527,6 @@
<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>
@ -606,7 +600,6 @@
<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>
@ -690,7 +683,6 @@
<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>

View File

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

View File

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