Dylan Smith : richedit: Implemented ITextServices_TxSendMessage.

Alexandre Julliard julliard at winehq.org
Wed Jan 21 06:39:45 CST 2009


Module: wine
Branch: master
Commit: e7b68a20fd78d3f5a082d5b00cf8ee7c031ccbda
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=e7b68a20fd78d3f5a082d5b00cf8ee7c031ccbda

Author: Dylan Smith <dylan.ah.smith at gmail.com>
Date:   Tue Jan 20 01:41:40 2009 -0500

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 80e808e..6d4a2a9 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 cd2312b..09f3fb3 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 6c93385..53d6295 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 b7b909b..3980400 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<HFONT_CACHE_SIZE; i++)
diff --git a/dlls/riched20/txtsrv.c b/dlls/riched20/txtsrv.c
index d4679f7..f05e721 100644
--- a/dlls/riched20/txtsrv.c
+++ b/dlls/riched20/txtsrv.c
@@ -57,6 +57,7 @@ typedef struct ITextServicesImpl {
    ITextHost *pMyHost;
    LONG ref;
    CRITICAL_SECTION csTxtSrv;
+   ME_TextEditor *editor;
    char spare[256];
 } ITextServicesImpl;
 
@@ -70,6 +71,7 @@ HRESULT WINAPI CreateTextServices(IUnknown  * pUnkOuter,
                                   IUnknown  **ppUnk)
 {
    ITextServicesImpl *ITextImpl;
+   HRESULT hres;
    TRACE("%p %p --> %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,




More information about the wine-cvs mailing list