Commit 28cc0f9e authored by Eric Pouech's avatar Eric Pouech Committed by Alexandre Julliard

richedit: Fix the para computation when zoom is used.

parent f4fd0631
......@@ -214,6 +214,7 @@ BOOL ME_UpdateSelection(ME_TextEditor *editor, const ME_Cursor *pTempCursor);
BOOL ME_WrapMarkedParagraphs(ME_TextEditor *editor);
void ME_InvalidateMarkedParagraphs(ME_TextEditor *editor);
void ME_SendRequestResize(ME_TextEditor *editor, BOOL force);
int ME_twips2points(ME_Context *c, int x, int dpi);
/* para.c */
ME_DisplayItem *ME_GetParagraph(ME_DisplayItem *run);
......
......@@ -141,6 +141,13 @@ ME_RewrapRepaint(ME_TextEditor *editor)
ME_Repaint(editor);
}
int ME_twips2points(ME_Context *c, int x, int dpi)
{
if (c->editor->nZoomNumerator == 0)
return x * dpi / 1440;
else
return x * dpi * c->editor->nZoomNumerator / 1440 / c->editor->nZoomDenominator;
}
static void ME_DrawTextWithStyle(ME_Context *c, int x, int y, LPCWSTR szText, int nChars,
ME_Style *s, int *width, int nSelFrom, int nSelTo, int ymin, int cy) {
......@@ -167,17 +174,8 @@ static void ME_DrawTextWithStyle(ME_Context *c, int x, int y, LPCWSTR szText, in
if (s->fmt.dwEffects & CFE_SUBSCRIPT) yTwipsOffset = -s->fmt.yHeight/12;
}
if (yTwipsOffset)
{
int numerator = 1;
int denominator = 1;
yOffset = ME_twips2points(c, yTwipsOffset, GetDeviceCaps(hDC, LOGPIXELSY));
if (c->editor->nZoomNumerator)
{
numerator = c->editor->nZoomNumerator;
denominator = c->editor->nZoomDenominator;
}
yOffset = yTwipsOffset * GetDeviceCaps(hDC, LOGPIXELSY) * numerator / denominator / 1440;
}
ExtTextOutW(hDC, x, y-yOffset, 0, NULL, szText, nChars, NULL);
GetTextExtentPoint32W(hDC, szText, nChars, &sz);
if (width) *width = sz.cx;
......@@ -329,11 +327,11 @@ void ME_DrawParagraph(ME_Context *c, ME_DisplayItem *paragraph) {
case diParagraph:
para = &p->member.para;
assert(para);
nMargWidth = para->pFmt->dxStartIndent*dpi/1440;
nMargWidth = ME_twips2points(c, para->pFmt->dxStartIndent, dpi);
if (pno != 0)
nMargWidth += para->pFmt->dxOffset*dpi/1440;
nMargWidth += ME_twips2points(c, para->pFmt->dxOffset, dpi);
xs = c->rcView.left+nMargWidth;
xe = c->rcView.right-(para->pFmt->dxRightIndent*dpi/1440);
xe = c->rcView.right - ME_twips2points(c, para->pFmt->dxRightIndent, dpi);
break;
case diStartRow:
y += height;
......
......@@ -352,9 +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;
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.nFirstMargin = ME_twips2points(c, tp->member.para.pFmt->dxStartIndent, dpi) + beginofs
wc.nLeftMargin = wc.nFirstMargin + ME_twips2points(c, tp->member.para.pFmt->dxOffset, dpi) + beginofs
wc.nRightMargin = ME_twips2points(c, tp->member.para.pFmt->dxRightIndent, dpi);
wc.nRow = 0;
wc.pt.x = 0;
wc.pt.y = 0;
......
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