mirror of
https://gitlab.com/kicad/code/kicad.git
synced 2025-04-07 18:15:32 +00:00
Mac needs different font size handling than MSW & GTK.
Mac already uses diverse font sizes (for instance, smaller fonts for radio button groups), and the anti-aliasing is a lot better. The other platforms need a more limited range of sizes. Fixes https://gitlab.com/kicad/code/kicad/issues/8608
This commit is contained in:
parent
769ca2d255
commit
9c78e4cf54
common
cvpcb
eeschema/dialogs
dialog_junction_props.cppdialog_lib_text_properties.cppdialog_line_wire_bus_properties.cppdialog_sheet_properties.cppdialog_text_and_label_properties.cpppanel_eeschema_display_options.cpp
include/widgets
kicad
pagelayout_editor/dialogs
pcb_calculator
pcbnew
dialogs
dialog_board_statistics.cppdialog_footprint_properties.cppdialog_footprint_properties_fp_editor.cppdialog_get_footprint_by_name.hdialog_global_edit_text_and_graphics.cppdialog_global_edit_tracks_and_vias.cppdialog_pad_properties.cppdialog_text_properties.cpppanel_fp_editor_defaults.cpppanel_setup_constraints.cpp
widgets
@ -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::GetGUIFont( this, -1 ) );
|
||||
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::GetGUIFont( this, -2 ) );
|
||||
stsbar->SetFont( KIUI::GetStatusFont( this ) );
|
||||
|
||||
// Create child subwindows.
|
||||
GetClientSize( &m_frameSize.x, &m_frameSize.y );
|
||||
|
@ -43,7 +43,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::GetGUIFont( this, -2 ) );
|
||||
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()
|
||||
@ -90,7 +90,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::GetGUIFont( this ) );
|
||||
dc.SetFont( KIUI::GetControlFont( this ) );
|
||||
|
||||
for( const MSG_PANEL_ITEM& item : m_Items )
|
||||
showItem( dc, item );
|
||||
|
@ -95,15 +95,10 @@ wxFont KIUI::GetMonospacedUIFont()
|
||||
}
|
||||
|
||||
|
||||
wxFont KIUI::GetGUIFont( wxWindow* aWindow, int aRelativeSize )
|
||||
wxFont getGUIFont( wxWindow* aWindow, int aRelativeSize )
|
||||
{
|
||||
wxFont font = aWindow->GetFont();
|
||||
|
||||
#ifdef __WXMSW__
|
||||
// -2 is too small on MSW
|
||||
aRelativeSize = std::max( aRelativeSize, -1 );
|
||||
#endif
|
||||
|
||||
font.SetPointSize( font.GetPointSize() + aRelativeSize );
|
||||
|
||||
// Both wxFont::SetSymbolicSize() and wxWindow::ConvertDialogToPixels() fail on some GTKs
|
||||
@ -131,6 +126,30 @@ wxFont KIUI::GetGUIFont( wxWindow* aWindow, int aRelativeSize )
|
||||
}
|
||||
|
||||
|
||||
wxFont KIUI::GetStatusFont( wxWindow* aWindow )
|
||||
{
|
||||
#ifdef __WXMAC__
|
||||
int scale = -2;
|
||||
#else
|
||||
int scale = -1;
|
||||
#endif
|
||||
|
||||
return getGUIFont( aWindow, scale );
|
||||
}
|
||||
|
||||
|
||||
wxFont KIUI::GetInfoFont( wxWindow* aWindow )
|
||||
{
|
||||
return getGUIFont( aWindow, -1 );
|
||||
}
|
||||
|
||||
|
||||
wxFont KIUI::GetControlFont( wxWindow* aWindow )
|
||||
{
|
||||
return getGUIFont( aWindow, 0 );
|
||||
}
|
||||
|
||||
|
||||
bool KIUI::EnsureTextCtrlWidth( wxTextCtrl* aCtrl, const wxString* aString )
|
||||
{
|
||||
wxWindow* window = aCtrl->GetParent();
|
||||
|
@ -40,7 +40,7 @@ WX_GRID::WX_GRID( wxWindow *parent, wxWindowID id, const wxPoint& pos, const wxS
|
||||
SetDefaultCellOverflow( false );
|
||||
|
||||
// Make sure the GUI font scales properly on GTK
|
||||
SetDefaultCellFont( KIUI::GetGUIFont( this ) );
|
||||
SetDefaultCellFont( KIUI::GetControlFont( this ) );
|
||||
}
|
||||
|
||||
|
||||
@ -60,7 +60,7 @@ void WX_GRID::SetColLabelSize( int aHeight )
|
||||
}
|
||||
|
||||
// Make sure the GUI font scales properly on GTK
|
||||
wxFont headingFont = KIUI::GetGUIFont( this );
|
||||
wxFont headingFont = KIUI::GetControlFont( this );
|
||||
headingFont.MakeBold();
|
||||
SetLabelFont( headingFont );
|
||||
|
||||
|
@ -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::GetGUIFont( this, -1 ) );
|
||||
m_statusLine2->SetFont( KIUI::GetGUIFont( this, -1 ) );
|
||||
m_statusLine3->SetFont( KIUI::GetGUIFont( this, -1 ) );
|
||||
m_statusLine1->SetFont( KIUI::GetStatusFont( this ) );
|
||||
m_statusLine2->SetFont( KIUI::GetStatusFont( this ) );
|
||||
m_statusLine3->SetFont( KIUI::GetStatusFont( 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::GetGUIFont( this, -1 ) );
|
||||
m_helpLabel2->SetFont( KIUI::GetGUIFont( this, -1 ) );
|
||||
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::GetGUIFont( this, -1 ) );
|
||||
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::GetGUIFont( this, -1 ) );
|
||||
m_helpLabel2->SetFont( KIUI::GetGUIFont( this, -1 ) );
|
||||
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::GetGUIFont( this, -2 ) );
|
||||
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::GetGUIFont( this, -1 ) );
|
||||
m_note2->SetFont( KIUI::GetGUIFont( this, -1 ) );
|
||||
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::GetGUIFont( this, -1 ) );
|
||||
m_highlightColorNote->SetFont( KIUI::GetInfoFont( this ) );
|
||||
}
|
||||
|
||||
|
||||
|
@ -52,7 +52,9 @@ wxSize GetTextSize( const wxString& aSingleLine, wxWindow* aWindow );
|
||||
|
||||
wxFont GetMonospacedUIFont();
|
||||
|
||||
wxFont GetGUIFont( wxWindow* aWindow, int aRelativeSize = 0 );
|
||||
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
|
||||
|
@ -126,7 +126,7 @@ KICAD_MANAGER_FRAME::KICAD_MANAGER_FRAME( wxWindow* parent, const wxString& titl
|
||||
// Create the status line (bottom of the frame). Left half is for project name; right half
|
||||
// is for Reporter (currently used by archiver/unarchiver).
|
||||
CreateStatusBar( 2 );
|
||||
GetStatusBar()->SetFont( KIUI::GetGUIFont( this, -2 ) );
|
||||
GetStatusBar()->SetFont( KIUI::GetStatusFont( this ) );
|
||||
|
||||
// Give an icon
|
||||
wxIcon icon;
|
||||
|
@ -49,7 +49,7 @@ PROJECT_TREE::PROJECT_TREE( PROJECT_TREE_PANE* parent ) :
|
||||
m_projectTreePane = parent;
|
||||
|
||||
// Make sure the GUI font scales properly on GTK
|
||||
SetFont( KIUI::GetGUIFont( this ) );
|
||||
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::GetGUIFont( this, -1 ) );
|
||||
m_staticTextSizeInfo->SetFont( KIUI::GetInfoFont( 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::GetGUIFont( this, -1 ) );
|
||||
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::GetGUIFont( this, -1 );
|
||||
wxFont headingFont = KIUI::GetStatusFont( 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::GetGUIFont( this, -1 );
|
||||
wxFont infoFont = KIUI::GetInfoFont( this );
|
||||
#if __WXMAC__
|
||||
m_allow90Label->SetFont( infoFont );
|
||||
m_allow180Label->SetFont( infoFont );
|
||||
|
@ -100,7 +100,7 @@ DIALOG_FOOTPRINT_PROPERTIES_FP_EDITOR::DIALOG_FOOTPRINT_PROPERTIES_FP_EDITOR(
|
||||
m_FootprintNameCtrl->SetValidator( FOOTPRINT_NAME_VALIDATOR() );
|
||||
|
||||
// Set font sizes
|
||||
wxFont infoFont = KIUI::GetGUIFont( this, -1 );
|
||||
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::GetGUIFont( this, -1 ) );
|
||||
m_multipleHint->SetFont( KIUI::GetInfoFont( 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::GetGUIFont( this, -1 ) );
|
||||
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::GetGUIFont( this, -1 ) );
|
||||
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::GetGUIFont( this, -1 );
|
||||
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::GetGUIFont( this, -2 ) );
|
||||
m_statusLine->SetFont( KIUI::GetInfoFont( this ) );
|
||||
|
||||
m_sdbSizerOK->SetDefault();
|
||||
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user