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
1bda5913
Commit
1bda5913
authored
Oct 09, 2020
by
Huw Davies
Committed by
Alexandre Julliard
Oct 09, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
riched20: Use ME_Paragraph ptrs in a few of the table functions.
Signed-off-by:
Huw Davies
<
huw@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
c3e6cb5b
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
54 additions
and
47 deletions
+54
-47
caret.c
dlls/riched20/caret.c
+3
-3
editor.h
dlls/riched20/editor.h
+5
-3
paint.c
dlls/riched20/paint.c
+2
-2
para.c
dlls/riched20/para.c
+13
-0
table.c
dlls/riched20/table.c
+25
-32
wrap.c
dlls/riched20/wrap.c
+4
-5
writer.c
dlls/riched20/writer.c
+2
-2
No files found.
dlls/riched20/caret.c
View file @
1bda5913
...
...
@@ -1033,7 +1033,7 @@ static BOOL ME_FindPixelPos(ME_TextEditor *editor, int x, int y,
}
else
if
(
p
->
member
.
para
.
nFlags
&
MEPF_ROWSTART
)
{
p
=
ME_GetTableRowEnd
(
p
);
p
=
para_get_di
(
table_row_end
(
&
p
->
member
.
para
)
);
}
}
/* find row */
...
...
@@ -1304,7 +1304,7 @@ ME_MoveCursorLines(ME_TextEditor *editor, ME_Cursor *pCursor, int nRelOfs, BOOL
pOldPara
->
member
.
para
.
pCell
!=
pNewPara
->
member
.
para
.
pCell
))
{
/* Brought out of a cell */
pNewPara
=
ME_GetTableRowStart
(
pOldPara
)
->
member
.
para
.
prev_para
;
pNewPara
=
table_row_start
(
&
pOldPara
->
member
.
para
)
->
prev_para
;
if
(
pNewPara
->
type
==
diTextStart
)
return
;
/* At the top, so don't go anywhere. */
pItem
=
ME_FindItemFwd
(
pNewPara
,
diStartRow
);
...
...
@@ -1335,7 +1335,7 @@ ME_MoveCursorLines(ME_TextEditor *editor, ME_Cursor *pCursor, int nRelOfs, BOOL
pOldPara
->
member
.
para
.
pCell
!=
pNewPara
->
member
.
para
.
pCell
))
{
/* Brought out of a cell */
pNewPara
=
ME_GetTableRowEnd
(
pOldPara
)
->
member
.
para
.
next_para
;
pNewPara
=
table_row_end
(
&
pOldPara
->
member
.
para
)
->
next_para
;
if
(
pNewPara
->
type
==
diTextEnd
)
return
;
/* At the bottom, so don't go anywhere. */
pItem
=
ME_FindItemFwd
(
pNewPara
,
diStartRow
);
...
...
dlls/riched20/editor.h
View file @
1bda5913
...
...
@@ -211,6 +211,8 @@ int get_total_width(ME_TextEditor *editor) DECLSPEC_HIDDEN;
void
para_mark_rewrap
(
ME_TextEditor
*
editor
,
ME_Paragraph
*
para
)
DECLSPEC_HIDDEN
;
void
para_mark_add
(
ME_TextEditor
*
editor
,
ME_Paragraph
*
para
)
DECLSPEC_HIDDEN
;
void
para_mark_remove
(
ME_TextEditor
*
editor
,
ME_Paragraph
*
para
)
DECLSPEC_HIDDEN
;
ME_Paragraph
*
para_next
(
ME_Paragraph
*
para
)
DECLSPEC_HIDDEN
;
ME_Paragraph
*
para_prev
(
ME_Paragraph
*
para
)
DECLSPEC_HIDDEN
;
ME_Run
*
para_first_run
(
ME_Paragraph
*
para
)
DECLSPEC_HIDDEN
;
static
inline
ME_DisplayItem
*
para_get_di
(
ME_Paragraph
*
para
)
{
...
...
@@ -273,9 +275,9 @@ ME_DisplayItem *ME_InsertTableRowStartAtParagraph(ME_TextEditor *editor,
ME_DisplayItem
*
para
)
DECLSPEC_HIDDEN
;
ME_DisplayItem
*
ME_InsertTableCellFromCursor
(
ME_TextEditor
*
editor
)
DECLSPEC_HIDDEN
;
ME_DisplayItem
*
ME_InsertTableRowEndFromCursor
(
ME_TextEditor
*
editor
)
DECLSPEC_HIDDEN
;
ME_
DisplayItem
*
ME_GetTableRowEnd
(
ME_DisplayItem
*
para
)
DECLSPEC_HIDDEN
;
ME_
DisplayItem
*
ME_GetTableRowStart
(
ME_DisplayItem
*
para
)
DECLSPEC_HIDDEN
;
ME_
DisplayItem
*
ME_GetOuterParagraph
(
ME_DisplayItem
*
para
)
DECLSPEC_HIDDEN
;
ME_
Paragraph
*
table_row_end
(
ME_Paragraph
*
para
)
DECLSPEC_HIDDEN
;
ME_
Paragraph
*
table_row_start
(
ME_Paragraph
*
para
)
DECLSPEC_HIDDEN
;
ME_
Paragraph
*
table_outer_para
(
ME_Paragraph
*
para
)
DECLSPEC_HIDDEN
;
void
ME_CheckTablesForCorruption
(
ME_TextEditor
*
editor
)
DECLSPEC_HIDDEN
;
void
ME_ProtectPartialTableDeletion
(
ME_TextEditor
*
editor
,
ME_Cursor
*
c
,
int
*
nChars
)
DECLSPEC_HIDDEN
;
ME_DisplayItem
*
ME_AppendTableRow
(
ME_TextEditor
*
editor
,
ME_DisplayItem
*
table_row
)
DECLSPEC_HIDDEN
;
...
...
dlls/riched20/paint.c
View file @
1bda5913
...
...
@@ -778,10 +778,10 @@ static void ME_DrawTableBorders(ME_Context *c, ME_DisplayItem *paragraph)
if
(
atBottom
)
{
int
oldLeft
=
rc
.
left
;
width
=
max
(
ME_twips2pointsY
(
c
,
cell
->
border
.
bottom
.
width
),
1
);
paraAfterRow
=
ME_GetTableRowEnd
(
paragraph
)
->
member
.
para
.
next_para
;
paraAfterRow
=
table_row_end
(
&
paragraph
->
member
.
para
)
->
next_para
;
if
(
paraAfterRow
->
member
.
para
.
nFlags
&
MEPF_ROWSTART
)
{
ME_DisplayItem
*
nextEndCell
;
nextEndCell
=
ME_FindItemBack
(
ME_GetTableRowEnd
(
paraAfterRow
),
diCell
);
nextEndCell
=
ME_FindItemBack
(
para_get_di
(
table_row_end
(
&
paraAfterRow
->
member
.
para
)
),
diCell
);
assert
(
nextEndCell
&&
!
nextEndCell
->
member
.
cell
.
next_cell
);
rc
.
left
=
c
->
pt
.
x
+
nextEndCell
->
member
.
cell
.
pt
.
x
;
/* FIXME: Native draws FROM the bottom of the table rather than
...
...
dlls/riched20/para.c
View file @
1bda5913
...
...
@@ -55,6 +55,19 @@ void destroy_para(ME_TextEditor *editor, ME_DisplayItem *item)
ME_DestroyDisplayItem
(
item
);
}
/* Note para_next/prev will return the start and end doc nodes */
ME_Paragraph
*
para_next
(
ME_Paragraph
*
para
)
{
if
(
para
->
next_para
)
return
&
para
->
next_para
->
member
.
para
;
return
NULL
;
}
ME_Paragraph
*
para_prev
(
ME_Paragraph
*
para
)
{
if
(
para
->
prev_para
)
return
&
para
->
prev_para
->
member
.
para
;
return
NULL
;
}
int
get_total_width
(
ME_TextEditor
*
editor
)
{
ME_Paragraph
*
para
;
...
...
dlls/riched20/table.c
View file @
1bda5913
...
...
@@ -133,52 +133,46 @@ ME_DisplayItem* ME_InsertTableRowEndFromCursor(ME_TextEditor *editor)
return
para
->
member
.
para
.
prev_para
;
}
ME_
DisplayItem
*
ME_GetTableRowEnd
(
ME_DisplayItem
*
para
)
ME_
Paragraph
*
table_row_end
(
ME_Paragraph
*
para
)
{
ME_DisplayItem
*
cell
;
assert
(
para
);
if
(
para
->
member
.
para
.
nFlags
&
MEPF_ROWEND
)
return
para
;
if
(
para
->
member
.
para
.
nFlags
&
MEPF_ROWSTART
)
para
=
para
->
member
.
para
.
next_para
;
cell
=
para
->
member
.
para
.
pCell
;
assert
(
para
);
if
(
para
->
nFlags
&
MEPF_ROWEND
)
return
para
;
if
(
para
->
nFlags
&
MEPF_ROWSTART
)
para
=
para_next
(
para
);
cell
=
para
->
pCell
;
assert
(
cell
&&
cell
->
type
==
diCell
);
while
(
cell
->
member
.
cell
.
next_cell
)
cell
=
cell
->
member
.
cell
.
next_cell
;
para
=
ME_FindItemFwd
(
cell
,
diParagraph
)
;
assert
(
para
&&
para
->
member
.
para
.
nFlags
&
MEPF_ROWEND
);
para
=
&
ME_FindItemFwd
(
cell
,
diParagraph
)
->
member
.
para
;
assert
(
para
&&
para
->
nFlags
&
MEPF_ROWEND
);
return
para
;
}
ME_
DisplayItem
*
ME_GetTableRowStart
(
ME_DisplayItem
*
para
)
ME_
Paragraph
*
table_row_start
(
ME_Paragraph
*
para
)
{
ME_DisplayItem
*
cell
;
assert
(
para
);
if
(
para
->
member
.
para
.
nFlags
&
MEPF_ROWSTART
)
return
para
;
if
(
para
->
member
.
para
.
nFlags
&
MEPF_ROWEND
)
para
=
para
->
member
.
para
.
prev_para
;
cell
=
para
->
member
.
para
.
pCell
;
assert
(
para
);
if
(
para
->
nFlags
&
MEPF_ROWSTART
)
return
para
;
if
(
para
->
nFlags
&
MEPF_ROWEND
)
para
=
para_prev
(
para
);
cell
=
para
->
pCell
;
assert
(
cell
&&
cell
->
type
==
diCell
);
while
(
cell
->
member
.
cell
.
prev_cell
)
cell
=
cell
->
member
.
cell
.
prev_cell
;
para
=
ME_FindItemBack
(
cell
,
diParagraph
)
;
assert
(
para
&&
para
->
member
.
para
.
nFlags
&
MEPF_ROWSTART
);
para
=
&
ME_FindItemBack
(
cell
,
diParagraph
)
->
member
.
para
;
assert
(
para
&&
para
->
nFlags
&
MEPF_ROWSTART
);
return
para
;
}
ME_
DisplayItem
*
ME_GetOuterParagraph
(
ME_DisplayItem
*
para
)
ME_
Paragraph
*
table_outer_para
(
ME_Paragraph
*
para
)
{
if
(
para
->
member
.
para
.
nFlags
&
MEPF_ROWEND
)
para
=
para
->
member
.
para
.
prev_para
;
while
(
para
->
member
.
para
.
pCell
)
if
(
para
->
nFlags
&
MEPF_ROWEND
)
para
=
para_prev
(
para
);
while
(
para
->
pCell
)
{
para
=
ME_GetTableRowStart
(
para
);
if
(
!
para
->
member
.
para
.
pCell
)
break
;
para
=
ME_FindItemBack
(
para
->
member
.
para
.
pCell
,
diParagraph
);
para
=
table_row_start
(
para
);
if
(
!
para
->
pCell
)
break
;
para
=
&
ME_FindItemBack
(
para
->
pCell
,
diParagraph
)
->
member
.
para
;
}
return
para
;
}
...
...
@@ -330,7 +324,7 @@ void ME_ProtectPartialTableDeletion(ME_TextEditor *editor, ME_Cursor *c, int *nC
while
(
!
bTruancateDeletion
&&
next_para
->
member
.
para
.
nFlags
&
MEPF_ROWSTART
)
{
next_para
=
ME_GetTableRowEnd
(
next_para
)
->
member
.
para
.
next_para
;
next_para
=
table_row_end
(
&
next_para
->
member
.
para
)
->
next_para
;
if
(
next_para
->
member
.
para
.
nCharOfs
>
nOfs
+
*
nChars
)
{
/* End of deletion is not past the end of the table row. */
...
...
@@ -416,8 +410,8 @@ ME_DisplayItem* ME_AppendTableRow(ME_TextEditor *editor,
assert
(
table_row
->
type
==
diParagraph
);
if
(
!
editor
->
bEmulateVersion10
)
{
/* v4.1 */
ME_DisplayItem
*
insertedCell
,
*
para
,
*
cell
,
*
prevTableEnd
;
cell
=
ME_FindItemFwd
(
ME_GetTableRowStart
(
table_row
),
diCell
);
prevTableEnd
=
ME_GetTableRowEnd
(
table_row
);
cell
=
ME_FindItemFwd
(
para_get_di
(
table_row_start
(
&
table_row
->
member
.
para
)
),
diCell
);
prevTableEnd
=
para_get_di
(
table_row_end
(
&
table_row
->
member
.
para
)
);
para
=
prevTableEnd
->
member
.
para
.
next_para
;
run
=
ME_FindItemFwd
(
para
,
diRun
);
editor
->
pCursors
[
0
].
pPara
=
para
;
...
...
@@ -484,15 +478,14 @@ static void ME_SelectOrInsertNextCell(ME_TextEditor *editor,
{
cell
=
cell
->
member
.
cell
.
next_cell
;
}
else
{
para
=
ME_GetTableRowEnd
(
ME_FindItemFwd
(
cell
,
diParagraph
));
para
=
para
->
member
.
para
.
next_para
;
para
=
table_row_end
(
&
ME_FindItemFwd
(
cell
,
diParagraph
)
->
member
.
para
)
->
next_para
;
assert
(
para
);
if
(
para
->
member
.
para
.
nFlags
&
MEPF_ROWSTART
)
{
cell
=
para
->
member
.
para
.
next_para
->
member
.
para
.
pCell
;
}
else
{
/* Insert row */
para
=
para
->
member
.
para
.
prev_para
;
para
=
ME_AppendTableRow
(
editor
,
ME_GetTableRowStart
(
para
)
);
para
=
ME_AppendTableRow
(
editor
,
para_get_di
(
table_row_start
(
&
para
->
member
.
para
)
)
);
/* Put cursor at the start of the new table row */
para
=
para
->
member
.
para
.
next_para
;
editor
->
pCursors
[
0
].
pPara
=
para
;
...
...
dlls/riched20/wrap.c
View file @
1bda5913
...
...
@@ -209,7 +209,7 @@ static void ME_BeginRow(ME_WrapContext *wc)
width
-=
cell
->
prev_cell
->
member
.
cell
.
nRightBoundary
;
if
(
!
cell
->
prev_cell
)
{
int
rowIndent
=
ME_GetTableRowEnd
(
para_get_di
(
wc
->
para
)
)
->
member
.
para
.
fmt
.
dxStartIndent
;
int
rowIndent
=
table_row_end
(
wc
->
para
)
->
fmt
.
dxStartIndent
;
width
-=
rowIndent
;
}
cell
->
nWidth
=
max
(
ME_twips2pointsX
(
wc
->
context
,
width
),
0
);
...
...
@@ -843,8 +843,7 @@ static void ME_WrapTextParagraph( ME_TextEditor *editor, ME_Context *c, ME_Parag
else
{
int
dxStartIndent
=
para
->
fmt
.
dxStartIndent
;
if
(
para
->
pCell
)
dxStartIndent
+=
ME_GetTableRowEnd
(
para_get_di
(
para
)
)
->
member
.
para
.
fmt
.
dxOffset
;
if
(
para
->
pCell
)
dxStartIndent
+=
table_row_end
(
para
)
->
fmt
.
dxOffset
;
wc
.
nLeftMargin
=
ME_twips2pointsX
(
c
,
dxStartIndent
+
para
->
fmt
.
dxOffset
);
wc
.
nFirstMargin
=
ME_twips2pointsX
(
c
,
dxStartIndent
);
...
...
@@ -1101,8 +1100,8 @@ void ME_InvalidateParagraphRange(ME_TextEditor *editor,
if
(
start_para
)
{
start_para
=
ME_GetOuterParagraph
(
start_para
);
last_para
=
ME_GetOuterParagraph
(
last_para
);
start_para
=
para_get_di
(
table_outer_para
(
&
start_para
->
member
.
para
)
);
last_para
=
para_get_di
(
table_outer_para
(
&
last_para
->
member
.
para
)
);
rc
.
top
+=
start_para
->
member
.
para
.
pt
.
y
-
ofs
;
}
else
{
rc
.
top
+=
editor
->
nTotalLength
-
ofs
;
...
...
dlls/riched20/writer.c
View file @
1bda5913
...
...
@@ -400,8 +400,8 @@ ME_StreamOutRTFTableProps(ME_TextEditor *editor, ME_OutStream *pStream,
if
(
!
ME_StreamOutPrint
(
pStream
,
"
\\
trowd"
))
return
FALSE
;
if
(
!
editor
->
bEmulateVersion10
)
{
/* v4.1 */
PARAFORMAT2
*
pFmt
=
&
ME_GetTableRowEnd
(
para
)
->
member
.
para
.
fmt
;
para
=
ME_GetTableRowStart
(
para
);
PARAFORMAT2
*
pFmt
=
&
table_row_end
(
&
para
->
member
.
para
)
->
fmt
;
para
=
para_get_di
(
table_row_start
(
&
para
->
member
.
para
)
);
cell
=
para
->
member
.
para
.
next_para
->
member
.
para
.
pCell
;
assert
(
cell
);
if
(
pFmt
->
dxOffset
)
...
...
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