ReactOS 0.4.16-dev-1276-g70732b0
view.cpp File Reference
#include "precomp.h"
Include dependency graph for view.cpp:

Go to the source code of this file.

Functions

 WINE_DEFAULT_DEBUG_CHANNEL (fprop)
 
static CFolderOptionsGetFolderOptions (HWND hwndDlg)
 
static IRegTreeOptions * GetRegTreeOptions (HWND hwndDlg)
 
static void ViewDlg_OnDestroy (HWND hwndDlg)
 
static BOOL ViewDlg_OnInitDialog (HWND hwndDlg, LPPROPSHEETPAGE psp)
 
static BOOL ViewDlg_ToggleCheckItem (HWND hwndDlg, HTREEITEM hItem)
 
static VOID ViewDlg_OnTreeViewClick (HWND hwndDlg)
 
static void ViewDlg_OnTreeViewKeyDown (HWND hwndDlg, TV_KEYDOWN *KeyDown)
 
static INT_PTR ViewDlg_OnTreeCustomDraw (HWND hwndDlg, NMTVCUSTOMDRAW *Draw)
 
static VOID ViewDlg_RestoreDefaults (HWND hwndDlg)
 
static BOOL CALLBACK PostCabinetMessageCallback (HWND hWnd, LPARAM param)
 
void PostCabinetMessage (UINT Msg, WPARAM wParam, LPARAM lParam)
 
static VOID ViewDlg_Apply (HWND hwndDlg)
 
INT_PTR CALLBACK FolderOptionsViewDlg (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
 

Function Documentation

◆ FolderOptionsViewDlg()

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

Definition at line 208 of file view.cpp.

213{
215
216 switch (uMsg)
217 {
218 case WM_INITDIALOG:
220
221 case WM_DESTROY:
222 ViewDlg_OnDestroy(hwndDlg);
223 break;
224
225 case WM_COMMAND:
226 switch (LOWORD(wParam))
227 {
228 case IDC_VIEW_RESTORE_DEFAULTS: // Restore Defaults
230 break;
231
234 {
236 bool ResetToDefault = LOWORD(wParam) == IDC_VIEW_RESET_ALL;
238 if (pFO)
239 hr = pFO->ApplyDefFolderSettings(ResetToDefault); // Use IBrowserService2
240 if (ResetToDefault && hr == HRESULT_FROM_WIN32(ERROR_NOT_SUPPORTED))
242 if (FAILED(hr))
243 SHELL_ErrorBox(hwndDlg, hr);
244 break;
245 }
246 }
247 break;
248
249 case WM_NOTIFY:
250 switch (LPNMHDR(lParam)->code)
251 {
252 case NM_CLICK: // clicked on treeview
254 break;
255
256 case NM_CUSTOMDRAW: // custom draw (for graying)
259 return Result;
260
261 case TVN_KEYDOWN: // key is down
263 break;
264
265 case PSN_APPLY: // [Apply] is clicked
266 ViewDlg_Apply(hwndDlg);
267 break;
268
269 default:
270 break;
271 }
272 break;
273 }
274
275 return FALSE;
276}
static HRESULT ResetGlobalAndDefViewFolderSettings()
WPARAM wParam
Definition: combotst.c:138
LPARAM lParam
Definition: combotst.c:139
#define FALSE
Definition: types.h:117
#define ERROR_NOT_SUPPORTED
Definition: compat.h:100
FxFileObject * pFO
#define FAILED(hr)
Definition: intsafe.h:51
#define LOWORD(l)
Definition: pedump.c:82
#define PSN_APPLY
Definition: prsht.h:117
#define LPPROPSHEETPAGE
Definition: prsht.h:390
#define TVN_KEYDOWN
Definition: commctrl.h:3718
#define NM_CLICK
Definition: commctrl.h:130
#define NM_CUSTOMDRAW
Definition: commctrl.h:137
#define TV_KEYDOWN
Definition: commctrl.h:3727
#define WM_NOTIFY
Definition: richedit.h:61
#define SHELL_ErrorBox
Definition: shellutils.h:126
HRESULT hr
Definition: shlfolder.c:183
#define IDC_VIEW_RESET_ALL
Definition: shresdef.h:535
#define IDC_VIEW_RESTORE_DEFAULTS
Definition: shresdef.h:537
#define IDC_VIEW_APPLY_TO_ALL
Definition: shresdef.h:534
Definition: inflate.c:139
#define SetWindowLongPtr
Definition: treelist.c:70
int32_t INT_PTR
Definition: typedefs.h:64
static void ViewDlg_OnTreeViewKeyDown(HWND hwndDlg, TV_KEYDOWN *KeyDown)
Definition: view.cpp:103
static VOID ViewDlg_RestoreDefaults(HWND hwndDlg)
Definition: view.cpp:151
static INT_PTR ViewDlg_OnTreeCustomDraw(HWND hwndDlg, NMTVCUSTOMDRAW *Draw)
Definition: view.cpp:122
static VOID ViewDlg_Apply(HWND hwndDlg)
Definition: view.cpp:188
static BOOL ViewDlg_OnInitDialog(HWND hwndDlg, LPPROPSHEETPAGE psp)
Definition: view.cpp:50
static CFolderOptions * GetFolderOptions(HWND hwndDlg)
Definition: view.cpp:27
static void ViewDlg_OnDestroy(HWND hwndDlg)
Definition: view.cpp:39
static VOID ViewDlg_OnTreeViewClick(HWND hwndDlg)
Definition: view.cpp:84
#define HRESULT_FROM_WIN32(x)
Definition: winerror.h:92
#define WM_COMMAND
Definition: winuser.h:1759
#define WM_INITDIALOG
Definition: winuser.h:1758
struct tagNMHDR * LPNMHDR
#define DWLP_MSGRESULT
Definition: winuser.h:881
#define WM_DESTROY
Definition: winuser.h:1628
_At_(*)(_In_ PWSK_CLIENT Client, _In_opt_ PUNICODE_STRING NodeName, _In_opt_ PUNICODE_STRING ServiceName, _In_opt_ ULONG NameSpace, _In_opt_ GUID *Provider, _In_opt_ PADDRINFOEXW Hints, _Outptr_ PADDRINFOEXW *Result, _In_opt_ PEPROCESS OwningProcess, _In_opt_ PETHREAD OwningThread, _Inout_ PIRP Irp Result)(Mem)) NTSTATUS(WSKAPI *PFN_WSK_GET_ADDRESS_INFO
Definition: wsk.h:409

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

◆ GetFolderOptions()

static CFolderOptions * GetFolderOptions ( HWND  hwndDlg)
inlinestatic

Definition at line 27 of file view.cpp.

28{
30}
#define GetWindowLongPtr
Definition: treelist.c:73
#define GWLP_USERDATA
Definition: treelist.c:63

Referenced by FolderOptionsViewDlg().

◆ GetRegTreeOptions()

static IRegTreeOptions * GetRegTreeOptions ( HWND  hwndDlg)
inlinestatic

Definition at line 33 of file view.cpp.

34{
35 return (IRegTreeOptions*)GetWindowLongPtr(hwndDlg, DWLP_USER);
36}
#define DWLP_USER
Definition: winuser.h:883

Referenced by ViewDlg_Apply(), ViewDlg_OnDestroy(), ViewDlg_OnTreeViewKeyDown(), ViewDlg_RestoreDefaults(), and ViewDlg_ToggleCheckItem().

◆ PostCabinetMessage()

void PostCabinetMessage ( UINT  Msg,
WPARAM  wParam,
LPARAM  lParam 
)

Definition at line 178 of file view.cpp.

179{
180 MSG data;
181 data.message = Msg;
182 data.wParam = wParam;
183 data.lParam = lParam;
185}
struct @1709 Msg[]
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
TW_UINT32 TW_UINT16 TW_UINT16 MSG
Definition: twain.h:1829
static BOOL CALLBACK PostCabinetMessageCallback(HWND hWnd, LPARAM param)
Definition: view.cpp:161
LONG_PTR LPARAM
Definition: windef.h:208
BOOL WINAPI EnumWindows(_In_ WNDENUMPROC lpEnumFunc, _In_ LPARAM lParam)

Referenced by GeneralDlg_OnApply(), and ViewDlg_Apply().

◆ PostCabinetMessageCallback()

static BOOL CALLBACK PostCabinetMessageCallback ( HWND  hWnd,
LPARAM  param 
)
static

Definition at line 161 of file view.cpp.

162{
163 MSG &data = *(MSG*)param;
164 WCHAR ClassName[100];
165 if (GetClassNameW(hWnd, ClassName, _countof(ClassName)))
166 {
167 if (!wcscmp(ClassName, L"Progman") ||
168 !wcscmp(ClassName, L"CabinetWClass") ||
169 !wcscmp(ClassName, L"ExploreWClass"))
170 {
171 PostMessage(hWnd, data.message, data.wParam, data.lParam);
172 }
173 }
174 return TRUE;
175}
HWND hWnd
Definition: settings.c:17
#define TRUE
Definition: types.h:120
GLfloat param
Definition: glext.h:5796
#define L(x)
Definition: ntvdm.h:50
_Check_return_ _CRTIMP int __cdecl wcscmp(_In_z_ const wchar_t *_Str1, _In_z_ const wchar_t *_Str2)
#define _countof(array)
Definition: sndvol32.h:70
#define PostMessage
Definition: winuser.h:5917
int WINAPI GetClassNameW(_In_ HWND hWnd, _Out_writes_to_(nMaxCount, return) LPWSTR lpClassName, _In_ int nMaxCount)
__wchar_t WCHAR
Definition: xmlstorage.h:180

Referenced by PostCabinetMessage().

◆ ViewDlg_Apply()

static VOID ViewDlg_Apply ( HWND  hwndDlg)
static

Definition at line 188 of file view.cpp.

189{
190 IRegTreeOptions *pRTO = GetRegTreeOptions(hwndDlg);
191 if (!pRTO || FAILED(pRTO->WalkTree(WALK_TREE_SAVE)))
192 return;
193
194 SHSettingsChanged(0, 0); // Invalidate restrictions
195 SHGetSetSettings(NULL, 0, TRUE); // Invalidate SHELLSTATE
196
198 cs.cLength = sizeof(cs);
199 if (ReadCabinetState(&cs, sizeof(cs)))
200 WriteCabinetState(&cs); // Write the settings and invalidate global counter
201
204}
#define NULL
Definition: types.h:112
#define FCIDM_DESKBROWSER_REFRESH
Definition: desktop.c:14
DWORD WINAPI SHSendMessageBroadcastW(UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: ordinal.c:4072
#define cs
Definition: i386-dis.c:442
BOOL WINAPI ReadCabinetState(CABINETSTATE *cs, int length)
Definition: shellord.c:1807
VOID WINAPI SHGetSetSettings(LPSHELLSTATE lpss, DWORD dwMask, BOOL bSet)
Definition: shellord.c:225
BOOL WINAPI WriteCabinetState(CABINETSTATE *cs)
Definition: shellord.c:1859
@ WALK_TREE_SAVE
Definition: shlobj_undoc.h:456
BOOL WINAPI SHSettingsChanged(LPCVOID unused, LPCWSTR pszKey)
Definition: shpolicy.c:197
void PostCabinetMessage(UINT Msg, WPARAM wParam, LPARAM lParam)
Definition: view.cpp:178
static IRegTreeOptions * GetRegTreeOptions(HWND hwndDlg)
Definition: view.cpp:33
#define WM_SETTINGCHANGE
Definition: winuser.h:1648

Referenced by FolderOptionsViewDlg().

◆ ViewDlg_OnDestroy()

static void ViewDlg_OnDestroy ( HWND  hwndDlg)
static

Definition at line 39 of file view.cpp.

40{
41 if (IRegTreeOptions *pRTO = GetRegTreeOptions(hwndDlg))
42 {
43 pRTO->WalkTree(WALK_TREE_DESTROY);
44 pRTO->Release();
45 SetWindowLongPtr(hwndDlg, DWLP_USER, 0);
46 }
47}
@ WALK_TREE_DESTROY
Definition: shlobj_undoc.h:457

Referenced by FolderOptionsViewDlg().

◆ ViewDlg_OnInitDialog()

static BOOL ViewDlg_OnInitDialog ( HWND  hwndDlg,
LPPROPSHEETPAGE  psp 
)
static

Definition at line 50 of file view.cpp.

51{
52 SetWindowLongPtr(hwndDlg, GWLP_USERDATA, psp->lParam);
53 CFolderOptions *pFO = (CFolderOptions*)psp->lParam;
54
55 if (!pFO || !pFO->CanSetDefFolderSettings())
56 {
57 // The global options (started from rundll32 or control panel)
58 // has no browser to copy the current settings from.
60 }
61
62 IRegTreeOptions *pRTO = NULL;
63 if (SUCCEEDED(SHCoCreateInstance(NULL, &CLSID_CRegTreeOptions, NULL, IID_PPV_ARG(IRegTreeOptions, &pRTO))))
64 {
65 SetWindowLongPtr(hwndDlg, DWLP_USER, (LPARAM)pRTO);
66
67 CHAR apath[MAX_PATH];
68 SHUnicodeToAnsi(REGSTR_PATH_EXPLORER L"\\Advanced", apath, _countof(apath));
70 pRTO->InitTree(hwndTreeView, HKEY_LOCAL_MACHINE, apath, NULL);
71 }
72
73 return TRUE; // Set focus
74}
#define MAX_PATH
Definition: compat.h:34
HRESULT WINAPI SHCoCreateInstance(LPCWSTR aclsid, const CLSID *clsid, LPUNKNOWN pUnkOuter, REFIID refiid, LPVOID *ppv)
Definition: shellole.c:105
INT WINAPI SHUnicodeToAnsi(LPCWSTR lpSrcStr, LPSTR lpDstStr, INT iLen)
Definition: string.c:2797
HWND hwndTreeView
Definition: eventvwr.c:65
#define SUCCEEDED(hr)
Definition: intsafe.h:50
if(dx< 0)
Definition: linetemp.h:194
#define REGSTR_PATH_EXPLORER
Definition: regstr.h:33
#define IDC_VIEW_TREEVIEW
Definition: shresdef.h:536
#define HKEY_LOCAL_MACHINE
Definition: winreg.h:12
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
BOOL WINAPI EnableWindow(_In_ HWND, _In_ BOOL)
#define IID_PPV_ARG(Itype, ppType)
char CHAR
Definition: xmlstorage.h:175

Referenced by FolderOptionsViewDlg().

◆ ViewDlg_OnTreeCustomDraw()

static INT_PTR ViewDlg_OnTreeCustomDraw ( HWND  hwndDlg,
NMTVCUSTOMDRAW Draw 
)
static

Definition at line 122 of file view.cpp.

123{
124 NMCUSTOMDRAW& nmcd = Draw->nmcd;
125 switch (nmcd.dwDrawStage)
126 {
127 case CDDS_PREPAINT:
128 return CDRF_NOTIFYITEMDRAW; // for CDDS_ITEMPREPAINT
129
131 if (!(nmcd.uItemState & CDIS_SELECTED)) // not selected
132 {
134 if ((HKEY)lParam == HKEY_REGTREEOPTION_GRAYED) // disabled
135 {
136 // draw as grayed
137 Draw->clrText = GetSysColor(COLOR_GRAYTEXT);
138 Draw->clrTextBk = GetSysColor(COLOR_WINDOW);
139 return CDRF_NEWFONT;
140 }
141 }
142 break;
143
144 default:
145 break;
146 }
147 return CDRF_DODEFAULT;
148}
void Draw(HDC aDc)
Definition: magnifier.c:359
#define CDDS_ITEMPREPAINT
Definition: commctrl.h:285
#define CDRF_NOTIFYITEMDRAW
Definition: commctrl.h:275
#define CDRF_DODEFAULT
Definition: commctrl.h:268
#define CDIS_SELECTED
Definition: commctrl.h:291
#define CDRF_NEWFONT
Definition: commctrl.h:269
#define CDDS_PREPAINT
Definition: commctrl.h:280
#define HKEY_REGTREEOPTION_GRAYED
Definition: shlobj_undoc.h:462
DWORD WINAPI GetSysColor(_In_ int)
#define COLOR_GRAYTEXT
Definition: winuser.h:943
#define COLOR_WINDOW
Definition: winuser.h:929

Referenced by FolderOptionsViewDlg().

◆ ViewDlg_OnTreeViewClick()

static VOID ViewDlg_OnTreeViewClick ( HWND  hwndDlg)
static

Definition at line 84 of file view.cpp.

85{
87
88 // do hit test to get the clicked item
89 TV_HITTESTINFO HitTest;
90 ZeroMemory(&HitTest, sizeof(HitTest));
91 DWORD dwPos = GetMessagePos();
92 HitTest.pt.x = GET_X_LPARAM(dwPos);
93 HitTest.pt.y = GET_Y_LPARAM(dwPos);
94 ScreenToClient(hwndTreeView, &HitTest.pt);
96
97 // toggle the check mark if possible
98 if (ViewDlg_ToggleCheckItem(hwndDlg, hItem))
99 PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
100}
unsigned long DWORD
Definition: ntddk_ex.h:95
#define PropSheet_Changed(d, w)
Definition: prsht.h:344
#define TV_HITTESTINFO
Definition: commctrl.h:3521
#define TreeView_HitTest(hwnd, lpht)
Definition: commctrl.h:3518
static BOOL ViewDlg_ToggleCheckItem(HWND hwndDlg, HTREEITEM hItem)
Definition: view.cpp:77
#define ZeroMemory
Definition: winbase.h:1753
#define GET_Y_LPARAM(lp)
Definition: windowsx.h:300
#define GET_X_LPARAM(lp)
Definition: windowsx.h:299
DWORD WINAPI GetMessagePos(void)
Definition: message.c:1351
HWND WINAPI GetParent(_In_ HWND)
BOOL WINAPI ScreenToClient(_In_ HWND, _Inout_ LPPOINT)

Referenced by FolderOptionsViewDlg().

◆ ViewDlg_OnTreeViewKeyDown()

static void ViewDlg_OnTreeViewKeyDown ( HWND  hwndDlg,
TV_KEYDOWN KeyDown 
)
static

Definition at line 103 of file view.cpp.

104{
106
107 if (KeyDown->wVKey == VK_SPACE)
108 {
110 if (ViewDlg_ToggleCheckItem(hwndDlg, hItem))
111 PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
112 }
113 else if (KeyDown->wVKey == VK_F5)
114 {
115 IRegTreeOptions *pRTO = GetRegTreeOptions(hwndDlg);
116 if (pRTO)
117 pRTO->WalkTree(WALK_TREE_REFRESH);
118 }
119}
#define TreeView_GetSelection(hwnd)
Definition: commctrl.h:3478
@ WALK_TREE_REFRESH
Definition: shlobj_undoc.h:459
#define VK_SPACE
Definition: winuser.h:2238
#define VK_F5
Definition: winuser.h:2278

Referenced by FolderOptionsViewDlg().

◆ ViewDlg_RestoreDefaults()

static VOID ViewDlg_RestoreDefaults ( HWND  hwndDlg)
static

Definition at line 151 of file view.cpp.

152{
153 if (IRegTreeOptions *pRTO = GetRegTreeOptions(hwndDlg))
154 {
155 pRTO->WalkTree(WALK_TREE_DEFAULT);
156 PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
157 }
158}
@ WALK_TREE_DEFAULT
Definition: shlobj_undoc.h:458

Referenced by FolderOptionsViewDlg().

◆ ViewDlg_ToggleCheckItem()

static BOOL ViewDlg_ToggleCheckItem ( HWND  hwndDlg,
HTREEITEM  hItem 
)
static

Definition at line 77 of file view.cpp.

78{
79 IRegTreeOptions *pRTO = GetRegTreeOptions(hwndDlg);
80 return pRTO && SUCCEEDED(pRTO->ToggleItem(hItem));
81}

Referenced by ViewDlg_OnTreeViewClick(), and ViewDlg_OnTreeViewKeyDown().

◆ WINE_DEFAULT_DEBUG_CHANNEL()

WINE_DEFAULT_DEBUG_CHANNEL ( fprop  )