1 /* dialog management for wineconsole
9 #include "winecon_user.h"
11 /* FIXME: so far, part of the code is made in ASCII because the Uncode property sheet functions
12 * are not implemented yet
17 WCUSER_ApplyToCursorSize
,
18 WCUSER_ApplyToHistorySize
, WCUSER_ApplyToHistoryMode
, WCUSER_ApplyToMenuMask
,
20 WCUSER_ApplyToFont
, WCUSER_ApplyToAttribute
,
22 WCUSER_ApplyToBufferSize
, WCUSER_ApplyToWindow
27 struct config_data
* config
; /* pointer to configuration used for dialog box */
28 struct inner_data
* data
; /* pointer to current winecon info */
29 HWND hDlg
; /* handle to active propsheet */
30 int nFont
; /* number of font size in size LB */
35 } *font
; /* array of nFont. index sync'ed with SIZE LB */
36 void (*apply
)(struct dialog_info
*, HWND
, enum WCUSER_ApplyTo
, DWORD
);
39 /******************************************************************
44 static void WCUSER_ApplyDefault(struct dialog_info
* di
, HWND hDlg
, enum WCUSER_ApplyTo apply
, DWORD val
)
48 case WCUSER_ApplyToCursorSize
:
49 case WCUSER_ApplyToHistorySize
:
50 case WCUSER_ApplyToHistoryMode
:
51 case WCUSER_ApplyToBufferSize
:
52 case WCUSER_ApplyToWindow
:
53 /* not saving those for now... */
55 case WCUSER_ApplyToMenuMask
:
56 di
->config
->menu_mask
= val
;
58 case WCUSER_ApplyToFont
:
59 WCUSER_CopyFont(di
->config
, &di
->font
[val
].lf
);
61 case WCUSER_ApplyToAttribute
:
62 di
->config
->def_attr
= val
;
65 WINECON_RegSave(di
->config
);
68 /******************************************************************
73 static void WCUSER_ApplyCurrent(struct dialog_info
* di
, HWND hDlg
, enum WCUSER_ApplyTo apply
, DWORD val
)
77 case WCUSER_ApplyToCursorSize
:
79 CONSOLE_CURSOR_INFO cinfo
;
81 cinfo
.bVisible
= di
->config
->cursor_visible
;
82 /* this shall update (through notif) curcfg */
83 SetConsoleCursorInfo(di
->data
->hConOut
, &cinfo
);
86 case WCUSER_ApplyToHistorySize
:
87 di
->config
->history_size
= val
;
88 WINECON_SetHistorySize(di
->data
->hConIn
, val
);
90 case WCUSER_ApplyToHistoryMode
:
91 WINECON_SetHistoryMode(di
->data
->hConIn
, val
);
93 case WCUSER_ApplyToMenuMask
:
94 di
->config
->menu_mask
= val
;
96 case WCUSER_ApplyToFont
:
97 WCUSER_SetFont(di
->data
, &di
->font
[val
].lf
);
99 case WCUSER_ApplyToAttribute
:
100 di
->config
->def_attr
= val
;
101 SetConsoleTextAttribute(di
->data
->hConOut
, val
);
103 case WCUSER_ApplyToBufferSize
:
104 /* this shall update (through notif) curcfg */
105 SetConsoleScreenBufferSize(di
->data
->hConOut
, *(COORD
*)val
);
107 case WCUSER_ApplyToWindow
:
108 /* this shall update (through notif) curcfg */
109 SetConsoleWindowInfo(di
->data
->hConOut
, FALSE
, (SMALL_RECT
*)val
);
114 /******************************************************************
115 * WCUSER_OptionDlgProc
117 * Dialog prop for the option property sheet
119 static BOOL WINAPI
WCUSER_OptionDlgProc(HWND hDlg
, UINT msg
, WPARAM wParam
, LPARAM lParam
)
121 struct dialog_info
* di
;
127 di
= (struct dialog_info
*)((PROPSHEETPAGEA
*)lParam
)->lParam
;
129 SetWindowLongA(hDlg
, DWL_USER
, (DWORD
)di
);
130 if (di
->config
->cursor_size
<= 25) idc
= IDC_OPT_CURSOR_SMALL
;
131 else if (di
->config
->cursor_size
<= 50) idc
= IDC_OPT_CURSOR_MEDIUM
;
132 else idc
= IDC_OPT_CURSOR_LARGE
;
133 SendDlgItemMessage(hDlg
, idc
, BM_SETCHECK
, BST_CHECKED
, 0L);
134 SetDlgItemInt(hDlg
, IDC_OPT_HIST_SIZE
, WINECON_GetHistorySize(di
->data
->hConIn
), FALSE
);
135 if (WINECON_GetHistoryMode(di
->data
->hConIn
))
136 SendDlgItemMessage(hDlg
, IDC_OPT_HIST_DOUBLE
, BM_SETCHECK
, BST_CHECKED
, 0L);
137 SendDlgItemMessage(hDlg
, IDC_OPT_CONF_CTRL
, BM_SETCHECK
,
138 (di
->config
->menu_mask
& MK_CONTROL
) ? BST_CHECKED
: BST_UNCHECKED
, 0L);
139 SendDlgItemMessage(hDlg
, IDC_OPT_CONF_SHIFT
, BM_SETCHECK
,
140 (di
->config
->menu_mask
& MK_SHIFT
) ? BST_CHECKED
: BST_UNCHECKED
, 0L);
141 return FALSE
; /* because we set the focus */
146 NMHDR
* nmhdr
= (NMHDR
*)lParam
;
150 di
= (struct dialog_info
*)GetWindowLongA(hDlg
, DWL_USER
);
154 /* needed in propsheet to keep properly the selected radio button
155 * otherwise, the focus would be set to the first tab stop in the
156 * propsheet, which would always activate the first radio button
158 if (IsDlgButtonChecked(hDlg
, IDC_OPT_CURSOR_SMALL
) == BST_CHECKED
)
159 idc
= IDC_OPT_CURSOR_SMALL
;
160 else if (IsDlgButtonChecked(hDlg
, IDC_OPT_CURSOR_MEDIUM
) == BST_CHECKED
)
161 idc
= IDC_OPT_CURSOR_MEDIUM
;
163 idc
= IDC_OPT_CURSOR_LARGE
;
164 PostMessage(hDlg
, WM_NEXTDLGCTL
, (WPARAM
)GetDlgItem(hDlg
, idc
), TRUE
);
168 if (IsDlgButtonChecked(hDlg
, IDC_OPT_CURSOR_SMALL
) == BST_CHECKED
) val
= 25;
169 else if (IsDlgButtonChecked(hDlg
, IDC_OPT_CURSOR_MEDIUM
) == BST_CHECKED
) val
= 50;
171 (di
->apply
)(di
, hDlg
, WCUSER_ApplyToCursorSize
, val
);
173 val
= GetDlgItemInt(hDlg
, IDC_OPT_HIST_SIZE
, &done
, FALSE
);
174 if (done
) (di
->apply
)(di
, hDlg
, WCUSER_ApplyToHistorySize
, val
);
176 (di
->apply
)(di
, hDlg
, WCUSER_ApplyToHistoryMode
,
177 IsDlgButtonChecked(hDlg
, IDC_OPT_HIST_DOUBLE
) & BST_CHECKED
);
180 if (IsDlgButtonChecked(hDlg
, IDC_OPT_CONF_CTRL
) & BST_CHECKED
) val
|= MK_CONTROL
;
181 if (IsDlgButtonChecked(hDlg
, IDC_OPT_CONF_SHIFT
) & BST_CHECKED
) val
|= MK_SHIFT
;
182 (di
->apply
)(di
, hDlg
, WCUSER_ApplyToMenuMask
, val
);
183 SetWindowLong(hDlg
, DWL_MSGRESULT
, PSNRET_NOERROR
);
196 /******************************************************************
197 * WCUSER_FontPreviewProc
199 * Window proc for font previewer in font property sheet
201 static LRESULT WINAPI
WCUSER_FontPreviewProc(HWND hWnd
, UINT msg
, WPARAM wParam
, LPARAM lParam
)
210 struct dialog_info
* di
;
212 di
= (struct dialog_info
*)GetWindowLong(GetParent(hWnd
), DWL_USER
);
213 BeginPaint(hWnd
, &ps
);
215 font_idx
= SendDlgItemMessage(di
->hDlg
, IDC_FNT_LIST_FONT
, LB_GETCURSEL
, 0L, 0L);
216 size_idx
= SendDlgItemMessage(di
->hDlg
, IDC_FNT_LIST_SIZE
, LB_GETCURSEL
, 0L, 0L);
218 if (font_idx
>= 0 && size_idx
>= 0 && size_idx
< di
->nFont
)
220 HFONT hFont
, hOldFont
;
225 hFont
= CreateFontIndirect(&di
->font
[size_idx
].lf
);
226 len1
= LoadString(GetModuleHandle(NULL
), IDS_FNT_PREVIEW_1
,
227 buf1
, sizeof(buf1
) / sizeof(WCHAR
));
228 len2
= LoadString(GetModuleHandle(NULL
), IDS_FNT_PREVIEW_2
,
229 buf2
, sizeof(buf2
) / sizeof(WCHAR
));
230 buf1
[len1
] = buf2
[len2
] = 0;
233 hOldFont
= SelectObject(ps
.hdc
, hFont
);
234 SetBkColor(ps
.hdc
, WCUSER_ColorMap
[GetWindowLong(GetDlgItem(di
->hDlg
, IDC_FNT_COLOR_BK
), 0)]);
235 SetTextColor(ps
.hdc
, WCUSER_ColorMap
[GetWindowLong(GetDlgItem(di
->hDlg
, IDC_FNT_COLOR_FG
), 0)]);
236 TextOut(ps
.hdc
, 0, 0, buf1
, len1
);
238 TextOut(ps
.hdc
, 0, di
->font
[size_idx
].tm
.tmHeight
, buf2
, len2
);
239 SelectObject(ps
.hdc
, hOldFont
);
247 return DefWindowProc(hWnd
, msg
, wParam
, lParam
);
252 /******************************************************************
253 * WCUSER_ColorPreviewProc
255 * Window proc for color previewer in font property sheet
257 static LRESULT WINAPI
WCUSER_ColorPreviewProc(HWND hWnd
, UINT msg
, WPARAM wParam
, LPARAM lParam
)
268 BeginPaint(hWnd
, &ps
);
269 GetClientRect(hWnd
, &client
);
270 step
= client
.right
/ 8;
272 for (i
= 0; i
< 16; i
++)
274 r
.top
= (i
/ 8) * (client
.bottom
/ 2);
275 r
.bottom
= r
.top
+ client
.bottom
/ 2;
276 r
.left
= (i
& 7) * step
;
277 r
.right
= r
.left
+ step
;
278 hbr
= CreateSolidBrush(WCUSER_ColorMap
[i
]);
279 FillRect(ps
.hdc
, &r
, hbr
);
281 if (GetWindowLong(hWnd
, 0) == i
)
286 hOldPen
= SelectObject(ps
.hdc
, GetStockObject(WHITE_PEN
));
287 r
.right
--; r
.bottom
--;
290 MoveToEx(ps
.hdc
, r
.left
, r
.bottom
, NULL
);
291 LineTo(ps
.hdc
, r
.left
, r
.top
);
292 LineTo(ps
.hdc
, r
.right
, r
.top
);
293 SelectObject(ps
.hdc
, GetStockObject(BLACK_PEN
));
294 LineTo(ps
.hdc
, r
.right
, r
.bottom
);
295 LineTo(ps
.hdc
, r
.left
, r
.bottom
);
298 r
.left
++; r
.top
++; r
.right
--; r
.bottom
--;
299 SelectObject(ps
.hdc
, GetStockObject(WHITE_PEN
));
301 SelectObject(ps
.hdc
, hOldPen
);
312 GetClientRect(hWnd
, &client
);
313 step
= client
.right
/ 8;
314 i
= (HIWORD(lParam
) >= client
.bottom
/ 2) ? 8 : 0;
315 i
+= LOWORD(lParam
) / step
;
316 SetWindowLong(hWnd
, 0, i
);
317 InvalidateRect(GetDlgItem(GetParent(hWnd
), IDC_FNT_PREVIEW
), NULL
, FALSE
);
318 InvalidateRect(hWnd
, NULL
, FALSE
);
322 return DefWindowProc(hWnd
, msg
, wParam
, lParam
);
327 /******************************************************************
330 * enumerates all the font names with at least one valid font
332 static int CALLBACK
font_enum_size2(const LOGFONT
* lf
, const TEXTMETRIC
* tm
,
333 DWORD FontType
, LPARAM lParam
)
335 struct dialog_info
* di
= (struct dialog_info
*)lParam
;
337 if (WCUSER_ValidateFontMetric(di
->data
, tm
))
344 static int CALLBACK
font_enum(const LOGFONT
* lf
, const TEXTMETRIC
* tm
,
345 DWORD FontType
, LPARAM lParam
)
347 struct dialog_info
* di
= (struct dialog_info
*)lParam
;
350 if (WCUSER_ValidateFont(di
->data
, lf
) && (hdc
= GetDC(di
->hDlg
)))
353 EnumFontFamilies(hdc
, lf
->lfFaceName
, font_enum_size2
, (LPARAM
)di
);
357 idx
= SendDlgItemMessage(di
->hDlg
, IDC_FNT_LIST_FONT
, LB_ADDSTRING
,
358 0, (LPARAM
)lf
->lfFaceName
);
360 ReleaseDC(di
->hDlg
, hdc
);
365 /******************************************************************
370 static int CALLBACK
font_enum_size(const LOGFONT
* lf
, const TEXTMETRIC
* tm
,
371 DWORD FontType
, LPARAM lParam
)
373 struct dialog_info
* di
= (struct dialog_info
*)lParam
;
375 if (WCUSER_ValidateFontMetric(di
->data
, tm
))
378 static const WCHAR fmt
[] = {'%','l','d',0};
381 /* we want the string to be sorted with a numeric order, not a lexicographic...
382 * do the job by hand... get where to insert the new string
384 for (idx
= 0; idx
< di
->nFont
&& tm
->tmHeight
> di
->font
[idx
].tm
.tmHeight
; idx
++);
385 if (idx
< di
->nFont
&&
386 tm
->tmHeight
== di
->font
[idx
].tm
.tmHeight
&&
387 tm
->tmMaxCharWidth
== di
->font
[idx
].tm
.tmMaxCharWidth
)
389 /* we already have an entry with the same width & height...
390 * try to see which TEXTMETRIC (old or new) we should keep...
392 if (di
->font
[idx
].tm
.tmWeight
!= tm
->tmWeight
)
394 /* get the weight closer to 400, the default value */
395 if (abs(tm
->tmWeight
- 400) < abs(di
->font
[idx
].tm
.tmWeight
- 400))
397 di
->font
[idx
].tm
= *tm
;
400 /* else FIXME: skip the new tm for now */
404 /* here we need to add the new entry */
405 wsprintfW(buf
, fmt
, tm
->tmHeight
);
406 SendDlgItemMessage(di
->hDlg
, IDC_FNT_LIST_SIZE
, LB_INSERTSTRING
, idx
, (LPARAM
)buf
);
408 /* now grow our arrays and insert to values at the same index than in the list box */
409 di
->font
= HeapReAlloc(GetProcessHeap(), 0, di
->font
, sizeof(*di
->font
) * (di
->nFont
+ 1));
410 if (idx
!= di
->nFont
)
411 memmove(&di
->font
[idx
+ 1], &di
->font
[idx
], (di
->nFont
- idx
) * sizeof(*di
->font
));
412 di
->font
[idx
].tm
= *tm
;
413 di
->font
[idx
].lf
= *lf
;
420 /******************************************************************
425 static BOOL
select_font(struct dialog_info
* di
)
427 int idx
= SendDlgItemMessage(di
->hDlg
, IDC_FNT_LIST_SIZE
, LB_GETCURSEL
, 0L, 0L);
431 if (idx
< 0 || idx
>= di
->nFont
)
434 LoadString(GetModuleHandle(NULL
), IDS_FNT_DISPLAY
, fmt
, sizeof(fmt
) / sizeof(WCHAR
));
435 wsprintfW(buf
, fmt
, di
->font
[idx
].tm
.tmMaxCharWidth
, di
->font
[idx
].tm
.tmHeight
);
437 SendDlgItemMessage(di
->hDlg
, IDC_FNT_FONT_INFO
, WM_SETTEXT
, 0, (LPARAM
)buf
);
438 InvalidateRect(GetDlgItem(di
->hDlg
, IDC_FNT_PREVIEW
), NULL
, TRUE
);
439 UpdateWindow(GetDlgItem(di
->hDlg
, IDC_FNT_PREVIEW
));
443 /******************************************************************
446 * fills the size list box according to selected family in font LB
448 static BOOL
fill_list_size(struct dialog_info
* di
, BOOL doInit
)
452 WCHAR lfFaceName
[LF_FACESIZE
];
454 idx
= SendDlgItemMessage(di
->hDlg
, IDC_FNT_LIST_FONT
, LB_GETCURSEL
, 0L, 0L);
455 if (idx
< 0) return FALSE
;
457 hdc
= GetDC(di
->hDlg
);
458 if (!hdc
) return FALSE
;
460 SendDlgItemMessage(di
->hDlg
, IDC_FNT_LIST_FONT
, LB_GETTEXT
, idx
, (LPARAM
)lfFaceName
);
461 SendDlgItemMessage(di
->hDlg
, IDC_FNT_LIST_SIZE
, LB_RESETCONTENT
, 0L, 0L);
462 if (di
->font
) HeapFree(GetProcessHeap(), 0, di
->font
);
466 EnumFontFamilies(hdc
, lfFaceName
, font_enum_size
, (LPARAM
)di
);
467 ReleaseDC(di
->hDlg
, hdc
);
471 for (idx
= 0; idx
< di
->nFont
; idx
++)
473 if (WCUSER_AreFontsEqual(di
->config
, &di
->font
[idx
].lf
))
476 if (idx
== di
->nFont
) idx
= 0;
480 SendDlgItemMessage(di
->hDlg
, IDC_FNT_LIST_SIZE
, LB_SETCURSEL
, idx
, 0L);
485 /******************************************************************
490 static BOOL
fill_list_font(struct dialog_info
* di
)
494 hdc
= GetDC(di
->hDlg
);
495 if (!hdc
) return FALSE
;
497 SendDlgItemMessage(di
->hDlg
, IDC_FNT_LIST_FONT
, LB_RESETCONTENT
, 0L, 0L);
498 EnumFontFamilies(hdc
, NULL
, font_enum
, (LPARAM
)di
);
499 ReleaseDC(di
->hDlg
, hdc
);
500 if (SendDlgItemMessage(di
->hDlg
, IDC_FNT_LIST_FONT
, LB_SELECTSTRING
,
501 (WPARAM
)-1, (LPARAM
)di
->config
->face_name
) == LB_ERR
)
502 SendDlgItemMessage(di
->hDlg
, IDC_FNT_LIST_FONT
, LB_SETCURSEL
, 0L, 0L);
503 fill_list_size(di
, TRUE
);
507 /******************************************************************
510 * Dialog proc for the Font property sheet
512 static BOOL WINAPI
WCUSER_FontDlgProc(HWND hDlg
, UINT msg
, WPARAM wParam
, LPARAM lParam
)
514 struct dialog_info
* di
;
519 di
= (struct dialog_info
*)((PROPSHEETPAGEA
*)lParam
)->lParam
;
521 SetWindowLong(hDlg
, DWL_USER
, (DWORD
)di
);
523 SetWindowLong(GetDlgItem(hDlg
, IDC_FNT_COLOR_BK
), 0, di
->config
->def_attr
& 0x0F);
524 SetWindowLong(GetDlgItem(hDlg
, IDC_FNT_COLOR_FG
), 0, (di
->config
->def_attr
>> 4) & 0x0F);
527 di
= (struct dialog_info
*)GetWindowLong(hDlg
, DWL_USER
);
528 switch (LOWORD(wParam
))
530 case IDC_FNT_LIST_FONT
:
531 if (HIWORD(wParam
) == LBN_SELCHANGE
)
533 fill_list_size(di
, FALSE
);
536 case IDC_FNT_LIST_SIZE
:
537 if (HIWORD(wParam
) == LBN_SELCHANGE
)
546 NMHDR
* nmhdr
= (NMHDR
*)lParam
;
549 di
= (struct dialog_info
*)GetWindowLong(hDlg
, DWL_USER
);
556 val
= SendDlgItemMessage(hDlg
, IDC_FNT_LIST_SIZE
, LB_GETCURSEL
, 0L, 0L);
558 if (val
< di
->nFont
) (di
->apply
)(di
, hDlg
, WCUSER_ApplyToFont
, val
);
560 (di
->apply
)(di
, hDlg
, WCUSER_ApplyToAttribute
,
561 GetWindowLong(GetDlgItem(hDlg
, IDC_FNT_COLOR_BK
), 0) |
562 (GetWindowLong(GetDlgItem(hDlg
, IDC_FNT_COLOR_FG
), 0) << 4));
564 SetWindowLong(hDlg
, DWL_MSGRESULT
, PSNRET_NOERROR
);
577 /******************************************************************
578 * WCUSER_ConfigDlgProc
580 * Dialog proc for the config property sheet
582 static BOOL WINAPI
WCUSER_ConfigDlgProc(HWND hDlg
, UINT msg
, WPARAM wParam
, LPARAM lParam
)
584 struct dialog_info
* di
;
589 di
= (struct dialog_info
*)((PROPSHEETPAGEA
*)lParam
)->lParam
;
591 SetWindowLong(hDlg
, DWL_USER
, (DWORD
)di
);
592 SetDlgItemInt(hDlg
, IDC_CNF_SB_WIDTH
, di
->config
->sb_width
, FALSE
);
593 SetDlgItemInt(hDlg
, IDC_CNF_SB_HEIGHT
, di
->config
->sb_height
, FALSE
);
594 SetDlgItemInt(hDlg
, IDC_CNF_WIN_WIDTH
, di
->config
->win_width
, FALSE
);
595 SetDlgItemInt(hDlg
, IDC_CNF_WIN_HEIGHT
, di
->config
->win_height
, FALSE
);
598 di
= (struct dialog_info
*)GetWindowLong(hDlg
, DWL_USER
);
599 switch (LOWORD(wParam
))
605 NMHDR
* nmhdr
= (NMHDR
*)lParam
;
610 di
= (struct dialog_info
*)GetWindowLong(hDlg
, DWL_USER
);
617 sb
.X
= GetDlgItemInt(hDlg
, IDC_CNF_SB_WIDTH
, &st_w
, FALSE
);
618 sb
.Y
= GetDlgItemInt(hDlg
, IDC_CNF_SB_HEIGHT
, &st_h
, FALSE
);
619 if (st_w
&& st_h
&& (sb
.X
!= di
->config
->sb_width
|| sb
.Y
!= di
->config
->sb_height
))
621 (di
->apply
)(di
, hDlg
, WCUSER_ApplyToBufferSize
, (DWORD
)&sb
);
624 pos
.Right
= GetDlgItemInt(hDlg
, IDC_CNF_WIN_WIDTH
, &st_w
, FALSE
);
625 pos
.Bottom
= GetDlgItemInt(hDlg
, IDC_CNF_WIN_HEIGHT
, &st_h
, FALSE
);
627 (pos
.Right
!= di
->config
->win_width
|| pos
.Bottom
!= di
->config
->win_height
))
629 pos
.Left
= pos
.Top
= 0;
630 pos
.Right
--; pos
.Bottom
--;
631 (di
->apply
)(di
, hDlg
, WCUSER_ApplyToWindow
, (DWORD
)&pos
);
633 SetWindowLong(hDlg
, DWL_MSGRESULT
, PSNRET_NOERROR
);
646 /******************************************************************
647 * WCUSER_GetProperties
649 * Runs the dialog box to set up the winconsole options
651 BOOL
WCUSER_GetProperties(struct inner_data
* data
, BOOL current
)
653 HPROPSHEETPAGE psPage
[3];
655 PROPSHEETHEADERA psHead
;
657 static const WCHAR szFntPreview
[] = {'W','i','n','e','C','o','n','F','o','n','t','P','r','e','v','i','e','w',0};
658 static const WCHAR szColorPreview
[] = {'W','i','n','e','C','o','n','C','o','l','o','r','P','r','e','v','i','e','w',0};
659 struct dialog_info di
;
662 InitCommonControls();
667 di
.config
= &data
->curcfg
;
668 di
.apply
= WCUSER_ApplyCurrent
;
672 di
.config
= &data
->defcfg
;
673 di
.apply
= WCUSER_ApplyDefault
;
679 wndclass
.lpfnWndProc
= WCUSER_FontPreviewProc
;
680 wndclass
.cbClsExtra
= 0;
681 wndclass
.cbWndExtra
= 0;
682 wndclass
.hInstance
= GetModuleHandle(NULL
);
684 wndclass
.hCursor
= LoadCursor(0, IDC_ARROW
);
685 wndclass
.hbrBackground
= GetStockObject(BLACK_BRUSH
);
686 wndclass
.lpszMenuName
= NULL
;
687 wndclass
.lpszClassName
= szFntPreview
;
688 RegisterClass(&wndclass
);
691 wndclass
.lpfnWndProc
= WCUSER_ColorPreviewProc
;
692 wndclass
.cbClsExtra
= 0;
693 wndclass
.cbWndExtra
= sizeof(DWORD
);
694 wndclass
.hInstance
= GetModuleHandle(NULL
);
696 wndclass
.hCursor
= LoadCursor(0, IDC_ARROW
);
697 wndclass
.hbrBackground
= GetStockObject(BLACK_BRUSH
);
698 wndclass
.lpszMenuName
= NULL
;
699 wndclass
.lpszClassName
= szColorPreview
;
700 RegisterClass(&wndclass
);
702 memset(&psp
, 0, sizeof(psp
));
703 psp
.dwSize
= sizeof(psp
);
705 psp
.hInstance
= wndclass
.hInstance
;
706 psp
.lParam
= (LPARAM
)&di
;
708 psp
.u
.pszTemplate
= MAKEINTRESOURCEA(IDD_OPTION
);
709 psp
.pfnDlgProc
= WCUSER_OptionDlgProc
;
710 psPage
[0] = CreatePropertySheetPageA(&psp
);
712 psp
.u
.pszTemplate
= MAKEINTRESOURCEA(IDD_FONT
);
713 psp
.pfnDlgProc
= WCUSER_FontDlgProc
;
714 psPage
[1] = CreatePropertySheetPageA(&psp
);
716 psp
.u
.pszTemplate
= MAKEINTRESOURCEA(IDD_CONFIG
);
717 psp
.pfnDlgProc
= WCUSER_ConfigDlgProc
;
718 psPage
[2] = CreatePropertySheetPageA(&psp
);
720 memset(&psHead
, 0, sizeof(psHead
));
721 psHead
.dwSize
= sizeof(psHead
);
723 if (!LoadStringA(GetModuleHandle(NULL
),
724 (current
) ? IDS_DLG_TIT_CURRENT
: IDS_DLG_TIT_DEFAULT
,
726 strcpy(buff
, "Setup");
727 psHead
.pszCaption
= buff
;
729 psHead
.hwndParent
= PRIVATE(data
)->hWnd
;
730 psHead
.u3
.phpage
= psPage
;
732 PropertySheetA(&psHead
);