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 // Prepare
wxClientDC dc(this); wxClientDC dc(this);
dc.DrawBitmap(splash,0,0); dc.DrawBitmap(splash,0,0);
autoClose = new wxTimer(this,5000);
autoClose->Start(5000,true);
} }
@ -101,17 +98,13 @@ SplashScreen::SplashScreen(wxWindow *parent)
/// @brief Destructor /// @brief Destructor
/// ///
SplashScreen::~SplashScreen () { SplashScreen::~SplashScreen () {
// Kill timer
delete autoClose;
} }
/////////////// ///////////////
// Event table // Event table
BEGIN_EVENT_TABLE(SplashScreen, wxFrame) BEGIN_EVENT_TABLE(SplashScreen, wxFrame)
EVT_MOUSE_EVENTS(SplashScreen::OnMouseEvent)
EVT_PAINT(SplashScreen::OnPaint) EVT_PAINT(SplashScreen::OnPaint)
EVT_TIMER(5000,SplashScreen::OnTimer)
END_EVENT_TABLE() END_EVENT_TABLE()
@ -124,28 +117,3 @@ void SplashScreen::OnPaint(wxPaintEvent& event) {
dc.DrawBitmap(splash,0,0); 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 // Includes
#ifndef AGI_PRE #ifndef AGI_PRE
#include <wx/frame.h> #include <wx/frame.h>
#include <wx/timer.h>
#endif #endif
@ -63,12 +62,7 @@ public:
SplashScreen(wxWindow *parent); SplashScreen(wxWindow *parent);
~SplashScreen(); ~SplashScreen();
/// DOCME
wxTimer *autoClose;
void OnPaint(wxPaintEvent& event); void OnPaint(wxPaintEvent& event);
void OnMouseEvent(wxMouseEvent& event);
void OnTimer(wxTimerEvent &event);
DECLARE_EVENT_TABLE() DECLARE_EVENT_TABLE()
}; };

View File

@ -127,6 +127,21 @@ FrameMain::FrameMain (wxArrayString args)
wxPNGHandler *png = new wxPNGHandler; wxPNGHandler *png = new wxPNGHandler;
wxImage::AddHandler(png); 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 // Storage for subs-file-local scripts
#ifdef WITH_AUTOMATION #ifdef WITH_AUTOMATION
StartupLog(_T("Create local Automation script manager")); StartupLog(_T("Create local Automation script manager"));
@ -162,22 +177,6 @@ FrameMain::FrameMain (wxArrayString args)
stylingAssistant = NULL; stylingAssistant = NULL;
StartupLog(_T("Initialize inner main window controls")); StartupLog(_T("Initialize inner main window controls"));
InitContents(); 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 // Set autosave timer
StartupLog(_T("Set up Auto Save")); StartupLog(_T("Set up Auto Save"));
@ -213,6 +212,16 @@ FrameMain::FrameMain (wxArrayString args)
PerformVersionCheck(false); PerformVersionCheck(false);
StartupLog(_T("Display main window"));
Freeze();
Show();
SetDisplayMode(1, 1);
Thaw();
if (splash) {
delete splash;
}
//ShowFullScreen(true,wxFULLSCREEN_NOBORDER | wxFULLSCREEN_NOCAPTION); //ShowFullScreen(true,wxFULLSCREEN_NOBORDER | wxFULLSCREEN_NOCAPTION);
StartupLog(_T("Leaving FrameMain constructor")); StartupLog(_T("Leaving FrameMain constructor"));
} }