Commit 3c0b519b authored by Sergio Gómez Del Real's avatar Sergio Gómez Del Real Committed by Alexandre Julliard

riched20: Add get_total_width() to get widest paragraph number.

parent 118908d0
...@@ -202,6 +202,7 @@ void ME_MarkAllForWrapping(ME_TextEditor *editor) DECLSPEC_HIDDEN; ...@@ -202,6 +202,7 @@ void ME_MarkAllForWrapping(ME_TextEditor *editor) DECLSPEC_HIDDEN;
void ME_SetDefaultParaFormat(ME_TextEditor *editor, PARAFORMAT2 *pFmt) 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_init( ME_Context *c, ME_Paragraph *para ) DECLSPEC_HIDDEN;
void para_num_clear( struct para_num *pn ) DECLSPEC_HIDDEN; void para_num_clear( struct para_num *pn ) DECLSPEC_HIDDEN;
int get_total_width(ME_TextEditor *editor) DECLSPEC_HIDDEN;
/* paint.c */ /* paint.c */
void ME_PaintContent(ME_TextEditor *editor, HDC hDC, const RECT *rcUpdate) DECLSPEC_HIDDEN; 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) ...@@ -36,11 +36,34 @@ void destroy_para(ME_TextEditor *editor, ME_DisplayItem *item)
{ {
assert(item->type == diParagraph); 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); ME_DestroyString(item->member.para.text);
para_num_clear( &item->member.para.para_num ); para_num_clear( &item->member.para.para_num );
ME_DestroyDisplayItem(item); 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 = &para->next_para->member.para;
}
}
return total_width;
}
void ME_MakeFirstParagraph(ME_TextEditor *editor) void ME_MakeFirstParagraph(ME_TextEditor *editor)
{ {
ME_Context c; ME_Context c;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment