| 1331 | } |
| 1332 | |
| 1333 | void AudacityApp::HideSplashScreen(bool fadeOut) |
| 1334 | { |
| 1335 | const int fadeDurationMs = 120; |
| 1336 | const int fadeStepMs = 16; |
| 1337 | |
| 1338 | const int maxTransparency = 255; |
| 1339 | const int numSteps = fadeDurationMs / fadeStepMs; |
| 1340 | const int transparencyDecrement = maxTransparency / numSteps; |
| 1341 | |
| 1342 | int currentAlpha = maxTransparency; |
| 1343 | |
| 1344 | // Splash was already destroyed |
| 1345 | if (!mSplashScreen) { |
| 1346 | return; |
| 1347 | } |
| 1348 | |
| 1349 | if (!fadeOut) { |
| 1350 | mSplashScreen->Destroy(); |
| 1351 | mSplashScreen.release(); |
| 1352 | return; |
| 1353 | } |
| 1354 | |
| 1355 | mSplashTimer.Start(fadeStepMs); |
| 1356 | |
| 1357 | mSplashTimer.Bind(wxEVT_TIMER, [this, currentAlpha, transparencyDecrement](wxTimerEvent& evt) mutable { |
| 1358 | currentAlpha -= transparencyDecrement; |
| 1359 | if (!mSplashScreen) { |
| 1360 | mSplashTimer.Stop(); |
| 1361 | } |
| 1362 | else if (currentAlpha <= 0) { |
| 1363 | mSplashTimer.Stop(); |
| 1364 | mSplashScreen->Destroy(); |
| 1365 | mSplashScreen.release(); |
| 1366 | } |
| 1367 | else if (mSplashScreen->CanSetTransparent()) { |
| 1368 | mSplashScreen->SetTransparent(currentAlpha); |
| 1369 | } |
| 1370 | }); |
| 1371 | } |
| 1372 | |
| 1373 | // Some of the many initialization steps |
| 1374 | void AudacityApp::OnInit0() |