Implemented EM_GETLINECOUNT RichEdit message.

This commit is contained in:
Phil Krylov 2005-06-30 18:10:22 +00:00 committed by Alexandre Julliard
parent 4d11eba003
commit eb1c6657f7
3 changed files with 18 additions and 2 deletions

View File

@ -51,7 +51,7 @@
- EM_GETLANGOPTIONS 2.0
- EM_GETLIMITTEXT
- EM_GETLINE
- EM_GETLINECOUNT returns number of rows, not of paragraphs
+ EM_GETLINECOUNT returns number of rows, not of paragraphs
+ EM_GETMODIFY
- EM_GETOLEINTERFACE
- EM_GETOPTIONS
@ -838,7 +838,6 @@ LRESULT WINAPI RichEditANSIWndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lP
UNSUPPORTED_MSG(EM_GETLANGOPTIONS)
UNSUPPORTED_MSG(EM_GETLIMITTEXT)
UNSUPPORTED_MSG(EM_GETLINE)
UNSUPPORTED_MSG(EM_GETLINECOUNT)
/* UNSUPPORTED_MSG(EM_GETOLEINTERFACE) separate stub */
UNSUPPORTED_MSG(EM_GETOPTIONS)
UNSUPPORTED_MSG(EM_GETPASSWORDCHAR)
@ -1235,6 +1234,19 @@ LRESULT WINAPI RichEditANSIWndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lP
}
return ME_GetTextW(editor, rng->lpstrText, rng->chrg.cpMin, rng->chrg.cpMax-rng->chrg.cpMin, FALSE);
}
case EM_GETLINECOUNT:
{
ME_DisplayItem *item = editor->pBuffer->pFirst->next;
int nRows = 0;
while (item != editor->pBuffer->pLast)
{
assert(item->type == diParagraph);
nRows += item->member.para.nRows;
item = item->member.para.next_para;
}
return max(1, nRows);
}
case WM_CREATE:
ME_CommitUndo(editor);
ME_WrapMarkedParagraphs(editor);

View File

@ -147,6 +147,7 @@ typedef struct tagME_Paragraph
int nFlags;
int nYPos, nHeight;
int nLastPaintYPos, nLastPaintHeight;
int nRows;
struct tagME_DisplayItem *prev_para, *next_para, *document;
} ME_Paragraph;

View File

@ -375,12 +375,15 @@ void ME_WrapTextParagraph(ME_Context *c, ME_DisplayItem *tp) {
ME_WrapEndParagraph(&wc, p);
tp->member.para.nFlags &= ~MEPF_REWRAP;
tp->member.para.nHeight = wc.pt.y;
tp->member.para.nRows = wc.nRow + 1;
}
void ME_PrepareParagraphForWrapping(ME_Context *c, ME_DisplayItem *tp) {
ME_DisplayItem *p;
/* remove all items that will be reinserted by paragraph wrapper anyway */
tp->member.para.nRows = 0;
for (p = tp->next; p!=tp->member.para.next_para; p = p->next) {
switch(p->type) {
case diStartRow: