Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
wine
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Package Registry
Container Registry
Model registry
Operate
Terraform modules
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Yoann Laissus
wine
Commits
a4605ac0
Commit
a4605ac0
authored
23 years ago
by
Bill Medland
Committed by
Alexandre Julliard
23 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Put the prefix-underline-drawing away into it's own function so we can
see what is happening.
parent
c43985b2
Loading
Loading
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
dlls/user/text.c
+44
-21
44 additions, 21 deletions
dlls/user/text.c
with
44 additions
and
21 deletions
dlls/user/text.c
+
44
−
21
View file @
a4605ac0
...
...
@@ -212,6 +212,42 @@ static const WCHAR *TEXT_NextLineW( HDC hdc, const WCHAR *str, int *count,
}
/***********************************************************************
* TEXT_DrawUnderscore
*
* Draw the underline under the prefixed character
*
* Parameters
* hdc [in] The handle of the DC for drawing
* x [in] The x location of the line segment (logical coordinates)
* y [in] The y location of where the underscore should appear
* (logical coordinates)
* str [in] The text of the line segment
* offset [in] The offset of the underscored character within str
*/
static
void
TEXT_DrawUnderscore
(
HDC
hdc
,
int
x
,
int
y
,
const
WCHAR
*
str
,
int
offset
)
{
int
prefix_x
;
int
prefix_end
;
SIZE
size
;
HPEN
hpen
;
HPEN
oldPen
;
GetTextExtentPointW
(
hdc
,
str
,
offset
,
&
size
);
prefix_x
=
x
+
size
.
cx
;
GetTextExtentPointW
(
hdc
,
str
,
offset
+
1
,
&
size
);
prefix_end
=
x
+
size
.
cx
-
1
;
/* The above method may eventually be slightly wrong due to kerning etc. */
hpen
=
CreatePen
(
PS_SOLID
,
1
,
GetTextColor
(
hdc
));
oldPen
=
SelectObject
(
hdc
,
hpen
);
MoveToEx
(
hdc
,
prefix_x
,
y
,
NULL
);
LineTo
(
hdc
,
prefix_end
,
y
);
SelectObject
(
hdc
,
oldPen
);
DeleteObject
(
hpen
);
}
/***********************************************************************
* DrawTextExW (USER32.@)
*/
...
...
@@ -223,8 +259,6 @@ INT WINAPI DrawTextExW( HDC hdc, LPWSTR str, INT i_count,
const
WCHAR
*
strPtr
;
static
WCHAR
line
[
MAX_STATIC_BUFFER
];
int
len
,
lh
,
count
=
i_count
;
int
prefix_x
=
0
;
int
prefix_end
=
0
;
TEXTMETRICW
tm
;
int
lmargin
=
0
,
rmargin
=
0
;
int
x
=
rect
->
left
,
y
=
rect
->
top
;
...
...
@@ -275,14 +309,6 @@ INT WINAPI DrawTextExW( HDC hdc, LPWSTR str, INT i_count,
len
=
MAX_STATIC_BUFFER
;
strPtr
=
TEXT_NextLineW
(
hdc
,
strPtr
,
&
count
,
line
,
&
len
,
width
,
flags
);
if
(
prefix_offset
!=
-
1
)
{
GetTextExtentPointW
(
hdc
,
line
,
prefix_offset
,
&
size
);
prefix_x
=
size
.
cx
;
GetTextExtentPointW
(
hdc
,
line
,
prefix_offset
+
1
,
&
size
);
prefix_end
=
size
.
cx
-
1
;
}
if
(
!
GetTextExtentPointW
(
hdc
,
line
,
len
,
&
size
))
return
0
;
if
(
flags
&
DT_CENTER
)
x
=
(
rect
->
left
+
rect
->
right
-
size
.
cx
)
/
2
;
...
...
@@ -302,6 +328,7 @@ INT WINAPI DrawTextExW( HDC hdc, LPWSTR str, INT i_count,
WCHAR
*
fnameDelim
=
NULL
;
int
totalLen
=
i_count
>=
0
?
i_count
:
strlenW
(
str
);
int
fnameLen
=
totalLen
;
int
old_prefix_offset
=
prefix_offset
;
/* allow room for '...' */
count
=
min
(
totalLen
+
3
,
countof
(
line
)
-
3
);
...
...
@@ -338,6 +365,7 @@ INT WINAPI DrawTextExW( HDC hdc, LPWSTR str, INT i_count,
len
=
MAX_STATIC_BUFFER
;
TEXT_NextLineW
(
hdc
,
swapStr
,
&
count
,
line
,
&
len
,
width
,
flags
);
prefix_offset
=
old_prefix_offset
;
/* if only the ELLIPSIS will fit, just let it be clipped */
len
=
max
(
3
,
len
);
...
...
@@ -376,13 +404,15 @@ INT WINAPI DrawTextExW( HDC hdc, LPWSTR str, INT i_count,
line
[
len
]
=
'\0'
;
strPtr
=
NULL
;
if
(
flags
&
DT_MODIFYSTRING
)
strcpyW
(
str
,
swapStr
);
/* Note that really we ought to refigure the location of
* the underline for the prefix; it might be currently set for
* something we have just ellipsified out.
* NB We had better do it before modifying the string and
* loosing the ampersands
*/
if
(
flags
&
DT_MODIFYSTRING
)
strcpyW
(
str
,
swapStr
);
}
if
(
!
(
flags
&
DT_CALCRECT
))
{
...
...
@@ -391,14 +421,7 @@ INT WINAPI DrawTextExW( HDC hdc, LPWSTR str, INT i_count,
((
flags
&
DT_RTLREADING
)
?
ETO_RTLREADING
:
0
),
rect
,
line
,
len
,
NULL
))
return
0
;
if
(
prefix_offset
!=
-
1
)
{
HPEN
hpen
=
CreatePen
(
PS_SOLID
,
1
,
GetTextColor
(
hdc
)
);
HPEN
oldPen
=
SelectObject
(
hdc
,
hpen
);
MoveToEx
(
hdc
,
x
+
prefix_x
,
y
+
tm
.
tmAscent
+
1
,
NULL
);
LineTo
(
hdc
,
x
+
prefix_end
+
1
,
y
+
tm
.
tmAscent
+
1
);
SelectObject
(
hdc
,
oldPen
);
DeleteObject
(
hpen
);
}
TEXT_DrawUnderscore
(
hdc
,
x
,
y
+
tm
.
tmAscent
+
1
,
line
,
prefix_offset
);
}
else
if
(
size
.
cx
>
max_width
)
max_width
=
size
.
cx
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment