mirror of
git://source.winehq.org/git/wine.git
synced 2024-10-14 21:39:43 +00:00
riched20: Pass a ME_Paragraph ptr to itemize_para().
Signed-off-by: Huw Davies <huw@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
1500cfe8fa
commit
7ef2c6c8d5
|
@ -211,6 +211,7 @@ 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;
|
||||
ME_Run *para_first_run( ME_Paragraph *para ) DECLSPEC_HIDDEN;
|
||||
static inline ME_DisplayItem *para_get_di(ME_Paragraph *para)
|
||||
{
|
||||
return (ME_DisplayItem *)((ptrdiff_t)para - offsetof(ME_DisplayItem, member));
|
||||
|
|
|
@ -143,6 +143,19 @@ void add_marked_para(ME_TextEditor *editor, ME_DisplayItem *di)
|
|||
}
|
||||
}
|
||||
|
||||
ME_Run *para_first_run( ME_Paragraph *para )
|
||||
{
|
||||
ME_DisplayItem *di;
|
||||
|
||||
for (di = para_get_di( para ); di != para->next_para; di = di->next )
|
||||
{
|
||||
if (di->type != diRun) continue;
|
||||
return &di->member.run;
|
||||
}
|
||||
ERR( "failed to find run in paragraph\n" );
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void ME_MakeFirstParagraph(ME_TextEditor *editor)
|
||||
{
|
||||
static const WCHAR cr_lf[] = {'\r','\n',0};
|
||||
|
|
|
@ -719,11 +719,9 @@ static void ME_PrepareParagraphForWrapping( ME_TextEditor *editor, ME_Context *c
|
|||
}
|
||||
}
|
||||
|
||||
static HRESULT itemize_para( ME_Context *c, ME_DisplayItem *p )
|
||||
static HRESULT itemize_para( ME_Context *c, ME_Paragraph *para )
|
||||
{
|
||||
ME_Paragraph *para = &p->member.para;
|
||||
ME_Run *run;
|
||||
ME_DisplayItem *di;
|
||||
SCRIPT_ITEM buf[16], *items = buf;
|
||||
int items_passed = ARRAY_SIZE( buf ), num_items, cur_item;
|
||||
SCRIPT_CONTROL control = { LANG_USER_DEFAULT, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE,
|
||||
|
@ -731,8 +729,6 @@ static HRESULT itemize_para( ME_Context *c, ME_DisplayItem *p )
|
|||
SCRIPT_STATE state = { 0, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, 0, 0 };
|
||||
HRESULT hr;
|
||||
|
||||
assert( p->type == diParagraph );
|
||||
|
||||
if (para->fmt.dwMask & PFM_RTLPARA && para->fmt.wEffects & PFE_RTLPARA)
|
||||
state.uBidiLevel = 1;
|
||||
|
||||
|
@ -763,19 +759,13 @@ static HRESULT itemize_para( ME_Context *c, ME_DisplayItem *p )
|
|||
}
|
||||
|
||||
TRACE( "before splitting runs into ranges\n" );
|
||||
for (di = p->next; di != p->member.para.next_para; di = di->next)
|
||||
{
|
||||
if (di->type != diRun) continue;
|
||||
TRACE( "\t%d: %s\n", di->member.run.nCharOfs, debugstr_run( &di->member.run ) );
|
||||
}
|
||||
for (run = para_first_run( para ); run; run = run_next( run ))
|
||||
TRACE( "\t%d: %s\n", run->nCharOfs, debugstr_run( run ) );
|
||||
}
|
||||
|
||||
/* split runs into ranges at item boundaries */
|
||||
for (di = p->next, cur_item = 0; di != p->member.para.next_para; di = di->next)
|
||||
for (run = para_first_run( para ), cur_item = 0; run; run = run_next( run ))
|
||||
{
|
||||
if (di->type != diRun) continue;
|
||||
run = &di->member.run;
|
||||
|
||||
if (run->nCharOfs == items[cur_item+1].iCharPos) cur_item++;
|
||||
|
||||
items[cur_item].a.fLogicalOrder = TRUE;
|
||||
|
@ -785,7 +775,7 @@ static HRESULT itemize_para( ME_Context *c, ME_DisplayItem *p )
|
|||
|
||||
if (run->nCharOfs + run->len > items[cur_item+1].iCharPos)
|
||||
{
|
||||
ME_Cursor cursor = {p, di, items[cur_item+1].iCharPos - run->nCharOfs};
|
||||
ME_Cursor cursor = {para_get_di( para ), run_get_di( run ), items[cur_item+1].iCharPos - run->nCharOfs};
|
||||
ME_SplitRunSimple( c->editor, &cursor );
|
||||
}
|
||||
}
|
||||
|
@ -793,11 +783,8 @@ static HRESULT itemize_para( ME_Context *c, ME_DisplayItem *p )
|
|||
if (TRACE_ON( richedit ))
|
||||
{
|
||||
TRACE( "after splitting into ranges\n" );
|
||||
for (di = p->next; di != p->member.para.next_para; di = di->next)
|
||||
{
|
||||
if (di->type != diRun) continue;
|
||||
TRACE( "\t%d: %s\n", di->member.run.nCharOfs, debugstr_run( &di->member.run ) );
|
||||
}
|
||||
for (run = para_first_run( para ); run; run = run_next( run ))
|
||||
TRACE( "\t%d: %s\n", run->nCharOfs, debugstr_run( run ) );
|
||||
}
|
||||
|
||||
para->nFlags |= MEPF_COMPLEX;
|
||||
|
@ -847,7 +834,7 @@ static void ME_WrapTextParagraph( ME_TextEditor *editor, ME_Context *c, ME_Parag
|
|||
if (!c->editor->cPasswordMask /* &&
|
||||
ScriptIsComplex( tp->member.para.text->szData, tp->member.para.text->nLen, SIC_COMPLEX ) == S_OK */)
|
||||
{
|
||||
if (SUCCEEDED( itemize_para( c, para_get_di( para ) ) ))
|
||||
if (SUCCEEDED( itemize_para( c, para ) ))
|
||||
shape_para( c, para_get_di( para ) );
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue