ReactOS 0.4.16-dev-2498-g8632030
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
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 }
147 }
148
149 for (SIZE_T i = 0; i < _countof(Map); ++i)
150 {
151 LVFINDINFOW FindInfo = { LVFI_PARAM, NULL, Map[i].Id };
152 int Idx = ListView_FindItem(hWndList, -1, &FindInfo);
153 if (Idx >= 0)
154 {
155 if (Load)
156 {
157 ListView_SetCheckState(hWndList, Idx, *Map[i].Setting);
158 }
159 else
160 {
161 *Map[i].Setting = ListView_GetCheckState(hWndList, Idx);
162 }
163 }
164 }
165}
DWORD Id
const DWORD ExStyle
Definition: appswitch.c:73
#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
#define L(x)
Definition: resources.c:13
unsigned short WORD
Definition: ntddk_ex.h:93
unsigned int BOOL
Definition: ntddk_ex.h:94
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 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 ListView_GetItemCount(hwnd)
Definition: commctrl.h:2312
#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 168 of file settingsdlg.cpp.

169{
172
174 SetWindowTextW(hCtl, Info->szDownloadDir);
175 SendMessageW(hCtl, EM_LIMITTEXT, MAX_PATH - 1, 0);
176
178
179 if (Info->Proxy == 2)
180 {
183 }
184 else
185 {
188 }
189
191
192 EnableWindow(GetDlgItem(hDlg, IDC_SOURCE_URL), Info->bUseSource);
193
194 SetWindowTextW(GetDlgItem(hDlg, IDC_SOURCE_URL), Info->szSourceURL);
195 SetWindowTextW(GetDlgItem(hDlg, IDC_PROXY_SERVER), Info->szProxyServer);
196 SetWindowTextW(GetDlgItem(hDlg, IDC_NO_PROXY_FOR), Info->szNoProxyFor);
197}
#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:2029
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
#define BM_SETCHECK
Definition: winuser.h:1950
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:4773
#define BST_CHECKED
Definition: winuser.h:197
#define BM_GETCHECK
Definition: winuser.h:1947

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 200 of file settingsdlg.cpp.

201{
202 SETTINGS_INFO &NewSettingsInfo = *g_pNewSettingsInfo;
203
204 switch (Msg)
205 {
206 case WM_INITDIALOG:
208 return TRUE;
209
210 case WM_SETTINGCHANGE:
211 case WM_THEMECHANGED:
215 break;
216
217 case WM_COMMAND:
218 {
219 switch (LOWORD(wParam))
220 {
221 case IDC_CHOOSE:
222 ChooseFolder(hDlg);
223 break;
224
227 break;
228
230 NewSettingsInfo.bUseSource = FALSE;
231 EnableWindow(GetDlgItem(hDlg, IDC_SOURCE_URL), NewSettingsInfo.bUseSource);
232 break;
233
234 case IDC_USE_SOURCE:
235 NewSettingsInfo.bUseSource = TRUE;
236 EnableWindow(GetDlgItem(hDlg, IDC_SOURCE_URL), NewSettingsInfo.bUseSource);
237 break;
238
240 NewSettingsInfo.Proxy = 0;
243 break;
244
245 case IDC_NO_PROXY:
246 NewSettingsInfo.Proxy = 1;
249 break;
250
251 case IDC_USE_PROXY:
252 NewSettingsInfo.Proxy = 2;
255 break;
256
258 FillDefaultSettings(&NewSettingsInfo);
259 InitSettingsControls(hDlg, &NewSettingsInfo);
260 break;
261
262 case IDOK:
263 {
264 HandleGeneralListItems(GetDlgItem(hDlg, IDC_GENERALLIST), NULL, &NewSettingsInfo);
265
266 CStringW szDir;
267 CStringW szSource;
268 CStringW szProxy;
269 CStringW szNoProxy;
270 DWORD dwAttr;
271
273 szDir.ReleaseBuffer();
274
278 szSource.ReleaseBuffer();
279
281 szProxy.ReleaseBuffer();
283 NewSettingsInfo.szProxyServer, _countof(NewSettingsInfo.szProxyServer), szProxy,
284 szProxy.GetLength() + 1);
285
287 szNoProxy.ReleaseBuffer();
289 NewSettingsInfo.szNoProxyFor, _countof(NewSettingsInfo.szNoProxyFor), szNoProxy,
290 szNoProxy.GetLength() + 1);
291
293 NewSettingsInfo.szDownloadDir, _countof(NewSettingsInfo.szDownloadDir), szDir,
294 szDir.GetLength() + 1);
295 dwAttr = GetFileAttributesW(szDir);
296 if (dwAttr == INVALID_FILE_ATTRIBUTES || !(dwAttr & FILE_ATTRIBUTE_DIRECTORY))
297 {
298 CStringW szMsgText;
299 szMsgText.LoadStringW(IDS_CHOOSE_FOLDER_ERROR);
300
301 if (MessageBoxW(hDlg, szMsgText, NULL, MB_YESNO) == IDYES)
302 {
303 if (!CreateDirectoryW(szDir, NULL))
304 {
305 ErrorBox(hDlg);
306 break;
307 }
308 }
309 else
310 {
312 break;
313 }
314 }
315
316 if (NewSettingsInfo.bUseSource && !IsUrlValid(szSource))
317 {
318 CStringW szMsgText;
319 szMsgText.LoadStringW(IDS_URL_INVALID);
320
321 MessageBoxW(hDlg, szMsgText, NULL, MB_OK);
323 break;
324 }
325 else
326 {
328 NewSettingsInfo.szSourceURL, _countof(NewSettingsInfo.szSourceURL), szSource,
329 szSource.GetLength() + 1);
330 }
331
332 if (SettingsInfo.bSmallIcons != NewSettingsInfo.bSmallIcons)
333 {
334 SendMessageW(hMainWnd, WM_SETTINGCHANGE, SPI_SETICONMETRICS, 0); // Note: WM_SETTINGCHANGE cannot be posted
336 }
337 SettingsInfo = NewSettingsInfo;
339 EndDialog(hDlg, LOWORD(wParam));
340 }
341 break;
342
343 case IDCANCEL:
344 EndDialog(hDlg, LOWORD(wParam));
345 break;
346 }
347 break;
348 }
349
350 case WM_NOTIFY:
351 {
353 if (wParam == IDC_GENERALLIST && nmia.hdr.code == NM_CLICK)
354 {
355 LVHITTESTINFO lvhti;
356 lvhti.pt = nmia.ptAction;
357 if (nmia.iItem != -1 && ListView_HitTest(nmia.hdr.hwndFrom, &lvhti) != -1)
358 {
359 if (lvhti.flags & (LVHT_ONITEMICON | LVHT_ONITEMLABEL))
362 }
363 }
364 break;
365 }
366 }
367
368 return FALSE;
369}
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 @1751 Msg[]
BOOL WINAPI CreateDirectoryW(IN LPCWSTR lpPathName, IN LPSECURITY_ATTRIBUTES lpSecurityAttributes)
Definition: dir.c:58
DWORD WINAPI GetFileAttributesW(LPCWSTR lpFileName)
Definition: fileinfo.c:636
unsigned long DWORD
Definition: ntddk_ex.h:95
static UINT ErrorBox(UINT Error=GetLastError())
Definition: geninst.cpp:198
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:3267
HWND hwndFrom
Definition: winuser.h:3265
#define INVALID_FILE_ATTRIBUTES
Definition: vfdcmd.c:23
int WINAPI GetWindowTextW(HWND hWnd, LPWSTR lpString, int nMaxCount)
Definition: window.c:1382
#define INTERNET_MAX_URL_LENGTH
Definition: wininet.h:51
#define IDCANCEL
Definition: winuser.h:842
BOOL WINAPI PostMessageW(_In_opt_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define WM_COMMAND
Definition: winuser.h:1768
#define WM_INITDIALOG
Definition: winuser.h:1767
#define MB_YESNO
Definition: winuser.h:828
#define WM_SYSCOLORCHANGE
Definition: winuser.h:1654
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:1657
HWND WINAPI SetFocus(_In_opt_ HWND)
#define SendMessage
Definition: winuser.h:6009
#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().