riched20: Pass a ME_Paragraph ptr to the marking functions.

Signed-off-by: Huw Davies <huw@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Huw Davies 2020-10-09 12:59:18 +01:00 committed by Alexandre Julliard
parent e2bcf44080
commit 02cf14cf43
7 changed files with 28 additions and 27 deletions

View file

@ -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

View file

@ -2509,7 +2509,7 @@ static BOOL handle_enter(ME_TextEditor *editor)
para = editor->pBuffer->pFirst->member.para.next_para;
ME_SetDefaultParaFormat(editor, &para->member.para.fmt);
para->member.para.nFlags = 0;
mark_para_rewrap(editor, para);
para_mark_rewrap( editor, &para->member.para );
editor->pCursors[0].pPara = para;
editor->pCursors[0].pRun = ME_FindItemFwd(para, diRun);
editor->pCursors[1] = editor->pCursors[0];

View file

@ -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)
{

View file

@ -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, &para->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->para_num );
if (para->next_para->type != diParagraph) break;
para = &para->next_para->member.para;
@ -537,7 +538,7 @@ static BOOL ME_SetParaFormat(ME_TextEditor *editor, ME_Paragraph *para, const PA
if (memcmp(&copy, &para->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;
}

View file

@ -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 );
}
}

View file

@ -341,7 +341,7 @@ static void ME_PlayUndoItem(ME_TextEditor *editor, struct undo_item *undo)
add_undo_set_para_fmt( editor, &para->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, &para->member.para );
break;
}
case undo_set_char_fmt:

View file

@ -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;