#include <ObjBase.h>\r
\r
#ifdef DEBUG_IME\r
-#define DebugLog(fmt, ...) CUtils::Log(fmt, __VA_ARGS__)\r
+#define DebugLog(fmt, ...) CUtils::Log(_T(__FUNCTION__ ## ": " ## fmt), __VA_ARGS__)\r
#else\r
#define DebugLog(fmt, ...)\r
#endif\r
return;\r
HRESULT hr = CoInitializeEx(nullptr, COINIT_APARTMENTTHREADED);\r
if (FAILED(hr)) {\r
- DebugLog(_T("CoInitializeEx failed."));\r
+ DebugLog("CoInitializeEx failed.");\r
return;\r
}\r
if (hr == S_FALSE)\r
CoUninitialize();\r
ITfThreadMgr *thread;\r
if (FAILED(CoCreateInstance(CLSID_TF_ThreadMgr, nullptr, CLSCTX_INPROC_SERVER, IID_PPV_ARGS(&thread)))) {\r
- DebugLog(_T("CoCreateInstance for ThreadMgr failed."));\r
+ DebugLog("CoCreateInstance for ThreadMgr failed.");\r
return;\r
}\r
TSFHandler *tsfh = new TSFHandler();\r
tsfh->m_ThreadMgr = thread;\r
ITfSource *src;\r
if (FAILED(thread->QueryInterface(&src))) {\r
- DebugLog(_T("ThreadMgr->QueryInterface failed."));\r
+ DebugLog("ThreadMgr->QueryInterface failed.");\r
goto fail;\r
}\r
DWORD cookie;\r
if (FAILED(src->AdviseSink(IID_ITfThreadMgrEventSink, static_cast<ITfThreadMgrEventSink *>(tsfh), &cookie))) {\r
- DebugLog(_T("Souece->AdviseSink failed."));\r
+ DebugLog("Souece->AdviseSink failed.");\r
src->Release();\r
goto fail;\r
}\r
// ITfThreadMgrEventSink\r
STDMETHODIMP TSFHandler::OnInitDocumentMgr(ITfDocumentMgr *)\r
{\r
- DebugLog(_T("OnInitDocumentMgr"));\r
+ DebugLog("OnInitDocumentMgr");\r
return S_OK;\r
}\r
\r
STDMETHODIMP TSFHandler::OnPopContext(ITfContext *)\r
{\r
- DebugLog(_T("OnPopContext"));\r
+ DebugLog("OnPopContext");\r
return S_OK;\r
}\r
\r
STDMETHODIMP TSFHandler::OnPushContext(ITfContext *)\r
{\r
- DebugLog(_T("OnPushContext"));\r
+ DebugLog("OnPushContext");\r
return S_OK;\r
}\r
\r
STDMETHODIMP TSFHandler::OnSetFocus(ITfDocumentMgr *docMgr, ITfDocumentMgr *)\r
{\r
- DebugLog(_T("OnSetFocus"));\r
+ DebugLog("OnSetFocus");\r
if (docMgr == nullptr)\r
return S_OK;\r
if (m_Cookie != TF_INVALID_COOKIE) {\r
ITfSource *src;\r
if (FAILED(m_Context->QueryInterface(&src))) {\r
- DebugLog(_T("Context->QueryInterface:0 failed."));\r
+ DebugLog("Context->QueryInterface:0 failed.");\r
return S_OK;\r
}\r
HRESULT hr = src->UnadviseSink(m_Cookie);\r
src->Release();\r
if (FAILED(hr)) {\r
- DebugLog(_T("Source->UnadviceThink failed."));\r
+ DebugLog("Source->UnadviceThink failed.");\r
return S_OK;\r
}\r
m_Context->Release();\r
}\r
ITfContext *cxt;\r
if (FAILED(docMgr->GetTop(&cxt))) {\r
- DebugLog(_T("DocumentMgr->GetTop failed."));\r
+ DebugLog("DocumentMgr->GetTop failed.");\r
return S_OK;\r
}\r
if (cxt == nullptr) {\r
- DebugLog(_T("ITfContext is null."));\r
+ DebugLog("ITfContext is null.");\r
return S_OK;\r
}\r
ITfSource *src;\r
if (FAILED(cxt->QueryInterface(&src))) {\r
- DebugLog(_T("Context->QueryInterface:1 failed."));\r
+ DebugLog("Context->QueryInterface:1 failed.");\r
goto fail;\r
}\r
if (FAILED(src->AdviseSink(IID_ITfTextEditSink, static_cast<ITfTextEditSink *>(this), &m_Cookie))) {\r
- DebugLog(_T("Source->AdviseSink(ITfTextEditSink) failed."));\r
+ DebugLog("Source->AdviseSink(ITfTextEditSink) failed.");\r
src->Release();\r
goto fail;\r
}\r
\r
STDMETHODIMP TSFHandler::OnUninitDocumentMgr(ITfDocumentMgr *)\r
{\r
- DebugLog(_T("OnUninitDocumentMgr"));\r
+ DebugLog("OnUninitDocumentMgr");\r
return S_OK;\r
}\r
\r
STDMETHODIMP TSFHandler::OnEndEdit(ITfContext *cxt, TfEditCookie, ITfEditRecord *)\r
{\r
- DebugLog(_T("OnEndEdit"));\r
+ DebugLog("OnEndEdit");\r
ITfContextComposition *comp;\r
if (FAILED(cxt->QueryInterface(&comp))) {\r
- DebugLog(_T("Context->QueryInterface(ITfContextComposition) failed."));\r
+ DebugLog("Context->QueryInterface(ITfContextComposition) failed.");\r
return S_OK;\r
}\r
IEnumITfCompositionView *enumCompView;\r
if (FAILED(comp->EnumCompositions(&enumCompView))) {\r
- DebugLog(_T("ContextComposition->EnumCompositions failed."));\r
+ DebugLog("ContextComposition->EnumCompositions failed.");\r
goto fail;\r
}\r
ITfCompositionView *view;\r
ULONG fetched;\r
HRESULT hr = enumCompView->Next(1, &view, &fetched);\r
if (FAILED(hr)) {\r
- DebugLog(_T("EnumCompositions->Next failed."));\r
+ DebugLog("EnumCompositions->Next failed.");\r
enumCompView->Release();\r
goto fail;\r
}\r
- DebugLog(_T("EnumComposition->Next succeeded. fetched=%d"), fetched);\r
+ DebugLog("EnumComposition->Next succeeded. fetched=%d", fetched);\r
if (fetched) {\r
if (!m_CompositionState)\r
CXkeymacsDll::SetIMEState(true);\r