ReactOS 0.4.15-dev-7934-g1dc8d80
general.cpp File Reference
#include "precomp.h"
Include dependency graph for general.cpp:

Go to the source code of this file.

Classes

struct  REGSHELLSTATE
 
struct  GENERAL_DIALOG
 

Macros

#define REGSHELLSTATE_SIZE   0x24
 

Typedefs

typedef struct REGSHELLSTATE REGSHELLSTATE
 
typedef struct REGSHELLSTATEPREGSHELLSTATE
 
typedef struct GENERAL_DIALOG GENERAL_DIALOG
 
typedef struct GENERAL_DIALOGPGENERAL_DIALOG
 

Functions

 WINE_DEFAULT_DEBUG_CHANNEL (fprop)
 
static void IntGetDefaultShellState (REGSHELLSTATE &rss)
 
static BOOL IntSetShellStateSettings (BOOL bDoubleClick, BOOL bUseCommonTasks)
 
static BOOL IntGetShellStateSettings (BOOL &bDoubleClick, BOOL &bUseCommonTasks)
 
static BOOL IntSetUnderlineState (BOOL bIconUnderline)
 
static BOOL IntGetUnderlineState (VOID)
 
static BOOL IntSetNewWindowMode (BOOL bNewWindowMode)
 
static BOOL IntGetNewWindowMode (VOID)
 
static VOID GeneralDlg_UpdateIcons (HWND hDlg, UINT nCtrlID, PGENERAL_DIALOG pGeneral)
 
static void GeneralDlg_StoreToUI (HWND hwndDlg, BOOL bDoubleClick, BOOL bUseCommonTasks, BOOL bUnderline, BOOL bNewWindowMode, PGENERAL_DIALOG pGeneral)
 
static BOOL GeneralDlg_OnInitDialog (HWND hwndDlg, PGENERAL_DIALOG pGeneral)
 
static void GeneralDlg_OnRestoreDefaults (HWND hwndDlg, PGENERAL_DIALOG pGeneral)
 
static BOOL GeneralDlg_OnApply (HWND hwndDlg, PGENERAL_DIALOG pGeneral)
 
INT_PTR CALLBACK FolderOptionsGeneralDlg (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
 

Variables

static const LPCWSTR s_pszExplorerKey
 

Macro Definition Documentation

◆ REGSHELLSTATE_SIZE

#define REGSHELLSTATE_SIZE   0x24

Definition at line 32 of file general.cpp.

Typedef Documentation

◆ GENERAL_DIALOG

◆ PGENERAL_DIALOG

◆ PREGSHELLSTATE

◆ REGSHELLSTATE

Function Documentation

◆ FolderOptionsGeneralDlg()

INT_PTR CALLBACK FolderOptionsGeneralDlg ( HWND  hwndDlg,
UINT  uMsg,
WPARAM  wParam,
LPARAM  lParam 
)

Definition at line 362 of file general.cpp.

367{
368 static GENERAL_DIALOG general;
369
370 switch (uMsg)
371 {
372 case WM_INITDIALOG:
373 general.hTaskIcon = NULL;
374 general.hFolderIcon = NULL;
375 general.hClickIcon = NULL;
376 return GeneralDlg_OnInitDialog(hwndDlg, &general);
377
378 case WM_COMMAND:
379 switch (LOWORD(wParam))
380 {
389 if (HIWORD(wParam) == BN_CLICKED)
390 {
391 GeneralDlg_UpdateIcons(hwndDlg, LOWORD(wParam), &general);
392
393 // Enable the 'Apply' button
394 PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
395 }
396 break;
398 if (HIWORD(wParam) == BN_CLICKED)
399 {
400 GeneralDlg_OnRestoreDefaults(hwndDlg, &general);
401
402 // Enable the 'Apply' button
403 PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
404 }
405 break;
406 }
407 break;
408
409 case WM_NOTIFY:
410 {
411 LPNMHDR pnmh = (LPNMHDR)lParam;
412
413 switch (pnmh->code)
414 {
415 case PSN_SETACTIVE:
416 break;
417
418 case PSN_APPLY:
419 return GeneralDlg_OnApply(hwndDlg, &general);
420 }
421 break;
422 }
423
424 case WM_DESTROY:
425 DestroyIcon(general.hTaskIcon);
426 DestroyIcon(general.hFolderIcon);
427 DestroyIcon(general.hClickIcon);
428 break;
429
430 default:
431 return FALSE;
432 }
433 return FALSE;
434}
WPARAM wParam
Definition: combotst.c:138
LPARAM lParam
Definition: combotst.c:139
#define NULL
Definition: types.h:112
#define FALSE
Definition: types.h:117
static BOOL GeneralDlg_OnInitDialog(HWND hwndDlg, PGENERAL_DIALOG pGeneral)
Definition: general.cpp:319
static VOID GeneralDlg_UpdateIcons(HWND hDlg, UINT nCtrlID, PGENERAL_DIALOG pGeneral)
Definition: general.cpp:195
static void GeneralDlg_OnRestoreDefaults(HWND hwndDlg, PGENERAL_DIALOG pGeneral)
Definition: general.cpp:335
static BOOL GeneralDlg_OnApply(HWND hwndDlg, PGENERAL_DIALOG pGeneral)
Definition: general.cpp:348
#define LOWORD(l)
Definition: pedump.c:82
#define PropSheet_Changed(d, w)
Definition: prsht.h:344
#define PSN_APPLY
Definition: prsht.h:117
#define PSN_SETACTIVE
Definition: prsht.h:115
#define WM_NOTIFY
Definition: richedit.h:61
#define IDC_FOLDER_OPTIONS_CLASSICFOLDERS
Definition: shresdef.h:415
#define IDC_FOLDER_OPTIONS_ULBROWSER
Definition: shresdef.h:420
#define IDC_FOLDER_OPTIONS_SINGLECLICK
Definition: shresdef.h:418
#define IDC_FOLDER_OPTIONS_COMMONTASKS
Definition: shresdef.h:414
#define IDC_FOLDER_OPTIONS_SAMEWINDOW
Definition: shresdef.h:416
#define IDC_FOLDER_OPTIONS_DOUBLECLICK
Definition: shresdef.h:419
#define IDC_FOLDER_OPTIONS_ULPOINT
Definition: shresdef.h:421
#define IDC_FOLDER_OPTIONS_RESTORE
Definition: shresdef.h:422
#define IDC_FOLDER_OPTIONS_OWNWINDOW
Definition: shresdef.h:417
HICON hFolderIcon
Definition: general.cpp:190
HICON hClickIcon
Definition: general.cpp:191
HICON hTaskIcon
Definition: general.cpp:189
UINT code
Definition: winuser.h:3159
#define HIWORD(l)
Definition: typedefs.h:247
#define WM_COMMAND
Definition: winuser.h:1740
#define WM_INITDIALOG
Definition: winuser.h:1739
struct tagNMHDR * LPNMHDR
HWND WINAPI GetParent(_In_ HWND)
#define BN_CLICKED
Definition: winuser.h:1925
#define WM_DESTROY
Definition: winuser.h:1609
BOOL WINAPI DestroyIcon(_In_ HICON)
Definition: cursoricon.c:2053

Referenced by CFolderOptions::AddPages(), and ShowFolderOptionsDialogThreadProc().

◆ GeneralDlg_OnApply()

static BOOL GeneralDlg_OnApply ( HWND  hwndDlg,
PGENERAL_DIALOG  pGeneral 
)
static

Definition at line 348 of file general.cpp.

349{
351 BOOL bUseCommonTasks = (IsDlgButtonChecked(hwndDlg, IDC_FOLDER_OPTIONS_COMMONTASKS) == BST_CHECKED);
353 BOOL bNewWindowMode = !(IsDlgButtonChecked(hwndDlg, IDC_FOLDER_OPTIONS_SAMEWINDOW) == BST_CHECKED);
354
355 IntSetUnderlineState(bUnderline);
356 IntSetNewWindowMode(bNewWindowMode);
357 IntSetShellStateSettings(bDoubleClick, bUseCommonTasks);
358 return TRUE;
359}
#define TRUE
Definition: types.h:120
unsigned int BOOL
Definition: ntddk_ex.h:94
static BOOL IntSetShellStateSettings(BOOL bDoubleClick, BOOL bUseCommonTasks)
Definition: general.cpp:67
static BOOL IntSetUnderlineState(BOOL bIconUnderline)
Definition: general.cpp:137
static BOOL IntSetNewWindowMode(BOOL bNewWindowMode)
Definition: general.cpp:165
UINT WINAPI IsDlgButtonChecked(_In_ HWND, _In_ int)
#define BST_CHECKED
Definition: winuser.h:197

Referenced by FolderOptionsGeneralDlg().

◆ GeneralDlg_OnInitDialog()

static BOOL GeneralDlg_OnInitDialog ( HWND  hwndDlg,
PGENERAL_DIALOG  pGeneral 
)
static

Definition at line 319 of file general.cpp.

320{
321 BOOL bDoubleClick = TRUE;
322 BOOL bUseCommonTasks = FALSE;
323 BOOL bUnderline = IntGetUnderlineState();
324 BOOL bNewWindowMode = IntGetNewWindowMode();
325
326 IntGetShellStateSettings(bDoubleClick, bUseCommonTasks);
327
328 GeneralDlg_StoreToUI(hwndDlg, bDoubleClick, bUseCommonTasks, bUnderline, bNewWindowMode, pGeneral);
329 GeneralDlg_UpdateIcons(hwndDlg, 0, pGeneral);
330
331 return TRUE;
332}
static BOOL IntGetNewWindowMode(VOID)
Definition: general.cpp:175
static BOOL IntGetUnderlineState(VOID)
Definition: general.cpp:150
static BOOL IntGetShellStateSettings(BOOL &bDoubleClick, BOOL &bUseCommonTasks)
Definition: general.cpp:110
static void GeneralDlg_StoreToUI(HWND hwndDlg, BOOL bDoubleClick, BOOL bUseCommonTasks, BOOL bUnderline, BOOL bNewWindowMode, PGENERAL_DIALOG pGeneral)
Definition: general.cpp:283

Referenced by FolderOptionsGeneralDlg().

◆ GeneralDlg_OnRestoreDefaults()

static void GeneralDlg_OnRestoreDefaults ( HWND  hwndDlg,
PGENERAL_DIALOG  pGeneral 
)
static

Definition at line 335 of file general.cpp.

336{
337 // default values
338 BOOL bDoubleClick = TRUE;
339 BOOL bUseCommonTasks = FALSE;
340 BOOL bUnderline = FALSE;
341 BOOL bNewWindowMode = FALSE;
342
343 GeneralDlg_StoreToUI(hwndDlg, bDoubleClick, bUseCommonTasks, bUnderline, bNewWindowMode, pGeneral);
344 GeneralDlg_UpdateIcons(hwndDlg, 0, pGeneral);
345}

Referenced by FolderOptionsGeneralDlg().

◆ GeneralDlg_StoreToUI()

static void GeneralDlg_StoreToUI ( HWND  hwndDlg,
BOOL  bDoubleClick,
BOOL  bUseCommonTasks,
BOOL  bUnderline,
BOOL  bNewWindowMode,
PGENERAL_DIALOG  pGeneral 
)
static

Definition at line 283 of file general.cpp.

285{
286 if (bUseCommonTasks)
288 else
290
291 if (bDoubleClick)
293 else
295
296 if (bNewWindowMode)
298 else
300
301 if (!bDoubleClick)
302 {
305 if (bUnderline)
307 else
309 }
310 else
311 {
315 }
316}
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
BOOL WINAPI EnableWindow(_In_ HWND, _In_ BOOL)
BOOL WINAPI CheckRadioButton(_In_ HWND, _In_ int, _In_ int, _In_ int)

Referenced by GeneralDlg_OnInitDialog(), and GeneralDlg_OnRestoreDefaults().

◆ GeneralDlg_UpdateIcons()

static VOID GeneralDlg_UpdateIcons ( HWND  hDlg,
UINT  nCtrlID,
PGENERAL_DIALOG  pGeneral 
)
static

Definition at line 195 of file general.cpp.

196{
197 HICON hTaskIcon = NULL, hFolderIcon = NULL, hClickIcon = NULL;
198 LPTSTR lpTaskIconName = NULL, lpFolderIconName = NULL, lpClickIconName = NULL;
199
200 // Show task setting icon.
205
206 if (lpTaskIconName)
207 {
208 hTaskIcon = (HICON)LoadImage(shell32_hInstance, lpTaskIconName,
210 if (hTaskIcon)
211 {
212 HWND hwndTaskIcon = GetDlgItem(hDlg, IDC_FOLDER_OPTIONS_TASKICON);
213 SendMessage(hwndTaskIcon, STM_SETIMAGE, IMAGE_ICON, (LPARAM)hTaskIcon);
214 }
215 }
216
217 // Show Folder setting icons
222
223 if (lpFolderIconName)
224 {
225 hFolderIcon = (HICON)LoadImage(shell32_hInstance, lpFolderIconName,
227 if (hFolderIcon)
228 {
229 HWND hwndFolderIcon = GetDlgItem(hDlg, IDC_FOLDER_OPTIONS_FOLDERICON);
230 SendMessage(hwndFolderIcon, STM_SETIMAGE, IMAGE_ICON, (LPARAM)hFolderIcon);
231 }
232 }
233
234 // Show click setting icon
239
240 if (lpClickIconName)
241 {
242 hClickIcon = (HICON)LoadImage(shell32_hInstance, lpClickIconName,
244 if (hClickIcon)
245 {
246 HWND hwndClickIcon = GetDlgItem(hDlg, IDC_FOLDER_OPTIONS_CLICKICON);
247 SendMessage(hwndClickIcon, STM_SETIMAGE, IMAGE_ICON, (LPARAM)hClickIcon);
248 }
249 }
250
251 // Replace icons
252 if (hTaskIcon)
253 {
254 DestroyIcon(pGeneral->hTaskIcon);
255 pGeneral->hTaskIcon = hTaskIcon;
256 }
257 if (hFolderIcon)
258 {
259 DestroyIcon(pGeneral->hFolderIcon);
260 pGeneral->hFolderIcon = hFolderIcon;
261 }
262 if (hClickIcon)
263 {
264 DestroyIcon(pGeneral->hClickIcon);
265 pGeneral->hClickIcon = hClickIcon;
266 }
267
268 if (nCtrlID == IDC_FOLDER_OPTIONS_SINGLECLICK)
269 {
272 }
273
274 if (nCtrlID == IDC_FOLDER_OPTIONS_DOUBLECLICK)
275 {
279 }
280}
#define shell32_hInstance
static HICON
Definition: imagelist.c:84
#define IDI_SHELL_OPEN_IN_SOME_WINDOW
Definition: shresdef.h:650
#define IDC_FOLDER_OPTIONS_FOLDERICON
Definition: shresdef.h:412
#define IDI_SHELL_OPEN_IN_NEW_WINDOW
Definition: shresdef.h:651
#define IDI_SHELL_CLASSIC_FOLDERS
Definition: shresdef.h:649
#define IDI_SHELL_SINGLE_CLICK_TO_OPEN
Definition: shresdef.h:652
#define IDC_FOLDER_OPTIONS_CLICKICON
Definition: shresdef.h:413
#define IDI_SHELL_DOUBLE_CLICK_TO_OPEN
Definition: shresdef.h:653
#define IDC_FOLDER_OPTIONS_TASKICON
Definition: shresdef.h:411
#define IDI_SHELL_SHOW_COMMON_TASKS
Definition: shresdef.h:648
LONG_PTR LPARAM
Definition: windef.h:208
#define IMAGE_ICON
Definition: winuser.h:212
#define STM_SETIMAGE
Definition: winuser.h:2093
#define SendMessage
Definition: winuser.h:5843
#define LoadImage
Definition: winuser.h:5815
#define LR_DEFAULTCOLOR
Definition: winuser.h:1087
#define MAKEINTRESOURCE
Definition: winuser.h:591
CHAR * LPTSTR
Definition: xmlstorage.h:192

Referenced by FolderOptionsGeneralDlg(), GeneralDlg_OnInitDialog(), and GeneralDlg_OnRestoreDefaults().

◆ IntGetDefaultShellState()

static void IntGetDefaultShellState ( REGSHELLSTATE rss)
static

Definition at line 41 of file general.cpp.

42{
43 ZeroMemory(&rss, sizeof(rss));
45
48
51 rss.ss.fShowInfoTip = TRUE;
52
53 rss.ss.iSortDirection = 1;
54 rss.ss.version = 0xD;
55 rss.ss.fStartPanelOn = TRUE;
56}
#define REGSHELLSTATE_SIZE
Definition: general.cpp:32
DWORD dwSize
Definition: general.cpp:28
SHELLSTATE ss
Definition: general.cpp:29
BOOL fShowExtensions
Definition: shlobj.h:1533
BOOL fShowCompColor
Definition: shlobj.h:1537
BOOL fShowInfoTip
Definition: shlobj.h:1544
UINT version
Definition: shlobj.h:1556
int iSortDirection
Definition: shlobj.h:1555
BOOL fShowAllObjects
Definition: shlobj.h:1532
BOOL fDoubleClickInWebView
Definition: shlobj.h:1538
BOOL fStartPanelOn
Definition: shlobj.h:1559
#define ZeroMemory
Definition: winbase.h:1712

Referenced by IntSetShellStateSettings().

◆ IntGetNewWindowMode()

static BOOL IntGetNewWindowMode ( VOID  )
static

Definition at line 175 of file general.cpp.

176{
178 if (!ReadCabinetState(&cs, sizeof(cs)))
179 return FALSE;
180
181 return !!cs.fNewWindowMode;
182}
#define cs
Definition: i386-dis.c:442
BOOL WINAPI ReadCabinetState(CABINETSTATE *cs, int length)
Definition: shellord.c:1609

Referenced by GeneralDlg_OnInitDialog().

◆ IntGetShellStateSettings()

static BOOL IntGetShellStateSettings ( BOOL bDoubleClick,
BOOL bUseCommonTasks 
)
static

Definition at line 110 of file general.cpp.

111{
112 REGSHELLSTATE rss;
113 DWORD dwSize = sizeof(rss);
114 LSTATUS nStatus;
115 bDoubleClick = TRUE;
116 bUseCommonTasks = FALSE;
117
118 // read ShellState
120 L"ShellState", NULL, &rss, &dwSize);
121 if (nStatus != ERROR_SUCCESS || rss.dwSize < REGSHELLSTATE_SIZE)
122 return FALSE;
123
124 bDoubleClick = !!rss.ss.fDoubleClickInWebView;
125 bUseCommonTasks = !!rss.ss.fWebView;
126 return TRUE;
127}
#define ERROR_SUCCESS
Definition: deptool.c:10
static LSTATUS(WINAPI *pRegDeleteTreeW)(HKEY
DWORD WINAPI SHGetValueW(HKEY hKey, LPCWSTR lpszSubKey, LPCWSTR lpszValue, LPDWORD pwType, LPVOID pvData, LPDWORD pcbData)
Definition: reg.c:1236
unsigned long DWORD
Definition: ntddk_ex.h:95
static const LPCWSTR s_pszExplorerKey
Definition: general.cpp:34
PSDBQUERYRESULT_VISTA PVOID DWORD * dwSize
Definition: env.c:56
#define L(x)
Definition: ntvdm.h:50
BOOL fWebView
Definition: shlobj.h:1546
#define HKEY_CURRENT_USER
Definition: winreg.h:11

Referenced by GeneralDlg_OnInitDialog().

◆ IntGetUnderlineState()

static BOOL IntGetUnderlineState ( VOID  )
static

Definition at line 150 of file general.cpp.

151{
152 DWORD dwValue, dwDefault = 2, dwSize = sizeof(DWORD);
153 SHRegGetUSValue(s_pszExplorerKey, L"IconUnderline", NULL, &dwValue, &dwSize, FALSE, &dwDefault, sizeof(DWORD));
154 return dwValue == 3;
155}
#define DWORD
Definition: nt_native.h:44
#define SHRegGetUSValue
Definition: shlwapi.h:534

Referenced by GeneralDlg_OnInitDialog().

◆ IntSetNewWindowMode()

static BOOL IntSetNewWindowMode ( BOOL  bNewWindowMode)
static

Definition at line 165 of file general.cpp.

166{
168 if (!ReadCabinetState(&cs, sizeof(cs)))
169 return FALSE;
170
171 cs.fNewWindowMode = (bNewWindowMode ? TRUE : FALSE);
172 return WriteCabinetState(&cs);
173}
BOOL WINAPI WriteCabinetState(CABINETSTATE *cs)
Definition: shellord.c:1656

Referenced by GeneralDlg_OnApply().

◆ IntSetShellStateSettings()

static BOOL IntSetShellStateSettings ( BOOL  bDoubleClick,
BOOL  bUseCommonTasks 
)
static

Definition at line 67 of file general.cpp.

68{
69 REGSHELLSTATE rss;
70 DWORD dwSize = sizeof(rss);
71 LSTATUS nStatus;
72
73 // read ShellState
76 L"ShellState",
77 NULL,
78 &rss,
79 &dwSize);
80 if (nStatus != ERROR_SUCCESS || rss.dwSize < REGSHELLSTATE_SIZE)
81 {
83 }
84
85 // update ShellState
86 rss.ss.fDoubleClickInWebView = (bDoubleClick ? TRUE : FALSE);
87 rss.ss.fWebView = (bUseCommonTasks ? TRUE : FALSE);
88
89 // write ShellState
93 L"ShellState",
95 &rss,
96 dwSize);
97 if (nStatus != ERROR_SUCCESS)
98 return FALSE;
99
100 SHSettingsChanged(0, L"ShellState");
101 return TRUE;
102}
DWORD WINAPI SHSetValueW(HKEY hKey, LPCWSTR lpszSubKey, LPCWSTR lpszValue, DWORD dwType, LPCVOID pvData, DWORD cbData)
Definition: reg.c:1306
static void IntGetDefaultShellState(REGSHELLSTATE &rss)
Definition: general.cpp:41
#define REG_BINARY
Definition: nt_native.h:1496
BOOL WINAPI SHSettingsChanged(LPCVOID unused, LPCWSTR pszKey)
Definition: shpolicy.c:174

Referenced by GeneralDlg_OnApply().

◆ IntSetUnderlineState()

static BOOL IntSetUnderlineState ( BOOL  bIconUnderline)
static

Definition at line 137 of file general.cpp.

138{
140 DWORD dwValue = (bIconUnderline ? 3 : 2), dwSize = sizeof(DWORD);
143 if (Status != ERROR_SUCCESS)
144 return FALSE;
145
146 SHSettingsChanged(0, L"Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\IconUnderline");
147 return TRUE;
148}
Status
Definition: gdiplustypes.h:25
#define REG_NONE
Definition: nt_native.h:1492
#define SHRegSetUSValue
Definition: shlwapi.h:556
#define SHREGSET_HKLM
Definition: shlwapi.h:313
#define SHREGSET_FORCE_HKCU
Definition: shlwapi.h:312

Referenced by GeneralDlg_OnApply().

◆ WINE_DEFAULT_DEBUG_CHANNEL()

WINE_DEFAULT_DEBUG_CHANNEL ( fprop  )

Variable Documentation

◆ s_pszExplorerKey

const LPCWSTR s_pszExplorerKey
static
Initial value:
=
L"Software\\Microsoft\\Windows\\CurrentVersion\\Explorer"

Definition at line 34 of file general.cpp.

Referenced by IntGetShellStateSettings(), IntGetUnderlineState(), IntSetShellStateSettings(), and IntSetUnderlineState().