Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-cw
Commits
1866dfbe
Commit
1866dfbe
authored
Aug 02, 2004
by
James Hawkins
Committed by
Alexandre Julliard
Aug 02, 2004
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Cleanup A->W cross calls.
parent
7155eff8
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
48 additions
and
154 deletions
+48
-154
fontdlg.c
dlls/commdlg/fontdlg.c
+48
-154
No files found.
dlls/commdlg/fontdlg.c
View file @
1866dfbe
...
...
@@ -163,14 +163,17 @@ void _dump_cf_flags(DWORD cflags)
}
/***********************************************************************
* ChooseFont
A
(COMDLG32.@)
* ChooseFont
W
(COMDLG32.@)
*/
BOOL
WINAPI
ChooseFont
A
(
LPCHOOSEFONTA
lpChFont
)
BOOL
WINAPI
ChooseFont
W
(
LPCHOOSEFONTW
lpChFont
)
{
LPCVOID
template
;
HRSRC
hResInfo
;
HINSTANCE
hDlginst
;
HGLOBAL
hDlgTmpl
;
static
const
WCHAR
chooseFontW
[]
=
{
'C'
,
'H'
,
'O'
,
'O'
,
'S'
,
'E'
,
'_'
,
'F'
,
'O'
,
'N'
,
'T'
,
0
};
if
(
(
lpChFont
->
Flags
&
CF_ENABLETEMPLATEHANDLE
)
!=
0
)
{
...
...
@@ -180,8 +183,8 @@ BOOL WINAPI ChooseFontA(LPCHOOSEFONTA lpChFont)
if
(
(
lpChFont
->
Flags
&
CF_ENABLETEMPLATE
)
!=
0
)
{
hDlginst
=
lpChFont
->
hInstance
;
if
(
!
(
hResInfo
=
FindResource
A
(
hDlginst
,
lpChFont
->
lpTemplateName
,
(
LPSTR
)
RT_DIALOG
)))
if
(
!
(
hResInfo
=
FindResource
W
(
hDlginst
,
lpChFont
->
lpTemplateName
,
(
LP
W
STR
)
RT_DIALOG
)))
{
COMDLG32_SetCommDlgExtendedError
(
CDERR_FINDRESFAILURE
);
return
FALSE
;
...
...
@@ -189,7 +192,7 @@ BOOL WINAPI ChooseFontA(LPCHOOSEFONTA lpChFont)
}
else
{
hDlginst
=
COMDLG32_hInstance
;
if
(
!
(
hResInfo
=
FindResource
A
(
hDlginst
,
"CHOOSE_FONT"
,
(
LP
STR
)
RT_DIALOG
)))
if
(
!
(
hResInfo
=
FindResource
W
(
hDlginst
,
chooseFontW
,
(
LPW
STR
)
RT_DIALOG
)))
{
COMDLG32_SetCommDlgExtendedError
(
CDERR_FINDRESFAILURE
);
return
FALSE
;
...
...
@@ -208,169 +211,60 @@ BOOL WINAPI ChooseFontA(LPCHOOSEFONTA lpChFont)
if
(
lpChFont
->
Flags
&
(
CF_SELECTSCRIPT
|
CF_NOVERTFONTS
))
FIXME
(
": unimplemented flag (ignored)
\n
"
);
return
DialogBoxIndirectParam
A
(
COMDLG32_hInstance
,
template
,
lpChFont
->
hwndOwner
,
FormatCharDlgProc
A
,
(
LPARAM
)
lpChFont
);
return
DialogBoxIndirectParam
W
(
COMDLG32_hInstance
,
template
,
lpChFont
->
hwndOwner
,
FormatCharDlgProc
W
,
(
LPARAM
)
lpChFont
);
}
/***********************************************************************
* ChooseFontW (COMDLG32.@)
*
* NOTES:
*
* The LOGFONT conversion functions will break if the structure ever
* grows beyond the lfFaceName element.
*
* The CHOOSEFONT conversion functions assume that both versions of
* lpLogFont and lpszStyle (if used) point to pre-allocated objects.
*
* The ASCII version of lpTemplateName is created by ChooseFontAtoW
* and freed by ChooseFontWtoA.
* ChooseFontA (COMDLG32.@)
*/
inline
static
VOID
LogFontWtoA
(
const
LOGFONTW
*
lfw
,
LOGFONTA
*
lfa
)
{
memcpy
(
lfa
,
lfw
,
sizeof
(
LOGFONTA
));
WideCharToMultiByte
(
CP_ACP
,
0
,
lfw
->
lfFaceName
,
-
1
,
lfa
->
lfFaceName
,
LF_FACESIZE
,
NULL
,
NULL
);
lfa
->
lfFaceName
[
LF_FACESIZE
-
1
]
=
'\0'
;
}
inline
static
VOID
LogFontAtoW
(
const
LOGFONTA
*
lfa
,
LOGFONTW
*
lfw
)
{
memcpy
(
lfw
,
lfa
,
sizeof
(
LOGFONTA
));
MultiByteToWideChar
(
CP_ACP
,
0
,
lfa
->
lfFaceName
,
-
1
,
lfw
->
lfFaceName
,
LF_FACESIZE
);
lfw
->
lfFaceName
[
LF_FACESIZE
-
1
]
=
0
;
}
static
BOOL
ChooseFontWtoA
(
const
CHOOSEFONTW
*
cfw
,
CHOOSEFONTA
*
cfa
)
{
LOGFONTA
*
lpLogFont
=
cfa
->
lpLogFont
;
LPSTR
lpszStyle
=
cfa
->
lpszStyle
;
memcpy
(
cfa
,
cfw
,
sizeof
(
CHOOSEFONTA
));
cfa
->
lpLogFont
=
lpLogFont
;
cfa
->
lpszStyle
=
lpszStyle
;
LogFontWtoA
(
cfw
->
lpLogFont
,
lpLogFont
);
if
((
cfw
->
Flags
&
CF_ENABLETEMPLATE
)
!=
0
&&
HIWORD
(
cfw
->
lpTemplateName
)
!=
0
)
{
cfa
->
lpTemplateName
=
HEAP_strdupWtoA
(
GetProcessHeap
(),
0
,
cfw
->
lpTemplateName
);
if
(
cfa
->
lpTemplateName
==
NULL
)
return
FALSE
;
}
if
((
cfw
->
Flags
&
CF_USESTYLE
)
!=
0
&&
cfw
->
lpszStyle
!=
NULL
)
{
WideCharToMultiByte
(
CP_ACP
,
0
,
cfw
->
lpszStyle
,
-
1
,
cfa
->
lpszStyle
,
LF_FACESIZE
,
NULL
,
NULL
);
cfa
->
lpszStyle
[
LF_FACESIZE
-
1
]
=
'\0'
;
}
return
TRUE
;
}
static
VOID
ChooseFontAtoW
(
const
CHOOSEFONTA
*
cfa
,
CHOOSEFONTW
*
cfw
)
{
LOGFONTW
*
lpLogFont
=
cfw
->
lpLogFont
;
LPWSTR
lpszStyle
=
cfw
->
lpszStyle
;
LPCWSTR
lpTemplateName
=
cfw
->
lpTemplateName
;
memcpy
(
cfw
,
cfa
,
sizeof
(
CHOOSEFONTA
));
cfw
->
lpLogFont
=
lpLogFont
;
cfw
->
lpszStyle
=
lpszStyle
;
cfw
->
lpTemplateName
=
lpTemplateName
;
LogFontAtoW
(
cfa
->
lpLogFont
,
lpLogFont
);
if
((
cfa
->
Flags
&
CF_ENABLETEMPLATE
)
!=
0
&&
HIWORD
(
cfa
->
lpTemplateName
)
!=
0
)
HeapFree
(
GetProcessHeap
(),
0
,
(
LPSTR
)(
cfa
->
lpTemplateName
));
if
((
cfa
->
Flags
&
CF_USESTYLE
)
!=
0
&&
cfa
->
lpszStyle
!=
NULL
)
{
MultiByteToWideChar
(
CP_ACP
,
0
,
cfa
->
lpszStyle
,
-
1
,
cfw
->
lpszStyle
,
LF_FACESIZE
);
cfw
->
lpszStyle
[
LF_FACESIZE
-
1
]
=
0
;
}
}
BOOL
WINAPI
ChooseFontW
(
LPCHOOSEFONTW
lpChFont
)
BOOL
WINAPI
ChooseFontA
(
LPCHOOSEFONTA
lpChFont
)
{
CHOOSEFONTA
cf_a
;
LOGFONTA
lf_a
;
CHAR
style_a
[
LF_FACESIZE
];
cf_a
.
lpLogFont
=
&
lf_a
;
cf_a
.
lpszStyle
=
style_a
;
LPCVOID
template
;
HRSRC
hResInfo
;
HINSTANCE
hDlginst
;
HGLOBAL
hDlgTmpl
;
if
(
ChooseFontWtoA
(
lpChFont
,
&
cf_a
)
==
FALSE
)
if
(
(
lpChFont
->
Flags
&
CF_ENABLETEMPLATEHANDLE
)
!=
0
)
{
COMDLG32_SetCommDlgExtendedError
(
CDERR_MEMALLOCFAILURE
);
return
FALSE
;
}
if
(
ChooseFontA
(
&
cf_a
)
==
FALSE
)
template
=
(
LPCVOID
)
lpChFont
->
hInstance
;
}
else
{
if
(
cf_a
.
lpTemplateName
!=
NULL
)
HeapFree
(
GetProcessHeap
(),
0
,
(
LPSTR
)(
cf_a
.
lpTemplateName
));
return
FALSE
;
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
;
if
(
!
(
hResInfo
=
FindResourceA
(
hDlginst
,
"CHOOSE_FONT"
,
(
LPSTR
)
RT_DIALOG
)))
{
COMDLG32_SetCommDlgExtendedError
(
CDERR_FINDRESFAILURE
);
return
FALSE
;
}
}
if
(
!
(
hDlgTmpl
=
LoadResource
(
hDlginst
,
hResInfo
))
||
!
(
template
=
LockResource
(
hDlgTmpl
)))
{
COMDLG32_SetCommDlgExtendedError
(
CDERR_LOADRESFAILURE
);
return
FALSE
;
}
}
ChooseFontAtoW
(
&
cf_a
,
lpChFont
);
return
TRUE
;
}
#if 0
/***********************************************************************
* ChooseFontW (COMDLG32.@)
*/
BOOL WINAPI ChooseFontW(LPCHOOSEFONTW lpChFont)
{
BOOL bRet=FALSE;
CHOOSEFONTA cf32a;
LOGFONTA lf32a;
LPCVOID template;
HANDLE hResInfo, hDlgTmpl;
if
(
TRACE_ON
(
commdlg
))
_dump_cf_flags
(
lpChFont
->
Flags
);
if (!(hResInfo = FindResourceA(COMDLG32_hInstance, "CHOOSE_FONT", (LPSTR)RT_DIALOG)))
{
COMDLG32_SetCommDlgExtendedError(CDERR_FINDRESFAILURE);
return FALSE;
}
if (!(hDlgTmpl = LoadResource(COMDLG32_hInstance, hResInfo )) ||
!(template = LockResource( hDlgTmpl )))
{
COMDLG32_SetCommDlgExtendedError(CDERR_LOADRESFAILURE);
return FALSE;
}
if
(
lpChFont
->
Flags
&
(
CF_SELECTSCRIPT
|
CF_NOVERTFONTS
))
FIXME
(
": unimplemented flag (ignored)
\n
"
);
if (lpChFont->Flags & (CF_SELECTSCRIPT | CF_NOVERTFONTS | CF_ENABLETEMPLATE |
CF_ENABLETEMPLATEHANDLE)) FIXME(": unimplemented flag (ignored)\n");
memcpy(&cf32a, lpChFont, sizeof(cf32a));
memcpy(&lf32a, lpChFont->lpLogFont, sizeof(LOGFONTA));
WideCharToMultiByte( CP_ACP, 0, lpChFont->lpLogFont->lfFaceName, -1,
lf32a.lfFaceName, LF_FACESIZE, NULL, NULL );
lf32a.lfFaceName[LF_FACESIZE-1] = 0;
cf32a.lpLogFont=&lf32a;
cf32a.lpszStyle=HEAP_strdupWtoA(GetProcessHeap(), 0, lpChFont->lpszStyle);
lpChFont->lpTemplateName=(LPWSTR)&cf32a;
bRet = DialogBoxIndirectParamW(COMDLG32_hInstance, template,
lpChFont->hwndOwner, FormatCharDlgProcW, (LPARAM)lpChFont );
HeapFree(GetProcessHeap(), 0, cf32a.lpszStyle);
lpChFont->lpTemplateName=(LPWSTR)cf32a.lpTemplateName;
memcpy(lpChFont->lpLogFont, &lf32a, sizeof(CHOOSEFONTA));
MultiByteToWideChar( CP_ACP, 0, lf32a.lfFaceName, -1,
lpChFont->lpLogFont->lfFaceName, LF_FACESIZE );
lpChFont->lpLogFont->lfFaceName[LF_FACESIZE-1] = 0;
return bRet;
return
DialogBoxIndirectParamA
(
COMDLG32_hInstance
,
template
,
lpChFont
->
hwndOwner
,
FormatCharDlgProcA
,
(
LPARAM
)
lpChFont
);
}
#endif
#define TEXT_EXTRAS 4
#define TEXT_COLORS 16
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment