MCPcopy Create free account
hub / github.com/audacity/audacity / OnInit

Method OnInit

src/AudacityApp.cpp:1455–1535  ·  view source on GitHub ↗

The `main program' equivalent, creating the windows and returning the main frame

Source from the content-addressed store, hash-verified

1453// The `main program' equivalent, creating the windows and returning the
1454// main frame
1455bool AudacityApp::OnInit()
1456{
1457 RegisterBuiltinEffects();
1458
1459 // JKC: ANSWER-ME: Who actually added the event loop guarantor?
1460 // Although 'blame' says Leland, I think it came from a donated patch.
1461
1462 // PRL: It was added by LL at 54676a72285ba7ee3a69920e91fa390a71ef10c9 :
1463 // " Ensure OnInit() has an event loop
1464 // And allow events to flow so the splash window updates under GTK"
1465 // then mistakenly lost in the merge at
1466 // 37168ebbf67ae869ab71a3b5cbbf1d2a48e824aa
1467 // then restored at 7687972aa4b2199f0717165235f3ef68ade71e08
1468
1469 // Ensure we have an event loop during initialization
1470 wxEventLoopGuarantor eventLoop;
1471
1472 OnInit0();
1473
1474 FileNames::InitializePathList();
1475
1476 // Define languages for which we have translations, but that are not yet
1477 // supported by wxWidgets.
1478 //
1479 // TODO: The whole Language initialization really need to be reworked.
1480 // It's all over the place.
1481#if wxCHECK_VERSION(3, 0, 1) && !wxCHECK_VERSION(3, 1, 6)
1482 for (size_t i = 0, cnt = WXSIZEOF(userLangs); i < cnt; i++)
1483 {
1484 wxLocale::AddLanguage(userLangs[i]);
1485 }
1486#endif
1487
1488 // Initialize preferences and language
1489 {
1490 InitPreferences(audacity::ApplicationSettings::Call());
1491 PopulatePreferences();
1492 }
1493
1494 mThemeChangeSubscription = theTheme.Subscribe(OnThemeChange);
1495
1496 {
1497 wxBusyCursor busy;
1498 theTheme.LoadPreferredTheme();
1499 }
1500
1501 // AColor depends on theTheme.
1502 AColor::Init();
1503
1504 // If this fails, we must exit the program.
1505 if (!InitTempDir()) {
1506 FinishPreferences();
1507 return false;
1508 }
1509
1510 ThemeResources::Load();
1511
1512#ifdef __WXMAC__

Callers

nothing calls this directly

Calls 10

RegisterBuiltinEffectsFunction · 0.85
InitPreferencesFunction · 0.85
CallClass · 0.85
PopulatePreferencesFunction · 0.85
InitClass · 0.85
FinishPreferencesFunction · 0.85
LoadFunction · 0.85
CallAfterFunction · 0.85
LoadPreferredThemeMethod · 0.80
SubscribeMethod · 0.45

Tested by

no test coverage detected