|
发表于 2007-10-11 14:05:21
|
显示全部楼层
首先:现在大家没有不用sourceinsight的了吧,就按照里面的习惯来说了,呵呵
zi,t9之外的输入法,便宜,不过就mtk平台来说,就不会zi,t9集成进去了,所以要自己写,在输入法lib文
件夹里,要有*.lib和*.a文件,前一个是在模拟器上调试的时候用的,后一个是arm编译器用到的格式,就是do
wn到手机里的,你要跟做输入法的公司说明白(.a文件用小端个是存储字),要不自然出问题
在make文件夹里加入你的输入法的目录,并建立这几个文件,可以参考别的模块的写法(需要编译的文件的路
径名)
newinput.def: 需要使用的一些特殊的宏定义
newinput.inc:需要使用的一些头文件的引用
newinput.lis:包含的文件
newinput.pth:包含文件的路径
在当前工程用到的.mak文件里面,直接搜索INPUT_METHOD,找到的都要改,
例如一般都是 INPUT_METHOD = MMI_ZI # Input methods: NONE, MMI_T9, or MMI_ZI
改成 INPUT_METHOD = MMI_NEWINPUT,通常办法就是直接把MMI_ZI reaplaceall MMI_NEWINPUT
然后再把库文件(lib)添加
改完了.mak文件
MMI_featuresplutommi.h里面
#if defined(__MMI_NEWINPUT__)
#define __MMI_NEWINPUT_ENGLISH__
#define __MMI_NEWINPUT_TR_CHINESE__//不一定要加,用到再说吧
#define __MMI_NEWINPUT_SM_CHINESE__
这个还是不错的,对条理的清晰有作用的,所以保留吧,
国内的输入法,不会和zi那么复杂,一般就4个api函数吧
要做的很少,就是写个初始化,在处理键可以参考zi的
void INPUTKey0PressHandler(void)
{
IMEprocessKey(KEY0,0,0 );
}
,其他的就不多管了吧,学学印度,做个大点的全局变量,然后再以下的函数中处理IMEprocessKey*
我用拼音举例好了,呵呵
static IME_RETURN_CODE IMEprocessKeyPhonetic ( KEYID keyID,
int bLongPress,
int timeBetweenKeyPress )
{
IME_RETURN_CODE rtnCode = IME_SKIP;
ZI8UCHAR (这个是mtk写的就是unsigned char)SEARCH_RESULT = FUC_WRONG_CALLED;
ZI8UCHAR lastIMEphoneticIndex = IMEphoneticIndex;
int i;
TiNoDrawRightArrowSymbol = FALSE;
TiNoDrawCandidateRightArrowSymbol = FALSE;
TiRefillPhoneticBuffer = FALSE;
switch( keyID )
{
case KEY1: case KEY2: case KEY3:
case KEY4: case KEY5: case KEY6:
case KEY7: case KEY8: case KEY9:
case KEY0:
if(INPUTMaxLengthCheck() == FALSE)
{
IMEfirstCandidate = 0;
IMEbValidCandidates = FALSE;
IMEbValidPhonetic = FALSE;
IMEbPhoneticComfirmed = FALSE;
IMEbCandidateComfirmed=FALSE;
IMEprediction = 0;
UI_editor_play_tone_cannot_insert();
goto IME_EXIT;
}
break;
default:
break;
}
switch( keyID )
{
case KEYLEFT:
{
if( !IMEbValidCandidates ) goto IME_EXIT;
if( IMEbFocusOnPhonetic )
{
/****************非法的键的处理***********************************/
if(IMEphoneticIndex>0)
{
--IMEphoneticIndex ;
}
}
else //if(IMEbPhoneticComfirmed)
{
/***************光标在最左边的字上***********************************/
if(0==(IMEcandIndex%MAX_COUNT_CANDIDATES))
{
if(IMEcandIndex>0)
{
--IMEcandIndex ;
IMEfirstCandidate-=MAX_COUNT_CANDIDATES;
}
}
/****************
光标在中间的字上***********************************/
else
{
--IMEcandIndex ;
}
}
}
break;
case KEYUP:
{
if( !IMEbValidCandidates ) goto IME_EXIT;
if( IMEbFocusOnPhonetic )
{
/****************valid key***********************************/
if(IMEphoneticIndex>0)
{
--IMEphoneticIndex ;
}
}
else
{
if(IMEcandIndex>=MAX_COUNT_CANDIDATES)
{
IMEfirstCandidate-=MAX_COUNT_CANDIDATES;
IMEcandIndex=IMEfirstCandidate;
}
else
{
IMEcandIndex=0 ;
}
}
}
break;
case KEYSTAR:
{
if( !IMEbValidCandidates || IMEbPhoneticComfirmed ) goto IME_EXIT;
if( !bLongPress )
{
IMEfirstCandidate = 0;
if( ++IMEphoneticIndex >= IMEphoneticCount )
{
IMEphoneticIndex = 0;
}
}
else
{
IMEbFocusOnPhonetic = FALSE;
IMEbPhoneticComfirmed = TRUE;
IMEbValidPhonetic = FALSE;
IMEelementCount = 0;
}
}
break;
case KEYRIGHT:
{
if( !IMEbValidCandidates ) goto IME_EXIT;
if( IMEbFocusOnPhonetic )
{
++IMEphoneticIndex ;
/****************valid key***********************************/
if(IMEphoneticIndex<IMEphoneticCount)
{
;
}
/****************invalid key***********************************/
else
{
--IMEphoneticIndex ;
}
}
else //if(IMEbPhoneticComfirmed)
{
++IMEcandIndex;
/****************valid key***********************************/
if(IMEcandIndex<IMEcandCount)
{
if(0==(IMEcandIndex%MAX_COUNT_CANDIDATES))
{
IMEfirstCandidate+=MAX_COUNT_CANDIDATES;
}
}
/****************invalid key***********************************/
else
{
--IMEcandIndex ;
}
}
}
break;
case KEYDOWN:
{
if( !IMEbValidCandidates ) goto IME_EXIT;
if( IMEbFocusOnPhonetic )
{
++IMEphoneticIndex ;
/****************valid key***********************************/
if(IMEphoneticIndex<IMEphoneticCount)
{
;
}
/****************invalid key***********************************/
else
{
--IMEphoneticIndex ;
}
}
else
{
IMEcandIndex+=MAX_COUNT_CANDIDATES;
/****************valid key***********************************/
if(IMEcandIndex<IMEcandCount)
{
IMEfirstCandidate+=MAX_COUNT_CANDIDATES;
IMEcandIndex=IMEfirstCandidate;
}
/****************invalid key***********************************/
else
{
IMEcandIndex=IMEcandCount-1 ;
}
}
}
break;
case KEYSOFTR:
{
if( !IMEbValidCandidates ) goto IME_EXIT;
if( bLongPress )
{
/***************拼音**************************************************/
if( IMEbFocusOnPhonetic )
{
IMEbFocusOnPhonetic = FALSE;
}
IMEprediction= IMEelementCount=0;
IMEelementBuffer[IMEelementCount]=0;
IMEphoneticIndex=0;
IMEbPhoneticComfirmed = FALSE;
IMEbCandidateComfirmed=FALSE;
IMEbValidCandidates = FALSE;
IMEbValidPhonetic = FALSE;
IMEbSkipGetCandidate=FALSE;
IMEbCandidateComfirmed=FALSE;
}
else
{
/*****************************************************************/
if( IMEbFocusOnPhonetic )
{
if( IMEelementCount )
{
if( --IMEelementCount == 0 )
{
IMEbFocusOnPhonetic = FALSE;
IMEbValidPhonetic = FALSE;
IMEbValidCandidates = FALSE;
}
IMEelementBuffer[IMEelementCount]=0;
IMEphoneticIndex=0;
IMEprediction= IMEelementCount;
}
}
else
{
if(IMEbPhoneticComfirmed&&(!IMEbSkipGetCandidate)&&IMEbCandidateComfirmed)
{
IMEbFocusOnPhonetic = TRUE;
IMEcandIndex=IMEfirstCandidate=0;
IMEbPhoneticComfirmed=FALSE;
IMEbCandidateComfirmed=FALSE;
}
else
if((!IMEbPhoneticComfirmed)&&IMEbSkipGetCandidate&&(!IMEbCandidateComfirmed))
{
IMEbSkipGetCandidate=FALSE;
IMEelementCount=0;
IMEelementBuffer[IMEelementCount]=0;
IMEbSkipGetCandidate=FALSE;
IMEbValidPhonetic= FALSE;
IMEbValidCandidates = FALSE;
}
else
if((!IMEbPhoneticComfirmed)&&IMEbSkipGetCandidate&&(IMEbCandidateComfirmed))
{
IMEbCandidateComfirmed=FALSE;
IMEbSkipGetCandidate=FALSE;
IMEelementCount=0;
IMEelementBuffer[IMEelementCount]=0;
IMEbSkipGetCandidate=FALSE;
IMEbValidPhonetic= FALSE;
IMEbValidCandidates = FALSE;
}
}
}
}
break;
case KEYSOFTL:
{
if( !IMEbValidCandidates ) goto IME_EXIT;
/*****************************************************************/
if( IMEbFocusOnPhonetic )
{
IMEbCandidateComfirmed=TRUE;
IMEbPhoneticComfirmed = TRUE;
IMEbFocusOnPhonetic = FALSE;
IMEbValidPhonetic== FALSE;
}
/***************传换************************************************/
else
{
#ifndef InputSecondTheme
/**********select condidate when displaying phonetic s*********/
if(IMEbPhoneticComfirmed&&(!IMEbSkipGetCandidate))
{
IMEbPhoneticComfirmed = FALSE;
IMEbSkipGetCandidate=TRUE;
}
IMEelementCount = 0;
/**select condidate when no displaying phonetic s**/
if(IMEcandIndex<IMEcandCount)
{
IMELastWord=IMEcandidateBuffer[IMEcandIndex];
IMEinsertChar(IMEcandidateBuffer[IMEcandIndex]);
}
IMEfirstCandidate = 0;
IMEcandIndex =IMEfirstCandidate=0;
/**select condidate when no displaying phonetic e**/
/**********select condidate when displaying phonetic e*********/
#else
if(IMEbPhoneticComfirmed&&(!IMEbSkipGetCandidate)&&IMEbCandidateComfirmed) |
|