Don't resize hidden columns.

wxGrid columns are hidden by setting their width to 0.  Resizing
them will "unhide" them.

Fixes: lp:1796150
* https://bugs.launchpad.net/kicad/+bug/1796150
This commit is contained in:
Jeff Young 2018-10-05 13:54:15 +01:00
parent 895e187ca0
commit 8015334683
1 changed files with 11 additions and 6 deletions

View File

@ -720,6 +720,10 @@ DIALOG_FIELDS_EDITOR_GLOBAL::DIALOG_FIELDS_EDITOR_GLOBAL( SCH_EDIT_FRAME* parent
m_grid->AutoSizeColumns( false ); m_grid->AutoSizeColumns( false );
for( int col = 0; col < m_grid->GetNumberCols(); ++ col ) for( int col = 0; col < m_grid->GetNumberCols(); ++ col )
{
// Columns are hidden by setting their width to 0 so if we resize them they will
// become unhidden.
if( m_grid->IsColShown( col ) )
{ {
int textWidth = m_dataModel->GetDataWidth( col ) + COLUMN_MARGIN; int textWidth = m_dataModel->GetDataWidth( col ) + COLUMN_MARGIN;
int maxWidth = defaultDlgSize.x / 3; int maxWidth = defaultDlgSize.x / 3;
@ -729,6 +733,7 @@ DIALOG_FIELDS_EDITOR_GLOBAL::DIALOG_FIELDS_EDITOR_GLOBAL( SCH_EDIT_FRAME* parent
else else
m_grid->SetColSize( col, std::min( std::max( 100, textWidth ), maxWidth ) ); m_grid->SetColSize( col, std::min( std::max( 100, textWidth ), maxWidth ) );
} }
}
m_grid->SetGridCursor( 0, 1 ); m_grid->SetGridCursor( 0, 1 );
SetInitialFocus( m_grid ); SetInitialFocus( m_grid );