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
d528e760
Commit
d528e760
authored
Feb 14, 2013
by
Huw Davies
Committed by
Alexandre Julliard
Feb 14, 2013
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
riched20: Use the point from char helpers to calculate the selection rectangle.
parent
2a6f99ef
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
34 deletions
+23
-34
paint.c
dlls/riched20/paint.c
+23
-34
No files found.
dlls/riched20/paint.c
View file @
d528e760
...
@@ -295,6 +295,15 @@ static void draw_space( ME_Context *c, ME_Run *run, int x, int y,
...
@@ -295,6 +295,15 @@ static void draw_space( ME_Context *c, ME_Run *run, int x, int y,
PatBlt
(
hdc
,
x
,
ymin
,
run
->
nWidth
,
cy
,
DSTINVERT
);
PatBlt
(
hdc
,
x
,
ymin
,
run
->
nWidth
,
cy
,
DSTINVERT
);
}
}
static
void
get_selection_rect
(
ME_Context
*
c
,
ME_Run
*
run
,
int
from
,
int
to
,
int
cy
,
RECT
*
r
)
{
r
->
left
=
ME_PointFromCharContext
(
c
,
run
,
from
);
r
->
top
=
0
;
r
->
right
=
ME_PointFromCharContext
(
c
,
run
,
to
);
r
->
bottom
=
cy
;
return
;
}
static
void
ME_DrawTextWithStyle
(
ME_Context
*
c
,
ME_Run
*
run
,
int
x
,
int
y
,
LPCWSTR
szText
,
static
void
ME_DrawTextWithStyle
(
ME_Context
*
c
,
ME_Run
*
run
,
int
x
,
int
y
,
LPCWSTR
szText
,
int
nSelFrom
,
int
nSelTo
,
int
ymin
,
int
cy
)
int
nSelFrom
,
int
nSelTo
,
int
ymin
,
int
cy
)
...
@@ -307,37 +316,22 @@ static void ME_DrawTextWithStyle(ME_Context *c, ME_Run *run, int x, int y, LPCWS
...
@@ -307,37 +316,22 @@ static void ME_DrawTextWithStyle(ME_Context *c, ME_Run *run, int x, int y, LPCWS
HPEN
hPen
=
NULL
,
hOldPen
=
NULL
;
HPEN
hPen
=
NULL
,
hOldPen
=
NULL
;
BOOL
bHighlightedText
=
(
nSelFrom
<
run
->
len
&&
nSelTo
>=
0
BOOL
bHighlightedText
=
(
nSelFrom
<
run
->
len
&&
nSelTo
>=
0
&&
nSelFrom
<
nSelTo
&&
!
c
->
editor
->
bHideSelection
);
&&
nSelFrom
<
nSelTo
&&
!
c
->
editor
->
bHideSelection
);
int
xSelStart
=
x
,
xSelEnd
=
x
;
RECT
sel_rect
;
hOldFont
=
ME_SelectStyleFont
(
c
,
run
->
style
);
yOffset
=
calc_y_offset
(
c
,
run
->
style
);
yOffset
=
calc_y_offset
(
c
,
run
->
style
);
rgb
=
get_text_color
(
c
,
run
->
style
,
FALSE
);
rgb
=
get_text_color
(
c
,
run
->
style
,
FALSE
);
if
(
bHighlightedText
)
if
(
bHighlightedText
)
{
{
SIZE
sz
;
nSelFrom
=
max
(
0
,
nSelFrom
);
if
(
nSelFrom
<=
0
)
nSelTo
=
min
(
run
->
len
,
nSelTo
);
{
get_selection_rect
(
c
,
run
,
nSelFrom
,
nSelTo
,
cy
,
&
sel_rect
);
nSelFrom
=
0
;
OffsetRect
(
&
sel_rect
,
x
,
ymin
);
}
else
{
GetTextExtentPoint32W
(
hDC
,
szText
,
nSelFrom
,
&
sz
);
xSelStart
=
x
+
sz
.
cx
;
}
if
(
nSelTo
>=
run
->
len
)
{
nSelTo
=
run
->
len
;
xSelEnd
=
x
+
run
->
nWidth
;
}
else
{
GetTextExtentPoint32W
(
hDC
,
szText
+
nSelFrom
,
nSelTo
-
nSelFrom
,
&
sz
);
xSelEnd
=
xSelStart
+
sz
.
cx
;
}
}
}
hOldFont
=
ME_SelectStyleFont
(
c
,
run
->
style
);
get_underline_pen
(
run
->
style
,
rgb
,
&
hPen
);
get_underline_pen
(
run
->
style
,
rgb
,
&
hPen
);
if
(
hPen
)
hOldPen
=
SelectObject
(
hDC
,
hPen
);
if
(
hPen
)
hOldPen
=
SelectObject
(
hDC
,
hPen
);
...
@@ -345,32 +339,27 @@ static void ME_DrawTextWithStyle(ME_Context *c, ME_Run *run, int x, int y, LPCWS
...
@@ -345,32 +339,27 @@ static void ME_DrawTextWithStyle(ME_Context *c, ME_Run *run, int x, int y, LPCWS
if
(
bHighlightedText
&&
!
c
->
editor
->
bEmulateVersion10
)
if
(
bHighlightedText
&&
!
c
->
editor
->
bEmulateVersion10
)
{
{
COLORREF
rgbBackOld
;
COLORREF
rgbBackOld
;
RECT
dim
;
/* FIXME: should use textmetrics info for Descent info */
/* FIXME: should use textmetrics info for Descent info */
if
(
hPen
)
if
(
hPen
)
MoveToEx
(
hDC
,
x
,
y
-
yOffset
+
1
,
NULL
);
MoveToEx
(
hDC
,
x
,
y
-
yOffset
+
1
,
NULL
);
if
(
xSelStar
t
>
x
)
if
(
sel_rect
.
lef
t
>
x
)
{
{
ExtTextOutW
(
hDC
,
x
,
y
-
yOffset
,
0
,
NULL
,
szText
,
nSelFrom
,
NULL
);
ExtTextOutW
(
hDC
,
x
,
y
-
yOffset
,
0
,
NULL
,
szText
,
nSelFrom
,
NULL
);
if
(
hPen
)
if
(
hPen
)
LineTo
(
hDC
,
xSelStar
t
,
y
-
yOffset
+
1
);
LineTo
(
hDC
,
sel_rect
.
lef
t
,
y
-
yOffset
+
1
);
}
}
dim
.
top
=
ymin
;
dim
.
bottom
=
ymin
+
cy
;
dim
.
left
=
xSelStart
;
dim
.
right
=
xSelEnd
;
SetTextColor
(
hDC
,
get_text_color
(
c
,
run
->
style
,
TRUE
)
);
SetTextColor
(
hDC
,
get_text_color
(
c
,
run
->
style
,
TRUE
)
);
rgbBackOld
=
SetBkColor
(
hDC
,
ITextHost_TxGetSysColor
(
c
->
editor
->
texthost
,
rgbBackOld
=
SetBkColor
(
hDC
,
ITextHost_TxGetSysColor
(
c
->
editor
->
texthost
,
COLOR_HIGHLIGHT
));
COLOR_HIGHLIGHT
));
ExtTextOutW
(
hDC
,
xSelStart
,
y
-
yOffset
,
ETO_OPAQUE
,
&
dim
,
ExtTextOutW
(
hDC
,
sel_rect
.
left
,
y
-
yOffset
,
ETO_OPAQUE
,
&
sel_rect
,
szText
+
nSelFrom
,
nSelTo
-
nSelFrom
,
NULL
);
szText
+
nSelFrom
,
nSelTo
-
nSelFrom
,
NULL
);
if
(
hPen
)
if
(
hPen
)
LineTo
(
hDC
,
xSelEnd
,
y
-
yOffset
+
1
);
LineTo
(
hDC
,
sel_rect
.
right
,
y
-
yOffset
+
1
);
SetBkColor
(
hDC
,
rgbBackOld
);
SetBkColor
(
hDC
,
rgbBackOld
);
if
(
xSelEnd
<
x
+
run
->
nWidth
)
if
(
sel_rect
.
right
<
x
+
run
->
nWidth
)
{
{
SetTextColor
(
hDC
,
rgb
);
SetTextColor
(
hDC
,
rgb
);
ExtTextOutW
(
hDC
,
xSelEnd
,
y
-
yOffset
,
0
,
NULL
,
szText
+
nSelTo
,
ExtTextOutW
(
hDC
,
sel_rect
.
right
,
y
-
yOffset
,
0
,
NULL
,
szText
+
nSelTo
,
run
->
len
-
nSelTo
,
NULL
);
run
->
len
-
nSelTo
,
NULL
);
if
(
hPen
)
if
(
hPen
)
LineTo
(
hDC
,
x
+
run
->
nWidth
,
y
-
yOffset
+
1
);
LineTo
(
hDC
,
x
+
run
->
nWidth
,
y
-
yOffset
+
1
);
...
@@ -389,7 +378,7 @@ static void ME_DrawTextWithStyle(ME_Context *c, ME_Run *run, int x, int y, LPCWS
...
@@ -389,7 +378,7 @@ static void ME_DrawTextWithStyle(ME_Context *c, ME_Run *run, int x, int y, LPCWS
if
(
bHighlightedText
)
/* v1.0 inverts the selection */
if
(
bHighlightedText
)
/* v1.0 inverts the selection */
{
{
PatBlt
(
hDC
,
xSelStart
,
ymin
,
xSelEnd
-
xSelStar
t
,
cy
,
DSTINVERT
);
PatBlt
(
hDC
,
sel_rect
.
left
,
ymin
,
sel_rect
.
right
-
sel_rect
.
lef
t
,
cy
,
DSTINVERT
);
}
}
}
}
...
...
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