ReactOS 0.4.15-dev-7842-g558ab78
appearance.c File Reference
#include "desk.h"
Include dependency graph for appearance.c:

Go to the source code of this file.

Functions

static void AppearancePage_UpdateThemePreview (HWND hwndDlg, GLOBALS *g)
 
static void AppearancePage_LoadSelectedScheme (HWND hwndDlg, GLOBALS *g)
 
static void AppearancePage_ShowStyles (HWND hwndDlg, int nIDDlgItem, PTHEME_STYLE pStyles, PTHEME_STYLE pActiveStyle)
 
static void AppearancePage_ShowColorSchemes (HWND hwndDlg, GLOBALS *g)
 
static void AppearancePage_ShowSizes (HWND hwndDlg, GLOBALS *g)
 
static INT_PTR AppearancePage_OnInit (HWND hwndDlg)
 
static VOID AppearancePage_OnDestroy (HWND hwndDlg, GLOBALS *g)
 
static PVOID GetSelectedData (HWND hwndDlg, int nIDDlgItem)
 
INT_PTR CALLBACK AppearancePageProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
 

Function Documentation

◆ AppearancePage_LoadSelectedScheme()

static void AppearancePage_LoadSelectedScheme ( HWND  hwndDlg,
GLOBALS g 
)
static

Definition at line 35 of file appearance.c.

36{
37 if (g->ActiveTheme.ThemeActive == FALSE )
38 {
39 LoadSchemeFromReg(&g->Scheme, &g->ActiveTheme);
40 }
41 else
42 {
43 LoadSchemeFromTheme(&g->Scheme, &g->ActiveTheme);
44 }
45
46 g_GlobalData.desktop_color = g->Scheme.crColor[COLOR_DESKTOP];
47}
BOOL LoadSchemeFromReg(PCOLOR_SCHEME scheme, PTHEME_SELECTION pSelectedTheme)
BOOL LoadSchemeFromTheme(PCOLOR_SCHEME scheme, PTHEME_SELECTION pSelectedTheme)
GLOBAL_DATA g_GlobalData
Definition: background.c:70
#define FALSE
Definition: types.h:117
GLboolean GLboolean g
Definition: glext.h:6204
COLORREF desktop_color
Definition: desk.h:159
#define COLOR_DESKTOP
Definition: winuser.h:914

Referenced by AppearancePage_OnInit(), and AppearancePageProc().

◆ AppearancePage_OnDestroy()

static VOID AppearancePage_OnDestroy ( HWND  hwndDlg,
GLOBALS g 
)
static

Definition at line 197 of file appearance.c.

198{
200}
#define GetProcessHeap()
Definition: compat.h:736
#define HeapFree(x, y, z)
Definition: compat.h:735

Referenced by AppearancePageProc().

◆ AppearancePage_OnInit()

static INT_PTR AppearancePage_OnInit ( HWND  hwndDlg)
static

Definition at line 97 of file appearance.c.

98{
99 INT iListIndex;
100 HWND hwndTheme;
101 GLOBALS *g;
102 RECT rcPreview;
103 HDC hdcScreen;
104 PTHEME pTheme;
105
107 if (g == NULL)
108 return FALSE;
109
111
112 g->bInitializing = TRUE;
113
114 if (!LoadCurrentScheme(&g->Scheme))
115 return FALSE;
116
117 g->pThemes = LoadThemes();
118 if (g->pThemes)
119 {
120 BOOL bLoadedTheme = FALSE;
121
124 wcscmp(g_GlobalData.pwszAction, L"OpenMSTheme") == 0)
125 {
126 bLoadedTheme = FindOrAppendTheme(g->pThemes,
128 NULL,
129 NULL,
130 &g->ActiveTheme);
131 }
132
133 if (bLoadedTheme)
134 {
135 g->bThemeChanged = TRUE;
136 g->bSchemeChanged = TRUE;
137
138 PostMessageW(GetParent(hwndDlg), PSM_CHANGED, (WPARAM)hwndDlg, 0);
139
141 }
142 else
143 {
144 if (!GetActiveTheme(g->pThemes, &g->ActiveTheme))
145 {
146 g->ActiveTheme.ThemeActive = FALSE;
147 }
148 }
149
150 /*
151 * Keep a copy of the selected classic theme in order to select this
152 * when user selects the classic theme (and not a horrible random theme )
153 */
154 if (!GetActiveClassicTheme(g->pThemes, &g->ClassicTheme))
155 {
156 g->ClassicTheme.Theme = g->pThemes;
157 g->ClassicTheme.Color = g->pThemes->ColoursList;
158 g->ClassicTheme.Size = g->ClassicTheme.Color->ChildStyle;
159 }
160
161 if (g->ActiveTheme.ThemeActive == FALSE)
162 g->ActiveTheme = g->ClassicTheme;
163
164 GetClientRect(GetDlgItem(hwndDlg, IDC_APPEARANCE_PREVIEW), &rcPreview);
165
166 hdcScreen = GetDC(NULL);
167 g->hbmpThemePreview = CreateCompatibleBitmap(hdcScreen, rcPreview.right, rcPreview.bottom);
168 g->hdcThemePreview = CreateCompatibleDC(hdcScreen);
169 SelectObject(g->hdcThemePreview, g->hbmpThemePreview);
170 ReleaseDC(NULL, hdcScreen);
171
172 hwndTheme = GetDlgItem(hwndDlg, IDC_APPEARANCE_VISUAL_STYLE);
173
174 for (pTheme = g->pThemes; pTheme; pTheme = pTheme->NextTheme)
175 {
176 iListIndex = SendMessage(hwndTheme, CB_ADDSTRING, 0, (LPARAM)pTheme->DisplayName);
177 SendMessage(hwndTheme, CB_SETITEMDATA, iListIndex, (LPARAM)pTheme);
178 if (pTheme == g->ActiveTheme.Theme)
179 {
180 SendMessage(hwndTheme, CB_SETCURSEL, (WPARAM)iListIndex, 0);
181 }
182 }
183
184 if (g->ActiveTheme.Theme)
185 {
187 AppearancePage_ShowSizes(hwndDlg, g);
189 }
190 }
191 g->bInitializing = FALSE;
192
193 return FALSE;
194}
static void AppearancePage_UpdateThemePreview(HWND hwndDlg, GLOBALS *g)
Definition: appearance.c:16
static void AppearancePage_ShowSizes(HWND hwndDlg, GLOBALS *g)
Definition: appearance.c:81
static void AppearancePage_LoadSelectedScheme(HWND hwndDlg, GLOBALS *g)
Definition: appearance.c:35
static void AppearancePage_ShowColorSchemes(HWND hwndDlg, GLOBALS *g)
Definition: appearance.c:72
BOOL FindOrAppendTheme(IN PTHEME pThemeList, IN LPCWSTR pwszThemeFileName, IN LPCWSTR pwszColorBuff, IN LPCWSTR pwszSizeBuff, OUT PTHEME_SELECTION pSelectedTheme)
Definition: theme.c:791
BOOL GetActiveClassicTheme(PTHEME pThemeList, PTHEME_SELECTION pSelectedTheme)
PTHEME LoadThemes(VOID)
Definition: theme.c:749
BOOL GetActiveTheme(PTHEME pThemeList, PTHEME_SELECTION pSelectedTheme)
BOOL LoadCurrentScheme(PCOLOR_SCHEME scheme)
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define IDC_APPEARANCE_VISUAL_STYLE
Definition: resource.h:102
#define IDC_APPEARANCE_PREVIEW
Definition: resource.h:97
#define HeapAlloc
Definition: compat.h:733
#define HEAP_ZERO_MEMORY
Definition: compat.h:134
unsigned int BOOL
Definition: ntddk_ex.h:94
static HDC
Definition: imagelist.c:92
__int3264 LONG_PTR
Definition: mstsclib_h.h:276
#define L(x)
Definition: ntvdm.h:50
struct _GLOBALS GLOBALS
#define PSM_CHANGED
Definition: prsht.h:164
_Check_return_ _CRTIMP int __cdecl wcscmp(_In_z_ const wchar_t *_Str1, _In_z_ const wchar_t *_Str2)
LPCWSTR pwszFile
Definition: desk.h:160
LPCWSTR pwszAction
Definition: desk.h:161
struct _THEME * NextTheme
Definition: appearance.h:89
PWSTR DisplayName
Definition: appearance.h:91
LONG right
Definition: windef.h:308
LONG bottom
Definition: windef.h:309
#define SetWindowLongPtr
Definition: treelist.c:70
int32_t INT
Definition: typedefs.h:58
LONG_PTR LPARAM
Definition: windef.h:208
UINT_PTR WPARAM
Definition: windef.h:207
HGDIOBJ WINAPI SelectObject(_In_ HDC, _In_ HGDIOBJ)
Definition: dc.c:1539
HDC WINAPI CreateCompatibleDC(_In_opt_ HDC hdc)
HBITMAP WINAPI CreateCompatibleBitmap(_In_ HDC hdc, _In_ INT cx, _In_ INT cy)
int WINAPI ReleaseDC(_In_opt_ HWND, _In_ HDC)
#define CB_SETITEMDATA
Definition: winuser.h:1966
#define DWLP_USER
Definition: winuser.h:872
BOOL WINAPI PostMessageW(_In_opt_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define CB_SETCURSEL
Definition: winuser.h:1961
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
BOOL WINAPI GetClientRect(_In_ HWND, _Out_ LPRECT)
#define CB_ADDSTRING
Definition: winuser.h:1936
#define SendMessage
Definition: winuser.h:5843
HDC WINAPI GetDC(_In_opt_ HWND)
HWND WINAPI GetParent(_In_ HWND)

Referenced by AppearancePageProc().

◆ AppearancePage_ShowColorSchemes()

static void AppearancePage_ShowColorSchemes ( HWND  hwndDlg,
GLOBALS g 
)
static

Definition at line 72 of file appearance.c.

73{
76 g->ActiveTheme.Theme->ColoursList,
77 g->ActiveTheme.Color);
78}
static void AppearancePage_ShowStyles(HWND hwndDlg, int nIDDlgItem, PTHEME_STYLE pStyles, PTHEME_STYLE pActiveStyle)
Definition: appearance.c:50
#define IDC_APPEARANCE_COLORSCHEME
Definition: resource.h:98

Referenced by AppearancePage_OnInit(), and AppearancePageProc().

◆ AppearancePage_ShowSizes()

static void AppearancePage_ShowSizes ( HWND  hwndDlg,
GLOBALS g 
)
static

Definition at line 81 of file appearance.c.

82{
83 PTHEME_STYLE pSizes;
84
85 if (g->ActiveTheme.Theme->SizesList)
86 pSizes = g->ActiveTheme.Theme->SizesList;
87 else
88 pSizes = g->ActiveTheme.Color->ChildStyle;
89
92 pSizes,
93 g->ActiveTheme.Size);
94}
#define IDC_APPEARANCE_SIZE
Definition: resource.h:103
struct _THEME_STYLE * ChildStyle
Definition: appearance.h:82

Referenced by AppearancePage_OnInit(), and AppearancePageProc().

◆ AppearancePage_ShowStyles()

static void AppearancePage_ShowStyles ( HWND  hwndDlg,
int  nIDDlgItem,
PTHEME_STYLE  pStyles,
PTHEME_STYLE  pActiveStyle 
)
static

Definition at line 50 of file appearance.c.

51{
52 int iListIndex;
53 HWND hwndList = GetDlgItem(hwndDlg, nIDDlgItem);
54 PTHEME_STYLE pCurrentStyle;
55
56 SendMessage(hwndList, CB_RESETCONTENT , 0, 0);
57
58 for (pCurrentStyle = pStyles;
59 pCurrentStyle;
60 pCurrentStyle = pCurrentStyle->NextStyle)
61 {
62 iListIndex = SendMessage(hwndList, CB_ADDSTRING, 0, (LPARAM)pCurrentStyle->DisplayName);
63 SendMessage(hwndList, CB_SETITEMDATA, iListIndex, (LPARAM)pCurrentStyle);
64 if (pCurrentStyle == pActiveStyle)
65 {
66 SendMessage(hwndList, CB_SETCURSEL, (WPARAM)iListIndex, 0);
67 }
68 }
69}
struct _THEME_STYLE * NextStyle
Definition: appearance.h:81
PWSTR DisplayName
Definition: appearance.h:84
#define CB_RESETCONTENT
Definition: winuser.h:1959
_In_ int nIDDlgItem
Definition: winuser.h:4619

Referenced by AppearancePage_ShowColorSchemes(), and AppearancePage_ShowSizes().

◆ AppearancePage_UpdateThemePreview()

static void AppearancePage_UpdateThemePreview ( HWND  hwndDlg,
GLOBALS g 
)
static

Definition at line 16 of file appearance.c.

17{
18 if (g->ActiveTheme.ThemeActive)
19 {
20 RECT rcWindow;
21
23 if (DrawThemePreview(g->hdcThemePreview, &g->Scheme, &g->ActiveTheme, &rcWindow))
24 {
26 return;
27 }
28 }
29
32}
BOOL DrawThemePreview(HDC hdcMem, PCOLOR_SCHEME scheme, PTHEME_SELECTION pSelectedTheme, PRECT prcWindow)
#define PVM_UPDATETHEME
Definition: preview.h:33
#define PVM_SET_HDC_PREVIEW
Definition: preview.h:32
#define SendDlgItemMessage
Definition: winuser.h:5842

Referenced by AppearancePage_OnInit(), and AppearancePageProc().

◆ AppearancePageProc()

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

Definition at line 216 of file appearance.c.

217{
218 GLOBALS *g;
219 LPNMHDR lpnm;
220
221 g = (GLOBALS*)GetWindowLongPtr(hwndDlg, DWLP_USER);
222
223 switch (uMsg)
224 {
225 case WM_INITDIALOG:
226 return AppearancePage_OnInit(hwndDlg);
227
228 case WM_DESTROY:
229 AppearancePage_OnDestroy(hwndDlg, g);
230 break;
231
232 case WM_COMMAND:
233 if (g == NULL || g->bInitializing)
234 return FALSE;
235
236 switch (LOWORD(wParam))
237 {
240 hwndDlg, EffAppearanceDlgProc, (LPARAM)g) == IDOK)
241 {
242 PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
243 g->Scheme = g->SchemeAdv;
244 g->bSchemeChanged = TRUE;
245 }
246 break;
247
250 hwndDlg, AdvAppearanceDlgProc, (LPARAM)g) == IDOK)
251 {
252 PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
253 g->bSchemeChanged = TRUE;
254 g->Scheme = g->SchemeAdv;
255 g_GlobalData.desktop_color = g->Scheme.crColor[COLOR_DESKTOP];
256
258 }
259 break;
260
263 {
264 g->ActiveTheme.Color = (PTHEME_STYLE)GetSelectedData(hwndDlg, IDC_APPEARANCE_COLORSCHEME);
265 if (g->ActiveTheme.Color->ChildStyle != NULL)
266 g->ActiveTheme.Size = g->ActiveTheme.Color->ChildStyle;
267
268 g->bSchemeChanged = TRUE;
269 if (g->ActiveTheme.ThemeActive)
270 g->bThemeChanged = TRUE;
271
272 PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
273
275 AppearancePage_ShowSizes(hwndDlg, g);
277 }
278 break;
279
282 {
284
285 if (g->ClassicTheme.Theme == pTheme)
286 g->ActiveTheme = g->ClassicTheme;
287 else
288 {
289 g->ActiveTheme.Theme = pTheme;
290 g->ActiveTheme.Size = pTheme->SizesList;
291 g->ActiveTheme.Color = pTheme->ColoursList;
292 g->ActiveTheme.ThemeActive = TRUE;
293 }
294
295 g->bThemeChanged = TRUE;
296 g->bSchemeChanged = TRUE;
297
298 PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
299
301 AppearancePage_ShowSizes(hwndDlg, g);
304 }
305 break;
306
309 {
310 g->ActiveTheme.Size = (PTHEME_STYLE)GetSelectedData(hwndDlg, IDC_APPEARANCE_SIZE);
311 g->bSchemeChanged = TRUE;
312 if (g->ActiveTheme.ThemeActive)
313 g->bThemeChanged = TRUE;
314
315 PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
316
319 }
320 }
321 break;
322
323 case WM_NOTIFY:
324 lpnm = (LPNMHDR)lParam;
325 switch (lpnm->code)
326 {
327 case PSN_APPLY:
328
329 if (g->bThemeChanged)
330 {
331 ActivateTheme(&g->ActiveTheme);
332 }
333
334 if (g->bSchemeChanged)
335 {
336 ApplyScheme(&g->Scheme, &g->ActiveTheme);
337 if (g->ActiveTheme.ThemeActive == FALSE)
338 g->ClassicTheme = g->ActiveTheme;
339 }
340
342 g->bThemeChanged = FALSE;
343 g->bSchemeChanged = FALSE;
345 return TRUE;
346
347 case PSN_KILLACTIVE:
349 return TRUE;
350
351 case PSN_SETACTIVE:
352 if (g->Scheme.crColor[COLOR_DESKTOP] != g_GlobalData.desktop_color)
353 {
354 g->Scheme.crColor[COLOR_DESKTOP] = g_GlobalData.desktop_color;
356 }
357 break;
358 }
359 break;
360 }
361
362 return FALSE;
363}
INT_PTR CALLBACK AdvAppearanceDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: advappdlg.c:503
static INT_PTR AppearancePage_OnInit(HWND hwndDlg)
Definition: appearance.c:97
static VOID AppearancePage_OnDestroy(HWND hwndDlg, GLOBALS *g)
Definition: appearance.c:197
static PVOID GetSelectedData(HWND hwndDlg, int nIDDlgItem)
Definition: appearance.c:203
struct _THEME_STYLE * PTHEME_STYLE
VOID ApplyScheme(PCOLOR_SCHEME scheme, PTHEME_SELECTION pSelectedTheme)
struct _THEME * PTHEME
BOOL ActivateTheme(PTHEME_SELECTION pSelectedTheme)
INT_PTR CALLBACK EffAppearanceDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: effappdlg.c:130
WPARAM wParam
Definition: combotst.c:138
LPARAM lParam
Definition: combotst.c:139
HINSTANCE hApplet
Definition: access.c:17
#define IDC_APPEARANCE_ADVANCED
Definition: resource.h:101
#define IDC_APPEARANCE_EFFECTS
Definition: resource.h:100
#define IDD_ADVAPPEARANCE
Definition: resource.h:14
#define IDD_EFFAPPEARANCE
Definition: resource.h:15
#define LOWORD(l)
Definition: pedump.c:82
#define PropSheet_Changed(d, w)
Definition: prsht.h:344
#define PSN_KILLACTIVE
Definition: prsht.h:116
#define PSN_APPLY
Definition: prsht.h:117
#define PSNRET_NOERROR
Definition: prsht.h:129
#define PSN_SETACTIVE
Definition: prsht.h:115
#define WM_NOTIFY
Definition: richedit.h:61
THEME_STYLE * SizesList
Definition: appearance.h:93
THEME_STYLE * ColoursList
Definition: appearance.h:92
UINT code
Definition: winuser.h:3159
#define GetWindowLongPtr
Definition: treelist.c:73
#define HIWORD(l)
Definition: typedefs.h:247
#define WM_COMMAND
Definition: winuser.h:1740
#define DialogBoxParam
Definition: winuser.h:5764
#define WM_INITDIALOG
Definition: winuser.h:1739
#define IDOK
Definition: winuser.h:830
#define CBN_SELCHANGE
Definition: winuser.h:1979
struct tagNMHDR * LPNMHDR
#define DWLP_MSGRESULT
Definition: winuser.h:870
#define WM_DESTROY
Definition: winuser.h:1609
#define MAKEINTRESOURCE
Definition: winuser.h:591

◆ GetSelectedData()

static PVOID GetSelectedData ( HWND  hwndDlg,
int  nIDDlgItem 
)
static

Definition at line 203 of file appearance.c.

204{
205 HWND hwndCombo;
206 INT sel;
207
208 hwndCombo = GetDlgItem(hwndDlg, nIDDlgItem);
209 sel = SendMessage(hwndCombo, CB_GETCURSEL, 0, 0);
210 if (sel == CB_ERR)
211 return NULL;
212 return (PVOID)SendMessage(hwndCombo, CB_GETITEMDATA, (WPARAM)sel, 0);
213}
#define CB_ERR
Definition: winuser.h:2435
#define CB_GETITEMDATA
Definition: winuser.h:1950
#define CB_GETCURSEL
Definition: winuser.h:1943

Referenced by AppearancePageProc().