From f4fd063101ef10c1a88527369a9b339705367bae Mon Sep 17 00:00:00 2001 From: Eric Pouech Date: Tue, 1 Jan 2008 22:04:34 +0100 Subject: [PATCH] richedit: Enforce usage of paraformat2 fields instead of homegrown ones for paragraphs. --- dlls/riched20/editstr.h | 1 - dlls/riched20/paint.c | 15 +++++++++------ dlls/riched20/para.c | 5 ----- dlls/riched20/wrap.c | 9 +++------ 4 files changed, 12 insertions(+), 18 deletions(-) diff --git a/dlls/riched20/editstr.h b/dlls/riched20/editstr.h index cc70af2206c..2f383c73f65 100644 --- a/dlls/riched20/editstr.h +++ b/dlls/riched20/editstr.h @@ -167,7 +167,6 @@ typedef struct tagME_Paragraph struct tagME_TableCell *pCells; /* list of cells and their properties */ struct tagME_TableCell *pLastCell; /* points to the last cell in the list */ - int nLeftMargin, nRightMargin, nFirstMargin; int nCharOfs; int nFlags; int nYPos, nHeight; diff --git a/dlls/riched20/paint.c b/dlls/riched20/paint.c index b21e5bc22d9..11071056abb 100644 --- a/dlls/riched20/paint.c +++ b/dlls/riched20/paint.c @@ -310,14 +310,15 @@ static void ME_DrawRun(ME_Context *c, int x, int y, ME_DisplayItem *rundi, ME_Pa void ME_DrawParagraph(ME_Context *c, ME_DisplayItem *paragraph) { int align = SetTextAlign(c->hDC, TA_BASELINE); + int dpi = GetDeviceCaps(c->hDC, LOGPIXELSX); ME_DisplayItem *p; ME_Run *run; ME_Paragraph *para = NULL; RECT rc, rcPara; int y = c->pt.y; int height = 0, baseline = 0, no=0, pno = 0; - int xs, xe; - int visible = 0; + int xs = 0, xe = 0; + BOOL visible = FALSE; int nMargWidth = 0; c->pt.x = c->rcView.left; @@ -327,12 +328,14 @@ void ME_DrawParagraph(ME_Context *c, ME_DisplayItem *paragraph) { switch(p->type) { case diParagraph: para = &p->member.para; + assert(para); + nMargWidth = para->pFmt->dxStartIndent*dpi/1440; + if (pno != 0) + nMargWidth += para->pFmt->dxOffset*dpi/1440; + xs = c->rcView.left+nMargWidth; + xe = c->rcView.right-(para->pFmt->dxRightIndent*dpi/1440); break; case diStartRow: - assert(para); - nMargWidth = (pno==0?para->nFirstMargin:para->nLeftMargin); - xs = c->rcView.left+nMargWidth; - xe = c->rcView.right-para->nRightMargin; y += height; rcPara.top = y; rcPara.bottom = y+p->member.row.nHeight; diff --git a/dlls/riched20/para.c b/dlls/riched20/para.c index 1c8b21ce260..3b2750bad5a 100644 --- a/dlls/riched20/para.c +++ b/dlls/riched20/para.c @@ -141,11 +141,6 @@ ME_DisplayItem *ME_SplitParagraph(ME_TextEditor *editor, ME_DisplayItem *run, ME new_para->member.para.nFlags = MEPF_REWRAP; /* FIXME copy flags (if applicable) */ /* FIXME initialize format style and call ME_SetParaFormat blah blah */ CopyMemory(new_para->member.para.pFmt, run_para->member.para.pFmt, sizeof(PARAFORMAT2)); - - /* FIXME remove this as soon as nLeftMargin etc are replaced with proper fields of PARAFORMAT2 */ - new_para->member.para.nLeftMargin = run_para->member.para.nLeftMargin; - new_para->member.para.nRightMargin = run_para->member.para.nRightMargin; - new_para->member.para.nFirstMargin = run_para->member.para.nFirstMargin; new_para->member.para.bTable = run_para->member.para.bTable; diff --git a/dlls/riched20/wrap.c b/dlls/riched20/wrap.c index df1606ea6bd..ae399fba6df 100644 --- a/dlls/riched20/wrap.c +++ b/dlls/riched20/wrap.c @@ -352,12 +352,9 @@ static void ME_WrapTextParagraph(ME_Context *c, ME_DisplayItem *tp, DWORD begino wc.context = c; /* wc.para_style = tp->member.para.style; */ wc.style = NULL; - tp->member.para.nRightMargin = tp->member.para.pFmt->dxRightIndent*dpi/1440; - tp->member.para.nFirstMargin = tp->member.para.pFmt->dxStartIndent*dpi/1440 + beginofs; - tp->member.para.nLeftMargin = (tp->member.para.pFmt->dxStartIndent+tp->member.para.pFmt->dxOffset)*dpi/1440 + beginofs; - wc.nFirstMargin = tp->member.para.nFirstMargin; - wc.nLeftMargin = tp->member.para.nLeftMargin; - wc.nRightMargin = tp->member.para.nRightMargin; + wc.nFirstMargin = tp->member.para.pFmt->dxStartIndent*dpi/1440 + beginofs; + wc.nLeftMargin = wc.nFirstMargin + tp->member.para.pFmt->dxOffset*dpi/1440 + beginofs; + wc.nRightMargin = tp->member.para.pFmt->dxRightIndent*dpi/1440; wc.nRow = 0; wc.pt.x = 0; wc.pt.y = 0;