Adjust grid cols for large fonts and/or long translations.

Fixes: lp:1788495
* https://bugs.launchpad.net/kicad/+bug/1788495
This commit is contained in:
Jeff Young 2018-08-23 11:59:37 +01:00
parent 51a128e323
commit 8957008c2a
1 changed files with 9 additions and 1 deletions

View File

@ -26,6 +26,9 @@
#include "wx_grid.h"
#define MIN_GRIDCELL_MARGIN 3
void WX_GRID::SetTable( wxGridTableBase* aTable )
{
// wxGrid::SetTable() messes up the column widths from wxFormBuilder so we have to save
@ -38,7 +41,12 @@ void WX_GRID::SetTable( wxGridTableBase* aTable )
wxGrid::SetTable( aTable );
for( int i = 0; i < GetNumberCols(); ++i )
SetColSize( i, formBuilderColWidths[ i ] );
{
// correct wxFormBuilder width for large fonts and/or long translations
int headingWidth = GetTextExtent( GetColLabelValue( i ) ).x + 2 * MIN_GRIDCELL_MARGIN;
SetColSize( i, std::max( formBuilderColWidths[ i ], headingWidth ) );
}
delete[] formBuilderColWidths;
}