Huw Davies : riched20: Pass a ME_Paragraph ptr to the marking functions.
Alexandre Julliard
julliard at winehq.org
Fri Oct 9 16:00:45 CDT 2020
Module: wine
Branch: master
Commit: 02cf14cf439f2100764ec3d3139721b9d0691837
URL: https://source.winehq.org/git/wine.git/?a=commit;h=02cf14cf439f2100764ec3d3139721b9d0691837
Author: Huw Davies <huw at codeweavers.com>
Date: Fri Oct 9 12:59:18 2020 +0100
riched20: Pass a ME_Paragraph ptr to the marking functions.
Signed-off-by: Huw Davies <huw at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/riched20/caret.c | 2 +-
dlls/riched20/editor.c | 2 +-
dlls/riched20/editor.h | 6 +++---
dlls/riched20/para.c | 31 ++++++++++++++++---------------
dlls/riched20/run.c | 8 ++++----
dlls/riched20/undo.c | 2 +-
dlls/riched20/wrap.c | 4 ++--
7 files changed, 28 insertions(+), 27 deletions(-)
diff --git a/dlls/riched20/caret.c b/dlls/riched20/caret.c
index 0ed34372e3..89fd9d7326 100644
--- a/dlls/riched20/caret.c
+++ b/dlls/riched20/caret.c
@@ -394,7 +394,7 @@ BOOL ME_InternalDeleteText(ME_TextEditor *editor, ME_Cursor *start,
c.nOffset -= nCharsToDelete;
- mark_para_rewrap(editor, ME_FindItemBack(c.pRun, diParagraph));
+ para_mark_rewrap( editor, &ME_FindItemBack( c.pRun, diParagraph )->member.para );
cursor = c;
/* nChars is the number of characters that should be deleted from the
diff --git a/dlls/riched20/editor.c b/dlls/riched20/editor.c
index abc4592087..2fb7e3650d 100644
--- a/dlls/riched20/editor.c
+++ b/dlls/riched20/editor.c
@@ -2509,7 +2509,7 @@ static BOOL handle_enter(ME_TextEditor *editor)
para = editor->pBuffer->pFirst->member.para.next_para;
ME_SetDefaultParaFormat(editor, ¶->member.para.fmt);
para->member.para.nFlags = 0;
- mark_para_rewrap(editor, para);
+ para_mark_rewrap( editor, ¶->member.para );
editor->pCursors[0].pPara = para;
editor->pCursors[0].pRun = ME_FindItemFwd(para, diRun);
editor->pCursors[1] = editor->pCursors[0];
diff --git a/dlls/riched20/editor.h b/dlls/riched20/editor.h
index 47e822c2d3..e768727251 100644
--- a/dlls/riched20/editor.h
+++ b/dlls/riched20/editor.h
@@ -208,9 +208,9 @@ void ME_SetDefaultParaFormat(ME_TextEditor *editor, PARAFORMAT2 *pFmt) DECLSPEC_
void para_num_init( ME_Context *c, ME_Paragraph *para ) DECLSPEC_HIDDEN;
void para_num_clear( struct para_num *pn ) DECLSPEC_HIDDEN;
int get_total_width(ME_TextEditor *editor) DECLSPEC_HIDDEN;
-void mark_para_rewrap(ME_TextEditor *editor, ME_DisplayItem *para) DECLSPEC_HIDDEN;
-void add_marked_para(ME_TextEditor *editor, ME_DisplayItem *para) DECLSPEC_HIDDEN;
-void remove_marked_para(ME_TextEditor *editor, ME_DisplayItem *para) 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_Run *para_first_run( ME_Paragraph *para ) DECLSPEC_HIDDEN;
static inline ME_DisplayItem *para_get_di(ME_Paragraph *para)
{
diff --git a/dlls/riched20/para.c b/dlls/riched20/para.c
index fb994506be..9d8693ed41 100644
--- a/dlls/riched20/para.c
+++ b/dlls/riched20/para.c
@@ -23,10 +23,10 @@
WINE_DEFAULT_DEBUG_CHANNEL(richedit);
-void mark_para_rewrap(ME_TextEditor *editor, ME_DisplayItem *para)
+void para_mark_rewrap( ME_TextEditor *editor, ME_Paragraph *para )
{
- para->member.para.nFlags |= MEPF_REWRAP;
- add_marked_para(editor, para);
+ para->nFlags |= MEPF_REWRAP;
+ para_mark_add( editor, para );
}
static ME_DisplayItem *make_para(ME_TextEditor *editor)
@@ -52,7 +52,7 @@ void destroy_para(ME_TextEditor *editor, ME_DisplayItem *item)
editor->total_rows -= item->member.para.nRows;
ME_DestroyString(item->member.para.text);
para_num_clear( &item->member.para.para_num );
- remove_marked_para(editor, item);
+ para_mark_remove( editor, &item->member.para );
ME_DestroyDisplayItem(item);
}
@@ -74,11 +74,11 @@ int get_total_width(ME_TextEditor *editor)
return total_width;
}
-void remove_marked_para(ME_TextEditor *editor, ME_DisplayItem *di)
+void para_mark_remove( ME_TextEditor *editor, ME_Paragraph *para )
{
+ ME_DisplayItem *di = para_get_di( para );
ME_DisplayItem *head = editor->first_marked_para;
- assert(di->type == diParagraph);
if (!di->member.para.next_marked && !di->member.para.prev_marked)
{
if (di == head)
@@ -104,8 +104,9 @@ void remove_marked_para(ME_TextEditor *editor, ME_DisplayItem *di)
}
}
-void add_marked_para(ME_TextEditor *editor, ME_DisplayItem *di)
+void para_mark_add( ME_TextEditor *editor, ME_Paragraph *para )
{
+ ME_DisplayItem *di = para_get_di( para );
ME_DisplayItem *iter = editor->first_marked_para;
if (!iter)
@@ -228,7 +229,7 @@ void ME_MakeFirstParagraph(ME_TextEditor *editor)
text->pLast->member.para.nCharOfs = editor->bEmulateVersion10 ? 2 : 1;
- add_marked_para(editor, para);
+ para_mark_add( editor, ¶->member.para );
ME_DestroyContext(&c);
}
@@ -236,7 +237,7 @@ static void ME_MarkForWrapping(ME_TextEditor *editor, ME_DisplayItem *first, con
{
while(first != last)
{
- mark_para_rewrap(editor, first);
+ para_mark_rewrap( editor, &first->member.para );
first = first->member.para.next_para;
}
}
@@ -462,7 +463,7 @@ static void para_num_clear_list( ME_TextEditor *editor, ME_Paragraph *para, cons
{
do
{
- mark_para_rewrap( editor, para_get_di( para ) );
+ para_mark_rewrap( editor, para );
para_num_clear( ¶->para_num );
if (para->next_para->type != diParagraph) break;
para = ¶->next_para->member.para;
@@ -537,7 +538,7 @@ static BOOL ME_SetParaFormat(ME_TextEditor *editor, ME_Paragraph *para, const PA
if (memcmp(©, ¶->fmt, sizeof(PARAFORMAT2)))
{
- mark_para_rewrap( editor, para_get_di( para ) );
+ para_mark_rewrap( editor, para );
if (((dwMask & PFM_NUMBERING) && (copy.wNumbering != para->fmt.wNumbering)) ||
((dwMask & PFM_NUMBERINGSTART) && (copy.wNumberingStart != para->fmt.wNumberingStart)) ||
((dwMask & PFM_NUMBERINGSTYLE) && (copy.wNumberingStyle != para->fmt.wNumberingStyle)))
@@ -612,7 +613,7 @@ ME_DisplayItem *ME_SplitParagraph(ME_TextEditor *editor, ME_DisplayItem *run,
new_para->member.para.nCharOfs = run_para->member.para.nCharOfs + ofs;
new_para->member.para.nCharOfs += eol_len;
new_para->member.para.nFlags = 0;
- mark_para_rewrap(editor, new_para);
+ para_mark_rewrap( editor, &new_para->member.para );
/* FIXME initialize format style and call ME_SetParaFormat blah blah */
new_para->member.para.fmt = run_para->member.para.fmt;
@@ -679,9 +680,9 @@ ME_DisplayItem *ME_SplitParagraph(ME_TextEditor *editor, ME_DisplayItem *run,
/* force rewrap of the */
if (run_para->member.para.prev_para->type == diParagraph)
- mark_para_rewrap(editor, run_para->member.para.prev_para);
+ para_mark_rewrap( editor, &run_para->member.para.prev_para->member.para );
- mark_para_rewrap(editor, new_para->member.para.prev_para);
+ para_mark_rewrap( editor, &new_para->member.para.prev_para->member.para );
/* we've added the end run, so we need to modify nCharOfs in the next paragraphs */
ME_PropagateCharOffset(next_para, eol_len);
@@ -816,7 +817,7 @@ ME_DisplayItem *ME_JoinParagraphs(ME_TextEditor *editor, ME_DisplayItem *tp,
ME_CheckCharOffsets(editor);
editor->nParagraphs--;
- mark_para_rewrap(editor, tp);
+ para_mark_rewrap( editor, &tp->member.para );
return tp;
}
diff --git a/dlls/riched20/run.c b/dlls/riched20/run.c
index f98288a94a..c3bc7f50b3 100644
--- a/dlls/riched20/run.c
+++ b/dlls/riched20/run.c
@@ -247,7 +247,7 @@ void ME_JoinRuns(ME_TextEditor *editor, ME_DisplayItem *p)
int i;
assert(p->type == diRun && pNext->type == diRun);
assert(p->member.run.nCharOfs != -1);
- mark_para_rewrap(editor, ME_GetParagraph(p));
+ para_mark_rewrap( editor, &ME_GetParagraph( p )->member.para );
/* Update all cursors so that they don't contain the soon deleted run */
for (i=0; i<editor->nCursors; i++) {
@@ -299,7 +299,7 @@ ME_DisplayItem *ME_SplitRunSimple(ME_TextEditor *editor, ME_Cursor *cursor)
editor->pCursors[i].nOffset -= nOffset;
}
}
- mark_para_rewrap(editor, cursor->pPara);
+ para_mark_rewrap( editor, &cursor->pPara->member.para );
return run;
}
@@ -367,7 +367,7 @@ ME_InsertRunAtCursor(ME_TextEditor *editor, ME_Cursor *cursor, ME_Style *style,
ME_InsertBefore( insert_before, pDI );
TRACE("Shift length:%d\n", len);
ME_PropagateCharOffset( insert_before, len );
- mark_para_rewrap( editor, para_get_di( insert_before->member.run.para ) );
+ para_mark_rewrap( editor, insert_before->member.run.para );
/* Move any cursors that were at the end of the previous run to the end of the inserted run */
prev = ME_FindItemBack( pDI, diRun );
@@ -787,7 +787,7 @@ void ME_SetCharFormat(ME_TextEditor *editor, ME_Cursor *start, ME_Cursor *end, C
ME_ReleaseStyle(para->para_num.style);
para->para_num.style = NULL;
}
- mark_para_rewrap( editor, para_get_di( para ) );
+ para_mark_rewrap( editor, para );
}
}
diff --git a/dlls/riched20/undo.c b/dlls/riched20/undo.c
index 2f18fc78bb..c6b898b2dd 100644
--- a/dlls/riched20/undo.c
+++ b/dlls/riched20/undo.c
@@ -341,7 +341,7 @@ static void ME_PlayUndoItem(ME_TextEditor *editor, struct undo_item *undo)
add_undo_set_para_fmt( editor, ¶->member.para );
para->member.para.fmt = undo->u.set_para_fmt.fmt;
para->member.para.border = undo->u.set_para_fmt.border;
- mark_para_rewrap(editor, para);
+ para_mark_rewrap( editor, ¶->member.para );
break;
}
case undo_set_char_fmt:
diff --git a/dlls/riched20/wrap.c b/dlls/riched20/wrap.c
index 4853eefcab..c0c9c8f07e 100644
--- a/dlls/riched20/wrap.c
+++ b/dlls/riched20/wrap.c
@@ -1078,11 +1078,11 @@ BOOL ME_WrapMarkedParagraphs(ME_TextEditor *editor)
{
ME_DisplayItem *rem = item;
item = item->member.para.next_marked;
- remove_marked_para(editor, rem);
+ para_mark_remove( editor, &rem->member.para );
}
else
{
- remove_marked_para(editor, item);
+ para_mark_remove( editor, &item->member.para );
item = editor->pBuffer->pLast;
}
c.pt.y = item->member.para.pt.y;
More information about the wine-cvs
mailing list