ADDED: Startup splashscreen

This is purely loading in the background based and has no artificial delay.
Will be more useful once kicad.exe ends up loading more on launch immediately ;)
Right now the splash is probably visible the longest launching pcbnew standalone.

The actual splash image can be considered a placeholder
This commit is contained in:
Marek Roszko 2023-06-19 18:48:57 -04:00
parent fa84575510
commit 74d6dc6642
12 changed files with 20854 additions and 0 deletions

View File

@ -1093,6 +1093,7 @@ void BuildBitmapInfo( std::unordered_map<BITMAPS, std::vector<BITMAP_INFO>>& aBi
aBitmapInfoCache[BITMAPS::rectwaveguide].emplace_back( BITMAPS::rectwaveguide, wxT( "rectwaveguide.png" ), -1, wxT( "light" ) );
aBitmapInfoCache[BITMAPS::regul].emplace_back( BITMAPS::regul, wxT( "regul.png" ), -1, wxT( "light" ) );
aBitmapInfoCache[BITMAPS::regul_3pins].emplace_back( BITMAPS::regul_3pins, wxT( "regul_3pins.png" ), -1, wxT( "light" ) );
aBitmapInfoCache[BITMAPS::splash].emplace_back( BITMAPS::splash, wxT( "splash.png" ), -1, wxT( "light" ) );
aBitmapInfoCache[BITMAPS::stripline].emplace_back( BITMAPS::stripline, wxT( "stripline.png" ), -1, wxT( "light" ) );
aBitmapInfoCache[BITMAPS::stroke_dash].emplace_back( BITMAPS::stroke_dash, wxT( "stroke_dash.png" ), -1, wxT( "light" ) );
aBitmapInfoCache[BITMAPS::stroke_dashdot].emplace_back( BITMAPS::stroke_dashdot, wxT( "stroke_dashdot.png" ), -1, wxT( "light" ) );
@ -1132,6 +1133,7 @@ void BuildBitmapInfo( std::unordered_map<BITMAPS, std::vector<BITMAP_INFO>>& aBi
aBitmapInfoCache[BITMAPS::rectwaveguide].emplace_back( BITMAPS::rectwaveguide, wxT( "rectwaveguide_dark.png" ), -1, wxT( "dark" ) );
aBitmapInfoCache[BITMAPS::regul].emplace_back( BITMAPS::regul, wxT( "regul_dark.png" ), -1, wxT( "dark" ) );
aBitmapInfoCache[BITMAPS::regul_3pins].emplace_back( BITMAPS::regul_3pins, wxT( "regul_3pins_dark.png" ), -1, wxT( "dark" ) );
aBitmapInfoCache[BITMAPS::splash].emplace_back( BITMAPS::splash, wxT( "splash_dark.png" ), -1, wxT( "dark" ) );
aBitmapInfoCache[BITMAPS::stripline].emplace_back( BITMAPS::stripline, wxT( "stripline_dark.png" ), -1, wxT( "dark" ) );
aBitmapInfoCache[BITMAPS::stroke_dash].emplace_back( BITMAPS::stroke_dash, wxT( "stroke_dash_dark.png" ), -1, wxT( "dark" ) );
aBitmapInfoCache[BITMAPS::stroke_dashdot].emplace_back( BITMAPS::stroke_dashdot, wxT( "stroke_dashdot_dark.png" ), -1, wxT( "dark" ) );

View File

@ -43,6 +43,7 @@
#include <wx/tooltip.h>
#include <advanced_config.h>
#include <bitmaps.h>
#include <cli/cli_names.h> // Needed for the pre wx 3.2 cli workaround
#include <common.h>
#include <config_params.h>
@ -66,6 +67,8 @@
#include <thread_pool.h>
#include <trace_helpers.h>
#include <wx/splash.h>
#ifdef KICAD_USE_SENTRY
#include <boost/uuid/uuid_io.hpp>
#include <boost/uuid/uuid_generators.hpp>
@ -130,6 +133,7 @@ PGM_BASE::PGM_BASE()
m_Quitting = false;
m_argcUtf8 = 0;
m_argvUtf8 = nullptr;
m_splash = nullptr;
setLanguageId( wxLANGUAGE_DEFAULT );
@ -139,6 +143,7 @@ PGM_BASE::PGM_BASE()
PGM_BASE::~PGM_BASE()
{
HideSplash();
Destroy();
for( int n = 0; n < m_argcUtf8; n++ )
@ -399,6 +404,28 @@ void PGM_BASE::BuildArgvUtf8()
}
void PGM_BASE::ShowSplash()
{
if( m_splash )
return;
m_splash = new wxSplashScreen( KiBitmap( BITMAPS::splash ), wxSPLASH_CENTRE_ON_SCREEN, 0,
NULL, -1, wxDefaultPosition, wxDefaultSize, wxBORDER_NONE | wxSTAY_ON_TOP );
wxYield();
}
void PGM_BASE::HideSplash()
{
if( !m_splash )
return;
m_splash->Close();
m_splash->Destroy();
m_splash = nullptr;
}
bool PGM_BASE::InitPgm( bool aHeadless, bool aSkipPyInit, bool aIsUnitTest )
{
#if defined( __WXMAC__ )
@ -479,6 +506,9 @@ bool PGM_BASE::InitPgm( bool aHeadless, bool aSkipPyInit, bool aIsUnitTest )
SetLanguagePath();
SetDefaultLanguage( tmp );
if( !aHeadless )
ShowSplash();
m_settings_manager = std::make_unique<SETTINGS_MANAGER>( aHeadless );
// Our unit test mocks break if we continue

View File

@ -408,5 +408,7 @@ bool PGM_SINGLE_TOP::OnPgmInit()
frame->OpenProjectFiles( fileArgs );
}
HideSplash();
return true;
}

View File

@ -544,6 +544,7 @@ enum class BITMAPS : unsigned int
small_up,
small_warning,
special_tools,
splash,
spreadsheet,
stripline,
stroke_dash,

View File

@ -46,6 +46,7 @@ class wxSingleInstanceChecker;
class wxApp;
class wxMenu;
class wxWindow;
class wxSplashScreen;
class COMMON_SETTINGS;
class SETTINGS_MANAGER;
@ -352,6 +353,10 @@ public:
*/
bool IsGUI();
void ShowSplash();
void HideSplash();
/**
* wxWidgets on MSW tends to crash if you spool up more than one print job at a time.
*/
@ -407,6 +412,8 @@ protected:
/// and will return argv as either force converted to ascii in char* or wchar_t only
int m_argcUtf8;
wxSplashScreen* m_splash;
};

View File

@ -353,6 +353,8 @@ bool PGM_KICAD::OnPgmInit()
frame->Show( true );
frame->Raise();
HideSplash();
return true;
}

View File

@ -636,6 +636,7 @@ set( BMAPS_OTHER
creepage_clearance
cpw
cpw_back
light
microstrip
microstrip_zodd_zeven
pads_npth
@ -648,6 +649,7 @@ set( BMAPS_OTHER
rectwaveguide
regul
regul_3pins
splash
stripline
stroke_dash
stroke_dashdot

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 340 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 340 KiB

File diff suppressed because it is too large Load Diff

After

Width:  |  Height:  |  Size: 780 KiB

File diff suppressed because it is too large Load Diff

After

Width:  |  Height:  |  Size: 780 KiB