| 129 | } |
| 130 | |
| 131 | static INT_PTR CALLBACK DlgProcStatic(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) |
| 132 | { |
| 133 | auto app = (AppWindow*)GetWindowLongPtr(hDlg, GWLP_USERDATA); |
| 134 | |
| 135 | switch (message) |
| 136 | { |
| 137 | case WM_INITDIALOG: |
| 138 | { |
| 139 | app = (AppWindow*)lParam; |
| 140 | SetWindowLongPtr(hDlg, GWLP_USERDATA, (LONG_PTR)app); |
| 141 | |
| 142 | SetDlgItemText(hDlg, IDC_EDIT_PROFILE, app->GetWebViewOption().profile.c_str()); |
| 143 | SetDlgItemText( |
| 144 | hDlg, IDC_EDIT_DOWNLOAD_PATH, app->GetWebViewOption().downloadPath.c_str()); |
| 145 | SetDlgItemText(hDlg, IDC_EDIT_LOCALE, app->GetWebViewOption().scriptLocale.c_str()); |
| 146 | CheckDlgButton(hDlg, IDC_CHECK_INPRIVATE, app->GetWebViewOption().isInPrivate); |
| 147 | |
| 148 | return (INT_PTR)TRUE; |
| 149 | } |
| 150 | case WM_COMMAND: |
| 151 | { |
| 152 | if (LOWORD(wParam) == IDOK) |
| 153 | { |
| 154 | int length = GetWindowTextLength(GetDlgItem(hDlg, IDC_EDIT_PROFILE)); |
| 155 | wchar_t text[MAX_PATH] = {}; |
| 156 | GetDlgItemText(hDlg, IDC_EDIT_PROFILE, text, length + 1); |
| 157 | bool inPrivate = IsDlgButtonChecked(hDlg, IDC_CHECK_INPRIVATE); |
| 158 | |
| 159 | int downloadPathLength = |
| 160 | GetWindowTextLength(GetDlgItem(hDlg, IDC_EDIT_DOWNLOAD_PATH)); |
| 161 | wchar_t downloadPath[MAX_PATH] = {}; |
| 162 | GetDlgItemText(hDlg, IDC_EDIT_DOWNLOAD_PATH, downloadPath, downloadPathLength + 1); |
| 163 | |
| 164 | int scriptLocaleLength = GetWindowTextLength(GetDlgItem(hDlg, IDC_EDIT_LOCALE)); |
| 165 | wchar_t scriptLocale[MAX_PATH] = {}; |
| 166 | GetDlgItemText(hDlg, IDC_EDIT_LOCALE, scriptLocale, scriptLocaleLength + 1); |
| 167 | |
| 168 | bool useOsRegion = IsDlgButtonChecked(hDlg, IDC_CHECK_USE_OS_REGION); |
| 169 | |
| 170 | WebViewCreateOption opt( |
| 171 | std::wstring(std::move(text)), inPrivate, std::wstring(std::move(downloadPath)), |
| 172 | std::wstring(std::move(scriptLocale)), |
| 173 | WebViewCreateEntry::EVER_FROM_CREATE_WITH_OPTION_MENU, useOsRegion); |
| 174 | |
| 175 | // create app window |
| 176 | new AppWindow(app->GetCreationModeId(), opt); |
| 177 | } |
| 178 | |
| 179 | if (LOWORD(wParam) == IDOK || LOWORD(wParam) == IDCANCEL) |
| 180 | { |
| 181 | EndDialog(hDlg, LOWORD(wParam)); |
| 182 | return (INT_PTR)TRUE; |
| 183 | } |
| 184 | break; |
| 185 | } |
| 186 | case WM_NCDESTROY: |
| 187 | SetWindowLongPtr(hDlg, GWLP_USERDATA, NULL); |
| 188 | return (INT_PTR)TRUE; |
nothing calls this directly
no test coverage detected