| 94 | }; |
| 95 | |
| 96 | MainFrame::MainFrame(const wxString& title) |
| 97 | : wxFrame(nullptr, wxID_ANY, title, wxDefaultPosition, wxSize(900, 750)) |
| 98 | { |
| 99 | bool isAdmin = ::IsUserAnAdmin(); |
| 100 | m_isAdmin = isAdmin; |
| 101 | |
| 102 | if (isAdmin) |
| 103 | { |
| 104 | SetTitle(title + L" (Administrator)"); |
| 105 | } |
| 106 | m_baseTitle = GetTitle(); |
| 107 | |
| 108 | SelectionDialog dialog(nullptr, isAdmin); |
| 109 | int result = dialog.ShowModal(); |
| 110 | |
| 111 | if (result == wxID_CANCEL) |
| 112 | { |
| 113 | m_initCanceled = true; |
| 114 | return; |
| 115 | } |
| 116 | |
| 117 | bool useHklm = (result == wxID_YES); |
| 118 | m_config = std::make_unique<RegistryConfig>(useHklm); |
| 119 | m_systemConfig = std::make_unique<RegistryConfig>(true); |
| 120 | m_scopeLabel = useHklm ? LR"(HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\DWM)" : LR"(HKEY_CURRENT_USER\Software\Microsoft\Windows\DWM)"; |
| 121 | |
| 122 | SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_FRAMEBK)); |
| 123 | |
| 124 | wxBoxSizer* mainSizer = new wxBoxSizer(wxVERTICAL); |
| 125 | SetSizer(mainSizer); |
| 126 | |
| 127 | CreateControls(); |
| 128 | CreateBottomControls(mainSizer); |
| 129 | BindEvents(); |
| 130 | LoadSettings(true); |
| 131 | SetDirty(false); |
| 132 | UpdateStatusBar(); |
| 133 | |
| 134 | Centre(); |
| 135 | } |
| 136 | |
| 137 | void MainFrame::CreateControls() |
| 138 | { |
nothing calls this directly
no outgoing calls
no test coverage detected