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

Method PrefsDialog

src/prefs/PrefsDialog.cpp:441–597  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

439}
440
441PrefsDialog::PrefsDialog(
442 wxWindow * parent, AudacityProject *pProject,
443 const TranslatableString &titlePrefix,
444 PrefsPanel::Factories &factories)
445: wxDialogWrapper(parent, wxID_ANY, XO("Audacity Preferences"),
446 wxDefaultPosition,
447 wxDefaultSize,
448 wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER)
449, mFactories(factories)
450, mTitlePrefix(titlePrefix)
451{
452 wxASSERT(factories.size() > 0);
453 const bool uniquePage = (factories.size() == 1);
454 SetLayoutDirection(wxLayout_LeftToRight);
455
456 ShuttleGui S(this, eIsCreating);
457
458 S.StartVerticalLay(true);
459 {
460 wxASSERT(factories.size() > 0);
461 if (!uniquePage) {
462 mCategories = safenew wxTreebookExt(S.GetParent(), wxID_ANY, mTitlePrefix);
463#if wxUSE_ACCESSIBILITY
464 // so that name can be set on a standard control
465 mCategories->GetTreeCtrl()->SetAccessible(
466 safenew TreeCtrlAx(mCategories->GetTreeCtrl()));
467#endif
468 // RJH: Prevent NVDA from reading "treeCtrl"
469 mCategories->GetTreeCtrl()->SetName(_("Category"));
470 S.StartHorizontalLay(wxALIGN_LEFT | wxEXPAND, true);
471 {
472 S.Prop(1)
473 .Position(wxEXPAND)
474 .AddWindow(mCategories);
475
476 {
477 typedef std::pair<int, int> IntPair;
478 std::vector<IntPair> stack;
479 int iPage = 0;
480 for (auto it = factories.begin(), end = factories.end();
481 it != end; ++it, ++iPage)
482 {
483 const auto &node = *it;
484 const auto &factory = node.factory;
485 wxWindow *const w = factory(mCategories, wxID_ANY, pProject);
486 node.enabled = (w != nullptr);
487 if (stack.empty()) {
488 // Parameters are: AddPage(page, name, IsSelected, imageId).
489 if (w)
490 mCategories->AddPage(w, w->GetName(), false, 0);
491 }
492 else {
493 IntPair &top = *stack.rbegin();
494 if (w)
495 mCategories->InsertSubPage(top.first,
496 w, w->GetName(), false, 0);
497 if (--top.second == 0) {
498 // Expand all nodes before the layout calculation

Callers

nothing calls this directly

Calls 15

wxTreebookExtClass · 0.85
TreeCtrlAxClass · 0.85
GetParentFunction · 0.85
AddWindowMethod · 0.80
PositionMethod · 0.80
wxSizeClass · 0.50
sizeMethod · 0.45
GetParentMethod · 0.45
SetNameMethod · 0.45
beginMethod · 0.45
endMethod · 0.45
emptyMethod · 0.45

Tested by

no test coverage detected