ReactOS 0.4.16-dev-319-g6cf4263
effappdlg.c
Go to the documentation of this file.
1/*
2 * COPYRIGHT: See COPYING in the top level directory
3 * PROJECT: ReactOS Display Control Panel
4 * PURPOSE: Effects appearance dialog
5 * PROGRAMMERS: Jan Roeloffzen <jroeloffzen@hotmail.com>
6 * Ismael Ferreras Morezuelas <swyterzone+reactos@gmail.com>
7 */
8
9#include "desk.h"
10
11/* Update all the controls with the current values for the selected screen element */
12static VOID
14{
16
17#define SAVE_CHECKBOX(__CONTROL_ID, __MEMBER) \
18do { \
19 state = SendDlgItemMessageW(hwndDlg, __CONTROL_ID, BM_GETCHECK, 0, 0); \
20 g->SchemeAdv.Effects.__MEMBER = /* Do a XOR of both the conditions */ \
21 ((state == BST_CHECKED) != (__CONTROL_ID == IDC_EFFAPPEARANCE_KEYBOARDCUES)); \
22} while(0)
23
24#define SAVE_CHECKBOX_SCH(__CONTROL_ID, __MEMBER) \
25do { \
26 state = SendDlgItemMessageW(hwndDlg, __CONTROL_ID, BM_GETCHECK, 0, 0); \
27 g->SchemeAdv.__MEMBER = (state == BST_CHECKED); \
28} while(0)
29
30#define RSET_COMBOBOX(__CONTROL_ID, __PARENT_MEMBER, __MEMBER) \
31do { \
32 SendDlgItemMessageW(hwndDlg, __CONTROL_ID, CB_SETCURSEL, (WPARAM)g->SchemeAdv.Effects.__MEMBER, 0); \
33 EnableWindow(GetDlgItem(hwndDlg, __CONTROL_ID), g->SchemeAdv.Effects.__PARENT_MEMBER); \
34} while(0)
35
36 /* Animated menu transitions section (checkbox + combo) */
38 RSET_COMBOBOX(IDC_EFFAPPEARANCE_ANIMATIONTYPE, bMenuAnimation, bMenuFade);
39
40 /* Font antialiasing section (checkbox + combo) */
42 RSET_COMBOBOX(IDC_EFFAPPEARANCE_SMOOTHINGTYPE, bFontSmoothing, uiFontSmoothingType - 1);
43
44 /* Other checkboxes */
49
50#undef SAVE_CHECKBOX
51#undef RSET_COMBOBOX
52
53 g->bSchemeChanged = TRUE;
54}
55
56static VOID
58{
59 /* The settings get saved at the end of ApplyScheme() in theme.c,
60 * when clicking Apply in the main dialog. */
61}
62
63static VOID
64AddToCombobox(INT Combo, HWND hwndDlg, INT From, INT To)
65{
66 INT iElement;
67 TCHAR tstrText[80];
68
69 for (iElement = From; iElement <= To; iElement++)
70 {
71 LoadString(hApplet, iElement, (LPTSTR)tstrText, _countof(tstrText));
72 SendDlgItemMessage(hwndDlg, Combo, CB_ADDSTRING, 0, (LPARAM)tstrText);
73 }
74}
75
76/* Initialize the effects appearance dialog from the scheme populated in LoadCurrentScheme(), in theme.c */
77static VOID
79{
81
82 /* Copy the current theme values */
83 g->SchemeAdv = g->Scheme;
84
85#define INIT_CHECKBOX(__CONTROL_ID, __MEMBER) \
86do { \
87 state = /* Do a XOR of both the conditions */ \
88 ((g->SchemeAdv.Effects.__MEMBER) != (__CONTROL_ID == IDC_EFFAPPEARANCE_KEYBOARDCUES)) \
89 ? BST_CHECKED : BST_UNCHECKED; \
90 SendDlgItemMessageW(hwndDlg, __CONTROL_ID, BM_SETCHECK, state, 0); \
91} while(0)
92
93#define INIT_CHECKBOX_SCH(__CONTROL_ID, __MEMBER) \
94do { \
95 state = /* Do a XOR of both the conditions */ \
96 ((g->SchemeAdv.__MEMBER) == TRUE) \
97 ? BST_CHECKED : BST_UNCHECKED; \
98 SendDlgItemMessageW(hwndDlg, __CONTROL_ID, BM_SETCHECK, state, 0); \
99} while(0)
100
101#define FILL_COMBOBOX(__CONTROL_ID, __FIRST_STR, __LAST_STR) \
102 AddToCombobox(__CONTROL_ID, hwndDlg, __FIRST_STR, __LAST_STR)
103
104 /* Animated menu transitions section (checkbox + combo) */
108
109 /* Font antialiasing section (checkbox + combo) */
113
114 /* Other checkboxes */
119
120#undef INIT_CHECKBOX
121#undef FILL_COMBOBOX
122
123 /* Update the controls */
125}
126
129{
130 GLOBALS* g;
131
132 g = (GLOBALS*)GetWindowLongPtr(hwndDlg, DWLP_USER);
133
134 switch (uMsg)
135 {
136 case WM_INITDIALOG:
137 g = (GLOBALS*)lParam;
139 EffAppearanceDlg_Init(hwndDlg, g);
140 break;
141
142 case WM_DESTROY:
143 break;
144
145 case WM_COMMAND:
146 switch(LOWORD(wParam))
147 {
148 case IDOK:
150 EndDialog(hwndDlg, IDOK);
151 break;
152
153 case IDCANCEL:
154 g->SchemeAdv = g->Scheme;
155 EndDialog(hwndDlg, IDCANCEL);
156 break;
157
164 if (HIWORD(wParam) == BN_CLICKED)
166 break;
167
171 {
172 INT Index =
174 CB_GETCURSEL, 0, 0);
175
176 g->SchemeAdv.Effects.bMenuFade =
178 CB_GETCURSEL, 0, 0);
179 g->SchemeAdv.Effects.uiFontSmoothingType = (Index == CB_ERR) ? 0 : (Index + 1);
180
182 }
183 break;
184
185 default:
186 return FALSE;
187 }
188 break;
189
190 default:
191 return FALSE;
192 }
193
194 return TRUE;
195}
static int state
Definition: maze.c:121
WPARAM wParam
Definition: combotst.c:138
LPARAM lParam
Definition: combotst.c:139
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
HINSTANCE hApplet
Definition: access.c:17
#define IDS_CLEARTYPEEFFECT
Definition: resource.h:181
#define IDS_SLIDEEFFECT
Definition: resource.h:177
#define IDC_EFFAPPEARANCE_SETDROPSHADOW
Definition: resource.h:173
#define IDC_EFFAPPEARANCE_DRAGFULLWINDOWS
Definition: resource.h:174
#define IDS_STANDARDEFFECT
Definition: resource.h:180
#define IDC_EFFAPPEARANCE_FLATMENUS
Definition: resource.h:175
#define IDC_EFFAPPEARANCE_SMOOTHING
Definition: resource.h:170
#define IDS_FADEEFFECT
Definition: resource.h:178
#define IDC_EFFAPPEARANCE_ANIMATIONTYPE
Definition: resource.h:169
#define IDC_EFFAPPEARANCE_KEYBOARDCUES
Definition: resource.h:167
#define IDC_EFFAPPEARANCE_ANIMATION
Definition: resource.h:168
#define IDC_EFFAPPEARANCE_SMOOTHINGTYPE
Definition: resource.h:171
#define CALLBACK
Definition: compat.h:35
#define SAVE_CHECKBOX(__CONTROL_ID, __MEMBER)
static VOID EffAppearanceDlg_Init(HWND hwndDlg, GLOBALS *g)
Definition: effappdlg.c:78
static VOID AddToCombobox(INT Combo, HWND hwndDlg, INT From, INT To)
Definition: effappdlg.c:64
#define SAVE_CHECKBOX_SCH(__CONTROL_ID, __MEMBER)
#define FILL_COMBOBOX(__CONTROL_ID, __FIRST_STR, __LAST_STR)
#define RSET_COMBOBOX(__CONTROL_ID, __PARENT_MEMBER, __MEMBER)
#define INIT_CHECKBOX_SCH(__CONTROL_ID, __MEMBER)
static VOID EffAppearanceDlgSaveCurrentValues(HWND hwndDlg, GLOBALS *g)
Definition: effappdlg.c:57
INT_PTR CALLBACK EffAppearanceDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: effappdlg.c:128
#define INIT_CHECKBOX(__CONTROL_ID, __MEMBER)
static VOID EffAppearanceDlgUpdateControls(HWND hwndDlg, GLOBALS *g)
Definition: effappdlg.c:13
GLboolean GLboolean g
Definition: glext.h:6204
__int3264 LONG_PTR
Definition: mstsclib_h.h:276
unsigned int UINT
Definition: ndis.h:50
#define LOWORD(l)
Definition: pedump.c:82
#define _countof(array)
Definition: sndvol32.h:70
#define GetWindowLongPtr
Definition: treelist.c:73
#define SetWindowLongPtr
Definition: treelist.c:70
int32_t INT_PTR
Definition: typedefs.h:64
int32_t INT
Definition: typedefs.h:58
#define HIWORD(l)
Definition: typedefs.h:247
_In_ WDFCOLLECTION _In_ ULONG Index
LONG_PTR LPARAM
Definition: windef.h:208
UINT_PTR WPARAM
Definition: windef.h:207
#define DWLP_USER
Definition: winuser.h:875
#define IDCANCEL
Definition: winuser.h:834
#define WM_COMMAND
Definition: winuser.h:1743
#define CB_ERR
Definition: winuser.h:2438
#define WM_INITDIALOG
Definition: winuser.h:1742
#define IDOK
Definition: winuser.h:833
#define CBN_SELCHANGE
Definition: winuser.h:1982
LRESULT WINAPI SendDlgItemMessageW(_In_ HWND, _In_ int, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define CB_ADDSTRING
Definition: winuser.h:1939
#define LoadString
Definition: winuser.h:5831
#define BN_CLICKED
Definition: winuser.h:1928
#define WM_DESTROY
Definition: winuser.h:1612
#define CB_GETCURSEL
Definition: winuser.h:1946
#define SendDlgItemMessage
Definition: winuser.h:5854
BOOL WINAPI EndDialog(_In_ HWND, _In_ INT_PTR)
char TCHAR
Definition: xmlstorage.h:189
CHAR * LPTSTR
Definition: xmlstorage.h:192