From eb7dc6ddd95291d835d1aec72f98c0551620bb5a Mon Sep 17 00:00:00 2001 From: jean-pierre charras Date: Mon, 21 Dec 2020 17:44:10 +0100 Subject: [PATCH] Minor fixes. In stand alone show the frame as soon as possible. Especially when running Pcbnew to open a complex board the frame is shown faster. Add also a busy cursor when loading files and building the data. --- common/single_top.cpp | 10 ++++++++-- common/widgets/infobar.cpp | 2 +- eeschema/files-io.cpp | 4 ++++ pcbnew/files.cpp | 4 ++++ 4 files changed, 17 insertions(+), 3 deletions(-) diff --git a/common/single_top.cpp b/common/single_top.cpp index bca81112ed..f431c06858 100644 --- a/common/single_top.cpp +++ b/common/single_top.cpp @@ -391,6 +391,14 @@ bool PGM_SINGLE_TOP::OnPgmInit() App().SetTopWindow( frame ); // wxApp gets a face. + // Allocate a slice of time to show the frame and update wxWidgets widgets + // (especially setting valid sizes) after creating frame and before calling + // OpenProjectFiles() that can update/use some widgets. + // The 2 calls to wxSafeYield are needed on wxGTK for best results. + wxSafeYield(); + frame->Show(); + wxSafeYield(); + // Individual frames may provide additional option/switch processing, but for compatibility, // any positional arguments are treated as a list of files to pass to OpenProjectFiles frame->ParseArgs( parser ); @@ -448,7 +456,5 @@ bool PGM_SINGLE_TOP::OnPgmInit() } } - frame->Show(); - return true; } diff --git a/common/widgets/infobar.cpp b/common/widgets/infobar.cpp index de58463965..3723ec7e97 100644 --- a/common/widgets/infobar.cpp +++ b/common/widgets/infobar.cpp @@ -157,7 +157,7 @@ void WX_INFOBAR::Dismiss() void WX_INFOBAR::onSize( wxSizeEvent& aEvent ) { int barWidth = GetSize().GetWidth(); - int parentWidth = m_parent->GetSize().GetWidth(); + int parentWidth = m_parent->GetClientSize().GetWidth(); if( barWidth != parentWidth ) SetSize( parentWidth, GetSize().GetHeight() ); diff --git a/eeschema/files-io.cpp b/eeschema/files-io.cpp index 56e4399161..25f65ea29d 100644 --- a/eeschema/files-io.cpp +++ b/eeschema/files-io.cpp @@ -277,6 +277,10 @@ bool SCH_EDIT_FRAME::OpenProjectFiles( const std::vector& aFileSet, in return false; } + // Loading a complex project and build data can be time + // consumming, so display a busy cursor + wxBusyCursor dummy; + // unload current project file before loading new { SetScreen( nullptr ); diff --git a/pcbnew/files.cpp b/pcbnew/files.cpp index d6240dbac9..8424aaa1a7 100644 --- a/pcbnew/files.cpp +++ b/pcbnew/files.cpp @@ -575,6 +575,10 @@ bool PCB_EDIT_FRAME::OpenProjectFiles( const std::vector& aFileSet, in return false; } + // Loading a complex project and build data can be time + // consumming, so display a busy cursor + wxBusyCursor dummy; + // Unlink the old project if needed GetBoard()->ClearProject();