Only adjust LAYER_WIDGET font size if larger than indicator.

Also moves adjustment into LAYER_WIDGET so all the callers don't
have to deal with it individually.

Fixes: lp:1767965
* https://bugs.launchpad.net/kicad/+bug/1767965
This commit is contained in:
Jeff Young 2018-05-02 15:46:09 +01:00
parent 2f157f9b23
commit 106dd60e45
9 changed files with 31 additions and 61 deletions

View File

@ -118,14 +118,7 @@ GERBVIEW_FRAME::GERBVIEW_FRAME( KIWAY* aKiway, wxWindow* aParent ):
SetScreen( new GBR_SCREEN( GetPageSettings().GetSizeIU() ) );
// Create the PCB_LAYER_WIDGET *after* SetLayout():
wxFont font = wxSystemSettings::GetFont( wxSYS_DEFAULT_GUI_FONT );
int pointSize = font.GetPointSize();
int screenHeight = wxSystemSettings::GetMetric( wxSYS_SCREEN_Y );
if( screenHeight <= 900 )
pointSize = (pointSize * 8) / 10;
m_LayersManager = new GERBER_LAYER_WIDGET( this, m_canvas, pointSize );
m_LayersManager = new GERBER_LAYER_WIDGET( this, m_canvas );
// LoadSettings() *after* creating m_LayersManager, because LoadSettings()
// initialize parameters in m_LayersManager

View File

@ -55,9 +55,8 @@
*/
GERBER_LAYER_WIDGET::GERBER_LAYER_WIDGET( GERBVIEW_FRAME* aParent, wxWindow* aFocusOwner,
int aPointSize ) :
LAYER_WIDGET( aParent, aFocusOwner, aPointSize ),
GERBER_LAYER_WIDGET::GERBER_LAYER_WIDGET( GERBVIEW_FRAME* aParent, wxWindow* aFocusOwner ) :
LAYER_WIDGET( aParent, aFocusOwner ),
myframe( aParent )
{
m_alwaysShowActiveLayer = false;

View File

@ -75,11 +75,8 @@ public:
* Constructor
* @param aParent : the parent frame
* @param aFocusOwner : the window that has the keyboard focus.
* @param aPointSize is the font point size to use within the widget. This
* effectively sets the overal size of the widget via the row height and bitmap
* button sizes.
*/
GERBER_LAYER_WIDGET( GERBVIEW_FRAME* aParent, wxWindow* aFocusOwner, int aPointSize = 10 );
GERBER_LAYER_WIDGET( GERBVIEW_FRAME* aParent, wxWindow* aFocusOwner );
void ReFill();

View File

@ -267,8 +267,7 @@ FOOTPRINT_EDIT_FRAME::FOOTPRINT_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
// no net in footprint editor: make it non visible
GetBoard()->SetElementVisibility( LAYER_NO_CONNECTS, false );
wxFont font = wxSystemSettings::GetFont( wxSYS_DEFAULT_GUI_FONT );
m_Layers = new PCB_LAYER_WIDGET( this, GetCanvas(), font.GetPointSize(), true );
m_Layers = new PCB_LAYER_WIDGET( this, GetCanvas(), true );
// We should probably allow editing of these in the Footprint Editor's preferences, but
// that's not the case at present so copy them from Pcbnew.

View File

@ -447,34 +447,33 @@ void LAYER_WIDGET::passOnFocus()
//-----<public>-------------------------------------------------------
LAYER_WIDGET::LAYER_WIDGET( wxWindow* aParent, wxWindow* aFocusOwner, int aPointSize,
wxWindowID id, const wxPoint& pos, const wxSize& size, long style ) :
LAYER_WIDGET::LAYER_WIDGET( wxWindow* aParent, wxWindow* aFocusOwner, wxWindowID id,
const wxPoint& pos, const wxSize& size, long style ) :
wxPanel( aParent, id, pos, size, style )
{
int indicatorSize = ConvertDialogToPixels( wxSize( 6, 6 ) ).x;
m_IconProvider = new ROW_ICON_PROVIDER( indicatorSize );
int pointSize = wxSystemSettings::GetFont( wxSYS_DEFAULT_GUI_FONT ).GetPointSize();
int screenHeight = wxSystemSettings::GetMetric( wxSYS_SCREEN_Y );
if( screenHeight <= 900 && pointSize >= indicatorSize )
pointSize = pointSize * 8 / 10;
m_PointSize = pointSize;
wxBoxSizer* boxSizer = new wxBoxSizer( wxVERTICAL );
m_notebook = new wxAuiNotebook( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxAUI_NB_TOP );
wxFont font = m_notebook->GetFont();
if( aPointSize == -1 )
{
m_PointSize = font.GetPointSize();
}
else
{
m_PointSize = aPointSize;
// change the font size on the notebook's tabs to match aPointSize
font.SetPointSize( aPointSize );
font.SetPointSize( pointSize );
m_notebook->SetFont( font );
m_notebook->SetNormalFont( font );
m_notebook->SetSelectedFont( font );
m_notebook->SetMeasuringFont( font );
}
int indicatorSize = ConvertDialogToPixels( wxSize( 6, 6 ) ).x;
m_IconProvider = new ROW_ICON_PROVIDER( indicatorSize );
m_LayerPanel = new wxPanel( m_notebook, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );

View File

@ -259,18 +259,15 @@ public:
/** Constructor
* @param aParent is the parent window
* @param aFocusOwner is the window that should be sent the focus after
* @param aPointSize is the font point size to use within the widget. This
* effectively sets the overal size of the widget via the row height and bitmap
* button sizes.
* @param id is the wxWindow id ( default = wxID_ANY)
* @param pos is the window position
* @param size is the window size
* @param style is the window style
* every operation.
*/
LAYER_WIDGET( wxWindow* aParent, wxWindow* aFocusOwner, int aPointSize = -1,
wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize, long style = wxTAB_TRAVERSAL );
LAYER_WIDGET( wxWindow* aParent, wxWindow* aFocusOwner, wxWindowID id = wxID_ANY,
const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize,
long style = wxTAB_TRAVERSAL );
virtual ~LAYER_WIDGET();

View File

@ -347,17 +347,7 @@ PCB_EDIT_FRAME::PCB_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
SetBoard( new BOARD() );
// Create the PCB_LAYER_WIDGET *after* SetBoard():
wxFont font = wxSystemSettings::GetFont( wxSYS_DEFAULT_GUI_FONT );
int pointSize = font.GetPointSize();
int screenHeight = wxSystemSettings::GetMetric( wxSYS_SCREEN_Y );
// printf( "pointSize:%d 80%%:%d\n", pointSize, (pointSize*8)/10 );
if( screenHeight <= 900 )
pointSize = (pointSize * 8) / 10;
m_Layers = new PCB_LAYER_WIDGET( this, GetCanvas(), pointSize );
m_Layers = new PCB_LAYER_WIDGET( this, GetCanvas() );
m_drc = new DRC( this ); // these 2 objects point to each other
m_plotDialog = nullptr;

View File

@ -107,8 +107,8 @@ static int s_allowed_in_FpEditor[] =
PCB_LAYER_WIDGET::PCB_LAYER_WIDGET( PCB_BASE_FRAME* aParent, wxWindow* aFocusOwner,
int aPointSize, bool aFpEditorMode ) :
LAYER_WIDGET( aParent, aFocusOwner, aPointSize ),
bool aFpEditorMode ) :
LAYER_WIDGET( aParent, aFocusOwner ),
myframe( aParent )
{
m_alwaysShowActiveCopperLayer = false;

View File

@ -47,15 +47,11 @@ public:
* Constructor
* @param aParent is the parent window
* @param aFocusOwner is the window that should be sent the focus after
* @param aPointSize is the font point size to use within the widget. This
* effectively sets the overall size of the widget via the row height and bitmap
* button sizes.
* @param aFpEditorMode false for the board editor (default), true for fp editor
* when true, some options or layers which cannot be used in editor mode are not
* displayed
*/
PCB_LAYER_WIDGET( PCB_BASE_FRAME* aParent, wxWindow* aFocusOwner,
int aPointSize = 10, bool aFpEditorMode = false );
PCB_LAYER_WIDGET( PCB_BASE_FRAME* aParent, wxWindow* aFocusOwner, bool aFpEditorMode = false );
void ReFill();