Fix a bug in the test for italic font style property.
[wine.git] / dlls / commdlg / fontdlg.c
blob1ffec8de557a90c017746fde88b73e3258f218b1
1 /*
2 * COMMDLG - Font Dialog
4 * Copyright 1994 Martin Ayotte
5 * Copyright 1996 Albrecht Kleine
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this library; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 #include <ctype.h>
23 #include <stdlib.h>
24 #include <stdarg.h>
25 #include <stdio.h>
26 #include <string.h>
27 #include "windef.h"
28 #include "winbase.h"
29 #include "winnls.h"
30 #include "wingdi.h"
31 #include "winuser.h"
32 #include "wine/winbase16.h"
33 #include "wine/winuser16.h"
34 #include "heap.h"
35 #include "commdlg.h"
36 #include "dlgs.h"
37 #include "wine/debug.h"
38 #include "cderr.h"
40 WINE_DEFAULT_DEBUG_CHANNEL(commdlg);
42 #include "cdlg.h"
43 #include "fontdlg.h"
45 static HBITMAP hBitmapTT = 0;
48 INT_PTR CALLBACK FormatCharDlgProcA(HWND hDlg, UINT uMsg, WPARAM wParam,
49 LPARAM lParam);
50 INT_PTR CALLBACK FormatCharDlgProcW(HWND hDlg, UINT uMsg, WPARAM wParam,
51 LPARAM lParam);
52 BOOL16 CALLBACK FormatCharDlgProc16(HWND16 hDlg, UINT16 message, WPARAM16 wParam,
53 LPARAM lParam);
55 /* There is a table here of all charsets, and the sample text for each.
56 * There is a second table that translates a charset into an index into
57 * the first table.
60 #define CI(cs) ((IDS_CHARSET_##cs)-IDS_CHARSET_ANSI)
61 #define SAMPLE_EXTLEN 10
63 static const WCHAR SAMPLE_LANG_TEXT[][SAMPLE_EXTLEN]={
64 {'Y','y','Z','z',0}, /* Western and default */
65 {0}, /* Symbol */
66 {0}, /* Shift JIS */
67 {0}, /* Hangul */
68 {0}, /* GB2312 */
69 {0}, /* BIG5 */
70 {0}, /* Greek */
71 {0}, /* Turkish */
72 {0x05e0, 0x05e1, 0x05e9, 0x05ea, 0}, /* Hebrew */
73 {0}, /* Arabic */
74 {0}, /* Baltic */
75 {0}, /* Vietnamese */
76 {0}, /* Russian */
77 {0}, /* East European */
78 {0}, /* Thai */
79 {0}, /* Johab */
80 {0}, /* Mac */
81 {0}, /* OEM */
82 {0}, /* VISCII */
83 {0}, /* TCVN */
84 {0}, /* KOI-8 */
85 {0}, /* ISO-8859-3 */
86 {0}, /* ISO-8859-4 */
87 {0}, /* ISO-8859-10 */
88 {0} /* Celtic */
91 static const int CHARSET_ORDER[256]={
92 CI(ANSI), 0, CI(SYMBOL), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
93 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
94 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
95 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
96 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, CI(MAC), 0, 0,
97 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
98 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
99 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
100 CI(JIS), CI(HANGUL), CI(JOHAB), 0, 0, 0, CI(GB2312), 0, CI(BIG5), 0, 0, 0, 0, 0, 0, 0,
101 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
102 0, CI(GREEK), CI(TURKISH), CI(VIETNAMESE), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
103 0, CI(HEBREW), CI(ARABIC), 0, 0, 0, 0, 0, 0, 0, CI(BALTIC), 0, 0, 0, 0, 0,
104 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, CI(RUSSIAN), 0, 0, 0,
105 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, CI(THAI), 0,
106 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, CI(EE), 0,
107 CI(VISCII), CI(TCVN), CI(KOI8), CI(ISO3), CI(ISO4), CI(ISO10), CI(CELTIC), 0, 0, 0, 0, 0, 0, 0, 0, CI(OEM),
110 struct {
111 int mask;
112 char *name;
113 } cfflags[] = {
114 #define XX(x) { x, #x },
115 XX(CF_SCREENFONTS)
116 XX(CF_PRINTERFONTS)
117 XX(CF_SHOWHELP)
118 XX(CF_ENABLEHOOK)
119 XX(CF_ENABLETEMPLATE)
120 XX(CF_ENABLETEMPLATEHANDLE)
121 XX(CF_INITTOLOGFONTSTRUCT)
122 XX(CF_USESTYLE)
123 XX(CF_EFFECTS)
124 XX(CF_APPLY)
125 XX(CF_ANSIONLY)
126 XX(CF_NOVECTORFONTS)
127 XX(CF_NOSIMULATIONS)
128 XX(CF_LIMITSIZE)
129 XX(CF_FIXEDPITCHONLY)
130 XX(CF_WYSIWYG)
131 XX(CF_FORCEFONTEXIST)
132 XX(CF_SCALABLEONLY)
133 XX(CF_TTONLY)
134 XX(CF_NOFACESEL)
135 XX(CF_NOSTYLESEL)
136 XX(CF_NOSIZESEL)
137 XX(CF_SELECTSCRIPT)
138 XX(CF_NOSCRIPTSEL)
139 XX(CF_NOVERTFONTS)
140 #undef XX
141 {0,NULL},
144 void _dump_cf_flags(DWORD cflags)
146 int i;
148 for (i=0;cfflags[i].name;i++)
149 if (cfflags[i].mask & cflags)
150 MESSAGE("%s|",cfflags[i].name);
151 MESSAGE("\n");
154 /***********************************************************************
155 * ChooseFontA (COMDLG32.@)
157 BOOL WINAPI ChooseFontA(LPCHOOSEFONTA lpChFont)
159 LPCVOID template;
160 HRSRC hResInfo;
161 HINSTANCE hDlginst;
162 HGLOBAL hDlgTmpl;
164 if ( (lpChFont->Flags&CF_ENABLETEMPLATEHANDLE)!=0 )
166 template=(LPCVOID)lpChFont->hInstance;
167 } else
169 if ( (lpChFont->Flags&CF_ENABLETEMPLATE)!=0 )
171 hDlginst=lpChFont->hInstance;
172 if( !(hResInfo = FindResourceA(hDlginst, lpChFont->lpTemplateName,
173 (LPSTR)RT_DIALOG)))
175 COMDLG32_SetCommDlgExtendedError(CDERR_FINDRESFAILURE);
176 return FALSE;
178 } else
180 hDlginst=COMDLG32_hInstance;
181 if (!(hResInfo = FindResourceA(hDlginst, "CHOOSE_FONT", (LPSTR)RT_DIALOG)))
183 COMDLG32_SetCommDlgExtendedError(CDERR_FINDRESFAILURE);
184 return FALSE;
187 if (!(hDlgTmpl = LoadResource(hDlginst, hResInfo )) ||
188 !(template = LockResource( hDlgTmpl )))
190 COMDLG32_SetCommDlgExtendedError(CDERR_LOADRESFAILURE);
191 return FALSE;
194 if (TRACE_ON(commdlg))
195 _dump_cf_flags(lpChFont->Flags);
197 if (lpChFont->Flags & (CF_SELECTSCRIPT | CF_NOVERTFONTS ))
198 FIXME(": unimplemented flag (ignored)\n");
200 return DialogBoxIndirectParamA(COMDLG32_hInstance, template,
201 lpChFont->hwndOwner, FormatCharDlgProcA, (LPARAM)lpChFont );
204 /***********************************************************************
205 * ChooseFontW (COMDLG32.@)
207 * NOTES:
209 * The LOGFONT conversion functions will break if the structure ever
210 * grows beyond the lfFaceName element.
212 * The CHOOSEFONT conversion functions assume that both versions of
213 * lpLogFont and lpszStyle (if used) point to pre-allocated objects.
215 * The ASCII version of lpTemplateName is created by ChooseFontAtoW
216 * and freed by ChooseFontWtoA.
218 inline static VOID LogFontWtoA(const LOGFONTW *lfw, LOGFONTA *lfa)
220 memcpy(lfa, lfw, sizeof(LOGFONTA));
221 WideCharToMultiByte(CP_ACP, 0, lfw->lfFaceName, -1, lfa->lfFaceName,
222 LF_FACESIZE, NULL, NULL);
223 lfa->lfFaceName[LF_FACESIZE - 1] = '\0';
226 inline static VOID LogFontAtoW(const LOGFONTA *lfa, LOGFONTW *lfw)
228 memcpy(lfw, lfa, sizeof(LOGFONTA));
229 MultiByteToWideChar(CP_ACP, 0, lfa->lfFaceName, -1, lfw->lfFaceName,
230 LF_FACESIZE);
231 lfw->lfFaceName[LF_FACESIZE - 1] = 0;
234 static BOOL ChooseFontWtoA(const CHOOSEFONTW *cfw, CHOOSEFONTA *cfa)
236 LOGFONTA *lpLogFont = cfa->lpLogFont;
237 LPSTR lpszStyle = cfa->lpszStyle;
239 memcpy(cfa, cfw, sizeof(CHOOSEFONTA));
240 cfa->lpLogFont = lpLogFont;
241 cfa->lpszStyle = lpszStyle;
243 LogFontWtoA(cfw->lpLogFont, lpLogFont);
245 if ((cfw->Flags&CF_ENABLETEMPLATE)!=0 && HIWORD(cfw->lpTemplateName)!=0)
247 cfa->lpTemplateName = HEAP_strdupWtoA(GetProcessHeap(), 0,
248 cfw->lpTemplateName);
249 if (cfa->lpTemplateName == NULL)
250 return FALSE;
253 if ((cfw->Flags & CF_USESTYLE) != 0 && cfw->lpszStyle != NULL)
255 WideCharToMultiByte(CP_ACP, 0, cfw->lpszStyle, -1, cfa->lpszStyle,
256 LF_FACESIZE, NULL, NULL);
257 cfa->lpszStyle[LF_FACESIZE - 1] = '\0';
260 return TRUE;
263 static VOID ChooseFontAtoW(const CHOOSEFONTA *cfa, CHOOSEFONTW *cfw)
265 LOGFONTW *lpLogFont = cfw->lpLogFont;
266 LPWSTR lpszStyle = cfw->lpszStyle;
267 LPCWSTR lpTemplateName = cfw->lpTemplateName;
269 memcpy(cfw, cfa, sizeof(CHOOSEFONTA));
270 cfw->lpLogFont = lpLogFont;
271 cfw->lpszStyle = lpszStyle;
272 cfw->lpTemplateName = lpTemplateName;
274 LogFontAtoW(cfa->lpLogFont, lpLogFont);
276 if ((cfa->Flags&CF_ENABLETEMPLATE)!=0 && HIWORD(cfa->lpTemplateName) != 0)
277 HeapFree(GetProcessHeap(), 0, (LPSTR)(cfa->lpTemplateName));
279 if ((cfa->Flags & CF_USESTYLE) != 0 && cfa->lpszStyle != NULL)
281 MultiByteToWideChar(CP_ACP, 0, cfa->lpszStyle, -1, cfw->lpszStyle,
282 LF_FACESIZE);
283 cfw->lpszStyle[LF_FACESIZE - 1] = 0;
287 BOOL WINAPI ChooseFontW(LPCHOOSEFONTW lpChFont)
289 CHOOSEFONTA cf_a;
290 LOGFONTA lf_a;
291 CHAR style_a[LF_FACESIZE];
293 cf_a.lpLogFont = &lf_a;
294 cf_a.lpszStyle = style_a;
296 if (ChooseFontWtoA(lpChFont, &cf_a) == FALSE)
298 COMDLG32_SetCommDlgExtendedError(CDERR_MEMALLOCFAILURE);
299 return FALSE;
302 if (ChooseFontA(&cf_a) == FALSE)
304 if (cf_a.lpTemplateName != NULL)
305 HeapFree(GetProcessHeap(), 0, (LPSTR)(cf_a.lpTemplateName));
306 return FALSE;
309 ChooseFontAtoW(&cf_a, lpChFont);
311 return TRUE;
314 #if 0
315 /***********************************************************************
316 * ChooseFontW (COMDLG32.@)
318 BOOL WINAPI ChooseFontW(LPCHOOSEFONTW lpChFont)
320 BOOL bRet=FALSE;
321 CHOOSEFONTA cf32a;
322 LOGFONTA lf32a;
323 LPCVOID template;
324 HANDLE hResInfo, hDlgTmpl;
326 if (TRACE_ON(commdlg))
327 _dump_cf_flags(lpChFont->Flags);
329 if (!(hResInfo = FindResourceA(COMDLG32_hInstance, "CHOOSE_FONT", (LPSTR)RT_DIALOG)))
331 COMDLG32_SetCommDlgExtendedError(CDERR_FINDRESFAILURE);
332 return FALSE;
334 if (!(hDlgTmpl = LoadResource(COMDLG32_hInstance, hResInfo )) ||
335 !(template = LockResource( hDlgTmpl )))
337 COMDLG32_SetCommDlgExtendedError(CDERR_LOADRESFAILURE);
338 return FALSE;
341 if (lpChFont->Flags & (CF_SELECTSCRIPT | CF_NOVERTFONTS | CF_ENABLETEMPLATE |
342 CF_ENABLETEMPLATEHANDLE)) FIXME(": unimplemented flag (ignored)\n");
343 memcpy(&cf32a, lpChFont, sizeof(cf32a));
344 memcpy(&lf32a, lpChFont->lpLogFont, sizeof(LOGFONTA));
346 WideCharToMultiByte( CP_ACP, 0, lpChFont->lpLogFont->lfFaceName, -1,
347 lf32a.lfFaceName, LF_FACESIZE, NULL, NULL );
348 lf32a.lfFaceName[LF_FACESIZE-1] = 0;
349 cf32a.lpLogFont=&lf32a;
350 cf32a.lpszStyle=HEAP_strdupWtoA(GetProcessHeap(), 0, lpChFont->lpszStyle);
351 lpChFont->lpTemplateName=(LPWSTR)&cf32a;
352 bRet = DialogBoxIndirectParamW(COMDLG32_hInstance, template,
353 lpChFont->hwndOwner, FormatCharDlgProcW, (LPARAM)lpChFont );
354 HeapFree(GetProcessHeap(), 0, cf32a.lpszStyle);
355 lpChFont->lpTemplateName=(LPWSTR)cf32a.lpTemplateName;
356 memcpy(lpChFont->lpLogFont, &lf32a, sizeof(CHOOSEFONTA));
357 MultiByteToWideChar( CP_ACP, 0, lf32a.lfFaceName, -1,
358 lpChFont->lpLogFont->lfFaceName, LF_FACESIZE );
359 lpChFont->lpLogFont->lfFaceName[LF_FACESIZE-1] = 0;
360 return bRet;
362 #endif
364 #define TEXT_EXTRAS 4
365 #define TEXT_COLORS 16
367 static const COLORREF textcolors[TEXT_COLORS]=
369 0x00000000L,0x00000080L,0x00008000L,0x00008080L,
370 0x00800000L,0x00800080L,0x00808000L,0x00808080L,
371 0x00c0c0c0L,0x000000ffL,0x0000ff00L,0x0000ffffL,
372 0x00ff0000L,0x00ff00ffL,0x00ffff00L,0x00FFFFFFL
375 /***********************************************************************
376 * CFn_HookCallChk32 [internal]
378 static BOOL CFn_HookCallChk32(LPCHOOSEFONTA lpcf)
380 if (lpcf)
381 if(lpcf->Flags & CF_ENABLEHOOK)
382 if (lpcf->lpfnHook)
383 return TRUE;
384 return FALSE;
387 /*************************************************************************
388 * AddFontFamily [internal]
390 INT AddFontFamily(const LOGFONTA *lplf, UINT nFontType,
391 LPCHOOSEFONTA lpcf, HWND hwnd, LPCFn_ENUMSTRUCT e)
393 int i;
394 WORD w;
396 TRACE("font=%s (nFontType=%d)\n", lplf->lfFaceName,nFontType);
398 if (lpcf->Flags & CF_FIXEDPITCHONLY)
399 if (!(lplf->lfPitchAndFamily & FIXED_PITCH))
400 return 1;
401 if (lpcf->Flags & CF_ANSIONLY)
402 if (lplf->lfCharSet != ANSI_CHARSET)
403 return 1;
404 if (lpcf->Flags & CF_TTONLY)
405 if (!(nFontType & TRUETYPE_FONTTYPE))
406 return 1;
408 if (e) e->added++;
410 i=SendMessageA(hwnd, CB_ADDSTRING, 0, (LPARAM)lplf->lfFaceName);
411 if (i!=CB_ERR)
413 w=(lplf->lfCharSet << 8) | lplf->lfPitchAndFamily;
414 SendMessageA(hwnd, CB_SETITEMDATA, i, MAKELONG(nFontType,w));
415 return 1 ; /* store some important font information */
417 else
418 return 0;
421 /*************************************************************************
422 * FontFamilyEnumProc32 [internal]
424 static INT WINAPI FontFamilyEnumProc(const LOGFONTA *lpLogFont,
425 const TEXTMETRICA *metrics, DWORD dwFontType, LPARAM lParam)
427 LPCFn_ENUMSTRUCT e;
428 e=(LPCFn_ENUMSTRUCT)lParam;
429 return AddFontFamily(lpLogFont, dwFontType, e->lpcf32a, e->hWnd1, e);
432 /*************************************************************************
433 * SetFontStylesToCombo2 [internal]
435 * Fill font style information into combobox (without using font.c directly)
437 static int SetFontStylesToCombo2(HWND hwnd, HDC hdc, const LOGFONTA *lplf)
439 #define FSTYLES 4
440 struct FONTSTYLE
442 int italic;
443 int weight;
444 char stname[20];
446 static struct FONTSTYLE fontstyles[FSTYLES]={
447 { 0,FW_NORMAL,"Regular"}, { 1,FW_NORMAL,"Italic"},
448 { 0,FW_BOLD,"Bold"}, { 1,FW_BOLD,"Bold Italic"}
450 HFONT hf;
451 TEXTMETRICA tm;
452 int i,j;
453 LOGFONTA lf;
455 memcpy(&lf, lplf, sizeof(LOGFONTA));
457 for (i=0;i<FSTYLES;i++)
459 lf.lfItalic=fontstyles[i].italic;
460 lf.lfWeight=fontstyles[i].weight;
461 hf=CreateFontIndirectA(&lf);
462 hf=SelectObject(hdc,hf);
463 GetTextMetricsA(hdc,&tm);
464 hf=SelectObject(hdc,hf);
465 DeleteObject(hf);
466 /* font successful created ? */
467 if (tm.tmWeight==fontstyles[i].weight &&
468 ((tm.tmItalic != 0)==fontstyles[i].italic))
470 j=SendMessageA(hwnd,CB_ADDSTRING,0,(LPARAM)fontstyles[i].stname );
471 if (j==CB_ERR) return 1;
472 j=SendMessageA(hwnd, CB_SETITEMDATA, j,
473 MAKELONG(fontstyles[i].weight,fontstyles[i].italic));
474 if (j==CB_ERR) return 1;
477 return 0;
480 /*************************************************************************
481 * AddFontSizeToCombo3 [internal]
483 static int AddFontSizeToCombo3(HWND hwnd, UINT h, LPCHOOSEFONTA lpcf)
485 int j;
486 char buffer[20];
488 if ( (!(lpcf->Flags & CF_LIMITSIZE)) ||
489 ((lpcf->Flags & CF_LIMITSIZE) && (h >= lpcf->nSizeMin) && (h <= lpcf->nSizeMax)))
491 sprintf(buffer, "%2d", h);
492 j=SendMessageA(hwnd, CB_FINDSTRINGEXACT, -1, (LPARAM)buffer);
493 if (j==CB_ERR)
495 j=SendMessageA(hwnd, CB_ADDSTRING, 0, (LPARAM)buffer);
496 if (j!=CB_ERR) j = SendMessageA(hwnd, CB_SETITEMDATA, j, h);
497 if (j==CB_ERR) return 1;
500 return 0;
503 /*************************************************************************
504 * SetFontSizesToCombo3 [internal]
506 static int SetFontSizesToCombo3(HWND hwnd, LPCHOOSEFONTA lpcf)
508 static const int sizes[]={8,9,10,11,12,14,16,18,20,22,24,26,28,36,48,72,0};
509 int i;
511 for (i=0; sizes[i]; i++)
512 if (AddFontSizeToCombo3(hwnd, sizes[i], lpcf)) return 1;
513 return 0;
516 /***********************************************************************
517 * AddFontStyle [internal]
519 INT AddFontStyle(const LOGFONTA *lplf, UINT nFontType,
520 LPCHOOSEFONTA lpcf, HWND hcmb2, HWND hcmb3, HWND hDlg)
522 int i;
524 TRACE("(nFontType=%d)\n",nFontType);
525 TRACE(" %s h=%ld w=%ld e=%ld o=%ld wg=%ld i=%d u=%d s=%d"
526 " ch=%d op=%d cp=%d q=%d pf=%xh\n",
527 lplf->lfFaceName,lplf->lfHeight,lplf->lfWidth,
528 lplf->lfEscapement,lplf->lfOrientation,
529 lplf->lfWeight,lplf->lfItalic,lplf->lfUnderline,
530 lplf->lfStrikeOut,lplf->lfCharSet, lplf->lfOutPrecision,
531 lplf->lfClipPrecision,lplf->lfQuality, lplf->lfPitchAndFamily);
532 if (nFontType & RASTER_FONTTYPE)
534 if (AddFontSizeToCombo3(hcmb3, lplf->lfHeight, lpcf)) return 0;
535 } else if (SetFontSizesToCombo3(hcmb3, lpcf)) return 0;
537 if (!SendMessageA(hcmb2, CB_GETCOUNT, 0, 0))
539 HDC hdc= ((lpcf->Flags & CF_PRINTERFONTS) && lpcf->hDC) ? lpcf->hDC : GetDC(hDlg);
540 i=SetFontStylesToCombo2(hcmb2,hdc,lplf);
541 if (!((lpcf->Flags & CF_PRINTERFONTS) && lpcf->hDC))
542 ReleaseDC(hDlg,hdc);
543 if (i)
544 return 0;
546 return 1 ;
550 /***********************************************************************
551 * FontStyleEnumProc32 [internal]
553 static INT WINAPI FontStyleEnumProc( const LOGFONTA *lpFont,
554 const TEXTMETRICA *metrics, DWORD dwFontType, LPARAM lParam )
556 LPCFn_ENUMSTRUCT s=(LPCFn_ENUMSTRUCT)lParam;
557 HWND hcmb2=s->hWnd1;
558 HWND hcmb3=s->hWnd2;
559 HWND hDlg=GetParent(hcmb3);
560 return AddFontStyle(lpFont, dwFontType, s->lpcf32a, hcmb2,
561 hcmb3, hDlg);
564 /***********************************************************************
565 * CFn_WMInitDialog [internal]
567 LRESULT CFn_WMInitDialog(HWND hDlg, WPARAM wParam, LPARAM lParam,
568 LPCHOOSEFONTA lpcf)
570 HDC hdc;
571 int i,j,init=0;
572 long l;
573 LPLOGFONTA lpxx;
574 HCURSOR hcursor=SetCursor(LoadCursorA(0,(LPSTR)IDC_WAIT));
576 SetWindowLongA(hDlg, DWL_USER, lParam);
577 lpxx=lpcf->lpLogFont;
578 TRACE("WM_INITDIALOG lParam=%08lX\n", lParam);
580 if (lpcf->lStructSize != sizeof(CHOOSEFONTA))
582 ERR("structure size failure !!!\n");
583 EndDialog (hDlg, 0);
584 return FALSE;
586 if (!hBitmapTT)
587 hBitmapTT = LoadBitmapA(0, MAKEINTRESOURCEA(OBM_TRTYPE));
589 if (!(lpcf->Flags & CF_SHOWHELP) || !IsWindow(lpcf->hwndOwner))
590 ShowWindow(GetDlgItem(hDlg,pshHelp),SW_HIDE);
591 if (!(lpcf->Flags & CF_APPLY))
592 ShowWindow(GetDlgItem(hDlg,psh3),SW_HIDE);
593 if (lpcf->Flags & CF_EFFECTS)
595 for (i=0;i<TEXT_COLORS;i++)
597 char name[30];
599 if( LoadStringA(COMDLG32_hInstance, IDS_COLOR_BLACK+i, name,
600 sizeof(name)/sizeof(*name) )==0 )
602 strcpy( name, "[color name]" );
604 j=SendDlgItemMessageA(hDlg, cmb4, CB_ADDSTRING, 0, (LPARAM)name);
605 SendDlgItemMessageA(hDlg, cmb4, CB_SETITEMDATA16, j, textcolors[j]);
606 /* look for a fitting value in color combobox */
607 if (textcolors[j]==lpcf->rgbColors)
608 SendDlgItemMessageA(hDlg,cmb4, CB_SETCURSEL,j,0);
611 else
613 ShowWindow(GetDlgItem(hDlg,cmb4),SW_HIDE);
614 ShowWindow(GetDlgItem(hDlg,chx1),SW_HIDE);
615 ShowWindow(GetDlgItem(hDlg,chx2),SW_HIDE);
616 ShowWindow(GetDlgItem(hDlg,grp1),SW_HIDE);
617 ShowWindow(GetDlgItem(hDlg,stc4),SW_HIDE);
619 hdc= ((lpcf->Flags & CF_PRINTERFONTS) && lpcf->hDC) ? lpcf->hDC : GetDC(hDlg);
620 if (hdc)
622 CFn_ENUMSTRUCT s;
623 s.hWnd1=GetDlgItem(hDlg,cmb1);
624 s.lpcf32a=lpcf;
625 do {
626 s.added = 0;
627 if (!EnumFontFamiliesA(hdc, NULL, FontFamilyEnumProc, (LPARAM)&s)) {
628 TRACE("EnumFontFamilies returns 0\n");
629 break;
631 if (s.added) break;
632 if (lpcf->Flags & CF_FIXEDPITCHONLY) {
633 FIXME("No font found with fixed pitch only, dropping flag.\n");
634 lpcf->Flags &= ~CF_FIXEDPITCHONLY;
635 continue;
637 if (lpcf->Flags & CF_TTONLY) {
638 FIXME("No font found with truetype only, dropping flag.\n");
639 lpcf->Flags &= ~CF_TTONLY;
640 continue;
642 break;
643 } while (1);
646 if (lpcf->Flags & CF_INITTOLOGFONTSTRUCT)
648 /* look for fitting font name in combobox1 */
649 j=SendDlgItemMessageA(hDlg,cmb1,CB_FINDSTRING,-1,(LONG)lpxx->lfFaceName);
650 if (j!=CB_ERR)
652 SendDlgItemMessageA(hDlg, cmb1, CB_SETCURSEL, j, 0);
653 SendMessageA(hDlg, WM_COMMAND, MAKEWPARAM(cmb1, CBN_SELCHANGE),
654 (LPARAM)GetDlgItem(hDlg,cmb1));
655 init=1;
656 /* look for fitting font style in combobox2 */
657 l=MAKELONG(lpxx->lfWeight > FW_MEDIUM ? FW_BOLD:FW_NORMAL,lpxx->lfItalic !=0);
658 for (i=0;i<TEXT_EXTRAS;i++)
660 if (l==SendDlgItemMessageA(hDlg, cmb2, CB_GETITEMDATA, i, 0))
661 SendDlgItemMessageA(hDlg, cmb2, CB_SETCURSEL, i, 0);
664 /* look for fitting font size in combobox3 */
665 j=SendDlgItemMessageA(hDlg, cmb3, CB_GETCOUNT, 0, 0);
666 for (i=0;i<j;i++)
668 if (lpxx->lfHeight==(int)SendDlgItemMessageA(hDlg,cmb3, CB_GETITEMDATA,i,0))
669 SendDlgItemMessageA(hDlg,cmb3,CB_SETCURSEL,i,0);
673 if (!init)
675 SendDlgItemMessageA(hDlg,cmb1,CB_SETCURSEL,0,0);
676 SendMessageA(hDlg, WM_COMMAND, MAKEWPARAM(cmb1, CBN_SELCHANGE),
677 (LPARAM)GetDlgItem(hDlg,cmb1));
679 if (lpcf->Flags & CF_USESTYLE && lpcf->lpszStyle)
681 j=SendDlgItemMessageA(hDlg,cmb2,CB_FINDSTRING,-1,(LONG)lpcf->lpszStyle);
682 if (j!=CB_ERR)
684 j=SendDlgItemMessageA(hDlg,cmb2,CB_SETCURSEL,j,0);
685 SendMessageA(hDlg,WM_COMMAND,cmb2,
686 MAKELONG(HWND_16(GetDlgItem(hDlg,cmb2)),CBN_SELCHANGE));
690 else
692 WARN("HDC failure !!!\n");
693 EndDialog (hDlg, 0);
694 return FALSE;
697 if (!((lpcf->Flags & CF_PRINTERFONTS) && lpcf->hDC))
698 ReleaseDC(hDlg,hdc);
699 SetCursor(hcursor);
700 return TRUE;
704 /***********************************************************************
705 * CFn_WMMeasureItem [internal]
707 LRESULT CFn_WMMeasureItem(HWND hDlg, WPARAM wParam, LPARAM lParam)
709 BITMAP bm;
710 LPMEASUREITEMSTRUCT lpmi=(LPMEASUREITEMSTRUCT)lParam;
711 if (!hBitmapTT)
712 hBitmapTT = LoadBitmapA(0, MAKEINTRESOURCEA(OBM_TRTYPE));
713 GetObjectA( hBitmapTT, sizeof(bm), &bm );
714 lpmi->itemHeight=bm.bmHeight;
715 /* FIXME: use MAX of bm.bmHeight and tm.tmHeight .*/
716 return 0;
720 /***********************************************************************
721 * CFn_WMDrawItem [internal]
723 LRESULT CFn_WMDrawItem(HWND hDlg, WPARAM wParam, LPARAM lParam)
725 HBRUSH hBrush;
726 char buffer[40];
727 BITMAP bm;
728 COLORREF cr, oldText=0, oldBk=0;
729 RECT rect;
730 #if 0
731 HDC hMemDC;
732 int nFontType;
733 HBITMAP hBitmap; /* for later TT usage */
734 #endif
735 LPDRAWITEMSTRUCT lpdi = (LPDRAWITEMSTRUCT)lParam;
737 if (lpdi->itemID == (UINT)-1) /* got no items */
738 DrawFocusRect(lpdi->hDC, &lpdi->rcItem);
739 else
741 if (lpdi->CtlType == ODT_COMBOBOX)
743 if (lpdi->itemState ==ODS_SELECTED)
745 hBrush=GetSysColorBrush(COLOR_HIGHLIGHT);
746 oldText=SetTextColor(lpdi->hDC, GetSysColor(COLOR_HIGHLIGHTTEXT));
747 oldBk=SetBkColor(lpdi->hDC, GetSysColor(COLOR_HIGHLIGHT));
748 } else
750 hBrush = SelectObject(lpdi->hDC, GetStockObject(LTGRAY_BRUSH));
751 SelectObject(lpdi->hDC, hBrush);
753 FillRect(lpdi->hDC, &lpdi->rcItem, hBrush);
755 else
756 return TRUE; /* this should never happen */
758 rect=lpdi->rcItem;
759 switch (lpdi->CtlID)
761 case cmb1:
762 /* TRACE(commdlg,"WM_Drawitem cmb1\n"); */
763 SendMessageA(lpdi->hwndItem, CB_GETLBTEXT, lpdi->itemID,
764 (LPARAM)buffer);
765 GetObjectA( hBitmapTT, sizeof(bm), &bm );
766 TextOutA(lpdi->hDC, lpdi->rcItem.left + bm.bmWidth + 10,
767 lpdi->rcItem.top, buffer, strlen(buffer));
768 #if 0
769 nFontType = SendMessageA(lpdi->hwndItem, CB_GETITEMDATA, lpdi->itemID,0L);
770 /* FIXME: draw bitmap if truetype usage */
771 if (nFontType&TRUETYPE_FONTTYPE)
773 hMemDC = CreateCompatibleDC(lpdi->hDC);
774 hBitmap = SelectObject(hMemDC, hBitmapTT);
775 BitBlt(lpdi->hDC, lpdi->rcItem.left, lpdi->rcItem.top,
776 bm.bmWidth, bm.bmHeight, hMemDC, 0, 0, SRCCOPY);
777 SelectObject(hMemDC, hBitmap);
778 DeleteDC(hMemDC);
780 #endif
781 break;
782 case cmb2:
783 case cmb3:
784 /* TRACE(commdlg,"WM_DRAWITEN cmb2,cmb3\n"); */
785 SendMessageA(lpdi->hwndItem, CB_GETLBTEXT, lpdi->itemID,
786 (LPARAM)buffer);
787 TextOutA(lpdi->hDC, lpdi->rcItem.left,
788 lpdi->rcItem.top, buffer, strlen(buffer));
789 break;
791 case cmb4:
792 /* TRACE(commdlg,"WM_DRAWITEM cmb4 (=COLOR)\n"); */
793 SendMessageA(lpdi->hwndItem, CB_GETLBTEXT, lpdi->itemID,
794 (LPARAM)buffer);
795 TextOutA(lpdi->hDC, lpdi->rcItem.left + 25+5,
796 lpdi->rcItem.top, buffer, strlen(buffer));
797 cr = SendMessageA(lpdi->hwndItem, CB_GETITEMDATA, lpdi->itemID,0L);
798 hBrush = CreateSolidBrush(cr);
799 if (hBrush)
801 hBrush = SelectObject (lpdi->hDC, hBrush) ;
802 rect.right=rect.left+25;
803 rect.top++;
804 rect.left+=5;
805 rect.bottom--;
806 Rectangle( lpdi->hDC, rect.left, rect.top,
807 rect.right, rect.bottom );
808 DeleteObject( SelectObject (lpdi->hDC, hBrush)) ;
810 rect=lpdi->rcItem;
811 rect.left+=25+5;
812 break;
814 default:
815 return TRUE; /* this should never happen */
817 if (lpdi->itemState == ODS_SELECTED)
819 SetTextColor(lpdi->hDC, oldText);
820 SetBkColor(lpdi->hDC, oldBk);
823 return TRUE;
826 /***********************************************************************
827 * CFn_WMCommand [internal]
829 LRESULT CFn_WMCommand(HWND hDlg, WPARAM wParam, LPARAM lParam,
830 LPCHOOSEFONTA lpcf)
832 int i,j;
833 long l;
834 HDC hdc;
835 LPLOGFONTA lpxx=lpcf->lpLogFont;
837 TRACE("WM_COMMAND wParam=%08lX lParam=%08lX\n", (LONG)wParam, lParam);
838 switch (LOWORD(wParam))
840 case cmb1:
841 if (HIWORD(wParam)==CBN_SELCHANGE)
843 hdc=((lpcf->Flags & CF_PRINTERFONTS) && lpcf->hDC) ? lpcf->hDC : GetDC(hDlg);
844 if (hdc)
846 SendDlgItemMessageA(hDlg, cmb2, CB_RESETCONTENT16, 0, 0);
847 SendDlgItemMessageA(hDlg, cmb3, CB_RESETCONTENT16, 0, 0);
848 i=SendDlgItemMessageA(hDlg, cmb1, CB_GETCURSEL16, 0, 0);
849 if (i!=CB_ERR)
851 HCURSOR hcursor=SetCursor(LoadCursorA(0,(LPSTR)IDC_WAIT));
852 CFn_ENUMSTRUCT s;
853 char str[256];
854 SendDlgItemMessageA(hDlg, cmb1, CB_GETLBTEXT, i,
855 (LPARAM)str);
856 TRACE("WM_COMMAND/cmb1 =>%s\n",str);
857 s.hWnd1=GetDlgItem(hDlg, cmb2);
858 s.hWnd2=GetDlgItem(hDlg, cmb3);
859 s.lpcf32a=lpcf;
860 EnumFontFamiliesA(hdc, str, FontStyleEnumProc, (LPARAM)&s);
861 SendDlgItemMessageA(hDlg,cmb2, CB_SETCURSEL, 0, 0);
862 SendDlgItemMessageA(hDlg,cmb3, CB_SETCURSEL, 0, 0);
863 SetCursor(hcursor);
865 if (!((lpcf->Flags & CF_PRINTERFONTS) && lpcf->hDC))
866 ReleaseDC(hDlg,hdc);
868 else
870 WARN("HDC failure !!!\n");
871 EndDialog (hDlg, 0);
872 return TRUE;
875 case chx1:
876 case chx2:
877 case cmb2:
878 case cmb3:
879 if (HIWORD(wParam)==CBN_SELCHANGE || HIWORD(wParam)== BN_CLICKED )
881 char str[256];
882 WINDOWINFO wininfo;
884 TRACE("WM_COMMAND/cmb2,3 =%08lX\n", lParam);
885 i=SendDlgItemMessageA(hDlg,cmb1,CB_GETCURSEL,0,0);
886 if (i==CB_ERR)
887 i=GetDlgItemTextA( hDlg, cmb1, str, 256 );
888 else
890 SendDlgItemMessageA(hDlg,cmb1,CB_GETLBTEXT,i,
891 (LPARAM)str);
892 l=SendDlgItemMessageA(hDlg,cmb1,CB_GETITEMDATA,i,0);
893 j=HIWORD(l);
894 lpcf->nFontType = LOWORD(l);
895 /* FIXME: lpcf->nFontType |= .... SIMULATED_FONTTYPE and so */
896 /* same value reported to the EnumFonts
897 call back with the extra FONTTYPE_... bits added */
898 lpxx->lfPitchAndFamily=j&0xff;
899 lpxx->lfCharSet=j>>8;
901 strcpy(lpxx->lfFaceName,str);
902 i=SendDlgItemMessageA(hDlg, cmb2, CB_GETCURSEL, 0, 0);
903 if (i!=CB_ERR)
905 l=SendDlgItemMessageA(hDlg, cmb2, CB_GETITEMDATA, i, 0);
906 if (0!=(lpxx->lfItalic=HIWORD(l)))
907 lpcf->nFontType |= ITALIC_FONTTYPE;
908 if ((lpxx->lfWeight=LOWORD(l)) > FW_MEDIUM)
909 lpcf->nFontType |= BOLD_FONTTYPE;
911 i=SendDlgItemMessageA(hDlg, cmb3, CB_GETCURSEL, 0, 0);
912 if (i!=CB_ERR)
913 lpxx->lfHeight=-LOWORD(SendDlgItemMessageA(hDlg, cmb3, CB_GETITEMDATA, i, 0));
914 else
915 lpxx->lfHeight=0;
916 lpxx->lfStrikeOut=IsDlgButtonChecked(hDlg,chx1);
917 lpxx->lfUnderline=IsDlgButtonChecked(hDlg,chx2);
918 lpxx->lfWidth=lpxx->lfOrientation=lpxx->lfEscapement=0;
919 lpxx->lfOutPrecision=OUT_DEFAULT_PRECIS;
920 lpxx->lfClipPrecision=CLIP_DEFAULT_PRECIS;
921 lpxx->lfQuality=DEFAULT_QUALITY;
922 lpcf->iPointSize= -10*lpxx->lfHeight;
924 wininfo.cbSize=sizeof(wininfo);
926 if( GetWindowInfo( GetDlgItem( hDlg, stc5), &wininfo ) )
928 MapWindowPoints( 0, hDlg, (LPPOINT) &wininfo.rcWindow, 2);
929 InvalidateRect( hDlg, &wininfo.rcWindow, TRUE );
932 break;
934 case cmb4:
935 i=SendDlgItemMessageA(hDlg, cmb4, CB_GETCURSEL, 0, 0);
936 if (i!=CB_ERR)
938 WINDOWINFO wininfo;
940 lpcf->rgbColors=textcolors[i];
941 wininfo.cbSize=sizeof(wininfo);
943 if( GetWindowInfo( GetDlgItem( hDlg, stc5), &wininfo ) )
945 MapWindowPoints( 0, hDlg, (LPPOINT) &wininfo.rcWindow, 2);
946 InvalidateRect( hDlg, &wininfo.rcWindow, TRUE );
949 break;
951 case psh15:
952 i=RegisterWindowMessageA( HELPMSGSTRINGA );
953 if (lpcf->hwndOwner)
954 SendMessageA(lpcf->hwndOwner, i, 0, (LPARAM)GetWindowLongA(hDlg, DWL_USER));
955 /* if (CFn_HookCallChk(lpcf))
956 CallWindowProc16(lpcf->lpfnHook,hDlg,WM_COMMAND,psh15,(LPARAM)lpcf);*/
957 break;
959 case IDOK:
960 if ( (!(lpcf->Flags & CF_LIMITSIZE)) ||
961 ( (lpcf->Flags & CF_LIMITSIZE) &&
962 (-lpxx->lfHeight >= lpcf->nSizeMin) &&
963 (-lpxx->lfHeight <= lpcf->nSizeMax)))
964 EndDialog(hDlg, TRUE);
965 else
967 char buffer[80];
968 sprintf(buffer,"Select a font size between %d and %d points.",
969 lpcf->nSizeMin,lpcf->nSizeMax);
970 MessageBoxA(hDlg, buffer, NULL, MB_OK);
972 return(TRUE);
973 case IDCANCEL:
974 EndDialog(hDlg, FALSE);
975 return(TRUE);
977 return(FALSE);
980 LRESULT CFn_WMDestroy(HWND hwnd, WPARAM wParam, LPARAM lParam)
982 return TRUE;
985 static LRESULT CFn_WMPaint(HWND hDlg, WPARAM wParam, LPARAM lParam,
986 LPCHOOSEFONTA lpcf )
988 WINDOWINFO info;
990 info.cbSize=sizeof(info);
992 if( GetWindowInfo( GetDlgItem( hDlg, stc5), &info ) )
994 PAINTSTRUCT ps;
995 HDC hdc;
996 HPEN hOrigPen;
997 HFONT hOrigFont;
998 COLORREF rgbPrev;
999 WCHAR sample[SAMPLE_EXTLEN+5]={'A','a','B','b'};
1000 LOGFONTA lf = *(lpcf->lpLogFont);
1001 /* Always start with this basic sample */
1003 MapWindowPoints( 0, hDlg, (LPPOINT) &info.rcWindow, 2);
1004 hdc=BeginPaint( hDlg, &ps );
1006 /* Paint frame */
1007 MoveToEx( hdc, info.rcWindow.left, info.rcWindow.bottom, NULL );
1008 hOrigPen=SelectObject( hdc, CreatePen( PS_SOLID, 2,
1009 GetSysColor( COLOR_3DSHADOW ) ));
1010 LineTo( hdc, info.rcWindow.left, info.rcWindow.top );
1011 LineTo( hdc, info.rcWindow.right, info.rcWindow.top );
1012 DeleteObject(SelectObject( hdc, CreatePen( PS_SOLID, 2,
1013 GetSysColor( COLOR_3DLIGHT ) )));
1014 LineTo( hdc, info.rcWindow.right, info.rcWindow.bottom );
1015 LineTo( hdc, info.rcWindow.left, info.rcWindow.bottom );
1016 DeleteObject(SelectObject( hdc, hOrigPen ));
1018 /* Draw the sample text itself */
1019 lstrcatW(sample, SAMPLE_LANG_TEXT[CHARSET_ORDER[lpcf->lpLogFont->lfCharSet]] );
1021 info.rcWindow.right--;
1022 info.rcWindow.bottom--;
1023 info.rcWindow.top++;
1024 info.rcWindow.left++;
1025 lf.lfHeight = MulDiv(lf.lfHeight, GetDeviceCaps(hdc, LOGPIXELSY), 72);
1026 hOrigFont = SelectObject( hdc, CreateFontIndirectA( &lf ) );
1027 rgbPrev=SetTextColor( hdc, lpcf->rgbColors );
1029 DrawTextW( hdc, sample, -1, &info.rcWindow, DT_CENTER|DT_VCENTER|DT_SINGLELINE );
1031 EndPaint( hDlg, &ps );
1034 return FALSE;
1037 /***********************************************************************
1038 * FormatCharDlgProcA [internal]
1040 INT_PTR CALLBACK FormatCharDlgProcA(HWND hDlg, UINT uMsg, WPARAM wParam,
1041 LPARAM lParam)
1043 LPCHOOSEFONTA lpcf;
1044 INT_PTR res = FALSE;
1045 if (uMsg!=WM_INITDIALOG)
1047 lpcf=(LPCHOOSEFONTA)GetWindowLongA(hDlg, DWL_USER);
1048 if (!lpcf)
1049 return FALSE;
1050 if (CFn_HookCallChk32(lpcf))
1051 res=CallWindowProcA((WNDPROC)lpcf->lpfnHook, hDlg, uMsg, wParam, lParam);
1052 if (res)
1053 return res;
1055 else
1057 lpcf=(LPCHOOSEFONTA)lParam;
1058 if (!CFn_WMInitDialog(hDlg, wParam, lParam, lpcf))
1060 TRACE("CFn_WMInitDialog returned FALSE\n");
1061 return FALSE;
1063 if (CFn_HookCallChk32(lpcf))
1064 return CallWindowProcA((WNDPROC)lpcf->lpfnHook,hDlg,WM_INITDIALOG,wParam,lParam);
1066 switch (uMsg)
1068 case WM_MEASUREITEM:
1069 return CFn_WMMeasureItem(hDlg, wParam, lParam);
1070 case WM_DRAWITEM:
1071 return CFn_WMDrawItem(hDlg, wParam, lParam);
1072 case WM_COMMAND:
1073 return CFn_WMCommand(hDlg, wParam, lParam, lpcf);
1074 case WM_DESTROY:
1075 return CFn_WMDestroy(hDlg, wParam, lParam);
1076 case WM_CHOOSEFONT_GETLOGFONT:
1077 TRACE("WM_CHOOSEFONT_GETLOGFONT lParam=%08lX\n",
1078 lParam);
1079 FIXME("current logfont back to caller\n");
1080 break;
1081 case WM_PAINT:
1082 return CFn_WMPaint(hDlg, wParam, lParam, lpcf);
1084 return res;
1087 /***********************************************************************
1088 * FormatCharDlgProcW [internal]
1090 INT_PTR CALLBACK FormatCharDlgProcW(HWND hDlg, UINT uMsg, WPARAM wParam,
1091 LPARAM lParam)
1093 LPCHOOSEFONTW lpcf32w;
1094 LPCHOOSEFONTA lpcf32a;
1095 INT_PTR res = FALSE;
1096 if (uMsg!=WM_INITDIALOG)
1098 lpcf32w=(LPCHOOSEFONTW)GetWindowLongA(hDlg, DWL_USER);
1099 if (!lpcf32w)
1100 return FALSE;
1101 if (CFn_HookCallChk32((LPCHOOSEFONTA)lpcf32w))
1102 res=CallWindowProcW((WNDPROC)lpcf32w->lpfnHook, hDlg, uMsg, wParam, lParam);
1103 if (res)
1104 return res;
1106 else
1108 lpcf32w=(LPCHOOSEFONTW)lParam;
1109 lpcf32a=(LPCHOOSEFONTA)lpcf32w->lpTemplateName;
1110 if (!CFn_WMInitDialog(hDlg, wParam, lParam, lpcf32a))
1112 TRACE("CFn_WMInitDialog returned FALSE\n");
1113 return FALSE;
1115 if (CFn_HookCallChk32((LPCHOOSEFONTA)lpcf32w))
1116 return CallWindowProcW((WNDPROC)lpcf32w->lpfnHook,hDlg,WM_INITDIALOG,wParam,lParam);
1118 lpcf32a=(LPCHOOSEFONTA)lpcf32w->lpTemplateName;
1119 switch (uMsg)
1121 case WM_MEASUREITEM:
1122 return CFn_WMMeasureItem(hDlg, wParam, lParam);
1123 case WM_DRAWITEM:
1124 return CFn_WMDrawItem(hDlg, wParam, lParam);
1125 case WM_COMMAND:
1126 return CFn_WMCommand(hDlg, wParam, lParam, lpcf32a);
1127 case WM_DESTROY:
1128 return CFn_WMDestroy(hDlg, wParam, lParam);
1129 case WM_CHOOSEFONT_GETLOGFONT:
1130 TRACE("WM_CHOOSEFONT_GETLOGFONT lParam=%08lX\n",
1131 lParam);
1132 FIXME("current logfont back to caller\n");
1133 break;
1135 return res;