Another round of changes to attempt to fix the GTK font size issue.
Fixes https://gitlab.com/kicad/code/kicad/issues/8608
This commit is contained in:
parent
29c2f3b7d4
commit
7a822b55aa
|
@ -136,7 +136,7 @@ PANEL_SETUP_NETCLASSES::PANEL_SETUP_NETCLASSES( PAGED_DIALOG* aParent, NETCLASSE
|
|||
attr->SetEditor( new GRID_CELL_ICON_TEXT_POPUP( g_lineStyleIcons, g_lineStyleNames ) );
|
||||
m_netclassGrid->SetColAttr( GRID_LINESTYLE, attr );
|
||||
|
||||
m_colorDefaultHelpText->SetFont( KIUI::GetInfoFont() );
|
||||
m_colorDefaultHelpText->SetFont( KIUI::GetInfoFont( this ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -145,7 +145,7 @@ EDA_DRAW_FRAME::EDA_DRAW_FRAME( KIWAY* aKiway, wxWindow* aParent, FRAME_T aFrame
|
|||
};
|
||||
|
||||
SetStatusWidths( arrayDim( dims ), dims );
|
||||
stsbar->SetFont( KIUI::GetStatusFont() );
|
||||
stsbar->SetFont( KIUI::GetStatusFont( this ) );
|
||||
|
||||
// Create child subwindows.
|
||||
GetClientSize( &m_frameSize.x, &m_frameSize.y );
|
||||
|
|
|
@ -338,7 +338,7 @@ void ACTION_MENU::updateHotKeys()
|
|||
const TOOL_ACTION& action = *ii.second;
|
||||
int key = toolMgr->GetHotKey( action ) & ~MD_MODIFIER_MASK;
|
||||
|
||||
if( key )
|
||||
if( key >= 0 )
|
||||
{
|
||||
int mod = toolMgr->GetHotKey( action ) & MD_MODIFIER_MASK;
|
||||
int flags = 0;
|
||||
|
|
|
@ -48,7 +48,7 @@ EDA_MSG_PANEL::EDA_MSG_PANEL( wxWindow* aParent, int aId,
|
|||
long style, const wxString &name ) :
|
||||
wxPanel( aParent, aId, aPosition, aSize, style, name )
|
||||
{
|
||||
SetFont( KIUI::GetStatusFont() );
|
||||
SetFont( KIUI::GetStatusFont( this ) );
|
||||
SetBackgroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_BTNFACE ) );
|
||||
|
||||
// informs wx not to paint the background itself as we will paint it later in erase()
|
||||
|
@ -65,16 +65,24 @@ EDA_MSG_PANEL::~EDA_MSG_PANEL()
|
|||
}
|
||||
|
||||
|
||||
int EDA_MSG_PANEL::GetRequiredHeight()
|
||||
wxSize computeFontSize()
|
||||
{
|
||||
// Get size of the wxSYS_DEFAULT_GUI_FONT
|
||||
wxSize fontSizeInPixels;
|
||||
|
||||
wxScreenDC dc;
|
||||
|
||||
dc.SetFont( KIUI::GetStatusFont() );
|
||||
dc.SetFont( wxSystemSettings::GetFont( wxSYS_DEFAULT_GUI_FONT ) );
|
||||
dc.GetTextExtent( wxT( "W" ), &fontSizeInPixels.x, &fontSizeInPixels.y );
|
||||
|
||||
return fontSizeInPixels;
|
||||
}
|
||||
|
||||
|
||||
int EDA_MSG_PANEL::GetRequiredHeight()
|
||||
{
|
||||
// make space for two rows of text plus a number of pixels between them.
|
||||
return 2 * fontSizeInPixels.y + 0;
|
||||
return 2 * computeFontSize().y + 0;
|
||||
}
|
||||
|
||||
|
||||
|
@ -87,7 +95,7 @@ void EDA_MSG_PANEL::OnPaint( wxPaintEvent& aEvent )
|
|||
dc.SetBackground( wxSystemSettings::GetColour( wxSYS_COLOUR_BTNFACE ) );
|
||||
dc.SetBackgroundMode( wxSOLID );
|
||||
dc.SetTextBackground( wxSystemSettings::GetColour( wxSYS_COLOUR_BTNFACE ) );
|
||||
dc.SetFont( KIUI::GetStatusFont() );
|
||||
dc.SetFont( KIUI::GetStatusFont( this ) );
|
||||
|
||||
for( const MSG_PANEL_ITEM& item : m_Items )
|
||||
showItem( dc, item );
|
||||
|
|
|
@ -94,10 +94,25 @@ wxFont KIUI::GetMonospacedUIFont()
|
|||
}
|
||||
|
||||
|
||||
wxFont KIUI::GetInfoFont()
|
||||
wxFont makeGUIFont( wxWindow* aWindow, int aDialogSize )
|
||||
{
|
||||
wxFont font = wxSystemSettings::GetFont( wxSYS_DEFAULT_GUI_FONT );
|
||||
font.SetSymbolicSize( wxFONTSIZE_SMALL );
|
||||
|
||||
// Using wxFont::SetSymbolicSize() fails on (at least) GTK with HiDPI screens, so we have
|
||||
// to build our own version based off our icon scaling architecture.
|
||||
|
||||
int vert_size = aWindow->ConvertDialogToPixels( wxSize( 0, aDialogSize ) ).y;
|
||||
|
||||
if( Pgm().GetCommonSettings()->m_Appearance.icon_scale > 0 )
|
||||
vert_size *= Pgm().GetCommonSettings()->m_Appearance.icon_scale / 4;
|
||||
|
||||
if( vert_size < 7 )
|
||||
vert_size = 7;
|
||||
|
||||
if( vert_size < 10 )
|
||||
vert_size += 1;
|
||||
|
||||
font.SetPointSize( vert_size );
|
||||
|
||||
#ifdef __WXMAC__
|
||||
// https://trac.wxwidgets.org/ticket/19210
|
||||
|
@ -109,16 +124,21 @@ wxFont KIUI::GetInfoFont()
|
|||
}
|
||||
|
||||
|
||||
wxFont KIUI::GetStatusFont()
|
||||
wxFont KIUI::GetControlFont( wxWindow* aWindow )
|
||||
{
|
||||
// wxFONTSIZE_X_SMALL is too small, so we take the wxFONTSIZE_SMALL infofont and adjust
|
||||
// it by wxFONTSIZE_SMALL again.
|
||||
return makeGUIFont( aWindow, 7 );
|
||||
}
|
||||
|
||||
wxFont font = GetInfoFont();
|
||||
|
||||
font.SetPointSize( wxFont::AdjustToSymbolicSize( wxFONTSIZE_SMALL, font.GetPointSize() ) );
|
||||
wxFont KIUI::GetInfoFont( wxWindow* aWindow )
|
||||
{
|
||||
return makeGUIFont( aWindow, 6 );
|
||||
}
|
||||
|
||||
return font;
|
||||
|
||||
wxFont KIUI::GetStatusFont( wxWindow* aWindow )
|
||||
{
|
||||
return makeGUIFont( aWindow, 5 );
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
#include <wx/tokenzr.h>
|
||||
#include <wx/dc.h>
|
||||
#include <widgets/wx_grid.h>
|
||||
|
||||
#include <widgets/ui_common.h>
|
||||
#include <algorithm>
|
||||
|
||||
|
||||
|
@ -40,9 +40,8 @@ WX_GRID::WX_GRID( wxWindow *parent, wxWindowID id, const wxPoint& pos, const wxS
|
|||
SetDefaultCellOverflow( false );
|
||||
|
||||
// Make sure the GUI font scales properly on GTK
|
||||
wxFont guiFont = wxSystemSettings::GetFont( wxSYS_DEFAULT_GUI_FONT );
|
||||
guiFont.SetSymbolicSize( wxFONTSIZE_MEDIUM );
|
||||
SetDefaultCellFont( guiFont );
|
||||
SetDefaultCellFont( KIUI::GetControlFont( this ) );
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -132,9 +132,9 @@ CVPCB_MAINFRAME::CVPCB_MAINFRAME( KIWAY* aKiway, wxWindow* aParent ) :
|
|||
wxStaticLine* staticline1 = new wxStaticLine( bottomPanel );
|
||||
panelSizer->Add( staticline1, 0, wxEXPAND, 5 );
|
||||
|
||||
m_statusLine1->SetFont( KIUI::GetInfoFont() );
|
||||
m_statusLine2->SetFont( KIUI::GetInfoFont() );
|
||||
m_statusLine3->SetFont( KIUI::GetInfoFont() );
|
||||
m_statusLine1->SetFont( KIUI::GetInfoFont( this ) );
|
||||
m_statusLine2->SetFont( KIUI::GetInfoFont( this ) );
|
||||
m_statusLine3->SetFont( KIUI::GetInfoFont( this ) );
|
||||
|
||||
// Add buttons:
|
||||
auto buttonsSizer = new wxBoxSizer( wxHORIZONTAL );
|
||||
|
|
|
@ -37,8 +37,8 @@ DIALOG_JUNCTION_PROPS::DIALOG_JUNCTION_PROPS( SCH_EDIT_FRAME* aParent,
|
|||
|
||||
m_colorSwatch->SetDefaultColor( COLOR4D::UNSPECIFIED );
|
||||
|
||||
m_helpLabel1->SetFont( KIUI::GetInfoFont() );
|
||||
m_helpLabel2->SetFont( KIUI::GetInfoFont() );
|
||||
m_helpLabel1->SetFont( KIUI::GetInfoFont( this ) );
|
||||
m_helpLabel2->SetFont( KIUI::GetInfoFont( this ) );
|
||||
|
||||
SetInitialFocus( m_textCtrlDiameter );
|
||||
|
||||
|
|
|
@ -45,7 +45,7 @@ DIALOG_LIB_TEXT_PROPERTIES::DIALOG_LIB_TEXT_PROPERTIES( SYMBOL_EDIT_FRAME* aPare
|
|||
m_TextValueSelectButton->Hide();
|
||||
m_PowerComponentValues->Show( false );
|
||||
|
||||
m_PowerComponentValues->SetFont( KIUI::GetInfoFont() );
|
||||
m_PowerComponentValues->SetFont( KIUI::GetInfoFont( this ) );
|
||||
|
||||
SetInitialFocus( m_TextCtrl );
|
||||
m_StyledTextCtrl->Show( false );
|
||||
|
|
|
@ -64,8 +64,8 @@ DIALOG_LINE_WIRE_BUS_PROPERTIES::DIALOG_LINE_WIRE_BUS_PROPERTIES( SCH_EDIT_FRAME
|
|||
|
||||
m_colorSwatch->SetDefaultColor( COLOR4D::UNSPECIFIED );
|
||||
|
||||
m_helpLabel1->SetFont( KIUI::GetInfoFont() );
|
||||
m_helpLabel2->SetFont( KIUI::GetInfoFont() );
|
||||
m_helpLabel1->SetFont( KIUI::GetInfoFont( this ) );
|
||||
m_helpLabel2->SetFont( KIUI::GetInfoFont( this ) );
|
||||
|
||||
SetInitialFocus( m_lineWidth );
|
||||
|
||||
|
|
|
@ -81,7 +81,7 @@ DIALOG_SHEET_PROPERTIES::DIALOG_SHEET_PROPERTIES( SCH_EDIT_FRAME* aParent, SCH_S
|
|||
m_bpMoveDown->SetBitmap( KiBitmap( BITMAPS::small_down ) );
|
||||
|
||||
// Set font sizes
|
||||
m_hierarchicalPathLabel->SetFont( KIUI::GetInfoFont() );
|
||||
m_hierarchicalPathLabel->SetFont( KIUI::GetInfoFont( this ) );
|
||||
|
||||
// wxFormBuilder doesn't include this event...
|
||||
m_grid->Connect( wxEVT_GRID_CELL_CHANGING,
|
||||
|
|
|
@ -116,8 +116,8 @@ DIALOG_TEXT_AND_LABEL_PROPERTIES::DIALOG_TEXT_AND_LABEL_PROPERTIES( SCH_EDIT_FRA
|
|||
|
||||
if( m_CurrentText->Type() == SCH_GLOBAL_LABEL_T )
|
||||
{
|
||||
m_note1->SetFont( KIUI::GetStatusFont() );
|
||||
m_note2->SetFont( KIUI::GetStatusFont() );
|
||||
m_note1->SetFont( KIUI::GetInfoFont( this ) );
|
||||
m_note2->SetFont( KIUI::GetInfoFont( this ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -37,7 +37,7 @@ PANEL_EESCHEMA_DISPLAY_OPTIONS::PANEL_EESCHEMA_DISPLAY_OPTIONS( SCH_EDIT_FRAME*
|
|||
|
||||
m_galOptionsSizer->Add( m_galOptsPanel, 1, wxEXPAND, 0 );
|
||||
|
||||
m_highlightColorNote->SetFont( KIUI::GetInfoFont() );
|
||||
m_highlightColorNote->SetFont( KIUI::GetInfoFont( this ) );
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -52,9 +52,9 @@ wxSize GetTextSize( const wxString& aSingleLine, wxWindow* aWindow );
|
|||
|
||||
wxFont GetMonospacedUIFont();
|
||||
|
||||
wxFont GetInfoFont();
|
||||
|
||||
wxFont GetStatusFont();
|
||||
wxFont GetControlFont( wxWindow* aWindow );
|
||||
wxFont GetInfoFont( wxWindow* aWindow );
|
||||
wxFont GetStatusFont( wxWindow* aWindow );
|
||||
|
||||
/**
|
||||
* Set the minimum pixel width on a text control in order to make a text
|
||||
|
|
|
@ -49,9 +49,7 @@ PROJECT_TREE::PROJECT_TREE( PROJECT_TREE_PANE* parent ) :
|
|||
m_projectTreePane = parent;
|
||||
|
||||
// Make sure the GUI font scales properly on GTK
|
||||
wxFont guiFont = wxSystemSettings::GetFont( wxSYS_DEFAULT_GUI_FONT );
|
||||
guiFont.SetSymbolicSize( wxFONTSIZE_MEDIUM );
|
||||
SetFont( guiFont );
|
||||
SetFont( KIUI::GetControlFont( this ) );
|
||||
|
||||
// icons size is not know (depending on they are built)
|
||||
// so get it:
|
||||
|
|
|
@ -78,7 +78,7 @@ PROPERTIES_FRAME::PROPERTIES_FRAME( PL_EDITOR_FRAME* aParent ) :
|
|||
m_stcText->SetUseHorizontalScrollBar( false );
|
||||
m_scintillaTricks = new SCINTILLA_TRICKS( m_stcText, wxT( "{}" ), false );
|
||||
|
||||
m_staticTextSizeInfo->SetFont( KIUI::GetStatusFont() );
|
||||
m_staticTextSizeInfo->SetFont( KIUI::GetStatusFont( this ) );
|
||||
|
||||
m_buttonOK->SetDefault();
|
||||
|
||||
|
|
|
@ -74,7 +74,7 @@ PCB_CALCULATOR_FRAME::PCB_CALCULATOR_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
|
|||
m_attenuator_list.push_back( new ATTENUATOR_SPLITTER() );
|
||||
m_currAttenuator = m_attenuator_list[0];
|
||||
|
||||
m_staticTextAttMsg->SetFont( KIUI::GetInfoFont() );
|
||||
m_staticTextAttMsg->SetFont( KIUI::GetInfoFont( this ) );
|
||||
|
||||
m_IadjUnitLabel->SetLabel( wxT( "µA" ) );
|
||||
|
||||
|
|
|
@ -91,7 +91,7 @@ DIALOG_BOARD_STATISTICS::DIALOG_BOARD_STATISTICS( PCB_EDIT_FRAME* aParentFrame )
|
|||
m_checkBoxSubtractHoles->SetValue( s_savedDialogState.subtractHoles );
|
||||
|
||||
// Make labels for grids
|
||||
wxFont headingFont = KIUI::GetInfoFont();
|
||||
wxFont headingFont = KIUI::GetInfoFont( this );
|
||||
m_gridComponents->SetCellValue( ROW_LABEL, COL_FRONT_SIDE, _( "Front Side" ) );
|
||||
m_gridComponents->SetCellFont( ROW_LABEL, COL_FRONT_SIDE, headingFont );
|
||||
m_gridComponents->SetCellValue( ROW_LABEL, COL_BOTTOM_SIDE, _( "Back Side" ) );
|
||||
|
|
|
@ -109,7 +109,7 @@ DIALOG_FOOTPRINT_PROPERTIES::DIALOG_FOOTPRINT_PROPERTIES( PCB_EDIT_FRAME* aParen
|
|||
m_orientValidator.SetWindow( m_OrientValueCtrl );
|
||||
|
||||
// Set font size for items showing long strings:
|
||||
wxFont infoFont = KIUI::GetInfoFont();
|
||||
wxFont infoFont = KIUI::GetInfoFont( this );
|
||||
#if __WXMAC__
|
||||
m_allow90Label->SetFont( infoFont );
|
||||
m_allow180Label->SetFont( infoFont );
|
||||
|
|
|
@ -101,7 +101,7 @@ DIALOG_FOOTPRINT_PROPERTIES_FP_EDITOR::DIALOG_FOOTPRINT_PROPERTIES_FP_EDITOR(
|
|||
m_FootprintNameCtrl->SetValidator( FOOTPRINT_NAME_VALIDATOR() );
|
||||
|
||||
// Set font sizes
|
||||
wxFont infoFont = KIUI::GetInfoFont();
|
||||
wxFont infoFont = KIUI::GetInfoFont( this );
|
||||
#if __WXMAC__
|
||||
m_allow90Label->SetFont( infoFont );
|
||||
m_allow180Label->SetFont( infoFont );
|
||||
|
|
|
@ -46,7 +46,7 @@ public:
|
|||
m_sdbSizerOK->SetDefault();
|
||||
m_choiceFpList->Append( aFpList );
|
||||
|
||||
m_multipleHint->SetFont( KIUI::GetStatusFont() );
|
||||
m_multipleHint->SetFont( KIUI::GetStatusFont( this ) );
|
||||
|
||||
// Hide help string until someone implements successive placement (#2227)
|
||||
m_multipleHint->Show( false );
|
||||
|
|
|
@ -139,7 +139,7 @@ DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS( PCB_
|
|||
m_LayerCtrl->Resync();
|
||||
|
||||
m_grid->SetCellHighlightPenWidth( 0 );
|
||||
m_grid->SetDefaultCellFont( KIUI::GetInfoFont() );
|
||||
m_grid->SetDefaultCellFont( KIUI::GetInfoFont( this ) );
|
||||
|
||||
m_sdbSizerButtonsOK->SetDefault();
|
||||
|
||||
|
|
|
@ -129,7 +129,7 @@ DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS::DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS( PCB_EDIT
|
|||
m_layerBox->SetUndefinedLayerName( INDETERMINATE_ACTION );
|
||||
m_layerBox->Resync();
|
||||
|
||||
m_netclassGrid->SetDefaultCellFont( KIUI::GetInfoFont() );
|
||||
m_netclassGrid->SetDefaultCellFont( KIUI::GetInfoFont( this ) );
|
||||
buildNetclassesGrid();
|
||||
|
||||
m_netclassGrid->SetCellHighlightPenWidth( 0 );
|
||||
|
|
|
@ -205,7 +205,7 @@ DIALOG_PAD_PROPERTIES::DIALOG_PAD_PROPERTIES( PCB_BASE_FRAME* aParent, PAD* aPad
|
|||
|
||||
initValues();
|
||||
|
||||
wxFont infoFont = KIUI::GetInfoFont();
|
||||
wxFont infoFont = KIUI::GetInfoFont( this );
|
||||
m_copperLayersLabel->SetFont( infoFont );
|
||||
m_techLayersLabel->SetFont( infoFont );
|
||||
m_parentInfo->SetFont( infoFont );
|
||||
|
|
|
@ -131,7 +131,7 @@ DIALOG_TEXT_PROPERTIES::DIALOG_TEXT_PROPERTIES( PCB_BASE_EDIT_FRAME* aParent, BO
|
|||
m_OrientCtrl->SetString( ii, wxString::Format( "%.1f", rot_list[ii] ) );
|
||||
|
||||
// Set font sizes
|
||||
m_statusLine->SetFont( KIUI::GetStatusFont() );
|
||||
m_statusLine->SetFont( KIUI::GetStatusFont( this ) );
|
||||
|
||||
m_sdbSizerOK->SetDefault();
|
||||
|
||||
|
|
|
@ -199,7 +199,7 @@ PANEL_FP_EDITOR_DEFAULTS::PANEL_FP_EDITOR_DEFAULTS( FOOTPRINT_EDIT_FRAME* aFrame
|
|||
|
||||
m_graphicsGrid->PushEventHandler( new GRID_TRICKS( m_graphicsGrid ) );
|
||||
|
||||
m_staticTextInfo->SetFont( KIUI::GetInfoFont() );
|
||||
m_staticTextInfo->SetFont( KIUI::GetInfoFont( this ) );
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -51,7 +51,7 @@ PANEL_SETUP_CONSTRAINTS::PANEL_SETUP_CONSTRAINTS( PAGED_DIALOG* aParent, PCB_EDI
|
|||
m_Frame = aFrame;
|
||||
m_BrdSettings = &m_Frame->GetBoard()->GetDesignSettings();
|
||||
|
||||
m_stCircleToPolyWarning->SetFont( KIUI::GetInfoFont() );
|
||||
m_stCircleToPolyWarning->SetFont( KIUI::GetInfoFont( this ) );
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue