libedit: Control resize requests

Another GTK3 dialog with excessive resize requests.  Control the number
for re-draws based on grid size.

Fixes: lp:1818325
* https://bugs.launchpad.net/kicad/+bug/1818325
This commit is contained in:
Seth Hillbrand 2019-03-02 05:47:10 -08:00
parent 8d26b07f67
commit 84a1772e66
2 changed files with 11 additions and 3 deletions

View File

@ -68,7 +68,8 @@ DIALOG_EDIT_COMPONENT_IN_LIBRARY::DIALOG_EDIT_COMPONENT_IN_LIBRARY( LIB_EDIT_FRA
m_delayedFocusGrid( nullptr ), m_delayedFocusGrid( nullptr ),
m_delayedFocusRow( -1 ), m_delayedFocusRow( -1 ),
m_delayedFocusColumn( -1 ), m_delayedFocusColumn( -1 ),
m_delayedFocusPage( -1 ) m_delayedFocusPage( -1 ),
m_width( 0 )
{ {
m_config = Kiface().KifaceSettings(); m_config = Kiface().KifaceSettings();
@ -800,6 +801,8 @@ void DIALOG_EDIT_COMPONENT_IN_LIBRARY::OnEditFootprintFilter( wxCommandEvent& ev
void DIALOG_EDIT_COMPONENT_IN_LIBRARY::adjustGridColumns( int aWidth ) void DIALOG_EDIT_COMPONENT_IN_LIBRARY::adjustGridColumns( int aWidth )
{ {
m_width = aWidth;
// Account for scroll bars // Account for scroll bars
aWidth -= ( m_grid->GetSize().x - m_grid->GetClientSize().x ); aWidth -= ( m_grid->GetSize().x - m_grid->GetClientSize().x );
@ -906,9 +909,13 @@ void DIALOG_EDIT_COMPONENT_IN_LIBRARY::OnUpdateUI( wxUpdateUIEvent& event )
void DIALOG_EDIT_COMPONENT_IN_LIBRARY::OnSizeGrid( wxSizeEvent& event ) void DIALOG_EDIT_COMPONENT_IN_LIBRARY::OnSizeGrid( wxSizeEvent& event )
{ {
adjustGridColumns( event.GetSize().GetX() ); auto new_size = event.GetSize().GetX();
event.Skip(); if( new_size != m_width )
{
adjustGridColumns( event.GetSize().GetX() );
event.Skip();
}
} }

View File

@ -60,6 +60,7 @@ public:
wxString m_delayedErrorMessage; wxString m_delayedErrorMessage;
wxString m_shownColumns; wxString m_shownColumns;
int m_width;
bool TransferDataToWindow() override; bool TransferDataToWindow() override;
bool TransferDataFromWindow() override; bool TransferDataFromWindow() override;