[RICHED20]

* Sync to Wine 1.3.37.

svn path=/trunk/; revision=55303
This commit is contained in:
Amine Khaldi 2012-01-29 23:23:23 +00:00
parent ed317865e3
commit 4d623fd547
19 changed files with 778 additions and 1056 deletions

View file

@ -579,10 +579,8 @@ void ME_InsertTextFromCursor(ME_TextEditor *editor, int nCursor,
}
p = &editor->pCursors[nCursor];
if (p->nOffset) {
ME_SplitRunSimple(editor, p->pRun, p->nOffset);
p = &editor->pCursors[nCursor];
}
if (p->nOffset)
ME_SplitRunSimple(editor, p);
tmp_style = ME_GetInsertStyle(editor, nCursor);
/* ME_SplitParagraph increases style refcount */
tp = ME_SplitParagraph(editor, p->pRun, p->pRun->member.run.style, eol_str, 0);
@ -1201,7 +1199,6 @@ static ME_DisplayItem *ME_FindRunInRow(ME_TextEditor *editor, ME_DisplayItem *pR
ME_DisplayItem *pNext, *pLastRun;
pNext = ME_FindItemFwd(pRow, diRunOrStartRow);
assert(pNext->type == diRun);
pLastRun = pNext;
if (pbCaretAtEnd) *pbCaretAtEnd = FALSE;
if (pOffset) *pOffset = 0;
do {

View file

@ -25,7 +25,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(richedit);
static UINT cfRTF = 0;
typedef struct DataObjectImpl {
const IDataObjectVtbl *lpVtbl;
IDataObject IDataObject_iface;
LONG ref;
FORMATETC *fmtetc;
@ -36,7 +36,7 @@ typedef struct DataObjectImpl {
} DataObjectImpl;
typedef struct EnumFormatImpl {
const IEnumFORMATETCVtbl *lpVtbl;
IEnumFORMATETC IEnumFORMATETC_iface;
LONG ref;
FORMATETC *fmtetc;
@ -47,9 +47,19 @@ typedef struct EnumFormatImpl {
static HRESULT EnumFormatImpl_Create(const FORMATETC *fmtetc, UINT size, LPENUMFORMATETC *lplpformatetc);
static inline DataObjectImpl *impl_from_IDataObject(IDataObject *iface)
{
return CONTAINING_RECORD(iface, DataObjectImpl, IDataObject_iface);
}
static inline EnumFormatImpl *impl_from_IEnumFORMATETC(IEnumFORMATETC *iface)
{
return CONTAINING_RECORD(iface, EnumFormatImpl, IEnumFORMATETC_iface);
}
static HRESULT WINAPI EnumFormatImpl_QueryInterface(IEnumFORMATETC *iface, REFIID riid, LPVOID *ppvObj)
{
EnumFormatImpl *This = (EnumFormatImpl*)iface;
EnumFormatImpl *This = impl_from_IEnumFORMATETC(iface);
TRACE("%p %s\n", This, debugstr_guid(riid));
if (IsEqualGUID(riid, &IID_IUnknown) || IsEqualGUID(riid, &IID_IEnumFORMATETC)) {
@ -63,7 +73,7 @@ static HRESULT WINAPI EnumFormatImpl_QueryInterface(IEnumFORMATETC *iface, REFII
static ULONG WINAPI EnumFormatImpl_AddRef(IEnumFORMATETC *iface)
{
EnumFormatImpl *This = (EnumFormatImpl*)iface;
EnumFormatImpl *This = impl_from_IEnumFORMATETC(iface);
LONG ref = InterlockedIncrement(&This->ref);
TRACE("(%p) ref=%d\n", This, ref);
return ref;
@ -71,7 +81,7 @@ static ULONG WINAPI EnumFormatImpl_AddRef(IEnumFORMATETC *iface)
static ULONG WINAPI EnumFormatImpl_Release(IEnumFORMATETC *iface)
{
EnumFormatImpl *This = (EnumFormatImpl*)iface;
EnumFormatImpl *This = impl_from_IEnumFORMATETC(iface);
ULONG ref = InterlockedDecrement(&This->ref);
TRACE("(%p) ref=%d\n", This, ref);
@ -86,7 +96,7 @@ static ULONG WINAPI EnumFormatImpl_Release(IEnumFORMATETC *iface)
static HRESULT WINAPI EnumFormatImpl_Next(IEnumFORMATETC *iface, ULONG celt,
FORMATETC *rgelt, ULONG *pceltFetched)
{
EnumFormatImpl *This = (EnumFormatImpl*)iface;
EnumFormatImpl *This = impl_from_IEnumFORMATETC(iface);
ULONG count = 0;
TRACE("(%p)->(%d %p %p)\n", This, celt, rgelt, pceltFetched);
@ -105,7 +115,7 @@ static HRESULT WINAPI EnumFormatImpl_Next(IEnumFORMATETC *iface, ULONG celt,
static HRESULT WINAPI EnumFormatImpl_Skip(IEnumFORMATETC *iface, ULONG celt)
{
EnumFormatImpl *This = (EnumFormatImpl*)iface;
EnumFormatImpl *This = impl_from_IEnumFORMATETC(iface);
ULONG count = 0;
TRACE("(%p)->(%d)\n", This, celt);
@ -116,7 +126,7 @@ static HRESULT WINAPI EnumFormatImpl_Skip(IEnumFORMATETC *iface, ULONG celt)
static HRESULT WINAPI EnumFormatImpl_Reset(IEnumFORMATETC *iface)
{
EnumFormatImpl *This = (EnumFormatImpl*)iface;
EnumFormatImpl *This = impl_from_IEnumFORMATETC(iface);
TRACE("(%p)\n", This);
This->cur = 0;
@ -125,7 +135,7 @@ static HRESULT WINAPI EnumFormatImpl_Reset(IEnumFORMATETC *iface)
static HRESULT WINAPI EnumFormatImpl_Clone(IEnumFORMATETC *iface, IEnumFORMATETC **ppenum)
{
EnumFormatImpl *This = (EnumFormatImpl*)iface;
EnumFormatImpl *This = impl_from_IEnumFORMATETC(iface);
HRESULT hr;
TRACE("(%p)->(%p)\n", This, ppenum);
@ -153,7 +163,7 @@ static HRESULT EnumFormatImpl_Create(const FORMATETC *fmtetc, UINT fmtetc_cnt, I
TRACE("\n");
ret = heap_alloc(sizeof(EnumFormatImpl));
ret->lpVtbl = &VT_EnumFormatImpl;
ret->IEnumFORMATETC_iface.lpVtbl = &VT_EnumFormatImpl;
ret->ref = 1;
ret->cur = 0;
ret->fmtetc_cnt = fmtetc_cnt;
@ -165,7 +175,7 @@ static HRESULT EnumFormatImpl_Create(const FORMATETC *fmtetc, UINT fmtetc_cnt, I
static HRESULT WINAPI DataObjectImpl_QueryInterface(IDataObject *iface, REFIID riid, LPVOID *ppvObj)
{
DataObjectImpl *This = (DataObjectImpl*)iface;
DataObjectImpl *This = impl_from_IDataObject(iface);
TRACE("(%p)->(%s)\n", This, debugstr_guid(riid));
if (IsEqualGUID(riid, &IID_IUnknown) || IsEqualGUID(riid, &IID_IDataObject)) {
@ -179,7 +189,7 @@ static HRESULT WINAPI DataObjectImpl_QueryInterface(IDataObject *iface, REFIID r
static ULONG WINAPI DataObjectImpl_AddRef(IDataObject* iface)
{
DataObjectImpl *This = (DataObjectImpl*)iface;
DataObjectImpl *This = impl_from_IDataObject(iface);
ULONG ref = InterlockedIncrement(&This->ref);
TRACE("(%p) ref=%d\n", This, ref);
return ref;
@ -187,7 +197,7 @@ static ULONG WINAPI DataObjectImpl_AddRef(IDataObject* iface)
static ULONG WINAPI DataObjectImpl_Release(IDataObject* iface)
{
DataObjectImpl *This = (DataObjectImpl*)iface;
DataObjectImpl *This = impl_from_IDataObject(iface);
ULONG ref = InterlockedDecrement(&This->ref);
TRACE("(%p) ref=%d\n",This, ref);
@ -203,7 +213,7 @@ static ULONG WINAPI DataObjectImpl_Release(IDataObject* iface)
static HRESULT WINAPI DataObjectImpl_GetData(IDataObject* iface, FORMATETC *pformatetc, STGMEDIUM *pmedium)
{
DataObjectImpl *This = (DataObjectImpl*)iface;
DataObjectImpl *This = impl_from_IDataObject(iface);
TRACE("(%p)->(fmt=0x%08x tym=0x%08x)\n", This, pformatetc->cfFormat, pformatetc->tymed);
if(pformatetc->lindex != -1)
@ -227,14 +237,14 @@ static HRESULT WINAPI DataObjectImpl_GetData(IDataObject* iface, FORMATETC *pfor
static HRESULT WINAPI DataObjectImpl_GetDataHere(IDataObject* iface, FORMATETC *pformatetc, STGMEDIUM *pmedium)
{
DataObjectImpl *This = (DataObjectImpl*)iface;
DataObjectImpl *This = impl_from_IDataObject(iface);
FIXME("(%p): stub\n", This);
return E_NOTIMPL;
}
static HRESULT WINAPI DataObjectImpl_QueryGetData(IDataObject* iface, FORMATETC *pformatetc)
{
DataObjectImpl *This = (DataObjectImpl*)iface;
DataObjectImpl *This = impl_from_IDataObject(iface);
UINT i;
BOOL foundFormat = FALSE;
TRACE("(%p)->(fmt=0x%08x tym=0x%08x)\n", This, pformatetc->cfFormat, pformatetc->tymed);
@ -255,7 +265,7 @@ static HRESULT WINAPI DataObjectImpl_QueryGetData(IDataObject* iface, FORMATETC
static HRESULT WINAPI DataObjectImpl_GetCanonicalFormatEtc(IDataObject* iface, FORMATETC *pformatetcIn,
FORMATETC *pformatetcOut)
{
DataObjectImpl *This = (DataObjectImpl*)iface;
DataObjectImpl *This = impl_from_IDataObject(iface);
TRACE("(%p)->(%p,%p)\n", This, pformatetcIn, pformatetcOut);
if(pformatetcOut) {
@ -268,7 +278,7 @@ static HRESULT WINAPI DataObjectImpl_GetCanonicalFormatEtc(IDataObject* iface, F
static HRESULT WINAPI DataObjectImpl_SetData(IDataObject* iface, FORMATETC *pformatetc,
STGMEDIUM *pmedium, BOOL fRelease)
{
DataObjectImpl *This = (DataObjectImpl*)iface;
DataObjectImpl *This = impl_from_IDataObject(iface);
FIXME("(%p): stub\n", This);
return E_NOTIMPL;
}
@ -276,7 +286,7 @@ static HRESULT WINAPI DataObjectImpl_SetData(IDataObject* iface, FORMATETC *pfor
static HRESULT WINAPI DataObjectImpl_EnumFormatEtc(IDataObject* iface, DWORD dwDirection,
IEnumFORMATETC **ppenumFormatEtc)
{
DataObjectImpl *This = (DataObjectImpl*)iface;
DataObjectImpl *This = impl_from_IDataObject(iface);
TRACE("(%p)->(%d)\n", This, dwDirection);
if(dwDirection != DATADIR_GET) {
@ -291,21 +301,21 @@ static HRESULT WINAPI DataObjectImpl_EnumFormatEtc(IDataObject* iface, DWORD dwD
static HRESULT WINAPI DataObjectImpl_DAdvise(IDataObject* iface, FORMATETC *pformatetc, DWORD advf,
IAdviseSink *pAdvSink, DWORD *pdwConnection)
{
DataObjectImpl *This = (DataObjectImpl*)iface;
DataObjectImpl *This = impl_from_IDataObject(iface);
FIXME("(%p): stub\n", This);
return E_NOTIMPL;
}
static HRESULT WINAPI DataObjectImpl_DUnadvise(IDataObject* iface, DWORD dwConnection)
{
DataObjectImpl *This = (DataObjectImpl*)iface;
DataObjectImpl *This = impl_from_IDataObject(iface);
FIXME("(%p): stub\n", This);
return E_NOTIMPL;
}
static HRESULT WINAPI DataObjectImpl_EnumDAdvise(IDataObject* iface, IEnumSTATDATA **ppenumAdvise)
{
DataObjectImpl *This = (DataObjectImpl*)iface;
DataObjectImpl *This = impl_from_IDataObject(iface);
FIXME("(%p): stub\n", This);
return E_NOTIMPL;
}
@ -399,7 +409,7 @@ HRESULT ME_GetDataObject(ME_TextEditor *editor, const ME_Cursor *start,
if(cfRTF == 0)
cfRTF = RegisterClipboardFormatA("Rich Text Format");
obj->lpVtbl = &VT_DataObjectImpl;
obj->IDataObject_iface.lpVtbl = &VT_DataObjectImpl;
obj->ref = 1;
obj->unicode = get_unicode_text(editor, start, nChars);
obj->rtf = NULL;

View file

@ -285,9 +285,10 @@ static LRESULT ME_StreamInText(ME_TextEditor *editor, DWORD dwFormat, ME_InStrea
{
WCHAR wszText[STREAMIN_BUFFER_SIZE+1];
WCHAR *pText;
LRESULT total_bytes_read = 0;
TRACE("%08x %p\n", dwFormat, stream);
do {
LONG nWideChars = 0;
@ -298,8 +299,9 @@ static LRESULT ME_StreamInText(ME_TextEditor *editor, DWORD dwFormat, ME_InStrea
break;
if (!stream->dwSize)
break;
total_bytes_read += stream->dwSize;
}
if (!(dwFormat & SF_UNICODE))
{
/* FIXME? this is doomed to fail on true MBCS like UTF-8, luckily they're unlikely to be used as CP_ACP */
@ -311,15 +313,13 @@ static LRESULT ME_StreamInText(ME_TextEditor *editor, DWORD dwFormat, ME_InStrea
nWideChars = stream->dwSize >> 1;
pText = (WCHAR *)stream->buffer;
}
ME_InsertTextFromCursor(editor, 0, pText, nWideChars, style);
if (stream->dwSize == 0)
break;
stream->dwSize = 0;
} while(1);
ME_CommitUndo(editor);
ME_UpdateRepaint(editor);
return 0;
return total_bytes_read;
}
static void ME_ApplyBorderProperties(RTF_Info *info,
@ -666,6 +666,7 @@ void ME_RTFParAttrHook(RTF_Info *info)
fmt.dyLineSpacing = info->rtfParam;
fmt.bLineSpacingRule = 4;
}
break;
case rtfSpaceMultiply:
fmt.dwMask = PFM_LINESPACING;
fmt.dyLineSpacing = info->rtfParam * 20;
@ -1391,6 +1392,7 @@ static LRESULT ME_StreamIn(ME_TextEditor *editor, DWORD format, EDITSTREAM *stre
ME_InStream inStream;
BOOL invalidRTF = FALSE;
ME_Cursor *selStart, *selEnd;
LRESULT num_read = 0; /* bytes read for SF_TEXT, non-control chars inserted for SF_RTF */
TRACE("stream==%p editor==%p format==0x%X\n", stream, editor, format);
editor->nEventMask = 0;
@ -1468,6 +1470,8 @@ static LRESULT ME_StreamIn(ME_TextEditor *editor, DWORD format, EDITSTREAM *stre
if (!invalidRTF && !inStream.editstream->dwError)
{
if (format & SF_RTF) {
from = ME_GetCursorOfs(&editor->pCursors[0]);
/* setup the RTF parser */
memset(&parser, 0, sizeof parser);
RTFSetEditStream(&parser, &inStream);
@ -1561,11 +1565,13 @@ static LRESULT ME_StreamIn(ME_TextEditor *editor, DWORD format, EDITSTREAM *stre
}
}
}
to = ME_GetCursorOfs(&editor->pCursors[0]);
num_read = to - from;
style = parser.style;
}
else if (format & SF_TEXT)
ME_StreamInText(editor, format, &inStream, style);
num_read = ME_StreamInText(editor, format, &inStream, style);
else
ERR("EM_STREAMIN without SF_TEXT or SF_RTF\n");
/* put the cursor at the top */
@ -1585,7 +1591,7 @@ static LRESULT ME_StreamIn(ME_TextEditor *editor, DWORD format, EDITSTREAM *stre
ME_ReleaseStyle(style);
editor->nEventMask = nEventMask;
ME_UpdateRepaint(editor);
ME_UpdateRepaint(editor, FALSE);
if (!(format & SFF_SELECTION)) {
ME_ClearTempStyle(editor);
}
@ -1595,7 +1601,7 @@ static LRESULT ME_StreamIn(ME_TextEditor *editor, DWORD format, EDITSTREAM *stre
ME_SendSelChange(editor);
ME_SendRequestResize(editor, FALSE);
return 0;
return num_read;
}
@ -2139,7 +2145,7 @@ ME_KeyDown(ME_TextEditor *editor, WORD nKey)
return TRUE;
ME_MoveCursorFromTableRowStartParagraph(editor);
ME_UpdateSelectionLinkAttribute(editor);
ME_UpdateRepaint(editor);
ME_UpdateRepaint(editor, FALSE);
ME_SendRequestResize(editor, FALSE);
return TRUE;
case VK_RETURN:
@ -2195,7 +2201,7 @@ ME_KeyDown(ME_TextEditor *editor, WORD nKey)
editor->pCursors[1] = editor->pCursors[0];
ME_CommitUndo(editor);
ME_CheckTablesForCorruption(editor);
ME_UpdateRepaint(editor);
ME_UpdateRepaint(editor, FALSE);
return TRUE;
}
else if (para == editor->pCursors[1].pPara &&
@ -2220,7 +2226,7 @@ ME_KeyDown(ME_TextEditor *editor, WORD nKey)
para->member.para.next_para->member.para.nFlags |= MEPF_ROWSTART;
ME_CommitCoalescingUndo(editor);
ME_CheckTablesForCorruption(editor);
ME_UpdateRepaint(editor);
ME_UpdateRepaint(editor, FALSE);
return TRUE;
}
} else { /* v1.0 - 3.0 */
@ -2237,7 +2243,7 @@ ME_KeyDown(ME_TextEditor *editor, WORD nKey)
editor->pCursors[0].nOffset = 0;
editor->pCursors[1] = editor->pCursors[0];
ME_CommitCoalescingUndo(editor);
ME_UpdateRepaint(editor);
ME_UpdateRepaint(editor, FALSE);
return TRUE;
}
} else {
@ -2264,7 +2270,7 @@ ME_KeyDown(ME_TextEditor *editor, WORD nKey)
editor->pCursors[1] = editor->pCursors[0];
}
ME_CommitCoalescingUndo(editor);
ME_UpdateRepaint(editor);
ME_UpdateRepaint(editor, FALSE);
return TRUE;
}
}
@ -2282,7 +2288,7 @@ ME_KeyDown(ME_TextEditor *editor, WORD nKey)
SetCursor(NULL);
ME_UpdateSelectionLinkAttribute(editor);
ME_UpdateRepaint(editor);
ME_UpdateRepaint(editor, FALSE);
}
return TRUE;
}
@ -2321,7 +2327,7 @@ ME_KeyDown(ME_TextEditor *editor, WORD nKey)
{
ME_InternalDeleteText(editor, selStart, nChars, FALSE);
ME_CommitUndo(editor);
ME_UpdateRepaint(editor);
ME_UpdateRepaint(editor, TRUE);
}
return result;
}
@ -2451,7 +2457,7 @@ static LRESULT ME_Char(ME_TextEditor *editor, WPARAM charCode,
}
ME_UpdateSelectionLinkAttribute(editor);
ME_UpdateRepaint(editor);
ME_UpdateRepaint(editor, FALSE);
}
return 0;
}
@ -3301,7 +3307,7 @@ LRESULT ME_HandleMessage(ME_TextEditor *editor, UINT msg, WPARAM wParam,
editor->nModifyStep = oldModify;
ME_EmptyUndoStack(editor);
}
ME_UpdateRepaint(editor);
ME_UpdateRepaint(editor, FALSE);
return len;
}
case EM_SETBKGNDCOLOR:
@ -3361,26 +3367,27 @@ LRESULT ME_HandleMessage(ME_TextEditor *editor, UINT msg, WPARAM wParam,
BOOL bRepaint = TRUE;
p = ME_ToCF2W(&buf, (CHARFORMAT2W *)lParam);
if (p == NULL) return 0;
if (!wParam)
ME_SetDefaultCharFormat(editor, p);
else if (wParam == (SCF_WORD | SCF_SELECTION)) {
FIXME("EM_SETCHARFORMAT: word selection not supported\n");
return 0;
} else if (wParam == SCF_ALL) {
if (editor->mode & TM_PLAINTEXT)
if (wParam & SCF_ALL) {
if (editor->mode & TM_PLAINTEXT) {
ME_SetDefaultCharFormat(editor, p);
else {
} else {
ME_Cursor start;
ME_SetCursorToStart(editor, &start);
ME_SetCharFormat(editor, &start, NULL, p);
editor->nModifyStep = 1;
}
} else if (editor->mode & TM_PLAINTEXT) {
return 0;
} else {
} else if (wParam & SCF_SELECTION) {
if (editor->mode & TM_PLAINTEXT)
return 0;
if (wParam & SCF_WORD) {
FIXME("EM_SETCHARFORMAT: word selection not supported\n");
return 0;
}
bRepaint = ME_IsSelection(editor);
ME_SetSelectionCharFormat(editor, p);
if (bRepaint) editor->nModifyStep = 1;
} else { /* SCF_DEFAULT */
ME_SetDefaultCharFormat(editor, p);
}
ME_CommitUndo(editor);
if (bRepaint)
@ -3462,7 +3469,7 @@ LRESULT ME_HandleMessage(ME_TextEditor *editor, UINT msg, WPARAM wParam,
int nStartCursor = ME_GetSelectionOfs(editor, &from, &to);
ME_InternalDeleteText(editor, &editor->pCursors[nStartCursor], to-from, FALSE);
ME_CommitUndo(editor);
ME_UpdateRepaint(editor);
ME_UpdateRepaint(editor, TRUE);
return 0;
}
case EM_REPLACESEL:
@ -3490,7 +3497,7 @@ LRESULT ME_HandleMessage(ME_TextEditor *editor, UINT msg, WPARAM wParam,
ME_UpdateSelectionLinkAttribute(editor);
if (!wParam)
ME_EmptyUndoStack(editor);
ME_UpdateRepaint(editor);
ME_UpdateRepaint(editor, FALSE);
return len;
}
case EM_SCROLLCARET:
@ -3568,7 +3575,7 @@ LRESULT ME_HandleMessage(ME_TextEditor *editor, UINT msg, WPARAM wParam,
editor->nModifyStep = 0;
ME_CommitUndo(editor);
ME_EmptyUndoStack(editor);
ME_UpdateRepaint(editor);
ME_UpdateRepaint(editor, FALSE);
return 1;
}
case EM_CANPASTE:
@ -3594,7 +3601,7 @@ LRESULT ME_HandleMessage(ME_TextEditor *editor, UINT msg, WPARAM wParam,
{
ME_InternalDeleteText(editor, selStart, nChars, FALSE);
ME_CommitUndo(editor);
ME_UpdateRepaint(editor);
ME_UpdateRepaint(editor, TRUE);
}
return 0;
}
@ -4248,7 +4255,7 @@ LRESULT ME_HandleMessage(ME_TextEditor *editor, UINT msg, WPARAM wParam,
editor->imeStartIndex=ME_GetCursorOfs(&editor->pCursors[0]);
ME_DeleteSelection(editor);
ME_CommitUndo(editor);
ME_UpdateRepaint(editor);
ME_UpdateRepaint(editor, FALSE);
return 0;
}
case WM_IME_COMPOSITION:
@ -4280,7 +4287,7 @@ LRESULT ME_HandleMessage(ME_TextEditor *editor, UINT msg, WPARAM wParam,
}
ME_ReleaseStyle(style);
ME_CommitUndo(editor);
ME_UpdateRepaint(editor);
ME_UpdateRepaint(editor, FALSE);
return 0;
}
case WM_IME_ENDCOMPOSITION:
@ -4318,35 +4325,37 @@ LRESULT ME_HandleMessage(ME_TextEditor *editor, UINT msg, WPARAM wParam,
return editor->mode;
case EM_SETTEXTMODE:
{
LRESULT ret;
int mask = 0;
int changes = 0;
GETTEXTLENGTHEX how;
/* CR/LF conversion required in 2.0 mode, verbatim in 1.0 mode */
how.flags = GTL_CLOSE | (editor->bEmulateVersion10 ? 0 : GTL_USECRLF) | GTL_NUMCHARS;
how.codepage = unicode ? 1200 : CP_ACP;
ret = ME_GetTextLengthEx(editor, &how);
if (!ret)
if (ME_GetTextLength(editor) || editor->pUndoStack || editor->pRedoStack)
return E_UNEXPECTED;
/* Check for mutually exclusive flags in adjacent bits of wParam */
if ((wParam & (TM_RICHTEXT | TM_MULTILEVELUNDO | TM_MULTICODEPAGE)) &
(wParam & (TM_PLAINTEXT | TM_SINGLELEVELUNDO | TM_SINGLECODEPAGE)) << 1)
return E_INVALIDARG;
if (wParam & (TM_RICHTEXT | TM_PLAINTEXT))
{
/*Check for valid wParam*/
if ((((wParam & TM_RICHTEXT) && ((wParam & TM_PLAINTEXT) << 1))) ||
(((wParam & TM_MULTILEVELUNDO) && ((wParam & TM_SINGLELEVELUNDO) << 1))) ||
(((wParam & TM_MULTICODEPAGE) && ((wParam & TM_SINGLECODEPAGE) << 1))))
return 1;
else
{
if (wParam & (TM_RICHTEXT | TM_PLAINTEXT))
{
mask |= (TM_RICHTEXT | TM_PLAINTEXT);
changes |= (wParam & (TM_RICHTEXT | TM_PLAINTEXT));
}
/*FIXME: Currently no support for undo level and code page options*/
editor->mode = (editor->mode & (~mask)) | changes;
return 0;
mask |= TM_RICHTEXT | TM_PLAINTEXT;
changes |= wParam & (TM_RICHTEXT | TM_PLAINTEXT);
if (wParam & TM_PLAINTEXT) {
/* Clear selection since it should be possible to select the
* end of text run for rich text */
ME_InvalidateSelection(editor);
ME_SetCursorToStart(editor, &editor->pCursors[0]);
editor->pCursors[1] = editor->pCursors[0];
/* plain text can only have the default style. */
ME_ClearTempStyle(editor);
ME_AddRefStyle(editor->pBuffer->pDefaultStyle);
ME_ReleaseStyle(editor->pCursors[0].pRun->member.run.style);
editor->pCursors[0].pRun->member.run.style = editor->pBuffer->pDefaultStyle;
}
}
return ret;
/* FIXME: Currently no support for undo level and code page options */
editor->mode = (editor->mode & ~mask) | changes;
return 0;
}
case EM_SETPASSWORDCHAR:
{
@ -4421,6 +4430,8 @@ static LRESULT RichEditWndProc_common(HWND hWnd, UINT msg, WPARAM wParam,
PAINTSTRUCT ps;
hDC = BeginPaint(editor->hWnd, &ps);
if (!editor->bEmulateVersion10 || (editor->nEventMask & ENM_UPDATE))
ME_SendOldNotify(editor, EN_UPDATE);
/* Erase area outside of the formatting rectangle */
if (ps.rcPaint.top < editor->rcFormat.top)
{

View file

@ -23,7 +23,7 @@
struct _RTF_Info;
extern HANDLE me_heap;
extern HANDLE me_heap DECLSPEC_HIDDEN;
static inline void * __WINE_ALLOC_SIZE(1) heap_alloc( size_t len )
{
@ -57,51 +57,51 @@ static inline void * __WINE_ALLOC_SIZE(2) heap_realloc( void *ptr, size_t len )
};
/* style.c */
ME_Style *ME_MakeStyle(CHARFORMAT2W *style);
void ME_AddRefStyle(ME_Style *item);
void ME_ReleaseStyle(ME_Style *item);
ME_Style *ME_GetInsertStyle(ME_TextEditor *editor, int nCursor);
ME_Style *ME_ApplyStyle(ME_Style *sSrc, CHARFORMAT2W *style);
HFONT ME_SelectStyleFont(ME_Context *c, ME_Style *s);
void ME_UnselectStyleFont(ME_Context *c, ME_Style *s, HFONT hOldFont);
void ME_InitCharFormat2W(CHARFORMAT2W *pFmt);
void ME_SaveTempStyle(ME_TextEditor *editor);
void ME_ClearTempStyle(ME_TextEditor *editor);
void ME_DumpStyleToBuf(CHARFORMAT2W *pFmt, char buf[2048]);
void ME_DumpStyle(ME_Style *s);
CHARFORMAT2W *ME_ToCF2W(CHARFORMAT2W *to, CHARFORMAT2W *from);
void ME_CopyToCFAny(CHARFORMAT2W *to, CHARFORMAT2W *from);
void ME_CopyCharFormat(CHARFORMAT2W *pDest, const CHARFORMAT2W *pSrc); /* only works with 2W structs */
void ME_CharFormatFromLogFont(HDC hDC, const LOGFONTW *lf, CHARFORMAT2W *fmt); /* ditto */
ME_Style *ME_MakeStyle(CHARFORMAT2W *style) DECLSPEC_HIDDEN;
void ME_AddRefStyle(ME_Style *item) DECLSPEC_HIDDEN;
void ME_ReleaseStyle(ME_Style *item) DECLSPEC_HIDDEN;
ME_Style *ME_GetInsertStyle(ME_TextEditor *editor, int nCursor) DECLSPEC_HIDDEN;
ME_Style *ME_ApplyStyle(ME_Style *sSrc, CHARFORMAT2W *style) DECLSPEC_HIDDEN;
HFONT ME_SelectStyleFont(ME_Context *c, ME_Style *s) DECLSPEC_HIDDEN;
void ME_UnselectStyleFont(ME_Context *c, ME_Style *s, HFONT hOldFont) DECLSPEC_HIDDEN;
void ME_InitCharFormat2W(CHARFORMAT2W *pFmt) DECLSPEC_HIDDEN;
void ME_SaveTempStyle(ME_TextEditor *editor) DECLSPEC_HIDDEN;
void ME_ClearTempStyle(ME_TextEditor *editor) DECLSPEC_HIDDEN;
void ME_DumpStyleToBuf(CHARFORMAT2W *pFmt, char buf[2048]) DECLSPEC_HIDDEN;
void ME_DumpStyle(ME_Style *s) DECLSPEC_HIDDEN;
CHARFORMAT2W *ME_ToCF2W(CHARFORMAT2W *to, CHARFORMAT2W *from) DECLSPEC_HIDDEN;
void ME_CopyToCFAny(CHARFORMAT2W *to, CHARFORMAT2W *from) DECLSPEC_HIDDEN;
void ME_CopyCharFormat(CHARFORMAT2W *pDest, const CHARFORMAT2W *pSrc) DECLSPEC_HIDDEN; /* only works with 2W structs */
void ME_CharFormatFromLogFont(HDC hDC, const LOGFONTW *lf, CHARFORMAT2W *fmt) DECLSPEC_HIDDEN; /* ditto */
/* list.c */
void ME_InsertBefore(ME_DisplayItem *diWhere, ME_DisplayItem *diWhat);
void ME_Remove(ME_DisplayItem *diWhere);
BOOL ME_NextRun(ME_DisplayItem **para, ME_DisplayItem **run);
BOOL ME_PrevRun(ME_DisplayItem **para, ME_DisplayItem **run);
ME_DisplayItem *ME_FindItemBack(ME_DisplayItem *di, ME_DIType nTypeOrClass);
ME_DisplayItem *ME_FindItemFwd(ME_DisplayItem *di, ME_DIType nTypeOrClass);
ME_DisplayItem *ME_FindItemBackOrHere(ME_DisplayItem *di, ME_DIType nTypeOrClass);
ME_DisplayItem *ME_MakeDI(ME_DIType type);
void ME_DestroyDisplayItem(ME_DisplayItem *item);
void ME_DumpDocument(ME_TextBuffer *buffer);
const char *ME_GetDITypeName(ME_DIType type);
void ME_InsertBefore(ME_DisplayItem *diWhere, ME_DisplayItem *diWhat) DECLSPEC_HIDDEN;
void ME_Remove(ME_DisplayItem *diWhere) DECLSPEC_HIDDEN;
BOOL ME_NextRun(ME_DisplayItem **para, ME_DisplayItem **run) DECLSPEC_HIDDEN;
BOOL ME_PrevRun(ME_DisplayItem **para, ME_DisplayItem **run) DECLSPEC_HIDDEN;
ME_DisplayItem *ME_FindItemBack(ME_DisplayItem *di, ME_DIType nTypeOrClass) DECLSPEC_HIDDEN;
ME_DisplayItem *ME_FindItemFwd(ME_DisplayItem *di, ME_DIType nTypeOrClass) DECLSPEC_HIDDEN;
ME_DisplayItem *ME_FindItemBackOrHere(ME_DisplayItem *di, ME_DIType nTypeOrClass) DECLSPEC_HIDDEN;
ME_DisplayItem *ME_MakeDI(ME_DIType type) DECLSPEC_HIDDEN;
void ME_DestroyDisplayItem(ME_DisplayItem *item) DECLSPEC_HIDDEN;
void ME_DumpDocument(ME_TextBuffer *buffer) DECLSPEC_HIDDEN;
const char *ME_GetDITypeName(ME_DIType type) DECLSPEC_HIDDEN;
/* string.c */
ME_String *ME_MakeStringN(LPCWSTR szText, int nMaxChars);
ME_String *ME_MakeStringR(WCHAR cRepeat, int nMaxChars);
ME_String *ME_StrDup(const ME_String *s);
void ME_DestroyString(ME_String *s);
void ME_AppendString(ME_String *s1, const ME_String *s2);
ME_String *ME_VSplitString(ME_String *orig, int nVPos);
int ME_IsWhitespaces(const ME_String *s);
int ME_IsSplitable(const ME_String *s);
int ME_FindNonWhitespaceV(const ME_String *s, int nVChar);
int ME_CallWordBreakProc(ME_TextEditor *editor, ME_String *str, INT start, INT code);
void ME_StrDeleteV(ME_String *s, int nVChar, int nChars);
ME_String *ME_MakeStringN(LPCWSTR szText, int nMaxChars) DECLSPEC_HIDDEN;
ME_String *ME_MakeStringR(WCHAR cRepeat, int nMaxChars) DECLSPEC_HIDDEN;
ME_String *ME_StrDup(const ME_String *s) DECLSPEC_HIDDEN;
void ME_DestroyString(ME_String *s) DECLSPEC_HIDDEN;
void ME_AppendString(ME_String *s1, const ME_String *s2) DECLSPEC_HIDDEN;
ME_String *ME_VSplitString(ME_String *orig, int nVPos) DECLSPEC_HIDDEN;
int ME_IsWhitespaces(const ME_String *s) DECLSPEC_HIDDEN;
int ME_IsSplitable(const ME_String *s) DECLSPEC_HIDDEN;
int ME_FindNonWhitespaceV(const ME_String *s, int nVChar) DECLSPEC_HIDDEN;
int ME_CallWordBreakProc(ME_TextEditor *editor, ME_String *str, INT start, INT code) DECLSPEC_HIDDEN;
void ME_StrDeleteV(ME_String *s, int nVChar, int nChars) DECLSPEC_HIDDEN;
/* smart helpers for A<->W conversions, they reserve/free memory and call MultiByte<->WideChar functions */
LPWSTR ME_ToUnicode(BOOL unicode, LPVOID psz);
void ME_EndToUnicode(BOOL unicode, LPVOID psz);
LPWSTR ME_ToUnicode(BOOL unicode, LPVOID psz) DECLSPEC_HIDDEN;
void ME_EndToUnicode(BOOL unicode, LPVOID psz) DECLSPEC_HIDDEN;
static inline int ME_IsWSpace(WCHAR ch)
{
@ -115,162 +115,162 @@ static inline int ME_CharCompare(WCHAR a, WCHAR b, int caseSensitive)
/* note: those two really return the first matching offset (starting from EOS)+1
* in other words, an offset of the first trailing white/black */
int ME_ReverseFindNonWhitespaceV(const ME_String *s, int nVChar);
int ME_ReverseFindWhitespaceV(const ME_String *s, int nVChar);
int ME_ReverseFindNonWhitespaceV(const ME_String *s, int nVChar) DECLSPEC_HIDDEN;
int ME_ReverseFindWhitespaceV(const ME_String *s, int nVChar) DECLSPEC_HIDDEN;
/* row.c */
ME_DisplayItem *ME_RowStart(ME_DisplayItem *item);
ME_DisplayItem *ME_RowStart(ME_DisplayItem *item) DECLSPEC_HIDDEN;
/* ME_DisplayItem *ME_RowEnd(ME_DisplayItem *item); */
ME_DisplayItem *ME_FindRowWithNumber(ME_TextEditor *editor, int nRow);
int ME_RowNumberFromCharOfs(ME_TextEditor *editor, int nOfs);
ME_DisplayItem *ME_FindRowWithNumber(ME_TextEditor *editor, int nRow) DECLSPEC_HIDDEN;
int ME_RowNumberFromCharOfs(ME_TextEditor *editor, int nOfs) DECLSPEC_HIDDEN;
/* run.c */
ME_DisplayItem *ME_MakeRun(ME_Style *s, ME_String *strData, int nFlags);
ME_DisplayItem *ME_MakeRun(ME_Style *s, ME_String *strData, int nFlags) DECLSPEC_HIDDEN;
ME_DisplayItem *ME_InsertRunAtCursor(ME_TextEditor *editor, ME_Cursor *cursor,
ME_Style *style, const WCHAR *str, int len, int flags);
void ME_CheckCharOffsets(ME_TextEditor *editor);
void ME_PropagateCharOffset(ME_DisplayItem *p, int shift);
int ME_CharFromPoint(ME_Context *c, int cx, ME_Run *run);
ME_Style *style, const WCHAR *str, int len, int flags) DECLSPEC_HIDDEN;
void ME_CheckCharOffsets(ME_TextEditor *editor) DECLSPEC_HIDDEN;
void ME_PropagateCharOffset(ME_DisplayItem *p, int shift) DECLSPEC_HIDDEN;
int ME_CharFromPoint(ME_Context *c, int cx, ME_Run *run) DECLSPEC_HIDDEN;
/* this one accounts for 1/2 char tolerance */
int ME_CharFromPointCursor(ME_TextEditor *editor, int cx, ME_Run *run);
int ME_PointFromChar(ME_TextEditor *editor, ME_Run *pRun, int nOffset);
int ME_CanJoinRuns(const ME_Run *run1, const ME_Run *run2);
void ME_JoinRuns(ME_TextEditor *editor, ME_DisplayItem *p);
ME_DisplayItem *ME_SplitRun(ME_WrapContext *wc, ME_DisplayItem *item, int nChar);
ME_DisplayItem *ME_SplitRunSimple(ME_TextEditor *editor, ME_DisplayItem *item, int nChar);
void ME_UpdateRunFlags(ME_TextEditor *editor, ME_Run *run);
void ME_CalcRunExtent(ME_Context *c, const ME_Paragraph *para, int startx, ME_Run *run);
SIZE ME_GetRunSize(ME_Context *c, const ME_Paragraph *para, ME_Run *run, int nLen, int startx);
void ME_CursorFromCharOfs(ME_TextEditor *editor, int nCharOfs, ME_Cursor *pCursor);
void ME_RunOfsFromCharOfs(ME_TextEditor *editor, int nCharOfs, ME_DisplayItem **ppPara, ME_DisplayItem **ppRun, int *pOfs);
int ME_CharOfsFromRunOfs(ME_TextEditor *editor, const ME_DisplayItem *pPara, const ME_DisplayItem *pRun, int nOfs);
void ME_SkipAndPropagateCharOffset(ME_DisplayItem *p, int shift);
void ME_SetCharFormat(ME_TextEditor *editor, ME_Cursor *start, ME_Cursor *end, CHARFORMAT2W *pFmt);
void ME_SetSelectionCharFormat(ME_TextEditor *editor, CHARFORMAT2W *pFmt);
int ME_CharFromPointCursor(ME_TextEditor *editor, int cx, ME_Run *run) DECLSPEC_HIDDEN;
int ME_PointFromChar(ME_TextEditor *editor, ME_Run *pRun, int nOffset) DECLSPEC_HIDDEN;
int ME_CanJoinRuns(const ME_Run *run1, const ME_Run *run2) DECLSPEC_HIDDEN;
void ME_JoinRuns(ME_TextEditor *editor, ME_DisplayItem *p) DECLSPEC_HIDDEN;
ME_DisplayItem *ME_SplitRun(ME_WrapContext *wc, ME_DisplayItem *item, int nChar) DECLSPEC_HIDDEN;
ME_DisplayItem *ME_SplitRunSimple(ME_TextEditor *editor, ME_Cursor *cursor) DECLSPEC_HIDDEN;
void ME_UpdateRunFlags(ME_TextEditor *editor, ME_Run *run) DECLSPEC_HIDDEN;
void ME_CalcRunExtent(ME_Context *c, const ME_Paragraph *para, int startx, ME_Run *run) DECLSPEC_HIDDEN;
SIZE ME_GetRunSize(ME_Context *c, const ME_Paragraph *para, ME_Run *run, int nLen, int startx) DECLSPEC_HIDDEN;
void ME_CursorFromCharOfs(ME_TextEditor *editor, int nCharOfs, ME_Cursor *pCursor) DECLSPEC_HIDDEN;
void ME_RunOfsFromCharOfs(ME_TextEditor *editor, int nCharOfs, ME_DisplayItem **ppPara, ME_DisplayItem **ppRun, int *pOfs) DECLSPEC_HIDDEN;
int ME_CharOfsFromRunOfs(ME_TextEditor *editor, const ME_DisplayItem *pPara, const ME_DisplayItem *pRun, int nOfs) DECLSPEC_HIDDEN;
void ME_SkipAndPropagateCharOffset(ME_DisplayItem *p, int shift) DECLSPEC_HIDDEN;
void ME_SetCharFormat(ME_TextEditor *editor, ME_Cursor *start, ME_Cursor *end, CHARFORMAT2W *pFmt) DECLSPEC_HIDDEN;
void ME_SetSelectionCharFormat(ME_TextEditor *editor, CHARFORMAT2W *pFmt) DECLSPEC_HIDDEN;
void ME_GetCharFormat(ME_TextEditor *editor, const ME_Cursor *from,
const ME_Cursor *to, CHARFORMAT2W *pFmt);
void ME_GetSelectionCharFormat(ME_TextEditor *editor, CHARFORMAT2W *pFmt);
void ME_GetDefaultCharFormat(ME_TextEditor *editor, CHARFORMAT2W *pFmt);
void ME_SetDefaultCharFormat(ME_TextEditor *editor, CHARFORMAT2W *mod);
const ME_Cursor *to, CHARFORMAT2W *pFmt) DECLSPEC_HIDDEN;
void ME_GetSelectionCharFormat(ME_TextEditor *editor, CHARFORMAT2W *pFmt) DECLSPEC_HIDDEN;
void ME_GetDefaultCharFormat(ME_TextEditor *editor, CHARFORMAT2W *pFmt) DECLSPEC_HIDDEN;
void ME_SetDefaultCharFormat(ME_TextEditor *editor, CHARFORMAT2W *mod) DECLSPEC_HIDDEN;
/* caret.c */
void ME_SetCursorToStart(ME_TextEditor *editor, ME_Cursor *cursor);
int ME_SetSelection(ME_TextEditor *editor, int from, int to);
void ME_HideCaret(ME_TextEditor *ed);
void ME_ShowCaret(ME_TextEditor *ed);
void ME_MoveCaret(ME_TextEditor *ed);
BOOL ME_CharFromPos(ME_TextEditor *editor, int x, int y, ME_Cursor *cursor, BOOL *isExact);
void ME_LButtonDown(ME_TextEditor *editor, int x, int y, int clickNum);
void ME_MouseMove(ME_TextEditor *editor, int x, int y);
BOOL ME_DeleteTextAtCursor(ME_TextEditor *editor, int nCursor, int nChars);
void ME_SetCursorToStart(ME_TextEditor *editor, ME_Cursor *cursor) DECLSPEC_HIDDEN;
int ME_SetSelection(ME_TextEditor *editor, int from, int to) DECLSPEC_HIDDEN;
void ME_HideCaret(ME_TextEditor *ed) DECLSPEC_HIDDEN;
void ME_ShowCaret(ME_TextEditor *ed) DECLSPEC_HIDDEN;
void ME_MoveCaret(ME_TextEditor *ed) DECLSPEC_HIDDEN;
BOOL ME_CharFromPos(ME_TextEditor *editor, int x, int y, ME_Cursor *cursor, BOOL *isExact) DECLSPEC_HIDDEN;
void ME_LButtonDown(ME_TextEditor *editor, int x, int y, int clickNum) DECLSPEC_HIDDEN;
void ME_MouseMove(ME_TextEditor *editor, int x, int y) DECLSPEC_HIDDEN;
BOOL ME_DeleteTextAtCursor(ME_TextEditor *editor, int nCursor, int nChars) DECLSPEC_HIDDEN;
void ME_InsertTextFromCursor(ME_TextEditor *editor, int nCursor,
const WCHAR *str, int len, ME_Style *style);
void ME_InsertEndRowFromCursor(ME_TextEditor *editor, int nCursor);
int ME_MoveCursorChars(ME_TextEditor *editor, ME_Cursor *cursor, int nRelOfs);
BOOL ME_ArrowKey(ME_TextEditor *ed, int nVKey, BOOL extend, BOOL ctrl);
const WCHAR *str, int len, ME_Style *style) DECLSPEC_HIDDEN;
void ME_InsertEndRowFromCursor(ME_TextEditor *editor, int nCursor) DECLSPEC_HIDDEN;
int ME_MoveCursorChars(ME_TextEditor *editor, ME_Cursor *cursor, int nRelOfs) DECLSPEC_HIDDEN;
BOOL ME_ArrowKey(ME_TextEditor *ed, int nVKey, BOOL extend, BOOL ctrl) DECLSPEC_HIDDEN;
int ME_GetCursorOfs(const ME_Cursor *cursor);
int ME_GetSelectionOfs(ME_TextEditor *editor, int *from, int *to);
int ME_GetSelection(ME_TextEditor *editor, ME_Cursor **from, ME_Cursor **to);
BOOL ME_IsSelection(ME_TextEditor *editor);
void ME_DeleteSelection(ME_TextEditor *editor);
void ME_SendSelChange(ME_TextEditor *editor);
void ME_InsertOLEFromCursor(ME_TextEditor *editor, const REOBJECT* reo, int nCursor);
BOOL ME_InternalDeleteText(ME_TextEditor *editor, ME_Cursor *start, int nChars, BOOL bForce);
int ME_GetTextLength(ME_TextEditor *editor);
int ME_GetTextLengthEx(ME_TextEditor *editor, const GETTEXTLENGTHEX *how);
ME_Style *ME_GetSelectionInsertStyle(ME_TextEditor *editor);
int ME_GetCursorOfs(const ME_Cursor *cursor) DECLSPEC_HIDDEN;
int ME_GetSelectionOfs(ME_TextEditor *editor, int *from, int *to) DECLSPEC_HIDDEN;
int ME_GetSelection(ME_TextEditor *editor, ME_Cursor **from, ME_Cursor **to) DECLSPEC_HIDDEN;
BOOL ME_IsSelection(ME_TextEditor *editor) DECLSPEC_HIDDEN;
void ME_DeleteSelection(ME_TextEditor *editor) DECLSPEC_HIDDEN;
void ME_SendSelChange(ME_TextEditor *editor) DECLSPEC_HIDDEN;
void ME_InsertOLEFromCursor(ME_TextEditor *editor, const REOBJECT* reo, int nCursor) DECLSPEC_HIDDEN;
BOOL ME_InternalDeleteText(ME_TextEditor *editor, ME_Cursor *start, int nChars, BOOL bForce) DECLSPEC_HIDDEN;
int ME_GetTextLength(ME_TextEditor *editor) DECLSPEC_HIDDEN;
int ME_GetTextLengthEx(ME_TextEditor *editor, const GETTEXTLENGTHEX *how) DECLSPEC_HIDDEN;
ME_Style *ME_GetSelectionInsertStyle(ME_TextEditor *editor) DECLSPEC_HIDDEN;
/* context.c */
void ME_InitContext(ME_Context *c, ME_TextEditor *editor, HDC hDC);
void ME_DestroyContext(ME_Context *c);
void ME_InitContext(ME_Context *c, ME_TextEditor *editor, HDC hDC) DECLSPEC_HIDDEN;
void ME_DestroyContext(ME_Context *c) DECLSPEC_HIDDEN;
/* wrap.c */
BOOL ME_WrapMarkedParagraphs(ME_TextEditor *editor);
void ME_InvalidateMarkedParagraphs(ME_TextEditor *editor);
void ME_SendRequestResize(ME_TextEditor *editor, BOOL force);
BOOL ME_WrapMarkedParagraphs(ME_TextEditor *editor) DECLSPEC_HIDDEN;
void ME_InvalidateMarkedParagraphs(ME_TextEditor *editor) DECLSPEC_HIDDEN;
void ME_SendRequestResize(ME_TextEditor *editor, BOOL force) DECLSPEC_HIDDEN;
/* para.c */
ME_DisplayItem *ME_GetParagraph(ME_DisplayItem *run);
void ME_GetSelectionParas(ME_TextEditor *editor, ME_DisplayItem **para, ME_DisplayItem **para_end);
void ME_MakeFirstParagraph(ME_TextEditor *editor);
ME_DisplayItem *ME_SplitParagraph(ME_TextEditor *editor, ME_DisplayItem *rp, ME_Style *style, ME_String *eol_str, int paraFlags);
ME_DisplayItem *ME_GetParagraph(ME_DisplayItem *run) DECLSPEC_HIDDEN;
void ME_GetSelectionParas(ME_TextEditor *editor, ME_DisplayItem **para, ME_DisplayItem **para_end) DECLSPEC_HIDDEN;
void ME_MakeFirstParagraph(ME_TextEditor *editor) DECLSPEC_HIDDEN;
ME_DisplayItem *ME_SplitParagraph(ME_TextEditor *editor, ME_DisplayItem *rp, ME_Style *style, ME_String *eol_str, int paraFlags) DECLSPEC_HIDDEN;
ME_DisplayItem *ME_JoinParagraphs(ME_TextEditor *editor, ME_DisplayItem *tp,
BOOL keepFirstParaFormat);
void ME_DumpParaStyle(ME_Paragraph *s);
void ME_DumpParaStyleToBuf(const PARAFORMAT2 *pFmt, char buf[2048]);
BOOL ME_SetSelectionParaFormat(ME_TextEditor *editor, const PARAFORMAT2 *pFmt);
void ME_GetSelectionParaFormat(ME_TextEditor *editor, PARAFORMAT2 *pFmt);
BOOL keepFirstParaFormat) DECLSPEC_HIDDEN;
void ME_DumpParaStyle(ME_Paragraph *s) DECLSPEC_HIDDEN;
void ME_DumpParaStyleToBuf(const PARAFORMAT2 *pFmt, char buf[2048]) DECLSPEC_HIDDEN;
BOOL ME_SetSelectionParaFormat(ME_TextEditor *editor, const PARAFORMAT2 *pFmt) DECLSPEC_HIDDEN;
void ME_GetSelectionParaFormat(ME_TextEditor *editor, PARAFORMAT2 *pFmt) DECLSPEC_HIDDEN;
/* marks from first up to (but not including) last */
void ME_MarkForPainting(ME_TextEditor *editor, ME_DisplayItem *first, const ME_DisplayItem *last);
void ME_MarkAllForWrapping(ME_TextEditor *editor);
void ME_SetDefaultParaFormat(PARAFORMAT2 *pFmt);
void ME_MarkForPainting(ME_TextEditor *editor, ME_DisplayItem *first, const ME_DisplayItem *last) DECLSPEC_HIDDEN;
void ME_MarkAllForWrapping(ME_TextEditor *editor) DECLSPEC_HIDDEN;
void ME_SetDefaultParaFormat(PARAFORMAT2 *pFmt) DECLSPEC_HIDDEN;
/* paint.c */
void ME_PaintContent(ME_TextEditor *editor, HDC hDC, BOOL bOnlyNew, const RECT *rcUpdate);
void ME_Repaint(ME_TextEditor *editor);
void ME_RewrapRepaint(ME_TextEditor *editor);
void ME_UpdateRepaint(ME_TextEditor *editor);
void ME_EnsureVisible(ME_TextEditor *editor, ME_Cursor *pCursor);
void ME_InvalidateSelection(ME_TextEditor *editor);
BOOL ME_SetZoom(ME_TextEditor *editor, int numerator, int denominator);
int ME_twips2pointsX(ME_Context *c, int x);
int ME_twips2pointsY(ME_Context *c, int y);
void ME_PaintContent(ME_TextEditor *editor, HDC hDC, BOOL bOnlyNew, const RECT *rcUpdate) DECLSPEC_HIDDEN;
void ME_Repaint(ME_TextEditor *editor) DECLSPEC_HIDDEN;
void ME_RewrapRepaint(ME_TextEditor *editor) DECLSPEC_HIDDEN;
void ME_UpdateRepaint(ME_TextEditor *editor, BOOL update_now) DECLSPEC_HIDDEN;
void ME_EnsureVisible(ME_TextEditor *editor, ME_Cursor *pCursor) DECLSPEC_HIDDEN;
void ME_InvalidateSelection(ME_TextEditor *editor) DECLSPEC_HIDDEN;
BOOL ME_SetZoom(ME_TextEditor *editor, int numerator, int denominator) DECLSPEC_HIDDEN;
int ME_twips2pointsX(const ME_Context *c, int x) DECLSPEC_HIDDEN;
int ME_twips2pointsY(const ME_Context *c, int y) DECLSPEC_HIDDEN;
/* scroll functions in paint.c */
void ME_ScrollAbs(ME_TextEditor *editor, int x, int y);
void ME_HScrollAbs(ME_TextEditor *editor, int x);
void ME_VScrollAbs(ME_TextEditor *editor, int y);
void ME_ScrollUp(ME_TextEditor *editor, int cy);
void ME_ScrollDown(ME_TextEditor *editor, int cy);
void ME_ScrollLeft(ME_TextEditor *editor, int cx);
void ME_ScrollRight(ME_TextEditor *editor, int cx);
void ME_UpdateScrollBar(ME_TextEditor *editor);
void ME_ScrollAbs(ME_TextEditor *editor, int x, int y) DECLSPEC_HIDDEN;
void ME_HScrollAbs(ME_TextEditor *editor, int x) DECLSPEC_HIDDEN;
void ME_VScrollAbs(ME_TextEditor *editor, int y) DECLSPEC_HIDDEN;
void ME_ScrollUp(ME_TextEditor *editor, int cy) DECLSPEC_HIDDEN;
void ME_ScrollDown(ME_TextEditor *editor, int cy) DECLSPEC_HIDDEN;
void ME_ScrollLeft(ME_TextEditor *editor, int cx) DECLSPEC_HIDDEN;
void ME_ScrollRight(ME_TextEditor *editor, int cx) DECLSPEC_HIDDEN;
void ME_UpdateScrollBar(ME_TextEditor *editor) DECLSPEC_HIDDEN;
/* other functions in paint.c */
int ME_GetParaBorderWidth(ME_Context *c, int flags);
int ME_GetParaBorderWidth(const ME_Context *c, int flags) DECLSPEC_HIDDEN;
/* richole.c */
LRESULT CreateIRichEditOle(ME_TextEditor *editor, LPVOID *);
void ME_DrawOLE(ME_Context *c, int x, int y, ME_Run* run, ME_Paragraph *para, BOOL selected);
void ME_GetOLEObjectSize(ME_Context *c, ME_Run *run, SIZE *pSize);
void ME_CopyReObject(REOBJECT* dst, const REOBJECT* src);
void ME_DeleteReObject(REOBJECT* reo);
LRESULT CreateIRichEditOle(ME_TextEditor *editor, LPVOID *) DECLSPEC_HIDDEN;
void ME_DrawOLE(ME_Context *c, int x, int y, ME_Run* run, ME_Paragraph *para, BOOL selected) DECLSPEC_HIDDEN;
void ME_GetOLEObjectSize(const ME_Context *c, ME_Run *run, SIZE *pSize) DECLSPEC_HIDDEN;
void ME_CopyReObject(REOBJECT* dst, const REOBJECT* src) DECLSPEC_HIDDEN;
void ME_DeleteReObject(REOBJECT* reo) DECLSPEC_HIDDEN;
/* editor.c */
ME_TextEditor *ME_MakeEditor(ITextHost *texthost, BOOL bEmulateVersion10);
ME_TextEditor *ME_MakeEditor(ITextHost *texthost, BOOL bEmulateVersion10) DECLSPEC_HIDDEN;
LRESULT ME_HandleMessage(ME_TextEditor *editor, UINT msg, WPARAM wParam,
LPARAM lParam, BOOL unicode, HRESULT* phresult);
void ME_SendOldNotify(ME_TextEditor *editor, int nCode);
LPARAM lParam, BOOL unicode, HRESULT* phresult) DECLSPEC_HIDDEN;
void ME_SendOldNotify(ME_TextEditor *editor, int nCode) DECLSPEC_HIDDEN;
int ME_GetTextW(ME_TextEditor *editor, WCHAR *buffer, int buflen,
const ME_Cursor *start, int srcChars, BOOL bCRLF);
void ME_RTFCharAttrHook(struct _RTF_Info *info);
void ME_RTFParAttrHook(struct _RTF_Info *info);
void ME_RTFTblAttrHook(struct _RTF_Info *info);
void ME_RTFSpecialCharHook(struct _RTF_Info *info);
void ME_StreamInFill(ME_InStream *stream);
extern int me_debug;
const ME_Cursor *start, int srcChars, BOOL bCRLF) DECLSPEC_HIDDEN;
void ME_RTFCharAttrHook(struct _RTF_Info *info) DECLSPEC_HIDDEN;
void ME_RTFParAttrHook(struct _RTF_Info *info) DECLSPEC_HIDDEN;
void ME_RTFTblAttrHook(struct _RTF_Info *info) DECLSPEC_HIDDEN;
void ME_RTFSpecialCharHook(struct _RTF_Info *info) DECLSPEC_HIDDEN;
void ME_StreamInFill(ME_InStream *stream) DECLSPEC_HIDDEN;
extern int me_debug DECLSPEC_HIDDEN;
/* table.c */
BOOL ME_IsInTable(ME_DisplayItem *pItem);
ME_DisplayItem *ME_InsertTableRowStartFromCursor(ME_TextEditor *editor);
BOOL ME_IsInTable(ME_DisplayItem *pItem) DECLSPEC_HIDDEN;
ME_DisplayItem *ME_InsertTableRowStartFromCursor(ME_TextEditor *editor) DECLSPEC_HIDDEN;
ME_DisplayItem *ME_InsertTableRowStartAtParagraph(ME_TextEditor *editor,
ME_DisplayItem *para);
ME_DisplayItem *ME_InsertTableCellFromCursor(ME_TextEditor *editor);
ME_DisplayItem *ME_InsertTableRowEndFromCursor(ME_TextEditor *editor);
ME_DisplayItem *ME_GetTableRowEnd(ME_DisplayItem *para);
ME_DisplayItem *ME_GetTableRowStart(ME_DisplayItem *para);
void ME_CheckTablesForCorruption(ME_TextEditor *editor);
void ME_ProtectPartialTableDeletion(ME_TextEditor *editor, ME_Cursor *c, int *nChars);
ME_DisplayItem* ME_AppendTableRow(ME_TextEditor *editor, ME_DisplayItem *table_row);
void ME_TabPressedInTable(ME_TextEditor *editor, BOOL bSelectedRow);
void ME_MoveCursorFromTableRowStartParagraph(ME_TextEditor *editor);
struct RTFTable *ME_MakeTableDef(ME_TextEditor *editor);
void ME_InitTableDef(ME_TextEditor *editor, struct RTFTable *tableDef);
ME_DisplayItem *para) DECLSPEC_HIDDEN;
ME_DisplayItem *ME_InsertTableCellFromCursor(ME_TextEditor *editor) DECLSPEC_HIDDEN;
ME_DisplayItem *ME_InsertTableRowEndFromCursor(ME_TextEditor *editor) DECLSPEC_HIDDEN;
ME_DisplayItem *ME_GetTableRowEnd(ME_DisplayItem *para) DECLSPEC_HIDDEN;
ME_DisplayItem *ME_GetTableRowStart(ME_DisplayItem *para) DECLSPEC_HIDDEN;
void ME_CheckTablesForCorruption(ME_TextEditor *editor) DECLSPEC_HIDDEN;
void ME_ProtectPartialTableDeletion(ME_TextEditor *editor, ME_Cursor *c, int *nChars) DECLSPEC_HIDDEN;
ME_DisplayItem* ME_AppendTableRow(ME_TextEditor *editor, ME_DisplayItem *table_row) DECLSPEC_HIDDEN;
void ME_TabPressedInTable(ME_TextEditor *editor, BOOL bSelectedRow) DECLSPEC_HIDDEN;
void ME_MoveCursorFromTableRowStartParagraph(ME_TextEditor *editor) DECLSPEC_HIDDEN;
struct RTFTable *ME_MakeTableDef(ME_TextEditor *editor) DECLSPEC_HIDDEN;
void ME_InitTableDef(ME_TextEditor *editor, struct RTFTable *tableDef) DECLSPEC_HIDDEN;
/* txthost.c */
ITextHost *ME_CreateTextHost(HWND hwnd, CREATESTRUCTW *cs, BOOL bEmulateVersion10);
ITextHost *ME_CreateTextHost(HWND hwnd, CREATESTRUCTW *cs, BOOL bEmulateVersion10) DECLSPEC_HIDDEN;
#ifdef __i386__ /* Use wrappers to perform thiscall on i386 */
#define TXTHOST_VTABLE(This) (&itextHostStdcallVtbl)
#else /* __i386__ */
@ -318,17 +318,17 @@ ITextHost *ME_CreateTextHost(HWND hwnd, CREATESTRUCTW *cs, BOOL bEmulateVersion1
#define ITextHost_TxGetSelectionBarWidth(This,a) TXTHOST_VTABLE(This)->TxGetSelectionBarWidth(This,a)
/* undo.c */
ME_UndoItem *ME_AddUndoItem(ME_TextEditor *editor, ME_DIType type, const ME_DisplayItem *pdi);
void ME_CommitUndo(ME_TextEditor *editor);
void ME_ContinueCoalescingTransaction(ME_TextEditor *editor);
void ME_CommitCoalescingUndo(ME_TextEditor *editor);
BOOL ME_Undo(ME_TextEditor *editor);
BOOL ME_Redo(ME_TextEditor *editor);
void ME_EmptyUndoStack(ME_TextEditor *editor);
ME_UndoItem *ME_AddUndoItem(ME_TextEditor *editor, ME_DIType type, const ME_DisplayItem *pdi) DECLSPEC_HIDDEN;
void ME_CommitUndo(ME_TextEditor *editor) DECLSPEC_HIDDEN;
void ME_ContinueCoalescingTransaction(ME_TextEditor *editor) DECLSPEC_HIDDEN;
void ME_CommitCoalescingUndo(ME_TextEditor *editor) DECLSPEC_HIDDEN;
BOOL ME_Undo(ME_TextEditor *editor) DECLSPEC_HIDDEN;
BOOL ME_Redo(ME_TextEditor *editor) DECLSPEC_HIDDEN;
void ME_EmptyUndoStack(ME_TextEditor *editor) DECLSPEC_HIDDEN;
/* writer.c */
LRESULT ME_StreamOutRange(ME_TextEditor *editor, DWORD dwFormat, const ME_Cursor *start, int nChars, EDITSTREAM *stream);
LRESULT ME_StreamOut(ME_TextEditor *editor, DWORD dwFormat, EDITSTREAM *stream);
LRESULT ME_StreamOutRange(ME_TextEditor *editor, DWORD dwFormat, const ME_Cursor *start, int nChars, EDITSTREAM *stream) DECLSPEC_HIDDEN;
LRESULT ME_StreamOut(ME_TextEditor *editor, DWORD dwFormat, EDITSTREAM *stream) DECLSPEC_HIDDEN;
/* clipboard.c */
HRESULT ME_GetDataObject(ME_TextEditor *editor, const ME_Cursor *start, int nChars, LPDATAOBJECT *lplpdataobj);
HRESULT ME_GetDataObject(ME_TextEditor *editor, const ME_Cursor *start, int nChars, LPDATAOBJECT *lplpdataobj) DECLSPEC_HIDDEN;

View file

@ -118,10 +118,6 @@ typedef enum {
#define MERF_ENDWHITE 0x004000
/* run is completely made of whitespaces */
#define MERF_WHITESPACE 0x008000
/* run is a last (dummy) run in the paragraph */
#define MERF_SKIPPED 0x010000
/* flags that are calculated during text wrapping */
#define MERF_CALCBYWRAP 0x0F0000
/* the "end of paragraph" run, contains 1 character */
#define MERF_ENDPARA 0x100000
/* forcing the "end of row" run, contains 1 character */
@ -414,7 +410,6 @@ typedef struct tagME_WrapContext
ME_DisplayItem *pRowStart;
ME_DisplayItem *pLastSplittableRun;
POINT ptLastSplittableRun;
} ME_WrapContext;
#endif

View file

@ -73,7 +73,7 @@ void ME_PaintContent(ME_TextEditor *editor, HDC hDC, BOOL bOnlyNew, const RECT *
if (!bOnlyNew || (item->member.para.nFlags & MEPF_REPAINT))
{
/* Draw the pargraph if any of the paragraph is in the update region. */
/* Draw the paragraph if any of the paragraph is in the update region. */
if (ys < rcUpdate->bottom && ye > rcUpdate->top)
{
ME_DrawParagraph(&c, item);
@ -129,12 +129,10 @@ void ME_Repaint(ME_TextEditor *editor)
ME_UpdateScrollBar(editor);
FIXME("ME_Repaint had to call ME_WrapMarkedParagraphs\n");
}
if (!editor->bEmulateVersion10 || (editor->nEventMask & ENM_UPDATE))
ME_SendOldNotify(editor, EN_UPDATE);
ITextHost_TxViewChange(editor->texthost, TRUE);
}
void ME_UpdateRepaint(ME_TextEditor *editor)
void ME_UpdateRepaint(ME_TextEditor *editor, BOOL update_now)
{
/* Should be called whenever the contents of the control have changed */
BOOL wrappedParagraphs;
@ -146,6 +144,8 @@ void ME_UpdateRepaint(ME_TextEditor *editor)
/* Ensure that the cursor is visible */
ME_EnsureVisible(editor, &editor->pCursors[0]);
ITextHost_TxViewChange(editor->texthost, update_now);
ME_SendSelChange(editor);
/* send EN_CHANGE if the event mask asks for it */
@ -155,7 +155,6 @@ void ME_UpdateRepaint(ME_TextEditor *editor)
ME_SendOldNotify(editor, EN_CHANGE);
editor->nEventMask |= ENM_CHANGE;
}
ME_Repaint(editor);
}
void
@ -170,7 +169,7 @@ ME_RewrapRepaint(ME_TextEditor *editor)
ME_Repaint(editor);
}
int ME_twips2pointsX(ME_Context *c, int x)
int ME_twips2pointsX(const ME_Context *c, int x)
{
if (c->editor->nZoomNumerator == 0)
return x * c->dpi.cx / 1440;
@ -178,7 +177,7 @@ int ME_twips2pointsX(ME_Context *c, int x)
return x * c->dpi.cx * c->editor->nZoomNumerator / 1440 / c->editor->nZoomDenominator;
}
int ME_twips2pointsY(ME_Context *c, int y)
int ME_twips2pointsY(const ME_Context *c, int y)
{
if (c->editor->nZoomNumerator == 0)
return y * c->dpi.cy / 1440;
@ -490,7 +489,7 @@ static const COLORREF pen_colors[16] = {
/* Dark gray */ RGB(0x80, 0x80, 0x80), /* Light gray */ RGB(0xc0, 0xc0, 0xc0),
};
static int ME_GetBorderPenWidth(ME_Context* c, int idx)
static int ME_GetBorderPenWidth(const ME_Context* c, int idx)
{
int width = border_details[idx].width;
@ -503,7 +502,7 @@ static int ME_GetBorderPenWidth(ME_Context* c, int idx)
return width;
}
int ME_GetParaBorderWidth(ME_Context* c, int flags)
int ME_GetParaBorderWidth(const ME_Context* c, int flags)
{
int idx = (flags >> 8) & 0xF;
int width;
@ -958,12 +957,9 @@ static void ME_DrawParagraph(ME_Context *c, ME_DisplayItem *paragraph)
rc.left = c->pt.x + run->pt.x;
rc.right = rc.left + run->nWidth;
rc.top = c->pt.y + para->pt.y + run->pt.y;
rc.bottom = rc.bottom + height;
rc.bottom = rc.top + height;
TRACE("rc = (%d, %d, %d, %d)\n", rc.left, rc.top, rc.right, rc.bottom);
if (run->nFlags & MERF_SKIPPED)
DrawFocusRect(c->hDC, &rc);
else
FrameRect(c->hDC, &rc, GetSysColorBrush(COLOR_GRAYTEXT));
FrameRect(c->hDC, &rc, GetSysColorBrush(COLOR_GRAYTEXT));
}
if (visible)
ME_DrawRun(c, c->pt.x + run->pt.x,
@ -1096,7 +1092,7 @@ void ME_ScrollRight(ME_TextEditor *editor, int cx)
ME_HScrollAbs(editor, editor->horz_si.nPos + cx);
}
/* Calculates the visiblity after a call to SetScrollRange or
/* Calculates the visibility after a call to SetScrollRange or
* SetScrollInfo with SIF_RANGE. */
static BOOL ME_PostSetScrollRangeVisibility(SCROLLINFO *si)
{

View file

@ -475,7 +475,7 @@ void ME_DumpParaStyleToBuf(const PARAFORMAT2 *pFmt, char buf[2048])
/* we take for granted that PFE_xxx is the hiword of the corresponding PFM_xxx */
#define DUMP_EFFECT(mask, name) \
p += sprintf(p, "%-22s%s\n", name, (pFmt->dwMask & (mask)) ? ((pFmt->wEffects & ((mask) >> 8)) ? "yes" : "no") : "N/A");
p += sprintf(p, "%-22s%s\n", name, (pFmt->dwMask & (mask)) ? ((pFmt->wEffects & ((mask) >> 16)) ? "yes" : "no") : "N/A");
DUMP(PFM_NUMBERING, "Numbering:", "%u", wNumbering);
DUMP_EFFECT(PFM_DONOTHYPHEN, "Disable auto-hyphen:");

View file

@ -18,4 +18,4 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#define OCR_REVERSE 32768
#define OCR_REVERSE 107

File diff suppressed because it is too large Load diff

View file

@ -1186,31 +1186,31 @@ struct _RTF_Info {
* Public RTF reader routines
*/
void RTFInit (RTF_Info *);
void RTFDestroy(RTF_Info *info);
void RTFSetDestinationCallback (RTF_Info *, int, RTFFuncPtr);
void RTFRead (RTF_Info *);
int RTFGetToken (RTF_Info *); /* writer should rarely need this */
void RTFSetReadHook (RTF_Info *, RTFFuncPtr);
void RTFRouteToken (RTF_Info *);
void RTFSkipGroup (RTF_Info *);
void RTFReadGroup (RTF_Info *);
int RTFCheckCM (const RTF_Info *, int, int);
int RTFCheckCMM (const RTF_Info *, int, int, int);
int RTFCheckMM (const RTF_Info *, int, int);
RTFFont *RTFGetFont (const RTF_Info *, int);
RTFColor *RTFGetColor (const RTF_Info *, int);
int RTFCharToHex ( char);
void RTFInit (RTF_Info *) DECLSPEC_HIDDEN;
void RTFDestroy(RTF_Info *info) DECLSPEC_HIDDEN;
void RTFSetDestinationCallback (RTF_Info *, int, RTFFuncPtr) DECLSPEC_HIDDEN;
void RTFRead (RTF_Info *) DECLSPEC_HIDDEN;
int RTFGetToken (RTF_Info *) DECLSPEC_HIDDEN; /* writer should rarely need this */
void RTFSetReadHook (RTF_Info *, RTFFuncPtr) DECLSPEC_HIDDEN;
void RTFRouteToken (RTF_Info *) DECLSPEC_HIDDEN;
void RTFSkipGroup (RTF_Info *) DECLSPEC_HIDDEN;
void RTFReadGroup (RTF_Info *) DECLSPEC_HIDDEN;
int RTFCheckCM (const RTF_Info *, int, int) DECLSPEC_HIDDEN;
int RTFCheckCMM (const RTF_Info *, int, int, int) DECLSPEC_HIDDEN;
int RTFCheckMM (const RTF_Info *, int, int) DECLSPEC_HIDDEN;
RTFFont *RTFGetFont (const RTF_Info *, int) DECLSPEC_HIDDEN;
RTFColor *RTFGetColor (const RTF_Info *, int) DECLSPEC_HIDDEN;
int RTFCharToHex ( char) DECLSPEC_HIDDEN;
void RTFFlushOutputBuffer( RTF_Info *info );
void RTFSetEditStream(RTF_Info *info, ME_InStream *stream);
void RTFFlushOutputBuffer( RTF_Info *info ) DECLSPEC_HIDDEN;
void RTFSetEditStream(RTF_Info *info, ME_InStream *stream) DECLSPEC_HIDDEN;
void WriterInit (RTF_Info *);
int BeginFile (RTF_Info *);
void WriterInit (RTF_Info *) DECLSPEC_HIDDEN;
int BeginFile (RTF_Info *) DECLSPEC_HIDDEN;
int RTFCharSetToCodePage(RTF_Info *info, int charset);
int RTFCharSetToCodePage(RTF_Info *info, int charset) DECLSPEC_HIDDEN;
void LookupInit (void);
void LookupCleanup (void);
void LookupInit (void) DECLSPEC_HIDDEN;
void LookupCleanup (void) DECLSPEC_HIDDEN;
#endif

View file

@ -251,9 +251,9 @@ void ME_JoinRuns(ME_TextEditor *editor, ME_DisplayItem *p)
ME_DisplayItem *ME_SplitRun(ME_WrapContext *wc, ME_DisplayItem *item, int nVChar)
{
ME_TextEditor *editor = wc->context->editor;
ME_DisplayItem *item2 = NULL;
ME_Run *run, *run2;
ME_Paragraph *para = &ME_GetParagraph(item)->member.para;
ME_Paragraph *para = &wc->pPara->member.para;
ME_Cursor cursor = {wc->pPara, item, nVChar};
assert(item->member.run.nCharOfs != -1);
if(TRACE_ON(richedit))
@ -268,12 +268,11 @@ ME_DisplayItem *ME_SplitRun(ME_WrapContext *wc, ME_DisplayItem *item, int nVChar
TRACE("Before split: %s(%d, %d)\n", debugstr_w(run->strText->szData),
run->pt.x, run->pt.y);
item2 = ME_SplitRunSimple(editor, item, nVChar);
ME_SplitRunSimple(editor, &cursor);
run2 = &item2->member.run;
run2 = &cursor.pRun->member.run;
ME_CalcRunExtent(wc->context, para, wc->nRow ? wc->nLeftMargin : wc->nFirstMargin, run);
ME_CalcRunExtent(wc->context, para, wc->nRow ? wc->nLeftMargin : wc->nFirstMargin, run2);
run2->pt.x = run->pt.x+run->nWidth;
run2->pt.y = run->pt.y;
@ -288,46 +287,45 @@ ME_DisplayItem *ME_SplitRun(ME_WrapContext *wc, ME_DisplayItem *item, int nVChar
debugstr_w(run2->strText->szData), run2->pt.x, run2->pt.y);
}
return item2;
return cursor.pRun;
}
/******************************************************************************
* ME_SplitRunSimple
*
*
* Does the most basic job of splitting a run into two - it does not
* update the positions and extents.
*/
ME_DisplayItem *ME_SplitRunSimple(ME_TextEditor *editor, ME_DisplayItem *item, int nVChar)
* update the positions and extents.
*/
ME_DisplayItem *ME_SplitRunSimple(ME_TextEditor *editor, ME_Cursor *cursor)
{
ME_Run *run = &item->member.run;
ME_DisplayItem *item2;
ME_Run *run2;
ME_DisplayItem *run = cursor->pRun;
ME_DisplayItem *new_run;
int i;
assert(nVChar > 0 && nVChar < run->strText->nLen);
assert(item->type == diRun);
assert(!(item->member.run.nFlags & MERF_NONTEXT));
assert(item->member.run.nCharOfs != -1);
int nOffset = cursor->nOffset;
item2 = ME_MakeRun(run->style,
ME_VSplitString(run->strText, nVChar), run->nFlags&MERF_SPLITMASK);
assert(!(run->member.run.nFlags & MERF_NONTEXT));
item2->member.run.nCharOfs = item->member.run.nCharOfs + nVChar;
new_run = ME_MakeRun(run->member.run.style,
ME_VSplitString(run->member.run.strText, nOffset),
run->member.run.nFlags & MERF_SPLITMASK);
run2 = &item2->member.run;
ME_InsertBefore(item->next, item2);
new_run->member.run.nCharOfs = run->member.run.nCharOfs + nOffset;
cursor->pRun = new_run;
cursor->nOffset = 0;
ME_UpdateRunFlags(editor, run);
ME_UpdateRunFlags(editor, run2);
for (i=0; i<editor->nCursors; i++) {
if (editor->pCursors[i].pRun == item &&
editor->pCursors[i].nOffset >= nVChar) {
assert(item2->type == diRun);
editor->pCursors[i].pRun = item2;
editor->pCursors[i].nOffset -= nVChar;
ME_InsertBefore(run->next, new_run);
ME_UpdateRunFlags(editor, &run->member.run);
ME_UpdateRunFlags(editor, &new_run->member.run);
for (i = 0; i < editor->nCursors; i++) {
if (editor->pCursors[i].pRun == run &&
editor->pCursors[i].nOffset >= nOffset) {
editor->pCursors[i].pRun = new_run;
editor->pCursors[i].nOffset -= nOffset;
}
}
ME_GetParagraph(item)->member.para.nFlags |= MEPF_REWRAP;
return item2;
cursor->pPara->member.para.nFlags |= MEPF_REWRAP;
return run;
}
/******************************************************************************
@ -361,12 +359,8 @@ ME_InsertRunAtCursor(ME_TextEditor *editor, ME_Cursor *cursor, ME_Style *style,
ME_DisplayItem *pDI;
ME_UndoItem *pUI;
if (cursor->nOffset) {
/* We're inserting at the middle of the existing run, which means that
* that run must be split. It isn't always necessary, but */
cursor->pRun = ME_SplitRunSimple(editor, cursor->pRun, cursor->nOffset);
cursor->nOffset = 0;
}
if (cursor->nOffset)
ME_SplitRunSimple(editor, cursor);
pUI = ME_AddUndoItem(editor, diUndoDeleteRun, NULL);
if (pUI) {
@ -756,10 +750,8 @@ void ME_SetCharFormat(ME_TextEditor *editor, ME_Cursor *start, ME_Cursor *end, C
{
/* SplitRunSimple may or may not update the cursors, depending on whether they
* are selection cursors, but we need to make sure they are valid. */
ME_DisplayItem *split_run = start->pRun;
int split_offset = start->nOffset;
start->pRun = ME_SplitRunSimple(editor, split_run, split_offset);
start->nOffset = 0;
ME_DisplayItem *split_run = ME_SplitRunSimple(editor, start);
if (end && end->pRun == split_run)
{
end->pRun = start->pRun;
@ -768,12 +760,8 @@ void ME_SetCharFormat(ME_TextEditor *editor, ME_Cursor *start, ME_Cursor *end, C
}
if (end && end->nOffset)
{
end_run = end->pRun = ME_SplitRunSimple(editor, end->pRun, end->nOffset);
end->nOffset = 0;
} else if (end) {
end_run = end->pRun;
}
ME_SplitRunSimple(editor, end);
end_run = end ? end->pRun : NULL;
run = start->pRun;
para = start->pPara;
@ -906,8 +894,8 @@ void ME_GetCharFormat(ME_TextEditor *editor, const ME_Cursor *from,
do {
/* FIXME add more style feature comparisons */
int nAttribs = CFM_SIZE | CFM_FACE | CFM_COLOR | CFM_UNDERLINETYPE;
int nEffects = CFM_BOLD | CFM_ITALIC | CFM_UNDERLINE | CFM_STRIKEOUT | CFM_PROTECTED | CFM_LINK | CFM_SUPERSCRIPT;
DWORD dwAttribs = CFM_SIZE | CFM_FACE | CFM_COLOR | CFM_UNDERLINETYPE;
DWORD dwEffects = CFM_BOLD | CFM_ITALIC | CFM_UNDERLINE | CFM_STRIKEOUT | CFM_PROTECTED | CFM_LINK | CFM_SUPERSCRIPT;
run = ME_FindItemFwd(run, diRun);
@ -915,7 +903,7 @@ void ME_GetCharFormat(ME_TextEditor *editor, const ME_Cursor *from,
tmp.cbSize = sizeof(tmp);
ME_GetRunCharFormat(editor, run, &tmp);
assert((tmp.dwMask & nAttribs) == nAttribs);
assert((tmp.dwMask & dwAttribs) == dwAttribs);
/* reset flags that differ */
if (pFmt->yHeight != tmp.yHeight)
@ -941,7 +929,7 @@ void ME_GetCharFormat(ME_TextEditor *editor, const ME_Cursor *from,
}
}
pFmt->dwMask &= ~((pFmt->dwEffects ^ tmp.dwEffects) & nEffects);
pFmt->dwMask &= ~((pFmt->dwEffects ^ tmp.dwEffects) & dwEffects);
pFmt->dwEffects = tmp.dwEffects;
} while(run != run_end);

View file

@ -139,21 +139,16 @@ void ME_CopyToCFAny(CHARFORMAT2W *to, CHARFORMAT2W *from)
CopyMemory(to, from, to->cbSize);
}
ME_Style *ME_MakeStyle(CHARFORMAT2W *style) {
CHARFORMAT2W styledata;
ME_Style *ME_MakeStyle(CHARFORMAT2W *style)
{
ME_Style *s = ALLOC_OBJ(ME_Style);
style = ME_ToCF2W(&styledata, style);
memset(s, 0, sizeof(ME_Style));
if (style->cbSize <= sizeof(CHARFORMAT2W))
CopyMemory(&s->fmt, style, style->cbSize);
else
s->fmt = *style;
s->fmt.cbSize = sizeof(CHARFORMAT2W);
assert(style->cbSize == sizeof(CHARFORMAT2W));
s->fmt = *style;
s->nSequence = -2;
s->nRefs = 1;
s->hFont = NULL;
memset(&s->tm, 0, sizeof(s->tm));
s->tm.tmAscent = -1;
all_refs++;
TRACE_(richedit_style)("ME_MakeStyle %p, total refs=%d\n", s, all_refs);
@ -171,7 +166,7 @@ ME_Style *ME_MakeStyle(CHARFORMAT2W *style) {
s->fmt.dwMask |= mask;\
CopyMemory(s->fmt.member, style->member, sizeof(style->member));\
}
void ME_InitCharFormat2W(CHARFORMAT2W *pFmt)
{
ZeroMemory(pFmt, sizeof(CHARFORMAT2W));
@ -180,9 +175,8 @@ void ME_InitCharFormat2W(CHARFORMAT2W *pFmt)
ME_Style *ME_ApplyStyle(ME_Style *sSrc, CHARFORMAT2W *style)
{
CHARFORMAT2W styledata;
ME_Style *s = ME_MakeStyle(&sSrc->fmt);
style = ME_ToCF2W(&styledata, style);
assert(style->cbSize == sizeof(CHARFORMAT2W));
COPY_STYLE_ITEM(CFM_ANIMATION, bAnimation);
COPY_STYLE_ITEM(CFM_BACKCOLOR, crBackColor);
COPY_STYLE_ITEM(CFM_CHARSET, bCharSet);

View file

@ -64,10 +64,8 @@ static ME_DisplayItem* ME_InsertEndParaFromCursor(ME_TextEditor *editor,
ME_Style *pStyle = ME_GetInsertStyle(editor, nCursor);
ME_DisplayItem *tp;
ME_Cursor* cursor = &editor->pCursors[nCursor];
if (cursor->nOffset) {
ME_SplitRunSimple(editor, cursor->pRun, cursor->nOffset);
cursor = &editor->pCursors[nCursor];
}
if (cursor->nOffset)
ME_SplitRunSimple(editor, cursor);
tp = ME_SplitParagraph(editor, cursor->pRun, pStyle, eol_str, paraFlags);
ME_ReleaseStyle(pStyle);
@ -249,7 +247,7 @@ void ME_CheckTablesForCorruption(ME_TextEditor *editor)
{
assert(!(p->member.para.nFlags & (MEPF_ROWSTART|MEPF_ROWEND|MEPF_CELL)));
assert(p->member.para.pFmt->dwMask & PFM_TABLE);
assert(!(p->member.para.pFmt->wEffects & PFM_TABLEROWDELIMITER));
assert(!(p->member.para.pFmt->wEffects & PFE_TABLEROWDELIMITER));
assert(!p->member.para.pCell);
p = p->member.para.next_para;
}

View file

@ -36,7 +36,7 @@
WINE_DEFAULT_DEBUG_CHANNEL(richedit);
typedef struct ITextHostImpl {
const ITextHostVtbl *lpVtbl;
ITextHost ITextHost_iface;
LONG ref;
HWND hWnd;
BOOL bEmulateVersion10;
@ -52,12 +52,12 @@ ITextHost *ME_CreateTextHost(HWND hwnd, CREATESTRUCTW *cs, BOOL bEmulateVersion1
{
ME_TextEditor *editor;
texthost->lpVtbl = &textHostVtbl;
texthost->ITextHost_iface.lpVtbl = &textHostVtbl;
texthost->ref = 1;
texthost->hWnd = hwnd;
texthost->bEmulateVersion10 = bEmulateVersion10;
editor = ME_MakeEditor((ITextHost*)texthost, bEmulateVersion10);
editor = ME_MakeEditor(&texthost->ITextHost_iface, bEmulateVersion10);
editor->exStyleFlags = GetWindowLongW(hwnd, GWL_EXSTYLE);
editor->styleFlags |= GetWindowLongW(hwnd, GWL_STYLE) & ES_WANTRETURN;
editor->hWnd = hwnd; /* FIXME: Remove editor's dependence on hWnd */
@ -65,14 +65,17 @@ ITextHost *ME_CreateTextHost(HWND hwnd, CREATESTRUCTW *cs, BOOL bEmulateVersion1
SetWindowLongPtrW(hwnd, 0, (LONG_PTR)editor);
}
return (ITextHost*)texthost;
return &texthost->ITextHost_iface;
}
static HRESULT WINAPI ITextHostImpl_QueryInterface(ITextHost *iface,
REFIID riid,
LPVOID *ppvObject)
static inline ITextHostImpl *impl_from_ITextHost(ITextHost *iface)
{
ITextHostImpl *This = (ITextHostImpl *)iface;
return CONTAINING_RECORD(iface, ITextHostImpl, ITextHost_iface);
}
static HRESULT WINAPI ITextHostImpl_QueryInterface(ITextHost *iface, REFIID riid, void **ppvObject)
{
ITextHostImpl *This = impl_from_ITextHost(iface);
if (IsEqualIID(riid, &IID_IUnknown) || IsEqualIID(riid, &IID_ITextHost)) {
*ppvObject = This;
@ -86,14 +89,14 @@ static HRESULT WINAPI ITextHostImpl_QueryInterface(ITextHost *iface,
static ULONG WINAPI ITextHostImpl_AddRef(ITextHost *iface)
{
ITextHostImpl *This = (ITextHostImpl *)iface;
ITextHostImpl *This = impl_from_ITextHost(iface);
ULONG ref = InterlockedIncrement(&This->ref);
return ref;
}
static ULONG WINAPI ITextHostImpl_Release(ITextHost *iface)
{
ITextHostImpl *This = (ITextHostImpl *)iface;
ITextHostImpl *This = impl_from_ITextHost(iface);
ULONG ref = InterlockedDecrement(&This->ref);
if (!ref)
@ -104,182 +107,155 @@ static ULONG WINAPI ITextHostImpl_Release(ITextHost *iface)
return ref;
}
HDC WINAPI ITextHostImpl_TxGetDC(ITextHost *iface)
DECLSPEC_HIDDEN HDC WINAPI ITextHostImpl_TxGetDC(ITextHost *iface)
{
ITextHostImpl *This = (ITextHostImpl *)iface;
ITextHostImpl *This = impl_from_ITextHost(iface);
return GetDC(This->hWnd);
}
INT WINAPI ITextHostImpl_TxReleaseDC(ITextHost *iface,
HDC hdc)
DECLSPEC_HIDDEN INT WINAPI ITextHostImpl_TxReleaseDC(ITextHost *iface, HDC hdc)
{
ITextHostImpl *This = (ITextHostImpl *)iface;
ITextHostImpl *This = impl_from_ITextHost(iface);
return ReleaseDC(This->hWnd, hdc);
}
BOOL WINAPI ITextHostImpl_TxShowScrollBar(ITextHost *iface,
INT fnBar,
BOOL fShow)
DECLSPEC_HIDDEN BOOL WINAPI ITextHostImpl_TxShowScrollBar(ITextHost *iface, INT fnBar, BOOL fShow)
{
ITextHostImpl *This = (ITextHostImpl *)iface;
ITextHostImpl *This = impl_from_ITextHost(iface);
return ShowScrollBar(This->hWnd, fnBar, fShow);
}
BOOL WINAPI ITextHostImpl_TxEnableScrollBar(ITextHost *iface,
INT fuSBFlags,
INT fuArrowflags)
DECLSPEC_HIDDEN BOOL WINAPI ITextHostImpl_TxEnableScrollBar(ITextHost *iface, INT fuSBFlags, INT fuArrowflags)
{
ITextHostImpl *This = (ITextHostImpl *)iface;
ITextHostImpl *This = impl_from_ITextHost(iface);
return EnableScrollBar(This->hWnd, fuSBFlags, fuArrowflags);
}
BOOL WINAPI ITextHostImpl_TxSetScrollRange(ITextHost *iface,
INT fnBar,
LONG nMinPos,
INT nMaxPos,
DECLSPEC_HIDDEN BOOL WINAPI ITextHostImpl_TxSetScrollRange(ITextHost *iface, INT fnBar, LONG nMinPos, INT nMaxPos,
BOOL fRedraw)
{
ITextHostImpl *This = (ITextHostImpl *)iface;
ITextHostImpl *This = impl_from_ITextHost(iface);
return SetScrollRange(This->hWnd, fnBar, nMinPos, nMaxPos, fRedraw);
}
BOOL WINAPI ITextHostImpl_TxSetScrollPos(ITextHost *iface,
INT fnBar,
INT nPos,
BOOL fRedraw)
DECLSPEC_HIDDEN BOOL WINAPI ITextHostImpl_TxSetScrollPos(ITextHost *iface, INT fnBar, INT nPos, BOOL fRedraw)
{
ITextHostImpl *This = (ITextHostImpl *)iface;
ITextHostImpl *This = impl_from_ITextHost(iface);
int pos = SetScrollPos(This->hWnd, fnBar, nPos, fRedraw);
return (pos ? TRUE : FALSE);
}
void WINAPI ITextHostImpl_TxInvalidateRect(ITextHost *iface,
LPCRECT prc,
BOOL fMode)
DECLSPEC_HIDDEN void WINAPI ITextHostImpl_TxInvalidateRect(ITextHost *iface, LPCRECT prc, BOOL fMode)
{
ITextHostImpl *This = (ITextHostImpl *)iface;
ITextHostImpl *This = impl_from_ITextHost(iface);
InvalidateRect(This->hWnd, prc, fMode);
}
void WINAPI ITextHostImpl_TxViewChange(ITextHost *iface,
BOOL fUpdate)
DECLSPEC_HIDDEN void WINAPI ITextHostImpl_TxViewChange(ITextHost *iface, BOOL fUpdate)
{
ITextHostImpl *This = (ITextHostImpl *)iface;
ITextHostImpl *This = impl_from_ITextHost(iface);
if (fUpdate)
UpdateWindow(This->hWnd);
}
BOOL WINAPI ITextHostImpl_TxCreateCaret(ITextHost *iface,
HBITMAP hbmp,
INT xWidth, INT yHeight)
DECLSPEC_HIDDEN BOOL WINAPI ITextHostImpl_TxCreateCaret(ITextHost *iface, HBITMAP hbmp, INT xWidth, INT yHeight)
{
ITextHostImpl *This = (ITextHostImpl *)iface;
ITextHostImpl *This = impl_from_ITextHost(iface);
return CreateCaret(This->hWnd, hbmp, xWidth, yHeight);
}
BOOL WINAPI ITextHostImpl_TxShowCaret(ITextHost *iface, BOOL fShow)
DECLSPEC_HIDDEN BOOL WINAPI ITextHostImpl_TxShowCaret(ITextHost *iface, BOOL fShow)
{
ITextHostImpl *This = (ITextHostImpl *)iface;
ITextHostImpl *This = impl_from_ITextHost(iface);
if (fShow)
return ShowCaret(This->hWnd);
else
return HideCaret(This->hWnd);
}
BOOL WINAPI ITextHostImpl_TxSetCaretPos(ITextHost *iface,
DECLSPEC_HIDDEN BOOL WINAPI ITextHostImpl_TxSetCaretPos(ITextHost *iface,
INT x, INT y)
{
return SetCaretPos(x, y);
}
BOOL WINAPI ITextHostImpl_TxSetTimer(ITextHost *iface,
UINT idTimer, UINT uTimeout)
DECLSPEC_HIDDEN BOOL WINAPI ITextHostImpl_TxSetTimer(ITextHost *iface, UINT idTimer, UINT uTimeout)
{
ITextHostImpl *This = (ITextHostImpl *)iface;
ITextHostImpl *This = impl_from_ITextHost(iface);
return SetTimer(This->hWnd, idTimer, uTimeout, NULL) != 0;
}
void WINAPI ITextHostImpl_TxKillTimer(ITextHost *iface,
UINT idTimer)
DECLSPEC_HIDDEN void WINAPI ITextHostImpl_TxKillTimer(ITextHost *iface, UINT idTimer)
{
ITextHostImpl *This = (ITextHostImpl *)iface;
ITextHostImpl *This = impl_from_ITextHost(iface);
KillTimer(This->hWnd, idTimer);
}
void WINAPI ITextHostImpl_TxScrollWindowEx(ITextHost *iface,
INT dx, INT dy,
LPCRECT lprcScroll,
LPCRECT lprcClip,
HRGN hRgnUpdate,
LPRECT lprcUpdate,
DECLSPEC_HIDDEN void WINAPI ITextHostImpl_TxScrollWindowEx(ITextHost *iface, INT dx, INT dy, LPCRECT lprcScroll,
LPCRECT lprcClip, HRGN hRgnUpdate, LPRECT lprcUpdate,
UINT fuScroll)
{
ITextHostImpl *This = (ITextHostImpl *)iface;
ITextHostImpl *This = impl_from_ITextHost(iface);
ScrollWindowEx(This->hWnd, dx, dy, lprcScroll, lprcClip,
hRgnUpdate, lprcUpdate, fuScroll);
}
void WINAPI ITextHostImpl_TxSetCapture(ITextHost *iface,
BOOL fCapture)
DECLSPEC_HIDDEN void WINAPI ITextHostImpl_TxSetCapture(ITextHost *iface, BOOL fCapture)
{
ITextHostImpl *This = (ITextHostImpl *)iface;
ITextHostImpl *This = impl_from_ITextHost(iface);
if (fCapture)
SetCapture(This->hWnd);
else
ReleaseCapture();
}
void WINAPI ITextHostImpl_TxSetFocus(ITextHost *iface)
DECLSPEC_HIDDEN void WINAPI ITextHostImpl_TxSetFocus(ITextHost *iface)
{
ITextHostImpl *This = (ITextHostImpl *)iface;
ITextHostImpl *This = impl_from_ITextHost(iface);
SetFocus(This->hWnd);
}
void WINAPI ITextHostImpl_TxSetCursor(ITextHost *iface,
DECLSPEC_HIDDEN void WINAPI ITextHostImpl_TxSetCursor(ITextHost *iface,
HCURSOR hcur,
BOOL fText)
{
SetCursor(hcur);
}
BOOL WINAPI ITextHostImpl_TxScreenToClient(ITextHost *iface,
LPPOINT lppt)
DECLSPEC_HIDDEN BOOL WINAPI ITextHostImpl_TxScreenToClient(ITextHost *iface, LPPOINT lppt)
{
ITextHostImpl *This = (ITextHostImpl *)iface;
ITextHostImpl *This = impl_from_ITextHost(iface);
return ScreenToClient(This->hWnd, lppt);
}
BOOL WINAPI ITextHostImpl_TxClientToScreen(ITextHost *iface,
LPPOINT lppt)
DECLSPEC_HIDDEN BOOL WINAPI ITextHostImpl_TxClientToScreen(ITextHost *iface, LPPOINT lppt)
{
ITextHostImpl *This = (ITextHostImpl *)iface;
ITextHostImpl *This = impl_from_ITextHost(iface);
return ClientToScreen(This->hWnd, lppt);
}
HRESULT WINAPI ITextHostImpl_TxActivate(ITextHost *iface,
LONG *plOldState)
DECLSPEC_HIDDEN HRESULT WINAPI ITextHostImpl_TxActivate(ITextHost *iface, LONG *plOldState)
{
ITextHostImpl *This = (ITextHostImpl *)iface;
ITextHostImpl *This = impl_from_ITextHost(iface);
*plOldState = HandleToLong(SetActiveWindow(This->hWnd));
return (*plOldState ? S_OK : E_FAIL);
}
HRESULT WINAPI ITextHostImpl_TxDeactivate(ITextHost *iface,
DECLSPEC_HIDDEN HRESULT WINAPI ITextHostImpl_TxDeactivate(ITextHost *iface,
LONG lNewState)
{
HWND ret = SetActiveWindow(LongToHandle(lNewState));
return (ret ? S_OK : E_FAIL);
}
HRESULT WINAPI ITextHostImpl_TxGetClientRect(ITextHost *iface,
LPRECT prc)
DECLSPEC_HIDDEN HRESULT WINAPI ITextHostImpl_TxGetClientRect(ITextHost *iface, LPRECT prc)
{
ITextHostImpl *This = (ITextHostImpl *)iface;
ITextHostImpl *This = impl_from_ITextHost(iface);
int ret = GetClientRect(This->hWnd, prc);
return (ret ? S_OK : E_FAIL);
}
HRESULT WINAPI ITextHostImpl_TxGetViewInset(ITextHost *iface,
DECLSPEC_HIDDEN HRESULT WINAPI ITextHostImpl_TxGetViewInset(ITextHost *iface,
LPRECT prc)
{
prc->top = 0;
@ -289,42 +265,41 @@ HRESULT WINAPI ITextHostImpl_TxGetViewInset(ITextHost *iface,
return S_OK;
}
HRESULT WINAPI ITextHostImpl_TxGetCharFormat(ITextHost *iface,
DECLSPEC_HIDDEN HRESULT WINAPI ITextHostImpl_TxGetCharFormat(ITextHost *iface,
const CHARFORMATW **ppCF)
{
return E_NOTIMPL;
}
HRESULT WINAPI ITextHostImpl_TxGetParaFormat(ITextHost *iface,
DECLSPEC_HIDDEN HRESULT WINAPI ITextHostImpl_TxGetParaFormat(ITextHost *iface,
const PARAFORMAT **ppPF)
{
return E_NOTIMPL;
}
COLORREF WINAPI ITextHostImpl_TxGetSysColor(ITextHost *iface,
DECLSPEC_HIDDEN COLORREF WINAPI ITextHostImpl_TxGetSysColor(ITextHost *iface,
int nIndex)
{
return GetSysColor(nIndex);
}
HRESULT WINAPI ITextHostImpl_TxGetBackStyle(ITextHost *iface,
DECLSPEC_HIDDEN HRESULT WINAPI ITextHostImpl_TxGetBackStyle(ITextHost *iface,
TXTBACKSTYLE *pStyle)
{
*pStyle = TXTBACK_OPAQUE;
return S_OK;
}
HRESULT WINAPI ITextHostImpl_TxGetMaxLength(ITextHost *iface,
DECLSPEC_HIDDEN HRESULT WINAPI ITextHostImpl_TxGetMaxLength(ITextHost *iface,
DWORD *pLength)
{
*pLength = INFINITE;
return S_OK;
}
HRESULT WINAPI ITextHostImpl_TxGetScrollBars(ITextHost *iface,
DWORD *pdwScrollBar)
DECLSPEC_HIDDEN HRESULT WINAPI ITextHostImpl_TxGetScrollBars(ITextHost *iface, DWORD *pdwScrollBar)
{
ITextHostImpl *This = (ITextHostImpl *)iface;
ITextHostImpl *This = impl_from_ITextHost(iface);
ME_TextEditor *editor = (ME_TextEditor*)GetWindowLongPtrW(This->hWnd, 0);
const DWORD mask = WS_VSCROLL|
WS_HSCROLL|
@ -345,43 +320,41 @@ HRESULT WINAPI ITextHostImpl_TxGetScrollBars(ITextHost *iface,
return S_OK;
}
HRESULT WINAPI ITextHostImpl_TxGetPasswordChar(ITextHost *iface,
DECLSPEC_HIDDEN HRESULT WINAPI ITextHostImpl_TxGetPasswordChar(ITextHost *iface,
WCHAR *pch)
{
*pch = '*';
return S_OK;
}
HRESULT WINAPI ITextHostImpl_TxGetAcceleratorPos(ITextHost *iface,
DECLSPEC_HIDDEN HRESULT WINAPI ITextHostImpl_TxGetAcceleratorPos(ITextHost *iface,
LONG *pch)
{
*pch = -1;
return S_OK;
}
HRESULT WINAPI ITextHostImpl_TxGetExtent(ITextHost *iface,
DECLSPEC_HIDDEN HRESULT WINAPI ITextHostImpl_TxGetExtent(ITextHost *iface,
LPSIZEL lpExtent)
{
return E_NOTIMPL;
}
HRESULT WINAPI ITextHostImpl_OnTxCharFormatChange(ITextHost *iface,
DECLSPEC_HIDDEN HRESULT WINAPI ITextHostImpl_OnTxCharFormatChange(ITextHost *iface,
const CHARFORMATW *pcf)
{
return S_OK;
}
HRESULT WINAPI ITextHostImpl_OnTxParaFormatChange(ITextHost *iface,
DECLSPEC_HIDDEN HRESULT WINAPI ITextHostImpl_OnTxParaFormatChange(ITextHost *iface,
const PARAFORMAT *ppf)
{
return S_OK;
}
HRESULT WINAPI ITextHostImpl_TxGetPropertyBits(ITextHost *iface,
DWORD dwMask,
DWORD *pdwBits)
DECLSPEC_HIDDEN HRESULT WINAPI ITextHostImpl_TxGetPropertyBits(ITextHost *iface, DWORD dwMask, DWORD *pdwBits)
{
ITextHostImpl *This = (ITextHostImpl *)iface;
ITextHostImpl *This = impl_from_ITextHost(iface);
ME_TextEditor *editor = (ME_TextEditor *)GetWindowLongPtrW(This->hWnd, 0);
DWORD style;
DWORD dwBits = 0;
@ -445,11 +418,9 @@ HRESULT WINAPI ITextHostImpl_TxGetPropertyBits(ITextHost *iface,
return S_OK;
}
HRESULT WINAPI ITextHostImpl_TxNotify(ITextHost *iface,
DWORD iNotify,
void *pv)
DECLSPEC_HIDDEN HRESULT WINAPI ITextHostImpl_TxNotify(ITextHost *iface, DWORD iNotify, void *pv)
{
ITextHostImpl *This = (ITextHostImpl *)iface;
ITextHostImpl *This = impl_from_ITextHost(iface);
ME_TextEditor *editor = (ME_TextEditor*)GetWindowLongPtrW(This->hWnd, 0);
HWND hwnd = This->hWnd;
UINT id;
@ -505,23 +476,21 @@ HRESULT WINAPI ITextHostImpl_TxNotify(ITextHost *iface,
return S_OK;
}
HIMC WINAPI ITextHostImpl_TxImmGetContext(ITextHost *iface)
DECLSPEC_HIDDEN HIMC WINAPI ITextHostImpl_TxImmGetContext(ITextHost *iface)
{
ITextHostImpl *This = (ITextHostImpl *)iface;
ITextHostImpl *This = impl_from_ITextHost(iface);
return ImmGetContext(This->hWnd);
}
void WINAPI ITextHostImpl_TxImmReleaseContext(ITextHost *iface,
HIMC himc)
DECLSPEC_HIDDEN void WINAPI ITextHostImpl_TxImmReleaseContext(ITextHost *iface, HIMC himc)
{
ITextHostImpl *This = (ITextHostImpl *)iface;
ITextHostImpl *This = impl_from_ITextHost(iface);
ImmReleaseContext(This->hWnd, himc);
}
HRESULT WINAPI ITextHostImpl_TxGetSelectionBarWidth(ITextHost *iface,
LONG *lSelBarWidth)
DECLSPEC_HIDDEN HRESULT WINAPI ITextHostImpl_TxGetSelectionBarWidth(ITextHost *iface, LONG *lSelBarWidth)
{
ITextHostImpl *This = (ITextHostImpl *)iface;
ITextHostImpl *This = impl_from_ITextHost(iface);
ME_TextEditor *editor = (ME_TextEditor *)GetWindowLongPtrW(This->hWnd, 0);
DWORD style = editor ? editor->styleFlags

View file

@ -54,7 +54,7 @@
WINE_DEFAULT_DEBUG_CHANNEL(richedit);
typedef struct ITextServicesImpl {
const ITextServicesVtbl *lpVtbl;
ITextServices ITextServices_iface;
ITextHost *pMyHost;
LONG ref;
CRITICAL_SECTION csTxtSrv;
@ -85,13 +85,14 @@ HRESULT WINAPI CreateTextServices(IUnknown * pUnkOuter,
ITextImpl->ref = 1;
ITextHost_AddRef(pITextHost);
ITextImpl->pMyHost = pITextHost;
ITextImpl->lpVtbl = &textservices_Vtbl;
ITextImpl->ITextServices_iface.lpVtbl = &textservices_Vtbl;
ITextImpl->editor = ME_MakeEditor(pITextHost, FALSE);
ITextImpl->editor->exStyleFlags = 0;
ITextImpl->editor->rcFormat.left = 0;
ITextImpl->editor->rcFormat.top = 0;
ITextImpl->editor->rcFormat.right = 0;
ITextImpl->editor->rcFormat.bottom = 0;
ME_HandleMessage(ITextImpl->editor, WM_CREATE, 0, 0, TRUE, &hres);
if (pUnkOuter)
@ -100,18 +101,19 @@ HRESULT WINAPI CreateTextServices(IUnknown * pUnkOuter,
return CLASS_E_NOAGGREGATION;
}
*ppUnk = (IUnknown *)ITextImpl;
*ppUnk = (IUnknown *)&ITextImpl->ITextServices_iface;
return S_OK;
}
#define ICOM_THIS_MULTI(impl,field,iface) \
impl* const This=(impl*)((char*)(iface) - offsetof(impl,field))
static HRESULT WINAPI fnTextSrv_QueryInterface(ITextServices * iface,
REFIID riid,
LPVOID * ppv)
static inline ITextServicesImpl *impl_from_ITextServices(ITextServices *iface)
{
ICOM_THIS_MULTI(ITextServicesImpl, lpVtbl, iface);
return CONTAINING_RECORD(iface, ITextServicesImpl, ITextServices_iface);
}
static HRESULT WINAPI fnTextSrv_QueryInterface(ITextServices *iface, REFIID riid, void **ppv)
{
ITextServicesImpl *This = impl_from_ITextServices(iface);
TRACE("(%p/%p)->(%s, %p)\n", This, iface, debugstr_guid(riid), ppv);
*ppv = NULL;
if (IsEqualIID(riid, &IID_IUnknown) || IsEqualIID(riid, &IID_ITextServices))
@ -129,7 +131,7 @@ static HRESULT WINAPI fnTextSrv_QueryInterface(ITextServices * iface,
static ULONG WINAPI fnTextSrv_AddRef(ITextServices *iface)
{
ICOM_THIS_MULTI(ITextServicesImpl, lpVtbl, iface);
ITextServicesImpl *This = impl_from_ITextServices(iface);
DWORD ref = InterlockedIncrement(&This->ref);
TRACE("(%p/%p)->() AddRef from %d\n", This, iface, ref - 1);
@ -138,7 +140,7 @@ static ULONG WINAPI fnTextSrv_AddRef(ITextServices *iface)
static ULONG WINAPI fnTextSrv_Release(ITextServices *iface)
{
ICOM_THIS_MULTI(ITextServicesImpl, lpVtbl, iface);
ITextServicesImpl *This = impl_from_ITextServices(iface);
DWORD ref = InterlockedDecrement(&This->ref);
TRACE("(%p/%p)->() Release from %d\n", This, iface, ref + 1);
@ -153,13 +155,10 @@ static ULONG WINAPI fnTextSrv_Release(ITextServices *iface)
return ref;
}
HRESULT WINAPI fnTextSrv_TxSendMessage(ITextServices *iface,
UINT msg,
WPARAM wparam,
LPARAM lparam,
LRESULT* plresult)
DECLSPEC_HIDDEN HRESULT WINAPI fnTextSrv_TxSendMessage(ITextServices *iface, UINT msg, WPARAM wparam,
LPARAM lparam, LRESULT *plresult)
{
ICOM_THIS_MULTI(ITextServicesImpl, lpVtbl, iface);
ITextServicesImpl *This = impl_from_ITextServices(iface);
HRESULT hresult;
LRESULT lresult;
@ -168,34 +167,22 @@ HRESULT WINAPI fnTextSrv_TxSendMessage(ITextServices *iface,
return hresult;
}
HRESULT WINAPI fnTextSrv_TxDraw(ITextServices *iface,
DWORD dwDrawAspect,
LONG lindex,
void* pvAspect,
DVTARGETDEVICE* ptd,
HDC hdcDraw,
HDC hdcTargetDev,
LPCRECTL lprcBounds,
LPCRECTL lprcWBounds,
LPRECT lprcUpdate,
BOOL (CALLBACK * pfnContinue)(DWORD),
DWORD dwContinue,
DECLSPEC_HIDDEN HRESULT WINAPI fnTextSrv_TxDraw(ITextServices *iface, DWORD dwDrawAspect, LONG lindex,
void *pvAspect, DVTARGETDEVICE *ptd, HDC hdcDraw, HDC hdcTargetDev,
LPCRECTL lprcBounds, LPCRECTL lprcWBounds, LPRECT lprcUpdate,
BOOL (CALLBACK * pfnContinue)(DWORD), DWORD dwContinue,
LONG lViewId)
{
ICOM_THIS_MULTI(ITextServicesImpl, lpVtbl, iface);
ITextServicesImpl *This = impl_from_ITextServices(iface);
FIXME("%p: STUB\n", This);
return E_NOTIMPL;
}
HRESULT WINAPI fnTextSrv_TxGetHScroll(ITextServices *iface,
LONG* plMin,
LONG* plMax,
LONG* plPos,
LONG* plPage,
BOOL* pfEnabled)
DECLSPEC_HIDDEN HRESULT WINAPI fnTextSrv_TxGetHScroll(ITextServices *iface, LONG *plMin, LONG *plMax, LONG *plPos,
LONG *plPage, BOOL *pfEnabled)
{
ICOM_THIS_MULTI(ITextServicesImpl, lpVtbl, iface);
ITextServicesImpl *This = impl_from_ITextServices(iface);
*plMin = This->editor->horz_si.nMin;
*plMax = This->editor->horz_si.nMax;
@ -205,14 +192,10 @@ HRESULT WINAPI fnTextSrv_TxGetHScroll(ITextServices *iface,
return S_OK;
}
HRESULT WINAPI fnTextSrv_TxGetVScroll(ITextServices *iface,
LONG* plMin,
LONG* plMax,
LONG* plPos,
LONG* plPage,
BOOL* pfEnabled)
DECLSPEC_HIDDEN HRESULT WINAPI fnTextSrv_TxGetVScroll(ITextServices *iface, LONG *plMin, LONG *plMax, LONG *plPos,
LONG *plPage, BOOL *pfEnabled)
{
ICOM_THIS_MULTI(ITextServicesImpl, lpVtbl, iface);
ITextServicesImpl *This = impl_from_ITextServices(iface);
*plMin = This->editor->vert_si.nMin;
*plMax = This->editor->vert_si.nMax;
@ -222,76 +205,62 @@ HRESULT WINAPI fnTextSrv_TxGetVScroll(ITextServices *iface,
return S_OK;
}
HRESULT WINAPI fnTextSrv_OnTxSetCursor(ITextServices *iface,
DWORD dwDrawAspect,
LONG lindex,
void* pvAspect,
DVTARGETDEVICE* ptd,
HDC hdcDraw,
HDC hicTargetDev,
LPCRECT lprcClient,
INT x, INT y)
DECLSPEC_HIDDEN HRESULT WINAPI fnTextSrv_OnTxSetCursor(ITextServices *iface, DWORD dwDrawAspect, LONG lindex,
void *pvAspect, DVTARGETDEVICE *ptd, HDC hdcDraw,
HDC hicTargetDev, LPCRECT lprcClient, INT x, INT y)
{
ICOM_THIS_MULTI(ITextServicesImpl, lpVtbl, iface);
ITextServicesImpl *This = impl_from_ITextServices(iface);
FIXME("%p: STUB\n", This);
return E_NOTIMPL;
}
HRESULT WINAPI fnTextSrv_TxQueryHitPoint(ITextServices *iface,
DWORD dwDrawAspect,
LONG lindex,
void* pvAspect,
DVTARGETDEVICE* ptd,
HDC hdcDraw,
HDC hicTargetDev,
LPCRECT lprcClient,
INT x, INT y,
DWORD* pHitResult)
DECLSPEC_HIDDEN HRESULT WINAPI fnTextSrv_TxQueryHitPoint(ITextServices *iface, DWORD dwDrawAspect, LONG lindex,
void *pvAspect, DVTARGETDEVICE *ptd, HDC hdcDraw,
HDC hicTargetDev, LPCRECT lprcClient, INT x, INT y,
DWORD *pHitResult)
{
ICOM_THIS_MULTI(ITextServicesImpl, lpVtbl, iface);
ITextServicesImpl *This = impl_from_ITextServices(iface);
FIXME("%p: STUB\n", This);
return E_NOTIMPL;
}
HRESULT WINAPI fnTextSrv_OnTxInplaceActivate(ITextServices *iface,
LPCRECT prcClient)
DECLSPEC_HIDDEN HRESULT WINAPI fnTextSrv_OnTxInplaceActivate(ITextServices *iface, LPCRECT prcClient)
{
ICOM_THIS_MULTI(ITextServicesImpl, lpVtbl, iface);
ITextServicesImpl *This = impl_from_ITextServices(iface);
FIXME("%p: STUB\n", This);
return E_NOTIMPL;
}
HRESULT WINAPI fnTextSrv_OnTxInplaceDeactivate(ITextServices *iface)
DECLSPEC_HIDDEN HRESULT WINAPI fnTextSrv_OnTxInplaceDeactivate(ITextServices *iface)
{
ICOM_THIS_MULTI(ITextServicesImpl, lpVtbl, iface);
ITextServicesImpl *This = impl_from_ITextServices(iface);
FIXME("%p: STUB\n", This);
return E_NOTIMPL;
}
HRESULT WINAPI fnTextSrv_OnTxUIActivate(ITextServices *iface)
DECLSPEC_HIDDEN HRESULT WINAPI fnTextSrv_OnTxUIActivate(ITextServices *iface)
{
ICOM_THIS_MULTI(ITextServicesImpl, lpVtbl, iface);
ITextServicesImpl *This = impl_from_ITextServices(iface);
FIXME("%p: STUB\n", This);
return E_NOTIMPL;
}
HRESULT WINAPI fnTextSrv_OnTxUIDeactivate(ITextServices *iface)
DECLSPEC_HIDDEN HRESULT WINAPI fnTextSrv_OnTxUIDeactivate(ITextServices *iface)
{
ICOM_THIS_MULTI(ITextServicesImpl, lpVtbl, iface);
ITextServicesImpl *This = impl_from_ITextServices(iface);
FIXME("%p: STUB\n", This);
return E_NOTIMPL;
}
HRESULT WINAPI fnTextSrv_TxGetText(ITextServices *iface,
BSTR* pbstrText)
DECLSPEC_HIDDEN HRESULT WINAPI fnTextSrv_TxGetText(ITextServices *iface, BSTR *pbstrText)
{
ICOM_THIS_MULTI(ITextServicesImpl, lpVtbl, iface);
ITextServicesImpl *This = impl_from_ITextServices(iface);
int length;
length = ME_GetTextLength(This->editor);
@ -313,10 +282,9 @@ HRESULT WINAPI fnTextSrv_TxGetText(ITextServices *iface,
return S_OK;
}
HRESULT WINAPI fnTextSrv_TxSetText(ITextServices *iface,
LPCWSTR pszText)
DECLSPEC_HIDDEN HRESULT WINAPI fnTextSrv_TxSetText(ITextServices *iface, LPCWSTR pszText)
{
ICOM_THIS_MULTI(ITextServicesImpl, lpVtbl, iface);
ITextServicesImpl *This = impl_from_ITextServices(iface);
ME_Cursor cursor;
ME_SetCursorToStart(This->editor, &cursor);
@ -328,69 +296,56 @@ HRESULT WINAPI fnTextSrv_TxSetText(ITextServices *iface,
This->editor->nModifyStep = 0;
OleFlushClipboard();
ME_EmptyUndoStack(This->editor);
ME_UpdateRepaint(This->editor);
ME_UpdateRepaint(This->editor, FALSE);
return S_OK;
}
HRESULT WINAPI fnTextSrv_TxGetCurrentTargetX(ITextServices *iface,
LONG* x)
DECLSPEC_HIDDEN HRESULT WINAPI fnTextSrv_TxGetCurrentTargetX(ITextServices *iface, LONG *x)
{
ICOM_THIS_MULTI(ITextServicesImpl, lpVtbl, iface);
ITextServicesImpl *This = impl_from_ITextServices(iface);
FIXME("%p: STUB\n", This);
return E_NOTIMPL;
}
HRESULT WINAPI fnTextSrv_TxGetBaseLinePos(ITextServices *iface,
LONG* x)
DECLSPEC_HIDDEN HRESULT WINAPI fnTextSrv_TxGetBaseLinePos(ITextServices *iface, LONG *x)
{
ICOM_THIS_MULTI(ITextServicesImpl, lpVtbl, iface);
ITextServicesImpl *This = impl_from_ITextServices(iface);
FIXME("%p: STUB\n", This);
return E_NOTIMPL;
}
HRESULT WINAPI fnTextSrv_TxGetNaturalSize(ITextServices *iface,
DWORD dwAspect,
HDC hdcDraw,
HDC hicTargetDev,
DVTARGETDEVICE* ptd,
DWORD dwMode,
const SIZEL* psizelExtent,
LONG* pwidth,
LONG* pheight)
DECLSPEC_HIDDEN HRESULT WINAPI fnTextSrv_TxGetNaturalSize(ITextServices *iface, DWORD dwAspect, HDC hdcDraw,
HDC hicTargetDev, DVTARGETDEVICE *ptd, DWORD dwMode,
const SIZEL *psizelExtent, LONG *pwidth, LONG *pheight)
{
ICOM_THIS_MULTI(ITextServicesImpl, lpVtbl, iface);
ITextServicesImpl *This = impl_from_ITextServices(iface);
FIXME("%p: STUB\n", This);
return E_NOTIMPL;
}
HRESULT WINAPI fnTextSrv_TxGetDropTarget(ITextServices *iface,
IDropTarget** ppDropTarget)
DECLSPEC_HIDDEN HRESULT WINAPI fnTextSrv_TxGetDropTarget(ITextServices *iface, IDropTarget **ppDropTarget)
{
ICOM_THIS_MULTI(ITextServicesImpl, lpVtbl, iface);
ITextServicesImpl *This = impl_from_ITextServices(iface);
FIXME("%p: STUB\n", This);
return E_NOTIMPL;
}
HRESULT WINAPI fnTextSrv_OnTxPropertyBitsChange(ITextServices *iface,
DWORD dwMask,
DWORD dwBits)
DECLSPEC_HIDDEN HRESULT WINAPI fnTextSrv_OnTxPropertyBitsChange(ITextServices *iface, DWORD dwMask, DWORD dwBits)
{
ICOM_THIS_MULTI(ITextServicesImpl, lpVtbl, iface);
ITextServicesImpl *This = impl_from_ITextServices(iface);
FIXME("%p: STUB\n", This);
return E_NOTIMPL;
}
HRESULT WINAPI fnTextSrv_TxGetCachedSize(ITextServices *iface,
DWORD* pdwWidth,
DWORD* pdwHeight)
DECLSPEC_HIDDEN HRESULT WINAPI fnTextSrv_TxGetCachedSize(ITextServices *iface, DWORD *pdwWidth, DWORD *pdwHeight)
{
ICOM_THIS_MULTI(ITextServicesImpl, lpVtbl, iface);
ITextServicesImpl *This = impl_from_ITextServices(iface);
FIXME("%p: STUB\n", This);
return E_NOTIMPL;

View file

@ -206,7 +206,7 @@ void ME_CommitUndo(ME_TextEditor *editor) {
}
/**
* Groups supsequent changes with previous ones for an undo if coalescing.
* Groups subsequent changes with previous ones for an undo if coalescing.
*
* Has no effect if the previous changes were followed by a ME_CommitUndo. This
* function will only have an affect if the previous changes were followed by
@ -336,7 +336,7 @@ static void ME_PlayUndoItem(ME_TextEditor *editor, ME_DisplayItem *pItem)
int paraFlags = pItem->member.para.nFlags & (MEPF_ROWSTART|MEPF_CELL|MEPF_ROWEND);
ME_CursorFromCharOfs(editor, pUItem->nStart, &tmp);
if (tmp.nOffset)
tmp.pRun = ME_SplitRunSimple(editor, tmp.pRun, tmp.nOffset);
ME_SplitRunSimple(editor, &tmp);
assert(pUItem->eol_str);
this_para = tmp.pPara;
bFixRowStart = this_para->member.para.nFlags & MEPF_ROWSTART;
@ -402,7 +402,7 @@ BOOL ME_Undo(ME_TextEditor *editor) {
ME_CheckTablesForCorruption(editor);
editor->nUndoStackSize--;
editor->nUndoMode = nMode;
ME_UpdateRepaint(editor);
ME_UpdateRepaint(editor, FALSE);
return TRUE;
}
@ -438,6 +438,6 @@ BOOL ME_Redo(ME_TextEditor *editor) {
ME_AddUndoItem(editor, diUndoEndTransaction, NULL);
ME_CheckTablesForCorruption(editor);
editor->nUndoMode = nMode;
ME_UpdateRepaint(editor);
ME_UpdateRepaint(editor, FALSE);
return TRUE;
}

View file

@ -271,7 +271,7 @@ static ME_DisplayItem *ME_SplitByBacktracking(ME_WrapContext *wc, ME_DisplayItem
{
if (wc->pLastSplittableRun->member.run.nFlags & (MERF_GRAPHICS|MERF_TAB))
{
wc->pt = wc->ptLastSplittableRun;
wc->pt = wc->pLastSplittableRun->member.run.pt;
return wc->pLastSplittableRun;
}
else if (wc->pLastSplittableRun->member.run.nFlags & MERF_SPLITTABLE)
@ -299,7 +299,7 @@ static ME_DisplayItem *ME_SplitByBacktracking(ME_WrapContext *wc, ME_DisplayItem
else
{
/* restart from the first run beginning with spaces */
wc->pt = wc->ptLastSplittableRun;
wc->pt = wc->pLastSplittableRun->member.run.pt;
return wc->pLastSplittableRun;
}
}
@ -349,7 +349,6 @@ static ME_DisplayItem *ME_WrapHandleRun(ME_WrapContext *wc, ME_DisplayItem *p)
return p->next;
if (run->nFlags & MERF_WHITESPACE) {
p->member.run.nFlags |= MERF_SKIPPED;
wc->pt.x += run->nWidth;
/* skip runs consisting of only whitespaces */
return p->next;
@ -362,7 +361,9 @@ static ME_DisplayItem *ME_WrapHandleRun(ME_WrapContext *wc, ME_DisplayItem *p)
if (black) {
wc->bOverflown = FALSE;
pp = ME_SplitRun(wc, p, black);
p->member.run.nFlags |= MERF_SKIPPED;
ME_CalcRunExtent(wc->context, &wc->pPara->member.para,
wc->nRow ? wc->nLeftMargin : wc->nFirstMargin,
&pp->member.run);
ME_InsertRowStart(wc, pp);
return pp;
}
@ -451,7 +452,6 @@ static ME_DisplayItem *ME_WrapHandleRun(ME_WrapContext *wc, ME_DisplayItem *p)
|| ((run->nFlags & (MERF_GRAPHICS|MERF_TAB)) && (p != wc->pRowStart)))
{
wc->pLastSplittableRun = p;
wc->ptLastSplittableRun = wc->pt;
}
wc->pt.x += run->nWidth;
return p->next;
@ -480,7 +480,32 @@ static int ME_GetParaLineSpace(ME_Context* c, ME_Paragraph* para)
return sp * c->editor->nZoomNumerator / c->editor->nZoomDenominator;
}
static void ME_PrepareParagraphForWrapping(ME_Context *c, ME_DisplayItem *tp);
static void ME_PrepareParagraphForWrapping(ME_Context *c, ME_DisplayItem *tp) {
ME_DisplayItem *p;
tp->member.para.nWidth = 0;
/* remove row start items as they will be reinserted by the
* paragraph wrapper anyway */
tp->member.para.nRows = 0;
for (p = tp->next; p != tp->member.para.next_para; p = p->next) {
if (p->type == diStartRow) {
ME_DisplayItem *pRow = p;
p = p->prev;
ME_Remove(pRow);
ME_DestroyDisplayItem(pRow);
}
}
/* join runs that can be joined */
for (p = tp->next; p != tp->member.para.next_para; p = p->next) {
assert(p->type != diStartRow); /* should have been deleted above */
if (p->type == diRun) {
while (p->next->type == diRun && /* FIXME */
ME_CanJoinRuns(&p->member.run, &p->next->member.run)) {
ME_JoinRuns(c->editor, p);
}
}
}
}
static void ME_WrapTextParagraph(ME_Context *c, ME_DisplayItem *tp) {
ME_DisplayItem *p;
@ -558,45 +583,6 @@ static void ME_WrapTextParagraph(ME_Context *c, ME_DisplayItem *tp) {
tp->member.para.nRows = wc.nRow;
}
static void ME_PrepareParagraphForWrapping(ME_Context *c, ME_DisplayItem *tp) {
ME_DisplayItem *p, *pRow;
tp->member.para.nWidth = 0;
/* 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:
pRow = p;
p = p->prev;
ME_Remove(pRow);
ME_DestroyDisplayItem(pRow);
break;
default:
break;
}
}
/* join runs that can be joined, set up flags */
for (p = tp->next; p!=tp->member.para.next_para; p = p->next) {
switch(p->type) {
case diStartRow: assert(0); break; /* should have deleted it */
case diRun:
while (p->next->type == diRun) { /* FIXME */
if (ME_CanJoinRuns(&p->member.run, &p->next->member.run)) {
ME_JoinRuns(c->editor, p);
}
else
break;
}
p->member.run.nFlags &= ~MERF_CALCBYWRAP;
break;
default:
break;
}
}
}
BOOL ME_WrapMarkedParagraphs(ME_TextEditor *editor)
{
ME_DisplayItem *item;

View file

@ -54,7 +54,7 @@ ME_StreamOutFlush(ME_OutStream *pStream)
LONG nRemaining = 0;
EDITSTREAM *stream = pStream->stream;
do {
while (nStart < pStream->pos) {
TRACE("sending %u bytes\n", pStream->pos - nStart);
/* Some apps seem not to set *pcb unless a problem arises, relying
on initial random nWritten value, which is usually >STREAMOUT_BUFFER_SIZE */
@ -72,7 +72,7 @@ ME_StreamOutFlush(ME_OutStream *pStream)
return FALSE;
pStream->written += nWritten;
nStart += nWritten;
} while (nStart < pStream->pos);
}
pStream->pos = 0;
return TRUE;
}
@ -927,7 +927,7 @@ static BOOL ME_StreamOutText(ME_TextEditor *editor, ME_OutStream *pStream,
if (!editor->bEmulateVersion10 && cursor.pRun->member.run.nFlags & MERF_ENDPARA)
{
static const WCHAR szEOL[2] = { '\r', '\n' };
static const WCHAR szEOL[] = { '\r', '\n' };
/* richedit 2.0 - all line breaks are \r\n */
if (dwFormat & SF_UNICODE)

View file

@ -138,7 +138,7 @@ reactos/dll/win32/pstorec # Synced to Wine-1.3.37
reactos/dll/win32/query # Synced to Wine-1.3.37
reactos/dll/win32/rasapi32 # Synced to Wine-1.3.37
reactos/dll/win32/resutils # Autosync
reactos/dll/win32/riched20 # Autosync
reactos/dll/win32/riched20 # Synced to Wine-1.3.37
reactos/dll/win32/riched32 # Autosync
reactos/dll/win32/rpcrt4 # Synced to Wine-1.3.26
reactos/dll/win32/rsabase # Autosync