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
196daf81
Commit
196daf81
authored
Sep 22, 2000
by
Susan Farley
Committed by
Alexandre Julliard
Sep 22, 2000
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added support DT_PATH_ELLIPSIS, DT_END_ELLIPSIS, and DT_WORD_ELLIPSIS
flags in DrawText.
parent
7096384d
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
97 additions
and
0 deletions
+97
-0
text.c
dlls/user/text.c
+97
-0
No files found.
dlls/user/text.c
View file @
196daf81
...
...
@@ -25,6 +25,10 @@ DEFAULT_DEBUG_CHANNEL(text);
#define SPACE 32
#define PREFIX 38
#define ELLIPSIS "..."
#define FORWARD_SLASH '/'
#define BACK_SLASH '\\'
#define SWAP_INT(a,b) { int t = a; a = b; b = t; }
static
int
tabstop
=
8
;
...
...
@@ -49,6 +53,12 @@ static const char *TEXT_NextLine( HDC hdc, const char *str, int *count,
* or NULL if end of str reached.
*/
/* FIXME:
* GetTextExtentPoint is used to get the width of each character,
* rather than GetCharABCWidth... So the whitespace between
* characters is ignored, and the reported len is too great.
*/
int
i
=
0
,
j
=
0
,
k
;
int
plen
=
0
;
int
numspaces
;
...
...
@@ -227,6 +237,7 @@ INT WINAPI DrawTextA( HDC hdc, LPCSTR str, INT i_count, LPRECT rect, UINT flags
if
(
!
str
)
return
0
;
if
(
count
==
-
1
)
count
=
strlen
(
str
);
if
(
count
==
0
)
return
0
;
strPtr
=
str
;
GetTextMetricsA
(
hdc
,
&
tm
);
...
...
@@ -271,6 +282,92 @@ INT WINAPI DrawTextA( HDC hdc, LPCSTR str, INT i_count, LPRECT rect, UINT flags
if
(
flags
&
DT_VCENTER
)
y
=
rect
->
top
+
(
rect
->
bottom
-
rect
->
top
)
/
2
-
size
.
cy
/
2
;
else
if
(
flags
&
DT_BOTTOM
)
y
=
rect
->
bottom
-
size
.
cy
;
if
(
flags
&
(
DT_PATH_ELLIPSIS
|
DT_END_ELLIPSIS
|
DT_WORD_ELLIPSIS
))
{
char
swapStr
[
sizeof
(
line
)];
char
*
fnameDelim
=
NULL
;
int
totalLen
=
i_count
>=
0
?
i_count
:
strlen
(
str
);
if
(
size
.
cx
>
width
)
{
int
fnameLen
=
totalLen
;
/* allow room for '...' */
count
=
min
(
totalLen
+
3
,
sizeof
(
line
)
-
3
);
if
(
flags
&
DT_WORD_ELLIPSIS
)
flags
|=
DT_WORDBREAK
;
if
(
flags
&
DT_PATH_ELLIPSIS
)
{
char
*
lastBkSlash
=
NULL
;
char
*
lastFwdSlash
=
NULL
;
strncpy
(
line
,
str
,
totalLen
);
line
[
totalLen
]
=
'\0'
;
lastBkSlash
=
strrchr
(
line
,
BACK_SLASH
);
lastFwdSlash
=
strrchr
(
line
,
FORWARD_SLASH
);
fnameDelim
=
lastFwdSlash
?
lastFwdSlash
:
lastBkSlash
;
if
(
lastBkSlash
&&
lastFwdSlash
)
/* which is last? */
if
(
lastBkSlash
>
lastFwdSlash
)
fnameDelim
=
lastBkSlash
;
if
(
fnameDelim
)
fnameLen
=
&
line
[
totalLen
]
-
fnameDelim
;
else
fnameDelim
=
(
char
*
)
str
;
strcpy
(
swapStr
,
ELLIPSIS
);
strncat
(
swapStr
,
fnameDelim
,
fnameLen
);
swapStr
[
fnameLen
+
3
]
=
'\0'
;
strncat
(
swapStr
,
str
,
totalLen
-
fnameLen
);
swapStr
[
totalLen
+
3
]
=
'\0'
;
}
else
/* DT_END_ELLIPSIS | DT_WORD_ELLIPSIS */
{
strcpy
(
swapStr
,
ELLIPSIS
);
strncat
(
swapStr
,
str
,
totalLen
);
}
TEXT_NextLine
(
hdc
,
swapStr
,
&
count
,
line
,
&
len
,
width
,
flags
);
/* if only the ELLIPSIS will fit, just let it be clipped */
len
=
max
(
3
,
len
);
GetTextExtentPointA
(
hdc
,
line
,
len
,
&
size
);
/* FIXME:
* NextLine uses GetTextExtentPoint for each character,
* rather than GetCharABCWidth... So the whitespace between
* characters is ignored in the width measurement, and the
* reported len is too great. To compensate, we must get
* the width of the entire line and adjust len accordingly.
*/
while
((
size
.
cx
>
width
)
&&
(
len
>
3
))
{
line
[
--
len
]
=
'\0'
;
GetTextExtentPointA
(
hdc
,
line
,
len
,
&
size
);
}
if
(
fnameLen
<
len
-
3
)
/* some of the path will fit */
{
/* put the ELLIPSIS between the path and filename */
strncpy
(
swapStr
,
&
line
[
fnameLen
+
3
],
len
-
3
-
fnameLen
);
swapStr
[
len
-
3
-
fnameLen
]
=
'\0'
;
strcat
(
swapStr
,
ELLIPSIS
);
strncat
(
swapStr
,
&
line
[
3
],
fnameLen
);
}
else
{
/* move the ELLIPSIS to the end */
strncpy
(
swapStr
,
&
line
[
3
],
len
-
3
);
swapStr
[
len
-
3
]
=
'\0'
;
strcat
(
swapStr
,
ELLIPSIS
);
}
strncpy
(
line
,
swapStr
,
len
);
line
[
len
]
=
'\0'
;
strPtr
=
NULL
;
}
}
}
if
(
!
(
flags
&
DT_CALCRECT
))
{
...
...
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