From 52627a0fc521320dd65bc70454ee7bb73c1e07e6 Mon Sep 17 00:00:00 2001 From: Niels Martin Hansen Date: Sat, 26 Jun 2010 14:16:59 +0000 Subject: [PATCH] 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. --- aegisub/src/dialog_splash.cpp | 32 --------------------------- aegisub/src/dialog_splash.h | 6 ----- aegisub/src/frame_main.cpp | 41 +++++++++++++++++++++-------------- 3 files changed, 25 insertions(+), 54 deletions(-) diff --git a/aegisub/src/dialog_splash.cpp b/aegisub/src/dialog_splash.cpp index 08c85c04b..35ff46edd 100644 --- a/aegisub/src/dialog_splash.cpp +++ b/aegisub/src/dialog_splash.cpp @@ -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); -} - - diff --git a/aegisub/src/dialog_splash.h b/aegisub/src/dialog_splash.h index 525e7a244..783beb6cf 100644 --- a/aegisub/src/dialog_splash.h +++ b/aegisub/src/dialog_splash.h @@ -41,7 +41,6 @@ // Includes #ifndef AGI_PRE #include -#include #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() }; diff --git a/aegisub/src/frame_main.cpp b/aegisub/src/frame_main.cpp index 416f2df44..037dfae02 100644 --- a/aegisub/src/frame_main.cpp +++ b/aegisub/src/frame_main.cpp @@ -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")); }