首先:现在大家没有不用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)
   {
    IMEbSkipGetCandidate=TRUE;
    IMEbPhoneticComfirmed=FALSE;
    IMEbCandidateComfirmed=FALSE;
    IMEPhoneticAddChar();
    }
   else 
if((!IMEbPhoneticComfirmed)&&IMEbSkipGetCandidate&&(!IMEbCandidateComfirmed))
   {
    IMEbCandidateComfirmed=TRUE;
   }
   else 
if((!IMEbPhoneticComfirmed)&&IMEbSkipGetCandidate&&(IMEbCandidateComfirmed))
   {
    IMEbCandidateComfirmed=FALSE;
    IMEPhoneticAddChar();
   }
   #endif
         }
     }
        break;
     case KEY1: case KEY2: case KEY3:
     case KEY4: case KEY5: case KEY6:
     case KEY7: case KEY8: case KEY9:
     case KEY0:
         if(IMEbCandidateComfirmed)
         {
            #ifdef InputSecondTheme
      
             ZI8UCHAR  IMEFastMark=0;
         
             switch( keyID )
             {
    case KEY1: IMEFastMark = tone1; break;
    case KEY2: IMEFastMark = tone2; break;
    case KEY3: IMEFastMark = tone3; break;
    case KEY4: IMEFastMark = tone4; break;
    case KEY5: IMEFastMark = tone5; break;
    case KEY6: IMEFastMark = tone6; break;
             default: goto IME_EXIT;
             }
    
   if((IMEfirstCandidate+IMEFastMark)>=IMEcandCount)
    goto IME_EXIT;
    
    
if(IMEbPhoneticComfirmed&&(!IMEbSkipGetCandidate)&&IMEbCandidateComfirmed)
    {
     IMEbSkipGetCandidate=TRUE;
     IMEbPhoneticComfirmed=FALSE;
    }
    
    IMEbCandidateComfirmed=FALSE;
    IMEelementCount   = 0;
    IMEelementBuffer[IMEelementCount]=0;
   
    IMELastWord=IMEcandidateBuffer[IMEfirstCandidate+IMEFastMark];
    IMEinsertChar(IMEcandidateBuffer[IMEfirstCandidate+IMEFastMark]);
    IMEfirstCandidate     = 0;
    IMEcandIndex =IMEfirstCandidate=0;
  
   
   #endif
         }
  else
  {
         switch( keyID )
   {
   case KEY1:
    {
#ifdef InputSecondTheme
           if( !IMEbValidCandidates ) goto IME_EXIT;
     if( IMEbFocusOnPhonetic )
     {
      IMEbPhoneticComfirmed = TRUE;
      IMEbFocusOnPhonetic   = FALSE;
      IMEbValidPhonetic== FALSE;
     }
     
     IMEbCandidateComfirmed=TRUE;
#endif
    goto IME_EXIT;
    }
   break;
   
   case KEY2: IMEelementBuffer[IMEelementCount++] = KEY2; break;
   case KEY3: IMEelementBuffer[IMEelementCount++] = KEY3; break;
   case KEY4: IMEelementBuffer[IMEelementCount++] = KEY4; break;
   case KEY5: IMEelementBuffer[IMEelementCount++] = KEY5; break;
   case KEY6: IMEelementBuffer[IMEelementCount++] = KEY6; break;
   case KEY7: IMEelementBuffer[IMEelementCount++] = KEY7; break;
   case KEY8: IMEelementBuffer[IMEelementCount++] = KEY8; break;
   case KEY9: IMEelementBuffer[IMEelementCount++] = KEY9; break;
   case KEY0: IMEelementBuffer[IMEelementCount++] = KEY0; break;
   }
   
          IMEelementBuffer[IMEelementCount] = 0;
    IMEbFocusOnPhonetic = TRUE;
   //IMEbValidPhonetic   = FALSE;
   //IMEbValidCandidates = FALSE;
   IMEfirstCandidate   = 0;
   IMEprediction       = 0;
   IMEphoneticIndex    = 0;
   IMEcandIndex=0;
   IMEbSkipGetCandidate=FALSE;
  }
  break;
     case KEYDUMMY:
         IMEfirstCandidate = 0;
         break;
     default:
         goto IME_EXIT;
     }
 
     if(IMEbFocusOnPhonetic&&!IMEphoneticIndex )
     {
         if( IMEelementCount >= MAX_ELEMENT_BUFFERSIZE )
         {
             IMEelementCount = MAX_ELEMENT_BUFFERSIZE - 1;
         }
  SEARCH_RESULT=这个就是你们的自己输入法的api搜索函数,提供结果
  
/***********************搜索成功后的处理,哈哈,能不成功嘛***************************************
****/
  if (FUC_RIGHT_CALLED==SEARCH_RESULT)
  {
   
fnPySearch(IMEelementBuffer,IMEphoneticBuffer,IMEcandidateBuffer,IMEphoneticIndex);
   IMEcandCount=cscount_result;
   IMEphoneticCount=pycount_result; 
   IMEbValidCandidates=TRUE;
   IMEbValidPhonetic=TRUE;
  }
  
/***********************不成还是要处理的*******************************************/
  else
  {
   IMEelementBuffer[--IMEelementCount] = 0;
   if(0==IMEelementCount)
    {
     IMEcandCount=0;
     IMEphoneticCount=0; 
     IMEbValidCandidates=FALSE;
     IMEbValidPhonetic=FALSE;
     IMEelementBuffer[IMEelementCount]=0;
     IMEbFocusOnPhonetic = FALSE;
    }
   
  }
  
     }
 else  if(IMEbFocusOnPhonetic&&IMEphoneticIndex )
  {
  
SEARCH_RESULT=fnPySearch(IMEelementBuffer,IMEphoneticBuffer,IMEcandidateBuffer,PYSEARCH_STEP1_pyz
h);  
  /***********************返回状态*******************************************/
  if (FUC_RIGHT_CALLED==SEARCH_RESULT)
   {
    
fnPySearch(IMEelementBuffer,IMEphoneticBuffer,IMEcandidateBuffer,IMEphoneticIndex);
    IMEcandCount=cscount_result;
    IMEphoneticCount=pycount_result; 
    IMEbValidCandidates=TRUE;
    IMEbValidPhonetic=TRUE;
   }
  }
 else if((!IMEbFocusOnPhonetic)&&IMEbSkipGetCandidate)
  {
   fnCharAssociation(IMELastWord, IMEcandidateBuffer);
   IMEphoneticCount=pycount_result=0; 
   
   IMEelementCount   = 0;
   IMEelementBuffer[IMEelementCount] = 0;
   
   if(cscount_result)
   {
    IMEcandCount=cscount_result;
    IMEbValidCandidates=TRUE;
   }
   
  }
    IMEprediction = IMEelementCount;
    
    if( IMEbValidCandidates )//候选框可见 
    {
        labelSoftlLSK[0]='S';
  
        if( !IMEbPhoneticComfirmed && !IMEfirstCandidate)
        {
            labelSoftRSK[0]='S';
        }
        else
 {
            labelSoftRSK[0]='C';
        }
    }
    rtnCode = IME_CONTINUE;
IME_EXIT:
 
    if( IMEbValidCandidates )
     {
  IMEactive = TRUE;
     }
 
    return( rtnCode );
}

其它的处理参考zi就可以,但是用不了那么多,zi的文档里的api实在太多了