Make sure plugins table has columns wide enough for headers.

Don't expect wxWidgets to return appropriate values for this.  At
least not in the version we're using.

Fixes https://gitlab.com/kicad/code/kicad/issues/1916
This commit is contained in:
Jeff Young 2020-08-05 19:37:04 +01:00
parent 73832a9708
commit b26ced820c
1 changed files with 5 additions and 1 deletions

View File

@ -29,6 +29,7 @@
#include <grid_tricks.h>
#include <widgets/wx_grid.h>
#define GRID_CELL_MARGIN 4
PANEL_PCBNEW_ACTION_PLUGINS::PANEL_PCBNEW_ACTION_PLUGINS( PCB_EDIT_FRAME* aFrame,
PAGED_DIALOG* aWindow ) :
@ -193,8 +194,11 @@ bool PANEL_PCBNEW_ACTION_PLUGINS::TransferDataToWindow()
for( int col = 0; col < m_grid->GetNumberCols(); col++ )
{
const wxString& heading = m_grid->GetColLabelValue( col );
int headingWidth = GetTextExtent( heading ).x + 2 * GRID_CELL_MARGIN;
// Set the minimal width to the column label size.
m_grid->SetColMinimalWidth( col, m_grid->GetVisibleWidth( col, true, false, false ) );
m_grid->SetColMinimalWidth( col, headingWidth );
// Set the width to see the full contents
m_grid->SetColSize( col, m_grid->GetVisibleWidth( col, true, true, false ) );
}