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

Go to the source code of this file.

Classes

struct  GENERAL_DIALOG
 

Typedefs

typedef struct GENERAL_DIALOG GENERAL_DIALOG
 
typedef struct GENERAL_DIALOGPGENERAL_DIALOG
 

Functions

 WINE_DEFAULT_DEBUG_CHANNEL (fprop)
 
EXTERN_C void SHELL32_GetDefaultShellState (LPSHELLSTATE pss)
 
EXTERN_C LSTATUS SHELL32_WriteRegShellState (PREGSHELLSTATE prss)
 
static BOOL IntSetShellStateSettings (BOOL bDoubleClick, BOOL bUseCommonTasks)
 
EXTERN_C BOOL SHELL32_ReadRegShellState (PREGSHELLSTATE prss)
 
static BOOL IntSetUnderlineState (BOOL bIconUnderline)
 
static BOOL IntGetUnderlineState (VOID)
 
static HRESULT 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
 

Typedef Documentation

◆ GENERAL_DIALOG

◆ PGENERAL_DIALOG

Function Documentation

◆ FolderOptionsGeneralDlg()

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

Definition at line 331 of file general.cpp.

336{
337 static GENERAL_DIALOG general;
338
339 switch (uMsg)
340 {
341 case WM_INITDIALOG:
342 general.hTaskIcon = NULL;
343 general.hFolderIcon = NULL;
344 general.hClickIcon = NULL;
345 return GeneralDlg_OnInitDialog(hwndDlg, &general);
346
347 case WM_COMMAND:
348 switch (LOWORD(wParam))
349 {
358 if (HIWORD(wParam) == BN_CLICKED)
359 {
360 GeneralDlg_UpdateIcons(hwndDlg, LOWORD(wParam), &general);
361
362 // Enable the 'Apply' button
363 PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
364 }
365 break;
367 if (HIWORD(wParam) == BN_CLICKED)
368 {
369 GeneralDlg_OnRestoreDefaults(hwndDlg, &general);
370
371 // Enable the 'Apply' button
372 PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
373 }
374 break;
375 }
376 break;
377
378 case WM_NOTIFY:
379 {
380 LPNMHDR pnmh = (LPNMHDR)lParam;
381
382 switch (pnmh->code)
383 {
384 case PSN_SETACTIVE:
385 break;
386
387 case PSN_APPLY:
388 return GeneralDlg_OnApply(hwndDlg, &general);
389 }
390 break;
391 }
392
393 case WM_DESTROY:
394 DestroyIcon(general.hTaskIcon);
395 DestroyIcon(general.hFolderIcon);
396 DestroyIcon(general.hClickIcon);
397 break;
398
399 default:
400 return FALSE;
401 }
402 return FALSE;
403}
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:286
static VOID GeneralDlg_UpdateIcons(HWND hDlg, UINT nCtrlID, PGENERAL_DIALOG pGeneral)
Definition: general.cpp:160
static void GeneralDlg_OnRestoreDefaults(HWND hwndDlg, PGENERAL_DIALOG pGeneral)
Definition: general.cpp:302
static BOOL GeneralDlg_OnApply(HWND hwndDlg, PGENERAL_DIALOG pGeneral)
Definition: general.cpp:315
#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:420
#define IDC_FOLDER_OPTIONS_ULBROWSER
Definition: shresdef.h:425
#define IDC_FOLDER_OPTIONS_SINGLECLICK
Definition: shresdef.h:423
#define IDC_FOLDER_OPTIONS_COMMONTASKS
Definition: shresdef.h:419
#define IDC_FOLDER_OPTIONS_SAMEWINDOW
Definition: shresdef.h:421
#define IDC_FOLDER_OPTIONS_DOUBLECLICK
Definition: shresdef.h:424
#define IDC_FOLDER_OPTIONS_ULPOINT
Definition: shresdef.h:426
#define IDC_FOLDER_OPTIONS_RESTORE
Definition: shresdef.h:427
#define IDC_FOLDER_OPTIONS_OWNWINDOW
Definition: shresdef.h:422
HICON hFolderIcon
Definition: general.cpp:155
HICON hClickIcon
Definition: general.cpp:156
HICON hTaskIcon
Definition: general.cpp:154
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:2097

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

◆ GeneralDlg_OnApply()

static BOOL GeneralDlg_OnApply ( HWND  hwndDlg,
PGENERAL_DIALOG  pGeneral 
)
static

Definition at line 315 of file general.cpp.

316{
318 BOOL bUseCommonTasks = (IsDlgButtonChecked(hwndDlg, IDC_FOLDER_OPTIONS_COMMONTASKS) == BST_CHECKED);
320 BOOL bNewWindowMode = !(IsDlgButtonChecked(hwndDlg, IDC_FOLDER_OPTIONS_SAMEWINDOW) == BST_CHECKED);
321
322 IntSetUnderlineState(bUnderline);
323 BOOL updateCabinets = IntSetNewWindowMode(bNewWindowMode) == S_OK;
324 IntSetShellStateSettings(bDoubleClick, bUseCommonTasks);
325 if (updateCabinets)
327 return TRUE;
328}
#define TRUE
Definition: types.h:120
unsigned int BOOL
Definition: ntddk_ex.h:94
static BOOL IntSetShellStateSettings(BOOL bDoubleClick, BOOL bUseCommonTasks)
Definition: general.cpp:68
static BOOL IntSetUnderlineState(BOOL bIconUnderline)
Definition: general.cpp:101
static HRESULT IntSetNewWindowMode(BOOL bNewWindowMode)
Definition: general.cpp:129
#define S_OK
Definition: intsafe.h:52
#define CWM_STATECHANGE
Definition: undocshell.h:207
void PostCabinetMessage(UINT Msg, WPARAM wParam, LPARAM lParam)
Definition: view.cpp:880
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 286 of file general.cpp.

287{
290 BOOL bDoubleClick = !!ss.fDoubleClickInWebView;
291 BOOL bUseCommonTasks = !!ss.fWebView;
292 BOOL bUnderline = IntGetUnderlineState();
293 BOOL bNewWindowMode = IntGetNewWindowMode();
294
295 GeneralDlg_StoreToUI(hwndDlg, bDoubleClick, bUseCommonTasks, bUnderline, bNewWindowMode, pGeneral);
296 GeneralDlg_UpdateIcons(hwndDlg, 0, pGeneral);
297
298 return TRUE;
299}
static BOOL IntGetNewWindowMode(VOID)
Definition: general.cpp:140
static BOOL IntGetUnderlineState(VOID)
Definition: general.cpp:114
static void GeneralDlg_StoreToUI(HWND hwndDlg, BOOL bDoubleClick, BOOL bUseCommonTasks, BOOL bUnderline, BOOL bNewWindowMode, PGENERAL_DIALOG pGeneral)
Definition: general.cpp:248
#define ss
Definition: i386-dis.c:441
VOID WINAPI SHGetSetSettings(LPSHELLSTATE lpss, DWORD dwMask, BOOL bSet)
Definition: shellord.c:225
#define SSF_DOUBLECLICKINWEBVIEW
Definition: shlobj.h:1609
#define SSF_WEBVIEW
Definition: shlobj.h:1619

Referenced by FolderOptionsGeneralDlg().

◆ GeneralDlg_OnRestoreDefaults()

static void GeneralDlg_OnRestoreDefaults ( HWND  hwndDlg,
PGENERAL_DIALOG  pGeneral 
)
static

Definition at line 302 of file general.cpp.

303{
304 // default values
305 BOOL bDoubleClick = TRUE;
306 BOOL bUseCommonTasks = TRUE;
307 BOOL bUnderline = FALSE;
308 BOOL bNewWindowMode = (_WIN32_WINNT < _WIN32_WINNT_WIN2K);
309
310 GeneralDlg_StoreToUI(hwndDlg, bDoubleClick, bUseCommonTasks, bUnderline, bNewWindowMode, pGeneral);
311 GeneralDlg_UpdateIcons(hwndDlg, 0, pGeneral);
312}
#define _WIN32_WINNT
Definition: precomp.h:14
#define _WIN32_WINNT_WIN2K
Definition: sdkddkver.h:21

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 248 of file general.cpp.

250{
251 EnableWindow(GetDlgItem(hwndDlg, IDC_FOLDER_OPTIONS_COMMONTASKS), bUseCommonTasks); // FIXME: ROS DefView does not support WebView nor the tasks pane
252
253 if (bUseCommonTasks)
255 else
257
258 if (bDoubleClick)
260 else
262
263 if (bNewWindowMode)
265 else
267
268 if (!bDoubleClick)
269 {
272 if (bUnderline)
274 else
276 }
277 else
278 {
282 }
283}
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 160 of file general.cpp.

161{
162 HICON hTaskIcon = NULL, hFolderIcon = NULL, hClickIcon = NULL;
163 LPTSTR lpTaskIconName = NULL, lpFolderIconName = NULL, lpClickIconName = NULL;
164
165 // Show task setting icon.
170
171 if (lpTaskIconName)
172 {
173 hTaskIcon = (HICON)LoadImage(shell32_hInstance, lpTaskIconName,
175 if (hTaskIcon)
176 {
177 HWND hwndTaskIcon = GetDlgItem(hDlg, IDC_FOLDER_OPTIONS_TASKICON);
178 SendMessage(hwndTaskIcon, STM_SETIMAGE, IMAGE_ICON, (LPARAM)hTaskIcon);
179 }
180 }
181
182 // Show Folder setting icons
187
188 if (lpFolderIconName)
189 {
190 hFolderIcon = (HICON)LoadImage(shell32_hInstance, lpFolderIconName,
192 if (hFolderIcon)
193 {
194 HWND hwndFolderIcon = GetDlgItem(hDlg, IDC_FOLDER_OPTIONS_FOLDERICON);
195 SendMessage(hwndFolderIcon, STM_SETIMAGE, IMAGE_ICON, (LPARAM)hFolderIcon);
196 }
197 }
198
199 // Show click setting icon
204
205 if (lpClickIconName)
206 {
207 hClickIcon = (HICON)LoadImage(shell32_hInstance, lpClickIconName,
209 if (hClickIcon)
210 {
211 HWND hwndClickIcon = GetDlgItem(hDlg, IDC_FOLDER_OPTIONS_CLICKICON);
212 SendMessage(hwndClickIcon, STM_SETIMAGE, IMAGE_ICON, (LPARAM)hClickIcon);
213 }
214 }
215
216 // Replace icons
217 if (hTaskIcon)
218 {
219 DestroyIcon(pGeneral->hTaskIcon);
220 pGeneral->hTaskIcon = hTaskIcon;
221 }
222 if (hFolderIcon)
223 {
224 DestroyIcon(pGeneral->hFolderIcon);
225 pGeneral->hFolderIcon = hFolderIcon;
226 }
227 if (hClickIcon)
228 {
229 DestroyIcon(pGeneral->hClickIcon);
230 pGeneral->hClickIcon = hClickIcon;
231 }
232
233 if (nCtrlID == IDC_FOLDER_OPTIONS_SINGLECLICK)
234 {
237 }
238
239 if (nCtrlID == IDC_FOLDER_OPTIONS_DOUBLECLICK)
240 {
244 }
245}
#define shell32_hInstance
static HICON
Definition: imagelist.c:84
#define IDI_SHELL_OPEN_IN_SOME_WINDOW
Definition: shresdef.h:655
#define IDC_FOLDER_OPTIONS_FOLDERICON
Definition: shresdef.h:417
#define IDI_SHELL_OPEN_IN_NEW_WINDOW
Definition: shresdef.h:656
#define IDI_SHELL_CLASSIC_FOLDERS
Definition: shresdef.h:654
#define IDI_SHELL_SINGLE_CLICK_TO_OPEN
Definition: shresdef.h:657
#define IDC_FOLDER_OPTIONS_CLICKICON
Definition: shresdef.h:418
#define IDI_SHELL_DOUBLE_CLICK_TO_OPEN
Definition: shresdef.h:658
#define IDC_FOLDER_OPTIONS_TASKICON
Definition: shresdef.h:416
#define IDI_SHELL_SHOW_COMMON_TASKS
Definition: shresdef.h:653
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:5852
#define LoadImage
Definition: winuser.h:5824
#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().

◆ IntGetNewWindowMode()

static BOOL IntGetNewWindowMode ( VOID  )
static

Definition at line 140 of file general.cpp.

141{
143 if (!ReadCabinetState(&cs, sizeof(cs)))
144 return FALSE;
145
146 return !!cs.fNewWindowMode;
147}
#define cs
Definition: i386-dis.c:442
BOOL WINAPI ReadCabinetState(CABINETSTATE *cs, int length)
Definition: shellord.c:1801

Referenced by GeneralDlg_OnInitDialog().

◆ IntGetUnderlineState()

static BOOL IntGetUnderlineState ( VOID  )
static

Definition at line 114 of file general.cpp.

115{
116 DWORD dwValue, dwDefault = 2, dwSize = sizeof(DWORD);
117 SHRegGetUSValue(s_pszExplorerKey, L"IconUnderline", NULL, &dwValue, &dwSize, FALSE, &dwDefault, sizeof(DWORD));
118 return dwValue == 3;
119}
unsigned long DWORD
Definition: ntddk_ex.h:95
static const LPCWSTR s_pszExplorerKey
Definition: general.cpp:26
PSDBQUERYRESULT_VISTA PVOID DWORD * dwSize
Definition: env.c:56
#define DWORD
Definition: nt_native.h:44
#define L(x)
Definition: ntvdm.h:50
#define SHRegGetUSValue
Definition: shlwapi.h:534

Referenced by GeneralDlg_OnInitDialog().

◆ IntSetNewWindowMode()

static HRESULT IntSetNewWindowMode ( BOOL  bNewWindowMode)
static

Definition at line 129 of file general.cpp.

130{
132 if (!ReadCabinetState(&cs, sizeof(cs)))
133 return E_FAIL;
134
135 BOOL changed = !!cs.fNewWindowMode != !!bNewWindowMode;
136 cs.fNewWindowMode = !!bNewWindowMode;
137 return WriteCabinetState(&cs) ? (changed ? S_OK : S_FALSE) : E_FAIL;
138}
#define E_FAIL
Definition: ddrawi.h:102
BOOL WINAPI WriteCabinetState(CABINETSTATE *cs)
Definition: shellord.c:1848
#define S_FALSE
Definition: winerror.h:2357

Referenced by GeneralDlg_OnApply().

◆ IntSetShellStateSettings()

static BOOL IntSetShellStateSettings ( BOOL  bDoubleClick,
BOOL  bUseCommonTasks 
)
static

Definition at line 68 of file general.cpp.

69{
70 SHELLSTATE shellstate;
71 shellstate.fDoubleClickInWebView = !!bDoubleClick;
72 shellstate.fWebView = !!bUseCommonTasks;
74
75 SHSettingsChanged(0, L"ShellState");
76 return TRUE;
77}
BOOL WINAPI SHSettingsChanged(LPCVOID unused, LPCWSTR pszKey)
Definition: shpolicy.c:178
BOOL fWebView
Definition: shlobj.h:1554
BOOL fDoubleClickInWebView
Definition: shlobj.h:1546

Referenced by GeneralDlg_OnApply().

◆ IntSetUnderlineState()

static BOOL IntSetUnderlineState ( BOOL  bIconUnderline)
static

Definition at line 101 of file general.cpp.

102{
104 DWORD dwValue = (bIconUnderline ? 3 : 2), dwSize = sizeof(DWORD);
107 if (Status != ERROR_SUCCESS)
108 return FALSE;
109
110 SHSettingsChanged(0, L"Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\IconUnderline");
111 return TRUE;
112}
#define ERROR_SUCCESS
Definition: deptool.c:10
static LSTATUS(WINAPI *pRegDeleteTreeW)(HKEY
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().

◆ SHELL32_GetDefaultShellState()

EXTERN_C void SHELL32_GetDefaultShellState ( LPSHELLSTATE  pss)

Definition at line 33 of file general.cpp.

34{
35 ZeroMemory(pss, sizeof(*pss));
36 pss->fShowAllObjects = TRUE;
37 pss->fShowExtensions = TRUE;
38 pss->fShowCompColor = TRUE;
40 pss->fShowAttribCol = TRUE; // ROS defaults to Details view with this column on
41 pss->fShowInfoTip = TRUE;
44 pss->iSortDirection = 1;
46 pss->fSepProcess = FALSE;
47 pss->fStartPanelOn = FALSE; // Note: This should be changed to TRUE when the modern start menu is implemented
48}
#define SHFSF_COL_NAME
Definition: shfldr.h:43
BOOL fShowSuperHidden
Definition: shlobj.h:1556
BOOL fShowExtensions
Definition: shlobj.h:1541
LONG lParamSort
Definition: shlobj.h:1562
BOOL fShowAttribCol
Definition: shlobj.h:1550
BOOL fShowCompColor
Definition: shlobj.h:1545
BOOL fShowInfoTip
Definition: shlobj.h:1552
UINT version
Definition: shlobj.h:1564
BOOL fSepProcess
Definition: shlobj.h:1566
int iSortDirection
Definition: shlobj.h:1563
BOOL fShowAllObjects
Definition: shlobj.h:1540
BOOL fStartPanelOn
Definition: shlobj.h:1567
#define REGSHELLSTATE_VERSION
Definition: undocshell.h:548
#define ZeroMemory
Definition: winbase.h:1712

Referenced by SHGetSetSettings().

◆ SHELL32_ReadRegShellState()

EXTERN_C BOOL SHELL32_ReadRegShellState ( PREGSHELLSTATE  prss)

Definition at line 85 of file general.cpp.

86{
87 DWORD dwSize = sizeof(REGSHELLSTATE);
89 L"ShellState", NULL, prss, &dwSize);
90 return err == ERROR_SUCCESS && prss->dwSize >= REGSHELLSTATE_SIZE;
91}
DWORD WINAPI SHGetValueW(HKEY hKey, LPCWSTR lpszSubKey, LPCWSTR lpszValue, LPDWORD pwType, LPVOID pvData, LPDWORD pcbData)
Definition: reg.c:1236
#define err(...)
#define REGSHELLSTATE_SIZE
Definition: undocshell.h:547
#define HKEY_CURRENT_USER
Definition: winreg.h:11

Referenced by SHGetSetSettings().

◆ SHELL32_WriteRegShellState()

EXTERN_C LSTATUS SHELL32_WriteRegShellState ( PREGSHELLSTATE  prss)

Definition at line 51 of file general.cpp.

52{
56 REG_BINARY, prss, prss->dwSize);
57}
DWORD WINAPI SHSetValueW(HKEY hKey, LPCWSTR lpszSubKey, LPCWSTR lpszValue, DWORD dwType, LPCVOID pvData, DWORD cbData)
Definition: reg.c:1306
#define REG_BINARY
Definition: nt_native.h:1496
SHELLSTATE ss
Definition: ShellState.cpp:22

Referenced by SHGetSetSettings().

◆ 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 26 of file general.cpp.

Referenced by IntGetUnderlineState(), IntSetUnderlineState(), SHELL32_ReadRegShellState(), and SHELL32_WriteRegShellState().