void ME_InvalidateMarkedParagraphs(ME_TextEditor *editor, ME_DisplayItem *start_para, ME_DisplayItem *end_para) { ME_Context c; RECT rc; int ofs; ME_DisplayItem *item; ME_InitContext(&c, editor, ITextHost_TxGetDC(editor->texthost)); rc = c.rcView; ofs = editor->vert_si.nPos; item = start_para; while(item && item != end_para) { if (item->member.para.nFlags & MEPF_REPAINT) { rc.top = c.rcView.top + item->member.para.pt.y - ofs; rc.bottom = max(rc.top + item->member.para.nHeight, c.rcView.bottom); ITextHost_TxInvalidateRect(editor->texthost, &rc, TRUE); item->member.para.nFlags &= ~MEPF_REPAINT; } item = item->member.para.next_para; } if (editor->nTotalLength < editor->nLastTotalLength) { rc.top = c.rcView.top + editor->nTotalLength - ofs; rc.bottom = c.rcView.top + editor->nLastTotalLength - ofs; ITextHost_TxInvalidateRect(editor->texthost, &rc, TRUE); } ME_DestroyContext(&c); }
void ME_InvalidateParagraphRange(ME_TextEditor *editor, ME_DisplayItem *start_para, ME_DisplayItem *last_para) { ME_Context c; RECT rc; int ofs; ME_InitContext(&c, editor, ITextHost_TxGetDC(editor->texthost)); rc = c.rcView; ofs = editor->vert_si.nPos; if (start_para) { start_para = ME_GetOuterParagraph(start_para); last_para = ME_GetOuterParagraph(last_para); rc.top = c.rcView.top + start_para->member.para.pt.y - ofs; } else { rc.top = c.rcView.top + editor->nTotalLength - ofs; } if (editor->nTotalLength < editor->nLastTotalLength) rc.bottom = c.rcView.top + editor->nLastTotalLength - ofs; else rc.bottom = c.rcView.top + last_para->member.para.pt.y + last_para->member.para.nHeight - ofs; ITextHost_TxInvalidateRect(editor->texthost, &rc, TRUE); ME_DestroyContext(&c); }