Try a bigger hammer to keep wxFormBuilder from messing up grid fonts.

Fixes https://gitlab.com/kicad/code/kicad/issues/13547
This commit is contained in:
Jeff Young 2023-01-17 13:24:49 +00:00
parent 7361414f4c
commit 8ac0543a5e
2 changed files with 19 additions and 2 deletions

View File

@ -1,7 +1,7 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2018-2022 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 2018-2023 KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@ -103,6 +103,7 @@ WX_GRID::WX_GRID( wxWindow *parent, wxWindowID id, const wxPoint& pos, const wxS
// Make sure the GUI font scales properly
SetDefaultCellFont( KIUI::GetControlFont( this ) );
SetLabelFont( KIUI::GetControlFont( this ) );
if( GetColLabelSize() > 0 )
SetColLabelSize( GetColLabelSize() + 4 );
@ -191,6 +192,20 @@ void WX_GRID::SetTable( wxGridTableBase* aTable, bool aTakeOwnership )
}
bool WX_GRID::Show( bool aShow )
{
// Don't let wxFormBuilder override the fonts. It's always the wrong answer as it will set
// a fixed-size, non-scaling, non-HiDPI-aware font.
if( aShow )
{
SetDefaultCellFont( KIUI::GetControlFont( this ) );
SetLabelFont( KIUI::GetControlFont( this ) );
}
return wxGrid::Show( aShow );
}
void WX_GRID::onGridCellSelect( wxGridEvent& aEvent )
{
// Highlight the selected cell.

View File

@ -1,7 +1,7 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2018-2022 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 2018-2023 KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@ -136,6 +136,8 @@ public:
DeleteRows( 0, GetNumberRows() );
}
bool Show( bool aShow ) override;
protected:
/**
* A re-implementation of wxGrid::DrawColLabel which left-aligns the first column and draws