mirror of
https://github.com/reactos/reactos.git
synced 2025-08-05 06:02:59 +00:00
[MSCTF][CICERO][DOC] Fork MSCTF from Wine (#8245)
JIRA issue: CORE-19361 - Delete msctf.c and add msctf.cpp. - Modify precomp.h and enable precompiled header. - Modify media/doc/WINESYNC.txt. - Add cicMemReCalloc function to cicero.
This commit is contained in:
parent
853b446e38
commit
a18a5734ac
22 changed files with 539 additions and 759 deletions
|
@ -6,56 +6,40 @@
|
|||
* Copyright 2025 Katayama Hirofumi MZ <katayama.hirofumi.mz@gmail.com>
|
||||
*/
|
||||
|
||||
#include <initguid.h>
|
||||
#include <windef.h>
|
||||
#include <winbase.h>
|
||||
#include <winreg.h>
|
||||
#include <msctf.h>
|
||||
#include <msctf_undoc.h>
|
||||
|
||||
// Cicero
|
||||
#include <cicbase.h>
|
||||
#include <cicreg.h>
|
||||
#include <cicutb.h>
|
||||
|
||||
class CInputContext;
|
||||
#include "precomp.h"
|
||||
#include "range.h"
|
||||
#include "msctf_internal.h"
|
||||
|
||||
#include <wine/debug.h>
|
||||
WINE_DEFAULT_DEBUG_CHANNEL(msctf);
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
// CRange
|
||||
|
||||
CRange::CRange(
|
||||
_In_ ITfContext *context,
|
||||
_In_ ITextStoreACP *textstore,
|
||||
_In_ DWORD lockType,
|
||||
_In_ TfAnchor anchorStart,
|
||||
_In_ TfAnchor anchorEnd
|
||||
)
|
||||
: m_pContext(context)
|
||||
, m_pTextStore(textstore)
|
||||
, m_dwLockType(lockType)
|
||||
: m_cRefs(1)
|
||||
, m_context(context)
|
||||
, m_anchorStart(anchorStart)
|
||||
, m_anchorEnd(anchorEnd)
|
||||
, m_dwCookie(MAXDWORD)
|
||||
, m_cRefs(1)
|
||||
{
|
||||
if (context)
|
||||
context->AddRef();
|
||||
}
|
||||
|
||||
CRange::~CRange()
|
||||
{
|
||||
TRACE("destroying %p\n", this);
|
||||
if (m_context)
|
||||
m_context->Release();
|
||||
}
|
||||
|
||||
CRange *CRange::_Clone()
|
||||
{
|
||||
CRange *pRange = new(cicNoThrow) CRange(m_pContext, m_pTextStore, m_dwLockType,
|
||||
m_anchorStart, m_anchorEnd);
|
||||
CRange *pRange = new(cicNoThrow) CRange(m_context, m_anchorStart, m_anchorEnd);
|
||||
if (!pRange)
|
||||
return NULL;
|
||||
pRange->m_dwCookie = m_dwCookie;
|
||||
return pRange;
|
||||
}
|
||||
|
||||
|
@ -90,24 +74,19 @@ HRESULT CRange::TF_SELECTION_to_TS_SELECTION_ACP(const TF_SELECTION *tf, TS_SELE
|
|||
return S_OK;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
// ** IUnknown methods **
|
||||
|
||||
STDMETHODIMP CRange::QueryInterface(REFIID riid, void **ppvObj)
|
||||
{
|
||||
if (IsEqualGUID(riid, IID_PRIV_CRANGE))
|
||||
if (riid == IID_PRIV_CRANGE)
|
||||
{
|
||||
*ppvObj = this;
|
||||
return S_OK; // No AddRef
|
||||
}
|
||||
|
||||
if (IsEqualGUID(riid, IID_ITfRange) || IsEqualGUID(riid, IID_IUnknown))
|
||||
*ppvObj = this;
|
||||
else if (IsEqualGUID(riid, IID_ITfRangeACP))
|
||||
if (riid == IID_IUnknown || riid == IID_ITfRange || riid == IID_ITfRangeACP)
|
||||
*ppvObj = static_cast<ITfRangeACP *>(this);
|
||||
else if (IsEqualGUID(riid, IID_ITfRangeAnchor))
|
||||
else if (riid == IID_ITfRangeAnchor)
|
||||
*ppvObj = static_cast<ITfRangeAnchor *>(this);
|
||||
else if (IsEqualGUID(riid, IID_ITfSource))
|
||||
else if (riid == IID_ITfSource)
|
||||
*ppvObj = static_cast<ITfSource *>(this);
|
||||
else
|
||||
*ppvObj = NULL;
|
||||
|
@ -118,30 +97,25 @@ STDMETHODIMP CRange::QueryInterface(REFIID riid, void **ppvObj)
|
|||
return S_OK;
|
||||
}
|
||||
|
||||
ERR("E_NOINTERFACE: %s\n", wine_dbgstr_guid(&riid));
|
||||
WARN("unsupported interface: %s\n", debugstr_guid(&riid));
|
||||
return E_NOINTERFACE;
|
||||
}
|
||||
|
||||
STDMETHODIMP_(ULONG) CRange::AddRef()
|
||||
{
|
||||
TRACE("%p -> ()\n", this);
|
||||
return InterlockedIncrement(&m_cRefs);
|
||||
return ::InterlockedIncrement(&m_cRefs);
|
||||
}
|
||||
|
||||
STDMETHODIMP_(ULONG) CRange::Release()
|
||||
{
|
||||
TRACE("%p -> ()\n", this);
|
||||
if (InterlockedDecrement(&m_cRefs) == 0)
|
||||
{
|
||||
ULONG ret = InterlockedDecrement(&m_cRefs);
|
||||
if (!ret)
|
||||
delete this;
|
||||
return 0;
|
||||
}
|
||||
return m_cRefs;
|
||||
return ret;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
// ** ITfRange methods **
|
||||
|
||||
STDMETHODIMP CRange::GetText(
|
||||
_In_ TfEditCookie ec,
|
||||
_In_ DWORD dwFlags,
|
||||
|
@ -351,9 +325,6 @@ STDMETHODIMP CRange::GetContext(
|
|||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
// ** ITfRangeACP methods **
|
||||
|
||||
STDMETHODIMP CRange::GetExtent(_Out_ LONG *pacpAnchor, _Out_ LONG *pcch)
|
||||
{
|
||||
FIXME("\n");
|
||||
|
@ -366,9 +337,6 @@ STDMETHODIMP CRange::SetExtent(_In_ LONG acpAnchor, _In_ LONG cch)
|
|||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
// ** ITfRangeAnchor methods **
|
||||
|
||||
STDMETHODIMP CRange::GetExtent(_Out_ IAnchor **ppStart, _Out_ IAnchor **ppEnd)
|
||||
{
|
||||
FIXME("\n");
|
||||
|
@ -381,9 +349,6 @@ STDMETHODIMP CRange::SetExtent(_In_ IAnchor *pAnchorStart, _In_ IAnchor *pAnchor
|
|||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
// ** ITfSource methods **
|
||||
|
||||
STDMETHODIMP CRange::AdviseSink(
|
||||
_In_ REFIID riid,
|
||||
_In_ IUnknown *punk,
|
||||
|
@ -404,11 +369,9 @@ STDMETHODIMP CRange::UnadviseSink(
|
|||
|
||||
EXTERN_C
|
||||
HRESULT
|
||||
Range_Constructor(ITfContext *context, ITextStoreACP *textstore,
|
||||
DWORD lockType, DWORD anchorStart, DWORD anchorEnd, ITfRange **ppOut)
|
||||
Range_Constructor(ITfContext *context, DWORD anchorStart, DWORD anchorEnd, ITfRange **ppOut)
|
||||
{
|
||||
CRange *This = new(cicNoThrow) CRange(context, textstore, lockType,
|
||||
(TfAnchor)anchorStart, (TfAnchor)anchorEnd);
|
||||
CRange *This = new(cicNoThrow) CRange(context, (TfAnchor)anchorStart, (TfAnchor)anchorEnd);
|
||||
if (!This)
|
||||
return E_OUTOFMEMORY;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue