comdlg32: Reimplement the 16-bit font dialog on top of the 32-bit one.

Stub out the functionality that cannot be supported that way.
This commit is contained in:
Alexandre Julliard 2009-11-12 18:36:43 +01:00
parent 459a0c4de9
commit e5a09cffeb
3 changed files with 90 additions and 351 deletions

View file

@ -206,29 +206,4 @@ int CC_HSLtoRGB(char c, int hue, int sat, int lum);
void CC_EditSetRGB( HWND hDlg, COLORREF cr );
void CC_PaintUserColorArray( HWND hDlg, int rows, int cols, const COLORREF* lpcr );
typedef struct
{
HWND hWnd1;
HWND hWnd2;
LPCHOOSEFONTW lpcf32w;
int added;
} CFn_ENUMSTRUCT, *LPCFn_ENUMSTRUCT;
INT AddFontFamily(const ENUMLOGFONTEXW *lpElfex, const NEWTEXTMETRICEXW *lpNTM,
UINT nFontType, const CHOOSEFONTW *lpcf, HWND hwnd,
LPCFn_ENUMSTRUCT e);
INT AddFontStyle(const ENUMLOGFONTEXW *lpElfex, const NEWTEXTMETRICEXW *metrics,
UINT nFontType, const CHOOSEFONTW *lpcf, HWND hcmb2, HWND hcmb3,
HWND hDlg, BOOL iswin16);
void _dump_cf_flags(DWORD cflags);
LRESULT CFn_WMInitDialog(HWND hDlg, WPARAM wParam, LPARAM lParam,
LPCHOOSEFONTW lpcf);
LRESULT CFn_WMMeasureItem(HWND hDlg, WPARAM wParam, LPARAM lParam);
LRESULT CFn_WMDrawItem(HWND hDlg, WPARAM wParam, LPARAM lParam);
LRESULT CFn_WMCommand(HWND hDlg, WPARAM wParam, LPARAM lParam,
LPCHOOSEFONTW lpcf);
LRESULT CFn_WMPaint(HWND hDlg, WPARAM wParam, LPARAM lParam,
const CHOOSEFONTW *lpcf);
#endif /* _WINE_DLL_CDLG_H */

View file

@ -33,16 +33,24 @@
#include "dlgs.h"
#include "wine/debug.h"
#include "cderr.h"
#include "cdlg.h"
WINE_DEFAULT_DEBUG_CHANNEL(commdlg);
typedef struct
{
HWND hWnd1;
HWND hWnd2;
LPCHOOSEFONTW lpcf32w;
int added;
} CFn_ENUMSTRUCT, *LPCFn_ENUMSTRUCT;
static const WCHAR strWineFontData[] = {'_','_','W','I','N','E','_','F','O','N','T','D','L','G','D','A','T','A',0};
static const WCHAR strWineFontData_a[] =
{'_','_','W','I','N','E','_','F','O','N','T','D','L','G','D','A','T','A','_','A',0};
static const WCHAR chooseFontW[] = {'C','H','O','O','S','E','_','F','O','N','T',0};
#include "cdlg.h"
/* image list with TrueType bitmaps and more */
static HIMAGELIST himlTT = 0;
#define TTBITMAP_XSIZE 20 /* x-size of the bitmaps */
@ -148,7 +156,7 @@ static const struct {
#undef XX
};
void _dump_cf_flags(DWORD cflags)
static void _dump_cf_flags(DWORD cflags)
{
unsigned int i;
@ -299,8 +307,8 @@ static BOOL CFn_HookCallChk32(const CHOOSEFONTW *lpcf)
/*************************************************************************
* AddFontFamily [internal]
*/
INT AddFontFamily(const ENUMLOGFONTEXW *lpElfex, const NEWTEXTMETRICEXW *lpNTM,
UINT nFontType, const CHOOSEFONTW *lpcf, HWND hwnd, LPCFn_ENUMSTRUCT e)
static INT AddFontFamily(const ENUMLOGFONTEXW *lpElfex, const NEWTEXTMETRICEXW *lpNTM,
UINT nFontType, const CHOOSEFONTW *lpcf, HWND hwnd, LPCFn_ENUMSTRUCT e)
{
int i;
WORD w;
@ -459,9 +467,8 @@ static inline void CFn_ReleaseDC(const CHOOSEFONTW *lpcf, HDC hdc)
/***********************************************************************
* AddFontStyle [internal]
*/
INT AddFontStyle( const ENUMLOGFONTEXW *lpElfex, const NEWTEXTMETRICEXW *lpNTM,
UINT nFontType, const CHOOSEFONTW *lpcf, HWND hcmb2, HWND hcmb3,
HWND hDlg, BOOL iswin16)
static INT AddFontStyle( const ENUMLOGFONTEXW *lpElfex, const NEWTEXTMETRICEXW *lpNTM,
UINT nFontType, const CHOOSEFONTW *lpcf, HWND hcmb2, HWND hcmb3, HWND hDlg)
{
int i;
const LOGFONTW *lplf = &(lpElfex->elfLogFont);
@ -495,7 +502,7 @@ INT AddFontStyle( const ENUMLOGFONTEXW *lpElfex, const NEWTEXTMETRICEXW *lpNTM,
if (i)
return 0;
}
if( iswin16 || !( hcmb5 = GetDlgItem(hDlg, cmb5))) return 1;
if (!( hcmb5 = GetDlgItem(hDlg, cmb5))) return 1;
i = SendMessageW( hcmb5, CB_FINDSTRINGEXACT, 0,
(LPARAM)lpElfex->elfScript);
if( i == CB_ERR) {
@ -584,14 +591,13 @@ static INT WINAPI FontStyleEnumProc( const ENUMLOGFONTEXW *lpElfex,
HWND hcmb3=s->hWnd2;
HWND hDlg=GetParent(hcmb3);
return AddFontStyle( lpElfex, (const NEWTEXTMETRICEXW *) metrics,
dwFontType, s->lpcf32w, hcmb2, hcmb3, hDlg, FALSE);
dwFontType, s->lpcf32w, hcmb2, hcmb3, hDlg);
}
/***********************************************************************
* CFn_WMInitDialog [internal]
*/
LRESULT CFn_WMInitDialog(HWND hDlg, WPARAM wParam, LPARAM lParam,
LPCHOOSEFONTW lpcf)
static LRESULT CFn_WMInitDialog(HWND hDlg, WPARAM wParam, LPARAM lParam, LPCHOOSEFONTW lpcf)
{
HDC hdc;
int i,j,init=0;
@ -747,7 +753,7 @@ LRESULT CFn_WMInitDialog(HWND hDlg, WPARAM wParam, LPARAM lParam,
/***********************************************************************
* CFn_WMMeasureItem [internal]
*/
LRESULT CFn_WMMeasureItem(HWND hDlg, WPARAM wParam, LPARAM lParam)
static LRESULT CFn_WMMeasureItem(HWND hDlg, WPARAM wParam, LPARAM lParam)
{
HDC hdc;
HFONT hfontprev;
@ -775,7 +781,7 @@ LRESULT CFn_WMMeasureItem(HWND hDlg, WPARAM wParam, LPARAM lParam)
/***********************************************************************
* CFn_WMDrawItem [internal]
*/
LRESULT CFn_WMDrawItem(HWND hDlg, WPARAM wParam, LPARAM lParam)
static LRESULT CFn_WMDrawItem(HWND hDlg, WPARAM wParam, LPARAM lParam)
{
HBRUSH hBrush;
WCHAR buffer[40];
@ -879,8 +885,7 @@ LRESULT CFn_WMDrawItem(HWND hDlg, WPARAM wParam, LPARAM lParam)
/***********************************************************************
* CFn_WMCommand [internal]
*/
LRESULT CFn_WMCommand(HWND hDlg, WPARAM wParam, LPARAM lParam,
LPCHOOSEFONTW lpcf)
static LRESULT CFn_WMCommand(HWND hDlg, WPARAM wParam, LPARAM lParam, LPCHOOSEFONTW lpcf)
{
int i;
long l;
@ -1028,8 +1033,6 @@ LRESULT CFn_WMCommand(HWND hDlg, WPARAM wParam, LPARAM lParam,
i=RegisterWindowMessageW( HELPMSGSTRINGW );
if (lpcf->hwndOwner)
SendMessageW(lpcf->hwndOwner, i, 0, (LPARAM)GetPropW(hDlg, strWineFontData));
/* if (CFn_HookCallChk(lpcf))
CallWindowProc16(lpcf->lpfnHook,hDlg,WM_COMMAND,psh15,(LPARAM)lpcf);*/
break;
case IDOK:
@ -1084,7 +1087,7 @@ static LRESULT CFn_WMDestroy(HWND hwnd, WPARAM wParam, LPARAM lParam, LPCHOOSEFO
return TRUE;
}
LRESULT CFn_WMPaint(HWND hDlg, WPARAM wParam, LPARAM lParam, const CHOOSEFONTW *lpcf)
static LRESULT CFn_WMPaint(HWND hDlg, WPARAM wParam, LPARAM lParam, const CHOOSEFONTW *lpcf)
{
WINDOWINFO info;
@ -1137,8 +1140,7 @@ LRESULT CFn_WMPaint(HWND hDlg, WPARAM wParam, LPARAM lParam, const CHOOSEFONTW *
/***********************************************************************
* FormatCharDlgProcA [internal]
*/
INT_PTR CALLBACK FormatCharDlgProcA(HWND hDlg, UINT uMsg, WPARAM wParam,
LPARAM lParam)
static INT_PTR CALLBACK FormatCharDlgProcA(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
LPCHOOSEFONTW lpcfw;
LPCHOOSEFONTA lpcfa;
@ -1201,8 +1203,7 @@ INT_PTR CALLBACK FormatCharDlgProcA(HWND hDlg, UINT uMsg, WPARAM wParam,
/***********************************************************************
* FormatCharDlgProcW [internal]
*/
INT_PTR CALLBACK FormatCharDlgProcW(HWND hDlg, UINT uMsg, WPARAM wParam,
LPARAM lParam)
static INT_PTR CALLBACK FormatCharDlgProcW(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
LPCHOOSEFONTW lpcf;
INT_PTR res = FALSE;

View file

@ -28,93 +28,14 @@
#include "winbase.h"
#include "wingdi.h"
#include "winuser.h"
#include "winnls.h"
#include "wine/winbase16.h"
#include "wine/winuser16.h"
#include "commdlg.h"
#include "wine/debug.h"
#include "cderr.h"
WINE_DEFAULT_DEBUG_CHANNEL(commdlg);
#include "cdlg.h"
#include "cdlg16.h"
static const WCHAR strWineFontData16[] =
{'_','_','W','I','N','E','_','F','O','N','T','D','L','G','D','A','T','A','1','6',0};
static void FONT_LogFont16To32W( const LOGFONT16 *font16, LPLOGFONTW font32 )
{
font32->lfHeight = font16->lfHeight;
font32->lfWidth = font16->lfWidth;
font32->lfEscapement = font16->lfEscapement;
font32->lfOrientation = font16->lfOrientation;
font32->lfWeight = font16->lfWeight;
font32->lfItalic = font16->lfItalic;
font32->lfUnderline = font16->lfUnderline;
font32->lfStrikeOut = font16->lfStrikeOut;
font32->lfCharSet = font16->lfCharSet;
font32->lfOutPrecision = font16->lfOutPrecision;
font32->lfClipPrecision = font16->lfClipPrecision;
font32->lfQuality = font16->lfQuality;
font32->lfPitchAndFamily = font16->lfPitchAndFamily;
MultiByteToWideChar(CP_ACP, 0, font16->lfFaceName,
LF_FACESIZE, font32->lfFaceName, LF_FACESIZE);
}
static void FONT_Metrics16To32W( const TEXTMETRIC16 *pm16,
NEWTEXTMETRICEXW *pnm32w)
{
ZeroMemory( pnm32w, sizeof(NEWTEXTMETRICEXW));
/* NOTE: only the fields used by AddFontStyle() are filled in */
pnm32w->ntmTm.tmHeight = pm16->tmHeight;
pnm32w->ntmTm.tmExternalLeading = pm16->tmExternalLeading;
}
static void CFn_CHOOSEFONT16to32W(const CHOOSEFONT16 *chf16, LPCHOOSEFONTW chf32w)
{
int len;
if (chf16->Flags & CF_ENABLETEMPLATE)
{
LPWSTR name32w;
len = MultiByteToWideChar( CP_ACP, 0, MapSL(chf16->lpTemplateName), -1, NULL, 0);
name32w = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR));
MultiByteToWideChar( CP_ACP, 0, MapSL(chf16->lpTemplateName), -1, name32w, len);
chf32w->lpTemplateName = name32w;
}
if (chf16->Flags & CF_USESTYLE)
{
len = MultiByteToWideChar( CP_ACP, 0, MapSL(chf16->lpszStyle), -1, NULL, 0);
chf32w->lpszStyle = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR));
MultiByteToWideChar( CP_ACP, 0, MapSL(chf16->lpszStyle), -1, chf32w->lpszStyle, len);
}
chf32w->lStructSize=sizeof(CHOOSEFONTW);
chf32w->hwndOwner=HWND_32(chf16->hwndOwner);
chf32w->hDC=HDC_32(chf16->hDC);
chf32w->iPointSize=chf16->iPointSize;
chf32w->Flags=chf16->Flags;
chf32w->rgbColors=chf16->rgbColors;
chf32w->lCustData=chf16->lCustData;
chf32w->lpfnHook=NULL;
chf32w->hInstance=HINSTANCE_32(chf16->hInstance);
chf32w->nFontType=chf16->nFontType;
chf32w->nSizeMax=chf16->nSizeMax;
chf32w->nSizeMin=chf16->nSizeMin;
FONT_LogFont16To32W(MapSL(chf16->lpLogFont), chf32w->lpLogFont);
}
/***********************************************************************
* CFn_HookCallChk [internal]
*/
static BOOL CFn_HookCallChk(const CHOOSEFONT16 *lpcf)
{
if (lpcf)
if(lpcf->Flags & CF_ENABLEHOOK)
if (lpcf->lpfnHook)
return TRUE;
return FALSE;
}
WINE_DEFAULT_DEBUG_CHANNEL(commdlg);
/***********************************************************************
* FontFamilyEnumProc (COMMDLG.19)
@ -122,19 +43,8 @@ static BOOL CFn_HookCallChk(const CHOOSEFONT16 *lpcf)
INT16 WINAPI FontFamilyEnumProc16( SEGPTR logfont, SEGPTR metrics,
UINT16 nFontType, LPARAM lParam )
{
HWND hwnd=HWND_32(LOWORD(lParam));
HWND hDlg=GetParent(hwnd);
LPCHOOSEFONT16 lpcf;
LOGFONT16 *lplf = MapSL( logfont );
TEXTMETRIC16 *lpmtrx16 = MapSL(metrics);
ENUMLOGFONTEXW elf32w;
NEWTEXTMETRICEXW nmtrx32w;
lpcf = (LPCHOOSEFONT16)GetPropW(hDlg, strWineFontData16);
FONT_LogFont16To32W(lplf, &(elf32w.elfLogFont));
FONT_Metrics16To32W(lpmtrx16, &nmtrx32w);
return AddFontFamily(&elf32w, &nmtrx32w, nFontType,
(LPCHOOSEFONTW)lpcf->lpTemplateName, hwnd,NULL);
FIXME( "%08x %08x %u %lx\n", logfont, metrics, nFontType, lParam );
return 0;
}
/***********************************************************************
@ -143,20 +53,8 @@ INT16 WINAPI FontFamilyEnumProc16( SEGPTR logfont, SEGPTR metrics,
INT16 WINAPI FontStyleEnumProc16( SEGPTR logfont, SEGPTR metrics,
UINT16 nFontType, LPARAM lParam )
{
HWND hcmb2=HWND_32(LOWORD(lParam));
HWND hcmb3=HWND_32(HIWORD(lParam));
HWND hDlg=GetParent(hcmb3);
LPCHOOSEFONT16 lpcf;
LOGFONT16 *lplf = MapSL(logfont);
TEXTMETRIC16 *lpmtrx16 = MapSL(metrics);
ENUMLOGFONTEXW elf32w;
NEWTEXTMETRICEXW nmtrx32w;
lpcf = (LPCHOOSEFONT16)GetPropW(hDlg, strWineFontData16);
FONT_LogFont16To32W(lplf, &(elf32w.elfLogFont));
FONT_Metrics16To32W(lpmtrx16, &nmtrx32w);
return AddFontStyle(&elf32w, &nmtrx32w, nFontType,
(LPCHOOSEFONTW)lpcf->lpTemplateName, hcmb2, hcmb3, hDlg, TRUE);
FIXME( "%08x %08x %u %lx\n", logfont, metrics, nFontType, lParam );
return 0;
}
/***********************************************************************
@ -164,132 +62,71 @@ INT16 WINAPI FontStyleEnumProc16( SEGPTR logfont, SEGPTR metrics,
*/
BOOL16 WINAPI ChooseFont16(LPCHOOSEFONT16 lpChFont)
{
HINSTANCE16 hInst;
HANDLE16 hDlgTmpl16 = 0;
HGLOBAL16 hGlobal16 = 0;
BOOL16 bRet = FALSE;
LPVOID template;
FARPROC16 ptr;
CHOOSEFONTW cf32w;
LOGFONTW lf32w;
CHOOSEFONTA cf32;
LOGFONTA lf32;
LOGFONT16 *font16;
SEGPTR lpTemplateName;
TRACE("ChooseFont\n");
if (!lpChFont) return FALSE;
cf32w.lpLogFont=&lf32w;
CFn_CHOOSEFONT16to32W(lpChFont, &cf32w);
if (TRACE_ON(commdlg))
_dump_cf_flags(lpChFont->Flags);
if (lpChFont->Flags & CF_ENABLETEMPLATEHANDLE)
{
if (!LockResource16( lpChFont->hInstance ))
{
COMDLG32_SetCommDlgExtendedError(CDERR_LOADRESFAILURE);
return FALSE;
}
}
else if (lpChFont->Flags & CF_ENABLETEMPLATE)
{
HANDLE16 hResInfo;
if (!(hResInfo = FindResource16( lpChFont->hInstance,
MapSL(lpChFont->lpTemplateName),
(LPSTR)RT_DIALOG)))
{
COMDLG32_SetCommDlgExtendedError(CDERR_FINDRESFAILURE);
return FALSE;
}
if (!(hDlgTmpl16 = LoadResource16( lpChFont->hInstance, hResInfo )) ||
!LockResource16( hDlgTmpl16 ))
{
COMDLG32_SetCommDlgExtendedError(CDERR_LOADRESFAILURE);
return FALSE;
}
}
else
{
HRSRC hResInfo;
HGLOBAL hDlgTmpl32;
LPCVOID template32;
DWORD size;
if (!(hResInfo = FindResourceA(COMDLG32_hInstance, "CHOOSE_FONT", (LPSTR)RT_DIALOG)))
{
COMDLG32_SetCommDlgExtendedError(CDERR_FINDRESFAILURE);
return FALSE;
}
if (!(hDlgTmpl32 = LoadResource(COMDLG32_hInstance, hResInfo)) ||
!(template32 = LockResource(hDlgTmpl32)))
{
COMDLG32_SetCommDlgExtendedError(CDERR_LOADRESFAILURE);
return FALSE;
}
size = SizeofResource(COMDLG32_hInstance, hResInfo);
hGlobal16 = GlobalAlloc16(0, size);
if (!hGlobal16)
{
COMDLG32_SetCommDlgExtendedError(CDERR_MEMALLOCFAILURE);
ERR("alloc failure for %d bytes\n", size);
return FALSE;
}
template = GlobalLock16(hGlobal16);
if (!template)
{
COMDLG32_SetCommDlgExtendedError(CDERR_MEMLOCKFAILURE);
ERR("global lock failure for %x handle\n", hGlobal16);
GlobalFree16(hGlobal16);
return FALSE;
}
ConvertDialog32To16(template32, size, template);
hDlgTmpl16 = hGlobal16;
}
/* lpTemplateName is not used in the dialog */
lpTemplateName=lpChFont->lpTemplateName;
lpChFont->lpTemplateName=(SEGPTR)&cf32w;
ptr = GetProcAddress16(GetModuleHandle16("COMMDLG"), (LPCSTR) 16);
hInst = GetWindowLongPtrA(HWND_32(lpChFont->hwndOwner), GWLP_HINSTANCE);
bRet = DialogBoxIndirectParam16(hInst, hDlgTmpl16, lpChFont->hwndOwner,
(DLGPROC16) ptr, (DWORD)lpChFont);
if (hGlobal16)
{
GlobalUnlock16(hGlobal16);
GlobalFree16(hGlobal16);
}
lpChFont->lpTemplateName=lpTemplateName;
lpChFont->iPointSize = cf32w.iPointSize;
lpChFont->Flags = cf32w.Flags;
lpChFont->rgbColors = cf32w.rgbColors;
lpChFont->lCustData = cf32w.lCustData;
lpChFont->nFontType = cf32w.nFontType;
font16 = MapSL(lpChFont->lpLogFont);
font16->lfHeight = cf32w.lpLogFont->lfHeight;
font16->lfWidth = cf32w.lpLogFont->lfWidth;
font16->lfEscapement = cf32w.lpLogFont->lfEscapement;
font16->lfOrientation = cf32w.lpLogFont->lfOrientation;
font16->lfWeight = cf32w.lpLogFont->lfWeight;
font16->lfItalic = cf32w.lpLogFont->lfItalic;
font16->lfUnderline = cf32w.lpLogFont->lfUnderline;
font16->lfStrikeOut = cf32w.lpLogFont->lfStrikeOut;
font16->lfCharSet = cf32w.lpLogFont->lfCharSet;
font16->lfOutPrecision = cf32w.lpLogFont->lfOutPrecision;
font16->lfClipPrecision = cf32w.lpLogFont->lfClipPrecision;
font16->lfQuality = cf32w.lpLogFont->lfQuality;
font16->lfPitchAndFamily = cf32w.lpLogFont->lfPitchAndFamily;
WideCharToMultiByte(CP_ACP, 0, cf32w.lpLogFont->lfFaceName,
LF_FACESIZE, font16->lfFaceName, LF_FACESIZE, 0, 0);
HeapFree(GetProcessHeap(), 0, (LPBYTE)cf32w.lpTemplateName);
HeapFree(GetProcessHeap(), 0, cf32w.lpszStyle);
cf32.lStructSize = sizeof(CHOOSEFONTW);
cf32.hwndOwner = HWND_32(lpChFont->hwndOwner);
cf32.hDC = HDC_32(lpChFont->hDC);
cf32.iPointSize = lpChFont->iPointSize;
cf32.Flags = lpChFont->Flags & ~(CF_ENABLETEMPLATEHANDLE | CF_ENABLETEMPLATE);
cf32.rgbColors = lpChFont->rgbColors;
cf32.lCustData = lpChFont->lCustData;
cf32.lpfnHook = NULL;
cf32.hInstance = GetModuleHandleA("comdlg32.dll");
cf32.nFontType = lpChFont->nFontType;
cf32.nSizeMax = lpChFont->nSizeMax;
cf32.nSizeMin = lpChFont->nSizeMin;
cf32.lpLogFont = &lf32;
return bRet;
lf32.lfHeight = font16->lfHeight;
lf32.lfWidth = font16->lfWidth;
lf32.lfEscapement = font16->lfEscapement;
lf32.lfOrientation = font16->lfOrientation;
lf32.lfWeight = font16->lfWeight;
lf32.lfItalic = font16->lfItalic;
lf32.lfUnderline = font16->lfUnderline;
lf32.lfStrikeOut = font16->lfStrikeOut;
lf32.lfCharSet = font16->lfCharSet;
lf32.lfOutPrecision = font16->lfOutPrecision;
lf32.lfClipPrecision = font16->lfClipPrecision;
lf32.lfQuality = font16->lfQuality;
lf32.lfPitchAndFamily = font16->lfPitchAndFamily;
lstrcpynA( lf32.lfFaceName, font16->lfFaceName, LF_FACESIZE );
if (lpChFont->Flags & (CF_ENABLETEMPLATEHANDLE | CF_ENABLETEMPLATE))
FIXME( "custom templates no longer supported, using default\n" );
if (lpChFont->lpfnHook)
FIXME( "custom hook %p no longer supported\n", lpChFont->lpfnHook );
if (!ChooseFontA( &cf32 )) return FALSE;
lpChFont->iPointSize = cf32.iPointSize;
lpChFont->Flags = cf32.Flags;
lpChFont->rgbColors = cf32.rgbColors;
lpChFont->lCustData = cf32.lCustData;
lpChFont->nFontType = cf32.nFontType;
font16->lfHeight = lf32.lfHeight;
font16->lfWidth = lf32.lfWidth;
font16->lfEscapement = lf32.lfEscapement;
font16->lfOrientation = lf32.lfOrientation;
font16->lfWeight = lf32.lfWeight;
font16->lfItalic = lf32.lfItalic;
font16->lfUnderline = lf32.lfUnderline;
font16->lfStrikeOut = lf32.lfStrikeOut;
font16->lfCharSet = lf32.lfCharSet;
font16->lfOutPrecision = lf32.lfOutPrecision;
font16->lfClipPrecision = lf32.lfClipPrecision;
font16->lfQuality = lf32.lfQuality;
font16->lfPitchAndFamily = lf32.lfPitchAndFamily;
lstrcpynA( font16->lfFaceName, lf32.lfFaceName, LF_FACESIZE );
return TRUE;
}
/***********************************************************************
@ -301,80 +138,6 @@ BOOL16 WINAPI ChooseFont16(LPCHOOSEFONT16 lpChFont)
BOOL16 CALLBACK FormatCharDlgProc16(HWND16 hDlg16, UINT16 message,
WPARAM16 wParam, LPARAM lParam)
{
HWND hDlg = HWND_32(hDlg16);
LPCHOOSEFONT16 lpcf;
BOOL16 res=0;
if (message!=WM_INITDIALOG)
{
lpcf = (LPCHOOSEFONT16)GetPropW(hDlg, strWineFontData16);
if (!lpcf)
return FALSE;
if (CFn_HookCallChk(lpcf))
res=CallWindowProc16((WNDPROC16)lpcf->lpfnHook,hDlg16,message,wParam,lParam);
if (res)
return res;
}
else
{
lpcf=(LPCHOOSEFONT16)lParam;
if (!CFn_WMInitDialog(hDlg, wParam, lParam, (LPCHOOSEFONTW)lpcf->lpTemplateName))
{
TRACE("CFn_WMInitDialog returned FALSE\n");
return FALSE;
}
SetPropW(hDlg, strWineFontData16, (HANDLE)lParam);
if (CFn_HookCallChk(lpcf))
return CallWindowProc16((WNDPROC16)lpcf->lpfnHook,hDlg16,WM_INITDIALOG,wParam,lParam);
}
switch (message)
{
case WM_MEASUREITEM:
{
MEASUREITEMSTRUCT16* mis16 = MapSL(lParam);
MEASUREITEMSTRUCT mis;
mis.CtlType = mis16->CtlType;
mis.CtlID = mis16->CtlID;
mis.itemID = mis16->itemID;
mis.itemWidth = mis16->itemWidth;
mis.itemHeight = mis16->itemHeight;
mis.itemData = mis16->itemData;
res = CFn_WMMeasureItem(hDlg, wParam, (LPARAM)&mis);
mis16->itemWidth = (UINT16)mis.itemWidth;
mis16->itemHeight = (UINT16)mis.itemHeight;
}
break;
case WM_DRAWITEM:
{
DRAWITEMSTRUCT16* dis16 = MapSL(lParam);
DRAWITEMSTRUCT dis;
dis.CtlType = dis16->CtlType;
dis.CtlID = dis16->CtlID;
dis.itemID = dis16->itemID;
dis.itemAction = dis16->itemAction;
dis.itemState = dis16->itemState;
dis.hwndItem = HWND_32(dis16->hwndItem);
dis.hDC = HDC_32(dis16->hDC);
dis.itemData = dis16->itemData;
dis.rcItem.left = dis16->rcItem.left;
dis.rcItem.top = dis16->rcItem.top;
dis.rcItem.right = dis16->rcItem.right;
dis.rcItem.bottom = dis16->rcItem.bottom;
res = CFn_WMDrawItem(hDlg, wParam, (LPARAM)&dis);
}
break;
case WM_COMMAND:
res=CFn_WMCommand(hDlg, MAKEWPARAM( wParam, HIWORD(lParam) ), LOWORD(lParam),
(LPCHOOSEFONTW)lpcf->lpTemplateName);
break;
case WM_DESTROY:
return TRUE;
case WM_CHOOSEFONT_GETLOGFONT:
TRACE("WM_CHOOSEFONT_GETLOGFONT lParam=%08lX\n", lParam);
FIXME("current logfont back to caller\n");
break;
case WM_PAINT:
res= CFn_WMPaint(hDlg, wParam, lParam, (LPCHOOSEFONTW)lpcf->lpTemplateName);
break;
}
return res;
FIXME( "%04x %04x %04x %08lx: stub\n", hDlg16, message, wParam, lParam );
return FALSE;
}