#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 */
#undef XX
};
-void _dump_cf_flags(DWORD cflags)
+static void _dump_cf_flags(DWORD cflags)
{
unsigned int i;
/*************************************************************************
* 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;
return ret;
}
+/*************************************************************************
+ * GetScreenDPI [internal]
+ */
+static inline int GetScreenDPI(void)
+{
+ HDC hdc;
+ int result;
+
+ hdc = GetDC(0);
+ result = GetDeviceCaps(hdc, LOGPIXELSY);
+ ReleaseDC(0, hdc);
+
+ return result;
+}
+
/*************************************************************************
* CFn_ReleaseDC [internal]
*/
/***********************************************************************
* 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);
if (nFontType & RASTER_FONTTYPE)
{
INT points;
- if(!(hdc = CFn_GetDC(lpcf))) return 0;
points = MulDiv( lpNTM->ntmTm.tmHeight - lpNTM->ntmTm.tmInternalLeading,
- 72, GetDeviceCaps(hdc, LOGPIXELSY));
- CFn_ReleaseDC(lpcf, hdc);
+ 72, GetScreenDPI());
i = AddFontSizeToCombo3(hcmb3, points, lpcf);
if(i) return 0;
} else if (SetFontSizesToCombo3(hcmb3, lpcf)) return 0;
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) {
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, LPARAM lParam, LPCHOOSEFONTW lpcf)
{
HDC hdc;
int i,j,init=0;
lpxx->lfHeight;
INT points;
int charset = lpxx->lfCharSet;
- points = MulDiv( height, 72, GetDeviceCaps(hdc, LOGPIXELSY));
+ points = MulDiv( height, 72, GetScreenDPI());
pstyle = MAKELONG(lpxx->lfWeight > FW_MEDIUM ? FW_BOLD:
FW_NORMAL,lpxx->lfItalic !=0);
SendDlgItemMessageW(hDlg, cmb1, CB_SETCURSEL, j, 0);
/***********************************************************************
* 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;
/***********************************************************************
* 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];
/***********************************************************************
* 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;
CB_GETITEMDATA , i, 0));
else
lpcf->iPointSize = 100;
- hdc = CFn_GetDC(lpcf);
- if( hdc)
- {
- lpxx->lfHeight = - MulDiv( lpcf->iPointSize ,
- GetDeviceCaps(hdc, LOGPIXELSY), 720);
- CFn_ReleaseDC(lpcf, hdc);
- } else
- lpxx->lfHeight = -lpcf->iPointSize / 10;
+ lpxx->lfHeight = - MulDiv( lpcf->iPointSize ,
+ GetScreenDPI(), 720);
i=SendDlgItemMessageW(hDlg, cmb5, CB_GETCURSEL, 0, 0);
if (i!=CB_ERR)
lpxx->lfCharSet=SendDlgItemMessageW(hDlg, cmb5, CB_GETITEMDATA, i, 0);
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:
return(FALSE);
}
-static LRESULT CFn_WMDestroy(HWND hwnd, WPARAM wParam, LPARAM lParam, LPCHOOSEFONTW lpcfw)
+static LRESULT CFn_WMDestroy(HWND hwnd, LPCHOOSEFONTW lpcfw)
{
LPCHOOSEFONTA lpcfa;
LPSTR lpszStyle;
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;
/***********************************************************************
* 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;
MultiByteToWideChar(CP_ACP, 0, lpcfa->lpszStyle, -1, lpcfw->lpszStyle, len);
}
- if (!CFn_WMInitDialog(hDlg, wParam, lParam, lpcfw))
+ if (!CFn_WMInitDialog(hDlg, lParam, lpcfw))
{
TRACE("CFn_WMInitDialog returned FALSE\n");
return FALSE;
case WM_COMMAND:
return CFn_WMCommand(hDlg, wParam, lParam, lpcfw);
case WM_DESTROY:
- return CFn_WMDestroy(hDlg, wParam, lParam, lpcfw);
+ return CFn_WMDestroy(hDlg, lpcfw);
case WM_CHOOSEFONT_GETLOGFONT:
TRACE("WM_CHOOSEFONT_GETLOGFONT lParam=%08lX\n", lParam);
FIXME("current logfont back to caller\n");
/***********************************************************************
* 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;
else
{
lpcf=(LPCHOOSEFONTW)lParam;
- if (!CFn_WMInitDialog(hDlg, wParam, lParam, lpcf))
+ if (!CFn_WMInitDialog(hDlg, lParam, lpcf))
{
TRACE("CFn_WMInitDialog returned FALSE\n");
return FALSE;