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
30 #include "wine/winbase16.h"
31 #include "wine/winuser16.h"
35 #include "wine/debug.h"
38 WINE_DEFAULT_DEBUG_CHANNEL(commdlg
);
42 static HBITMAP16 hBitmapTT
= 0;
45 LRESULT WINAPI
FormatCharDlgProcA(HWND hDlg
, UINT uMsg
, WPARAM wParam
,
47 LRESULT WINAPI
FormatCharDlgProcW(HWND hDlg
, UINT uMsg
, WPARAM wParam
,
49 LRESULT WINAPI
FormatCharDlgProc16(HWND16 hDlg
, UINT16 message
, WPARAM16 wParam
,
52 static void FONT_LogFont16To32A( const LPLOGFONT16 font16
, LPLOGFONTA font32
)
54 font32
->lfHeight
= font16
->lfHeight
;
55 font32
->lfWidth
= font16
->lfWidth
;
56 font32
->lfEscapement
= font16
->lfEscapement
;
57 font32
->lfOrientation
= font16
->lfOrientation
;
58 font32
->lfWeight
= font16
->lfWeight
;
59 font32
->lfItalic
= font16
->lfItalic
;
60 font32
->lfUnderline
= font16
->lfUnderline
;
61 font32
->lfStrikeOut
= font16
->lfStrikeOut
;
62 font32
->lfCharSet
= font16
->lfCharSet
;
63 font32
->lfOutPrecision
= font16
->lfOutPrecision
;
64 font32
->lfClipPrecision
= font16
->lfClipPrecision
;
65 font32
->lfQuality
= font16
->lfQuality
;
66 font32
->lfPitchAndFamily
= font16
->lfPitchAndFamily
;
67 lstrcpynA( font32
->lfFaceName
, font16
->lfFaceName
, LF_FACESIZE
);
70 static void CFn_CHOOSEFONT16to32A(LPCHOOSEFONT16 chf16
, LPCHOOSEFONTA chf32a
)
72 chf32a
->lStructSize
=sizeof(CHOOSEFONTA
);
73 chf32a
->hwndOwner
=chf16
->hwndOwner
;
74 chf32a
->hDC
=chf16
->hDC
;
75 chf32a
->iPointSize
=chf16
->iPointSize
;
76 chf32a
->Flags
=chf16
->Flags
;
77 chf32a
->rgbColors
=chf16
->rgbColors
;
78 chf32a
->lCustData
=chf16
->lCustData
;
79 chf32a
->lpfnHook
=NULL
;
80 chf32a
->lpTemplateName
=MapSL(chf16
->lpTemplateName
);
81 chf32a
->hInstance
=chf16
->hInstance
;
82 chf32a
->lpszStyle
=MapSL(chf16
->lpszStyle
);
83 chf32a
->nFontType
=chf16
->nFontType
;
84 chf32a
->nSizeMax
=chf16
->nSizeMax
;
85 chf32a
->nSizeMin
=chf16
->nSizeMin
;
86 FONT_LogFont16To32A(MapSL(chf16
->lpLogFont
), chf32a
->lpLogFont
);
93 #define XX(x) { x, #x },
99 XX(CF_ENABLETEMPLATEHANDLE
)
100 XX(CF_INITTOLOGFONTSTRUCT
)
108 XX(CF_FIXEDPITCHONLY
)
110 XX(CF_FORCEFONTEXIST
)
124 _dump_cf_flags(DWORD cflags
) {
127 for (i
=0;cfflags
[i
].name
;i
++)
128 if (cfflags
[i
].mask
& cflags
)
129 MESSAGE("%s|",cfflags
[i
].name
);
134 /***********************************************************************
135 * ChooseFont (COMMDLG.15)
137 BOOL16 WINAPI
ChooseFont16(LPCHOOSEFONT16 lpChFont
)
140 HANDLE16 hDlgTmpl16
= 0, hResource16
= 0;
141 HGLOBAL16 hGlobal16
= 0;
148 SEGPTR lpTemplateName
;
150 cf32a
.lpLogFont
=&lf32a
;
151 CFn_CHOOSEFONT16to32A(lpChFont
, &cf32a
);
153 TRACE("ChooseFont\n");
154 if (!lpChFont
) return FALSE
;
156 if (TRACE_ON(commdlg
))
157 _dump_cf_flags(lpChFont
->Flags
);
159 if (lpChFont
->Flags
& CF_ENABLETEMPLATEHANDLE
)
161 if (!(template = LockResource16( lpChFont
->hInstance
)))
163 COMDLG32_SetCommDlgExtendedError(CDERR_LOADRESFAILURE
);
167 else if (lpChFont
->Flags
& CF_ENABLETEMPLATE
)
170 if (!(hResInfo
= FindResource16( lpChFont
->hInstance
,
171 MapSL(lpChFont
->lpTemplateName
),
174 COMDLG32_SetCommDlgExtendedError(CDERR_FINDRESFAILURE
);
177 if (!(hDlgTmpl16
= LoadResource16( lpChFont
->hInstance
, hResInfo
)) ||
178 !(template = LockResource16( hDlgTmpl16
)))
180 COMDLG32_SetCommDlgExtendedError(CDERR_LOADRESFAILURE
);
186 HANDLE hResInfo
, hDlgTmpl32
;
189 if (!(hResInfo
= FindResourceA(COMMDLG_hInstance32
, "CHOOSE_FONT", RT_DIALOGA
)))
191 COMDLG32_SetCommDlgExtendedError(CDERR_FINDRESFAILURE
);
194 if (!(hDlgTmpl32
= LoadResource(COMMDLG_hInstance32
, hResInfo
)) ||
195 !(template32
= LockResource(hDlgTmpl32
)))
197 COMDLG32_SetCommDlgExtendedError(CDERR_LOADRESFAILURE
);
200 size
= SizeofResource(GetModuleHandleA("COMDLG32"), hResInfo
);
201 hGlobal16
= GlobalAlloc16(0, size
);
204 COMDLG32_SetCommDlgExtendedError(CDERR_MEMALLOCFAILURE
);
205 ERR("alloc failure for %ld bytes\n", size
);
208 template = GlobalLock16(hGlobal16
);
211 COMDLG32_SetCommDlgExtendedError(CDERR_MEMLOCKFAILURE
);
212 ERR("global lock failure for %x handle\n", hGlobal16
);
213 GlobalFree16(hGlobal16
);
216 ConvertDialog32To16((LPVOID
)template32
, size
, (LPVOID
)template);
217 hDlgTmpl16
= hGlobal16
;
221 /* lpTemplateName is not used in the dialog */
222 lpTemplateName
=lpChFont
->lpTemplateName
;
223 lpChFont
->lpTemplateName
=(SEGPTR
)&cf32a
;
225 ptr
= GetProcAddress16(GetModuleHandle16("COMMDLG"), (LPCSTR
) 16);
226 hInst
= GetWindowLongA(lpChFont
->hwndOwner
, GWL_HINSTANCE
);
227 bRet
= DialogBoxIndirectParam16(hInst
, hDlgTmpl16
, lpChFont
->hwndOwner
,
228 (DLGPROC16
) ptr
, (DWORD
)lpChFont
);
229 if (hResource16
) FreeResource16(hDlgTmpl16
);
232 GlobalUnlock16(hGlobal16
);
233 GlobalFree16(hGlobal16
);
235 lpChFont
->lpTemplateName
=lpTemplateName
;
238 font16
= MapSL(lpChFont
->lpLogFont
);
239 font16
->lfHeight
= cf32a
.lpLogFont
->lfHeight
;
240 font16
->lfWidth
= cf32a
.lpLogFont
->lfWidth
;
241 font16
->lfEscapement
= cf32a
.lpLogFont
->lfEscapement
;
242 font16
->lfOrientation
= cf32a
.lpLogFont
->lfOrientation
;
243 font16
->lfWeight
= cf32a
.lpLogFont
->lfWeight
;
244 font16
->lfItalic
= cf32a
.lpLogFont
->lfItalic
;
245 font16
->lfUnderline
= cf32a
.lpLogFont
->lfUnderline
;
246 font16
->lfStrikeOut
= cf32a
.lpLogFont
->lfStrikeOut
;
247 font16
->lfCharSet
= cf32a
.lpLogFont
->lfCharSet
;
248 font16
->lfOutPrecision
= cf32a
.lpLogFont
->lfOutPrecision
;
249 font16
->lfClipPrecision
= cf32a
.lpLogFont
->lfClipPrecision
;
250 font16
->lfQuality
= cf32a
.lpLogFont
->lfQuality
;
251 font16
->lfPitchAndFamily
= cf32a
.lpLogFont
->lfPitchAndFamily
;
252 lstrcpynA( font16
->lfFaceName
, cf32a
.lpLogFont
->lfFaceName
, LF_FACESIZE
);
257 /***********************************************************************
258 * ChooseFontA (COMDLG32.@)
260 BOOL WINAPI
ChooseFontA(LPCHOOSEFONTA lpChFont
)
263 HANDLE hResInfo
, hDlgTmpl
;
265 if (!(hResInfo
= FindResourceA(COMMDLG_hInstance32
, "CHOOSE_FONT", RT_DIALOGA
)))
267 COMDLG32_SetCommDlgExtendedError(CDERR_FINDRESFAILURE
);
270 if (!(hDlgTmpl
= LoadResource(COMMDLG_hInstance32
, hResInfo
)) ||
271 !(template = LockResource( hDlgTmpl
)))
273 COMDLG32_SetCommDlgExtendedError(CDERR_LOADRESFAILURE
);
276 if (TRACE_ON(commdlg
))
277 _dump_cf_flags(lpChFont
->Flags
);
279 if (lpChFont
->Flags
& (CF_SELECTSCRIPT
| CF_NOVERTFONTS
| CF_ENABLETEMPLATE
|
280 CF_ENABLETEMPLATEHANDLE
)) FIXME(": unimplemented flag (ignored)\n");
281 return DialogBoxIndirectParamA(COMMDLG_hInstance32
, template,
282 lpChFont
->hwndOwner
, (DLGPROC
)FormatCharDlgProcA
, (LPARAM
)lpChFont
);
285 /***********************************************************************
286 * ChooseFontW (COMDLG32.@)
290 * The LOGFONT conversion functions will break if the structure ever
291 * grows beyond the lfFaceName element.
293 * The CHOOSEFONT conversion functions assume that both versions of
294 * lpLogFont and lpszStyle (if used) point to pre-allocated objects.
296 * The ASCII version of lpTemplateName is created by ChooseFontAtoW
297 * and freed by ChooseFontWtoA.
299 inline static VOID
LogFontWtoA(const LOGFONTW
*lfw
, LOGFONTA
*lfa
)
301 memcpy(lfa
, lfw
, sizeof(LOGFONTA
));
302 WideCharToMultiByte(CP_ACP
, 0, lfw
->lfFaceName
, -1, lfa
->lfFaceName
,
303 LF_FACESIZE
, NULL
, NULL
);
304 lfa
->lfFaceName
[LF_FACESIZE
- 1] = '\0';
307 inline static VOID
LogFontAtoW(const LOGFONTA
*lfa
, LOGFONTW
*lfw
)
309 memcpy(lfw
, lfa
, sizeof(LOGFONTA
));
310 MultiByteToWideChar(CP_ACP
, 0, lfa
->lfFaceName
, -1, lfw
->lfFaceName
,
312 lfw
->lfFaceName
[LF_FACESIZE
- 1] = 0;
315 static BOOL
ChooseFontWtoA(const CHOOSEFONTW
*cfw
, CHOOSEFONTA
*cfa
)
317 LOGFONTA
*lpLogFont
= cfa
->lpLogFont
;
318 LPSTR lpszStyle
= cfa
->lpszStyle
;
320 memcpy(cfa
, cfw
, sizeof(CHOOSEFONTA
));
321 cfa
->lpLogFont
= lpLogFont
;
322 cfa
->lpszStyle
= lpszStyle
;
324 LogFontWtoA(cfw
->lpLogFont
, lpLogFont
);
326 if (cfw
->lpTemplateName
!= NULL
)
328 cfa
->lpTemplateName
= HEAP_strdupWtoA(GetProcessHeap(), 0,
329 cfw
->lpTemplateName
);
330 if (cfa
->lpTemplateName
== NULL
)
334 if ((cfw
->Flags
& CF_USESTYLE
) != 0 && cfw
->lpszStyle
!= NULL
)
336 WideCharToMultiByte(CP_ACP
, 0, cfw
->lpszStyle
, -1, cfa
->lpszStyle
,
337 LF_FACESIZE
, NULL
, NULL
);
338 cfa
->lpszStyle
[LF_FACESIZE
- 1] = '\0';
344 static VOID
ChooseFontAtoW(const CHOOSEFONTA
*cfa
, CHOOSEFONTW
*cfw
)
346 LOGFONTW
*lpLogFont
= cfw
->lpLogFont
;
347 LPWSTR lpszStyle
= cfw
->lpszStyle
;
348 LPCWSTR lpTemplateName
= cfw
->lpTemplateName
;
350 memcpy(cfw
, cfa
, sizeof(CHOOSEFONTA
));
351 cfw
->lpLogFont
= lpLogFont
;
352 cfw
->lpszStyle
= lpszStyle
;
353 cfw
->lpTemplateName
= lpTemplateName
;
355 LogFontAtoW(cfa
->lpLogFont
, lpLogFont
);
357 if (cfa
->lpTemplateName
!= NULL
)
358 HeapFree(GetProcessHeap(), 0, (LPSTR
)(cfa
->lpTemplateName
));
360 if ((cfa
->Flags
& CF_USESTYLE
) != 0 && cfa
->lpszStyle
!= NULL
)
362 MultiByteToWideChar(CP_ACP
, 0, cfa
->lpszStyle
, -1, cfw
->lpszStyle
,
364 cfw
->lpszStyle
[LF_FACESIZE
- 1] = 0;
368 BOOL WINAPI
ChooseFontW(LPCHOOSEFONTW lpChFont
)
372 CHAR style_a
[LF_FACESIZE
];
374 cf_a
.lpLogFont
= &lf_a
;
375 cf_a
.lpszStyle
= style_a
;
377 if (ChooseFontWtoA(lpChFont
, &cf_a
) == FALSE
)
379 COMDLG32_SetCommDlgExtendedError(CDERR_MEMALLOCFAILURE
);
383 if (ChooseFontA(&cf_a
) == FALSE
)
385 if (cf_a
.lpTemplateName
!= NULL
)
386 HeapFree(GetProcessHeap(), 0, (LPSTR
)(cf_a
.lpTemplateName
));
390 ChooseFontAtoW(&cf_a
, lpChFont
);
396 /***********************************************************************
397 * ChooseFontW (COMDLG32.@)
399 BOOL WINAPI
ChooseFontW(LPCHOOSEFONTW lpChFont
)
405 HANDLE hResInfo
, hDlgTmpl
;
407 if (TRACE_ON(commdlg
))
408 _dump_cf_flags(lpChFont
->Flags
);
410 if (!(hResInfo
= FindResourceA(COMMDLG_hInstance32
, "CHOOSE_FONT", RT_DIALOGA
)))
412 COMDLG32_SetCommDlgExtendedError(CDERR_FINDRESFAILURE
);
415 if (!(hDlgTmpl
= LoadResource(COMMDLG_hInstance32
, hResInfo
)) ||
416 !(template = LockResource( hDlgTmpl
)))
418 COMDLG32_SetCommDlgExtendedError(CDERR_LOADRESFAILURE
);
422 if (lpChFont
->Flags
& (CF_SELECTSCRIPT
| CF_NOVERTFONTS
| CF_ENABLETEMPLATE
|
423 CF_ENABLETEMPLATEHANDLE
)) FIXME(": unimplemented flag (ignored)\n");
424 memcpy(&cf32a
, lpChFont
, sizeof(cf32a
));
425 memcpy(&lf32a
, lpChFont
->lpLogFont
, sizeof(LOGFONTA
));
427 WideCharToMultiByte( CP_ACP
, 0, lpChFont
->lpLogFont
->lfFaceName
, -1,
428 lf32a
.lfFaceName
, LF_FACESIZE
, NULL
, NULL
);
429 lf32a
.lfFaceName
[LF_FACESIZE
-1] = 0;
430 cf32a
.lpLogFont
=&lf32a
;
431 cf32a
.lpszStyle
=HEAP_strdupWtoA(GetProcessHeap(), 0, lpChFont
->lpszStyle
);
432 lpChFont
->lpTemplateName
=(LPWSTR
)&cf32a
;
433 bRet
= DialogBoxIndirectParamW(COMMDLG_hInstance32
, template,
434 lpChFont
->hwndOwner
, (DLGPROC
)FormatCharDlgProcW
, (LPARAM
)lpChFont
);
435 HeapFree(GetProcessHeap(), 0, cf32a
.lpszStyle
);
436 lpChFont
->lpTemplateName
=(LPWSTR
)cf32a
.lpTemplateName
;
437 memcpy(lpChFont
->lpLogFont
, &lf32a
, sizeof(CHOOSEFONTA
));
438 MultiByteToWideChar( CP_ACP
, 0, lf32a
.lfFaceName
, -1,
439 lpChFont
->lpLogFont
->lfFaceName
, LF_FACESIZE
);
440 lpChFont
->lpLogFont
->lfFaceName
[LF_FACESIZE
-1] = 0;
445 #define TEXT_EXTRAS 4
446 #define TEXT_COLORS 16
448 static const COLORREF textcolors
[TEXT_COLORS
]=
450 0x00000000L
,0x00000080L
,0x00008000L
,0x00008080L
,
451 0x00800000L
,0x00800080L
,0x00808000L
,0x00808080L
,
452 0x00c0c0c0L
,0x000000ffL
,0x0000ff00L
,0x0000ffffL
,
453 0x00ff0000L
,0x00ff00ffL
,0x00ffff00L
,0x00FFFFFFL
456 /***********************************************************************
457 * CFn_HookCallChk [internal]
459 static BOOL
CFn_HookCallChk(LPCHOOSEFONT16 lpcf
)
462 if(lpcf
->Flags
& CF_ENABLEHOOK
)
468 /***********************************************************************
469 * CFn_HookCallChk32 [internal]
471 static BOOL
CFn_HookCallChk32(LPCHOOSEFONTA lpcf
)
474 if(lpcf
->Flags
& CF_ENABLEHOOK
)
484 LPCHOOSEFONTA lpcf32a
;
486 } CFn_ENUMSTRUCT
, *LPCFn_ENUMSTRUCT
;
488 /*************************************************************************
489 * AddFontFamily [internal]
491 static INT
AddFontFamily(const LOGFONTA
*lplf
, UINT nFontType
,
492 LPCHOOSEFONTA lpcf
, HWND hwnd
, LPCFn_ENUMSTRUCT e
)
497 TRACE("font=%s (nFontType=%d)\n", lplf
->lfFaceName
,nFontType
);
499 if (lpcf
->Flags
& CF_FIXEDPITCHONLY
)
500 if (!(lplf
->lfPitchAndFamily
& FIXED_PITCH
))
502 if (lpcf
->Flags
& CF_ANSIONLY
)
503 if (lplf
->lfCharSet
!= ANSI_CHARSET
)
505 if (lpcf
->Flags
& CF_TTONLY
)
506 if (!(nFontType
& TRUETYPE_FONTTYPE
))
511 i
=SendMessageA(hwnd
, CB_ADDSTRING
, 0, (LPARAM
)lplf
->lfFaceName
);
514 w
=(lplf
->lfCharSet
<< 8) | lplf
->lfPitchAndFamily
;
515 SendMessageA(hwnd
, CB_SETITEMDATA
, i
, MAKELONG(nFontType
,w
));
516 return 1 ; /* store some important font information */
522 /*************************************************************************
523 * FontFamilyEnumProc32 [internal]
525 static INT WINAPI
FontFamilyEnumProc(const LOGFONTA
*lpLogFont
,
526 const TEXTMETRICA
*metrics
, DWORD dwFontType
, LPARAM lParam
)
529 e
=(LPCFn_ENUMSTRUCT
)lParam
;
530 return AddFontFamily(lpLogFont
, dwFontType
, e
->lpcf32a
, e
->hWnd1
, e
);
533 /***********************************************************************
534 * FontFamilyEnumProc (COMMDLG.19)
536 INT16 WINAPI
FontFamilyEnumProc16( SEGPTR logfont
, SEGPTR metrics
,
537 UINT16 nFontType
, LPARAM lParam
)
539 HWND16 hwnd
=LOWORD(lParam
);
540 HWND hDlg
=GetParent(hwnd
);
541 LPCHOOSEFONT16 lpcf
=(LPCHOOSEFONT16
)GetWindowLongA(hDlg
, DWL_USER
);
542 LOGFONT16
*lplf
= MapSL( logfont
);
544 FONT_LogFont16To32A(lplf
, &lf32a
);
545 return AddFontFamily(&lf32a
, nFontType
, (LPCHOOSEFONTA
)lpcf
->lpTemplateName
,
549 /*************************************************************************
550 * SetFontStylesToCombo2 [internal]
552 * Fill font style information into combobox (without using font.c directly)
554 static int SetFontStylesToCombo2(HWND hwnd
, HDC hdc
, const LOGFONTA
*lplf
)
561 static struct FONTSTYLE fontstyles
[FSTYLES
]={
562 { 0,FW_NORMAL
,"Regular"},{0,FW_BOLD
,"Bold"},
563 { 1,FW_NORMAL
,"Italic"}, {1,FW_BOLD
,"Bold Italic"}};
569 memcpy(&lf
, lplf
, sizeof(LOGFONTA
));
571 for (i
=0;i
<FSTYLES
;i
++)
573 lf
.lfItalic
=fontstyles
[i
].italic
;
574 lf
.lfWeight
=fontstyles
[i
].weight
;
575 hf
=CreateFontIndirectA(&lf
);
576 hf
=SelectObject(hdc
,hf
);
577 GetTextMetricsA(hdc
,&tm
);
578 hf
=SelectObject(hdc
,hf
);
581 if (tm
.tmWeight
==fontstyles
[i
].weight
&&
582 tm
.tmItalic
==fontstyles
[i
].italic
) /* font successful created ? */
584 j
=SendMessageA(hwnd
,CB_ADDSTRING
,0,(LPARAM
)fontstyles
[i
].stname
);
585 if (j
==CB_ERR
) return 1;
586 j
=SendMessageA(hwnd
, CB_SETITEMDATA
, j
,
587 MAKELONG(fontstyles
[i
].weight
,fontstyles
[i
].italic
));
588 if (j
==CB_ERR
) return 1;
594 /*************************************************************************
595 * AddFontSizeToCombo3 [internal]
597 static int AddFontSizeToCombo3(HWND hwnd
, UINT h
, LPCHOOSEFONTA lpcf
)
602 if ( (!(lpcf
->Flags
& CF_LIMITSIZE
)) ||
603 ((lpcf
->Flags
& CF_LIMITSIZE
) && (h
>= lpcf
->nSizeMin
) && (h
<= lpcf
->nSizeMax
)))
605 sprintf(buffer
, "%2d", h
);
606 j
=SendMessageA(hwnd
, CB_FINDSTRINGEXACT
, -1, (LPARAM
)buffer
);
609 j
=SendMessageA(hwnd
, CB_ADDSTRING
, 0, (LPARAM
)buffer
);
610 if (j
!=CB_ERR
) j
= SendMessageA(hwnd
, CB_SETITEMDATA
, j
, h
);
611 if (j
==CB_ERR
) return 1;
617 /*************************************************************************
618 * SetFontSizesToCombo3 [internal]
620 static int SetFontSizesToCombo3(HWND hwnd
, LPCHOOSEFONTA lpcf
)
622 static const int sizes
[]={8,9,10,11,12,14,16,18,20,22,24,26,28,36,48,72,0};
625 for (i
=0; sizes
[i
]; i
++)
626 if (AddFontSizeToCombo3(hwnd
, sizes
[i
], lpcf
)) return 1;
630 /***********************************************************************
631 * AddFontStyle [internal]
633 static INT
AddFontStyle(const LOGFONTA
*lplf
, UINT nFontType
,
634 LPCHOOSEFONTA lpcf
, HWND hcmb2
, HWND hcmb3
, HWND hDlg
)
638 TRACE("(nFontType=%d)\n",nFontType
);
639 TRACE(" %s h=%ld w=%ld e=%ld o=%ld wg=%ld i=%d u=%d s=%d"
640 " ch=%d op=%d cp=%d q=%d pf=%xh\n",
641 lplf
->lfFaceName
,lplf
->lfHeight
,lplf
->lfWidth
,
642 lplf
->lfEscapement
,lplf
->lfOrientation
,
643 lplf
->lfWeight
,lplf
->lfItalic
,lplf
->lfUnderline
,
644 lplf
->lfStrikeOut
,lplf
->lfCharSet
, lplf
->lfOutPrecision
,
645 lplf
->lfClipPrecision
,lplf
->lfQuality
, lplf
->lfPitchAndFamily
);
646 if (nFontType
& RASTER_FONTTYPE
)
648 if (AddFontSizeToCombo3(hcmb3
, lplf
->lfHeight
, lpcf
)) return 0;
649 } else if (SetFontSizesToCombo3(hcmb3
, lpcf
)) return 0;
651 if (!SendMessageA(hcmb2
, CB_GETCOUNT
, 0, 0))
653 HDC hdc
= ((lpcf
->Flags
& CF_PRINTERFONTS
) && lpcf
->hDC
) ? lpcf
->hDC
: GetDC(hDlg
);
654 i
=SetFontStylesToCombo2(hcmb2
,hdc
,lplf
);
655 if (!((lpcf
->Flags
& CF_PRINTERFONTS
) && lpcf
->hDC
))
664 /***********************************************************************
665 * FontStyleEnumProc (COMMDLG.18)
667 INT16 WINAPI
FontStyleEnumProc16( SEGPTR logfont
, SEGPTR metrics
,
668 UINT16 nFontType
, LPARAM lParam
)
670 HWND16 hcmb2
=LOWORD(lParam
);
671 HWND16 hcmb3
=HIWORD(lParam
);
672 HWND hDlg
=GetParent(hcmb3
);
673 LPCHOOSEFONT16 lpcf
=(LPCHOOSEFONT16
)GetWindowLongA(hDlg
, DWL_USER
);
674 LOGFONT16
*lplf
= MapSL(logfont
);
676 FONT_LogFont16To32A(lplf
, &lf32a
);
677 return AddFontStyle(&lf32a
, nFontType
, (LPCHOOSEFONTA
)lpcf
->lpTemplateName
,
681 /***********************************************************************
682 * FontStyleEnumProc32 [internal]
684 static INT WINAPI
FontStyleEnumProc( const LOGFONTA
*lpFont
,
685 const TEXTMETRICA
*metrics
, DWORD dwFontType
, LPARAM lParam
)
687 LPCFn_ENUMSTRUCT s
=(LPCFn_ENUMSTRUCT
)lParam
;
690 HWND hDlg
=GetParent(hcmb3
);
691 return AddFontStyle(lpFont
, dwFontType
, s
->lpcf32a
, hcmb2
,
695 /***********************************************************************
696 * CFn_WMInitDialog [internal]
698 static LRESULT
CFn_WMInitDialog(HWND hDlg
, WPARAM wParam
, LPARAM lParam
,
705 HCURSOR hcursor
=SetCursor(LoadCursorA(0,IDC_WAITA
));
707 SetWindowLongA(hDlg
, DWL_USER
, lParam
);
708 lpxx
=lpcf
->lpLogFont
;
709 TRACE("WM_INITDIALOG lParam=%08lX\n", lParam
);
711 if (lpcf
->lStructSize
!= sizeof(CHOOSEFONTA
))
713 ERR("structure size failure !!!\n");
718 hBitmapTT
= LoadBitmapA(0, MAKEINTRESOURCEA(OBM_TRTYPE
));
720 /* This font will be deleted by WM_COMMAND */
721 SendDlgItemMessageA(hDlg
,stc6
,WM_SETFONT
,
722 CreateFontA(0, 0, 1, 1, 400, 0, 0, 0, 0, 0, 0, 0, 0, NULL
),FALSE
);
724 if (!(lpcf
->Flags
& CF_SHOWHELP
) || !IsWindow(lpcf
->hwndOwner
))
725 ShowWindow(GetDlgItem(hDlg
,pshHelp
),SW_HIDE
);
726 if (!(lpcf
->Flags
& CF_APPLY
))
727 ShowWindow(GetDlgItem(hDlg
,psh3
),SW_HIDE
);
728 if (lpcf
->Flags
& CF_EFFECTS
)
730 for (res
=1,i
=0;res
&& i
<TEXT_COLORS
;i
++)
732 /* FIXME: load color name from resource: res=LoadString(...,i+....,buffer,.....); */
734 strcpy( name
, "[color name]" );
735 j
=SendDlgItemMessageA(hDlg
, cmb4
, CB_ADDSTRING
, 0, (LPARAM
)name
);
736 SendDlgItemMessageA(hDlg
, cmb4
, CB_SETITEMDATA16
, j
, textcolors
[j
]);
737 /* look for a fitting value in color combobox */
738 if (textcolors
[j
]==lpcf
->rgbColors
)
739 SendDlgItemMessageA(hDlg
,cmb4
, CB_SETCURSEL
,j
,0);
744 ShowWindow(GetDlgItem(hDlg
,cmb4
),SW_HIDE
);
745 ShowWindow(GetDlgItem(hDlg
,chx1
),SW_HIDE
);
746 ShowWindow(GetDlgItem(hDlg
,chx2
),SW_HIDE
);
747 ShowWindow(GetDlgItem(hDlg
,grp1
),SW_HIDE
);
748 ShowWindow(GetDlgItem(hDlg
,stc4
),SW_HIDE
);
750 hdc
= ((lpcf
->Flags
& CF_PRINTERFONTS
) && lpcf
->hDC
) ? lpcf
->hDC
: GetDC(hDlg
);
754 s
.hWnd1
=GetDlgItem(hDlg
,cmb1
);
758 if (!EnumFontFamiliesA(hdc
, NULL
, FontFamilyEnumProc
, (LPARAM
)&s
)) {
759 TRACE("EnumFontFamilies returns 0\n");
763 if (lpcf
->Flags
& CF_FIXEDPITCHONLY
) {
764 FIXME("No founds found with fixed pitch only, dropping flag.\n");
765 lpcf
->Flags
&= ~CF_FIXEDPITCHONLY
;
768 if (lpcf
->Flags
& CF_TTONLY
) {
769 FIXME("No founds found with truetype only, dropping flag.\n");
770 lpcf
->Flags
&= ~CF_TTONLY
;
777 if (lpcf
->Flags
& CF_INITTOLOGFONTSTRUCT
)
779 /* look for fitting font name in combobox1 */
780 j
=SendDlgItemMessageA(hDlg
,cmb1
,CB_FINDSTRING
,-1,(LONG
)lpxx
->lfFaceName
);
783 SendDlgItemMessageA(hDlg
, cmb1
, CB_SETCURSEL
, j
, 0);
784 SendMessageA(hDlg
, WM_COMMAND
, MAKEWPARAM(cmb1
, CBN_SELCHANGE
),
785 GetDlgItem(hDlg
,cmb1
));
787 /* look for fitting font style in combobox2 */
788 l
=MAKELONG(lpxx
->lfWeight
> FW_MEDIUM
? FW_BOLD
:FW_NORMAL
,lpxx
->lfItalic
!=0);
789 for (i
=0;i
<TEXT_EXTRAS
;i
++)
791 if (l
==SendDlgItemMessageA(hDlg
, cmb2
, CB_GETITEMDATA
, i
, 0))
792 SendDlgItemMessageA(hDlg
, cmb2
, CB_SETCURSEL
, i
, 0);
795 /* look for fitting font size in combobox3 */
796 j
=SendDlgItemMessageA(hDlg
, cmb3
, CB_GETCOUNT
, 0, 0);
799 if (lpxx
->lfHeight
==(int)SendDlgItemMessageA(hDlg
,cmb3
, CB_GETITEMDATA
,i
,0))
800 SendDlgItemMessageA(hDlg
,cmb3
,CB_SETCURSEL
,i
,0);
806 SendDlgItemMessageA(hDlg
,cmb1
,CB_SETCURSEL
,0,0);
807 SendMessageA(hDlg
, WM_COMMAND
, MAKEWPARAM(cmb1
, CBN_SELCHANGE
),
808 GetDlgItem(hDlg
,cmb1
));
810 if (lpcf
->Flags
& CF_USESTYLE
&& lpcf
->lpszStyle
)
812 j
=SendDlgItemMessageA(hDlg
,cmb2
,CB_FINDSTRING
,-1,(LONG
)lpcf
->lpszStyle
);
815 j
=SendDlgItemMessageA(hDlg
,cmb2
,CB_SETCURSEL
,j
,0);
816 SendMessageA(hDlg
,WM_COMMAND
,cmb2
,
817 MAKELONG(GetDlgItem(hDlg
,cmb2
),CBN_SELCHANGE
));
823 WARN("HDC failure !!!\n");
828 if (!((lpcf
->Flags
& CF_PRINTERFONTS
) && lpcf
->hDC
))
835 /***********************************************************************
836 * CFn_WMMeasureItem [internal]
838 static LRESULT
CFn_WMMeasureItem(HWND hDlg
, WPARAM wParam
, LPARAM lParam
)
841 LPMEASUREITEMSTRUCT lpmi
=(LPMEASUREITEMSTRUCT
)lParam
;
843 hBitmapTT
= LoadBitmapA(0, MAKEINTRESOURCEA(OBM_TRTYPE
));
844 GetObjectA( hBitmapTT
, sizeof(bm
), &bm
);
845 lpmi
->itemHeight
=bm
.bmHeight
;
846 /* FIXME: use MAX of bm.bmHeight and tm.tmHeight .*/
851 /***********************************************************************
852 * CFn_WMDrawItem [internal]
854 static LRESULT
CFn_WMDrawItem(HWND hDlg
, WPARAM wParam
, LPARAM lParam
)
859 COLORREF cr
, oldText
=0, oldBk
=0;
864 HBITMAP hBitmap
; /* for later TT usage */
866 LPDRAWITEMSTRUCT lpdi
= (LPDRAWITEMSTRUCT
)lParam
;
868 if (lpdi
->itemID
== (UINT
)-1) /* got no items */
869 DrawFocusRect(lpdi
->hDC
, &lpdi
->rcItem
);
872 if (lpdi
->CtlType
== ODT_COMBOBOX
)
874 if (lpdi
->itemState
==ODS_SELECTED
)
876 hBrush
=GetSysColorBrush(COLOR_HIGHLIGHT
);
877 oldText
=SetTextColor(lpdi
->hDC
, GetSysColor(COLOR_HIGHLIGHTTEXT
));
878 oldBk
=SetBkColor(lpdi
->hDC
, GetSysColor(COLOR_HIGHLIGHT
));
881 hBrush
= SelectObject(lpdi
->hDC
, GetStockObject(LTGRAY_BRUSH
));
882 SelectObject(lpdi
->hDC
, hBrush
);
884 FillRect(lpdi
->hDC
, &lpdi
->rcItem
, hBrush
);
887 return TRUE
; /* this should never happen */
892 case cmb1
: /* TRACE(commdlg,"WM_Drawitem cmb1\n"); */
893 SendMessageA(lpdi
->hwndItem
, CB_GETLBTEXT
, lpdi
->itemID
,
895 GetObjectA( hBitmapTT
, sizeof(bm
), &bm
);
896 TextOutA(lpdi
->hDC
, lpdi
->rcItem
.left
+ bm
.bmWidth
+ 10,
897 lpdi
->rcItem
.top
, buffer
, strlen(buffer
));
899 nFontType
= SendMessageA(lpdi
->hwndItem
, CB_GETITEMDATA
, lpdi
->itemID
,0L);
900 /* FIXME: draw bitmap if truetype usage */
901 if (nFontType
&TRUETYPE_FONTTYPE
)
903 hMemDC
= CreateCompatibleDC(lpdi
->hDC
);
904 hBitmap
= SelectObject(hMemDC
, hBitmapTT
);
905 BitBlt(lpdi
->hDC
, lpdi
->rcItem
.left
, lpdi
->rcItem
.top
,
906 bm
.bmWidth
, bm
.bmHeight
, hMemDC
, 0, 0, SRCCOPY
);
907 SelectObject(hMemDC
, hBitmap
);
913 case cmb3
: /* TRACE(commdlg,"WM_DRAWITEN cmb2,cmb3\n"); */
914 SendMessageA(lpdi
->hwndItem
, CB_GETLBTEXT
, lpdi
->itemID
,
916 TextOutA(lpdi
->hDC
, lpdi
->rcItem
.left
,
917 lpdi
->rcItem
.top
, buffer
, strlen(buffer
));
920 case cmb4
: /* TRACE(commdlg,"WM_DRAWITEM cmb4 (=COLOR)\n"); */
921 SendMessageA(lpdi
->hwndItem
, CB_GETLBTEXT
, lpdi
->itemID
,
923 TextOutA(lpdi
->hDC
, lpdi
->rcItem
.left
+ 25+5,
924 lpdi
->rcItem
.top
, buffer
, strlen(buffer
));
925 cr
= SendMessageA(lpdi
->hwndItem
, CB_GETITEMDATA
, lpdi
->itemID
,0L);
926 hBrush
= CreateSolidBrush(cr
);
929 hBrush
= SelectObject (lpdi
->hDC
, hBrush
) ;
930 rect
.right
=rect
.left
+25;
934 Rectangle( lpdi
->hDC
, rect
.left
, rect
.top
,
935 rect
.right
, rect
.bottom
);
936 DeleteObject( SelectObject (lpdi
->hDC
, hBrush
)) ;
942 default: return TRUE
; /* this should never happen */
944 if (lpdi
->itemState
== ODS_SELECTED
)
946 SetTextColor(lpdi
->hDC
, oldText
);
947 SetBkColor(lpdi
->hDC
, oldBk
);
953 /***********************************************************************
954 * CFn_WMCtlColor [internal]
956 static LRESULT
CFn_WMCtlColorStatic(HWND hDlg
, WPARAM wParam
, LPARAM lParam
,
959 if (lpcf
->Flags
& CF_EFFECTS
)
960 if (GetDlgCtrlID(lParam
)==stc6
)
962 SetTextColor((HDC
)wParam
, lpcf
->rgbColors
);
963 return GetStockObject(WHITE_BRUSH
);
968 /***********************************************************************
969 * CFn_WMCommand [internal]
971 static LRESULT
CFn_WMCommand(HWND hDlg
, WPARAM wParam
, LPARAM lParam
,
978 LPLOGFONTA lpxx
=lpcf
->lpLogFont
;
980 TRACE("WM_COMMAND wParam=%08lX lParam=%08lX\n", (LONG
)wParam
, lParam
);
981 switch (LOWORD(wParam
))
983 case cmb1
:if (HIWORD(wParam
)==CBN_SELCHANGE
)
985 hdc
=((lpcf
->Flags
& CF_PRINTERFONTS
) && lpcf
->hDC
) ? lpcf
->hDC
: GetDC(hDlg
);
988 SendDlgItemMessageA(hDlg
, cmb2
, CB_RESETCONTENT16
, 0, 0);
989 SendDlgItemMessageA(hDlg
, cmb3
, CB_RESETCONTENT16
, 0, 0);
990 i
=SendDlgItemMessageA(hDlg
, cmb1
, CB_GETCURSEL16
, 0, 0);
993 HCURSOR hcursor
=SetCursor(LoadCursorA(0,IDC_WAITA
));
996 SendDlgItemMessageA(hDlg
, cmb1
, CB_GETLBTEXT
, i
,
998 TRACE("WM_COMMAND/cmb1 =>%s\n",str
);
999 s
.hWnd1
=GetDlgItem(hDlg
, cmb2
);
1000 s
.hWnd2
=GetDlgItem(hDlg
, cmb3
);
1002 EnumFontFamiliesA(hdc
, str
, FontStyleEnumProc
, (LPARAM
)&s
);
1003 SendDlgItemMessageA(hDlg
,cmb2
, CB_SETCURSEL
, 0, 0);
1004 SendDlgItemMessageA(hDlg
,cmb3
, CB_SETCURSEL
, 0, 0);
1007 if (!((lpcf
->Flags
& CF_PRINTERFONTS
) && lpcf
->hDC
))
1008 ReleaseDC(hDlg
,hdc
);
1012 WARN("HDC failure !!!\n");
1013 EndDialog (hDlg
, 0);
1020 case cmb3
:if (HIWORD(wParam
)==CBN_SELCHANGE
|| HIWORD(wParam
)== BN_CLICKED
)
1023 TRACE("WM_COMMAND/cmb2,3 =%08lX\n", lParam
);
1024 i
=SendDlgItemMessageA(hDlg
,cmb1
,CB_GETCURSEL
,0,0);
1026 i
=GetDlgItemTextA( hDlg
, cmb1
, str
, 256 );
1029 SendDlgItemMessageA(hDlg
,cmb1
,CB_GETLBTEXT
,i
,
1031 l
=SendDlgItemMessageA(hDlg
,cmb1
,CB_GETITEMDATA
,i
,0);
1033 lpcf
->nFontType
= LOWORD(l
);
1034 /* FIXME: lpcf->nFontType |= .... SIMULATED_FONTTYPE and so */
1035 /* same value reported to the EnumFonts
1036 call back with the extra FONTTYPE_... bits added */
1037 lpxx
->lfPitchAndFamily
=j
&0xff;
1038 lpxx
->lfCharSet
=j
>>8;
1040 strcpy(lpxx
->lfFaceName
,str
);
1041 i
=SendDlgItemMessageA(hDlg
, cmb2
, CB_GETCURSEL
, 0, 0);
1044 l
=SendDlgItemMessageA(hDlg
, cmb2
, CB_GETITEMDATA
, i
, 0);
1045 if (0!=(lpxx
->lfItalic
=HIWORD(l
)))
1046 lpcf
->nFontType
|= ITALIC_FONTTYPE
;
1047 if ((lpxx
->lfWeight
=LOWORD(l
)) > FW_MEDIUM
)
1048 lpcf
->nFontType
|= BOLD_FONTTYPE
;
1050 i
=SendDlgItemMessageA(hDlg
, cmb3
, CB_GETCURSEL
, 0, 0);
1052 lpxx
->lfHeight
=-LOWORD(SendDlgItemMessageA(hDlg
, cmb3
, CB_GETITEMDATA
, i
, 0));
1055 lpxx
->lfStrikeOut
=IsDlgButtonChecked(hDlg
,chx1
);
1056 lpxx
->lfUnderline
=IsDlgButtonChecked(hDlg
,chx2
);
1057 lpxx
->lfWidth
=lpxx
->lfOrientation
=lpxx
->lfEscapement
=0;
1058 lpxx
->lfOutPrecision
=OUT_DEFAULT_PRECIS
;
1059 lpxx
->lfClipPrecision
=CLIP_DEFAULT_PRECIS
;
1060 lpxx
->lfQuality
=DEFAULT_QUALITY
;
1061 lpcf
->iPointSize
= -10*lpxx
->lfHeight
;
1063 hFont
=CreateFontIndirectA(lpxx
);
1066 HFONT oldFont
=SendDlgItemMessageA(hDlg
, stc6
,
1068 SendDlgItemMessageA(hDlg
,stc6
,WM_SETFONT
,hFont
,TRUE
);
1069 DeleteObject(oldFont
);
1074 case cmb4
:i
=SendDlgItemMessageA(hDlg
, cmb4
, CB_GETCURSEL
, 0, 0);
1077 lpcf
->rgbColors
=textcolors
[i
];
1078 InvalidateRect( GetDlgItem(hDlg
,stc6
), NULL
, 0 );
1082 case psh15
:i
=RegisterWindowMessageA( HELPMSGSTRINGA
);
1083 if (lpcf
->hwndOwner
)
1084 SendMessageA(lpcf
->hwndOwner
, i
, 0, (LPARAM
)GetWindowLongA(hDlg
, DWL_USER
));
1085 /* if (CFn_HookCallChk(lpcf))
1086 CallWindowProc16(lpcf->lpfnHook,hDlg,WM_COMMAND,psh15,(LPARAM)lpcf);*/
1089 case IDOK
:if ( (!(lpcf
->Flags
& CF_LIMITSIZE
)) ||
1090 ( (lpcf
->Flags
& CF_LIMITSIZE
) &&
1091 (-lpxx
->lfHeight
>= lpcf
->nSizeMin
) &&
1092 (-lpxx
->lfHeight
<= lpcf
->nSizeMax
)))
1093 EndDialog(hDlg
, TRUE
);
1097 sprintf(buffer
,"Select a font size between %d and %d points.",
1098 lpcf
->nSizeMin
,lpcf
->nSizeMax
);
1099 MessageBoxA(hDlg
, buffer
, NULL
, MB_OK
);
1102 case IDCANCEL
:EndDialog(hDlg
, FALSE
);
1108 static LRESULT
CFn_WMDestroy(HWND hwnd
, WPARAM wParam
, LPARAM lParam
)
1110 DeleteObject(SendDlgItemMessageA(hwnd
, stc6
, WM_GETFONT
, 0, 0));
1115 /***********************************************************************
1116 * FormatCharDlgProc (COMMDLG.16)
1117 FIXME: 1. some strings are "hardcoded", but it's better load from sysres
1118 2. some CF_.. flags are not supported
1119 3. some TType extensions
1121 LRESULT WINAPI
FormatCharDlgProc16(HWND16 hDlg
, UINT16 message
, WPARAM16 wParam
,
1124 LPCHOOSEFONT16 lpcf
;
1125 LPCHOOSEFONTA lpcf32a
;
1127 if (message
!=WM_INITDIALOG
)
1129 lpcf
=(LPCHOOSEFONT16
)GetWindowLongA(hDlg
, DWL_USER
);
1132 if (CFn_HookCallChk(lpcf
))
1133 res
=CallWindowProc16((WNDPROC16
)lpcf
->lpfnHook
,hDlg
,message
,wParam
,lParam
);
1139 lpcf
=(LPCHOOSEFONT16
)lParam
;
1140 lpcf32a
=(LPCHOOSEFONTA
)lpcf
->lpTemplateName
;
1141 if (!CFn_WMInitDialog(hDlg
, wParam
, lParam
, lpcf32a
))
1143 TRACE("CFn_WMInitDialog returned FALSE\n");
1146 if (CFn_HookCallChk(lpcf
))
1147 return CallWindowProc16((WNDPROC16
)lpcf
->lpfnHook
,hDlg
,WM_INITDIALOG
,wParam
,lParam
);
1149 lpcf32a
=(LPCHOOSEFONTA
)lpcf
->lpTemplateName
;
1152 case WM_MEASUREITEM
:
1154 MEASUREITEMSTRUCT16
* mis16
= MapSL(lParam
);
1155 MEASUREITEMSTRUCT mis
;
1156 mis
.CtlType
= mis16
->CtlType
;
1157 mis
.CtlID
= mis16
->CtlID
;
1158 mis
.itemID
= mis16
->itemID
;
1159 mis
.itemWidth
= mis16
->itemWidth
;
1160 mis
.itemHeight
= mis16
->itemHeight
;
1161 mis
.itemData
= mis16
->itemData
;
1162 res
= CFn_WMMeasureItem(hDlg
, wParam
, (LPARAM
)&mis
);
1163 mis16
->itemWidth
= (UINT16
)mis
.itemWidth
;
1164 mis16
->itemHeight
= (UINT16
)mis
.itemHeight
;
1169 DRAWITEMSTRUCT16
* dis16
= MapSL(lParam
);
1171 dis
.CtlType
= dis16
->CtlType
;
1172 dis
.CtlID
= dis16
->CtlID
;
1173 dis
.itemID
= dis16
->itemID
;
1174 dis
.itemAction
= dis16
->itemAction
;
1175 dis
.itemState
= dis16
->itemState
;
1176 dis
.hwndItem
= dis16
->hwndItem
;
1177 dis
.hDC
= dis16
->hDC
;
1178 dis
.itemData
= dis16
->itemData
;
1179 CONV_RECT16TO32( &dis16
->rcItem
, &dis
.rcItem
);
1180 res
= CFn_WMDrawItem(hDlg
, wParam
, (LPARAM
)&dis
);
1184 if (HIWORD(lParam
) == CTLCOLOR_STATIC
)
1185 res
=CFn_WMCtlColorStatic(hDlg
, (HDC
)wParam
, (HWND
)LOWORD(lParam
), lpcf32a
);
1188 res
=CFn_WMCommand(hDlg
, MAKEWPARAM( wParam
, HIWORD(lParam
) ), LOWORD(lParam
), lpcf32a
);
1191 res
=CFn_WMDestroy(hDlg
, wParam
, lParam
);
1193 case WM_CHOOSEFONT_GETLOGFONT
:
1194 TRACE("WM_CHOOSEFONT_GETLOGFONT lParam=%08lX\n", lParam
);
1195 FIXME("current logfont back to caller\n");
1201 /***********************************************************************
1202 * FormatCharDlgProcA [internal]
1204 LRESULT WINAPI
FormatCharDlgProcA(HWND hDlg
, UINT uMsg
, WPARAM wParam
,
1209 if (uMsg
!=WM_INITDIALOG
)
1211 lpcf
=(LPCHOOSEFONTA
)GetWindowLongA(hDlg
, DWL_USER
);
1214 if (CFn_HookCallChk32(lpcf
))
1215 res
=CallWindowProcA((WNDPROC
)lpcf
->lpfnHook
, hDlg
, uMsg
, wParam
, lParam
);
1221 lpcf
=(LPCHOOSEFONTA
)lParam
;
1222 if (!CFn_WMInitDialog(hDlg
, wParam
, lParam
, lpcf
))
1224 TRACE("CFn_WMInitDialog returned FALSE\n");
1227 if (CFn_HookCallChk32(lpcf
))
1228 return CallWindowProcA((WNDPROC
)lpcf
->lpfnHook
,hDlg
,WM_INITDIALOG
,wParam
,lParam
);
1232 case WM_MEASUREITEM
:
1233 return CFn_WMMeasureItem(hDlg
, wParam
, lParam
);
1235 return CFn_WMDrawItem(hDlg
, wParam
, lParam
);
1236 case WM_CTLCOLORSTATIC
:
1237 return CFn_WMCtlColorStatic(hDlg
, wParam
, lParam
, lpcf
);
1239 return CFn_WMCommand(hDlg
, wParam
, lParam
, lpcf
);
1241 return CFn_WMDestroy(hDlg
, wParam
, lParam
);
1242 case WM_CHOOSEFONT_GETLOGFONT
:
1243 TRACE("WM_CHOOSEFONT_GETLOGFONT lParam=%08lX\n",
1245 FIXME("current logfont back to caller\n");
1251 /***********************************************************************
1252 * FormatCharDlgProcW [internal]
1254 LRESULT WINAPI
FormatCharDlgProcW(HWND hDlg
, UINT uMsg
, WPARAM wParam
,
1257 LPCHOOSEFONTW lpcf32w
;
1258 LPCHOOSEFONTA lpcf32a
;
1260 if (uMsg
!=WM_INITDIALOG
)
1262 lpcf32w
=(LPCHOOSEFONTW
)GetWindowLongA(hDlg
, DWL_USER
);
1265 if (CFn_HookCallChk32((LPCHOOSEFONTA
)lpcf32w
))
1266 res
=CallWindowProcW((WNDPROC
)lpcf32w
->lpfnHook
, hDlg
, uMsg
, wParam
, lParam
);
1272 lpcf32w
=(LPCHOOSEFONTW
)lParam
;
1273 lpcf32a
=(LPCHOOSEFONTA
)lpcf32w
->lpTemplateName
;
1274 if (!CFn_WMInitDialog(hDlg
, wParam
, lParam
, lpcf32a
))
1276 TRACE("CFn_WMInitDialog returned FALSE\n");
1279 if (CFn_HookCallChk32((LPCHOOSEFONTA
)lpcf32w
))
1280 return CallWindowProcW((WNDPROC
)lpcf32w
->lpfnHook
,hDlg
,WM_INITDIALOG
,wParam
,lParam
);
1282 lpcf32a
=(LPCHOOSEFONTA
)lpcf32w
->lpTemplateName
;
1285 case WM_MEASUREITEM
:
1286 return CFn_WMMeasureItem(hDlg
, wParam
, lParam
);
1288 return CFn_WMDrawItem(hDlg
, wParam
, lParam
);
1289 case WM_CTLCOLORSTATIC
:
1290 return CFn_WMCtlColorStatic(hDlg
, wParam
, lParam
, lpcf32a
);
1292 return CFn_WMCommand(hDlg
, wParam
, lParam
, lpcf32a
);
1294 return CFn_WMDestroy(hDlg
, wParam
, lParam
);
1295 case WM_CHOOSEFONT_GETLOGFONT
:
1296 TRACE("WM_CHOOSEFONT_GETLOGFONT lParam=%08lX\n",
1298 FIXME("current logfont back to caller\n");