[PATCH 2/5] riched20: Use ME_Paragraph ptrs for the update range.
Huw Davies
huw at codeweavers.com
Mon Oct 12 07:09:06 CDT 2020
Signed-off-by: Huw Davies <huw at codeweavers.com>
---
dlls/riched20/editor.h | 2 +-
dlls/riched20/paint.c | 2 +-
dlls/riched20/wrap.c | 41 ++++++++++++++++++++---------------------
3 files changed, 22 insertions(+), 23 deletions(-)
diff --git a/dlls/riched20/editor.h b/dlls/riched20/editor.h
index 910a87c33c4..6c45a3c6b54 100644
--- a/dlls/riched20/editor.h
+++ b/dlls/riched20/editor.h
@@ -189,7 +189,7 @@ void ME_DestroyContext(ME_Context *c) DECLSPEC_HIDDEN;
/* wrap.c */
BOOL ME_WrapMarkedParagraphs(ME_TextEditor *editor) DECLSPEC_HIDDEN;
-void ME_InvalidateParagraphRange(ME_TextEditor *editor, ME_DisplayItem *start_para, ME_DisplayItem *last_para) DECLSPEC_HIDDEN;
+void para_range_invalidate( ME_TextEditor *editor, ME_Paragraph *start_para, ME_Paragraph *last_para ) DECLSPEC_HIDDEN;
void ME_SendRequestResize(ME_TextEditor *editor, BOOL force) DECLSPEC_HIDDEN;
/* para.c */
diff --git a/dlls/riched20/paint.c b/dlls/riched20/paint.c
index 53583de21ce..6187fb74f1b 100644
--- a/dlls/riched20/paint.c
+++ b/dlls/riched20/paint.c
@@ -1356,7 +1356,7 @@ ME_InvalidateSelection(ME_TextEditor *editor)
}
if (repaint_start)
- ME_InvalidateParagraphRange(editor, repaint_start, repaint_end);
+ para_range_invalidate( editor, &repaint_start->member.para, &repaint_end->member.para );
/* remember the last invalidated position */
ME_GetSelectionOfs(editor, &editor->nLastSelStart, &editor->nLastSelEnd);
ME_GetSelectionParas(editor, &editor->pLastSelStartPara, &editor->pLastSelEndPara);
diff --git a/dlls/riched20/wrap.c b/dlls/riched20/wrap.c
index f864d97a0eb..90835905a0c 100644
--- a/dlls/riched20/wrap.c
+++ b/dlls/riched20/wrap.c
@@ -905,10 +905,10 @@ static void ME_WrapTextParagraph( ME_TextEditor *editor, ME_Context *c, ME_Parag
struct repaint_range
{
- ME_DisplayItem *start, *end;
+ ME_Paragraph *start, *end;
};
-static void update_repaint( ME_DisplayItem *para, struct repaint_range *repaint )
+static void update_repaint( ME_Paragraph *para, struct repaint_range *repaint )
{
if (!repaint->start) repaint->start = para;
repaint->end = para;
@@ -987,11 +987,11 @@ static void adjust_para_y( ME_Paragraph *para, ME_Context *c, struct repaint_ran
{
/* The height of the cells has grown, so invalidate the bottom of
* the cells. */
- update_repaint( para_get_di( para ), repaint );
+ update_repaint( para, repaint );
cell = ME_FindItemBack( para_get_di( para ), diCell );
while (cell)
{
- update_repaint( ME_FindItemBack(cell, diParagraph), repaint );
+ update_repaint( &ME_FindItemBack(cell, diParagraph)->member.para, repaint );
cell = cell->member.cell.prev_cell;
}
}
@@ -1054,22 +1054,22 @@ BOOL ME_WrapMarkedParagraphs(ME_TextEditor *editor)
totalWidth = max(totalWidth, para->nWidth);
if (!para->nCharOfs)
- update_repaint( para->prev_para, &repaint );
- update_repaint( para_get_di( para ), &repaint );
+ update_repaint( para_prev( para ), &repaint );
+ update_repaint( para, &repaint );
adjust_para_y( para, &c, &repaint );
- if (para->next_para)
+ if (para_next( para ))
{
- if (c.pt.y != para->next_para->member.para.pt.y)
+ if (c.pt.y != para_next( para )->pt.y)
{
next = para;
- while (next->next_para && &next->marked_entry != next_entry &&
+ while (para_next( next ) && &next->marked_entry != next_entry &&
next != &editor->pBuffer->pLast->member.para)
{
- update_repaint( next->next_para, &repaint );
- next->next_para->member.para.pt.y = c.pt.y;
- adjust_para_y( &next->next_para->member.para, &c, &repaint );
- next = &next->next_para->member.para;
+ update_repaint( para_next( next ), &repaint );
+ para_next( next )->pt.y = c.pt.y;
+ adjust_para_y( para_next( next ), &c, &repaint );
+ next = para_next( next );
}
}
}
@@ -1086,13 +1086,12 @@ BOOL ME_WrapMarkedParagraphs(ME_TextEditor *editor)
ME_DestroyContext(&c);
if (repaint.start || editor->nTotalLength < editor->nLastTotalLength)
- ME_InvalidateParagraphRange(editor, repaint.start, repaint.end);
+ para_range_invalidate( editor, repaint.start, repaint.end);
return !!repaint.start;
}
-void ME_InvalidateParagraphRange(ME_TextEditor *editor,
- ME_DisplayItem *start_para,
- ME_DisplayItem *last_para)
+void para_range_invalidate( ME_TextEditor *editor, ME_Paragraph *start_para,
+ ME_Paragraph *last_para )
{
RECT rc;
int ofs;
@@ -1102,16 +1101,16 @@ void ME_InvalidateParagraphRange(ME_TextEditor *editor,
if (start_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;
+ start_para = table_outer_para( start_para );
+ last_para = table_outer_para( last_para );
+ rc.top += start_para->pt.y - ofs;
} else {
rc.top += editor->nTotalLength - ofs;
}
if (editor->nTotalLength < editor->nLastTotalLength)
rc.bottom = editor->rcFormat.top + editor->nLastTotalLength - ofs;
else
- rc.bottom = editor->rcFormat.top + last_para->member.para.pt.y + last_para->member.para.nHeight - ofs;
+ rc.bottom = editor->rcFormat.top + last_para->pt.y + last_para->nHeight - ofs;
ITextHost_TxInvalidateRect(editor->texthost, &rc, TRUE);
}
--
2.23.0
More information about the wine-devel
mailing list