mirror of
https://github.com/cookiengineer/audacity
synced 2025-07-26 17:38:10 +02:00
Split Inits between OnInit() and FinishInits()
This is after reading a note in the release notes for wxWidgets 3.0.0. We need an event loop running to show a dialog in 3.0.0 (even though the splash screen works without).
This commit is contained in:
parent
6e07efa539
commit
44808022e1
@ -1167,19 +1167,37 @@ bool AudacityApp::OnInit()
|
|||||||
mLocale = NULL;
|
mLocale = NULL;
|
||||||
InitLang( lang );
|
InitLang( lang );
|
||||||
|
|
||||||
|
// Init DirManager, which initializes the temp directory
|
||||||
|
// If this fails, we must exit the program.
|
||||||
|
|
||||||
|
if (!InitTempDir()) {
|
||||||
|
FinishPreferences();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
//JKC We'd like to initialise the module manager WHILE showing the splash screen.
|
#if !wxCHECK_VERSION(3, 0, 0)
|
||||||
//Can't as MultiDialog interacts poorly with the splash screen. So we do it before.
|
FinishInits();
|
||||||
//TODO: Find out why opening a multidialog wrecks the splash screen.
|
#endif
|
||||||
//best current guess is that it's something to do with doing a DoModal this early
|
return TRUE;
|
||||||
//in the program.
|
}
|
||||||
|
|
||||||
// Initialize the CommandHandler
|
#if wxCHECK_VERSION(3, 0, 0)
|
||||||
InitCommandHandler();
|
void AudacityApp::OnEventLoopEnter(wxEventLoopBase * pLoop)
|
||||||
// Initialize the ModuleManager, including loading found modules
|
{
|
||||||
ModuleManager::Initialize(*mCmdHandler);
|
if( !pLoop->IsMain() )
|
||||||
|
return;
|
||||||
|
FinishInits();
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// JKC: I've split 'FinishInits()' from 'OnInit()', so that
|
||||||
|
// we can have a real event loop running. We could (I think)
|
||||||
|
// put everything that is in OnInit() in here.
|
||||||
|
// This change was to support wxWidgets 3.0.0 and allow us
|
||||||
|
// to show a dialog (for module loading) during initialisation.
|
||||||
|
// without it messing up the splash screen.
|
||||||
|
void AudacityApp::FinishInits()
|
||||||
|
{
|
||||||
// BG: Create a temporary window to set as the top window
|
// BG: Create a temporary window to set as the top window
|
||||||
wxImage logoimage((const char **) AudacityLogoWithName_xpm);
|
wxImage logoimage((const char **) AudacityLogoWithName_xpm);
|
||||||
logoimage.Rescale(logoimage.GetWidth() / 2, logoimage.GetHeight() / 2);
|
logoimage.Rescale(logoimage.GetWidth() / 2, logoimage.GetHeight() / 2);
|
||||||
@ -1199,14 +1217,18 @@ bool AudacityApp::OnInit()
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//JKC We'd like to initialise the module manager WHILE showing the splash screen.
|
||||||
|
//Can't as MultiDialog interacts poorly with the splash screen. So we do it before.
|
||||||
|
//TODO: Find out why opening a multidialog wrecks the splash screen.
|
||||||
|
//best current guess is that it's something to do with doing a DoModal this early
|
||||||
|
//in the program.
|
||||||
|
|
||||||
|
// Initialize the CommandHandler
|
||||||
|
InitCommandHandler();
|
||||||
|
// Initialize the ModuleManager, including loading found modules
|
||||||
|
ModuleManager::Initialize(*mCmdHandler);
|
||||||
|
|
||||||
// Init DirManager, which initializes the temp directory
|
|
||||||
// If this fails, we must exit the program.
|
|
||||||
|
|
||||||
if (!InitTempDir()) {
|
|
||||||
FinishPreferences();
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// More initialization
|
// More initialization
|
||||||
|
|
||||||
@ -1446,7 +1468,6 @@ bool AudacityApp::OnInit()
|
|||||||
|
|
||||||
mTimer = new wxTimer(this, kAudacityAppTimerID);
|
mTimer = new wxTimer(this, kAudacityAppTimerID);
|
||||||
mTimer->Start(200);
|
mTimer->Start(200);
|
||||||
return TRUE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void AudacityApp::InitCommandHandler()
|
void AudacityApp::InitCommandHandler()
|
||||||
|
@ -96,6 +96,10 @@ class BlockFile;
|
|||||||
class AudacityApp:public wxApp {
|
class AudacityApp:public wxApp {
|
||||||
public:
|
public:
|
||||||
virtual bool OnInit(void);
|
virtual bool OnInit(void);
|
||||||
|
void FinishInits();
|
||||||
|
#if wxCHECK_VERSION(3, 0, 0)
|
||||||
|
virtual void OnEventLoopEnter(wxEventLoopBase * pLoop);
|
||||||
|
#endif
|
||||||
virtual int OnExit(void);
|
virtual int OnExit(void);
|
||||||
virtual void OnFatalException();
|
virtual void OnFatalException();
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user