Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
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-winehq
Commits
7a9bacc4
Commit
7a9bacc4
authored
Jul 18, 2005
by
Robert Shearman
Committed by
Alexandre Julliard
Jul 18, 2005
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Replace calls to DIALOG_GetCharSize with code to do the equivalent
using GdiGetCharDimensions.
parent
0ceb6b6f
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
13 additions
and
37 deletions
+13
-37
controls.h
dlls/user/controls.h
+0
-1
dialog.c
dlls/user/dialog.c
+6
-34
dialog16.c
dlls/user/dialog16.c
+4
-1
menu.c
dlls/user/menu.c
+3
-1
No files found.
dlls/user/controls.h
View file @
7a9bacc4
...
...
@@ -148,7 +148,6 @@ typedef struct
#define DWLP_WINE_DIALOGINFO (DWLP_USER+sizeof(ULONG_PTR))
extern
DIALOGINFO
*
DIALOG_get_info
(
HWND
hwnd
,
BOOL
create
);
extern
BOOL
DIALOG_GetCharSize
(
HDC
hdc
,
HFONT
hFont
,
SIZE
*
pSize
);
extern
void
DIALOG_EnableOwner
(
HWND
hOwner
);
extern
BOOL
DIALOG_DisableOwner
(
HWND
hOwner
);
extern
INT
DIALOG_DoDialogBox
(
HWND
hwnd
,
HWND
owner
);
...
...
dlls/user/dialog.c
View file @
7a9bacc4
...
...
@@ -144,38 +144,6 @@ BOOL DIALOG_DisableOwner( HWND hOwner )
}
/***********************************************************************
* DIALOG_GetCharSize
*
* Despite most of MSDN insisting that the horizontal base unit is
* tmAveCharWidth it isn't. Knowledge base article Q145994
* "HOWTO: Calculate Dialog Units When Not Using the System Font",
* says that we should take the average of the 52 English upper and lower
* case characters.
*/
BOOL
DIALOG_GetCharSize
(
HDC
hDC
,
HFONT
hFont
,
SIZE
*
pSize
)
{
HFONT
hFontPrev
=
0
;
const
char
*
alphabet
=
"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
;
SIZE
sz
;
TEXTMETRICA
tm
;
if
(
!
hDC
)
return
FALSE
;
if
(
hFont
)
hFontPrev
=
SelectObject
(
hDC
,
hFont
);
if
(
!
GetTextMetricsA
(
hDC
,
&
tm
))
return
FALSE
;
if
(
!
GetTextExtentPointA
(
hDC
,
alphabet
,
52
,
&
sz
))
return
FALSE
;
pSize
->
cy
=
tm
.
tmHeight
;
pSize
->
cx
=
(
sz
.
cx
/
26
+
1
)
/
2
;
if
(
hFontPrev
)
SelectObject
(
hDC
,
hFontPrev
);
TRACE
(
"dlg base units: %ld x %ld
\n
"
,
pSize
->
cx
,
pSize
->
cy
);
return
TRUE
;
}
/***********************************************************************
* DIALOG_GetControl32
*
* Return the class and text of the control pointed to by ptr,
...
...
@@ -532,11 +500,14 @@ static HWND DIALOG_CreateIndirect( HINSTANCE hInst, LPCVOID dlgTemplate,
if
(
hUserFont
)
{
SIZE
charSize
;
if
(
DIALOG_GetCharSize
(
dc
,
hUserFont
,
&
charSize
))
HFONT
hOldFont
=
SelectObject
(
dc
,
hUserFont
);
charSize
.
cx
=
GdiGetCharDimensions
(
dc
,
NULL
,
&
charSize
.
cy
);
if
(
charSize
.
cx
)
{
xBaseUnit
=
charSize
.
cx
;
yBaseUnit
=
charSize
.
cy
;
}
SelectObject
(
dc
,
hOldFont
);
}
ReleaseDC
(
0
,
dc
);
TRACE
(
"units = %d,%d
\n
"
,
xBaseUnit
,
yBaseUnit
);
...
...
@@ -1439,7 +1410,8 @@ DWORD WINAPI GetDialogBaseUnits(void)
if
((
hdc
=
GetDC
(
0
)))
{
if
(
DIALOG_GetCharSize
(
hdc
,
0
,
&
size
))
units
=
MAKELONG
(
size
.
cx
,
size
.
cy
);
size
.
cx
=
GdiGetCharDimensions
(
hdc
,
NULL
,
&
size
.
cy
);
if
(
size
.
cx
)
units
=
MAKELONG
(
size
.
cx
,
size
.
cy
);
ReleaseDC
(
0
,
hdc
);
}
TRACE
(
"base units = %d,%d
\n
"
,
LOWORD
(
units
),
HIWORD
(
units
)
);
...
...
dlls/user/dialog16.c
View file @
7a9bacc4
...
...
@@ -333,11 +333,14 @@ static HWND DIALOG_CreateIndirect16( HINSTANCE16 hInst, LPCVOID dlgTemplate,
if
(
dlgInfo
->
hUserFont
)
{
SIZE
charSize
;
if
(
DIALOG_GetCharSize
(
dc
,
dlgInfo
->
hUserFont
,
&
charSize
))
HFONT
hOldFont
=
SelectObject
(
dc
,
dlgInfo
->
hUserFont
);
charSize
.
cx
=
GdiGetCharDimensions
(
dc
,
NULL
,
&
charSize
.
cy
);
if
(
charSize
.
cx
)
{
dlgInfo
->
xBaseUnit
=
charSize
.
cx
;
dlgInfo
->
yBaseUnit
=
charSize
.
cy
;
}
SelectObject
(
dc
,
hOldFont
);
}
ReleaseDC
(
0
,
dc
);
TRACE
(
"units = %d,%d
\n
"
,
dlgInfo
->
xBaseUnit
,
dlgInfo
->
yBaseUnit
);
...
...
dlls/user/menu.c
View file @
7a9bacc4
...
...
@@ -860,7 +860,9 @@ static void MENU_CalcItemSize( HDC hdc, MENUITEM *lpitem, HWND hwndOwner,
MEASUREITEMSTRUCT
mis
;
/* not done in Menu_Init: GetDialogBaseUnits() breaks there */
if
(
!
menucharsize
.
cx
)
{
DIALOG_GetCharSize
(
hdc
,
hMenuFont
,
&
menucharsize
);
HFONT
hOldFont
=
SelectObject
(
hdc
,
hMenuFont
);
menucharsize
.
cx
=
GdiGetCharDimensions
(
hdc
,
NULL
,
&
menucharsize
.
cy
);
SelectObject
(
hdc
,
hOldFont
);
/* Win95/98/ME will use menucharsize.cy here. Testing is possible
* but it is unlikely an application will depend on that */
ODitemheight
=
HIWORD
(
GetDialogBaseUnits
());
...
...
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