From e4825d4067d158687374c06863ef1aaba47358c5 Mon Sep 17 00:00:00 2001 From: Rodrigo Braz Monteiro Date: Tue, 26 Dec 2006 03:32:48 +0000 Subject: [PATCH] Improved Splash Screen behavior to show up even if the program is frozen loading subtitles, and to center on the current display. Originally committed to SVN as r623. --- core/changelog.txt | 1 + core/dialog_splash.cpp | 17 ++++++++++++----- core/frame_main.cpp | 33 ++++++++++++++++++--------------- core/main.cpp | 1 - 4 files changed, 31 insertions(+), 21 deletions(-) diff --git a/core/changelog.txt b/core/changelog.txt index c494eccaf..00dfdb47f 100644 --- a/core/changelog.txt +++ b/core/changelog.txt @@ -45,6 +45,7 @@ Please visit http://aegisub.net to download latest version - Added an inline MyThes-based Thesaurus. (AMZ) - Added two options ("Audio HD Cache Location" and "Audio HD Cache Name") that allows you to specify where to keep the audio cache. (AMZ) - Flexibible audio cache names now allow you to have more than one copy of Aegisub open with audio loaded to HD cache. (AMZ) +- Improved Splash Screen behavior to show up even if the program is frozen loading subtitles, and to center on the current display. (AMZ) = 1.10 beta - 2006.08.07 =========================== diff --git a/core/dialog_splash.cpp b/core/dialog_splash.cpp index 67f3f643c..d912ab10f 100644 --- a/core/dialog_splash.cpp +++ b/core/dialog_splash.cpp @@ -46,7 +46,7 @@ /////////////// // Constructor SplashScreen::SplashScreen(wxWindow *parent) -: wxFrame (NULL, -1, _T(""), wxDefaultPosition, wxSize(400,240), wxSTAY_ON_TOP | wxFRAME_NO_TASKBAR , _T("Splash")) +: wxFrame (parent, -1, _T(""), wxDefaultPosition, wxSize(400,240), wxSTAY_ON_TOP | wxFRAME_NO_TASKBAR , _T("Splash")) { // Set parent par = parent; @@ -54,10 +54,17 @@ SplashScreen::SplashScreen(wxWindow *parent) // Get splash splash = wxBITMAP(splash); - // Set position - Center(); - //wxDisplay display(wxDisplay::GetFromPoint(parent->GetPosition())); - //wxRect rect = display.GetGeometry(); + #if wxUSE_DISPLAY == 1 + // Center on current display + wxDisplay display(wxDisplay::GetFromPoint(parent->GetScreenPosition())); + wxRect dr = display.GetGeometry(); + wxRect window = GetScreenRect(); + window = window.CenterIn(dr); + Move(window.GetLeft(),window.GetTop()); + #else + // Center on window + CentreOnParent(); + #endif // Prepare wxClientDC dc(this); diff --git a/core/frame_main.cpp b/core/frame_main.cpp index 48bbf802b..3661c3426 100644 --- a/core/frame_main.cpp +++ b/core/frame_main.cpp @@ -74,18 +74,6 @@ FrameMain::FrameMain (wxArrayString args) : wxFrame ((wxFrame*)NULL,-1,_T(""),wxDefaultPosition,wxSize(800,600),wxDEFAULT_FRAME_STYLE | wxCLIP_CHILDREN) { - // Splash screen - #ifndef _DEBUG - if (Options.AsBool(_T("Show Splash"))) { - SplashScreen *splash = new SplashScreen(NULL); - splash->Show(true); - } - else { - // Show tip of the day - TipOfTheDay::Show(this); - } - #endif - // Initialize flags HasSelection = false; menuCreated = false; @@ -105,10 +93,21 @@ FrameMain::FrameMain (wxArrayString args) // Contents curMode = -1; InitContents(); + Show(); - // Parse arguments - LoadSubtitles(_T("")); - LoadList(args); + // Splash screen + //#ifndef _DEBUG + if (Options.AsBool(_T("Show Splash"))) { + SplashScreen *splash = new SplashScreen(this); + splash->Show(true); + splash->Update(); + } + else { + // Show tip of the day + TipOfTheDay::Show(this); + } + //#endif + wxSafeYield(); // Set autosave timer AutoSave.SetOwner(this,AutoSave_Timer); @@ -123,6 +122,10 @@ FrameMain::FrameMain (wxArrayString args) // Set drop target SetDropTarget(new AegisubFileDropTarget(this)); + + // Parse arguments + LoadSubtitles(_T("")); + LoadList(args); } diff --git a/core/main.cpp b/core/main.cpp index 10f367d3d..9bb0f58db 100644 --- a/core/main.cpp +++ b/core/main.cpp @@ -114,7 +114,6 @@ bool AegisubApp::OnInit() { // Open main frame frame = new FrameMain(subs); - frame->Show(true); SetTopWindow(frame); }