Another round of font sizing tweaks.

It appears that both strategies in the last commit worked, leaving us
with squared scaling.  The dialog pixel architecture seems safer than
our icon scaling stuff, so this version attempts to use only it.

Also works around a bug where wxELLIPSIZE_MIDDLE doesn't work on Mac.

Fixes https://gitlab.com/kicad/code/kicad/issues/8608

Fixes https://gitlab.com/kicad/code/kicad/issues/8375
This commit is contained in:
Jeff Young 2021-09-10 18:35:45 +01:00
parent abfc60acfc
commit ad59254be8
8 changed files with 46 additions and 43 deletions

View File

@ -338,7 +338,7 @@ void ACTION_MENU::updateHotKeys()
const TOOL_ACTION& action = *ii.second;
int key = toolMgr->GetHotKey( action ) & ~MD_MODIFIER_MASK;
if( key >= 0 )
if( key > 0 )
{
int mod = toolMgr->GetHotKey( action ) & MD_MODIFIER_MASK;
int flags = 0;

View File

@ -98,21 +98,12 @@ wxFont makeGUIFont( wxWindow* aWindow, int aDialogSize )
{
wxFont font = wxSystemSettings::GetFont( wxSYS_DEFAULT_GUI_FONT );
// 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.
// Using wxFont::SetSymbolicSize() fails on (at least) GTK with HiDPI screens, but the
// dialog pixel conversion stuff seems to work....
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 );
font.SetPointSize( vert_size / 2 );
#ifdef __WXMAC__
// https://trac.wxwidgets.org/ticket/19210
@ -126,19 +117,19 @@ wxFont makeGUIFont( wxWindow* aWindow, int aDialogSize )
wxFont KIUI::GetControlFont( wxWindow* aWindow )
{
return makeGUIFont( aWindow, 7 );
return makeGUIFont( aWindow, 14 );
}
wxFont KIUI::GetInfoFont( wxWindow* aWindow )
{
return makeGUIFont( aWindow, 6 );
return makeGUIFont( aWindow, 13 );
}
wxFont KIUI::GetStatusFont( wxWindow* aWindow )
{
return makeGUIFont( aWindow, 5 );
return makeGUIFont( aWindow, 11 );
}

View File

@ -41,7 +41,6 @@ WX_GRID::WX_GRID( wxWindow *parent, wxWindowID id, const wxPoint& pos, const wxS
// Make sure the GUI font scales properly on GTK
SetDefaultCellFont( KIUI::GetControlFont( this ) );
}
@ -60,10 +59,13 @@ void WX_GRID::SetColLabelSize( int aHeight )
return;
}
// correct wxFormBuilder height for large fonts
wxFont guiFont = wxSystemSettings::GetFont( wxSYS_DEFAULT_GUI_FONT );
int minHeight = guiFont.GetPixelSize().y + 2 * MIN_GRIDCELL_MARGIN;
// Make sure the GUI font scales properly on GTK
wxFont headingFont = KIUI::GetInfoFont( this );
headingFont.MakeBold();
SetLabelFont( headingFont );
// Correct wxFormBuilder height for large fonts
int minHeight = headingFont.GetPixelSize().y + 2 * MIN_GRIDCELL_MARGIN;
wxGrid::SetColLabelSize( std::max( aHeight, minHeight ) );
}

View File

@ -104,41 +104,41 @@ void PANEL_KICAD_LAUNCHER::CreateLaunchers()
};
addLauncher( KICAD_MANAGER_ACTIONS::editSchematic,
KiBitmap( BITMAPS::icon_eeschema, 48 ),
KiScaledBitmap( BITMAPS::icon_eeschema, this, 48 ),
_( "Edit the project schematic" ) );
addLauncher( KICAD_MANAGER_ACTIONS::editSymbols,
KiBitmap( BITMAPS::icon_libedit, 48 ),
KiScaledBitmap( BITMAPS::icon_libedit, this, 48 ),
_( "Edit global and/or project schematic symbol libraries" ) );
addLauncher( KICAD_MANAGER_ACTIONS::editPCB,
KiBitmap( BITMAPS::icon_pcbnew, 48 ),
KiScaledBitmap( BITMAPS::icon_pcbnew, this, 48 ),
_( "Edit the project PCB design" ) );
addLauncher( KICAD_MANAGER_ACTIONS::editFootprints,
KiBitmap( BITMAPS::icon_modedit, 48 ),
KiScaledBitmap( BITMAPS::icon_modedit, this, 48 ),
_( "Edit global and/or project PCB footprint libraries" ) );
addLauncher( KICAD_MANAGER_ACTIONS::viewGerbers,
KiBitmap( BITMAPS::icon_gerbview, 48 ),
KiScaledBitmap( BITMAPS::icon_gerbview, this, 48 ),
_( "Preview Gerber files" ) );
addLauncher( KICAD_MANAGER_ACTIONS::convertImage,
KiBitmap( BITMAPS::icon_bitmap2component, 48 ),
KiScaledBitmap( BITMAPS::icon_bitmap2component, this, 48 ),
_( "Convert bitmap images to schematic symbols or PCB footprints" ) );
addLauncher( KICAD_MANAGER_ACTIONS::showCalculator,
KiBitmap( BITMAPS::icon_pcbcalculator, 48 ),
KiScaledBitmap( BITMAPS::icon_pcbcalculator, this, 48 ),
_( "Show tools for calculating resistance, current capacity, etc." ) );
addLauncher( KICAD_MANAGER_ACTIONS::editDrawingSheet,
KiBitmap( BITMAPS::icon_pagelayout_editor, 48 ),
KiScaledBitmap( BITMAPS::icon_pagelayout_editor, this, 48 ),
_( "Edit drawing sheet borders and title blocks for use in schematics and PCB "
"designs" ) );
#ifdef PCM
addLauncher( KICAD_MANAGER_ACTIONS::showPluginManager,
KiBitmap( BITMAPS::icon_pcm, 48 ),
KiScaledBitmap( BITMAPS::icon_pcm, this, 48 ),
_( "Manage downloadable packages from KiCad and 3rd party repositories" ) );
#endif

View File

@ -52,6 +52,7 @@
#include <widgets/app_progress_dialog.h>
#include <wx/ffile.h>
#include <wx/filedlg.h>
#include <wx/dcclient.h>
#include <atomic>
@ -122,12 +123,10 @@ KICAD_MANAGER_FRAME::KICAD_MANAGER_FRAME( wxWindow* parent, const wxString& titl
wxXmlDocument dummy;
#endif
// Create the status line (bottom of the frame)
static const int dims[2] = { -1, -1 };
CreateStatusBar( 2, wxSTB_SIZEGRIP | wxSTB_SHOW_TIPS | wxSTB_ELLIPSIZE_MIDDLE |
wxFULL_REPAINT_ON_RESIZE );
SetStatusWidths( 2, dims );
// 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::GetStatusFont( this ) );
// Give an icon
wxIcon icon;
@ -346,6 +345,8 @@ void KICAD_MANAGER_FRAME::OnSize( wxSizeEvent& event )
if( m_auimgr.GetManagedWindow() )
m_auimgr.Update();
PrintPrjInfo();
event.Skip();
}
@ -681,8 +682,19 @@ void KICAD_MANAGER_FRAME::InstallPreferences( PAGED_DIALOG* aParent,
void KICAD_MANAGER_FRAME::PrintPrjInfo()
{
SetStatusText( wxString::Format( _( "Project: %s" ), Prj().GetProjectFullName() ) );
// wxStatusBar's wxELLIPSIZE_MIDDLE flag doesn't work (at least on Mac).
wxString status = wxString::Format( _( "Project: %s" ), Prj().GetProjectFullName() );
wxStatusBar* statusBar = GetStatusBar();
int width = statusBar->GetSize().GetWidth() / 2;
if( width > 20 )
{
wxClientDC dc( this );
status = wxControl::Ellipsize( status, dc, wxELLIPSIZE_MIDDLE, width );
}
SetStatusText( status );
}

View File

@ -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::GetControlFont( this ) );
SetFont( KIUI::GetInfoFont( this ) );
// icons size is not know (depending on they are built)
// so get it:

View File

@ -114,15 +114,14 @@ DIALOG_FOOTPRINT_PROPERTIES::DIALOG_FOOTPRINT_PROPERTIES( PCB_EDIT_FRAME* aParen
m_allow90Label->SetFont( infoFont );
m_allow180Label->SetFont( infoFont );
#endif
m_staticTextInfoCopper->SetFont( infoFont );
m_staticTextInfoPaste->SetFont( infoFont );
m_libraryIDLabel->SetFont( infoFont );
m_tcLibraryID->SetFont( infoFont );
infoFont.SetStyle( wxFONTSTYLE_ITALIC );
m_staticTextInfoValNeg->SetFont( infoFont );
m_staticTextInfoValPos->SetFont( infoFont );
m_staticTextInfoCopper->SetFont( infoFont );
m_staticTextInfoPaste->SetFont( infoFont );
m_NoteBook->SetSelection( m_page );

View File

@ -31,7 +31,6 @@
#include <board_design_settings.h>
#include <board_commit.h>
#include <bitmaps.h>
#include <widgets/grid_icon_text_helpers.h>
#include <widgets/grid_text_button_helpers.h>
#include <widgets/wx_grid.h>
#include <widgets/text_ctrl_eval.h>
@ -106,12 +105,12 @@ DIALOG_FOOTPRINT_PROPERTIES_FP_EDITOR::DIALOG_FOOTPRINT_PROPERTIES_FP_EDITOR(
m_allow90Label->SetFont( infoFont );
m_allow180Label->SetFont( infoFont );
#endif
m_staticTextInfoCopper->SetFont( infoFont );
m_staticTextInfoPaste->SetFont( infoFont );
infoFont.SetStyle( wxFONTSTYLE_ITALIC );
m_staticTextInfoValNeg->SetFont( infoFont );
m_staticTextInfoValPos->SetFont( infoFont );
m_staticTextInfoCopper->SetFont( infoFont );
m_staticTextInfoPaste->SetFont( infoFont );
if( static_cast<int>( m_page ) >= 0 )
m_NoteBook->SetSelection( (unsigned) m_page );