📄 t9main.c
字号:
******************************************************************************/
T9U8 IsBPMFChar(T9U8 bChar)
{
T9U16 nIdx;
for (nIdx = 0; BopomofoTable[nIdx].sbchar; nIdx++)
{
if (BopomofoTable[nIdx].sbchar == bChar)
return 1;
}
return 0;
}
/*******************************************************************************
*
* Function name : IsBPMFChar
* Description : check if the input char is a BoPoMoFo internal char.
*
* Return : 1 (Yes) or 0(No)
*
* Pass : T9U8 - alpha Tegic BoPoMoFo internal char code to be translated
*
******************************************************************************/
T9U8 IsPinYinChar(T9U8 bChar)
{
if ((bChar >= 0x61 && bChar <= 0x7A) || bChar == 0x20)
return 1;
else
return 0;
}
/*******************************************************************************
*
* Function name : IsBPMFChar
* Description : check if the input char is a BoPoMoFo internal char.
*
* Return : 1 (Yes) or 0(No)
*
* Pass : T9U8 - alpha Tegic BoPoMoFo internal char code to be translated
*
******************************************************************************/
T9U8 IsStrokeChar(T9U8 bChar)
{
if ((bChar >= 0x01 && bChar <= 0x06))
return 1;
else
return 0;
}
/*******************************************************************************
*
* Function name : PinYinInternalToUnicode
* Description : Convert 8 bit Tegic BoPoMoFo internal char code to Unicode
* (Where unicodes start from 3100, Linear offsets start from 0)
*
* Return : wUnicode
*
* Pass : T9U8 - alpha Tegic BoPoMoFo internal char code to be translated
*
******************************************************************************/
T9U16 BPMFInternalToUnicode(T9U8 bChar)
{
T9U16 nIdx;
for (nIdx = 0; BopomofoTable[nIdx].sbchar; nIdx++)
{
if (BopomofoTable[nIdx].sbchar == bChar)
{
return BopomofoTable[nIdx].unicode;
}
}
return BopomofoTable[nIdx].unicode;
}
/*******************************************************************************
*
* Function name : UnicodeToBPMFInternal
* Description : Convert Unicode to 8 bit Tegic BoPoMoFo internal char code
* (Where unicodes start from 3100, Linear offsets start from 0)
*
* Return : T9U8 - alpha Tegic BoPoMoFo internal char code
*
* Pass : wUnicode to be translated
*
******************************************************************************/
T9U8 UnicodeToBPMFInternal(T9U16 bpmf)
{
T9U16 nIdx;
for (nIdx = 0; BopomofoTable[nIdx].unicode; nIdx++)
{
if (BopomofoTable[nIdx].unicode == bpmf)
{
return BopomofoTable[nIdx].sbchar;
}
}
return BopomofoTable[nIdx].sbchar;
}
/*******************************************************************************
*
* Function name : BPMFInternalToUnicode
* Description : Convert 8 bit Tegic BoPoMoFo internal char code to Unicode
* (Where unicodes start from 3100, Linear offsets start from 0)
*
* Return : wUnicode
*
* Pass : T9U8 - alpha Tegic BoPoMoFo internal char code to be translated
*
******************************************************************************/
T9U16 PinYinInternalToUnicode(T9U8 bChar)
{
T9U16 nIdx;
nIdx = bChar;
return nIdx;
}
/*******************************************************************************
*
* Function name : StrokeInternalToUnicode
* Description : Convert 8 bit Tegic BoPoMoFo internal char code to Unicode
* (Where unicodes start from 3100, Linear offsets start from 0)
*
* Return : wUnicode
*
* Pass : T9U8 - alpha Tegic BoPoMoFo internal char code to be translated
*
******************************************************************************/
T9U16 StrokeInternalToUnicode(T9U8 bChar)
{
T9U16 nIdx;
//nIdx = bChar + 65509;//0x30;
switch(bChar)
{
case 1:
nIdx = 0xF004;
break;
case 2:
nIdx = 0xF001;
break;
case 3:
nIdx = 0xF007;
break;
case 4:
nIdx = 0xF002;
break;
case 5:
nIdx = 0xF005;
break;
case 6:
nIdx = 0xF000;
break;
}
return nIdx;
}
//2004-04-27 Wilson, Move from T9ChangeLanguage() to outside function for other app.
//PMt dara 27jan for using only the Alphbatic version of T9 core engine
#if defined(__MMI_T9_V7__)
#if defined (__MMI_T9_SM_CHINESE__)
void T9ChangeLanguageToSMChinesePinYin(void)
{
T9STATUS sStatus = T9STATERROR;
sStatus = T9CCInitialize(&FieldInfo.CCFieldInfo,
t9TxtBuf,
t9AuxBuf,
CHINESE_BUFFER_LENGTH,
0 /* nBufLen */,
T9HandleRequest,
T9_SELECTION_BUFFER_SIZE,
T9LoadChnLdb);
if (sStatus == T9STATNONE)
{
sStatus = T9CCSetLanguage(&FieldInfo.CCFieldInfo,
T9PIDChinese | T9SIDChineseSimplified,
0,
0);
}
/* nDymCtxtFence can not be greater than half of nSelectpageMax,
* if the user set it wrong, t9 core will detect it and keep
* the right value */
if (sStatus == T9STATNONE)
{
sStatus = T9CCSetDynCtxtFence(&FieldInfo.CCFieldInfo, 1);
}
/* nDymCtxtSearchDepth can not be greater than T9CCDYNCTXTSEARCHMAXDEPTH, if
* user set it larger than it, t9 core will detect it and keep the
* right one */
if (sStatus == T9STATNONE)
{
sStatus = T9CCSetDynCtxtSearchDepth(&FieldInfo.CCFieldInfo, 4);
}
if (sStatus == T9STATNONE)
{
sStatus = T9CCSetMultitapSpellMode(&FieldInfo.CCFieldInfo);
}
if (sStatus == T9STATNONE)
{
sStatus = T9CCSetMultitapSelListUpdate(&FieldInfo.CCFieldInfo);
}
if (sStatus)
{
T9ProcessErrorReturnCodes(sStatus);
}
}
#endif
//PMT dara added for t9core engine(Alphabatic only) 27jan2005
#ifdef __MMI_T9_TR_CHINESE__
void T9ChangeLanguageToTRChineseBoPoMo(void)
{
T9STATUS sStatus = T9STATERROR;
sStatus = T9CCInitialize(&FieldInfo.CCFieldInfo,
t9TxtBuf,
t9AuxBuf,
CHINESE_BUFFER_LENGTH,
0 /* nBufLen */,
T9HandleRequest,
T9_SELECTION_BUFFER_SIZE,
T9LoadChnLdb);
if (sStatus == T9STATNONE)
{
sStatus = T9CCSetLanguage(&FieldInfo.CCFieldInfo,
T9PIDChinese | T9SIDChineseTraditional,
0,
0);
}
/* nDymCtxtFence can not be greater than half of nSelectpageMax,
* if the user set it wrong, t9 core will detect it and keep
* the right value */
if (sStatus == T9STATNONE)
{
sStatus = T9CCSetDynCtxtFence(&FieldInfo.CCFieldInfo, 1);
}
/* nDymCtxtSearchDepth can not be greater than T9CCDYNCTXTSEARCHMAXDEPTH, if
* user set it larger than it, t9 core will detect it and keep the
* right one */
if (sStatus == T9STATNONE)
{
sStatus = T9CCSetDynCtxtSearchDepth(&FieldInfo.CCFieldInfo, 4);
}
if (sStatus == T9STATNONE)
{
sStatus = T9SetExtMultitapMode(&FieldInfo.CCFieldInfo.G);
}
if (sStatus == T9STATNONE)
{
sStatus = T9CCSetMultitapSpellMode(&FieldInfo.CCFieldInfo);
}
if (sStatus == T9STATNONE)
{
sStatus = T9CCSetMultitapSelListUpdate(&FieldInfo.CCFieldInfo);
}
if (sStatus)
{
T9ProcessErrorReturnCodes(sStatus);
}
}
#endif
#ifdef __MMI_T9_SM_CHINESE__
void T9ChangeLanguageToSMChineseStroke(void)
{
T9STATUS sStatus = T9STATERROR;
sStatus = T9CCInitialize(&FieldInfo.CCFieldInfo,
t9TxtBuf,
t9AuxBuf,
CHINESE_BUFFER_LENGTH,
0 /* nBufLen */,
T9HandleRequest,
T9_SELECTION_BUFFER_SIZE,
T9LoadChnLdb);
if (sStatus == T9STATNONE)
{
sStatus = T9CCSetLanguage(&FieldInfo.CCFieldInfo,
T9PIDChinese | T9SIDChineseSimplified,
0,
0);
}
/* nDymCtxtFence can not be greater than half of nSelectpageMax,
* if the user set it wrong, t9 core will detect it and keep
* the right value */
if (sStatus == T9STATNONE)
{
sStatus = T9CCSetDynCtxtFence(&FieldInfo.CCFieldInfo, 1);
}
/* nDymCtxtSearchDepth can not be greater than T9CCDYNCTXTSEARCHMAXDEPTH, if
* user set it larger than it, t9 core will detect it and keep the
* right one */
if (sStatus == T9STATNONE)
{
sStatus = T9CCSetDynCtxtSearchDepth(&FieldInfo.CCFieldInfo, 4);
}
if (sStatus == T9STATNONE)
{
sStatus = T9CCSetStrokeMode(&FieldInfo.CCFieldInfo);
}
if (sStatus == T9STATNONE)
{
sStatus = T9CCSetMultitapSelListUpdate(&FieldInfo.CCFieldInfo);
}
if (sStatus)
{
T9ProcessErrorReturnCodes(sStatus);
}
}
#endif
//PMT dara added for t9core engine(Alphabatic only) 27jan2005
#ifdef __MMI_T9_TR_CHINESE__
void T9ChangeLanguageToTRChineseStroke(void)
{
T9STATUS sStatus = T9STATERROR;
sStatus = T9CCInitialize(&FieldInfo.CCFieldInfo,
t9TxtBuf,
t9AuxBuf,
CHINESE_BUFFER_LENGTH,
0 /* nBufLen */,
T9HandleRequest,
T9_SELECTION_BUFFER_SIZE,
T9LoadChnLdb);
if (sStatus == T9STATNONE)
{
sStatus = T9CCSetLanguage(&FieldInfo.CCFieldInfo,
T9PIDChinese | T9SIDChineseTraditional,
0,
0);
}
/* nDymCtxtFence can not be greater than half of nSelectpageMax,
* if the user set it wrong, t9 core will detect it and keep
* the right value */
if (sStatus == T9STATNONE)
{
sStatus = T9CCSetDynCtxtFence(&FieldInfo.CCFieldInfo, 1);
}
/* nDymCtxtSearchDepth can not be greater than T9CCDYNCTXTSEARCHMAXDEPTH, if
* user set it larger than it, t9 core will detect it and keep the
* right one */
if (sStatus == T9STATNONE)
{
sStatus = T9CCSetDynCtxtSearchDepth(&FieldInfo.CCFieldInfo, 4);
}
if (sStatus == T9STATNONE)
{
sStatus = T9CCSetStrokeMode(&FieldInfo.CCFieldInfo);
}
if (sStatus == T9STATNONE)
{
sStatus = T9CCSetMultitapSelListUpdate(&FieldInfo.CCFieldInfo);
}
if (sStatus)
{
T9ProcessErrorReturnCodes(sStatus);
}
}
#endif
#else
void T9ChangeLanguageToSMChinesePinYin(void)
{
T9STATUS sStatus = T9STATERROR;
FieldInfo.nLdbNum = PLDBID_Chinese | SLDBID_ChineseSimplified;
t9event.mType = T9EVTSETLANG;
sStatus = T9HandleEvent(&FieldInfo, &t9event);
if (sStatus)
{
T9ProcessErrorReturnCodes(sStatus);
}
t9event.mType = T9EVTCTRL;
t9event.data.mCtrlID = T9CTRLPHMULTI;//T9CTRLPHAMBIG;
sStatus = T9HandleEvent(&FieldInfo, &t9event);
if (sStatus)
{
T9ProcessErrorReturnCodes(sStatus);
}
t9event.mType = T9EVTCTRL;
t9event.data.mCtrlID = T9CTRLSETPHMTUPDATE;
sStatus = T9HandleEvent(&FieldInfo, &t9event);
if (sStatus)
{
T9ProcessErrorReturnCodes(sStatus);
}
}
void T9ChangeLanguageToTRChineseBoPoMo(void)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -