riched20: Add get_total_width() to get widest paragraph number.
Signed-off-by: Sergio Gómez Del Real <sdelreal@codeweavers.com> Signed-off-by: Huw Davies <huw@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
118908d0af
commit
3c0b519bba
|
@ -202,6 +202,7 @@ void ME_MarkAllForWrapping(ME_TextEditor *editor) DECLSPEC_HIDDEN;
|
|||
void ME_SetDefaultParaFormat(ME_TextEditor *editor, PARAFORMAT2 *pFmt) DECLSPEC_HIDDEN;
|
||||
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;
|
||||
|
||||
/* paint.c */
|
||||
void ME_PaintContent(ME_TextEditor *editor, HDC hDC, const RECT *rcUpdate) DECLSPEC_HIDDEN;
|
||||
|
|
|
@ -36,11 +36,34 @@ void destroy_para(ME_TextEditor *editor, ME_DisplayItem *item)
|
|||
{
|
||||
assert(item->type == diParagraph);
|
||||
|
||||
if (item->member.para.nWidth == editor->nTotalWidth)
|
||||
{
|
||||
item->member.para.nWidth = 0;
|
||||
editor->nTotalWidth = get_total_width(editor);
|
||||
}
|
||||
ME_DestroyString(item->member.para.text);
|
||||
para_num_clear( &item->member.para.para_num );
|
||||
ME_DestroyDisplayItem(item);
|
||||
}
|
||||
|
||||
int get_total_width(ME_TextEditor *editor)
|
||||
{
|
||||
ME_Paragraph *para;
|
||||
int total_width = 0;
|
||||
|
||||
if (editor->pBuffer->pFirst && editor->pBuffer->pLast)
|
||||
{
|
||||
para = &editor->pBuffer->pFirst->next->member.para;
|
||||
while (para != &editor->pBuffer->pLast->member.para && para->next_para)
|
||||
{
|
||||
total_width = max(total_width, para->nWidth);
|
||||
para = ¶->next_para->member.para;
|
||||
}
|
||||
}
|
||||
|
||||
return total_width;
|
||||
}
|
||||
|
||||
void ME_MakeFirstParagraph(ME_TextEditor *editor)
|
||||
{
|
||||
ME_Context c;
|
||||
|
|
Loading…
Reference in New Issue