From e7b68a20fd78d3f5a082d5b00cf8ee7c031ccbda Mon Sep 17 00:00:00 2001 From: Dylan Smith Date: Tue, 20 Jan 2009 01:41:40 -0500 Subject: [PATCH] richedit: Implemented ITextServices_TxSendMessage. --- dlls/riched20/context.c | 8 ++++++-- dlls/riched20/editor.c | 2 +- dlls/riched20/editor.h | 2 ++ dlls/riched20/style.c | 2 -- dlls/riched20/txtsrv.c | 9 +++++++-- 5 files changed, 16 insertions(+), 7 deletions(-) diff --git a/dlls/riched20/context.c b/dlls/riched20/context.c index 80e808ecf66..6d4a2a93580 100644 --- a/dlls/riched20/context.c +++ b/dlls/riched20/context.c @@ -29,8 +29,12 @@ void ME_InitContext(ME_Context *c, ME_TextEditor *editor, HDC hDC) c->pt.y = 0; c->hbrMargin = CreateSolidBrush(RGB(224,224,224)); c->rcView = editor->rcFormat; - c->dpi.cx = GetDeviceCaps(hDC, LOGPIXELSX); - c->dpi.cy = GetDeviceCaps(hDC, LOGPIXELSY); + if (hDC) { + c->dpi.cx = GetDeviceCaps(hDC, LOGPIXELSX); + c->dpi.cy = GetDeviceCaps(hDC, LOGPIXELSY); + } else { + c->dpi.cx = c->dpi.cy = 96; + } } void ME_DestroyContext(ME_Context *c) diff --git a/dlls/riched20/editor.c b/dlls/riched20/editor.c index cd2312b2406..09f3fb3701e 100644 --- a/dlls/riched20/editor.c +++ b/dlls/riched20/editor.c @@ -3024,7 +3024,7 @@ void ME_LinkNotify(ME_TextEditor *editor, UINT msg, WPARAM wParam, LPARAM lParam * The LRESULT that is returned is a return value for window procs, * and the phresult parameter is the COM return code needed by the * text services interface. */ -static LRESULT ME_HandleMessage(ME_TextEditor *editor, UINT msg, WPARAM wParam, +LRESULT ME_HandleMessage(ME_TextEditor *editor, UINT msg, WPARAM wParam, LPARAM lParam, BOOL unicode, HRESULT* phresult) { *phresult = S_OK; diff --git a/dlls/riched20/editor.h b/dlls/riched20/editor.h index 6c9338592fc..53d6295c9b6 100644 --- a/dlls/riched20/editor.h +++ b/dlls/riched20/editor.h @@ -262,6 +262,8 @@ void ME_DeleteReObject(REOBJECT* reo); /* editor.c */ ME_TextEditor *ME_MakeEditor(ITextHost *texthost, BOOL bEmulateVersion10); +LRESULT ME_HandleMessage(ME_TextEditor *editor, UINT msg, WPARAM wParam, + LPARAM lParam, BOOL unicode, HRESULT* phresult); void ME_SendOldNotify(ME_TextEditor *editor, int nCode); int ME_GetTextW(ME_TextEditor *editor, WCHAR *buffer, int nStart, int nChars, BOOL bCRLF); ME_DisplayItem *ME_FindItemAtOffset(ME_TextEditor *editor, ME_DIType nItemType, int nOffset, int *nItemOffset); diff --git a/dlls/riched20/style.c b/dlls/riched20/style.c index b7b909b186e..3980400fb65 100644 --- a/dlls/riched20/style.c +++ b/dlls/riched20/style.c @@ -373,7 +373,6 @@ HFONT ME_SelectStyleFont(ME_Context *c, ME_Style *s) LOGFONTW lf; int i, nEmpty, nAge = 0x7FFFFFFF; ME_FontCacheItem *item; - assert(c->hDC); assert(s); ME_LogFontFromStyle(c, &lf, s); @@ -426,7 +425,6 @@ void ME_UnselectStyleFont(ME_Context *c, ME_Style *s, HFONT hOldFont) { int i; - assert(c->hDC); assert(s); SelectObject(c->hDC, hOldFont); for (i=0; i %p\n", pUnkOuter, pITextHost, ppUnk); if (pITextHost == NULL) return E_POINTER; @@ -83,6 +85,8 @@ HRESULT WINAPI CreateTextServices(IUnknown * pUnkOuter, ITextHost_AddRef(pITextHost); ITextImpl->pMyHost = pITextHost; ITextImpl->lpVtbl = &textservices_Vtbl; + ITextImpl->editor = ME_MakeEditor(pITextHost, FALSE); + ME_HandleMessage(ITextImpl->editor, WM_CREATE, 0, 0, TRUE, &hres); if (pUnkOuter) { @@ -150,9 +154,10 @@ HRESULT WINAPI fnTextSrv_TxSendMessage(ITextServices *iface, LRESULT* plresult) { ICOM_THIS_MULTI(ITextServicesImpl, lpVtbl, iface); + HRESULT hresult; - FIXME("%p: STUB\n", This); - return E_NOTIMPL; + *plresult = ME_HandleMessage(This->editor, msg, wparam, lparam, TRUE, &hresult); + return hresult; } HRESULT WINAPI fnTextSrv_TxDraw(ITextServices *iface,