ReactOS 0.4.16-dev-983-g23ad936
anonymous_namespace{settingsdlg.cpp} Namespace Reference

Functions

static BOOL IsCheckedDlgItem (HWND hDlg, INT nIDDlgItem)
 
static void AdjustListViewHeader (HWND hWndList)
 
static void HandleGeneralListItems (HWND hWndList, PSETTINGS_INFO Load, PSETTINGS_INFO Save)
 
static VOID InitSettingsControls (HWND hDlg, PSETTINGS_INFO Info)
 
static INT_PTR CALLBACK SettingsDlgProc (HWND hDlg, UINT Msg, WPARAM wParam, LPARAM lParam)
 

Function Documentation

◆ AdjustListViewHeader()

static void anonymous_namespace{settingsdlg.cpp}::AdjustListViewHeader ( HWND  hWndList)
inlinestatic

Definition at line 104 of file settingsdlg.cpp.

105{
107}
static HWND hWndList[5+1]
Definition: SetParent.c:10
#define ListView_SetColumnWidth(hwnd, iCol, cx)
Definition: commctrl.h:2653
#define LVSCW_AUTOSIZE_USEHEADER
Definition: commctrl.h:2650

Referenced by HandleGeneralListItems(), and SettingsDlgProc().

◆ HandleGeneralListItems()

static void anonymous_namespace{settingsdlg.cpp}::HandleGeneralListItems ( HWND  hWndList,
PSETTINGS_INFO  Load,
PSETTINGS_INFO  Save 
)
static

Definition at line 110 of file settingsdlg.cpp.

111{
113 const struct {
114 WORD Id;
115 BOOL *Setting;
116 } Map[] = {
117 { IDS_CFG_SAVE_WINDOW_POS, &Info->bSaveWndPos },
118 { IDS_CFG_UPDATE_AVLIST, &Info->bUpdateAtStart },
119 { IDS_CFG_LOG_ENABLED, &Info->bLogEnabled },
120 { IDS_CFG_SMALL_ICONS, &Info->bSmallIcons },
121 };
122
123 if (Load)
124 {
127 LVCOLUMN lvc;
128 lvc.mask = LVCF_TEXT | LVCF_SUBITEM;
129 lvc.iSubItem = 0;
130 lvc.pszText = const_cast<PWSTR>(L"");
132
134 for (SIZE_T i = 0; i < _countof(Map); ++i)
135 {
137 Item.mask = LVIF_TEXT | LVIF_PARAM;
138 Item.iItem = 0x7fff;
139 Item.iSubItem = 0;
140 Item.lParam = Map[i].Id;
141 Name.LoadStringW(Map[i].Id);
142 Item.pszText = const_cast<PWSTR>(Name.GetString());
144 ListView_SetCheckState(hWndList, Item.iItem, *Map[i].Setting);
145 }
148 }
149 else
150 {
151 for (SIZE_T i = 0; i < _countof(Map); ++i)
152 {
153 LVFINDINFOW FindInfo = { LVFI_PARAM, NULL, Map[i].Id };
154 int Idx = ListView_FindItem(hWndList, -1, &FindInfo);
155 if (Idx >= 0)
156 *Map[i].Setting = ListView_GetCheckState(hWndList, Idx);
157 }
158 }
159}
DWORD Id
const DWORD ExStyle
Definition: appswitch.c:72
#define IDS_CFG_LOG_ENABLED
Definition: resource.h:133
#define IDS_CFG_UPDATE_AVLIST
Definition: resource.h:132
#define IDS_CFG_SMALL_ICONS
Definition: resource.h:134
#define IDS_CFG_SAVE_WINDOW_POS
Definition: resource.h:131
LPWSTR Name
Definition: desk.c:124
#define NULL
Definition: types.h:112
unsigned int BOOL
Definition: ntddk_ex.h:94
unsigned short WORD
Definition: ntddk_ex.h:93
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
static HRESULT Load(IUnknown *pUnk, IStream *pStream)
Definition: lnktool.cpp:294
static void AdjustListViewHeader(HWND hWndList)
unsigned int UINT
Definition: ndis.h:50
#define L(x)
Definition: ntvdm.h:50
#define ListView_InsertItem(hwnd, pitem)
Definition: commctrl.h:2413
#define ListView_SetItemState(hwndLV, i, data, mask)
Definition: commctrl.h:2678
#define ListView_SetExtendedListViewStyleEx(hwndLV, dwMask, dw)
Definition: commctrl.h:2731
#define LVS_EX_LABELTIP
Definition: commctrl.h:2748
#define ListView_InsertColumn(hwnd, iCol, pcol)
Definition: commctrl.h:2641
#define ListView_SetCheckState(hwndLV, i, fCheck)
Definition: commctrl.h:2679
#define LVFI_PARAM
Definition: commctrl.h:2441
#define LVS_EX_CHECKBOXES
Definition: commctrl.h:2736
#define LVIS_SELECTED
Definition: commctrl.h:2324
#define LVIF_PARAM
Definition: commctrl.h:2316
#define LVIF_TEXT
Definition: commctrl.h:2314
#define LVCF_SUBITEM
Definition: commctrl.h:2594
#define ListView_GetCheckState(hwndLV, i)
Definition: commctrl.h:2682
#define LVCF_TEXT
Definition: commctrl.h:2593
#define LVIS_FOCUSED
Definition: commctrl.h:2323
#define ListView_FindItem(hwnd, iStart, plvfi)
Definition: commctrl.h:2475
#define LVCOLUMN
Definition: commctrl.h:2586
#define _countof(array)
Definition: sndvol32.h:70
uint16_t * PWSTR
Definition: typedefs.h:56
ULONG_PTR SIZE_T
Definition: typedefs.h:80
static int Save(const char **args)
Definition: vfdcmd.c:1851
_Must_inspect_result_ _In_ WDFCHILDLIST _In_ PWDF_CHILD_LIST_ITERATOR _Out_ WDFDEVICE _Inout_opt_ PWDF_CHILD_RETRIEVE_INFO Info
Definition: wdfchildlist.h:690
_In_ WDFCOLLECTION _In_ WDFOBJECT Item

Referenced by InitSettingsControls(), and SettingsDlgProc().

◆ InitSettingsControls()

static VOID anonymous_namespace{settingsdlg.cpp}::InitSettingsControls ( HWND  hDlg,
PSETTINGS_INFO  Info 
)
static

Definition at line 162 of file settingsdlg.cpp.

163{
166
168 SetWindowTextW(hCtl, Info->szDownloadDir);
169 SendMessageW(hCtl, EM_LIMITTEXT, MAX_PATH - 1, 0);
170
172
173 if (Info->Proxy == 2)
174 {
177 }
178 else
179 {
182 }
183
185
186 EnableWindow(GetDlgItem(hDlg, IDC_SOURCE_URL), Info->bUseSource);
187
188 SetWindowTextW(GetDlgItem(hDlg, IDC_SOURCE_URL), Info->szSourceURL);
189 SetWindowTextW(GetDlgItem(hDlg, IDC_PROXY_SERVER), Info->szProxyServer);
190 SetWindowTextW(GetDlgItem(hDlg, IDC_NO_PROXY_FOR), Info->szNoProxyFor);
191}
#define IDC_PROXY_SERVER
Definition: resource.h:57
#define IDC_USE_SOURCE
Definition: resource.h:60
#define IDC_DEL_AFTER_INSTALL
Definition: resource.h:47
#define IDC_NO_PROXY_FOR
Definition: resource.h:58
#define IDC_USE_PROXY
Definition: resource.h:56
#define IDC_PROXY_DEFAULT
Definition: resource.h:54
#define IDC_GENERALLIST
Definition: resource.h:44
#define IDC_SOURCE_URL
Definition: resource.h:61
#define IDC_DOWNLOAD_DIR_EDIT
Definition: resource.h:46
#define IDC_SOURCE_DEFAULT
Definition: resource.h:59
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define MAX_PATH
Definition: compat.h:34
static void HandleGeneralListItems(HWND hWndList, PSETTINGS_INFO Load, PSETTINGS_INFO Save)
#define EM_LIMITTEXT
Definition: winuser.h:2011
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
#define BM_SETCHECK
Definition: winuser.h:1932
LRESULT WINAPI SendDlgItemMessageW(_In_ HWND, _In_ int, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
BOOL WINAPI SetWindowTextW(_In_ HWND, _In_opt_ LPCWSTR)
BOOL WINAPI EnableWindow(_In_ HWND, _In_ BOOL)
BOOL WINAPI CheckRadioButton(_In_ HWND, _In_ int, _In_ int, _In_ int)
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)

Referenced by SettingsDlgProc().

◆ IsCheckedDlgItem()

static BOOL anonymous_namespace{settingsdlg.cpp}::IsCheckedDlgItem ( HWND  hDlg,
INT  nIDDlgItem 
)
inlinestatic

Definition at line 98 of file settingsdlg.cpp.

99{
101}
_In_ int nIDDlgItem
Definition: winuser.h:4630
#define BST_CHECKED
Definition: winuser.h:197
#define BM_GETCHECK
Definition: winuser.h:1929

Referenced by SettingsDlgProc().

◆ SettingsDlgProc()

static INT_PTR CALLBACK anonymous_namespace{settingsdlg.cpp}::SettingsDlgProc ( HWND  hDlg,
UINT  Msg,
WPARAM  wParam,
LPARAM  lParam 
)
static

Definition at line 194 of file settingsdlg.cpp.

195{
196 SETTINGS_INFO &NewSettingsInfo = *g_pNewSettingsInfo;
197
198 switch (Msg)
199 {
200 case WM_INITDIALOG:
202 return TRUE;
203
204 case WM_SETTINGCHANGE:
205 case WM_THEMECHANGED:
209 break;
210
211 case WM_COMMAND:
212 {
213 switch (LOWORD(wParam))
214 {
215 case IDC_CHOOSE:
216 ChooseFolder(hDlg);
217 break;
218
221 break;
222
224 NewSettingsInfo.bUseSource = FALSE;
225 EnableWindow(GetDlgItem(hDlg, IDC_SOURCE_URL), NewSettingsInfo.bUseSource);
226 break;
227
228 case IDC_USE_SOURCE:
229 NewSettingsInfo.bUseSource = TRUE;
230 EnableWindow(GetDlgItem(hDlg, IDC_SOURCE_URL), NewSettingsInfo.bUseSource);
231 break;
232
234 NewSettingsInfo.Proxy = 0;
237 break;
238
239 case IDC_NO_PROXY:
240 NewSettingsInfo.Proxy = 1;
243 break;
244
245 case IDC_USE_PROXY:
246 NewSettingsInfo.Proxy = 2;
249 break;
250
252 FillDefaultSettings(&NewSettingsInfo);
253 InitSettingsControls(hDlg, &NewSettingsInfo);
254 break;
255
256 case IDOK:
257 {
258 HandleGeneralListItems(GetDlgItem(hDlg, IDC_GENERALLIST), NULL, &NewSettingsInfo);
259
260 CStringW szDir;
261 CStringW szSource;
262 CStringW szProxy;
263 CStringW szNoProxy;
264 DWORD dwAttr;
265
267 szDir.ReleaseBuffer();
268
272 szSource.ReleaseBuffer();
273
275 szProxy.ReleaseBuffer();
277 NewSettingsInfo.szProxyServer, _countof(NewSettingsInfo.szProxyServer), szProxy,
278 szProxy.GetLength() + 1);
279
281 szNoProxy.ReleaseBuffer();
283 NewSettingsInfo.szNoProxyFor, _countof(NewSettingsInfo.szNoProxyFor), szNoProxy,
284 szNoProxy.GetLength() + 1);
285
287 NewSettingsInfo.szDownloadDir, _countof(NewSettingsInfo.szDownloadDir), szDir,
288 szDir.GetLength() + 1);
289 dwAttr = GetFileAttributesW(szDir);
290 if (dwAttr == INVALID_FILE_ATTRIBUTES || !(dwAttr & FILE_ATTRIBUTE_DIRECTORY))
291 {
292 CStringW szMsgText;
293 szMsgText.LoadStringW(IDS_CHOOSE_FOLDER_ERROR);
294
295 if (MessageBoxW(hDlg, szMsgText, NULL, MB_YESNO) == IDYES)
296 {
297 if (!CreateDirectoryW(szDir, NULL))
298 {
299 ErrorBox(hDlg);
300 break;
301 }
302 }
303 else
304 {
306 break;
307 }
308 }
309
310 if (NewSettingsInfo.bUseSource && !IsUrlValid(szSource))
311 {
312 CStringW szMsgText;
313 szMsgText.LoadStringW(IDS_URL_INVALID);
314
315 MessageBoxW(hDlg, szMsgText, NULL, MB_OK);
317 break;
318 }
319 else
320 {
322 NewSettingsInfo.szSourceURL, _countof(NewSettingsInfo.szSourceURL), szSource,
323 szSource.GetLength() + 1);
324 }
325
326 if (SettingsInfo.bSmallIcons != NewSettingsInfo.bSmallIcons)
327 {
328 SendMessageW(hMainWnd, WM_SETTINGCHANGE, SPI_SETICONMETRICS, 0); // Note: WM_SETTINGCHANGE cannot be posted
330 }
331 SettingsInfo = NewSettingsInfo;
333 EndDialog(hDlg, LOWORD(wParam));
334 }
335 break;
336
337 case IDCANCEL:
338 EndDialog(hDlg, LOWORD(wParam));
339 break;
340 }
341 break;
342 }
343
344 case WM_NOTIFY:
345 {
347 if (wParam == IDC_GENERALLIST && nmia.hdr.code == NM_CLICK)
348 {
349 LVHITTESTINFO lvhti;
350 lvhti.pt = nmia.ptAction;
351 if (nmia.iItem != -1 && ListView_HitTest(nmia.hdr.hwndFrom, &lvhti) != -1)
352 {
353 if (lvhti.flags & (LVHT_ONITEMICON | LVHT_ONITEMLABEL))
356 }
357 }
358 break;
359 }
360 }
361
362 return FALSE;
363}
void SaveSettings(void)
Definition: settings.c:115
#define ID_REFRESH
Definition: resource.h:16
#define IDC_NO_PROXY
Definition: resource.h:55
#define IDS_URL_INVALID
Definition: resource.h:111
#define IDC_CHOOSE
Definition: resource.h:49
#define IDC_DEFAULT_SETTINGS
Definition: resource.h:50
#define IDS_CHOOSE_FOLDER_ERROR
Definition: resource.h:110
SETTINGS_INFO SettingsInfo
Definition: winmain.cpp:21
VOID FillDefaultSettings(PSETTINGS_INFO pSettingsInfo)
Definition: settings.cpp:211
static void __cdecl CopyChars(_Out_writes_to_(nDestLen, nChars) XCHAR *pchDest, _In_ size_t nDestLen, _In_reads_opt_(nChars) const XCHAR *pchSrc, _In_ int nChars) noexcept
Definition: atlsimpstr.h:438
void ReleaseBuffer(_In_ int nNewLength=-1)
Definition: atlsimpstr.h:387
int GetLength() const noexcept
Definition: atlsimpstr.h:362
WPARAM wParam
Definition: combotst.c:138
LPARAM lParam
Definition: combotst.c:139
struct @1672 Msg[]
BOOL WINAPI CreateDirectoryW(IN LPCWSTR lpPathName, IN LPSECURITY_ATTRIBUTES lpSecurityAttributes)
Definition: dir.c:90
DWORD WINAPI GetFileAttributesW(LPCWSTR lpFileName)
Definition: fileinfo.c:652
#define INTERNET_MAX_URL_LENGTH
Definition: session.c:1418
unsigned long DWORD
Definition: ntddk_ex.h:95
static UINT ErrorBox(UINT Error=GetLastError())
Definition: geninst.cpp:188
HWND hMainWnd
Definition: magnifier.c:32
static BOOL IsCheckedDlgItem(HWND hDlg, INT nIDDlgItem)
Definition: settingsdlg.cpp:98
static VOID InitSettingsControls(HWND hDlg, PSETTINGS_INFO Info)
#define FILE_ATTRIBUTE_DIRECTORY
Definition: nt_native.h:705
#define LOWORD(l)
Definition: pedump.c:82
#define ListView_HitTest(hwndLV, pinfo)
Definition: commctrl.h:2521
#define NM_CLICK
Definition: commctrl.h:130
#define LVHT_ONITEMICON
Definition: commctrl.h:2499
#define LVHT_ONITEMLABEL
Definition: commctrl.h:2500
#define WM_NOTIFY
Definition: richedit.h:61
static BOOL ChooseFolder(HWND hwnd)
Definition: settingsdlg.cpp:27
SETTINGS_INFO * g_pNewSettingsInfo
Definition: settingsdlg.cpp:10
static BOOL IsUrlValid(const WCHAR *Url)
Definition: settingsdlg.cpp:69
WCHAR szDownloadDir[MAX_PATH]
Definition: settings.h:10
BOOL bUseSource
Definition: settings.h:24
BOOL bDelInstaller
Definition: settings.h:11
WCHAR szSourceURL[INTERNET_MAX_URL_LENGTH]
Definition: settings.h:25
WCHAR szNoProxyFor[MAX_PATH]
Definition: settings.h:22
BOOL bSmallIcons
Definition: settings.h:12
WCHAR szProxyServer[MAX_PATH]
Definition: settings.h:21
UINT code
Definition: winuser.h:3170
HWND hwndFrom
Definition: winuser.h:3168
#define INVALID_FILE_ATTRIBUTES
Definition: vfdcmd.c:23
int WINAPI GetWindowTextW(HWND hWnd, LPWSTR lpString, int nMaxCount)
Definition: window.c:1394
#define IDCANCEL
Definition: winuser.h:842
BOOL WINAPI PostMessageW(_In_opt_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define WM_COMMAND
Definition: winuser.h:1751
#define WM_INITDIALOG
Definition: winuser.h:1750
#define MB_YESNO
Definition: winuser.h:828
#define WM_SYSCOLORCHANGE
Definition: winuser.h:1637
int WINAPI MessageBoxW(_In_opt_ HWND hWnd, _In_opt_ LPCWSTR lpText, _In_opt_ LPCWSTR lpCaption, _In_ UINT uType)
#define IDOK
Definition: winuser.h:841
#define WM_SETTINGCHANGE
Definition: winuser.h:1640
HWND WINAPI SetFocus(_In_opt_ HWND)
#define SendMessage
Definition: winuser.h:5863
#define MB_OK
Definition: winuser.h:801
HWND WINAPI GetParent(_In_ HWND)
#define IDYES
Definition: winuser.h:846
BOOL WINAPI EndDialog(_In_ HWND, _In_ INT_PTR)

Referenced by CreateSettingsDlg().