Special case kicad manager default frame sizes.

Fixes https://gitlab.com/kicad/code/kicad/issues/7559
This commit is contained in:
Jeff Young 2021-02-16 15:15:52 +00:00
parent 114dceec2e
commit f3449452db
4 changed files with 33 additions and 16 deletions

View File

@ -60,11 +60,29 @@ wxDEFINE_EVENT( UNITS_CHANGED, wxCommandEvent );
// Minimum window size
static const int s_minsize_x = 500;
static const int s_minsize_y = 400;
static const wxSize minSize( FRAME_T aFrameType )
{
switch( aFrameType )
{
case KICAD_MAIN_FRAME_T:
return wxSize( 406, 354 );
static const int s_defaultSize_x = 1280;
static const int s_defaultSize_y = 720;
default:
return wxSize( 500, 400 );
}
}
static const wxSize defaultSize( FRAME_T aFrameType )
{
switch( aFrameType )
{
case KICAD_MAIN_FRAME_T:
return wxSize( 850, 540 );
default:
return wxSize( 1280, 720 );
}
}
BEGIN_EVENT_TABLE( EDA_BASE_FRAME, wxFrame )
@ -100,14 +118,14 @@ EDA_BASE_FRAME::EDA_BASE_FRAME( wxWindow* aParent, FRAME_T aFrameType,
{
m_autoSaveTimer = new wxTimer( this, ID_AUTO_SAVE_TIMER );
m_mruPath = PATHS::GetDefaultUserProjectsPath();
m_frameSize = wxSize( s_defaultSize_x, s_defaultSize_y );
m_frameSize = defaultSize( aFrameType );
m_auimgr.SetArtProvider( new WX_AUI_DOCK_ART() );
m_settingsManager = &Pgm().GetSettingsManager();
// Set a reasonable minimal size for the frame
SetSizeHints( s_minsize_x, s_minsize_y, -1, -1, -1, -1 );
SetSizeHints( minSize( aFrameType ).x, minSize( aFrameType ).y, -1, -1, -1, -1 );
// Store dimensions of the user area of the main window.
GetClientSize( &m_frameSize.x, &m_frameSize.y );
@ -464,11 +482,10 @@ void EDA_BASE_FRAME::LoadWindowState( const WINDOW_STATE& aState )
m_framePos.x, m_framePos.y, m_frameSize.x, m_frameSize.y );
// Ensure minimum size is set if the stored config was zero-initialized
if( m_frameSize.x < s_minsize_x || m_frameSize.y < s_minsize_y )
if( m_frameSize.x < minSize( m_ident ).x || m_frameSize.y < minSize( m_ident ).y )
{
m_frameSize.x = s_defaultSize_x;
m_frameSize.y = s_defaultSize_y;
wasDefault = true;
m_frameSize = defaultSize( m_ident );
wasDefault = true;
wxLogTrace( traceDisplayLocation, "Using minimum size (%d, %d)", m_frameSize.x, m_frameSize.y );
}

View File

@ -27,7 +27,7 @@
#ifdef __WXMAC__
constexpr int ICON_PADDING = 5;
constexpr int ICON_PADDING = 4;
constexpr int CELL_MARGINS = 0;
#else
constexpr int ICON_PADDING = 5;

View File

@ -16,7 +16,7 @@ PANEL_KICAD_LAUNCHER_BASE::PANEL_KICAD_LAUNCHER_BASE( wxWindow* parent, wxWindow
m_mainSizer = new wxBoxSizer( wxVERTICAL );
m_toolsSizer = new wxGridBagSizer( 0, 12 );
m_toolsSizer = new wxGridBagSizer( 0, 10 );
m_toolsSizer->SetFlexibleDirection( wxHORIZONTAL );
m_toolsSizer->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_NONE );
@ -27,7 +27,7 @@ PANEL_KICAD_LAUNCHER_BASE::PANEL_KICAD_LAUNCHER_BASE( wxWindow* parent, wxWindow
m_mainSizer->Add( 0, 20, 0, wxEXPAND, 5 );
bSizer2->Add( m_mainSizer, 1, wxEXPAND|wxTOP|wxLEFT, 10 );
bSizer2->Add( m_mainSizer, 1, wxEXPAND|wxTOP|wxLEFT, 8 );
this->SetSizer( bSizer2 );

View File

@ -55,7 +55,7 @@
<property name="orient">wxVERTICAL</property>
<property name="permission">none</property>
<object class="sizeritem" expanded="1">
<property name="border">10</property>
<property name="border">8</property>
<property name="flag">wxEXPAND|wxTOP|wxLEFT</property>
<property name="proportion">1</property>
<object class="wxBoxSizer" expanded="1">
@ -72,8 +72,8 @@
<property name="flexible_direction">wxHORIZONTAL</property>
<property name="growablecols"></property>
<property name="growablerows"></property>
<property name="hgap">12</property>
<property name="minimum_size"></property>
<property name="hgap">10</property>
<property name="minimum_size">-1,-1</property>
<property name="name">m_toolsSizer</property>
<property name="non_flexible_grow_mode">wxFLEX_GROWMODE_NONE</property>
<property name="permission">protected</property>