From 8015334683bf794d418df377e14110a2de3a657a Mon Sep 17 00:00:00 2001 From: Jeff Young Date: Fri, 5 Oct 2018 13:54:15 +0100 Subject: [PATCH] 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 --- .../dialogs/dialog_fields_editor_global.cpp | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/eeschema/dialogs/dialog_fields_editor_global.cpp b/eeschema/dialogs/dialog_fields_editor_global.cpp index d2d2b67005..f893fc1b7c 100644 --- a/eeschema/dialogs/dialog_fields_editor_global.cpp +++ b/eeschema/dialogs/dialog_fields_editor_global.cpp @@ -721,13 +721,18 @@ DIALOG_FIELDS_EDITOR_GLOBAL::DIALOG_FIELDS_EDITOR_GLOBAL( SCH_EDIT_FRAME* parent m_grid->AutoSizeColumns( false ); for( int col = 0; col < m_grid->GetNumberCols(); ++ col ) { - int textWidth = m_dataModel->GetDataWidth( col ) + COLUMN_MARGIN; - int maxWidth = defaultDlgSize.x / 3; + // 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 maxWidth = defaultDlgSize.x / 3; - if( col == m_grid->GetNumberCols() - 1 ) - m_grid->SetColSize( col, std::min( std::max( 50, textWidth ), maxWidth ) ); - else - m_grid->SetColSize( col, std::min( std::max( 100, textWidth ), maxWidth ) ); + if( col == m_grid->GetNumberCols() - 1 ) + m_grid->SetColSize( col, std::min( std::max( 50, textWidth ), maxWidth ) ); + else + m_grid->SetColSize( col, std::min( std::max( 100, textWidth ), maxWidth ) ); + } } m_grid->SetGridCursor( 0, 1 );