?? pinyinwb.c
字號:
*pParam = cC2N;
if(_IMEGetSelectWord(pEvent,pParam))
{
bDirectOut = FALSE;
}
}
else
{
__ResetIME();
g_pIMEInBuffer[g_pIMEInputednum++] = (UINT8)wMsgX;
g_mInputBox.state = IM_INPUT_DOING;
_PyWbGetData(uType);
g_mInputBox.refresh = IME_NEED_REFRESH;
bClearMsg = TRUE;
}
bClearMsg = TRUE;
}
break;
}
}
// 6x8機中,沒有數(shù)字鍵及直接輸出字符
// if(bDirectOut)/*直接輸出字符*/
// {
// *pEvent = EVENT_CHAR;
// *pParam = wMsgX;
// }
}
else if( *pEvent == EVENT_INITIALIZE )
{
__InitialIME();
}
if(bClearMsg)
{
*pEvent = EVENT_NOTHING;
}
return 0;
}
// 將字符鍵映射到數(shù)字
char Char2Num( UINT uChar)
{
if (uChar >= 'A' && uChar <= 'Z' )
{
uChar += 'a' - 'A';
}
switch(uChar)
{
case 'q': // 1
return '1';
case 'w': // 2
return '2';
case 'e': // 3
return '3';
case 'r': // 4
return '4';
case 't': // 5
return '5';
case 'y': // 6
return '6';
case 'u': // 7
return '7';
case 'i': // 8
return '8';
case 'o': // 9
return '9';
case 'p': // 0
return '0';
}
return (char)0xff;
}
UINT32 _gPinyinHandleEvent(IMEGUI_STRUCT *pApGui, UINT *pEvent, UINT *pParam)
{
BOOL bClearMsg;
UINT16 wMsgX;
bClearMsg = FALSE;
wMsgX = (UINT16)*pParam;
_IMEHandleEvent(pApGui,pEvent,pParam,ImeGetSystem()->uImeCurrentType);
// _IMEHandleEvent(pApGui,pEvent,pParam,IME_PINYIN);
g_mInputBox.refresh = IME_NEED_REFRESH;
if(g_mInputBox.refresh)
{
//_PinYinDrawGraph(IME_PINYIN);
_PinYinDrawGraph(ImeGetSystem()->uImeCurrentType);
}
if(bClearMsg)
{
*pParam = EVENT_NOTHING;
}
return 0;
}
/****************************************************************************/
/* FUNCTION: _WuBiHandleEvent */
/* DESCRIPTION:五筆輸入法的消息處理函數(shù) */
/* INPUTS: pEvent,消息 */
/* OUTPUTS: NONE */
/* RETURN: 消息處理函數(shù)返回值 */
/****************************************************************************/
/* NAME DATE REMARKS */
/* ========== ============ ==============================================*/
/* Zfs 2003-04-08 創(chuàng)建初始版本 */
/****************************************************************************/
FOR_IME_WUBI
INT _WuBiHandleEvent(IMEGUI_STRUCT *pApGui, UINT *pEvent, UINT *pParam)
{
BOOL bClearMsg;
UINT16 wMsgX;
bClearMsg = FALSE;
wMsgX = *pParam;
if ((*pEvent == EVENT_KEY|| *pEvent== EVENT_CHAR|| *pEvent==EVENT_KEYREPEAT)
&& ((wMsgX == 'z') || (wMsgX == 'Z')))
{
*pEvent = EVENT_CHAR;
return 0;
}
_IMEHandleEvent(pApGui,pEvent,pParam,IME_WUBI);
g_mInputBox.refresh = IME_NEED_REFRESH;
if(g_mInputBox.refresh)
{
_PinYinDrawGraph(IME_WUBI);
}
if(bClearMsg)
{
*pEvent = EVENT_NOTHING;
}
return 0;
}
INT _GBKHandleEvent(IMEGUI_STRUCT *pApGui, UINT *pEvent, UINT *pParam)
{
return _gPinyinHandleEvent(pApGui, pEvent,pParam);
}
/****************************************************************************/
/* FUNCTION: _PinYinDrawGraph */
/* DESCRIPTION:輸入法的輸入框的內(nèi)容繪制 */
/* INPUTS: uType 輸入法 */
/* OUTPUTS: NONE */
/* RETURN: NONE */
/****************************************************************************/
/* NAME DATE REMARKS */
/* ========== ============ ==============================================*/
/* Qorse 2003-03-25 創(chuàng)建初始版本 */
/****************************************************************************/
FOR_IME_ALL
VOID _PinYinDrawGraph(UINT uType)
{
UINT16 tempnum;
UINT8 *addr,i;
UINT32 uIconID;
INT x0;
UINT drawType;
GraphDisableRefresh();
__ImeDrawInputBoxHead(uType);
tempnum = g_pIMEWordNum - g_pIMECandiPos;
if (tempnum > g_pIMEWordTypeNum)
tempnum = g_pIMEWordTypeNum;
switch (g_mInputBox.state)
{
case IM_INPUT_DOING: /*用戶正在輸入*/
if (g_mInputBox.state == IM_INPUT_LX)
{
x0 = IME_CANDI_X;
drawType = IME_NONE;
}
else
{
GraphDrawText(g_mInputBox.rect.x+ g_mInputBox.rect.height,
g_mInputBox.rect.y, 0, 0,g_pIMEInBuffer);
x0 = PY_CANDI_X;
drawType = IME_PINYIN;
}
if (tempnum != 0)
{
for (i = 0; i < tempnum; i++)
{
memset(g_pIMEOutBuffer,0,IM_OUTBUFF_LEN);
addr = g_pIMEDataAddr + (g_pIMECandiPos+i) * 2;
*g_pIMEOutBuffer = *addr;
*(g_pIMEOutBuffer+1) = *(addr+1);
GraphDrawText(g_mInputBox.rect.x+ x0 + i * IME_CANDI_INTERVAL,
g_mInputBox.rect.y, 16, g_mInputBox.rect.height,g_pIMEOutBuffer);
}
uIconID = IDB_IME_ARROWLR; //提示用戶可以左右鍵轉(zhuǎn)入選字模式
/*顯示尾部圖標*/
if((uIconID != 0) && (tempnum > g_pIMEWordTypeNum))
{
UINT uWidth,uHeight;
GraphGetIconSize(&uWidth,&uHeight,MAKE_ID(uIconID ) ) ;
GraphDrawIcon(g_mInputBox.rect.x+g_mInputBox.rect.width - uWidth-2,
g_mInputBox.rect.y+(g_mInputBox.rect.height-12) / 2, 0, 0, MAKE_ID(uIconID));
}
}
break;
case IM_INPUT_LX: //聯(lián)想狀態(tài)
case IM_INPUT_LXZC:
case IM_INPUT_ZC: /*有內(nèi)容備選*/
if(g_mInputBox.state == IM_INPUT_LXZC ||g_mInputBox.state == IM_INPUT_LX) // 聯(lián)想選詞與拼音選詞字數(shù)不同
{
x0 = IME_CANDI_X;
drawType = IME_NONE;
}
else
{
GraphDrawText(g_mInputBox.rect.x+ g_mInputBox.rect.height,
g_mInputBox.rect.y, 0, 0,g_pIMEInBuffer);
x0 = PY_CANDI_X;
drawType = IME_PINYIN;
}
if(tempnum == 0)
{
__ResetIME();
break;
}
//只有進入選字模式才顯示數(shù)字
for (i = 0; i < tempnum; i++)
{
memset(g_pIMEOutBuffer,0,IM_OUTBUFF_LEN);
addr = g_pIMEDataAddr + (g_pIMECandiPos+i) * 2;
*g_pIMEOutBuffer = *addr;
*(g_pIMEOutBuffer+1) = *(addr+1);
//顯示數(shù)字索引小圖標
ImeDrawIndexNum((UINT8 )i,drawType);
GraphDrawText(g_mInputBox.rect.x+ x0 + i * IME_CANDI_INTERVAL,
g_mInputBox.rect.y, 16, g_mInputBox.rect.height,g_pIMEOutBuffer);
}
// 選擇尾部圖標
uIconID = 0;
if((g_pIMEWordNum - g_pIMECandiPos) > g_pIMEWordTypeNum) /*后面有數(shù)據(jù)*/
{
if(g_pIMECandiPos) /*前后都有沒有顯示的數(shù)據(jù)*/
{
uIconID = IDB_IME_ARROWLR;
}
else /*后面有數(shù)據(jù)*/
{
uIconID = IDB_IME_ARROWR;
}
}
else
{
if(g_pIMECandiPos) /*前面還有數(shù)據(jù)*/
{
uIconID = IDB_IME_ARROWL;
}
}
/*顯示尾部圖標*/
if(uIconID)
{
UINT uWidth,uHeight;
GraphGetIconSize(&uWidth,&uHeight,MAKE_ID(uIconID ) ) ;
GraphDrawIcon(g_mInputBox.rect.x+g_mInputBox.rect.width - uWidth-2,
g_mInputBox.rect.y+(g_mInputBox.rect.height-12) / 2, 0, 0, MAKE_ID(uIconID));
}
break;
case IM_INPUT_ERROR:/*用戶輸入出錯*/
GraphDrawText(g_mInputBox.rect.x+g_mInputBox.rect.height, 0, 0, 0, "查無此字!");
default:
break;
}
g_mInputBox.refresh = IME_NO_REFRESH;
GraphEnableRefresh();
}
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -