winemac.drv: Implement GetMonitorInfo.
[wine] / dlls / commdlg.dll16 / fontdlg.c
1 /*
2  * COMMDLG - Font Dialog
3  *
4  * Copyright 1994 Martin Ayotte
5  * Copyright 1996 Albrecht Kleine
6  *
7  * This library is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU Lesser General Public
9  * License as published by the Free Software Foundation; either
10  * version 2.1 of the License, or (at your option) any later version.
11  *
12  * This library is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15  * Lesser General Public License for more details.
16  *
17  * You should have received a copy of the GNU Lesser General Public
18  * License along with this library; if not, write to the Free Software
19  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
20  */
21
22 #include <ctype.h>
23 #include <stdlib.h>
24 #include <stdarg.h>
25 #include <stdio.h>
26 #include <string.h>
27 #include "windef.h"
28 #include "winbase.h"
29 #include "wingdi.h"
30 #include "winuser.h"
31 #include "wine/winbase16.h"
32 #include "wine/winuser16.h"
33 #include "commdlg.h"
34 #include "wine/debug.h"
35 #include "cderr.h"
36 #include "cdlg16.h"
37
38 WINE_DEFAULT_DEBUG_CHANNEL(commdlg);
39
40 /***********************************************************************
41  *                FontFamilyEnumProc                     (COMMDLG.19)
42  */
43 INT16 WINAPI FontFamilyEnumProc16( SEGPTR logfont, SEGPTR metrics,
44                                    UINT16 nFontType, LPARAM lParam )
45 {
46     FIXME( "%08x %08x %u %lx\n", logfont, metrics, nFontType, lParam );
47     return 0;
48 }
49
50 /***********************************************************************
51  *                 FontStyleEnumProc                     (COMMDLG.18)
52  */
53 INT16 WINAPI FontStyleEnumProc16( SEGPTR logfont, SEGPTR metrics,
54                                   UINT16 nFontType, LPARAM lParam )
55 {
56     FIXME( "%08x %08x %u %lx\n", logfont, metrics, nFontType, lParam );
57     return 0;
58 }
59
60 /***********************************************************************
61  *                        ChooseFont   (COMMDLG.15)
62  */
63 BOOL16 WINAPI ChooseFont16(LPCHOOSEFONT16 lpChFont)
64 {
65     CHOOSEFONTA cf32;
66     LOGFONTA lf32;
67     LOGFONT16 *font16;
68
69     if (!lpChFont) return FALSE;
70     font16 = MapSL(lpChFont->lpLogFont);
71
72     cf32.lStructSize = sizeof(CHOOSEFONTW);
73     cf32.hwndOwner = HWND_32(lpChFont->hwndOwner);
74     cf32.hDC = HDC_32(lpChFont->hDC);
75     cf32.iPointSize = lpChFont->iPointSize;
76     cf32.Flags = lpChFont->Flags & ~(CF_ENABLETEMPLATEHANDLE | CF_ENABLETEMPLATE);
77     cf32.rgbColors = lpChFont->rgbColors;
78     cf32.lCustData = lpChFont->lCustData;
79     cf32.lpfnHook = NULL;
80     cf32.hInstance = GetModuleHandleA("comdlg32.dll");
81     cf32.nFontType = lpChFont->nFontType;
82     cf32.nSizeMax = lpChFont->nSizeMax;
83     cf32.nSizeMin = lpChFont->nSizeMin;
84     cf32.lpLogFont = &lf32;
85
86     lf32.lfHeight = font16->lfHeight;
87     lf32.lfWidth = font16->lfWidth;
88     lf32.lfEscapement = font16->lfEscapement;
89     lf32.lfOrientation = font16->lfOrientation;
90     lf32.lfWeight = font16->lfWeight;
91     lf32.lfItalic = font16->lfItalic;
92     lf32.lfUnderline = font16->lfUnderline;
93     lf32.lfStrikeOut = font16->lfStrikeOut;
94     lf32.lfCharSet = font16->lfCharSet;
95     lf32.lfOutPrecision = font16->lfOutPrecision;
96     lf32.lfClipPrecision = font16->lfClipPrecision;
97     lf32.lfQuality = font16->lfQuality;
98     lf32.lfPitchAndFamily = font16->lfPitchAndFamily;
99     lstrcpynA( lf32.lfFaceName, font16->lfFaceName, LF_FACESIZE );
100
101     if (lpChFont->Flags & (CF_ENABLETEMPLATEHANDLE | CF_ENABLETEMPLATE))
102         FIXME( "custom templates no longer supported, using default\n" );
103
104     if (lpChFont->lpfnHook)
105         FIXME( "custom hook %p no longer supported\n", lpChFont->lpfnHook );
106
107     if (!ChooseFontA( &cf32 )) return FALSE;
108
109     lpChFont->iPointSize = cf32.iPointSize;
110     lpChFont->Flags = cf32.Flags;
111     lpChFont->rgbColors = cf32.rgbColors;
112     lpChFont->lCustData = cf32.lCustData;
113     lpChFont->nFontType = cf32.nFontType;
114
115     font16->lfHeight = lf32.lfHeight;
116     font16->lfWidth = lf32.lfWidth;
117     font16->lfEscapement = lf32.lfEscapement;
118     font16->lfOrientation = lf32.lfOrientation;
119     font16->lfWeight = lf32.lfWeight;
120     font16->lfItalic = lf32.lfItalic;
121     font16->lfUnderline = lf32.lfUnderline;
122     font16->lfStrikeOut = lf32.lfStrikeOut;
123     font16->lfCharSet = lf32.lfCharSet;
124     font16->lfOutPrecision = lf32.lfOutPrecision;
125     font16->lfClipPrecision = lf32.lfClipPrecision;
126     font16->lfQuality = lf32.lfQuality;
127     font16->lfPitchAndFamily = lf32.lfPitchAndFamily;
128     lstrcpynA( font16->lfFaceName, lf32.lfFaceName, LF_FACESIZE );
129     return TRUE;
130 }
131
132 /***********************************************************************
133  *           FormatCharDlgProc   (COMMDLG.16)
134              FIXME: 1. some strings are "hardcoded", but it's better load from sysres
135                     2. some CF_.. flags are not supported
136                     3. some TType extensions
137  */
138 BOOL16 CALLBACK FormatCharDlgProc16(HWND16 hDlg16, UINT16 message,
139                                    WPARAM16 wParam, LPARAM lParam)
140 {
141     FIXME( "%04x %04x %04x %08lx: stub\n", hDlg16, message, wParam, lParam );
142     return FALSE;
143 }