?? imemng.c
字號:
/****************************************************************************/
/* */
/* Copyright (C) 2003 SHENZHEN MEIJIN CO.LTD */
/* */
/* FILE NAME: ImeManag.c */
/* MODULE NAME: 輸入法 Input Method Editor */
/* DESCRIPTION: 輸入法 */
/* */
/****************************************************************************/
/* DTAE AUTHOR VERSION REMARKS */
/* =========== ========== ========= ======================================*/
/* Qorse 2003-03-25 創(chuàng)建初始版本 */
/* 謝永良 2003-06-13 刪除函數(shù)ID號和模塊調(diào)用 */
/****************************************************************************/
#include "Kernel.h"
#include "ImeIn.h"
MIMEManager g_mImeManager;
/****************************************************************************/
/* FUNCTION: ImeModInitial */
/* DESCRIPTION:模塊初始化 */
/* INPUTS: pEvent 初始化消息 */
/* OUTPUTS: NONE */
/* RETURN: NONE */
/****************************************************************************/
/* NAME DATE REMARKS */
/* ========== ============ ==============================================*/
/* Qorse 2003-03-25 創(chuàng)建初始版本 */
/****************************************************************************/
BOOL ImeInitialize(VOID)
{
_ImeInitialize(ImeGetSystem(),0);
return TRUE;
}
MIMEManager* ImeGetSystem()
{
return (MIMEManager*)&g_mImeManager;
}
/****************************************************************************/
/* FUNCTION: ImeGetCurrent */
/* DESCRIPTION:得到當(dāng)前輸入法 */
/* INPUTS: pApGui 指定的 AP Gui */
/* OUTPUTS: 該窗口的當(dāng)前輸入法 */
/* RETURN: 當(dāng)前輸入法ID */
/****************************************************************************/
/* NAME DATE REMARKS */
/* ========== ============ ==============================================*/
/* Qorse 2003-03-25 創(chuàng)建初始版本 */
/****************************************************************************/
UINT ImeGetCurrent(VOID)
{
return ImeGetDefault();
}
/*
UINT ImeGetCurrent(IMEGUI_STRUCT *pApGui)
{
return ImeGetDefault();
if(!pApGui)
{
pApGui = (IMEGUI_STRUCT *)GetApHandle();
}
return pApGui->uCurrentIme;
*/
/****************************************************************************/
/* FUNCTION: ImeSetCurrent */
/* DESCRIPTION:設(shè)置當(dāng)前輸入法 */
/* INPUTS: pApGui 指定的AP GUI */
/* uImeId 輸入法ID */
/* OUTPUTS: NONE */
/* RETURN: 成功返回TRUE,否則返回FALSE */
/****************************************************************************/
/* NAME DATE REMARKS */
/* ========== ============ ==============================================*/
/* Qorse 2003-03-25 創(chuàng)建初始版本 */
/****************************************************************************/
BOOL ImeSetCurrent( UINT uImeId)
{
IMEGUI_STRUCT *pApGui;
UINT32 dwParam;
if( ImeSetDefault(uImeId))
{
pApGui = (IMEGUI_STRUCT *)GetApHandle();
pApGui->uCurrentIme = uImeId;
if (g_mImeManager.ImeOnChangeFunc)
{
g_mImeManager.ImeOnChangeFunc(uImeId);
}
pApGui->wImeOption &= ~IME_OPTION_NOSWITCH;
// dwParam = ((UINT16)(uImeId==IME_NONE?0:tempIM.uHeight)<<16) | (UINT16 )uImeId;
dwParam = ((UINT16)(CM_IME_SELECTED) | (UINT16 )uImeId<<16 );
MsgPost((APGUI_STRUCT_MODEL *)NULL,EVENT_COMMAND,dwParam);
return TRUE;
}
return FALSE;
}
/*
BOOL ImeSetCurrent(IMEGUI_STRUCT *pApGui, UINT uImeId)
{
MInputME tempIM;
UINT32 dwParam;
if (g_mImeManager.uCount == 0)
{
return FALSE;
}
if(!pApGui)
{
pApGui = (IMEGUI_STRUCT *)GetApHandle();
}
//參數(shù)有效性驗(yàn)證
tempIM.uType = uImeId;
if (uImeId!= IME_NONE && !ImeGetInfo(&tempIM))
{
return FALSE;
}
pApGui->uCurrentIme = uImeId;
if (g_mImeManager.ImeOnChangeFunc)
{
g_mImeManager.ImeOnChangeFunc(uImeId);
}
pApGui->wImeOption &= ~IME_OPTION_NOSWITCH;
// dwParam = ((UINT16)(uImeId==IME_NONE?0:tempIM.uHeight)<<16) | (UINT16 )uImeId;
dwParam = ((UINT16)(CM_IME_SELECTED) | (UINT16 )uImeId<<16 );
MsgPost((APGUI_STRUCT_MODEL *)NULL,EVENT_COMMAND,dwParam);
return TRUE;
}
*/
/****************************************************************************/
/* FUNCTION: ImSetOnlyOne */
/* DESCRIPTION:鎖定當(dāng)前輸入法 */
/* INPUTS: pApGui 指定的AP GUI */
/* uImeId 輸入法ID */
/* OUTPUTS: NONE */
/* RETURN: 成功返回TRUE,否則返回FALSE */
/****************************************************************************/
/* NAME DATE REMARKS */
/* ========== ============ ==============================================*/
/* Qorse 2003-03-25 創(chuàng)建初始版本 */
/****************************************************************************/
BOOL ImSetOnlyOne(IMEGUI_STRUCT *pApGui, UINT uImeId)
{
if(!pApGui)
{
pApGui = (IMEGUI_STRUCT *)GetApHandle();
}
// if (ImeSetCurrent(pApGui, uImeId))
if (ImeSetCurrent(uImeId))
{
pApGui->wImeOption |= IME_OPTION_NOSWITCH;
return TRUE;
}
else
{
return FALSE;
}
}
/****************************************************************************/
/* FUNCTION: ImeGetInfo */
/* DESCRIPTION:得到輸入法的信息 */
/* INPUTS: 輸入法ID */
/* OUTPUTS: pInfo */
/* RETURN: 成功返回TRUE,否則返回FALSE */
/****************************************************************************/
/* NAME DATE REMARKS */
/* ========== ============ ==============================================*/
/* Qorse 2003-03-25 創(chuàng)建初始版本 */
/****************************************************************************/
BOOL ImeGetInfo(MInputME *pInfo)
{
UINT i;
if (pInfo->uType == IME_NONE)
{
return FALSE;
}
for (i = 0; i < g_mImeManager.uCount; i++)
{
if(g_mImeManager.maInputME[i].uType == pInfo->uType)/*ID相符*/
{
memmove((UINT8*)pInfo, (UINT8*)(g_mImeManager.maInputME + i),sizeof(MInputME));
return TRUE;
}
}
return FALSE;
}
/****************************************************************************/
/* FUNCTION: ImeSetOptions */
/* DESCRIPTION:設(shè)置輸入法選項(xiàng) */
/* INPUTS: pApGui AP pointer */
/* dwOptions 輸入法選項(xiàng) */
/* OUTPUTS: NONE */
/* RETURN: 成功返回TRUE,否則返回FALSE */
/****************************************************************************/
/* NAME DATE REMARKS */
/* ========== ============ ==============================================*/
/* Qorse 2003-03-25 創(chuàng)建初始版本 */
/****************************************************************************/
BOOL ImeSetOptions(IMEGUI_STRUCT *pApGui,UINT16 wOptions)
{
if(!pApGui)
{
pApGui = (IMEGUI_STRUCT *)GetApHandle();
}
pApGui->wImeOption = wOptions;
return TRUE;
}
/****************************************************************************/
/* FUNCTION: ImeManagerHandleEvent */
/* DESCRIPTION:輸入法管理的消息處理函數(shù) */
/* INPUTS: pApGui AP pointer */
/* pEvent 消息指針 */
/* OUTPUTS: NONE */
/* RETURN: 消息處理函數(shù)返回值 */
/****************************************************************************/
/* NAME DATE REMARKS */
/* ========== ============ ==============================================*/
/* Qorse 2003-03-25 創(chuàng)建初始版本 */
/****************************************************************************/
UINT32 IMeManager(IMEGUI_STRUCT *pApGui, UINT *pEvent, UINT *pParam)
{
MInputME tempIM;
UINT i;
/* if definified EVENT_KEYUP, not comment thest code
if (*pEvent == EVENT_KEYUP)
{
*pParam = EVENT_NOTHING;
return 0;
}
*/
if (!pApGui)
{
pApGui = (IMEGUI_STRUCT *)GetApHandle();
}
tempIM.uType = pApGui->uCurrentIme;
if(*pEvent==EVENT_KEY && *pParam == MVK_IME
|| *pEvent==EVENT_IME && ( LOWORD(*pParam)==IME_ACTION_SWITCH ))
{
*pEvent = EVENT_NOTHING;
if(pApGui->wImeOption & IME_OPTION_NOSWITCH)
{
return 0;
}
if(g_mImeManager.ImeSwitchFunc) /*有切換界面*/
{
return g_mImeManager.ImeSwitchFunc(&g_mImeManager);
}
else /*直接切換*/
{
for(i=0;i<g_mImeManager.uCount;i++)
{
if(g_mImeManager.maInputME[i].uType == pApGui->uCurrentIme)
{
break;
}
}
// return ImeSetCurrent(pApGui,g_mImeManager.maInputME[(++i)%g_mImeManager.uCount].uType); //???++i
return ImeSetCurrent(g_mImeManager.maInputME[(++i)%g_mImeManager.uCount].uType); //???++i
}
}
else if(*pEvent==EVENT_IME && LOWORD(*pParam)==IME_ACTION_SETCURRENT)
{
// ImeSetCurrent (pApGui,(UINT)(HIWORD(*pParam)) );
ImeSetCurrent ((UINT)(HIWORD(*pParam)) );
*pEvent = EVENT_NOTHING;
}
else if(ImeGetInfo(&tempIM)) /*轉(zhuǎn)交至輸入法的消息處理函數(shù)*/
{
g_mImeManager.uImeCurrentType = pApGui->uCurrentIme;
if(tempIM.fpImeHandleFunc) /*參數(shù)有效性檢查*/
{
return (tempIM.fpImeHandleFunc)((IMEGUI_STRUCT*)pApGui,pEvent,pParam);
}
}
return 0;
}
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -