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

📄 mmichineseinput.c

📁 是一个手机功能的模拟程序
💻 C
📖 第 1 页 / 共 5 页
字号:
/*******************************************************************************

                    CONDAT (UK)

********************************************************************************                                                                              

 This software product is the property of Condat (UK) Ltd and may not be
 disclosed to any third party without the express permission of the owner.                                 
                                                                              
********************************************************************************

 $Project name:	Basic MMI                                                      
 $Project code:	BMI (6349)                                                           
 $Module:		MmiChineseInput
 $File:		    MmiChineseInput.c
 $Revision:		1.0                                                       
                                                                              
 $Author:		Condat(UK)                                                         
 $Date:		    25/10/00                                                      
                                                                               
********************************************************************************
                                                                              
 Description:MMI Chinese Input handling.
 

                         
********************************************************************************

 $History: MmiChineseInput.c

    25/10/00			Original Condat(UK) BMI version.
    10/11/2003          sunsj
                        fix the bug that can't insert char to text.
       
 $End

*******************************************************************************/


/*******************************************************************************
                                                                              
                                Include Files
                                                                              
*******************************************************************************/
#include <stdio.h>
#include <string.h>
/*kk tracing*/

#if defined (NEW_FRAME)

    #include "typedefs.h"
    #include "vsi.h"
    #include "pei.h"
    #include "custom.h"
    #include "gsm.h"

#else

    #include "stddefs.h"
    #include "custom.h"
    #include "gsm.h"
    #include "vsi.h"

#endif


/*kk tracing end*/

//#include "mfw_sys.h"

//GW #include "stddefs.h"    // needed for mfw_mfw.h
#include "mfw_mfw.h"
#include "mfw_win.h"
#include "mfw_kbd.h"
#include "mfw_edt.h"
#include "mfw_tim.h"
#include "mfw_phb.h"
#include "mfw_sms.h"
#include "mfw_icn.h"
#include "mfw_mnu.h"
#include "mfw_lng.h"
#include "mfw_sat.h"
#include "mfw_kbd.h"
#include "mfw_nm.h"

#include "dspl.h"

#include "ksd.h"
#include "psa.h"

#include "MmiMain.h"
#include "MmiDummy.h"
//JVJE #include "MmiMsgsEdit.h"
//#include "MmiLists.h"
#include "MmiMmi.h"

#include "MmiDialogs.h"
#include "MmiLists.h"
#include "MmiMenu.h"
#include "MmiSoftKeys.h"
#include "MMIChineseInput.h"
//#include "MmiLatinPredText.h"
#include "Mmieditor_i.h"
#include "MmiSmsBroadcast.h"
#include "MmiSmsMenu.h"
#include "MmiSmsSend.h"
/* JF Modified */
//#include "MmiBookController.h"
//#include "cus_aci.h"
//#include "p_sim.h"
//#include "pcm.h"

/* Joseph Lee modified */
//#include "MmiSmsSend.h
/* START NEW PART */

//extern int SymbolChar;

/* 2003/10/13 sunsj/ store pinyin element */
typedef struct
{
    ZI8SHORT Count;
    ZI8WCHAR PinyinEleBUF[10][6];
} Pinyin_EleBUF;

static const unsigned char TextIconeZiTextSmall[] =
{
    0x03,
    0x03,
    0x18,
    0x7c,
    0xcc,
    0x08,
    0x10,
    0x0c
};

USHORT  TEXT_BUFFER_EDIT_SIZE;
static ZI8WCHAR chinese_input_buffer[70];   /* 2003/10/13 sunsj */
static int  editor_input_mode;              /* 2003/10/26 sunsj */
extern TextCursor;
#define   MaxPinYin 402						/* 2003/10/13 sunsj */

const char  StrokePrompt[]  = {0x7B, 0x14, 0x52, 0x12, 0x00, 0x3A, 0x00, 0x00};
const char  PinYinPrompt[]  = {0x62, 0xFC, 0x97, 0xF3, 0x00, 0x3A, 0x00, 0x00};
ZI8WCHAR const ZiStrokeKeyMap[10][3] =   /* table for PINYIN */
{
    {0,   ZI8_STROKE_MORE},
    {1,   ZI8_STROKE_OVER},
    {2,   ZI8_STROKE_DOWN},
    {3,   ZI8_STROKE_LEFT},
    {4,   ZI8_STROKE_DOT},
    {5,   ZI8_STROKE_OVER_DOWN},
    {6,   ZI8_STROKE_CURVED_HOOK},
    {7,   ZI8_STROKE_DOWN_OVER},
    {8,   ZI8_STROKE_MORE},
    {9,   ZI8_STROKE_OVER_DOWN_OVER},
};

ZI8WCHAR const ZiPinYinKeyMap[9][6] =   /* table for PINYIN */
{
    {ZI8_CODE_TONES_1,    ZI8_CODE_TONES_2,   ZI8_CODE_TONES_3,   ZI8_CODE_TONES_4,   ZI8_CODE_TONES_5,   5},
    {ZI8_CODE_PINYIN_A,   ZI8_CODE_PINYIN_B,  ZI8_CODE_PINYIN_C,  0,                  0,                  3},
    {ZI8_CODE_PINYIN_D,   ZI8_CODE_PINYIN_E,  ZI8_CODE_PINYIN_F,  0,                  0,                  3},
    {ZI8_CODE_PINYIN_G,   ZI8_CODE_PINYIN_H,  ZI8_CODE_PINYIN_I,  0,                  0,                  3},
    {ZI8_CODE_PINYIN_J,   ZI8_CODE_PINYIN_K,  ZI8_CODE_PINYIN_L,  0,                  0,                  3},
    {ZI8_CODE_PINYIN_M,   ZI8_CODE_PINYIN_N,  ZI8_CODE_PINYIN_O,  0,                  0,                  3},
    {ZI8_CODE_PINYIN_P,   ZI8_CODE_PINYIN_Q,  ZI8_CODE_PINYIN_R,  ZI8_CODE_PINYIN_S,  0,                  4},
    {ZI8_CODE_PINYIN_T,   ZI8_CODE_PINYIN_U,  ZI8_CODE_PINYIN_V,  0,                  0,                  3},
    {ZI8_CODE_PINYIN_W,   ZI8_CODE_PINYIN_X,  ZI8_CODE_PINYIN_Y,  ZI8_CODE_PINYIN_Z,  0,                  4},
};

/* 2003/10/13 sunsj add for pinyin input */
static const char  * PinyinTable[MaxPinYin] = {
    "a","ai","an","ang","ao","ba","bai","ban","bang","bao",
    "bei","ben","beng","bi","bian","biao","bie","bin","bing","bo",
    "bu","ca","cai","can","cang","cao","ce","cen","ceng","cha",
    "chai","chan","chang","chao","che","chen","cheng","chi","chong","chou",
    "chu","chuai","chuan","chuang","chui","chun","chuo","ci","cong","cou",
    "cu","cuan","cui","cun","cuo","da","dai","dan","dang","dao",
    "de","deng","di","dia","dian","diao","die","ding","diu","dong",
    "dou","du","duan","dui","dun","duo","e","ei","en","er",
    "fa","fan","fang","fei","fen","feng","fo","fou","fu","ga",
    "gai","gan","gang","gao","ge","gei","gen","geng","gong","gou",
    "gu","gua","guai","guan","guang","gui","gun","guo","ha","hai",
    "han","hang","hao","he","hei","hen","heng","hong","hou","hu",
    "hua","huai","huan","huang","hui","hun","huo","ji","jia","jian",
    "jiang","jiao","jie","jin","jing","jiong","jiu","ju","juan","jue",
    "jun","ka","kai","kan","kang","kao","ke","ken","keng","kong",
    "kou","ku","kua","kuai","kuan","kuang","kui","kun","kuo","la",
    "lai","lan","lang","lao","le","lei","leng","li","lia","lian",
    "liang","liao","lie","lin","ling","liu","long","lou","lu","luan",
    "lue","lun","luo","lv","ma","mai","man","mang","mao","me",
    "mei","men","meng","mi","mian","miao","mie","min","ming","miu",
    "mo","mou","mu","na","nai","nan","nang","nao","ne","nei",
    "nen","neng","ni","nian","niang","niao","nie","nin","ning","niu",
    "nong","nou","nu","nuan","nue","nuo","nv","o","ou","pa",
    "pai","pan","pang","pao","pei","pen","peng","pi","pian","piao",
    "pie","pin","ping","po","pou","pu","qi","qia","qian","qiang",
    "qiao","qie","qin","qing","qiong","qiu","qu","quan","que","qun",
    "ran","rang","rao","re","ren","reng","ri","rong","rou","ru",
    "ruan","rui","run","ruo","sa","sai","san","sang","sao","se",
    "sen","seng","sha","shai","shan","shang","shao","she","shen","sheng",
    "shi","shou","shu","shua","shuai","shuan","shuang","shui","shun","shuo",
    "si","song","sou","su","suan","sui","sun","suo","ta","tai",
    "tan","tang","tao","te","teng","ti","tian","tiao","tie","ting",
    "tong","tou","tu","tuan","tui","tun","tuo","wa","wai","wan",
    "wang","wei","wen","weng","wo","wu","xi","xia","xian","xiang",
    "xiao","xie","xin","xing","xiong","xiu","xu","xuan","xue","xun",
    "ya","yan","yang","yao","ye","yi","yin","ying","yo","yong",
    "you","yu","yuan","yue","yun","za","zai","zan","zang","zao",
    "ze","zei","zen","zeng","zha","zhai","zhan","zhang","zhao","zhe",
    "zhen","zheng","zhi","zhi","zhong","zhou","zhu","zhua","zhuai","zhuan",
    "zhuang","zhui","zhun","zhuo","zi","zong","zou","zu","zuan","zui","zun","zuo"
};

typedef struct _IME_DATA
{
    int             CandidateCursor;    /* the indication of the current candidate highlighted */
    unsigned short  TextBufferCount;    // Total number of characters contained in the wszTextBuffer.
    unsigned char   candidates;         /* last returned number of candidates */
    int             TextCursor;         /* the current test cursor */
    PZI8WCHAR       pTextBuffer;        /* the start of the text buffer */
    int             TextBufferEditSize; /*  */
    int             TextBufferSize;     /*  */
    unsigned char   moreCount;          /* keeps track of the more count */
    PZI8WCHAR       pDisplayElementBuffer;
    ZI8UCHAR        EditorMode;         // To store current editor mode i.e. stroke, PinYin
    unsigned char   InputScreenType;    // This variable is to state the different screen type. 
    PZI8GETPARAM    pGetParam;          /* pointer to Zi8GetParam */
    Pinyin_EleBUF   PinyinElementBUF[6];    /* 2003/10/13 sunsj/ pinyin element buffer */
    USHORT      PinyinDisplayBuf[ELEMENT_PERPAGE][TEXT_BUFFER_EXTRA_SPACE+1];   /* 2003/10/13 sunsj/ pinyin display buffer */
    USHORT      Element_Select;         /* 2003/10/13 sunsj/ the pinyin which user select */
    USHORT      ElementNumber;          /* 2003/10/13 sunsj/ the whole pinyin number */
    ZI8WCHAR        Association_Buffer[10]; /* 2003/10/13 sunsj/ association buf */
} IME_DATA, * pIME_DATA;

typedef struct
{
    T_MMI_CONTROL       mmi_control;
    T_MFW_HND           parent_win;
    T_MFW_HND           input_win;
    T_MFW_HND           input_kbd;
//    T_MFW_HND			edt;
    USHORT              Identifier;

    ZI8UCHAR            version;    
    ZI8WCHAR*           wszTextBuffer;/*[TEXT_BUFFER_EDIT_SIZE + 1];*/  /* TEXT_BUFFER_EDIT_SIZE = 80 */
    ZI8WCHAR            DisplayElementBuffer[TEXT_BUFFER_EXTRA_SPACE + 1];  /* TEXT_BUFFER_EXTRA_SPACE = 20 */
    ZI8WCHAR            wszElementBuffer[TEXT_BUFFER_EXTRA_SPACE + 1];      /* TEXT_BUFFER_EXTRA_SPACE = 20 */
    ZI8GETPARAM         GetParam;
    IME_DATA            Ime;
    ZI8WCHAR            wcCandidates[2*CANDIDATES_PER_GROUP+1];           /* CANDIDATES_PER_GROUP = 7 */    /* 2003/10/13 sunsj */
    ZI8WCHAR            StartOfDisplayIndex;
    ZI8WCHAR            HighlightedCandidate[2];  // This arrary is used to store the highlighted character pointed by CandidateCursor
    ZI8WCHAR            CursorPosition[2];  //Used to show the cursor Position in the composed text.
    ZI8UCHAR            NumberOfKeyPress;
    CHAR                PerviousKeyPress;
    T_MFW_HND           options_win;
    //MfwEdtAttr		edt_attr;
    /* Start of variable decleared for dummy functions. This is to be removed when eZiText code is received*/
    /* End */
    T_CHINESE_DATA      Callback_Data;
} T_chinese_input;

static T_MFW_HND    chinese_input_create        (T_MFW_HND  parent_win);
static void     chinese_input_exec          (T_MFW_HND  win, USHORT event, SHORT value, void * parameter);
static int  chinese_input_win_cb        (T_MFW_EVENT event, T_MFW_WIN * win);
static int  chinese_input_kbd_cb        (T_MFW_EVENT event, T_MFW_KBD * keyboard);

/* Initialize the defined structure */
void IMEInitialize(pIME_DATA pIME, PZI8GETPARAM pGetParam, PZI8WCHAR wszTextBuffer, int TextBufferEditSize,
                   int TextBufferSize, PZI8WCHAR wcCandidates, PZI8WCHAR wszElementBuffer, PZI8WCHAR DisplayElementBuffer);
void IMECursorLeft(pIME_DATA pIME); /* move the cadidate cursor left */
void IMECursorRight(pIME_DATA pIME); /* move the cadidate cursor right */
void IMESelectCandidate(pIME_DATA pIME, PZI8WCHAR wszElementBuffer); /* Select the candidate at sursor */
void IMEMore(pIME_DATA pIME); /* get the next group of candidates */
void IMEKeyPress(pIME_DATA pIME, ZI8WCHAR wcStroke); /* enter the stroke and get new candidates */
void IMEClear(pIME_DATA pIME, PZI8WCHAR wszElementBuffer); /* Clear the last stroke entered */
void CandidateHighlightDisplayContorl(pIME_DATA pIME, PZI8WCHAR HighlightedCandidate);
void TextCursorDisplayContorl(pIME_DATA pIME, PZI8WCHAR CursorPosition, int InsertLine);
void IMEChangeMode(pIME_DATA pIME, PZI8GETPARAM pGetParam);
void DataConvert(pIME_DATA pIME);

⌨️ 快捷键说明

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