Module: wine Branch: master Commit: 8172d69e8f422d31bdeb5d82ca0c9c3f806b7ef6 URL: http://source.winehq.org/git/wine.git/?a=commit;h=8172d69e8f422d31bdeb5d82ca...
Author: Dylan Smith dylan.ah.smith@gmail.com Date: Tue Jul 8 13:38:58 2008 -0400
richedit: Set the default paragraph format consistently.
I created a function to set the default paragraph format to ensure consistency when this is done. This initial paragraph format is also now more consistent with native richedit controls. The dwMask value always appears to have the same value when retrieved from the native richedit controls, so all the mask values are now initialized when the PARAFORMAT2 structure is created.
---
dlls/riched20/editor.c | 5 ++++- dlls/riched20/editor.h | 1 + dlls/riched20/list.c | 3 +-- dlls/riched20/para.c | 18 ++++++++++-------- 4 files changed, 16 insertions(+), 11 deletions(-)
diff --git a/dlls/riched20/editor.c b/dlls/riched20/editor.c index 4665845..35e4be1 100644 --- a/dlls/riched20/editor.c +++ b/dlls/riched20/editor.c @@ -1040,13 +1040,16 @@ static LRESULT ME_StreamIn(ME_TextEditor *editor, DWORD format, EDITSTREAM *stre ME_InternalDeleteText(editor, from, to-from); } else { + ME_DisplayItem *para_item; style = editor->pBuffer->pDefaultStyle; ME_AddRefStyle(style); SendMessageA(editor->hWnd, EM_SETSEL, 0, 0); ME_InternalDeleteText(editor, 0, ME_GetTextLength(editor)); from = to = 0; ME_ClearTempStyle(editor); - /* FIXME restore default paragraph formatting ! */ + + para_item = ME_GetParagraph(editor->pCursors[0].pRun); + ME_SetDefaultParaFormat(para_item->member.para.pFmt); }
diff --git a/dlls/riched20/editor.h b/dlls/riched20/editor.h index 76f61a2..786191a 100644 --- a/dlls/riched20/editor.h +++ b/dlls/riched20/editor.h @@ -231,6 +231,7 @@ void ME_GetSelectionParaFormat(ME_TextEditor *editor, PARAFORMAT2 *pFmt); void ME_MarkForWrapping(ME_TextEditor *editor, ME_DisplayItem *first, const ME_DisplayItem *last); void ME_MarkForPainting(ME_TextEditor *editor, ME_DisplayItem *first, const ME_DisplayItem *last); void ME_MarkAllForWrapping(ME_TextEditor *editor); +void ME_SetDefaultParaFormat(PARAFORMAT2 *pFmt);
/* paint.c */ void ME_PaintContent(ME_TextEditor *editor, HDC hDC, BOOL bOnlyNew, const RECT *rcUpdate); diff --git a/dlls/riched20/list.c b/dlls/riched20/list.c index f5c5f42..60c49e3 100644 --- a/dlls/riched20/list.c +++ b/dlls/riched20/list.c @@ -151,8 +151,7 @@ ME_DisplayItem *ME_MakeDI(ME_DIType type) { item->prev = item->next = NULL; if (type == diParagraph || type == diUndoSplitParagraph) { item->member.para.pFmt = ALLOC_OBJ(PARAFORMAT2); - item->member.para.pFmt->cbSize = sizeof(PARAFORMAT2); - item->member.para.pFmt->dwMask = 0; + ME_SetDefaultParaFormat(item->member.para.pFmt); item->member.para.nFlags = MEPF_REWRAP; }
diff --git a/dlls/riched20/para.c b/dlls/riched20/para.c index c0f1857..e2ba258 100644 --- a/dlls/riched20/para.c +++ b/dlls/riched20/para.c @@ -28,7 +28,6 @@ static const WCHAR wszParagraphSign[] = {0xB6, 0}; void ME_MakeFirstParagraph(ME_TextEditor *editor) { ME_Context c; - PARAFORMAT2 fmt; CHARFORMAT2W cf; LOGFONTW lf; HFONT hf; @@ -62,13 +61,6 @@ void ME_MakeFirstParagraph(ME_TextEditor *editor) cf.bPitchAndFamily = lf.lfPitchAndFamily; cf.bCharSet = lf.lfCharSet;
- ZeroMemory(&fmt, sizeof(fmt)); - fmt.cbSize = sizeof(fmt); - fmt.dwMask = PFM_ALIGNMENT | PFM_OFFSET | PFM_STARTINDENT | PFM_RIGHTINDENT | PFM_TABSTOPS; - fmt.wAlignment = PFA_LEFT; - - *para->member.para.pFmt = fmt; - style = ME_MakeStyle(&cf); text->pDefaultStyle = style;
@@ -520,3 +512,13 @@ void ME_GetSelectionParaFormat(ME_TextEditor *editor, PARAFORMAT2 *pFmt) para = para->member.para.next_para; } while(1); } + +void ME_SetDefaultParaFormat(PARAFORMAT2 *pFmt) +{ + ZeroMemory(pFmt, sizeof(PARAFORMAT2)); + pFmt->cbSize = sizeof(PARAFORMAT2); + pFmt->dwMask = PFM_ALL2; + pFmt->wAlignment = PFA_LEFT; + pFmt->sStyle = -1; + pFmt->bOutlineLevel = TRUE; +}