Layer Setup: DPI-independent default size

Also, remove a wxPanel border as it makes device-independent sizing
nearly impossible. For some reason wxPanel::GetClientSize() is returning
garbage here and breaks centering text without fudge factors. I think it
still looks good without the border, maybe better.
This commit is contained in:
Chris Pavlina 2018-01-07 00:06:57 -07:00
parent 8bc063abda
commit a06e3bef33
4 changed files with 16 additions and 15 deletions

View File

@ -3,7 +3,7 @@
*
* Copyright (C) 2009 Isaac Marino Bavaresco, isaacbavaresco@yahoo.com.br
* Copyright (C) 2009 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
* Copyright (C) 2009-2017 KiCad Developers, see change_log.txt for contributors.
* Copyright (C) 2009-2018 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
@ -207,16 +207,19 @@ private:
int offset = 0;
wxSize txtz;
wxSize panel_sz = m_TitlePanel->GetSize();
int voffset = panel_sz.y/2 - VertPixelsFromDU( 4 );
txtz = m_nameStaticText->GetSize();
m_nameStaticText->Move( offset + (widths[0] - txtz.x)/2, 5 );
m_nameStaticText->Move( offset + (widths[0] - txtz.x)/2, voffset );
offset += widths[0];
txtz = m_enabledStaticText->GetSize();
m_enabledStaticText->Move( offset + (widths[1] - txtz.x)/2, 5 );
m_enabledStaticText->Move( offset + (widths[1] - txtz.x)/2, voffset );
offset += widths[1];
txtz = m_typeStaticText->GetSize();
m_typeStaticText->Move( offset + (widths[2] - txtz.x)/2, 5 );
m_typeStaticText->Move( offset + (widths[2] - txtz.x)/2, voffset );
}
void OnSize( wxSizeEvent& event ) override;
@ -348,14 +351,12 @@ void DIALOG_LAYERS_SETUP::OnInitDialog( wxInitDialogEvent& aEvent )
{
wxWindowBase::OnInitDialog( aEvent );
// set the height of the title panel to be the size of any wxStaticText object
// plus 10 so we can have a border of 5 on both top and bottom.
m_TitlePanel->SetMinSize( wxSize( -1, m_AdhesFrontName->GetSize().y+10 ) );
m_TitlePanel->SetMinSize( wxSize( -1, VertPixelsFromDU( 10 ) ) );
m_LayersListPanel->ShowScrollbars( wxSHOW_SB_ALWAYS, wxSHOW_SB_ALWAYS );
Layout();
Fit();
SetSizeInDU( 240, 240 );
Center();
m_sdbSizerOK->SetFocus();

View File

@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Nov 22 2017)
// C++ code generated with wxFormBuilder (version Jan 2 2018)
// http://www.wxformbuilder.org/
//
// PLEASE DO *NOT* EDIT THIS FILE!
@ -11,7 +11,7 @@
DIALOG_LAYERS_SETUP_BASE::DIALOG_LAYERS_SETUP_BASE( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : DIALOG_SHIM( parent, id, title, pos, size, style )
{
this->SetSizeHints( wxSize( -1,500 ), wxSize( -1,550 ) );
this->SetSizeHints( wxSize( 200,200 ), wxSize( -1,-1 ) );
wxBoxSizer* bMainSizer;
bMainSizer = new wxBoxSizer( wxVERTICAL );
@ -98,7 +98,7 @@ DIALOG_LAYERS_SETUP_BASE::DIALOG_LAYERS_SETUP_BASE( wxWindow* parent, wxWindowID
wxBoxSizer* bCaptionsSizer;
bCaptionsSizer = new wxBoxSizer( wxHORIZONTAL );
m_TitlePanel = new wxPanel( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxRAISED_BORDER|wxTAB_TRAVERSAL );
m_TitlePanel = new wxPanel( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
m_TitlePanel->SetForegroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_CAPTIONTEXT ) );
m_TitlePanel->SetBackgroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_ACTIVECAPTION ) );
m_TitlePanel->SetMinSize( wxSize( -1,15 ) );

View File

@ -40,8 +40,8 @@
<property name="font"></property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="maximum_size">-1,550</property>
<property name="minimum_size">-1,500</property>
<property name="maximum_size">-1,-1</property>
<property name="minimum_size">200,200</property>
<property name="name">DIALOG_LAYERS_SETUP_BASE</property>
<property name="pos"></property>
<property name="size">-1,-1</property>
@ -909,7 +909,7 @@
<property name="tooltip"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style">wxRAISED_BORDER|wxTAB_TRAVERSAL</property>
<property name="window_style">wxTAB_TRAVERSAL</property>
<event name="OnChar"></event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>

View File

@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Nov 22 2017)
// C++ code generated with wxFormBuilder (version Jan 2 2018)
// http://www.wxformbuilder.org/
//
// PLEASE DO *NOT* EDIT THIS FILE!