richedit: Enforce usage of paraformat2 fields instead of homegrown ones for paragraphs.

This commit is contained in:
Eric Pouech 2008-01-01 22:04:34 +01:00 committed by Alexandre Julliard
parent 0e8c087561
commit f4fd063101
4 changed files with 12 additions and 18 deletions

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;