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
04c1f9f8
Commit
04c1f9f8
authored
Jul 09, 2003
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Only compute dialog base units once we need them.
parent
c28575e0
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
25 additions
and
66 deletions
+25
-66
controls.h
dlls/user/controls.h
+1
-2
dialog16.c
dlls/user/dialog16.c
+2
-2
user_main.c
dlls/user/user_main.c
+0
-3
dialog.c
windows/dialog.c
+22
-59
No files found.
dlls/user/controls.h
View file @
04c1f9f8
...
...
@@ -138,8 +138,7 @@ inline static DIALOGINFO *DIALOG_get_info( HWND hwnd )
return
(
DIALOGINFO
*
)
GetWindowLongW
(
hwnd
,
DWL_WINE_DIALOGINFO
);
}
extern
BOOL
DIALOG_Init
(
void
);
extern
BOOL
DIALOG_GetCharSize
(
HFONT
hFont
,
SIZE
*
pSize
);
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/dialog16.c
View file @
04c1f9f8
...
...
@@ -324,19 +324,19 @@ static HWND DIALOG_CreateIndirect16( HINSTANCE16 hInst, LPCVOID dlgTemplate,
int
pixels
;
dc
=
GetDC
(
0
);
pixels
=
MulDiv
(
template
.
pointSize
,
GetDeviceCaps
(
dc
,
LOGPIXELSY
),
72
);
ReleaseDC
(
0
,
dc
);
dlgInfo
->
hUserFont
=
CreateFontA
(
-
pixels
,
0
,
0
,
0
,
FW_DONTCARE
,
FALSE
,
FALSE
,
FALSE
,
DEFAULT_CHARSET
,
0
,
0
,
PROOF_QUALITY
,
FF_DONTCARE
,
template
.
faceName
);
if
(
dlgInfo
->
hUserFont
)
{
SIZE
charSize
;
if
(
DIALOG_GetCharSize
(
dlgInfo
->
hUserFont
,
&
charSize
))
if
(
DIALOG_GetCharSize
(
d
c
,
d
lgInfo
->
hUserFont
,
&
charSize
))
{
dlgInfo
->
xBaseUnit
=
charSize
.
cx
;
dlgInfo
->
yBaseUnit
=
charSize
.
cy
;
}
}
ReleaseDC
(
0
,
dc
);
TRACE
(
"units = %d,%d
\n
"
,
dlgInfo
->
xBaseUnit
,
dlgInfo
->
yBaseUnit
);
}
...
...
dlls/user/user_main.c
View file @
04c1f9f8
...
...
@@ -243,9 +243,6 @@ static BOOL process_attach(void)
/* Initialize built-in window classes */
controls_init
();
/* Initialize dialog manager */
if
(
!
DIALOG_Init
())
return
FALSE
;
/* Initialize menus */
if
(
!
MENU_Init
())
return
FALSE
;
...
...
windows/dialog.c
View file @
04c1f9f8
...
...
@@ -89,9 +89,6 @@ typedef struct
UINT
checkID
;
}
RADIOGROUP
;
/* Dialog base units */
static
WORD
xBaseUnit
=
0
,
yBaseUnit
=
0
;
/*********************************************************************
* dialog class descriptor
...
...
@@ -146,7 +143,7 @@ BOOL DIALOG_DisableOwner( HWND hOwner )
}
/***********************************************************************
* DIALOG_GetCharSize
FromDC
* DIALOG_GetCharSize
*
* Despite most of MSDN insisting that the horizontal base unit is
* tmAveCharWidth it isn't. Knowledge base article Q145994
...
...
@@ -154,16 +151,13 @@ BOOL DIALOG_DisableOwner( HWND hOwner )
* says that we should take the average of the 52 English upper and lower
* case characters.
*/
static
BOOL
DIALOG_GetCharSizeFromDC
(
HDC
hDC
,
HFONT
hFont
,
SIZE
*
pSize
)
BOOL
DIALOG_GetCharSize
(
HDC
hDC
,
HFONT
hFont
,
SIZE
*
pSize
)
{
HFONT
hFontPrev
=
0
;
char
*
alphabet
=
"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
;
SIZE
sz
;
TEXTMETRICA
tm
;
pSize
->
cx
=
xBaseUnit
;
pSize
->
cy
=
yBaseUnit
;
if
(
!
hDC
)
return
FALSE
;
if
(
hFont
)
hFontPrev
=
SelectObject
(
hDC
,
hFont
);
...
...
@@ -179,52 +173,6 @@ static BOOL DIALOG_GetCharSizeFromDC( HDC hDC, HFONT hFont, SIZE * pSize )
return
TRUE
;
}
/***********************************************************************
* DIALOG_GetCharSize
*
* A convenient variant of DIALOG_GetCharSizeFromDC.
*/
BOOL
DIALOG_GetCharSize
(
HFONT
hFont
,
SIZE
*
pSize
)
{
HDC
hDC
=
GetDC
(
0
);
BOOL
Success
=
DIALOG_GetCharSizeFromDC
(
hDC
,
hFont
,
pSize
);
ReleaseDC
(
0
,
hDC
);
return
Success
;
}
/***********************************************************************
* DIALOG_Init
*
* Initialisation of the dialog manager.
*/
BOOL
DIALOG_Init
(
void
)
{
HDC
hdc
;
SIZE
size
;
/* Calculate the dialog base units */
if
(
!
(
hdc
=
CreateDCA
(
"DISPLAY"
,
NULL
,
NULL
,
NULL
)))
{
ERR
(
"Could not create Display DC
\n
"
);
return
FALSE
;
}
if
(
!
DIALOG_GetCharSizeFromDC
(
hdc
,
0
,
&
size
))
{
DeleteDC
(
hdc
);
ERR
(
"Could not initialize base dialog units
\n
"
);
return
FALSE
;
}
DeleteDC
(
hdc
);
xBaseUnit
=
size
.
cx
;
yBaseUnit
=
size
.
cy
;
TRACE
(
"base units = %d,%d
\n
"
,
xBaseUnit
,
yBaseUnit
);
return
TRUE
;
}
/***********************************************************************
* DIALOG_GetControl32
...
...
@@ -545,6 +493,7 @@ static HWND DIALOG_CreateIndirect( HINSTANCE hInst, LPCVOID dlgTemplate,
WND
*
wndPtr
;
DLG_TEMPLATE
template
;
DIALOGINFO
*
dlgInfo
;
DWORD
units
=
GetDialogBaseUnits
();
BOOL
ownerEnabled
=
TRUE
;
/* Parse dialog template */
...
...
@@ -558,8 +507,8 @@ static HWND DIALOG_CreateIndirect( HINSTANCE hInst, LPCVOID dlgTemplate,
dlgInfo
->
hwndFocus
=
0
;
dlgInfo
->
hUserFont
=
0
;
dlgInfo
->
hMenu
=
0
;
dlgInfo
->
xBaseUnit
=
xBaseUnit
;
dlgInfo
->
yBaseUnit
=
yBaseUnit
;
dlgInfo
->
xBaseUnit
=
LOWORD
(
units
)
;
dlgInfo
->
yBaseUnit
=
HIWORD
(
units
)
;
dlgInfo
->
idResult
=
0
;
dlgInfo
->
flags
=
0
;
dlgInfo
->
hDialogHeap
=
0
;
...
...
@@ -578,7 +527,6 @@ static HWND DIALOG_CreateIndirect( HINSTANCE hInst, LPCVOID dlgTemplate,
int
pixels
;
dc
=
GetDC
(
0
);
pixels
=
MulDiv
(
template
.
pointSize
,
GetDeviceCaps
(
dc
,
LOGPIXELSY
),
72
);
ReleaseDC
(
0
,
dc
);
dlgInfo
->
hUserFont
=
CreateFontW
(
-
pixels
,
0
,
0
,
0
,
template
.
weight
,
template
.
italic
,
FALSE
,
FALSE
,
DEFAULT_CHARSET
,
0
,
0
,
PROOF_QUALITY
,
FF_DONTCARE
,
...
...
@@ -586,12 +534,13 @@ static HWND DIALOG_CreateIndirect( HINSTANCE hInst, LPCVOID dlgTemplate,
if
(
dlgInfo
->
hUserFont
)
{
SIZE
charSize
;
if
(
DIALOG_GetCharSize
(
dlgInfo
->
hUserFont
,
&
charSize
))
if
(
DIALOG_GetCharSize
(
d
c
,
d
lgInfo
->
hUserFont
,
&
charSize
))
{
dlgInfo
->
xBaseUnit
=
charSize
.
cx
;
dlgInfo
->
yBaseUnit
=
charSize
.
cy
;
}
}
ReleaseDC
(
0
,
dc
);
TRACE
(
"units = %d,%d
\n
"
,
dlgInfo
->
xBaseUnit
,
dlgInfo
->
yBaseUnit
);
}
...
...
@@ -1358,7 +1307,21 @@ BOOL WINAPI CheckRadioButton( HWND hwndDlg, UINT firstID,
*/
DWORD
WINAPI
GetDialogBaseUnits
(
void
)
{
return
MAKELONG
(
xBaseUnit
,
yBaseUnit
);
static
DWORD
units
;
if
(
!
units
)
{
HDC
hdc
;
SIZE
size
;
if
((
hdc
=
GetDC
(
0
)))
{
if
(
DIALOG_GetCharSize
(
hdc
,
0
,
&
size
))
units
=
MAKELONG
(
size
.
cx
,
size
.
cy
);
ReleaseDC
(
0
,
hdc
);
}
TRACE
(
"base units = %d,%d
\n
"
,
LOWORD
(
units
),
HIWORD
(
units
)
);
}
return
units
;
}
...
...
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