Calculate weighted column width locally

Multiplying the global variable also modifies all columns to the right,
which is not a problem right now because none exist, but might be in the
future.
This commit is contained in:
Simon Richter 2022-11-25 07:35:49 +01:00 committed by Ian McInerney
parent add082548d
commit d6c6116e67
1 changed files with 5 additions and 3 deletions

View File

@ -116,13 +116,15 @@ PANEL_SETUP_NETCLASSES::PANEL_SETUP_NETCLASSES( PAGED_DIALOG* aParent, EDA_DRAW_
// as this initial width is sometimes strange depending on the language (wxGrid bug?)
int min_width = m_netclassGrid->GetVisibleWidth( i, true, true );
if( i == GRID_LINESTYLE )
min_best_width *= 1.5;
int weighted_min_best_width =
( i == GRID_LINESTYLE )
? min_best_width * 3 / 2
: min_best_width;
m_netclassGrid->SetColMinimalWidth( i, min_width );
// We use a "best size" >= min_best_width
m_originalColWidths[ i ] = std::max( min_width, min_best_width );
m_originalColWidths[ i ] = std::max( min_width, weighted_min_best_width );
m_netclassGrid->SetColSize( i, m_originalColWidths[ i ] );
}