Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
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-cw
Commits
4366c81f
Commit
4366c81f
authored
Oct 13, 2020
by
Huw Davies
Committed by
Alexandre Julliard
Oct 13, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
riched20: Use paragraph ptrs in FindPixelPos().
Signed-off-by:
Huw Davies
<
huw@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
586e31a1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
33 additions
and
28 deletions
+33
-28
caret.c
dlls/riched20/caret.c
+28
-28
editor.c
dlls/riched20/editor.c
+4
-0
editor.h
dlls/riched20/editor.h
+1
-0
No files found.
dlls/riched20/caret.c
View file @
4366c81f
...
...
@@ -892,41 +892,41 @@ int ME_GetCursorOfs(const ME_Cursor *cursor)
}
/* Helper function for ME_FindPixelPos to find paragraph within tables */
static
ME_DisplayItem
*
ME_FindPixelPosInTableRow
(
int
x
,
int
y
,
ME_DisplayItem
*
para
)
static
ME_Paragraph
*
pixel_pos_in_table_row
(
int
x
,
int
y
,
ME_Paragraph
*
para
)
{
ME_DisplayItem
*
cell
,
*
next_cell
;
assert
(
para
->
member
.
para
.
nFlags
&
MEPF_ROWSTART
);
cell
=
para
->
member
.
para
.
next_para
->
member
.
para
.
pCell
;
assert
(
para
->
nFlags
&
MEPF_ROWSTART
);
cell
=
para_next
(
para
)
->
pCell
;
assert
(
cell
);
/* find the cell we are in */
while
((
next_cell
=
cell
->
member
.
cell
.
next_cell
)
!=
NULL
)
{
while
((
next_cell
=
cell
->
member
.
cell
.
next_cell
)
!=
NULL
)
{
if
(
x
<
next_cell
->
member
.
cell
.
pt
.
x
)
{
para
=
ME_FindItemFwd
(
cell
,
diParagraph
)
;
para
=
&
ME_FindItemFwd
(
cell
,
diParagraph
)
->
member
.
para
;
/* Found the cell, but there might be multiple paragraphs in
* the cell, so need to search down the cell for the paragraph. */
while
(
cell
==
para
->
member
.
para
.
pCell
)
{
if
(
y
<
para
->
member
.
para
.
pt
.
y
+
para
->
member
.
para
.
nHeight
)
while
(
cell
==
para
->
pCell
)
{
if
(
y
<
para
->
pt
.
y
+
para
->
nHeight
)
{
if
(
para
->
member
.
para
.
nFlags
&
MEPF_ROWSTART
)
return
ME_FindPixelPosInTableRow
(
x
,
y
,
para
);
else
return
para
;
if
(
para
->
nFlags
&
MEPF_ROWSTART
)
return
pixel_pos_in_table_row
(
x
,
y
,
para
);
else
return
para
;
}
para
=
para
->
member
.
para
.
next_para
;
para
=
para
_next
(
para
)
;
}
/* Past the end of the cell, so go back to the last cell paragraph */
return
para
->
member
.
para
.
prev_para
;
return
para
_prev
(
para
)
;
}
cell
=
next_cell
;
}
/* Return table row delimiter */
para
=
ME_FindItemFwd
(
cell
,
diParagraph
);
assert
(
para
->
member
.
para
.
nFlags
&
MEPF_ROWEND
);
assert
(
para
->
member
.
para
.
fmt
.
dwMask
&
PFM_TABLEROWDELIMITER
);
assert
(
para
->
member
.
para
.
fmt
.
wEffects
&
PFE_TABLEROWDELIMITER
);
para
=
table_row_end
(
para
);
assert
(
para
->
nFlags
&
MEPF_ROWEND
);
assert
(
para
->
fmt
.
dwMask
&
PFM_TABLEROWDELIMITER
);
assert
(
para
->
fmt
.
wEffects
&
PFE_TABLEROWDELIMITER
);
return
para
;
}
...
...
@@ -986,7 +986,7 @@ static BOOL ME_FindRunInRow(ME_TextEditor *editor, ME_DisplayItem *pRow,
static
BOOL
ME_FindPixelPos
(
ME_TextEditor
*
editor
,
int
x
,
int
y
,
ME_Cursor
*
result
,
BOOL
*
is_eol
,
BOOL
final_eop
)
{
ME_
DisplayItem
*
p
=
editor
->
pBuffer
->
pFirst
->
member
.
para
.
next_para
;
ME_
Paragraph
*
para
=
editor_first_para
(
editor
)
;
ME_DisplayItem
*
row
=
NULL
;
BOOL
isExact
=
TRUE
;
...
...
@@ -997,19 +997,19 @@ static BOOL ME_FindPixelPos(ME_TextEditor *editor, int x, int y,
*
is_eol
=
FALSE
;
/* find paragraph */
for
(;
p
!=
editor
->
pBuffer
->
pLast
;
p
=
p
->
member
.
para
.
next_para
)
for
(;
p
ara_next
(
para
);
para
=
para_next
(
para
)
)
{
if
(
y
<
p
->
member
.
para
.
pt
.
y
+
p
->
member
.
para
.
nHeight
)
if
(
y
<
p
ara
->
pt
.
y
+
para
->
nHeight
)
{
if
(
p
->
member
.
para
.
nFlags
&
MEPF_ROWSTART
)
p
=
ME_FindPixelPosInTableRow
(
x
,
y
,
p
);
y
-=
p
->
member
.
para
.
pt
.
y
;
row
=
ME_FindItemFwd
(
p
,
diStartRow
);
if
(
p
ara
->
nFlags
&
MEPF_ROWSTART
)
p
ara
=
pixel_pos_in_table_row
(
x
,
y
,
para
);
y
-=
p
ara
->
pt
.
y
;
row
=
ME_FindItemFwd
(
para_get_di
(
para
)
,
diStartRow
);
break
;
}
else
if
(
p
->
member
.
para
.
nFlags
&
MEPF_ROWSTART
)
else
if
(
p
ara
->
nFlags
&
MEPF_ROWSTART
)
{
p
=
para_get_di
(
table_row_end
(
&
p
->
member
.
para
)
);
p
ara
=
table_row_end
(
para
);
}
}
/* find row */
...
...
@@ -1029,7 +1029,7 @@ static BOOL ME_FindPixelPos(ME_TextEditor *editor, int x, int y,
* rather than the end of the text, so the x position will be used to
* determine the offset closest to the pixel position. */
isExact
=
FALSE
;
row
=
ME_FindItemBack
(
p
,
diStartRow
);
row
=
ME_FindItemBack
(
para_get_di
(
para
)
,
diStartRow
);
}
if
(
row
)
return
ME_FindRunInRow
(
editor
,
row
,
x
,
result
,
is_eol
)
&&
isExact
;
...
...
dlls/riched20/editor.c
View file @
4366c81f
...
...
@@ -280,6 +280,10 @@ static ME_TextBuffer *ME_MakeText(void) {
return
buf
;
}
ME_Paragraph
*
editor_first_para
(
ME_TextEditor
*
editor
)
{
return
para_next
(
&
editor
->
pBuffer
->
pFirst
->
member
.
para
);
}
static
LRESULT
ME_StreamInText
(
ME_TextEditor
*
editor
,
DWORD
dwFormat
,
ME_InStream
*
stream
,
ME_Style
*
style
)
{
...
...
dlls/riched20/editor.h
View file @
4366c81f
...
...
@@ -268,6 +268,7 @@ void ME_StreamInFill(ME_InStream *stream) DECLSPEC_HIDDEN;
extern
BOOL
me_debug
DECLSPEC_HIDDEN
;
void
ME_ReplaceSel
(
ME_TextEditor
*
editor
,
BOOL
can_undo
,
const
WCHAR
*
str
,
int
len
)
DECLSPEC_HIDDEN
;
int
set_selection
(
ME_TextEditor
*
editor
,
int
to
,
int
from
)
DECLSPEC_HIDDEN
;
ME_Paragraph
*
editor_first_para
(
ME_TextEditor
*
editor
)
DECLSPEC_HIDDEN
;
/* table.c */
BOOL
ME_IsInTable
(
ME_DisplayItem
*
pItem
)
DECLSPEC_HIDDEN
;
...
...
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