Implemented EM_GETTEXTLENGTHEX RichEdit message.

This commit is contained in:
Phil Krylov 2005-06-28 13:51:32 +00:00 committed by Alexandre Julliard
parent 68db49f233
commit b1f61804d7
3 changed files with 36 additions and 2 deletions

View File

@ -41,6 +41,38 @@ int ME_GetTextLength(ME_TextEditor *editor)
return ME_CharOfsFromRunOfs(editor, ME_FindItemBack(editor->pBuffer->pLast, diRun), 0);
}
int ME_GetTextLengthEx(ME_TextEditor *editor, GETTEXTLENGTHEX *how)
{
int length;
if (how->flags & GTL_PRECISE && how->flags & GTL_CLOSE)
return E_INVALIDARG;
if (how->flags & GTL_NUMCHARS && how->flags & GTL_NUMBYTES)
return E_INVALIDARG;
length = ME_GetTextLength(editor);
if (how->flags & GTL_USECRLF)
length += editor->nParagraphs;
if (how->flags & GTL_NUMBYTES)
{
CPINFO cpinfo;
if (how->codepage == 1200)
return length * 2;
if (how->flags & GTL_PRECISE)
FIXME("GTL_PRECISE flag unsupported. Using GTL_CLOSE\n");
if (GetCPInfo(how->codepage, &cpinfo))
return length * cpinfo.MaxCharSize;
ERR("Invalid codepage %u\n", how->codepage);
return E_INVALIDARG;
}
return length;
}
void ME_SetSelection(ME_TextEditor *editor, int from, int to)
{
if (from == 0 && to == -1)

View File

@ -65,7 +65,7 @@
- EM_GETSCROLLPOS 3.0
! - EM_GETTHUMB
- EM_GETTEXTEX 2.0
- EM_GETTEXTLENGTHEX
+ EM_GETTEXTLENGTHEX (GTL_PRECISE unimplemented)
- EM_GETTEXTMODE 2.0
? + EM_GETTEXTRANGE (ANSI&Unicode)
- EM_GETTYPOGRAPHYOPTIONS 3.0
@ -846,7 +846,6 @@ LRESULT WINAPI RichEditANSIWndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lP
UNSUPPORTED_MSG(EM_GETREDONAME)
UNSUPPORTED_MSG(EM_GETSCROLLPOS)
UNSUPPORTED_MSG(EM_GETTEXTEX)
UNSUPPORTED_MSG(EM_GETTEXTLENGTHEX)
UNSUPPORTED_MSG(EM_GETTEXTMODE)
UNSUPPORTED_MSG(EM_GETTYPOGRAPHYOPTIONS)
UNSUPPORTED_MSG(EM_GETUNDONAME)
@ -1175,6 +1174,8 @@ LRESULT WINAPI RichEditANSIWndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lP
}
case WM_GETTEXTLENGTH:
return ME_GetTextLength(editor);
case EM_GETTEXTLENGTHEX:
return ME_GetTextLengthEx(editor, (GETTEXTLENGTHEX *)wParam);
case WM_GETTEXT:
{
TEXTRANGEW tr; /* W and A differ only by rng->lpstrText */

View File

@ -160,6 +160,7 @@ void ME_SendSelChange(ME_TextEditor *editor);
void ME_InsertGraphicsFromCursor(ME_TextEditor *editor, int nCursor);
void ME_InternalDeleteText(ME_TextEditor *editor, int nOfs, int nChars);
int ME_GetTextLength(ME_TextEditor *editor);
int ME_GetTextLengthEx(ME_TextEditor *editor, GETTEXTLENGTHEX *how);
ME_Style *ME_GetSelectionInsertStyle(ME_TextEditor *editor);
BOOL ME_UpdateSelection(ME_TextEditor *editor, ME_Cursor *pTempCursor);