Fix a few bugs in the font dialog
Mike Hearn
mh at codeweavers.com
Fri Feb 11 11:51:22 CST 2005
That code really needs a lot of loving. This patch fixes a crash in PE
Explorer, which works very well indeed! Even my usual optimistic self
was pleasantly surprised.
Only remaining issues are that it needs Windows fonts to lay its UI out
without overlap, and the window is created without minimize/maximize
buttons for some reason. Oh, and HTML help. None of them get in the way
of using the app.
ChangeLog:
Respect the flags member of the CHOOSEFONT structure, and don't attempt
to process bogus strings
-------------- next part --------------
--- dlls/commdlg/fontdlg.c (revision 132)
+++ dlls/commdlg/fontdlg.c (local)
@@ -697,7 +697,7 @@ LRESULT CFn_WMInitDialog(HWND hDlg, WPAR
SendMessageW(hDlg, WM_COMMAND, MAKEWPARAM(cmb1, CBN_SELCHANGE),
(LPARAM)GetDlgItem(hDlg,cmb1));
}
- if (lpcf->Flags & CF_USESTYLE && lpcf->lpszStyle)
+ if ((lpcf->Flags & CF_USESTYLE) && lpcf->lpszStyle)
{
j=SendDlgItemMessageW(hDlg,cmb2,CB_FINDSTRING,-1,(LONG)lpcf->lpszStyle);
if (j!=CB_ERR)
@@ -1041,7 +1041,7 @@ LRESULT CFn_WMDestroy(HWND hwnd, WPARAM
WideCharToMultiByte(CP_ACP, 0, lpcfw->lpLogFont->lfFaceName,
LF_FACESIZE, lpcfa->lpLogFont->lfFaceName, LF_FACESIZE, 0, 0);
- if(lpcfw->lpszStyle) {
+ if((lpcfw->Flags & CF_USESTYLE) && lpcfw->lpszStyle) {
len = WideCharToMultiByte(CP_ACP, 0, lpcfw->lpszStyle, -1, NULL, -1, 0, 0);
WideCharToMultiByte(CP_ACP, 0, lpcfw->lpszStyle, -1, lpcfa->lpszStyle, len, 0, 0);
HeapFree(GetProcessHeap(), 0, lpcfw->lpszStyle);
@@ -1135,13 +1135,13 @@ INT_PTR CALLBACK FormatCharDlgProcA(HWND
MultiByteToWideChar(CP_ACP, 0, lpcfa->lpLogFont->lfFaceName,
LF_FACESIZE, lpcfw->lpLogFont->lfFaceName, LF_FACESIZE);
- if(lpcfa->lpszStyle) {
+ if((lpcfa->Flags & CF_USESTYLE) && lpcfa->lpszStyle) {
len = MultiByteToWideChar(CP_ACP, 0, lpcfa->lpszStyle, -1, NULL, 0);
lpcfw->lpszStyle = HeapAlloc(GetProcessHeap(), 0, len*sizeof(WCHAR));
MultiByteToWideChar(CP_ACP, 0, lpcfa->lpszStyle, -1, lpcfw->lpszStyle, len);
}
- if(lpcfa->lpTemplateName) {
+ if((lpcfa->Flags & CF_ENABLETEMPLATE) && lpcfa->lpTemplateName) {
len = MultiByteToWideChar(CP_ACP, 0, lpcfa->lpTemplateName, -1, NULL, 0);
lpcfw->lpTemplateName = HeapAlloc(GetProcessHeap(), 0, len*sizeof(WCHAR));
MultiByteToWideChar(CP_ACP, 0, lpcfa->lpTemplateName,
More information about the wine-patches
mailing list