Maximize main editors by default if config is missing

Also set default size for other windows to something slightly
larger than it was before
This commit is contained in:
Jon Evans 2020-10-18 14:38:40 -04:00
parent a0586d3e3d
commit e735d21824
6 changed files with 16 additions and 4 deletions

View File

@ -62,6 +62,9 @@ wxDEFINE_EVENT( UNITS_CHANGED, wxCommandEvent );
static const int s_minsize_x = 500;
static const int s_minsize_y = 400;
static const int s_defaultSize_x = 1280;
static const int s_defaultSize_y = 720;
BEGIN_EVENT_TABLE( EDA_BASE_FRAME, wxFrame )
EVT_MENU( wxID_ABOUT, EDA_BASE_FRAME::OnKicadAbout )
@ -82,6 +85,7 @@ EDA_BASE_FRAME::EDA_BASE_FRAME( wxWindow* aParent, FRAME_T aFrameType,
TOOLS_HOLDER(),
KIWAY_HOLDER( aKiway, KIWAY_HOLDER::FRAME ),
m_Ident( aFrameType ),
m_maximizeByDefault( false ),
m_infoBar( nullptr ),
m_settingsManager( nullptr ),
m_fileHistory( nullptr ),
@ -95,7 +99,7 @@ EDA_BASE_FRAME::EDA_BASE_FRAME( wxWindow* aParent, FRAME_T aFrameType,
{
m_autoSaveTimer = new wxTimer( this, ID_AUTO_SAVE_TIMER );
m_mruPath = wxStandardPaths::Get().GetDocumentsDir();
m_FrameSize = wxSize( s_minsize_x, s_minsize_y );
m_FrameSize = wxSize( s_defaultSize_x, s_defaultSize_y );
m_auimgr.SetArtProvider( new WX_AUI_DOCK_ART() );
@ -437,6 +441,8 @@ void EDA_BASE_FRAME::LoadWindowState( const wxString& aFileName )
void EDA_BASE_FRAME::LoadWindowState( const WINDOW_STATE& aState )
{
bool wasDefault = false;
m_FramePos.x = aState.pos_x;
m_FramePos.y = aState.pos_y;
m_FrameSize.x = aState.size_x;
@ -448,8 +454,9 @@ void EDA_BASE_FRAME::LoadWindowState( const WINDOW_STATE& aState )
// 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 )
{
m_FrameSize.x = s_minsize_x;
m_FrameSize.y = s_minsize_y;
m_FrameSize.x = s_defaultSize_x;
m_FrameSize.y = s_defaultSize_y;
wasDefault = true;
wxLogTrace( traceDisplayLocation, "Using minimum size (%d, %d)", m_FrameSize.x, m_FrameSize.y );
}
@ -528,7 +535,7 @@ void EDA_BASE_FRAME::LoadWindowState( const WINDOW_STATE& aState )
m_NormalFramePos = m_FramePos;
// Maximize if we were maximized before
if( aState.maximized )
if( aState.maximized || ( wasDefault && m_maximizeByDefault ) )
{
wxLogTrace( traceDisplayLocation, "Maximizing window" );
Maximize();

View File

@ -212,6 +212,7 @@ SCH_EDIT_FRAME::SCH_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ):
m_highlightedConn( nullptr ),
m_item_to_repeat( nullptr )
{
m_maximizeByDefault = true;
m_schematic = new SCHEMATIC( nullptr );
m_showBorderAndTitleBlock = true; // true to show sheet references

View File

@ -73,6 +73,7 @@ GERBVIEW_FRAME::GERBVIEW_FRAME( KIWAY* aKiway, wxWindow* aParent )
ID_GERBVIEW_JOB_FILE_LIST_CLEAR, _( "Clear Recent Job Files" ) ),
m_TextInfo( nullptr )
{
m_maximizeByDefault = true;
m_gerberLayout = nullptr;
m_show_layer_manager_tools = true;
m_showBorderAndTitleBlock = false; // true for reference drawings.

View File

@ -128,6 +128,7 @@ protected:
FRAME_T m_Ident; // Id Type (pcb, schematic, library..)
wxPoint m_FramePos;
wxSize m_FrameSize;
bool m_maximizeByDefault;
// These contain the frame size and position for when it is not maximized
wxPoint m_NormalFramePos;

View File

@ -86,6 +86,7 @@ PL_EDITOR_FRAME::PL_EDITOR_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
m_pageSelectBox( nullptr ),
m_propertiesPagelayout( nullptr )
{
m_maximizeByDefault = true;
m_userUnits = EDA_UNITS::MILLIMETRES;
m_showBorderAndTitleBlock = true; // true for reference drawings.

View File

@ -174,6 +174,7 @@ PCB_EDIT_FRAME::PCB_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
PCB_BASE_EDIT_FRAME( aKiway, aParent, FRAME_PCB_EDITOR, wxT( "Pcbnew" ), wxDefaultPosition,
wxDefaultSize, KICAD_DEFAULT_DRAWFRAME_STYLE, PCB_EDIT_FRAME_NAME )
{
m_maximizeByDefault = true;
m_showBorderAndTitleBlock = true; // true to display sheet references
m_SelTrackWidthBox = NULL;
m_SelViaSizeBox = NULL;