1999-02-28 21:05:11 +01:00
|
|
|
/*
|
|
|
|
* COMMDLG - Font Dialog
|
|
|
|
*
|
|
|
|
* Copyright 1994 Martin Ayotte
|
|
|
|
* Copyright 1996 Albrecht Kleine
|
2002-03-10 00:29:33 +01:00
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, write to the Free Software
|
2006-05-18 14:49:52 +02:00
|
|
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
1999-02-28 21:05:11 +01:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include <ctype.h>
|
|
|
|
#include <stdlib.h>
|
2003-09-06 01:08:26 +02:00
|
|
|
#include <stdarg.h>
|
2000-02-10 20:03:02 +01:00
|
|
|
#include <stdio.h>
|
1999-02-28 21:05:11 +01:00
|
|
|
#include <string.h>
|
2000-02-10 20:03:02 +01:00
|
|
|
#include "windef.h"
|
1999-02-28 21:05:11 +01:00
|
|
|
#include "winbase.h"
|
2003-08-20 20:22:31 +02:00
|
|
|
#include "winnls.h"
|
2000-02-10 20:03:02 +01:00
|
|
|
#include "wingdi.h"
|
2003-09-06 01:08:26 +02:00
|
|
|
#include "winuser.h"
|
1999-02-28 21:05:11 +01:00
|
|
|
#include "commdlg.h"
|
|
|
|
#include "dlgs.h"
|
2002-03-10 00:29:33 +01:00
|
|
|
#include "wine/debug.h"
|
2018-03-20 08:37:47 +01:00
|
|
|
#include "wine/heap.h"
|
1999-03-13 18:07:56 +01:00
|
|
|
#include "cderr.h"
|
2009-11-12 18:36:43 +01:00
|
|
|
#include "cdlg.h"
|
1999-02-28 21:05:11 +01:00
|
|
|
|
2002-03-10 00:29:33 +01:00
|
|
|
WINE_DEFAULT_DEBUG_CHANNEL(commdlg);
|
1999-04-19 16:56:29 +02:00
|
|
|
|
2009-11-12 18:36:43 +01:00
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
HWND hWnd1;
|
|
|
|
HWND hWnd2;
|
|
|
|
LPCHOOSEFONTW lpcf32w;
|
|
|
|
int added;
|
|
|
|
} CFn_ENUMSTRUCT, *LPCFn_ENUMSTRUCT;
|
|
|
|
|
|
|
|
|
2004-12-22 18:17:06 +01:00
|
|
|
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};
|
2015-12-21 23:19:32 +01:00
|
|
|
static const WCHAR fontsizefmtW[] = {'%','d',0};
|
2003-12-30 20:15:43 +01:00
|
|
|
|
2003-12-30 23:08:17 +01:00
|
|
|
/* image list with TrueType bitmaps and more */
|
|
|
|
static HIMAGELIST himlTT = 0;
|
|
|
|
#define TTBITMAP_XSIZE 20 /* x-size of the bitmaps */
|
1999-02-28 21:05:11 +01:00
|
|
|
|
2007-01-03 14:47:44 +01:00
|
|
|
static INT_PTR CALLBACK FormatCharDlgProcA(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
|
|
|
|
static INT_PTR CALLBACK FormatCharDlgProcW(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
|
1999-02-28 21:05:11 +01:00
|
|
|
|
2003-02-15 01:02:24 +01:00
|
|
|
/* There is a table here of all charsets, and the sample text for each.
|
|
|
|
* There is a second table that translates a charset into an index into
|
|
|
|
* the first table.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#define CI(cs) ((IDS_CHARSET_##cs)-IDS_CHARSET_ANSI)
|
2003-12-01 23:40:56 +01:00
|
|
|
|
|
|
|
|
|
|
|
static const WCHAR stWestern[]={'A','a','B','b','Y','y','Z','z',0}; /* Western and default */
|
|
|
|
static const WCHAR stSymbol[]={'S','y','m','b','o','l',0}; /* Symbol */
|
|
|
|
static const WCHAR stShiftJis[]={'A','a',0x3042,0x3041,0x30a2,0x30a1,0x4e9c,0x5b87,0}; /* Shift JIS */
|
|
|
|
static const WCHAR stHangul[]={0xac00,0xb098,0xb2e4,'A','a','B','Y','y','Z','z',0}; /* Hangul */
|
|
|
|
static const WCHAR stGB2312[]={0x5fae,0x8f6f,0x4e2d,0x6587,0x8f6f,0x4ef6,0}; /* GB2312 */
|
|
|
|
static const WCHAR stBIG5[]={0x4e2d,0x6587,0x5b57,0x578b,0x7bc4,0x4f8b,0}; /* BIG5 */
|
|
|
|
static const WCHAR stGreek[]={'A','a','B','b',0x0391,0x03b1,0x0392,0x03b2,0}; /* Greek */
|
|
|
|
static const WCHAR stTurkish[]={'A','a','B','b',0x011e,0x011f,0x015e,0x015f,0}; /* Turkish */
|
|
|
|
static const WCHAR stHebrew[]={'A','a','B','b',0x05e0,0x05e1,0x05e9,0x05ea,0}; /* Hebrew */
|
|
|
|
static const WCHAR stArabic[]={'A','a','B','b',0x0627,0x0628,0x062c,0x062f,0x0647,0x0648,0x0632,0};/* Arabic */
|
|
|
|
static const WCHAR stBaltic[]={'A','a','B','b','Y','y','Z','z',0}; /* Baltic */
|
|
|
|
static const WCHAR stVietname[]={'A','a','B','b',0x01a0,0x01a1,0x01af,0x01b0,0}; /* Vietnamese */
|
|
|
|
static const WCHAR stCyrillic[]={'A','a','B','b',0x0411,0x0431,0x0424,0x0444,0}; /* Cyrillic */
|
|
|
|
static const WCHAR stEastEur[]={'A','a','B','b',0xc1,0xe1,0xd4,0xf4,0}; /* East European */
|
|
|
|
static const WCHAR stThai[]={'A','a','B','b',0x0e2d,0x0e31,0x0e01,0x0e29,0x0e23,0x0e44,0x0e17,0x0e22,0}; /* Thai */
|
|
|
|
static const WCHAR stJohab[]={0xac00,0xb098,0xb2e4,'A','a','B','Y','y','Z','z',0}; /* Johab */
|
|
|
|
static const WCHAR stMac[]={'A','a','B','b','Y','y','Z','z',0}; /* Mac */
|
|
|
|
static const WCHAR stOEM[]={'A','a','B','b',0xf8,0xf1,0xfd,0}; /* OEM */
|
|
|
|
/* the following character sets actually behave different (Win2K observation):
|
|
|
|
* the sample string is 'sticky': it uses the sample string of the previous
|
|
|
|
* selected character set. That behaviour looks like some default, which is
|
|
|
|
* not (yet) implemented. */
|
|
|
|
static const WCHAR stVISCII[]={'A','a','B','b',0}; /* VISCII */
|
|
|
|
static const WCHAR stTCVN[]={'A','a','B','b',0}; /* TCVN */
|
|
|
|
static const WCHAR stKOI8[]={'A','a','B','b',0}; /* KOI-8 */
|
|
|
|
static const WCHAR stIso88593[]={'A','a','B','b',0}; /* ISO-8859-3 */
|
|
|
|
static const WCHAR stIso88594[]={'A','a','B','b',0}; /* ISO-8859-4 */
|
|
|
|
static const WCHAR stIso885910[]={'A','a','B','b',0}; /* ISO-8859-10 */
|
|
|
|
static const WCHAR stCeltic[]={'A','a','B','b',0};/* Celtic */
|
|
|
|
|
2006-11-29 11:04:52 +01:00
|
|
|
static const WCHAR * const sample_lang_text[]={
|
2003-12-01 23:40:56 +01:00
|
|
|
stWestern,stSymbol,stShiftJis,stHangul,stGB2312,
|
|
|
|
stBIG5,stGreek,stTurkish,stHebrew,stArabic,
|
|
|
|
stBaltic,stVietname,stCyrillic,stEastEur,stThai,
|
|
|
|
stJohab,stMac,stOEM,stVISCII,stTCVN,
|
|
|
|
stKOI8,stIso88593,stIso88594,stIso885910,stCeltic};
|
|
|
|
|
2003-02-15 01:02:24 +01:00
|
|
|
|
2004-10-07 19:35:08 +02:00
|
|
|
static const BYTE CHARSET_ORDER[256]={
|
2003-02-15 01:02:24 +01:00
|
|
|
CI(ANSI), 0, CI(SYMBOL), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
|
|
|
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
|
|
|
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
|
|
|
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
|
|
|
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, CI(MAC), 0, 0,
|
|
|
|
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
|
|
|
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
|
|
|
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
|
|
|
CI(JIS), CI(HANGUL), CI(JOHAB), 0, 0, 0, CI(GB2312), 0, CI(BIG5), 0, 0, 0, 0, 0, 0, 0,
|
|
|
|
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
|
|
|
0, CI(GREEK), CI(TURKISH), CI(VIETNAMESE), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
|
|
|
0, CI(HEBREW), CI(ARABIC), 0, 0, 0, 0, 0, 0, 0, CI(BALTIC), 0, 0, 0, 0, 0,
|
|
|
|
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, CI(RUSSIAN), 0, 0, 0,
|
|
|
|
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, CI(THAI), 0,
|
|
|
|
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, CI(EE), 0,
|
|
|
|
CI(VISCII), CI(TCVN), CI(KOI8), CI(ISO3), CI(ISO4), CI(ISO10), CI(CELTIC), 0, 0, 0, 0, 0, 0, 0, 0, CI(OEM),
|
|
|
|
};
|
|
|
|
|
2004-10-07 19:35:08 +02:00
|
|
|
static const struct {
|
|
|
|
DWORD mask;
|
|
|
|
const char *name;
|
2001-05-05 02:42:54 +02:00
|
|
|
} cfflags[] = {
|
|
|
|
#define XX(x) { x, #x },
|
|
|
|
XX(CF_SCREENFONTS)
|
|
|
|
XX(CF_PRINTERFONTS)
|
|
|
|
XX(CF_SHOWHELP)
|
|
|
|
XX(CF_ENABLEHOOK)
|
|
|
|
XX(CF_ENABLETEMPLATE)
|
|
|
|
XX(CF_ENABLETEMPLATEHANDLE)
|
|
|
|
XX(CF_INITTOLOGFONTSTRUCT)
|
|
|
|
XX(CF_USESTYLE)
|
|
|
|
XX(CF_EFFECTS)
|
|
|
|
XX(CF_APPLY)
|
|
|
|
XX(CF_ANSIONLY)
|
|
|
|
XX(CF_NOVECTORFONTS)
|
|
|
|
XX(CF_NOSIMULATIONS)
|
|
|
|
XX(CF_LIMITSIZE)
|
|
|
|
XX(CF_FIXEDPITCHONLY)
|
|
|
|
XX(CF_WYSIWYG)
|
|
|
|
XX(CF_FORCEFONTEXIST)
|
|
|
|
XX(CF_SCALABLEONLY)
|
|
|
|
XX(CF_TTONLY)
|
|
|
|
XX(CF_NOFACESEL)
|
|
|
|
XX(CF_NOSTYLESEL)
|
|
|
|
XX(CF_NOSIZESEL)
|
|
|
|
XX(CF_SELECTSCRIPT)
|
|
|
|
XX(CF_NOSCRIPTSEL)
|
|
|
|
XX(CF_NOVERTFONTS)
|
|
|
|
#undef XX
|
|
|
|
};
|
|
|
|
|
2009-11-12 18:36:43 +01:00
|
|
|
static void _dump_cf_flags(DWORD cflags)
|
2003-06-07 02:33:32 +02:00
|
|
|
{
|
2008-09-20 23:29:36 +02:00
|
|
|
unsigned int i;
|
2001-05-05 02:42:54 +02:00
|
|
|
|
2018-03-20 08:37:49 +01:00
|
|
|
for (i = 0; i < ARRAY_SIZE(cfflags); i++)
|
2003-11-29 00:35:34 +01:00
|
|
|
if (cfflags[i].mask & cflags)
|
2004-10-07 19:35:08 +02:00
|
|
|
TRACE("%s|",cfflags[i].name);
|
|
|
|
TRACE("\n");
|
2001-05-05 02:42:54 +02:00
|
|
|
}
|
|
|
|
|
1999-02-28 21:05:11 +01:00
|
|
|
/***********************************************************************
|
2004-08-03 00:21:12 +02:00
|
|
|
* ChooseFontW (COMDLG32.@)
|
2005-11-12 20:12:25 +01:00
|
|
|
*
|
|
|
|
* Create a font dialog box.
|
|
|
|
*
|
|
|
|
* PARAMS
|
|
|
|
* lpChFont [I/O] in: information to initialize the dialog box.
|
|
|
|
* out: User's color selection
|
|
|
|
*
|
|
|
|
* RETURNS
|
|
|
|
* TRUE: Ok button clicked.
|
|
|
|
* FALSE: Cancel button clicked, or error.
|
1999-02-28 21:05:11 +01:00
|
|
|
*/
|
2004-08-03 00:21:12 +02:00
|
|
|
BOOL WINAPI ChooseFontW(LPCHOOSEFONTW lpChFont)
|
1999-02-28 21:05:11 +01:00
|
|
|
{
|
2003-11-29 00:35:34 +01:00
|
|
|
LPCVOID template;
|
|
|
|
HRSRC hResInfo;
|
|
|
|
HINSTANCE hDlginst;
|
|
|
|
HGLOBAL hDlgTmpl;
|
2004-10-07 19:35:08 +02:00
|
|
|
|
2004-12-22 18:17:06 +01:00
|
|
|
TRACE("(%p)\n", lpChFont);
|
2003-11-29 00:35:34 +01:00
|
|
|
|
|
|
|
if ( (lpChFont->Flags&CF_ENABLETEMPLATEHANDLE)!=0 )
|
2002-11-08 19:56:46 +01:00
|
|
|
{
|
2009-01-13 23:30:08 +01:00
|
|
|
template=lpChFont->hInstance;
|
2002-11-13 05:08:57 +01:00
|
|
|
} else
|
|
|
|
{
|
2003-11-29 00:35:34 +01:00
|
|
|
if ( (lpChFont->Flags&CF_ENABLETEMPLATE)!=0 )
|
|
|
|
{
|
|
|
|
hDlginst=lpChFont->hInstance;
|
2004-08-03 00:21:12 +02:00
|
|
|
if( !(hResInfo = FindResourceW(hDlginst, lpChFont->lpTemplateName,
|
|
|
|
(LPWSTR)RT_DIALOG)))
|
2003-11-29 00:35:34 +01:00
|
|
|
{
|
|
|
|
COMDLG32_SetCommDlgExtendedError(CDERR_FINDRESFAILURE);
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
} else
|
|
|
|
{
|
|
|
|
hDlginst=COMDLG32_hInstance;
|
2004-08-03 00:21:12 +02:00
|
|
|
if (!(hResInfo = FindResourceW(hDlginst, chooseFontW, (LPWSTR)RT_DIALOG)))
|
2003-11-29 00:35:34 +01:00
|
|
|
{
|
|
|
|
COMDLG32_SetCommDlgExtendedError(CDERR_FINDRESFAILURE);
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (!(hDlgTmpl = LoadResource(hDlginst, hResInfo )) ||
|
|
|
|
!(template = LockResource( hDlgTmpl )))
|
|
|
|
{
|
|
|
|
COMDLG32_SetCommDlgExtendedError(CDERR_LOADRESFAILURE);
|
|
|
|
return FALSE;
|
|
|
|
}
|
2002-11-08 19:56:46 +01:00
|
|
|
}
|
2003-11-29 00:35:34 +01:00
|
|
|
if (TRACE_ON(commdlg))
|
|
|
|
_dump_cf_flags(lpChFont->Flags);
|
1999-04-25 20:31:35 +02:00
|
|
|
|
2013-06-25 12:38:52 +02:00
|
|
|
if (lpChFont->Flags & CF_SELECTSCRIPT)
|
2003-11-29 00:35:34 +01:00
|
|
|
FIXME(": unimplemented flag (ignored)\n");
|
2002-11-13 05:08:57 +01:00
|
|
|
|
2004-08-03 00:21:12 +02:00
|
|
|
return DialogBoxIndirectParamW(COMDLG32_hInstance, template,
|
|
|
|
lpChFont->hwndOwner, FormatCharDlgProcW, (LPARAM)lpChFont );
|
1999-02-28 21:05:11 +01:00
|
|
|
}
|
|
|
|
|
2001-06-13 22:06:42 +02:00
|
|
|
/***********************************************************************
|
2004-08-03 00:21:12 +02:00
|
|
|
* ChooseFontA (COMDLG32.@)
|
2005-11-12 20:12:25 +01:00
|
|
|
*
|
2007-12-18 14:05:19 +01:00
|
|
|
* See ChooseFontW.
|
2001-06-13 22:06:42 +02:00
|
|
|
*/
|
2004-08-03 00:21:12 +02:00
|
|
|
BOOL WINAPI ChooseFontA(LPCHOOSEFONTA lpChFont)
|
2001-06-13 22:06:42 +02:00
|
|
|
{
|
2004-08-03 00:21:12 +02:00
|
|
|
LPCVOID template;
|
|
|
|
HRSRC hResInfo;
|
|
|
|
HINSTANCE hDlginst;
|
|
|
|
HGLOBAL hDlgTmpl;
|
2002-06-01 01:06:46 +02:00
|
|
|
|
2004-12-22 18:17:06 +01:00
|
|
|
TRACE("(%p)\n", lpChFont);
|
|
|
|
|
2004-08-03 00:21:12 +02:00
|
|
|
if ( (lpChFont->Flags&CF_ENABLETEMPLATEHANDLE)!=0 )
|
2001-06-13 22:06:42 +02:00
|
|
|
{
|
2009-01-13 23:30:08 +01:00
|
|
|
template=lpChFont->hInstance;
|
2004-08-03 00:21:12 +02:00
|
|
|
} else
|
2001-06-13 22:06:42 +02:00
|
|
|
{
|
2004-08-03 00:21:12 +02:00
|
|
|
if ( (lpChFont->Flags&CF_ENABLETEMPLATE)!=0 )
|
|
|
|
{
|
|
|
|
hDlginst=lpChFont->hInstance;
|
|
|
|
if( !(hResInfo = FindResourceA(hDlginst, lpChFont->lpTemplateName,
|
|
|
|
(LPSTR)RT_DIALOG)))
|
|
|
|
{
|
|
|
|
COMDLG32_SetCommDlgExtendedError(CDERR_FINDRESFAILURE);
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
} else
|
|
|
|
{
|
|
|
|
hDlginst=COMDLG32_hInstance;
|
2004-12-22 18:17:06 +01:00
|
|
|
if (!(hResInfo = FindResourceW(hDlginst, chooseFontW, (LPWSTR)RT_DIALOG)))
|
2004-08-03 00:21:12 +02:00
|
|
|
{
|
|
|
|
COMDLG32_SetCommDlgExtendedError(CDERR_FINDRESFAILURE);
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (!(hDlgTmpl = LoadResource(hDlginst, hResInfo )) ||
|
|
|
|
!(template = LockResource( hDlgTmpl )))
|
|
|
|
{
|
|
|
|
COMDLG32_SetCommDlgExtendedError(CDERR_LOADRESFAILURE);
|
|
|
|
return FALSE;
|
|
|
|
}
|
2001-06-13 22:06:42 +02:00
|
|
|
}
|
2003-11-29 00:35:34 +01:00
|
|
|
if (TRACE_ON(commdlg))
|
|
|
|
_dump_cf_flags(lpChFont->Flags);
|
2013-06-25 12:38:52 +02:00
|
|
|
if (lpChFont->Flags & CF_SELECTSCRIPT)
|
2004-08-03 00:21:12 +02:00
|
|
|
FIXME(": unimplemented flag (ignored)\n");
|
2003-11-29 00:35:34 +01:00
|
|
|
|
2004-08-03 00:21:12 +02:00
|
|
|
return DialogBoxIndirectParamA(COMDLG32_hInstance, template,
|
|
|
|
lpChFont->hwndOwner, FormatCharDlgProcA, (LPARAM)lpChFont );
|
1999-02-28 21:05:11 +01:00
|
|
|
}
|
2004-08-03 00:21:12 +02:00
|
|
|
|
1999-02-28 21:05:11 +01:00
|
|
|
#define TEXT_EXTRAS 4
|
|
|
|
#define TEXT_COLORS 16
|
|
|
|
|
|
|
|
static const COLORREF textcolors[TEXT_COLORS]=
|
|
|
|
{
|
2003-11-29 00:35:34 +01:00
|
|
|
0x00000000L,0x00000080L,0x00008000L,0x00008080L,
|
|
|
|
0x00800000L,0x00800080L,0x00808000L,0x00808080L,
|
|
|
|
0x00c0c0c0L,0x000000ffL,0x0000ff00L,0x0000ffffL,
|
|
|
|
0x00ff0000L,0x00ff00ffL,0x00ffff00L,0x00FFFFFFL
|
1999-02-28 21:05:11 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* CFn_HookCallChk32 [internal]
|
|
|
|
*/
|
2007-04-06 11:56:00 +02:00
|
|
|
static BOOL CFn_HookCallChk32(const CHOOSEFONTW *lpcf)
|
1999-02-28 21:05:11 +01:00
|
|
|
{
|
2003-11-29 00:35:34 +01:00
|
|
|
if (lpcf)
|
|
|
|
if(lpcf->Flags & CF_ENABLEHOOK)
|
|
|
|
if (lpcf->lpfnHook)
|
|
|
|
return TRUE;
|
|
|
|
return FALSE;
|
1999-02-28 21:05:11 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/*************************************************************************
|
|
|
|
* AddFontFamily [internal]
|
|
|
|
*/
|
2009-11-12 18:36:43 +01:00
|
|
|
static INT AddFontFamily(const ENUMLOGFONTEXW *lpElfex, const NEWTEXTMETRICEXW *lpNTM,
|
|
|
|
UINT nFontType, const CHOOSEFONTW *lpcf, HWND hwnd, LPCFn_ENUMSTRUCT e)
|
1999-02-28 21:05:11 +01:00
|
|
|
{
|
2003-11-29 00:35:34 +01:00
|
|
|
int i;
|
|
|
|
WORD w;
|
2004-12-22 18:17:06 +01:00
|
|
|
const LOGFONTW *lplf = &(lpElfex->elfLogFont);
|
2003-11-29 00:35:34 +01:00
|
|
|
|
2004-12-22 18:17:06 +01:00
|
|
|
TRACE("font=%s (nFontType=%d)\n", debugstr_w(lplf->lfFaceName), nFontType);
|
2003-11-29 00:35:34 +01:00
|
|
|
|
|
|
|
if (lpcf->Flags & CF_FIXEDPITCHONLY)
|
|
|
|
if (!(lplf->lfPitchAndFamily & FIXED_PITCH))
|
|
|
|
return 1;
|
|
|
|
if (lpcf->Flags & CF_ANSIONLY)
|
|
|
|
if (lplf->lfCharSet != ANSI_CHARSET)
|
|
|
|
return 1;
|
|
|
|
if (lpcf->Flags & CF_TTONLY)
|
|
|
|
if (!(nFontType & TRUETYPE_FONTTYPE))
|
|
|
|
return 1;
|
2013-06-25 12:38:52 +02:00
|
|
|
if (lpcf->Flags & CF_NOVERTFONTS)
|
|
|
|
if (lplf->lfFaceName[0] == '@')
|
|
|
|
return 1;
|
2003-11-29 00:35:34 +01:00
|
|
|
|
|
|
|
if (e) e->added++;
|
|
|
|
|
2004-12-22 18:17:06 +01:00
|
|
|
i=SendMessageW(hwnd, CB_FINDSTRINGEXACT, 0, (LPARAM)lplf->lfFaceName);
|
2003-12-03 23:25:10 +01:00
|
|
|
if (i == CB_ERR) {
|
2004-12-22 18:17:06 +01:00
|
|
|
i = SendMessageW(hwnd, CB_ADDSTRING, 0, (LPARAM)lplf->lfFaceName);
|
2003-12-03 23:25:10 +01:00
|
|
|
if( i != CB_ERR) {
|
|
|
|
/* store some important font information */
|
2003-12-30 23:08:17 +01:00
|
|
|
w = (lplf->lfPitchAndFamily) << 8 |
|
|
|
|
(HIWORD(lpNTM->ntmTm.ntmFlags) & 0xff);
|
2004-12-22 18:17:06 +01:00
|
|
|
SendMessageW(hwnd, CB_SETITEMDATA, i, MAKELONG(nFontType,w));
|
2003-12-03 23:25:10 +01:00
|
|
|
}
|
2003-11-29 00:35:34 +01:00
|
|
|
}
|
2003-12-03 23:25:10 +01:00
|
|
|
return 1;
|
1999-02-28 21:05:11 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/*************************************************************************
|
|
|
|
* FontFamilyEnumProc32 [internal]
|
|
|
|
*/
|
2004-12-22 18:17:06 +01:00
|
|
|
static INT WINAPI FontFamilyEnumProc(const ENUMLOGFONTEXW *lpElfex,
|
|
|
|
const TEXTMETRICW *metrics, DWORD dwFontType, LPARAM lParam)
|
1999-02-28 21:05:11 +01:00
|
|
|
{
|
2003-11-29 00:35:34 +01:00
|
|
|
LPCFn_ENUMSTRUCT e;
|
|
|
|
e=(LPCFn_ENUMSTRUCT)lParam;
|
2006-09-02 17:33:45 +02:00
|
|
|
return AddFontFamily( lpElfex, (const NEWTEXTMETRICEXW *) metrics,
|
2004-12-22 18:17:06 +01:00
|
|
|
dwFontType, e->lpcf32w, e->hWnd1, e);
|
1999-02-28 21:05:11 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/*************************************************************************
|
|
|
|
* SetFontStylesToCombo2 [internal]
|
|
|
|
*
|
|
|
|
* Fill font style information into combobox (without using font.c directly)
|
|
|
|
*/
|
2013-10-22 22:21:49 +02:00
|
|
|
static BOOL SetFontStylesToCombo2(HWND hwnd, HDC hdc, const LOGFONTW *lplf)
|
1999-02-28 21:05:11 +01:00
|
|
|
{
|
2003-11-29 00:35:34 +01:00
|
|
|
#define FSTYLES 4
|
|
|
|
struct FONTSTYLE
|
|
|
|
{
|
|
|
|
int italic;
|
|
|
|
int weight;
|
2008-03-10 21:36:35 +01:00
|
|
|
UINT resId;
|
2003-11-29 00:35:34 +01:00
|
|
|
};
|
2004-10-07 19:35:08 +02:00
|
|
|
static const struct FONTSTYLE fontstyles[FSTYLES]={
|
2008-03-10 21:36:35 +01:00
|
|
|
{ 0, FW_NORMAL, IDS_FONT_REGULAR },
|
|
|
|
{ 1, FW_NORMAL, IDS_FONT_ITALIC },
|
|
|
|
{ 0, FW_BOLD, IDS_FONT_BOLD },
|
|
|
|
{ 1, FW_BOLD, IDS_FONT_BOLD_ITALIC }
|
2003-11-29 00:35:34 +01:00
|
|
|
};
|
|
|
|
HFONT hf;
|
2004-12-22 18:17:06 +01:00
|
|
|
TEXTMETRICW tm;
|
2003-11-29 00:35:34 +01:00
|
|
|
int i,j;
|
2004-12-22 18:17:06 +01:00
|
|
|
LOGFONTW lf;
|
2003-11-29 00:35:34 +01:00
|
|
|
|
2008-02-29 16:54:56 +01:00
|
|
|
lf = *lplf;
|
2003-11-29 00:35:34 +01:00
|
|
|
|
|
|
|
for (i=0;i<FSTYLES;i++)
|
|
|
|
{
|
|
|
|
lf.lfItalic=fontstyles[i].italic;
|
|
|
|
lf.lfWeight=fontstyles[i].weight;
|
2004-12-22 18:17:06 +01:00
|
|
|
hf=CreateFontIndirectW(&lf);
|
2003-11-29 00:35:34 +01:00
|
|
|
hf=SelectObject(hdc,hf);
|
2004-12-22 18:17:06 +01:00
|
|
|
GetTextMetricsW(hdc,&tm);
|
2003-11-29 00:35:34 +01:00
|
|
|
hf=SelectObject(hdc,hf);
|
|
|
|
DeleteObject(hf);
|
2003-11-29 00:38:51 +01:00
|
|
|
/* font successful created ? */
|
2006-09-14 14:10:19 +02:00
|
|
|
if (((fontstyles[i].weight == FW_NORMAL && tm.tmWeight <= FW_MEDIUM) ||
|
|
|
|
(fontstyles[i].weight == FW_BOLD && tm.tmWeight > FW_MEDIUM)) &&
|
2003-11-29 00:38:51 +01:00
|
|
|
((tm.tmItalic != 0)==fontstyles[i].italic))
|
2003-11-29 00:35:34 +01:00
|
|
|
{
|
2008-03-10 21:36:35 +01:00
|
|
|
WCHAR name[64];
|
|
|
|
LoadStringW(COMDLG32_hInstance, fontstyles[i].resId, name, 64);
|
|
|
|
j=SendMessageW(hwnd,CB_ADDSTRING,0,(LPARAM)name );
|
2013-10-22 22:21:49 +02:00
|
|
|
if (j==CB_ERR) return TRUE;
|
2004-12-22 18:17:06 +01:00
|
|
|
j=SendMessageW(hwnd, CB_SETITEMDATA, j,
|
2006-09-14 14:10:19 +02:00
|
|
|
MAKELONG(tm.tmWeight,fontstyles[i].italic));
|
2013-10-22 22:21:49 +02:00
|
|
|
if (j==CB_ERR) return TRUE;
|
2003-11-29 00:35:34 +01:00
|
|
|
}
|
|
|
|
}
|
2013-10-22 22:21:49 +02:00
|
|
|
return FALSE;
|
1999-02-28 21:05:11 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/*************************************************************************
|
|
|
|
* AddFontSizeToCombo3 [internal]
|
|
|
|
*/
|
2013-10-22 22:21:49 +02:00
|
|
|
static BOOL AddFontSizeToCombo3(HWND hwnd, UINT h, const CHOOSEFONTW *lpcf)
|
1999-02-28 21:05:11 +01:00
|
|
|
{
|
|
|
|
int j;
|
2005-01-06 20:43:43 +01:00
|
|
|
WCHAR buffer[20];
|
1999-02-28 21:05:11 +01:00
|
|
|
|
|
|
|
if ( (!(lpcf->Flags & CF_LIMITSIZE)) ||
|
2003-11-29 00:35:34 +01:00
|
|
|
((lpcf->Flags & CF_LIMITSIZE) && (h >= lpcf->nSizeMin) && (h <= lpcf->nSizeMax)))
|
1999-02-28 21:05:11 +01:00
|
|
|
{
|
2019-05-29 08:48:52 +02:00
|
|
|
swprintf(buffer, ARRAY_SIZE(buffer), fontsizefmtW, h);
|
2005-01-06 20:43:43 +01:00
|
|
|
j=SendMessageW(hwnd, CB_FINDSTRINGEXACT, -1, (LPARAM)buffer);
|
2003-11-29 00:35:34 +01:00
|
|
|
if (j==CB_ERR)
|
|
|
|
{
|
2015-12-21 23:19:32 +01:00
|
|
|
j=SendMessageW(hwnd, CB_INSERTSTRING, -1, (LPARAM)buffer);
|
2004-12-22 18:17:06 +01:00
|
|
|
if (j!=CB_ERR) j = SendMessageW(hwnd, CB_SETITEMDATA, j, h);
|
2013-10-22 22:21:49 +02:00
|
|
|
if (j==CB_ERR) return TRUE;
|
2003-11-29 00:35:34 +01:00
|
|
|
}
|
1999-02-28 21:05:11 +01:00
|
|
|
}
|
2013-10-22 22:21:49 +02:00
|
|
|
return FALSE;
|
2002-06-01 01:06:46 +02:00
|
|
|
}
|
|
|
|
|
1999-02-28 21:05:11 +01:00
|
|
|
/*************************************************************************
|
|
|
|
* SetFontSizesToCombo3 [internal]
|
|
|
|
*/
|
2013-10-22 22:21:49 +02:00
|
|
|
static BOOL SetFontSizesToCombo3(HWND hwnd, const CHOOSEFONTW *lpcf)
|
1999-02-28 21:05:11 +01:00
|
|
|
{
|
2006-02-06 11:26:22 +01:00
|
|
|
static const BYTE sizes[]={6,7,8,9,10,11,12,14,16,18,20,22,24,26,28,36,48,72};
|
2008-09-20 23:29:36 +02:00
|
|
|
unsigned int i;
|
1999-02-28 21:05:11 +01:00
|
|
|
|
2018-03-20 08:37:49 +01:00
|
|
|
for (i = 0; i < ARRAY_SIZE(sizes); i++)
|
2013-10-22 22:21:49 +02:00
|
|
|
if (AddFontSizeToCombo3(hwnd, sizes[i], lpcf)) return TRUE;
|
|
|
|
return FALSE;
|
1999-02-28 21:05:11 +01:00
|
|
|
}
|
|
|
|
|
2003-12-11 06:17:05 +01:00
|
|
|
/*************************************************************************
|
|
|
|
* CFn_GetDC [internal]
|
|
|
|
*/
|
2007-04-06 11:56:00 +02:00
|
|
|
static inline HDC CFn_GetDC(const CHOOSEFONTW *lpcf)
|
2003-12-11 06:17:05 +01:00
|
|
|
{
|
|
|
|
HDC ret = ((lpcf->Flags & CF_PRINTERFONTS) && lpcf->hDC) ?
|
|
|
|
lpcf->hDC :
|
|
|
|
GetDC(0);
|
|
|
|
if(!ret) ERR("HDC failure!!!\n");
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2010-02-19 23:50:22 +01:00
|
|
|
/*************************************************************************
|
|
|
|
* GetScreenDPI [internal]
|
|
|
|
*/
|
|
|
|
static inline int GetScreenDPI(void)
|
|
|
|
{
|
|
|
|
HDC hdc;
|
|
|
|
int result;
|
|
|
|
|
|
|
|
hdc = GetDC(0);
|
|
|
|
result = GetDeviceCaps(hdc, LOGPIXELSY);
|
|
|
|
ReleaseDC(0, hdc);
|
|
|
|
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
2003-12-11 06:17:05 +01:00
|
|
|
/*************************************************************************
|
|
|
|
* CFn_ReleaseDC [internal]
|
|
|
|
*/
|
2007-04-06 11:56:00 +02:00
|
|
|
static inline void CFn_ReleaseDC(const CHOOSEFONTW *lpcf, HDC hdc)
|
2003-12-11 06:17:05 +01:00
|
|
|
{
|
|
|
|
if(!((lpcf->Flags & CF_PRINTERFONTS) && lpcf->hDC))
|
|
|
|
ReleaseDC(0, hdc);
|
|
|
|
}
|
|
|
|
|
2018-01-18 19:51:06 +01:00
|
|
|
/*************************************************************************
|
|
|
|
* select_combo_item [internal]
|
|
|
|
*/
|
|
|
|
static void select_combo_item( HWND dialog, int id, int sel )
|
|
|
|
{
|
|
|
|
HWND combo = GetDlgItem( dialog, id );
|
|
|
|
SendMessageW( combo, CB_SETCURSEL, sel, 0 );
|
|
|
|
SendMessageW( dialog, WM_COMMAND, MAKEWPARAM( id, CBN_SELCHANGE ), (LPARAM)combo );
|
|
|
|
}
|
|
|
|
|
1999-02-28 21:05:11 +01:00
|
|
|
/***********************************************************************
|
|
|
|
* AddFontStyle [internal]
|
|
|
|
*/
|
2009-11-12 18:36:43 +01:00
|
|
|
static INT AddFontStyle( const ENUMLOGFONTEXW *lpElfex, const NEWTEXTMETRICEXW *lpNTM,
|
|
|
|
UINT nFontType, const CHOOSEFONTW *lpcf, HWND hcmb2, HWND hcmb3, HWND hDlg)
|
1999-02-28 21:05:11 +01:00
|
|
|
{
|
2003-11-29 00:35:34 +01:00
|
|
|
int i;
|
2004-12-22 18:17:06 +01:00
|
|
|
const LOGFONTW *lplf = &(lpElfex->elfLogFont);
|
2003-12-03 23:25:10 +01:00
|
|
|
HWND hcmb5;
|
2003-12-11 06:17:05 +01:00
|
|
|
HDC hdc;
|
2003-11-29 00:35:34 +01:00
|
|
|
|
|
|
|
TRACE("(nFontType=%d)\n",nFontType);
|
2006-10-13 15:04:43 +02:00
|
|
|
TRACE(" %s h=%d w=%d e=%d o=%d wg=%d i=%d u=%d s=%d"
|
2003-11-29 00:35:34 +01:00
|
|
|
" ch=%d op=%d cp=%d q=%d pf=%xh\n",
|
2004-12-22 18:17:06 +01:00
|
|
|
debugstr_w(lplf->lfFaceName),lplf->lfHeight,lplf->lfWidth,
|
2003-11-29 00:35:34 +01:00
|
|
|
lplf->lfEscapement,lplf->lfOrientation,
|
|
|
|
lplf->lfWeight,lplf->lfItalic,lplf->lfUnderline,
|
|
|
|
lplf->lfStrikeOut,lplf->lfCharSet, lplf->lfOutPrecision,
|
|
|
|
lplf->lfClipPrecision,lplf->lfQuality, lplf->lfPitchAndFamily);
|
|
|
|
if (nFontType & RASTER_FONTTYPE)
|
|
|
|
{
|
2003-12-11 06:17:05 +01:00
|
|
|
INT points;
|
2003-12-30 23:08:17 +01:00
|
|
|
points = MulDiv( lpNTM->ntmTm.tmHeight - lpNTM->ntmTm.tmInternalLeading,
|
2010-02-19 23:50:22 +01:00
|
|
|
72, GetScreenDPI());
|
2013-10-22 22:21:49 +02:00
|
|
|
if (AddFontSizeToCombo3(hcmb3, points, lpcf))
|
|
|
|
return 0;
|
2003-11-29 00:35:34 +01:00
|
|
|
} else if (SetFontSizesToCombo3(hcmb3, lpcf)) return 0;
|
|
|
|
|
2004-12-22 18:17:06 +01:00
|
|
|
if (!SendMessageW(hcmb2, CB_GETCOUNT, 0, 0))
|
2003-11-29 00:35:34 +01:00
|
|
|
{
|
2013-10-22 22:21:49 +02:00
|
|
|
BOOL res;
|
2003-12-11 06:17:05 +01:00
|
|
|
if(!(hdc = CFn_GetDC(lpcf))) return 0;
|
2013-10-22 22:21:49 +02:00
|
|
|
res = SetFontStylesToCombo2(hcmb2,hdc,lplf);
|
2003-12-11 06:17:05 +01:00
|
|
|
CFn_ReleaseDC(lpcf, hdc);
|
2013-10-22 22:21:49 +02:00
|
|
|
if (res)
|
2003-11-29 00:35:34 +01:00
|
|
|
return 0;
|
|
|
|
}
|
2009-11-12 18:36:43 +01:00
|
|
|
if (!( hcmb5 = GetDlgItem(hDlg, cmb5))) return 1;
|
2004-12-22 18:17:06 +01:00
|
|
|
i = SendMessageW( hcmb5, CB_FINDSTRINGEXACT, 0,
|
2003-12-03 23:25:10 +01:00
|
|
|
(LPARAM)lpElfex->elfScript);
|
2004-10-07 19:35:08 +02:00
|
|
|
if( i == CB_ERR) {
|
2004-12-22 18:17:06 +01:00
|
|
|
i = SendMessageW( hcmb5, CB_ADDSTRING, 0,
|
2003-12-03 23:25:10 +01:00
|
|
|
(LPARAM)lpElfex->elfScript);
|
|
|
|
if( i != CB_ERR)
|
2004-12-22 18:17:06 +01:00
|
|
|
SendMessageW( hcmb5, CB_SETITEMDATA, i, lplf->lfCharSet);
|
2003-12-03 23:25:10 +01:00
|
|
|
}
|
2003-11-29 00:35:34 +01:00
|
|
|
return 1 ;
|
2002-06-01 01:06:46 +02:00
|
|
|
}
|
2003-12-03 23:25:10 +01:00
|
|
|
|
2015-12-21 23:19:31 +01:00
|
|
|
static void CFn_FitFontSize( HWND hDlg, int points)
|
2003-11-29 00:40:12 +01:00
|
|
|
{
|
|
|
|
int i,n;
|
2015-12-21 23:19:31 +01:00
|
|
|
|
2003-11-29 00:40:12 +01:00
|
|
|
/* look for fitting font size in combobox3 */
|
2004-12-22 18:17:06 +01:00
|
|
|
n=SendDlgItemMessageW(hDlg, cmb3, CB_GETCOUNT, 0, 0);
|
2003-11-29 00:40:12 +01:00
|
|
|
for (i=0;i<n;i++)
|
|
|
|
{
|
2004-12-22 18:17:06 +01:00
|
|
|
if (points == (int)SendDlgItemMessageW
|
2003-11-29 00:40:12 +01:00
|
|
|
(hDlg,cmb3, CB_GETITEMDATA,i,0))
|
|
|
|
{
|
2018-01-18 19:51:06 +01:00
|
|
|
select_combo_item( hDlg, cmb3, i );
|
2015-12-21 23:19:31 +01:00
|
|
|
return;
|
2003-11-29 00:40:12 +01:00
|
|
|
}
|
|
|
|
}
|
2015-12-21 23:19:31 +01:00
|
|
|
|
|
|
|
/* no default matching size, set text manually */
|
2016-10-15 13:39:31 +02:00
|
|
|
SetDlgItemInt(hDlg, cmb3, points, TRUE);
|
2003-11-29 00:40:12 +01:00
|
|
|
}
|
|
|
|
|
2013-10-22 22:21:49 +02:00
|
|
|
static BOOL CFn_FitFontStyle( HWND hDlg, LONG packedstyle )
|
2003-11-29 00:40:12 +01:00
|
|
|
{
|
|
|
|
LONG id;
|
2013-10-22 22:21:49 +02:00
|
|
|
int i;
|
2003-11-29 00:40:12 +01:00
|
|
|
/* look for fitting font style in combobox2 */
|
|
|
|
for (i=0;i<TEXT_EXTRAS;i++)
|
|
|
|
{
|
2004-12-22 18:17:06 +01:00
|
|
|
id = SendDlgItemMessageW(hDlg, cmb2, CB_GETITEMDATA, i, 0);
|
2003-11-29 00:40:12 +01:00
|
|
|
if (packedstyle == id)
|
|
|
|
{
|
2018-01-18 19:51:06 +01:00
|
|
|
select_combo_item( hDlg, cmb2, i );
|
|
|
|
return TRUE;
|
2003-11-29 00:40:12 +01:00
|
|
|
}
|
|
|
|
}
|
2018-01-18 19:51:06 +01:00
|
|
|
return FALSE;
|
2003-11-29 00:40:12 +01:00
|
|
|
}
|
1999-02-28 21:05:11 +01:00
|
|
|
|
2003-12-03 23:25:10 +01:00
|
|
|
|
2013-10-22 22:21:49 +02:00
|
|
|
static BOOL CFn_FitCharSet( HWND hDlg, int charset )
|
2003-12-03 23:25:10 +01:00
|
|
|
{
|
|
|
|
int i,n,cs;
|
2003-12-04 02:43:01 +01:00
|
|
|
/* look for fitting char set in combobox5 */
|
2004-12-22 18:17:06 +01:00
|
|
|
n=SendDlgItemMessageW(hDlg, cmb5, CB_GETCOUNT, 0, 0);
|
2003-12-03 23:25:10 +01:00
|
|
|
for (i=0;i<n;i++)
|
|
|
|
{
|
2004-12-22 18:17:06 +01:00
|
|
|
cs =SendDlgItemMessageW(hDlg, cmb5, CB_GETITEMDATA, i, 0);
|
2003-12-03 23:25:10 +01:00
|
|
|
if (charset == cs)
|
|
|
|
{
|
2018-01-18 19:51:06 +01:00
|
|
|
select_combo_item( hDlg, cmb5, i );
|
2013-10-22 22:21:49 +02:00
|
|
|
return TRUE;
|
2003-12-03 23:25:10 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
/* no charset fits: select the first one in the list */
|
2018-01-18 19:51:06 +01:00
|
|
|
select_combo_item( hDlg, cmb5, 0 );
|
2013-10-22 22:21:49 +02:00
|
|
|
return FALSE;
|
2003-12-03 23:25:10 +01:00
|
|
|
}
|
|
|
|
|
1999-02-28 21:05:11 +01:00
|
|
|
/***********************************************************************
|
|
|
|
* FontStyleEnumProc32 [internal]
|
|
|
|
*/
|
2004-12-22 18:17:06 +01:00
|
|
|
static INT WINAPI FontStyleEnumProc( const ENUMLOGFONTEXW *lpElfex,
|
|
|
|
const TEXTMETRICW *metrics, DWORD dwFontType, LPARAM lParam )
|
1999-02-28 21:05:11 +01:00
|
|
|
{
|
2003-11-29 00:35:34 +01:00
|
|
|
LPCFn_ENUMSTRUCT s=(LPCFn_ENUMSTRUCT)lParam;
|
|
|
|
HWND hcmb2=s->hWnd1;
|
|
|
|
HWND hcmb3=s->hWnd2;
|
|
|
|
HWND hDlg=GetParent(hcmb3);
|
2004-12-22 18:17:06 +01:00
|
|
|
return AddFontStyle( lpElfex, (const NEWTEXTMETRICEXW *) metrics,
|
2009-11-12 18:36:43 +01:00
|
|
|
dwFontType, s->lpcf32w, hcmb2, hcmb3, hDlg);
|
1999-02-28 21:05:11 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* CFn_WMInitDialog [internal]
|
|
|
|
*/
|
2010-02-28 13:28:08 +01:00
|
|
|
static LRESULT CFn_WMInitDialog(HWND hDlg, LPARAM lParam, LPCHOOSEFONTW lpcf)
|
1999-02-28 21:05:11 +01:00
|
|
|
{
|
2003-11-29 00:35:34 +01:00
|
|
|
HDC hdc;
|
2013-10-22 22:21:49 +02:00
|
|
|
int i,j;
|
|
|
|
BOOL init = FALSE;
|
2003-11-29 00:40:12 +01:00
|
|
|
long pstyle;
|
2003-12-11 06:17:05 +01:00
|
|
|
CFn_ENUMSTRUCT s;
|
2004-12-22 18:17:06 +01:00
|
|
|
LPLOGFONTW lpxx;
|
|
|
|
HCURSOR hcursor=SetCursor(LoadCursorW(0,(LPWSTR)IDC_WAIT));
|
|
|
|
static const WCHAR strColorName[] = {'[','c','o','l','o','r',' ','n','a','m','e',']',0};
|
2003-11-29 00:35:34 +01:00
|
|
|
|
2009-01-13 23:30:08 +01:00
|
|
|
SetPropW(hDlg, strWineFontData, lpcf);
|
2003-11-29 00:35:34 +01:00
|
|
|
lpxx=lpcf->lpLogFont;
|
|
|
|
TRACE("WM_INITDIALOG lParam=%08lX\n", lParam);
|
|
|
|
|
2004-12-22 18:17:06 +01:00
|
|
|
if (lpcf->lStructSize != sizeof(CHOOSEFONTW))
|
1999-02-28 21:05:11 +01:00
|
|
|
{
|
2014-01-11 16:02:02 +01:00
|
|
|
ERR("structure size failure!!!\n");
|
2003-11-29 00:35:34 +01:00
|
|
|
EndDialog (hDlg, 0);
|
|
|
|
return FALSE;
|
1999-02-28 21:05:11 +01:00
|
|
|
}
|
2003-12-30 23:08:17 +01:00
|
|
|
if (!himlTT)
|
2004-12-22 18:17:06 +01:00
|
|
|
himlTT = ImageList_LoadImageW( COMDLG32_hInstance, MAKEINTRESOURCEW(38),
|
2003-12-30 23:08:17 +01:00
|
|
|
TTBITMAP_XSIZE, 0, CLR_DEFAULT, IMAGE_BITMAP, 0);
|
2003-11-29 00:35:34 +01:00
|
|
|
|
2007-08-26 18:29:23 +02:00
|
|
|
/* Set effect flags */
|
|
|
|
if((lpcf->Flags & CF_EFFECTS) && (lpcf->Flags & CF_INITTOLOGFONTSTRUCT))
|
|
|
|
{
|
|
|
|
if(lpxx->lfUnderline)
|
|
|
|
CheckDlgButton(hDlg, chx2, TRUE);
|
|
|
|
if(lpxx->lfStrikeOut)
|
|
|
|
CheckDlgButton(hDlg, chx1, TRUE);
|
|
|
|
}
|
|
|
|
|
2003-11-29 00:35:34 +01:00
|
|
|
if (!(lpcf->Flags & CF_SHOWHELP) || !IsWindow(lpcf->hwndOwner))
|
|
|
|
ShowWindow(GetDlgItem(hDlg,pshHelp),SW_HIDE);
|
|
|
|
if (!(lpcf->Flags & CF_APPLY))
|
|
|
|
ShowWindow(GetDlgItem(hDlg,psh3),SW_HIDE);
|
2007-07-04 15:28:45 +02:00
|
|
|
if (lpcf->Flags & CF_NOSCRIPTSEL)
|
|
|
|
EnableWindow(GetDlgItem(hDlg,cmb5),FALSE);
|
2003-11-29 00:35:34 +01:00
|
|
|
if (lpcf->Flags & CF_EFFECTS)
|
1999-02-28 21:05:11 +01:00
|
|
|
{
|
2003-11-29 00:35:34 +01:00
|
|
|
for (i=0;i<TEXT_COLORS;i++)
|
1999-02-28 21:05:11 +01:00
|
|
|
{
|
2004-12-22 18:17:06 +01:00
|
|
|
WCHAR name[30];
|
2003-11-29 00:35:34 +01:00
|
|
|
|
2004-12-22 18:17:06 +01:00
|
|
|
if( LoadStringW(COMDLG32_hInstance, IDS_COLOR_BLACK+i, name,
|
2018-03-20 08:37:49 +01:00
|
|
|
ARRAY_SIZE(name)) == 0 )
|
2003-11-29 00:35:34 +01:00
|
|
|
{
|
2004-12-22 18:17:06 +01:00
|
|
|
memcpy(name, strColorName, sizeof(strColorName));
|
2003-11-29 00:35:34 +01:00
|
|
|
}
|
2004-12-22 18:17:06 +01:00
|
|
|
j=SendDlgItemMessageW(hDlg, cmb4, CB_ADDSTRING, 0, (LPARAM)name);
|
2006-03-27 18:33:56 +02:00
|
|
|
SendDlgItemMessageW(hDlg, cmb4, CB_SETITEMDATA, j, textcolors[i]);
|
2003-11-29 00:35:34 +01:00
|
|
|
/* look for a fitting value in color combobox */
|
2006-03-27 18:33:56 +02:00
|
|
|
if (textcolors[i]==lpcf->rgbColors)
|
2004-12-22 18:17:06 +01:00
|
|
|
SendDlgItemMessageW(hDlg,cmb4, CB_SETCURSEL,j,0);
|
1999-02-28 21:05:11 +01:00
|
|
|
}
|
|
|
|
}
|
2003-11-29 00:35:34 +01:00
|
|
|
else
|
1999-02-28 21:05:11 +01:00
|
|
|
{
|
2003-11-29 00:35:34 +01:00
|
|
|
ShowWindow(GetDlgItem(hDlg,cmb4),SW_HIDE);
|
|
|
|
ShowWindow(GetDlgItem(hDlg,chx1),SW_HIDE);
|
|
|
|
ShowWindow(GetDlgItem(hDlg,chx2),SW_HIDE);
|
|
|
|
ShowWindow(GetDlgItem(hDlg,grp1),SW_HIDE);
|
|
|
|
ShowWindow(GetDlgItem(hDlg,stc4),SW_HIDE);
|
|
|
|
}
|
2003-12-11 06:17:05 +01:00
|
|
|
if(!(hdc = CFn_GetDC(lpcf)))
|
2003-11-29 00:35:34 +01:00
|
|
|
{
|
2003-12-11 06:17:05 +01:00
|
|
|
EndDialog (hDlg, 0);
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
s.hWnd1=GetDlgItem(hDlg,cmb1);
|
2004-12-22 18:17:06 +01:00
|
|
|
s.lpcf32w=lpcf;
|
2003-12-11 06:17:05 +01:00
|
|
|
do {
|
2004-12-22 18:17:06 +01:00
|
|
|
LOGFONTW elf;
|
2003-12-11 06:17:05 +01:00
|
|
|
s.added = 0;
|
2003-12-30 23:08:17 +01:00
|
|
|
elf.lfCharSet = DEFAULT_CHARSET; /* enum all charsets */
|
|
|
|
elf.lfPitchAndFamily = 0;
|
|
|
|
elf.lfFaceName[0] = '\0'; /* enum all fonts */
|
2004-12-22 18:17:06 +01:00
|
|
|
if (!EnumFontFamiliesExW(hdc, &elf, (FONTENUMPROCW)FontFamilyEnumProc, (LPARAM)&s, 0))
|
2003-12-30 23:08:17 +01:00
|
|
|
{
|
|
|
|
TRACE("EnumFontFamiliesEx returns 0\n");
|
2003-11-29 00:35:34 +01:00
|
|
|
break;
|
2003-12-11 06:17:05 +01:00
|
|
|
}
|
|
|
|
if (s.added) break;
|
|
|
|
if (lpcf->Flags & CF_FIXEDPITCHONLY) {
|
|
|
|
FIXME("No font found with fixed pitch only, dropping flag.\n");
|
|
|
|
lpcf->Flags &= ~CF_FIXEDPITCHONLY;
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
if (lpcf->Flags & CF_TTONLY) {
|
|
|
|
FIXME("No font found with truetype only, dropping flag.\n");
|
|
|
|
lpcf->Flags &= ~CF_TTONLY;
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
} while (1);
|
2003-11-29 00:35:34 +01:00
|
|
|
|
|
|
|
|
2003-12-11 06:17:05 +01:00
|
|
|
if (lpcf->Flags & CF_INITTOLOGFONTSTRUCT)
|
|
|
|
{
|
|
|
|
/* look for fitting font name in combobox1 */
|
2005-09-02 13:32:17 +02:00
|
|
|
j=SendDlgItemMessageW(hDlg,cmb1,CB_FINDSTRING,-1,(LPARAM)lpxx->lfFaceName);
|
2003-12-11 06:17:05 +01:00
|
|
|
if (j!=CB_ERR)
|
2003-11-29 00:35:34 +01:00
|
|
|
{
|
2003-12-11 06:17:05 +01:00
|
|
|
INT height = lpxx->lfHeight < 0 ? -lpxx->lfHeight :
|
|
|
|
lpxx->lfHeight;
|
|
|
|
INT points;
|
|
|
|
int charset = lpxx->lfCharSet;
|
2010-02-19 23:50:22 +01:00
|
|
|
points = MulDiv( height, 72, GetScreenDPI());
|
2003-12-11 06:17:05 +01:00
|
|
|
pstyle = MAKELONG(lpxx->lfWeight > FW_MEDIUM ? FW_BOLD:
|
|
|
|
FW_NORMAL,lpxx->lfItalic !=0);
|
2018-01-18 19:51:06 +01:00
|
|
|
select_combo_item( hDlg, cmb1, j );
|
2013-10-22 22:21:49 +02:00
|
|
|
init = TRUE;
|
2003-12-11 06:17:05 +01:00
|
|
|
/* look for fitting font style in combobox2 */
|
|
|
|
CFn_FitFontStyle(hDlg, pstyle);
|
|
|
|
/* look for fitting font size in combobox3 */
|
|
|
|
CFn_FitFontSize(hDlg, points);
|
|
|
|
CFn_FitCharSet( hDlg, charset );
|
2003-11-29 00:35:34 +01:00
|
|
|
}
|
2002-06-01 01:06:46 +02:00
|
|
|
}
|
2003-12-11 06:17:05 +01:00
|
|
|
if (!init)
|
1999-02-28 21:05:11 +01:00
|
|
|
{
|
2018-01-18 19:51:06 +01:00
|
|
|
select_combo_item( hDlg, cmb1, 0 );
|
|
|
|
select_combo_item( hDlg, cmb2, 0 );
|
|
|
|
select_combo_item( hDlg, cmb3, 0 );
|
|
|
|
select_combo_item( hDlg, cmb5, 0 );
|
1999-02-28 21:05:11 +01:00
|
|
|
}
|
2015-12-21 23:19:30 +01:00
|
|
|
/* limit text length user can type in as font size */
|
|
|
|
SendDlgItemMessageW(hDlg, cmb3, CB_LIMITTEXT, 5, 0);
|
|
|
|
|
2005-02-14 12:00:37 +01:00
|
|
|
if ((lpcf->Flags & CF_USESTYLE) && lpcf->lpszStyle)
|
2003-12-11 06:17:05 +01:00
|
|
|
{
|
2005-09-02 13:32:17 +02:00
|
|
|
j=SendDlgItemMessageW(hDlg,cmb2,CB_FINDSTRING,-1,(LPARAM)lpcf->lpszStyle);
|
2018-01-18 19:51:06 +01:00
|
|
|
if (j!=CB_ERR) select_combo_item( hDlg, cmb2, j );
|
2003-12-11 06:17:05 +01:00
|
|
|
}
|
|
|
|
CFn_ReleaseDC(lpcf, hdc);
|
2003-11-29 00:35:34 +01:00
|
|
|
SetCursor(hcursor);
|
|
|
|
return TRUE;
|
1999-02-28 21:05:11 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* CFn_WMMeasureItem [internal]
|
|
|
|
*/
|
2010-03-06 14:55:51 +01:00
|
|
|
static LRESULT CFn_WMMeasureItem(HWND hDlg, LPARAM lParam)
|
1999-02-28 21:05:11 +01:00
|
|
|
{
|
2003-12-30 23:08:17 +01:00
|
|
|
HDC hdc;
|
|
|
|
HFONT hfontprev;
|
|
|
|
TEXTMETRICW tm;
|
2003-11-29 00:35:34 +01:00
|
|
|
LPMEASUREITEMSTRUCT lpmi=(LPMEASUREITEMSTRUCT)lParam;
|
2010-08-19 08:18:16 +02:00
|
|
|
INT height = 0, cx;
|
2005-07-05 16:11:04 +02:00
|
|
|
|
2003-12-30 23:08:17 +01:00
|
|
|
if (!himlTT)
|
2004-12-22 18:17:06 +01:00
|
|
|
himlTT = ImageList_LoadImageW( COMDLG32_hInstance, MAKEINTRESOURCEW(38),
|
2003-12-30 23:08:17 +01:00
|
|
|
TTBITMAP_XSIZE, 0, CLR_DEFAULT, IMAGE_BITMAP, 0);
|
2010-08-19 08:18:16 +02:00
|
|
|
ImageList_GetIconSize( himlTT, &cx, &height);
|
2005-07-05 16:11:04 +02:00
|
|
|
lpmi->itemHeight = height + 2;
|
2003-12-30 23:08:17 +01:00
|
|
|
/* use MAX of bitmap height and tm.tmHeight .*/
|
2004-12-22 18:17:06 +01:00
|
|
|
hdc=GetDC(hDlg);
|
2003-12-30 23:08:17 +01:00
|
|
|
if(!hdc) return 0;
|
2013-05-29 16:28:48 +02:00
|
|
|
hfontprev = SelectObject( hdc, (HFONT)SendMessageW( hDlg, WM_GETFONT, 0, 0 ));
|
2004-12-22 18:17:06 +01:00
|
|
|
GetTextMetricsW(hdc, &tm);
|
2003-12-30 23:08:17 +01:00
|
|
|
if( tm.tmHeight > lpmi->itemHeight) lpmi->itemHeight = tm.tmHeight;
|
2004-12-22 18:17:06 +01:00
|
|
|
SelectObject(hdc, hfontprev);
|
|
|
|
ReleaseDC(hDlg, hdc);
|
2003-11-29 00:35:34 +01:00
|
|
|
return 0;
|
1999-02-28 21:05:11 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* CFn_WMDrawItem [internal]
|
|
|
|
*/
|
2010-03-06 14:55:51 +01:00
|
|
|
static LRESULT CFn_WMDrawItem(LPARAM lParam)
|
1999-02-28 21:05:11 +01:00
|
|
|
{
|
2003-11-29 00:35:34 +01:00
|
|
|
HBRUSH hBrush;
|
2004-12-22 18:17:06 +01:00
|
|
|
WCHAR buffer[40];
|
2003-11-29 00:35:34 +01:00
|
|
|
COLORREF cr, oldText=0, oldBk=0;
|
|
|
|
RECT rect;
|
|
|
|
int nFontType;
|
2013-05-29 16:28:48 +02:00
|
|
|
int cx, cy, idx;
|
2003-11-29 00:35:34 +01:00
|
|
|
LPDRAWITEMSTRUCT lpdi = (LPDRAWITEMSTRUCT)lParam;
|
|
|
|
|
|
|
|
if (lpdi->itemID == (UINT)-1) /* got no items */
|
|
|
|
DrawFocusRect(lpdi->hDC, &lpdi->rcItem);
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (lpdi->CtlType == ODT_COMBOBOX)
|
|
|
|
{
|
2003-12-04 22:53:14 +01:00
|
|
|
if (lpdi->itemState & ODS_SELECTED)
|
2003-11-29 00:35:34 +01:00
|
|
|
{
|
|
|
|
hBrush=GetSysColorBrush(COLOR_HIGHLIGHT);
|
|
|
|
oldText=SetTextColor(lpdi->hDC, GetSysColor(COLOR_HIGHLIGHTTEXT));
|
|
|
|
oldBk=SetBkColor(lpdi->hDC, GetSysColor(COLOR_HIGHLIGHT));
|
|
|
|
} else
|
|
|
|
{
|
|
|
|
hBrush = SelectObject(lpdi->hDC, GetStockObject(LTGRAY_BRUSH));
|
|
|
|
SelectObject(lpdi->hDC, hBrush);
|
|
|
|
}
|
|
|
|
FillRect(lpdi->hDC, &lpdi->rcItem, hBrush);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
return TRUE; /* this should never happen */
|
|
|
|
|
|
|
|
rect=lpdi->rcItem;
|
|
|
|
switch (lpdi->CtlID)
|
|
|
|
{
|
|
|
|
case cmb1:
|
|
|
|
/* TRACE(commdlg,"WM_Drawitem cmb1\n"); */
|
2013-05-29 16:28:48 +02:00
|
|
|
ImageList_GetIconSize( himlTT, &cx, &cy);
|
2004-12-22 18:17:06 +01:00
|
|
|
SendMessageW(lpdi->hwndItem, CB_GETLBTEXT, lpdi->itemID,
|
2003-11-29 00:35:34 +01:00
|
|
|
(LPARAM)buffer);
|
2013-05-29 16:28:48 +02:00
|
|
|
TextOutW(lpdi->hDC, lpdi->rcItem.left + cx + 4,
|
2004-12-22 18:17:06 +01:00
|
|
|
lpdi->rcItem.top, buffer, lstrlenW(buffer));
|
|
|
|
nFontType = SendMessageW(lpdi->hwndItem, CB_GETITEMDATA, lpdi->itemID,0L);
|
2003-12-30 23:08:17 +01:00
|
|
|
idx = -1;
|
|
|
|
if (nFontType & TRUETYPE_FONTTYPE) {
|
|
|
|
idx = 0; /* picture: TT */
|
|
|
|
if( nFontType & NTM_TT_OPENTYPE)
|
|
|
|
idx = 2; /* picture: O */
|
|
|
|
} else if( nFontType & NTM_PS_OPENTYPE)
|
|
|
|
idx = 3; /* picture: O+ps */
|
|
|
|
else if( nFontType & NTM_TYPE1)
|
|
|
|
idx = 4; /* picture: a */
|
|
|
|
else if( nFontType & DEVICE_FONTTYPE)
|
|
|
|
idx = 1; /* picture: printer */
|
|
|
|
if( idx >= 0)
|
|
|
|
ImageList_Draw( himlTT, idx, lpdi->hDC, lpdi->rcItem.left,
|
2013-05-29 16:28:48 +02:00
|
|
|
(lpdi->rcItem.top + lpdi->rcItem.bottom - cy) / 2, ILD_TRANSPARENT);
|
2003-11-29 00:35:34 +01:00
|
|
|
break;
|
|
|
|
case cmb2:
|
|
|
|
case cmb3:
|
|
|
|
/* TRACE(commdlg,"WM_DRAWITEN cmb2,cmb3\n"); */
|
2003-12-03 23:25:10 +01:00
|
|
|
case cmb5:
|
2004-12-22 18:17:06 +01:00
|
|
|
SendMessageW(lpdi->hwndItem, CB_GETLBTEXT, lpdi->itemID,
|
2003-11-29 00:35:34 +01:00
|
|
|
(LPARAM)buffer);
|
2004-12-22 18:17:06 +01:00
|
|
|
TextOutW(lpdi->hDC, lpdi->rcItem.left,
|
|
|
|
lpdi->rcItem.top, buffer, lstrlenW(buffer));
|
2003-11-29 00:35:34 +01:00
|
|
|
break;
|
|
|
|
|
|
|
|
case cmb4:
|
|
|
|
/* TRACE(commdlg,"WM_DRAWITEM cmb4 (=COLOR)\n"); */
|
2004-12-22 18:17:06 +01:00
|
|
|
SendMessageW(lpdi->hwndItem, CB_GETLBTEXT, lpdi->itemID,
|
|
|
|
(LPARAM)buffer);
|
|
|
|
TextOutW(lpdi->hDC, lpdi->rcItem.left + 25+5,
|
|
|
|
lpdi->rcItem.top, buffer, lstrlenW(buffer));
|
|
|
|
cr = SendMessageW(lpdi->hwndItem, CB_GETITEMDATA, lpdi->itemID,0L);
|
2003-11-29 00:35:34 +01:00
|
|
|
hBrush = CreateSolidBrush(cr);
|
|
|
|
if (hBrush)
|
|
|
|
{
|
|
|
|
hBrush = SelectObject (lpdi->hDC, hBrush) ;
|
|
|
|
rect.right=rect.left+25;
|
|
|
|
rect.top++;
|
|
|
|
rect.left+=5;
|
|
|
|
rect.bottom--;
|
|
|
|
Rectangle( lpdi->hDC, rect.left, rect.top,
|
|
|
|
rect.right, rect.bottom );
|
|
|
|
DeleteObject( SelectObject (lpdi->hDC, hBrush)) ;
|
|
|
|
}
|
|
|
|
rect=lpdi->rcItem;
|
|
|
|
rect.left+=25+5;
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
return TRUE; /* this should never happen */
|
|
|
|
}
|
2003-12-04 22:53:14 +01:00
|
|
|
if (lpdi->itemState & ODS_SELECTED)
|
2003-11-29 00:35:34 +01:00
|
|
|
{
|
|
|
|
SetTextColor(lpdi->hDC, oldText);
|
|
|
|
SetBkColor(lpdi->hDC, oldBk);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return TRUE;
|
1999-02-28 21:05:11 +01:00
|
|
|
}
|
|
|
|
|
2015-12-21 23:19:31 +01:00
|
|
|
static INT get_dialog_font_point_size(HWND hDlg, CHOOSEFONTW *cf)
|
|
|
|
{
|
|
|
|
BOOL invalid_size = FALSE;
|
|
|
|
INT i, size;
|
|
|
|
|
|
|
|
i = SendDlgItemMessageW(hDlg, cmb3, CB_GETCURSEL, 0, 0);
|
|
|
|
if (i != CB_ERR)
|
|
|
|
size = LOWORD(SendDlgItemMessageW(hDlg, cmb3, CB_GETITEMDATA , i, 0));
|
|
|
|
else
|
|
|
|
{
|
|
|
|
WCHAR buffW[8], *endptrW;
|
|
|
|
|
2018-03-20 08:37:49 +01:00
|
|
|
GetDlgItemTextW(hDlg, cmb3, buffW, ARRAY_SIZE(buffW));
|
2019-05-29 08:48:52 +02:00
|
|
|
size = wcstol(buffW, &endptrW, 10);
|
2015-12-21 23:19:31 +01:00
|
|
|
invalid_size = size == 0 && *endptrW;
|
|
|
|
|
|
|
|
if (size == 0)
|
|
|
|
size = 10;
|
|
|
|
}
|
|
|
|
|
|
|
|
cf->iPointSize = 10 * size;
|
|
|
|
cf->lpLogFont->lfHeight = -MulDiv(cf->iPointSize, GetScreenDPI(), 720);
|
|
|
|
return invalid_size ? -1 : size;
|
|
|
|
}
|
|
|
|
|
1999-02-28 21:05:11 +01:00
|
|
|
/***********************************************************************
|
|
|
|
* CFn_WMCommand [internal]
|
|
|
|
*/
|
2009-11-12 18:36:43 +01:00
|
|
|
static LRESULT CFn_WMCommand(HWND hDlg, WPARAM wParam, LPARAM lParam, LPCHOOSEFONTW lpcf)
|
1999-02-28 21:05:11 +01:00
|
|
|
{
|
2003-12-30 23:08:17 +01:00
|
|
|
int i;
|
2003-11-29 00:35:34 +01:00
|
|
|
long l;
|
|
|
|
HDC hdc;
|
2017-11-11 16:15:17 +01:00
|
|
|
BOOL cmb_selected_by_edit = FALSE;
|
2003-11-29 00:35:34 +01:00
|
|
|
|
2010-07-01 13:45:16 +02:00
|
|
|
if (!lpcf) return FALSE;
|
|
|
|
|
2017-11-11 16:15:17 +01:00
|
|
|
if(HIWORD(wParam) == CBN_EDITCHANGE)
|
|
|
|
{
|
|
|
|
int idx;
|
|
|
|
WCHAR str_edit[256], str_cmb[256];
|
|
|
|
int cmb = LOWORD(wParam);
|
|
|
|
|
2018-03-20 08:37:49 +01:00
|
|
|
GetDlgItemTextW(hDlg, cmb, str_edit, ARRAY_SIZE(str_edit));
|
2017-11-11 16:15:17 +01:00
|
|
|
idx = SendDlgItemMessageW(hDlg, cmb, CB_FINDSTRING, -1, (LPARAM)str_edit);
|
|
|
|
if(idx != -1)
|
|
|
|
{
|
|
|
|
SendDlgItemMessageW(hDlg, cmb, CB_GETLBTEXT, idx, (LPARAM)str_cmb);
|
|
|
|
|
|
|
|
/* Select listbox entry only if we have an exact match */
|
|
|
|
if(lstrcmpiW(str_edit, str_cmb) == 0)
|
|
|
|
{
|
|
|
|
SendDlgItemMessageW(hDlg, cmb, CB_SETCURSEL, idx, 0);
|
|
|
|
SendDlgItemMessageW(hDlg, cmb, CB_SETEDITSEL, 0, -1); /* Remove edit field selection */
|
|
|
|
cmb_selected_by_edit = TRUE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2006-10-13 15:04:43 +02:00
|
|
|
TRACE("WM_COMMAND wParam=%08X lParam=%08lX\n", (LONG)wParam, lParam);
|
2003-11-29 00:35:34 +01:00
|
|
|
switch (LOWORD(wParam))
|
|
|
|
{
|
|
|
|
case cmb1:
|
2017-11-11 16:15:17 +01:00
|
|
|
if (HIWORD(wParam) == CBN_SELCHANGE || cmb_selected_by_edit)
|
2003-11-29 00:35:34 +01:00
|
|
|
{
|
2003-12-11 06:17:05 +01:00
|
|
|
INT pointsize; /* save current pointsize */
|
|
|
|
LONG pstyle; /* save current style */
|
|
|
|
int charset;
|
|
|
|
int idx;
|
|
|
|
if(!(hdc = CFn_GetDC(lpcf)))
|
2003-11-29 00:35:34 +01:00
|
|
|
{
|
|
|
|
EndDialog (hDlg, 0);
|
|
|
|
return TRUE;
|
|
|
|
}
|
2004-12-22 18:17:06 +01:00
|
|
|
idx = SendDlgItemMessageW(hDlg, cmb3, CB_GETCURSEL, 0, 0);
|
|
|
|
pointsize = (int)SendDlgItemMessageW( hDlg, cmb3, CB_GETITEMDATA,
|
2003-12-11 06:17:05 +01:00
|
|
|
idx, 0);
|
2004-12-22 18:17:06 +01:00
|
|
|
idx = SendDlgItemMessageW(hDlg, cmb2, CB_GETCURSEL, 0, 0);
|
|
|
|
pstyle = SendDlgItemMessageW(hDlg, cmb2, CB_GETITEMDATA, idx, 0);
|
|
|
|
idx = SendDlgItemMessageW(hDlg, cmb5, CB_GETCURSEL, 0, 0);
|
|
|
|
charset = SendDlgItemMessageW(hDlg, cmb5, CB_GETITEMDATA, idx, 0);
|
|
|
|
|
|
|
|
SendDlgItemMessageW(hDlg, cmb2, CB_RESETCONTENT, 0, 0);
|
|
|
|
SendDlgItemMessageW(hDlg, cmb3, CB_RESETCONTENT, 0, 0);
|
|
|
|
SendDlgItemMessageW(hDlg, cmb5, CB_RESETCONTENT, 0, 0);
|
|
|
|
i=SendDlgItemMessageW(hDlg, cmb1, CB_GETCURSEL, 0, 0);
|
2003-12-11 06:17:05 +01:00
|
|
|
if (i!=CB_ERR)
|
|
|
|
{
|
2004-12-22 18:17:06 +01:00
|
|
|
HCURSOR hcursor=SetCursor(LoadCursorW(0,(LPWSTR)IDC_WAIT));
|
2003-12-11 06:17:05 +01:00
|
|
|
CFn_ENUMSTRUCT s;
|
2004-12-22 18:17:06 +01:00
|
|
|
LOGFONTW enumlf;
|
|
|
|
SendDlgItemMessageW(hDlg, cmb1, CB_GETLBTEXT, i,
|
2003-12-11 06:17:05 +01:00
|
|
|
(LPARAM)enumlf.lfFaceName);
|
2004-12-22 18:17:06 +01:00
|
|
|
TRACE("WM_COMMAND/cmb1 =>%s\n", debugstr_w(enumlf.lfFaceName));
|
2003-12-11 06:17:05 +01:00
|
|
|
s.hWnd1=GetDlgItem(hDlg, cmb2);
|
|
|
|
s.hWnd2=GetDlgItem(hDlg, cmb3);
|
2004-12-22 18:17:06 +01:00
|
|
|
s.lpcf32w=lpcf;
|
2003-12-11 06:17:05 +01:00
|
|
|
enumlf.lfCharSet = DEFAULT_CHARSET; /* enum all charsets */
|
|
|
|
enumlf.lfPitchAndFamily = 0;
|
2004-12-22 18:17:06 +01:00
|
|
|
EnumFontFamiliesExW(hdc, &enumlf,
|
|
|
|
(FONTENUMPROCW)FontStyleEnumProc, (LPARAM)&s, 0);
|
2003-12-11 06:17:05 +01:00
|
|
|
CFn_FitFontStyle(hDlg, pstyle);
|
|
|
|
if( pointsize != CB_ERR) CFn_FitFontSize(hDlg, pointsize);
|
|
|
|
if( charset != CB_ERR) CFn_FitCharSet( hDlg, charset );
|
|
|
|
SetCursor(hcursor);
|
|
|
|
}
|
|
|
|
CFn_ReleaseDC(lpcf, hdc);
|
2003-11-29 00:35:34 +01:00
|
|
|
}
|
2011-02-23 17:30:33 +01:00
|
|
|
break;
|
2003-11-29 00:35:34 +01:00
|
|
|
case chx1:
|
|
|
|
case chx2:
|
|
|
|
case cmb2:
|
|
|
|
case cmb3:
|
2003-12-03 23:25:10 +01:00
|
|
|
case cmb5:
|
2017-11-11 16:15:17 +01:00
|
|
|
if (HIWORD(wParam) == CBN_SELCHANGE || HIWORD(wParam) == BN_CLICKED || cmb_selected_by_edit)
|
2003-11-29 00:35:34 +01:00
|
|
|
{
|
2004-12-22 18:17:06 +01:00
|
|
|
WCHAR str[256];
|
2003-11-29 00:35:34 +01:00
|
|
|
WINDOWINFO wininfo;
|
2010-07-08 19:50:26 +02:00
|
|
|
LPLOGFONTW lpxx=lpcf->lpLogFont;
|
2003-11-29 00:35:34 +01:00
|
|
|
|
|
|
|
TRACE("WM_COMMAND/cmb2,3 =%08lX\n", lParam);
|
2015-12-21 23:19:31 +01:00
|
|
|
|
|
|
|
/* face name */
|
2004-12-22 18:17:06 +01:00
|
|
|
i=SendDlgItemMessageW(hDlg,cmb1,CB_GETCURSEL,0,0);
|
2003-11-29 00:35:34 +01:00
|
|
|
if (i==CB_ERR)
|
2018-03-20 08:37:49 +01:00
|
|
|
GetDlgItemTextW( hDlg, cmb1, str, ARRAY_SIZE(str));
|
2003-11-29 00:35:34 +01:00
|
|
|
else
|
|
|
|
{
|
2004-12-22 18:17:06 +01:00
|
|
|
SendDlgItemMessageW(hDlg,cmb1,CB_GETLBTEXT,i,
|
2003-11-29 00:35:34 +01:00
|
|
|
(LPARAM)str);
|
2004-12-22 18:17:06 +01:00
|
|
|
l=SendDlgItemMessageW(hDlg,cmb1,CB_GETITEMDATA,i,0);
|
2003-11-29 00:35:34 +01:00
|
|
|
lpcf->nFontType = LOWORD(l);
|
|
|
|
/* FIXME: lpcf->nFontType |= .... SIMULATED_FONTTYPE and so */
|
|
|
|
/* same value reported to the EnumFonts
|
|
|
|
call back with the extra FONTTYPE_... bits added */
|
2003-12-30 23:08:17 +01:00
|
|
|
lpxx->lfPitchAndFamily = HIWORD(l) >> 8;
|
2003-11-29 00:35:34 +01:00
|
|
|
}
|
2018-03-20 08:37:49 +01:00
|
|
|
lstrcpynW(lpxx->lfFaceName, str, ARRAY_SIZE(lpxx->lfFaceName));
|
2015-12-21 23:19:31 +01:00
|
|
|
|
|
|
|
/* style */
|
2004-12-22 18:17:06 +01:00
|
|
|
i=SendDlgItemMessageW(hDlg, cmb2, CB_GETCURSEL, 0, 0);
|
2003-11-29 00:35:34 +01:00
|
|
|
if (i!=CB_ERR)
|
|
|
|
{
|
2004-12-22 18:17:06 +01:00
|
|
|
l=SendDlgItemMessageW(hDlg, cmb2, CB_GETITEMDATA, i, 0);
|
2003-11-29 00:35:34 +01:00
|
|
|
if (0!=(lpxx->lfItalic=HIWORD(l)))
|
|
|
|
lpcf->nFontType |= ITALIC_FONTTYPE;
|
|
|
|
if ((lpxx->lfWeight=LOWORD(l)) > FW_MEDIUM)
|
|
|
|
lpcf->nFontType |= BOLD_FONTTYPE;
|
|
|
|
}
|
2015-12-21 23:19:31 +01:00
|
|
|
|
|
|
|
/* size */
|
|
|
|
get_dialog_font_point_size(hDlg, lpcf);
|
|
|
|
|
|
|
|
/* charset */
|
2004-12-22 18:17:06 +01:00
|
|
|
i=SendDlgItemMessageW(hDlg, cmb5, CB_GETCURSEL, 0, 0);
|
2003-12-03 23:25:10 +01:00
|
|
|
if (i!=CB_ERR)
|
2004-12-22 18:17:06 +01:00
|
|
|
lpxx->lfCharSet=SendDlgItemMessageW(hDlg, cmb5, CB_GETITEMDATA, i, 0);
|
2003-12-30 23:08:17 +01:00
|
|
|
else
|
|
|
|
lpxx->lfCharSet = DEFAULT_CHARSET;
|
2003-11-29 00:35:34 +01:00
|
|
|
lpxx->lfStrikeOut=IsDlgButtonChecked(hDlg,chx1);
|
|
|
|
lpxx->lfUnderline=IsDlgButtonChecked(hDlg,chx2);
|
|
|
|
lpxx->lfWidth=lpxx->lfOrientation=lpxx->lfEscapement=0;
|
|
|
|
lpxx->lfOutPrecision=OUT_DEFAULT_PRECIS;
|
|
|
|
lpxx->lfClipPrecision=CLIP_DEFAULT_PRECIS;
|
|
|
|
lpxx->lfQuality=DEFAULT_QUALITY;
|
|
|
|
|
|
|
|
wininfo.cbSize=sizeof(wininfo);
|
|
|
|
|
|
|
|
if( GetWindowInfo( GetDlgItem( hDlg, stc5), &wininfo ) )
|
|
|
|
{
|
|
|
|
MapWindowPoints( 0, hDlg, (LPPOINT) &wininfo.rcWindow, 2);
|
|
|
|
InvalidateRect( hDlg, &wininfo.rcWindow, TRUE );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case cmb4:
|
2004-12-22 18:17:06 +01:00
|
|
|
i=SendDlgItemMessageW(hDlg, cmb4, CB_GETCURSEL, 0, 0);
|
2003-11-29 00:35:34 +01:00
|
|
|
if (i!=CB_ERR)
|
|
|
|
{
|
|
|
|
WINDOWINFO wininfo;
|
|
|
|
|
2006-03-27 18:33:56 +02:00
|
|
|
lpcf->rgbColors = SendDlgItemMessageW(hDlg, cmb4, CB_GETITEMDATA, i, 0);
|
2003-11-29 00:35:34 +01:00
|
|
|
wininfo.cbSize=sizeof(wininfo);
|
|
|
|
|
|
|
|
if( GetWindowInfo( GetDlgItem( hDlg, stc5), &wininfo ) )
|
|
|
|
{
|
|
|
|
MapWindowPoints( 0, hDlg, (LPPOINT) &wininfo.rcWindow, 2);
|
|
|
|
InvalidateRect( hDlg, &wininfo.rcWindow, TRUE );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case psh15:
|
2004-12-22 18:17:06 +01:00
|
|
|
i=RegisterWindowMessageW( HELPMSGSTRINGW );
|
2003-11-29 00:35:34 +01:00
|
|
|
if (lpcf->hwndOwner)
|
2004-12-22 18:17:06 +01:00
|
|
|
SendMessageW(lpcf->hwndOwner, i, 0, (LPARAM)GetPropW(hDlg, strWineFontData));
|
2003-11-29 00:35:34 +01:00
|
|
|
break;
|
|
|
|
|
|
|
|
case IDOK:
|
2015-12-21 23:19:31 +01:00
|
|
|
{
|
|
|
|
WCHAR msgW[80];
|
|
|
|
INT pointsize;
|
|
|
|
|
|
|
|
pointsize = get_dialog_font_point_size(hDlg, lpcf);
|
|
|
|
if (pointsize == -1)
|
|
|
|
{
|
2018-03-20 08:37:49 +01:00
|
|
|
LoadStringW(COMDLG32_hInstance, IDS_FONT_SIZE_INPUT, msgW, ARRAY_SIZE(msgW));
|
2015-12-21 23:19:31 +01:00
|
|
|
MessageBoxW(hDlg, msgW, NULL, MB_OK | MB_ICONINFORMATION);
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2003-11-29 00:35:34 +01:00
|
|
|
if ( (!(lpcf->Flags & CF_LIMITSIZE)) ||
|
|
|
|
( (lpcf->Flags & CF_LIMITSIZE) &&
|
2003-12-11 06:17:05 +01:00
|
|
|
(lpcf->iPointSize >= 10 * lpcf->nSizeMin) &&
|
|
|
|
(lpcf->iPointSize <= 10 * lpcf->nSizeMax)))
|
2003-11-29 00:35:34 +01:00
|
|
|
EndDialog(hDlg, TRUE);
|
|
|
|
else
|
|
|
|
{
|
2005-01-06 20:43:43 +01:00
|
|
|
WCHAR format[80];
|
2011-11-19 15:11:49 +01:00
|
|
|
DWORD_PTR args[2];
|
2018-03-20 08:37:49 +01:00
|
|
|
LoadStringW(COMDLG32_hInstance, IDS_FONT_SIZE, format, ARRAY_SIZE(format));
|
2011-11-19 15:11:49 +01:00
|
|
|
args[0] = lpcf->nSizeMin;
|
|
|
|
args[1] = lpcf->nSizeMax;
|
|
|
|
FormatMessageW(FORMAT_MESSAGE_FROM_STRING|FORMAT_MESSAGE_ARGUMENT_ARRAY,
|
2018-03-20 08:37:49 +01:00
|
|
|
format, 0, 0, msgW, ARRAY_SIZE(msgW),
|
2011-11-19 15:11:49 +01:00
|
|
|
(__ms_va_list*)args);
|
2015-12-21 23:19:31 +01:00
|
|
|
MessageBoxW(hDlg, msgW, NULL, MB_OK);
|
2003-11-29 00:35:34 +01:00
|
|
|
}
|
|
|
|
return(TRUE);
|
2015-12-21 23:19:31 +01:00
|
|
|
}
|
2003-11-29 00:35:34 +01:00
|
|
|
case IDCANCEL:
|
|
|
|
EndDialog(hDlg, FALSE);
|
|
|
|
return(TRUE);
|
|
|
|
}
|
|
|
|
return(FALSE);
|
1999-02-28 21:05:11 +01:00
|
|
|
}
|
|
|
|
|
2010-02-28 13:28:08 +01:00
|
|
|
static LRESULT CFn_WMDestroy(HWND hwnd, LPCHOOSEFONTW lpcfw)
|
1999-02-28 21:05:11 +01:00
|
|
|
{
|
2004-12-22 18:17:06 +01:00
|
|
|
LPCHOOSEFONTA lpcfa;
|
|
|
|
LPSTR lpszStyle;
|
|
|
|
LPLOGFONTA lpLogFonta;
|
|
|
|
int len;
|
|
|
|
|
2010-07-01 13:45:16 +02:00
|
|
|
if (!lpcfw) return FALSE;
|
|
|
|
|
2004-12-22 18:17:06 +01:00
|
|
|
lpcfa = GetPropW(hwnd, strWineFontData_a);
|
|
|
|
lpLogFonta = lpcfa->lpLogFont;
|
|
|
|
lpszStyle = lpcfa->lpszStyle;
|
|
|
|
memcpy(lpcfa, lpcfw, sizeof(CHOOSEFONTA));
|
|
|
|
lpcfa->lpLogFont = lpLogFonta;
|
|
|
|
lpcfa->lpszStyle = lpszStyle;
|
|
|
|
memcpy(lpcfa->lpLogFont, lpcfw->lpLogFont, sizeof(LOGFONTA));
|
|
|
|
WideCharToMultiByte(CP_ACP, 0, lpcfw->lpLogFont->lfFaceName,
|
|
|
|
LF_FACESIZE, lpcfa->lpLogFont->lfFaceName, LF_FACESIZE, 0, 0);
|
|
|
|
|
2005-02-14 12:00:37 +01:00
|
|
|
if((lpcfw->Flags & CF_USESTYLE) && lpcfw->lpszStyle) {
|
2008-07-29 14:35:25 +02:00
|
|
|
len = WideCharToMultiByte(CP_ACP, 0, lpcfw->lpszStyle, -1, NULL, 0, 0, 0);
|
2004-12-22 18:17:06 +01:00
|
|
|
WideCharToMultiByte(CP_ACP, 0, lpcfw->lpszStyle, -1, lpcfa->lpszStyle, len, 0, 0);
|
2018-03-20 08:37:47 +01:00
|
|
|
heap_free(lpcfw->lpszStyle);
|
2004-12-22 18:17:06 +01:00
|
|
|
}
|
|
|
|
|
2018-03-20 08:37:47 +01:00
|
|
|
heap_free(lpcfw->lpLogFont);
|
|
|
|
heap_free(lpcfw);
|
2005-05-13 19:50:26 +02:00
|
|
|
SetPropW(hwnd, strWineFontData, 0);
|
2004-12-22 18:17:06 +01:00
|
|
|
|
2003-11-29 00:35:34 +01:00
|
|
|
return TRUE;
|
1999-02-28 21:05:11 +01:00
|
|
|
}
|
|
|
|
|
2009-11-12 18:36:43 +01:00
|
|
|
static LRESULT CFn_WMPaint(HWND hDlg, WPARAM wParam, LPARAM lParam, const CHOOSEFONTW *lpcf)
|
2003-02-15 01:02:24 +01:00
|
|
|
{
|
|
|
|
WINDOWINFO info;
|
|
|
|
|
2010-07-01 13:45:16 +02:00
|
|
|
if (!lpcf) return FALSE;
|
|
|
|
|
2003-02-15 01:02:24 +01:00
|
|
|
info.cbSize=sizeof(info);
|
|
|
|
if( GetWindowInfo( GetDlgItem( hDlg, stc5), &info ) )
|
|
|
|
{
|
|
|
|
PAINTSTRUCT ps;
|
|
|
|
HDC hdc;
|
|
|
|
HFONT hOrigFont;
|
2004-12-22 18:17:06 +01:00
|
|
|
LOGFONTW lf = *(lpcf->lpLogFont);
|
2003-02-15 01:02:24 +01:00
|
|
|
|
2003-11-26 04:38:39 +01:00
|
|
|
MapWindowPoints( 0, hDlg, (LPPOINT) &info.rcWindow, 2);
|
2004-10-07 19:35:08 +02:00
|
|
|
hdc = BeginPaint( hDlg, &ps );
|
|
|
|
|
2016-04-21 10:51:07 +02:00
|
|
|
TRACE("erase %d, rect=%s\n", ps.fErase, wine_dbgstr_rect(&ps.rcPaint));
|
2003-02-15 01:02:24 +01:00
|
|
|
|
|
|
|
/* Paint frame */
|
2012-02-14 15:38:14 +01:00
|
|
|
DrawEdge( hdc, &info.rcWindow, EDGE_SUNKEN, BF_RECT|BF_ADJUST );
|
2003-02-15 01:02:24 +01:00
|
|
|
|
|
|
|
/* Draw the sample text itself */
|
2004-12-22 18:17:06 +01:00
|
|
|
hOrigFont = SelectObject( hdc, CreateFontIndirectW( &lf ) );
|
2005-12-12 11:54:19 +01:00
|
|
|
SetTextColor( hdc, lpcf->rgbColors );
|
2020-10-21 07:49:33 +02:00
|
|
|
SetBkMode( hdc, TRANSPARENT );
|
2004-10-07 19:35:08 +02:00
|
|
|
|
2003-12-01 23:40:56 +01:00
|
|
|
DrawTextW( hdc,
|
|
|
|
sample_lang_text[CHARSET_ORDER[lpcf->lpLogFont->lfCharSet]],
|
|
|
|
-1, &info.rcWindow, DT_CENTER|DT_VCENTER|DT_SINGLELINE );
|
2003-11-29 00:35:34 +01:00
|
|
|
|
2003-12-08 22:52:43 +01:00
|
|
|
DeleteObject(SelectObject( hdc, hOrigFont ));
|
2003-02-15 01:02:24 +01:00
|
|
|
EndPaint( hDlg, &ps );
|
|
|
|
}
|
|
|
|
return FALSE;
|
|
|
|
}
|
1999-02-28 21:05:11 +01:00
|
|
|
|
|
|
|
/***********************************************************************
|
2000-03-28 22:22:59 +02:00
|
|
|
* FormatCharDlgProcA [internal]
|
1999-02-28 21:05:11 +01:00
|
|
|
*/
|
2009-11-12 18:36:43 +01:00
|
|
|
static INT_PTR CALLBACK FormatCharDlgProcA(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
1999-02-28 21:05:11 +01:00
|
|
|
{
|
2004-12-22 18:17:06 +01:00
|
|
|
LPCHOOSEFONTW lpcfw;
|
|
|
|
LPCHOOSEFONTA lpcfa;
|
2003-11-29 00:35:34 +01:00
|
|
|
INT_PTR res = FALSE;
|
2004-12-22 18:17:06 +01:00
|
|
|
int len;
|
2004-10-07 19:35:08 +02:00
|
|
|
|
2004-12-22 18:17:06 +01:00
|
|
|
if (uMsg!=WM_INITDIALOG) {
|
2008-10-30 22:31:35 +01:00
|
|
|
lpcfw = GetPropW(hDlg, strWineFontData);
|
2010-07-01 13:45:16 +02:00
|
|
|
if (lpcfw && CFn_HookCallChk32(lpcfw))
|
2004-12-22 18:17:06 +01:00
|
|
|
res=CallWindowProcA((WNDPROC)lpcfw->lpfnHook, hDlg, uMsg, wParam, lParam);
|
2003-11-29 00:35:34 +01:00
|
|
|
if (res)
|
|
|
|
return res;
|
2004-12-22 18:17:06 +01:00
|
|
|
} else {
|
|
|
|
lpcfa=(LPCHOOSEFONTA)lParam;
|
|
|
|
SetPropW(hDlg, strWineFontData_a, (HANDLE)lParam);
|
|
|
|
|
2018-03-20 08:37:47 +01:00
|
|
|
lpcfw = heap_alloc(sizeof(*lpcfw));
|
2004-12-22 18:17:06 +01:00
|
|
|
memcpy(lpcfw, lpcfa, sizeof(CHOOSEFONTA));
|
2018-03-20 08:37:47 +01:00
|
|
|
lpcfw->lpLogFont = heap_alloc(sizeof(*lpcfw->lpLogFont));
|
2004-12-22 18:17:06 +01:00
|
|
|
memcpy(lpcfw->lpLogFont, lpcfa->lpLogFont, sizeof(LOGFONTA));
|
|
|
|
MultiByteToWideChar(CP_ACP, 0, lpcfa->lpLogFont->lfFaceName,
|
|
|
|
LF_FACESIZE, lpcfw->lpLogFont->lfFaceName, LF_FACESIZE);
|
|
|
|
|
2005-02-14 12:00:37 +01:00
|
|
|
if((lpcfa->Flags & CF_USESTYLE) && lpcfa->lpszStyle) {
|
2004-12-22 18:17:06 +01:00
|
|
|
len = MultiByteToWideChar(CP_ACP, 0, lpcfa->lpszStyle, -1, NULL, 0);
|
2018-03-20 08:37:47 +01:00
|
|
|
lpcfw->lpszStyle = heap_alloc(len * sizeof(WCHAR));
|
2004-12-22 18:17:06 +01:00
|
|
|
MultiByteToWideChar(CP_ACP, 0, lpcfa->lpszStyle, -1, lpcfw->lpszStyle, len);
|
|
|
|
}
|
|
|
|
|
2010-02-28 13:28:08 +01:00
|
|
|
if (!CFn_WMInitDialog(hDlg, lParam, lpcfw))
|
2003-11-29 00:35:34 +01:00
|
|
|
{
|
|
|
|
TRACE("CFn_WMInitDialog returned FALSE\n");
|
|
|
|
return FALSE;
|
|
|
|
}
|
2004-12-22 18:17:06 +01:00
|
|
|
if (CFn_HookCallChk32(lpcfw))
|
|
|
|
return CallWindowProcA((WNDPROC)lpcfa->lpfnHook,hDlg,WM_INITDIALOG,wParam,lParam);
|
2002-06-01 01:06:46 +02:00
|
|
|
}
|
2003-11-29 00:35:34 +01:00
|
|
|
switch (uMsg)
|
1999-02-28 21:05:11 +01:00
|
|
|
{
|
2003-11-29 00:35:34 +01:00
|
|
|
case WM_MEASUREITEM:
|
2010-03-06 14:55:51 +01:00
|
|
|
return CFn_WMMeasureItem(hDlg,lParam);
|
2003-11-29 00:35:34 +01:00
|
|
|
case WM_DRAWITEM:
|
2010-03-06 14:55:51 +01:00
|
|
|
return CFn_WMDrawItem(lParam);
|
2003-11-29 00:35:34 +01:00
|
|
|
case WM_COMMAND:
|
2004-12-22 18:17:06 +01:00
|
|
|
return CFn_WMCommand(hDlg, wParam, lParam, lpcfw);
|
2003-11-29 00:35:34 +01:00
|
|
|
case WM_DESTROY:
|
2010-02-28 13:28:08 +01:00
|
|
|
return CFn_WMDestroy(hDlg, lpcfw);
|
2003-11-29 00:35:34 +01:00
|
|
|
case WM_CHOOSEFONT_GETLOGFONT:
|
2012-03-13 22:12:07 +01:00
|
|
|
{
|
|
|
|
LOGFONTA *logfont = (LOGFONTA *)lParam;
|
2004-12-22 18:17:06 +01:00
|
|
|
TRACE("WM_CHOOSEFONT_GETLOGFONT lParam=%08lX\n", lParam);
|
2012-03-13 22:12:07 +01:00
|
|
|
memcpy( logfont, lpcfw->lpLogFont, FIELD_OFFSET( LOGFONTA, lfFaceName ));
|
|
|
|
WideCharToMultiByte( CP_ACP, 0, lpcfw->lpLogFont->lfFaceName, LF_FACESIZE,
|
|
|
|
logfont->lfFaceName, LF_FACESIZE, NULL, NULL );
|
2003-11-29 00:35:34 +01:00
|
|
|
break;
|
2012-03-13 22:12:07 +01:00
|
|
|
}
|
2003-11-29 00:35:34 +01:00
|
|
|
case WM_PAINT:
|
2004-12-22 18:17:06 +01:00
|
|
|
return CFn_WMPaint(hDlg, wParam, lParam, lpcfw);
|
1999-02-28 21:05:11 +01:00
|
|
|
}
|
2003-11-29 00:35:34 +01:00
|
|
|
return res;
|
1999-02-28 21:05:11 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
2000-03-28 22:22:59 +02:00
|
|
|
* FormatCharDlgProcW [internal]
|
1999-02-28 21:05:11 +01:00
|
|
|
*/
|
2009-11-12 18:36:43 +01:00
|
|
|
static INT_PTR CALLBACK FormatCharDlgProcW(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
1999-02-28 21:05:11 +01:00
|
|
|
{
|
2004-12-22 18:17:06 +01:00
|
|
|
LPCHOOSEFONTW lpcf;
|
2003-11-29 00:35:34 +01:00
|
|
|
INT_PTR res = FALSE;
|
2004-10-07 19:35:08 +02:00
|
|
|
|
2003-11-29 00:35:34 +01:00
|
|
|
if (uMsg!=WM_INITDIALOG)
|
1999-02-28 21:05:11 +01:00
|
|
|
{
|
2008-10-30 22:31:35 +01:00
|
|
|
lpcf= GetPropW(hDlg, strWineFontData);
|
2010-07-01 13:45:16 +02:00
|
|
|
if (lpcf && CFn_HookCallChk32(lpcf))
|
2004-12-22 18:17:06 +01:00
|
|
|
res=CallWindowProcW((WNDPROC)lpcf->lpfnHook, hDlg, uMsg, wParam, lParam);
|
2003-11-29 00:35:34 +01:00
|
|
|
if (res)
|
|
|
|
return res;
|
2002-06-01 01:06:46 +02:00
|
|
|
}
|
2003-11-29 00:35:34 +01:00
|
|
|
else
|
|
|
|
{
|
2004-12-22 18:17:06 +01:00
|
|
|
lpcf=(LPCHOOSEFONTW)lParam;
|
2010-02-28 13:28:08 +01:00
|
|
|
if (!CFn_WMInitDialog(hDlg, lParam, lpcf))
|
2003-11-29 00:35:34 +01:00
|
|
|
{
|
|
|
|
TRACE("CFn_WMInitDialog returned FALSE\n");
|
|
|
|
return FALSE;
|
|
|
|
}
|
2004-12-22 18:17:06 +01:00
|
|
|
if (CFn_HookCallChk32(lpcf))
|
|
|
|
return CallWindowProcW((WNDPROC)lpcf->lpfnHook,hDlg,WM_INITDIALOG,wParam,lParam);
|
2003-11-29 00:35:34 +01:00
|
|
|
}
|
|
|
|
switch (uMsg)
|
1999-02-28 21:05:11 +01:00
|
|
|
{
|
2003-11-29 00:35:34 +01:00
|
|
|
case WM_MEASUREITEM:
|
2010-03-06 14:55:51 +01:00
|
|
|
return CFn_WMMeasureItem(hDlg, lParam);
|
2003-11-29 00:35:34 +01:00
|
|
|
case WM_DRAWITEM:
|
2010-03-06 14:55:51 +01:00
|
|
|
return CFn_WMDrawItem(lParam);
|
2003-11-29 00:35:34 +01:00
|
|
|
case WM_COMMAND:
|
2004-12-22 18:17:06 +01:00
|
|
|
return CFn_WMCommand(hDlg, wParam, lParam, lpcf);
|
2003-11-29 00:35:34 +01:00
|
|
|
case WM_DESTROY:
|
2004-12-22 18:17:06 +01:00
|
|
|
return TRUE;
|
2003-11-29 00:35:34 +01:00
|
|
|
case WM_CHOOSEFONT_GETLOGFONT:
|
2004-12-22 18:17:06 +01:00
|
|
|
TRACE("WM_CHOOSEFONT_GETLOGFONT lParam=%08lX\n", lParam);
|
2012-03-13 22:12:07 +01:00
|
|
|
memcpy( (LOGFONTW *)lParam, lpcf->lpLogFont, sizeof(LOGFONTW) );
|
2003-11-29 00:35:34 +01:00
|
|
|
break;
|
2004-12-22 18:17:06 +01:00
|
|
|
case WM_PAINT:
|
|
|
|
return CFn_WMPaint(hDlg, wParam, lParam, lpcf);
|
1999-02-28 21:05:11 +01:00
|
|
|
}
|
2003-11-29 00:35:34 +01:00
|
|
|
return res;
|
1999-02-28 21:05:11 +01:00
|
|
|
}
|