richedit: Avoid re-calculating positions found in wrapping for painting.
When the text is wrapped, the positions for all the runs, paragraphs, and cells are already calculated and stored. The only thing left to do for painting is to offset them by the formatting rectangle and the scroll position.
This commit is contained in:
parent
dc03b6b2f2
commit
97a83147b3
|
@ -23,10 +23,12 @@
|
||||||
|
|
||||||
WINE_DEFAULT_DEBUG_CHANNEL(richedit);
|
WINE_DEFAULT_DEBUG_CHANNEL(richedit);
|
||||||
|
|
||||||
void ME_PaintContent(ME_TextEditor *editor, HDC hDC, BOOL bOnlyNew, const RECT *rcUpdate) {
|
void ME_PaintContent(ME_TextEditor *editor, HDC hDC, BOOL bOnlyNew, const RECT *rcUpdate)
|
||||||
|
{
|
||||||
ME_DisplayItem *item;
|
ME_DisplayItem *item;
|
||||||
ME_Context c;
|
ME_Context c;
|
||||||
int yoffset;
|
int yoffset;
|
||||||
|
int ys, ye;
|
||||||
|
|
||||||
editor->nSequence++;
|
editor->nSequence++;
|
||||||
yoffset = ME_GetYScrollPos(editor);
|
yoffset = ME_GetYScrollPos(editor);
|
||||||
|
@ -34,115 +36,70 @@ void ME_PaintContent(ME_TextEditor *editor, HDC hDC, BOOL bOnlyNew, const RECT *
|
||||||
SetBkMode(hDC, TRANSPARENT);
|
SetBkMode(hDC, TRANSPARENT);
|
||||||
ME_MoveCaret(editor); /* Calls ME_WrapMarkedParagraphs */
|
ME_MoveCaret(editor); /* Calls ME_WrapMarkedParagraphs */
|
||||||
item = editor->pBuffer->pFirst->next;
|
item = editor->pBuffer->pFirst->next;
|
||||||
c.pt.y -= yoffset;
|
/* This context point is an offset for the paragraph positions stored
|
||||||
while(item != editor->pBuffer->pLast) {
|
* during wrapping. It shouldn't be modified during painting. */
|
||||||
int yTextOffset = 0;
|
c.pt.x = c.rcView.left;
|
||||||
int ys, ye;
|
c.pt.y = c.rcView.top - yoffset;
|
||||||
|
while(item != editor->pBuffer->pLast)
|
||||||
|
{
|
||||||
assert(item->type == diParagraph);
|
assert(item->type == diParagraph);
|
||||||
|
|
||||||
|
ys = c.pt.y + item->member.para.pt.y;
|
||||||
if (item->member.para.pCell
|
if (item->member.para.pCell
|
||||||
!= item->member.para.next_para->member.para.pCell)
|
!= item->member.para.next_para->member.para.pCell)
|
||||||
{
|
{
|
||||||
ME_Cell *cell = NULL;
|
ME_Cell *cell = NULL;
|
||||||
cell = &ME_FindItemBack(item->member.para.next_para, diCell)->member.cell;
|
cell = &ME_FindItemBack(item->member.para.next_para, diCell)->member.cell;
|
||||||
ye = cell->pt.y + cell->nHeight - yoffset;
|
ye = c.pt.y + cell->pt.y + cell->nHeight;
|
||||||
} else {
|
} else {
|
||||||
ye = c.pt.y + item->member.para.nHeight;
|
ye = ys + item->member.para.nHeight;
|
||||||
}
|
}
|
||||||
if (!(item->member.para.nFlags & MEPF_ROWEND) &&
|
if (item->member.para.pCell && !(item->member.para.nFlags & MEPF_ROWEND) &&
|
||||||
item->member.para.pCell != item->member.para.prev_para->member.para.pCell)
|
item->member.para.pCell != item->member.para.prev_para->member.para.pCell)
|
||||||
{
|
{
|
||||||
ME_DisplayItem *cell;
|
|
||||||
if (item->member.para.prev_para->member.para.nFlags & MEPF_ROWSTART)
|
|
||||||
cell = item->member.para.pCell;
|
|
||||||
else
|
|
||||||
cell = item->member.para.prev_para->member.para.pCell;
|
|
||||||
assert(cell);
|
|
||||||
/* the border shifts the text down */
|
/* the border shifts the text down */
|
||||||
yTextOffset = cell->member.cell.yTextOffset;
|
ys -= item->member.para.pCell->member.cell.yTextOffset;
|
||||||
ye += yTextOffset;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!bOnlyNew || (item->member.para.nFlags & MEPF_REPAINT))
|
if (!bOnlyNew || (item->member.para.nFlags & MEPF_REPAINT))
|
||||||
{
|
{
|
||||||
/* Draw the pargraph if any of the paragraph is in the update region. */
|
/* Draw the pargraph if any of the paragraph is in the update region. */
|
||||||
BOOL bPaint = (rcUpdate == NULL);
|
BOOL bPaint = (rcUpdate == NULL);
|
||||||
ys = c.pt.y;
|
|
||||||
if (rcUpdate)
|
if (rcUpdate)
|
||||||
bPaint = ys + c.rcView.top < rcUpdate->bottom &&
|
bPaint = ys < rcUpdate->bottom && ye > rcUpdate->top;
|
||||||
ye + c.rcView.top > rcUpdate->top;
|
|
||||||
if (bPaint)
|
if (bPaint)
|
||||||
{
|
{
|
||||||
c.pt.y += yTextOffset;
|
|
||||||
ME_DrawParagraph(&c, item);
|
ME_DrawParagraph(&c, item);
|
||||||
/* Clear the repaint flag if the whole paragraph is in the
|
/* Clear the repaint flag if the whole paragraph is in the
|
||||||
* update region. */
|
* update region. */
|
||||||
if (!rcUpdate || (rcUpdate->top <= ys + c.rcView.top &&
|
if (!rcUpdate || (rcUpdate->top <= ys && rcUpdate->bottom >= ye))
|
||||||
rcUpdate->bottom >= ye + c.rcView.top))
|
|
||||||
item->member.para.nFlags &= ~MEPF_REPAINT;
|
item->member.para.nFlags &= ~MEPF_REPAINT;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (item->member.para.pCell)
|
|
||||||
{
|
|
||||||
ME_Cell *cell = &item->member.para.pCell->member.cell;
|
|
||||||
ME_DisplayItem *next_para = item->member.para.next_para;
|
|
||||||
c.pt.x = cell->pt.x + cell->nWidth;
|
|
||||||
if (item->member.para.pCell == next_para->member.para.pCell &&
|
|
||||||
!(next_para->member.para.nFlags & (MEPF_ROWSTART|MEPF_ROWEND)))
|
|
||||||
{
|
|
||||||
c.pt.y = ye;
|
|
||||||
} else {
|
|
||||||
if (next_para->member.para.nFlags & MEPF_ROWSTART)
|
|
||||||
{
|
|
||||||
cell = &ME_FindItemFwd(next_para, diCell)->member.cell;
|
|
||||||
}
|
|
||||||
else if (next_para->member.para.nFlags & MEPF_ROWEND)
|
|
||||||
{
|
|
||||||
cell = &cell->next_cell->member.cell;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
cell = &next_para->member.para.pCell->member.cell;
|
|
||||||
}
|
|
||||||
c.pt.y = cell->pt.y - yoffset;
|
|
||||||
}
|
|
||||||
} else if (!(item->member.para.nFlags & MEPF_ROWSTART)) {
|
|
||||||
c.pt.y = ye;
|
|
||||||
}
|
|
||||||
item = item->member.para.next_para;
|
item = item->member.para.next_para;
|
||||||
}
|
}
|
||||||
if (c.pt.y < c.rcView.bottom - c.rcView.top)
|
if (c.pt.y + editor->nTotalLength < c.rcView.bottom)
|
||||||
{
|
{
|
||||||
/* Fill space after the end of the text. */
|
/* Fill space after the end of the text. */
|
||||||
int xs = c.rcView.left, xe = c.rcView.right;
|
RECT rc;
|
||||||
int ys = c.rcView.top + c.pt.y, ye = c.rcView.bottom;
|
rc.top = c.pt.y + editor->nTotalLength;
|
||||||
|
rc.left = c.rcView.left;
|
||||||
|
rc.bottom = c.rcView.bottom;
|
||||||
|
rc.right = c.rcView.right;
|
||||||
|
|
||||||
if (bOnlyNew)
|
if (bOnlyNew)
|
||||||
{
|
{
|
||||||
/* Only erase region drawn from previous call to ME_PaintContent */
|
/* Only erase region drawn from previous call to ME_PaintContent */
|
||||||
int y1 = editor->nTotalLength-yoffset, y2 = editor->nLastTotalLength-yoffset;
|
if (editor->nTotalLength < editor->nLastTotalLength)
|
||||||
if (y1<y2)
|
rc.bottom = c.pt.y + editor->nLastTotalLength;
|
||||||
ys = y1, ye = y2+1;
|
|
||||||
else
|
else
|
||||||
ys = ye; /* empty fill area */
|
SetRectEmpty(&rc);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (rcUpdate)
|
IntersectRect(&rc, &rc, rcUpdate);
|
||||||
{
|
|
||||||
/* Clip to update region */
|
|
||||||
xs = max(xs, rcUpdate->left);
|
|
||||||
xe = min(xe, rcUpdate->right);
|
|
||||||
ys = max(ys, rcUpdate->top);
|
|
||||||
ye = min(ye, rcUpdate->bottom);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (xe > xs && ye > ys)
|
if (!IsRectEmpty(&rc))
|
||||||
{
|
|
||||||
RECT rc;
|
|
||||||
rc.left = xs;
|
|
||||||
rc.top = ys;
|
|
||||||
rc.right = xe;
|
|
||||||
rc.bottom = ye;
|
|
||||||
FillRect(hDC, &rc, c.editor->hbrBackground);
|
FillRect(hDC, &rc, c.editor->hbrBackground);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if (editor->nTotalLength != editor->nLastTotalLength)
|
if (editor->nTotalLength != editor->nLastTotalLength)
|
||||||
ME_SendRequestResize(editor, FALSE);
|
ME_SendRequestResize(editor, FALSE);
|
||||||
|
@ -451,7 +408,7 @@ static void ME_DrawRun(ME_Context *c, int x, int y, ME_DisplayItem *rundi, ME_Pa
|
||||||
if (runofs >= nSelFrom && runofs < nSelTo)
|
if (runofs >= nSelFrom && runofs < nSelTo)
|
||||||
{
|
{
|
||||||
ME_HighlightSpace(c, x, y, wszSpace, 1, run->style, 0, 0, 1,
|
ME_HighlightSpace(c, x, y, wszSpace, 1, run->style, 0, 0, 1,
|
||||||
c->rcView.top + c->pt.y + start->member.row.pt.y,
|
c->pt.y + para->pt.y + start->member.row.pt.y,
|
||||||
start->member.row.nHeight);
|
start->member.row.nHeight);
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
|
@ -463,7 +420,7 @@ static void ME_DrawRun(ME_Context *c, int x, int y, ME_DisplayItem *rundi, ME_Pa
|
||||||
* an unwanted symbol can be inserted instead. */
|
* an unwanted symbol can be inserted instead. */
|
||||||
ME_DrawTextWithStyle(c, x, y, wszSpace, 1, run->style, run->nWidth,
|
ME_DrawTextWithStyle(c, x, y, wszSpace, 1, run->style, run->nWidth,
|
||||||
nSelFrom-runofs, nSelTo-runofs,
|
nSelFrom-runofs, nSelTo-runofs,
|
||||||
c->rcView.top + c->pt.y + start->member.row.pt.y,
|
c->pt.y + para->pt.y + start->member.row.pt.y,
|
||||||
start->member.row.nHeight);
|
start->member.row.nHeight);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -478,7 +435,7 @@ static void ME_DrawRun(ME_Context *c, int x, int y, ME_DisplayItem *rundi, ME_Pa
|
||||||
ME_DrawTextWithStyle(c, x, y,
|
ME_DrawTextWithStyle(c, x, y,
|
||||||
szMasked->szData, ME_StrVLen(szMasked), run->style, run->nWidth,
|
szMasked->szData, ME_StrVLen(szMasked), run->style, run->nWidth,
|
||||||
nSelFrom-runofs,nSelTo-runofs,
|
nSelFrom-runofs,nSelTo-runofs,
|
||||||
c->rcView.top + c->pt.y + start->member.row.pt.y,
|
c->pt.y + para->pt.y + start->member.row.pt.y,
|
||||||
start->member.row.nHeight);
|
start->member.row.nHeight);
|
||||||
ME_DestroyString(szMasked);
|
ME_DestroyString(szMasked);
|
||||||
}
|
}
|
||||||
|
@ -486,7 +443,7 @@ static void ME_DrawRun(ME_Context *c, int x, int y, ME_DisplayItem *rundi, ME_Pa
|
||||||
ME_DrawTextWithStyle(c, x, y,
|
ME_DrawTextWithStyle(c, x, y,
|
||||||
run->strText->szData, ME_StrVLen(run->strText), run->style, run->nWidth,
|
run->strText->szData, ME_StrVLen(run->strText), run->style, run->nWidth,
|
||||||
nSelFrom-runofs,nSelTo-runofs,
|
nSelFrom-runofs,nSelTo-runofs,
|
||||||
c->rcView.top + c->pt.y + start->member.row.pt.y,
|
c->pt.y + para->pt.y + start->member.row.pt.y,
|
||||||
start->member.row.nHeight);
|
start->member.row.nHeight);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -742,11 +699,11 @@ static void ME_DrawTableBorders(ME_Context *c, ME_DisplayItem *paragraph)
|
||||||
int width;
|
int width;
|
||||||
BOOL atTop = (para->pCell != para->prev_para->member.para.pCell);
|
BOOL atTop = (para->pCell != para->prev_para->member.para.pCell);
|
||||||
BOOL atBottom = (para->pCell != para->next_para->member.para.pCell);
|
BOOL atBottom = (para->pCell != para->next_para->member.para.pCell);
|
||||||
int top = c->rcView.top + (atTop ? cell->pt.y : para->pt.y) - ME_GetYScrollPos(c->editor);
|
int top = c->pt.y + (atTop ? cell->pt.y : para->pt.y);
|
||||||
int bottom = (atBottom ?
|
int bottom = (atBottom ?
|
||||||
c->rcView.top + cell->pt.y + cell->nHeight - ME_GetYScrollPos(c->editor):
|
c->pt.y + cell->pt.y + cell->nHeight :
|
||||||
top + para->nHeight + (atTop ? cell->yTextOffset : 0));
|
top + para->nHeight + (atTop ? cell->yTextOffset : 0));
|
||||||
rc.left = c->rcView.left + cell->pt.x;
|
rc.left = c->pt.x + cell->pt.x;
|
||||||
rc.right = rc.left + cell->nWidth;
|
rc.right = rc.left + cell->nWidth;
|
||||||
if (atTop) {
|
if (atTop) {
|
||||||
/* Erase gap before text if not all borders are the same height. */
|
/* Erase gap before text if not all borders are the same height. */
|
||||||
|
@ -759,7 +716,7 @@ static void ME_DrawTableBorders(ME_Context *c, ME_DisplayItem *paragraph)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* Draw cell borders.
|
/* Draw cell borders.
|
||||||
* The borders borders are draw in is left, top, bottom, right in order
|
* The order borders are draw in is left, top, bottom, right in order
|
||||||
* to be consistent with native richedit. This is noticeable from the
|
* to be consistent with native richedit. This is noticeable from the
|
||||||
* overlap of borders of different colours. */
|
* overlap of borders of different colours. */
|
||||||
if (!(para->nFlags & MEPF_ROWEND)) {
|
if (!(para->nFlags & MEPF_ROWEND)) {
|
||||||
|
@ -812,7 +769,7 @@ static void ME_DrawTableBorders(ME_Context *c, ME_DisplayItem *paragraph)
|
||||||
ME_DisplayItem *nextEndCell;
|
ME_DisplayItem *nextEndCell;
|
||||||
nextEndCell = ME_FindItemBack(ME_GetTableRowEnd(paraAfterRow), diCell);
|
nextEndCell = ME_FindItemBack(ME_GetTableRowEnd(paraAfterRow), diCell);
|
||||||
assert(nextEndCell && !nextEndCell->member.cell.next_cell);
|
assert(nextEndCell && !nextEndCell->member.cell.next_cell);
|
||||||
rc.left = c->rcView.left + nextEndCell->member.cell.pt.x;
|
rc.left = c->pt.x + nextEndCell->member.cell.pt.x;
|
||||||
/* FIXME: Native draws FROM the bottom of the table rather than
|
/* FIXME: Native draws FROM the bottom of the table rather than
|
||||||
* TO the bottom of the table in this case, but just doing so here
|
* TO the bottom of the table in this case, but just doing so here
|
||||||
* will cause the next row to erase the border. */
|
* will cause the next row to erase the border. */
|
||||||
|
@ -874,12 +831,12 @@ static void ME_DrawTableBorders(ME_Context *c, ME_DisplayItem *paragraph)
|
||||||
oldpen = SelectObject(c->hDC, pen);
|
oldpen = SelectObject(c->hDC, pen);
|
||||||
|
|
||||||
/* Find the start relative to the text */
|
/* Find the start relative to the text */
|
||||||
firstX = c->rcView.left + ME_FindItemFwd(paragraph, diRun)->member.run.pt.x;
|
firstX = c->pt.x + ME_FindItemFwd(paragraph, diRun)->member.run.pt.x;
|
||||||
/* Go back by the horizontal gap, which is stored in dxOffset */
|
/* Go back by the horizontal gap, which is stored in dxOffset */
|
||||||
firstX -= ME_twips2pointsX(c, para->pFmt->dxOffset);
|
firstX -= ME_twips2pointsX(c, para->pFmt->dxOffset);
|
||||||
/* The left edge, stored in dxStartIndent affected just the first edge */
|
/* The left edge, stored in dxStartIndent affected just the first edge */
|
||||||
startX = firstX - ME_twips2pointsX(c, para->pFmt->dxStartIndent);
|
startX = firstX - ME_twips2pointsX(c, para->pFmt->dxStartIndent);
|
||||||
rowY = c->rcView.top + c->pt.y;
|
rowY = c->pt.y + para->pt.y;
|
||||||
if (para->pFmt->dwMask & PFM_SPACEBEFORE)
|
if (para->pFmt->dwMask & PFM_SPACEBEFORE)
|
||||||
rowY += ME_twips2pointsY(c, para->pFmt->dySpaceBefore);
|
rowY += ME_twips2pointsY(c, para->pFmt->dySpaceBefore);
|
||||||
nHeight = ME_FindItemFwd(paragraph, diStartRow)->member.row.nHeight;
|
nHeight = ME_FindItemFwd(paragraph, diStartRow)->member.row.nHeight;
|
||||||
|
@ -928,45 +885,45 @@ void ME_DrawParagraph(ME_Context *c, ME_DisplayItem *paragraph)
|
||||||
ME_Run *run;
|
ME_Run *run;
|
||||||
ME_Paragraph *para = NULL;
|
ME_Paragraph *para = NULL;
|
||||||
RECT rc, bounds;
|
RECT rc, bounds;
|
||||||
int y = c->rcView.top + c->pt.y;
|
int y;
|
||||||
int height = 0, baseline = 0, no=0;
|
int height = 0, baseline = 0, no=0;
|
||||||
BOOL visible = FALSE;
|
BOOL visible = FALSE;
|
||||||
|
|
||||||
c->pt.x = c->rcView.left;
|
rc.left = c->pt.x;
|
||||||
rc.left = c->rcView.left;
|
|
||||||
rc.right = c->rcView.right;
|
rc.right = c->rcView.right;
|
||||||
for (p = paragraph; p!=paragraph->member.para.next_para; p = p->next) {
|
|
||||||
|
assert(paragraph);
|
||||||
|
para = ¶graph->member.para;
|
||||||
|
y = c->pt.y + para->pt.y;
|
||||||
|
if (para->pCell)
|
||||||
|
{
|
||||||
|
ME_Cell *cell = ¶->pCell->member.cell;
|
||||||
|
rc.left = c->pt.x + cell->pt.x;
|
||||||
|
rc.right = rc.left + cell->nWidth;
|
||||||
|
}
|
||||||
|
if (para->nFlags & MEPF_ROWSTART) {
|
||||||
|
ME_Cell *cell = ¶->next_para->member.para.pCell->member.cell;
|
||||||
|
rc.right = c->pt.x + cell->pt.x;
|
||||||
|
} else if (para->nFlags & MEPF_ROWEND) {
|
||||||
|
ME_Cell *cell = ¶->prev_para->member.para.pCell->member.cell;
|
||||||
|
rc.left = c->pt.x + cell->pt.x + cell->nWidth;
|
||||||
|
}
|
||||||
|
ME_DrawParaDecoration(c, para, y, &bounds);
|
||||||
|
y += bounds.top;
|
||||||
|
rc.left += bounds.left;
|
||||||
|
rc.right -= bounds.right;
|
||||||
|
|
||||||
|
for (p = paragraph->next; p != para->next_para; p = p->next)
|
||||||
|
{
|
||||||
switch(p->type) {
|
switch(p->type) {
|
||||||
case diParagraph:
|
case diParagraph:
|
||||||
para = &p->member.para;
|
assert(FALSE);
|
||||||
assert(para);
|
|
||||||
if (para->pCell)
|
|
||||||
{
|
|
||||||
ME_Cell *cell = ¶->pCell->member.cell;
|
|
||||||
rc.left = c->rcView.left + cell->pt.x;
|
|
||||||
rc.right = rc.left + cell->nWidth;
|
|
||||||
}
|
|
||||||
if (para->nFlags & MEPF_ROWSTART) {
|
|
||||||
ME_Cell *cell = ¶->next_para->member.para.pCell->member.cell;
|
|
||||||
rc.right = c->rcView.left + cell->pt.x;
|
|
||||||
} else if (para->nFlags & MEPF_ROWEND) {
|
|
||||||
ME_Cell *cell = ¶->prev_para->member.para.pCell->member.cell;
|
|
||||||
rc.left = c->rcView.left + cell->pt.x + cell->nWidth;
|
|
||||||
}
|
|
||||||
ME_DrawParaDecoration(c, para, y, &bounds);
|
|
||||||
y += bounds.top;
|
|
||||||
break;
|
break;
|
||||||
case diStartRow:
|
case diStartRow:
|
||||||
/* we should have seen a diParagraph before */
|
|
||||||
assert(para);
|
|
||||||
y += height;
|
y += height;
|
||||||
rc.top = y;
|
rc.top = y;
|
||||||
if (para->nFlags & MEPF_ROWSTART) {
|
if (para->nFlags & (MEPF_ROWSTART|MEPF_ROWEND)) {
|
||||||
ME_Cell *cell = ¶->next_para->member.para.pCell->member.cell;
|
rc.bottom = y + para->nHeight;
|
||||||
rc.bottom = y + cell->nHeight;
|
|
||||||
} else if (para->nFlags & MEPF_ROWEND) {
|
|
||||||
ME_Cell *cell = ¶->prev_para->member.para.pCell->member.cell;
|
|
||||||
rc.bottom = y + cell->nHeight;
|
|
||||||
} else {
|
} else {
|
||||||
rc.bottom = y + p->member.row.nHeight;
|
rc.bottom = y + p->member.row.nHeight;
|
||||||
}
|
}
|
||||||
|
@ -991,9 +948,10 @@ void ME_DrawParagraph(ME_Context *c, ME_DisplayItem *paragraph)
|
||||||
assert(para);
|
assert(para);
|
||||||
run = &p->member.run;
|
run = &p->member.run;
|
||||||
if (visible && me_debug) {
|
if (visible && me_debug) {
|
||||||
rc.left = c->rcView.left + run->pt.x;
|
RECT rc;
|
||||||
|
rc.left = c->pt.x + run->pt.x;
|
||||||
rc.right = rc.left + run->nWidth;
|
rc.right = rc.left + run->nWidth;
|
||||||
rc.top = c->rcView.top + c->pt.y + run->pt.y;
|
rc.top = c->pt.y + para->pt.y + run->pt.y;
|
||||||
rc.bottom = rc.bottom + height;
|
rc.bottom = rc.bottom + height;
|
||||||
TRACE("rc = (%d, %d, %d, %d)\n", rc.left, rc.top, rc.right, rc.bottom);
|
TRACE("rc = (%d, %d, %d, %d)\n", rc.left, rc.top, rc.right, rc.bottom);
|
||||||
if (run->nFlags & MERF_SKIPPED)
|
if (run->nFlags & MERF_SKIPPED)
|
||||||
|
@ -1002,30 +960,27 @@ void ME_DrawParagraph(ME_Context *c, ME_DisplayItem *paragraph)
|
||||||
FrameRect(c->hDC, &rc, GetSysColorBrush(COLOR_GRAYTEXT));
|
FrameRect(c->hDC, &rc, GetSysColorBrush(COLOR_GRAYTEXT));
|
||||||
}
|
}
|
||||||
if (visible)
|
if (visible)
|
||||||
ME_DrawRun(c, c->rcView.left + run->pt.x,
|
ME_DrawRun(c, c->pt.x + run->pt.x,
|
||||||
c->rcView.top + c->pt.y + run->pt.y + baseline,
|
c->pt.y + para->pt.y + run->pt.y + baseline, p, para);
|
||||||
p, ¶graph->member.para);
|
|
||||||
if (me_debug)
|
if (me_debug)
|
||||||
{
|
{
|
||||||
/* I'm using %ls, hope wsprintfW is not going to use wrong (4-byte) WCHAR version */
|
/* I'm using %ls, hope wsprintfW is not going to use wrong (4-byte) WCHAR version */
|
||||||
const WCHAR wszRunDebug[] = {'[','%','d',':','%','x',']',' ','%','l','s',0};
|
const WCHAR wszRunDebug[] = {'[','%','d',':','%','x',']',' ','%','l','s',0};
|
||||||
WCHAR buf[2560];
|
WCHAR buf[2560];
|
||||||
POINT pt;
|
POINT pt;
|
||||||
pt.x = run->pt.x;
|
pt.x = c->pt.x + run->pt.x;
|
||||||
pt.y = c->rcView.top + c->pt.y + run->pt.y;
|
pt.y = c->pt.y + para->pt.y + run->pt.y;
|
||||||
wsprintfW(buf, wszRunDebug, no, p->member.run.nFlags, p->member.run.strText->szData);
|
wsprintfW(buf, wszRunDebug, no, p->member.run.nFlags, p->member.run.strText->szData);
|
||||||
ME_DebugWrite(c->hDC, &pt, buf);
|
ME_DebugWrite(c->hDC, &pt, buf);
|
||||||
}
|
}
|
||||||
/* c->pt.x += p->member.run.nWidth; */
|
|
||||||
break;
|
break;
|
||||||
case diCell:
|
case diCell:
|
||||||
/* Clear any space at the bottom of the cell after the text. */
|
/* Clear any space at the bottom of the cell after the text. */
|
||||||
if (para->nFlags & MEPF_ROWSTART)
|
if (para->nFlags & (MEPF_ROWSTART|MEPF_ROWEND))
|
||||||
break;
|
break;
|
||||||
y += height;
|
y += height;
|
||||||
rc.top = y;
|
rc.top = c->pt.y + para->pt.y + para->nHeight;
|
||||||
rc.bottom = c->rcView.top + p->member.cell.pt.y
|
rc.bottom = c->pt.y + p->member.cell.pt.y + p->member.cell.nHeight;
|
||||||
+ p->member.cell.nHeight - ME_GetYScrollPos(c->editor);
|
|
||||||
if (RectVisible(c->hDC, &rc))
|
if (RectVisible(c->hDC, &rc))
|
||||||
{
|
{
|
||||||
FillRect(c->hDC, &rc, c->editor->hbrBackground);
|
FillRect(c->hDC, &rc, c->editor->hbrBackground);
|
||||||
|
|
|
@ -693,7 +693,8 @@ BOOL ME_WrapMarkedParagraphs(ME_TextEditor *editor)
|
||||||
c.pt.x = cell->pt.x + cell->nWidth;
|
c.pt.x = cell->pt.x + cell->nWidth;
|
||||||
c.pt.y = cell->pt.y;
|
c.pt.y = cell->pt.y;
|
||||||
cell->next_cell->member.cell.pt = c.pt;
|
cell->next_cell->member.cell.pt = c.pt;
|
||||||
c.pt.y += cell->yTextOffset;
|
if (!(item->member.para.next_para->member.para.nFlags & MEPF_ROWEND))
|
||||||
|
c.pt.y += cell->yTextOffset;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue