From d6c6116e67f56c1115ed7441ad18309ec6d92d56 Mon Sep 17 00:00:00 2001 From: Simon Richter Date: Fri, 25 Nov 2022 07:35:49 +0100 Subject: [PATCH] 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. --- common/dialogs/panel_setup_netclasses.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/common/dialogs/panel_setup_netclasses.cpp b/common/dialogs/panel_setup_netclasses.cpp index b65921ea86..114397e406 100644 --- a/common/dialogs/panel_setup_netclasses.cpp +++ b/common/dialogs/panel_setup_netclasses.cpp @@ -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 ] ); }