⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 pinyinwb.c

📁 好记星的控件,包括button,list,对文件操作
💻 C
📖 第 1 页 / 共 2 页
字号:
							*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机中,没有数字键及直接输出字符
//		if(bDirectOut)/*直接输出字符*/
//		{
//			*pEvent = EVENT_CHAR;
//			*pParam  = wMsgX;
//		}
	}
	else if( *pEvent == EVENT_INITIALIZE )
	{
		__InitialIME();
	}	
	
	if(bClearMsg)
	{
		*pEvent = EVENT_NOTHING;
	}

	return 0;
}

// 将字符键映射到数字
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:五笔输入法的消息处理函数									*/
/* INPUTS:     pEvent,消息													*/
/* OUTPUTS:    NONE														*/
/* RETURN:     消息处理函数返回值                                          */
/****************************************************************************/
/*  NAME           DATE               REMARKS                               */
/* ==========  ============   ==============================================*/
/*  Zfs			2003-04-08     创建初始版本                                 */
/****************************************************************************/
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:输入法的输入框的内容绘制									*/
/* INPUTS:     uType      输入法				                            */
/* OUTPUTS:    NONE														*/
/* RETURN:     NONE														*/
/****************************************************************************/
/*  NAME           DATE               REMARKS                               */
/* ==========  ============   ==============================================*/
/*  Qorse		2003-03-25     创建初始版本                                 */
/****************************************************************************/
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;	//提示用户可以左右键转入选字模式
			
			/*显示尾部图标*/
			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:		//联想状态
	case IM_INPUT_LXZC:
	case IM_INPUT_ZC:		/*有内容备选*/

		if(g_mInputBox.state == IM_INPUT_LXZC ||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)
		{
			__ResetIME();
			break;
		}
		//只有进入选字模式才显示数字
		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);
			//显示数字索引小图标
			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) /*后面有数据*/
		{
			if(g_pIMECandiPos)	/*前后都有没有显示的数据*/
			{
				uIconID = IDB_IME_ARROWLR;
			}
			else				/*后面有数据*/
			{
				uIconID = IDB_IME_ARROWR;
			}
		}
		else
		{
			if(g_pIMECandiPos)	/*前面还有数据*/
			{
				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();
}


⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -