Show splash screen much earlier, and show main window much later. Also be smoother about the display of the main window, avoid flickery relayouting. Remove splash screen "click to close" behaviour as well as timed close, just hide it when the main window has been shown.

Originally committed to SVN as r4606.
This commit is contained in:
Niels Martin Hansen 2010-06-26 14:16:59 +00:00
parent c15f0ada62
commit 52627a0fc5
3 changed files with 25 additions and 54 deletions

View file

@ -91,9 +91,6 @@ SplashScreen::SplashScreen(wxWindow *parent)
// Prepare
wxClientDC dc(this);
dc.DrawBitmap(splash,0,0);
autoClose = new wxTimer(this,5000);
autoClose->Start(5000,true);
}
@ -101,17 +98,13 @@ SplashScreen::SplashScreen(wxWindow *parent)
/// @brief Destructor
///
SplashScreen::~SplashScreen () {
// Kill timer
delete autoClose;
}
///////////////
// Event table
BEGIN_EVENT_TABLE(SplashScreen, wxFrame)
EVT_MOUSE_EVENTS(SplashScreen::OnMouseEvent)
EVT_PAINT(SplashScreen::OnPaint)
EVT_TIMER(5000,SplashScreen::OnTimer)
END_EVENT_TABLE()
@ -124,28 +117,3 @@ void SplashScreen::OnPaint(wxPaintEvent& event) {
dc.DrawBitmap(splash,0,0);
}
/// @brief Mouse events
/// @param event
///
void SplashScreen::OnMouseEvent(wxMouseEvent& event) {
if (event.ButtonDown()) {
// Show tip of the day
Destroy();
TipOfTheDay::Show(par);
}
}
/// @brief Timer
/// @param event
///
void SplashScreen::OnTimer(wxTimerEvent &event) {
// Show tip of the day
Destroy();
TipOfTheDay::Show(par);
}

View file

@ -41,7 +41,6 @@
// Includes
#ifndef AGI_PRE
#include <wx/frame.h>
#include <wx/timer.h>
#endif
@ -63,12 +62,7 @@ public:
SplashScreen(wxWindow *parent);
~SplashScreen();
/// DOCME
wxTimer *autoClose;
void OnPaint(wxPaintEvent& event);
void OnMouseEvent(wxMouseEvent& event);
void OnTimer(wxTimerEvent &event);
DECLARE_EVENT_TABLE()
};

View file

@ -127,6 +127,21 @@ FrameMain::FrameMain (wxArrayString args)
wxPNGHandler *png = new wxPNGHandler;
wxImage::AddHandler(png);
// Splash screen
// It doesn't work properly on wxMac, and the jumping dock icon
// signals the same as the splash screen either way.
SplashScreen *splash = 0;
#if !_DEBUG && !__WXMAC__
if (OPT_GET("App/Splash")->GetBool()) {
splash = new SplashScreen(this);
splash->Show(true);
splash->Update();
}
else
#endif
wxSafeYield();
// Storage for subs-file-local scripts
#ifdef WITH_AUTOMATION
StartupLog(_T("Create local Automation script manager"));
@ -162,22 +177,6 @@ FrameMain::FrameMain (wxArrayString args)
stylingAssistant = NULL;
StartupLog(_T("Initialize inner main window controls"));
InitContents();
StartupLog(_T("Display main window"));
Show();
// Splash screen
// It doesn't work properly on wxMac, and the jumping dock icon
// signals the same as the splash screen either way.
#if !_DEBUG && !__WXMAC__
if (OPT_GET("App/Splash")->GetBool()) {
SplashScreen *splash = new SplashScreen(this);
splash->Show(true);
splash->Update();
}
else
#endif
wxSafeYield();
// Set autosave timer
StartupLog(_T("Set up Auto Save"));
@ -213,6 +212,16 @@ FrameMain::FrameMain (wxArrayString args)
PerformVersionCheck(false);
StartupLog(_T("Display main window"));
Freeze();
Show();
SetDisplayMode(1, 1);
Thaw();
if (splash) {
delete splash;
}
//ShowFullScreen(true,wxFULLSCREEN_NOBORDER | wxFULLSCREEN_NOCAPTION);
StartupLog(_T("Leaving FrameMain constructor"));
}