| 1279 | } |
| 1280 | |
| 1281 | void AudacityApp::ShowSplashScreen() { |
| 1282 | // Bug 718: Position splash screen on same screen |
| 1283 | // as where Audacity project will appear. |
| 1284 | wxRect wndRect; |
| 1285 | bool bMaximized = false; |
| 1286 | bool bIconized = false; |
| 1287 | GetNextWindowPlacement(&wndRect, &bMaximized, &bIconized); |
| 1288 | |
| 1289 | // BG: Create a temporary window to set as the top window |
| 1290 | wxImage logoimage((const char**)Audacity_splash_xpm); |
| 1291 | logoimage.Scale(logoimage.GetWidth() * (2.0 / 3.0), logoimage.GetHeight() * (2.0 / 3.0), wxIMAGE_QUALITY_HIGH); |
| 1292 | #ifdef __WXMSW__ |
| 1293 | // We need to mirror the image for right-to-left languages on Windows only |
| 1294 | if (GetLayoutDirection() == wxLayout_RightToLeft) |
| 1295 | logoimage = logoimage.Mirror(); |
| 1296 | #endif |
| 1297 | wxBitmap logo(logoimage); |
| 1298 | |
| 1299 | mSplashScreen = std::make_unique<wxSplashScreen>( |
| 1300 | logo, |
| 1301 | wxSPLASH_CENTRE_ON_SCREEN | wxSPLASH_NO_TIMEOUT, |
| 1302 | 0, |
| 1303 | nullptr, |
| 1304 | wxID_ANY, |
| 1305 | wndRect.GetTopLeft(), |
| 1306 | wxDefaultSize, |
| 1307 | wxSTAY_ON_TOP); |
| 1308 | |
| 1309 | // If the user interacts with another top level window while the splash screen is visible |
| 1310 | // it gets destroyed automatically, need to hanlde that to prevent the fade out of deleted object |
| 1311 | mSplashScreen->Bind(wxEVT_DESTROY, [this](wxWindowDestroyEvent& event) { |
| 1312 | mSplashScreen.release(); |
| 1313 | event.Skip(); |
| 1314 | } |
| 1315 | ); |
| 1316 | |
| 1317 | // Unfortunately with the Windows 10 Creators update, the splash screen |
| 1318 | // now appears before setting its position. |
| 1319 | // On a dual monitor screen it will appear on one screen and then |
| 1320 | // possibly jump to the second. |
| 1321 | // We could fix this by writing our own splash screen and using Hide() |
| 1322 | // until the splash scren was correctly positioned, then Show() |
| 1323 | |
| 1324 | // Possibly move it on to the second screen... |
| 1325 | mSplashScreen->SetPosition(wndRect.GetTopLeft()); |
| 1326 | // Centered on whichever screen it is on. |
| 1327 | mSplashScreen->Center(); |
| 1328 | mSplashScreen->SetTitle(_("Audacity is starting up...")); |
| 1329 | SetTopWindow(mSplashScreen.get()); |
| 1330 | mSplashScreen->Raise(); |
| 1331 | } |
| 1332 | |
| 1333 | void AudacityApp::HideSplashScreen(bool fadeOut) |
| 1334 | { |
nothing calls this directly
no test coverage detected