| 448 | } |
| 449 | |
| 450 | bool ShowAutoRecoveryDialogIfNeeded(AudacityProject *&pproj, bool *didRecoverAnything) |
| 451 | { |
| 452 | if (didRecoverAnything) |
| 453 | { |
| 454 | *didRecoverAnything = false; |
| 455 | } |
| 456 | |
| 457 | bool success = true; |
| 458 | |
| 459 | // Under wxGTK3, the auto recovery dialog will not get |
| 460 | // the focus since the project window hasn't been allowed |
| 461 | // to completely initialize. |
| 462 | // |
| 463 | // Yielding seems to allow the initialization to complete. |
| 464 | // |
| 465 | // Additionally, it also corrects a sizing issue in the dialog |
| 466 | // related to wxWidgets bug: |
| 467 | // |
| 468 | // http://trac.wxwidgets.org/ticket/16440 |
| 469 | // |
| 470 | // This must be done before "dlg" is declared. |
| 471 | wxEventLoopBase::GetActive()->YieldFor(wxEVT_CATEGORY_UI | wxEVT_CATEGORY_USER_INPUT); |
| 472 | |
| 473 | AutoRecoveryDialog dialog(pproj); |
| 474 | |
| 475 | if (dialog.HasRecoverables()) |
| 476 | { |
| 477 | int ret = dialog.ShowModal(); |
| 478 | |
| 479 | switch (ret) |
| 480 | { |
| 481 | case ID_SKIP: |
| 482 | success = true; |
| 483 | break; |
| 484 | |
| 485 | case ID_DISCARD_SELECTED: |
| 486 | DiscardAllProjects(dialog.GetRecoverables()); |
| 487 | success = true; |
| 488 | break; |
| 489 | |
| 490 | case ID_RECOVER_SELECTED: |
| 491 | success = RecoverAllProjects(dialog.GetRecoverables(), pproj); |
| 492 | if (success) |
| 493 | { |
| 494 | if (didRecoverAnything) |
| 495 | { |
| 496 | *didRecoverAnything = true; |
| 497 | } |
| 498 | } |
| 499 | break; |
| 500 | |
| 501 | default: |
| 502 | // This includes ID_QUIT_AUDACITY |
| 503 | return false; |
| 504 | } |
| 505 | } |
| 506 | |
| 507 | return success; |
no test coverage detected