ReactOS  0.4.14-dev-98-gb0d4763
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  * FILE: dll/cpl/desk/effappdlg.c
5  * PURPOSE: Effects appearance dialog
6  *
7  * PROGRAMMERS: Jan Roeloffzen (jroeloffzen[at]hotmail[dot]com)
8  * Ismael Ferreras Morezuelas (swyterzone+reactos@gmail.com)
9  */
10 
11 #include "desk.h"
12 
13 /* Update all the controls with the current values for the selected screen element */
14 static VOID
16 {
17  WPARAM state;
18 
19 #define SAVE_CHECKBOX(__CONTROL_ID, __MEMBER) \
20 do { \
21  state = SendDlgItemMessageW(hwndDlg, __CONTROL_ID, BM_GETCHECK, 0, 0); \
22  g->SchemeAdv.Effects.__MEMBER = /* Do a XOR of both the conditions */ \
23  ((state == BST_CHECKED) != (__CONTROL_ID == IDC_EFFAPPEARANCE_KEYBOARDCUES)); \
24 } while(0)
25 
26 #define SAVE_CHECKBOX_SCH(__CONTROL_ID, __MEMBER) \
27 do { \
28  state = SendDlgItemMessageW(hwndDlg, __CONTROL_ID, BM_GETCHECK, 0, 0); \
29  g->SchemeAdv.__MEMBER = (state == BST_CHECKED); \
30 } while(0)
31 
32 #define RSET_COMBOBOX(__CONTROL_ID, __PARENT_MEMBER, __MEMBER) \
33 do { \
34  SendDlgItemMessageW(hwndDlg, __CONTROL_ID, CB_SETCURSEL, (WPARAM)g->SchemeAdv.Effects.__MEMBER, 0); \
35  EnableWindow(GetDlgItem(hwndDlg, __CONTROL_ID), g->SchemeAdv.Effects.__PARENT_MEMBER); \
36 } while(0)
37 
38  /* Animated menu transitions section (checkbox + combo) */
40  RSET_COMBOBOX(IDC_EFFAPPEARANCE_ANIMATIONTYPE, bMenuAnimation, bMenuFade);
41 
42  /* Font antialiasing section (checkbox + combo) */
44  RSET_COMBOBOX(IDC_EFFAPPEARANCE_SMOOTHINGTYPE, bFontSmoothing, uiFontSmoothingType - 1);
45 
46  /* Other checkboxes */
51 
52 #undef SAVE_CHECKBOX
53 #undef RSET_COMBOBOX
54 
55  g->bSchemeChanged = TRUE;
56 }
57 
58 static VOID
60 {
61  /* The settings get saved at the end of ApplyScheme() in theme.c,
62  * when clicking Apply in the main dialog. */
63 }
64 
65 static VOID
66 AddToCombobox(INT Combo, HWND hwndDlg, INT From, INT To)
67 {
68  INT iElement;
69  TCHAR tstrText[80];
70 
71  for (iElement = From; iElement <= To; iElement++)
72  {
73  LoadString(hApplet, iElement, (LPTSTR)tstrText, ARRAYSIZE(tstrText));
74  SendDlgItemMessage(hwndDlg, Combo, CB_ADDSTRING, 0, (LPARAM)tstrText);
75  }
76 }
77 
78 /* Initialize the effects appearance dialog from the scheme populated in LoadCurrentScheme(), in theme.c */
79 static VOID
81 {
82  WPARAM state;
83 
84  /* Copy the current theme values */
85  g->SchemeAdv = g->Scheme;
86 
87 #define INIT_CHECKBOX(__CONTROL_ID, __MEMBER) \
88 do { \
89  state = /* Do a XOR of both the conditions */ \
90  ((g->SchemeAdv.Effects.__MEMBER) != (__CONTROL_ID == IDC_EFFAPPEARANCE_KEYBOARDCUES)) \
91  ? BST_CHECKED : BST_UNCHECKED; \
92  SendDlgItemMessageW(hwndDlg, __CONTROL_ID, BM_SETCHECK, state, 0); \
93 } while(0)
94 
95 #define INIT_CHECKBOX_SCH(__CONTROL_ID, __MEMBER) \
96 do { \
97  state = /* Do a XOR of both the conditions */ \
98  ((g->SchemeAdv.__MEMBER) == TRUE) \
99  ? BST_CHECKED : BST_UNCHECKED; \
100  SendDlgItemMessageW(hwndDlg, __CONTROL_ID, BM_SETCHECK, state, 0); \
101 } while(0)
102 
103 #define FILL_COMBOBOX(__CONTROL_ID, __FIRST_STR, __LAST_STR) \
104  AddToCombobox(__CONTROL_ID, hwndDlg, __FIRST_STR, __LAST_STR)
105 
106  /* Animated menu transitions section (checkbox + combo) */
110 
111  /* Font antialiasing section (checkbox + combo) */
115 
116  /* Other checkboxes */
121 
122 #undef INIT_CHECKBOX
123 #undef FILL_COMBOBOX
124 
125  /* Update the controls */
127 }
128 
131 {
132  GLOBALS* g;
133 
134  g = (GLOBALS*)GetWindowLongPtr(hwndDlg, DWLP_USER);
135 
136  switch (uMsg)
137  {
138  case WM_INITDIALOG:
139  g = (GLOBALS*)lParam;
140  SetWindowLongPtr(hwndDlg, DWLP_USER, (LONG_PTR)g);
141  EffAppearanceDlg_Init(hwndDlg, g);
142  break;
143 
144  case WM_DESTROY:
145  break;
146 
147  case WM_COMMAND:
148  switch(LOWORD(wParam))
149  {
150  case IDOK:
152  EndDialog(hwndDlg, IDOK);
153  break;
154 
155  case IDCANCEL:
156  g->SchemeAdv = g->Scheme;
157  EndDialog(hwndDlg, IDCANCEL);
158  break;
159 
166  if (HIWORD(wParam) == BN_CLICKED)
167  {
169  }
170  break;
171 
174  if (HIWORD(wParam) == CBN_SELCHANGE)
175  {
176  INT Index =
178  CB_GETCURSEL, 0, 0);
179 
180  g->SchemeAdv.Effects.bMenuFade =
182  CB_GETCURSEL, 0, 0);
183  g->SchemeAdv.Effects.uiFontSmoothingType = (Index == CB_ERR) ? 0 : (Index + 1);
184 
186  }
187  break;
188 
189  default:
190  return FALSE;
191  }
192  break;
193 
194  default:
195  return FALSE;
196  }
197 
198  return TRUE;
199 }
#define IDC_EFFAPPEARANCE_SETDROPSHADOW
Definition: resource.h:161
#define IDC_EFFAPPEARANCE_DRAGFULLWINDOWS
Definition: resource.h:162
#define IDC_EFFAPPEARANCE_ANIMATIONTYPE
Definition: resource.h:157
#define TRUE
Definition: types.h:120
#define IDOK
Definition: winuser.h:824
#define IDS_SLIDEEFFECT
Definition: resource.h:165
#define IDC_EFFAPPEARANCE_SMOOTHING
Definition: resource.h:158
#define SAVE_CHECKBOX(__CONTROL_ID, __MEMBER)
static VOID AddToCombobox(INT Combo, HWND hwndDlg, INT From, INT To)
Definition: effappdlg.c:66
static VOID EffAppearanceDlgUpdateControls(HWND hwndDlg, GLOBALS *g)
Definition: effappdlg.c:15
#define IDS_FADEEFFECT
Definition: resource.h:166
#define CALLBACK
Definition: compat.h:27
#define ARRAYSIZE(array)
Definition: filtermapper.c:47
HINSTANCE hApplet
Definition: access.c:17
UINT_PTR WPARAM
Definition: windef.h:207
#define SendDlgItemMessage
Definition: winuser.h:5743
int32_t INT_PTR
Definition: typedefs.h:62
#define INIT_CHECKBOX(__CONTROL_ID, __MEMBER)
#define RSET_COMBOBOX(__CONTROL_ID, __PARENT_MEMBER, __MEMBER)
int32_t INT
Definition: typedefs.h:56
#define SetWindowLongPtr
Definition: treelist.c:70
#define CB_GETCURSEL
Definition: winuser.h:1925
BOOL WINAPI EndDialog(_In_ HWND, _In_ INT_PTR)
WPARAM wParam
Definition: combotst.c:138
CHAR * LPTSTR
Definition: xmlstorage.h:192
#define SAVE_CHECKBOX_SCH(__CONTROL_ID, __MEMBER)
#define CB_ADDSTRING
Definition: winuser.h:1918
#define IDS_STANDARDEFFECT
Definition: resource.h:168
LONG_PTR LPARAM
Definition: windef.h:208
#define IDS_CLEARTYPEEFFECT
Definition: resource.h:169
#define CB_ERR
Definition: winuser.h:2410
#define WM_DESTROY
Definition: winuser.h:1591
char TCHAR
Definition: xmlstorage.h:189
static VOID EffAppearanceDlg_Init(HWND hwndDlg, GLOBALS *g)
Definition: effappdlg.c:80
GLboolean GLboolean g
Definition: glext.h:6204
static const UCHAR Index[8]
Definition: usbohci.c:18
INT_PTR CALLBACK EffAppearanceDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: effappdlg.c:130
#define BN_CLICKED
Definition: winuser.h:1907
LRESULT WINAPI SendDlgItemMessageW(_In_ HWND, _In_ int, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define IDC_EFFAPPEARANCE_FLATMENUS
Definition: resource.h:163
#define DWLP_USER
Definition: winuser.h:866
static VOID EffAppearanceDlgSaveCurrentValues(HWND hwndDlg, GLOBALS *g)
Definition: effappdlg.c:59
static int state
Definition: maze.c:121
#define WM_COMMAND
Definition: winuser.h:1722
__int3264 LONG_PTR
Definition: mstsclib_h.h:276
unsigned int UINT
Definition: ndis.h:50
#define CBN_SELCHANGE
Definition: winuser.h:1961
#define IDC_EFFAPPEARANCE_SMOOTHINGTYPE
Definition: resource.h:159
#define HIWORD(l)
Definition: typedefs.h:246
#define IDC_EFFAPPEARANCE_ANIMATION
Definition: resource.h:156
#define INIT_CHECKBOX_SCH(__CONTROL_ID, __MEMBER)
#define GetWindowLongPtr
Definition: treelist.c:73
#define IDCANCEL
Definition: winuser.h:825
#define FILL_COMBOBOX(__CONTROL_ID, __FIRST_STR, __LAST_STR)
#define WM_INITDIALOG
Definition: winuser.h:1721
LPARAM lParam
Definition: combotst.c:139
#define LOWORD(l)
Definition: pedump.c:82
#define LoadString
Definition: winuser.h:5720
#define IDC_EFFAPPEARANCE_KEYBOARDCUES
Definition: resource.h:155