Back to index

im-sdk  12.3.91
Classes | Defines | Typedefs | Enumerations | Functions | Variables
neima_interface.c File Reference
#include <stdio.h>
#include "ime.h"
#include "ime_buffer.h"

Go to the source code of this file.

Classes

struct  _TUserPreference

Defines

#define MAX_PREEDIT_BYTES   16
#define MAX_CANDIDATES_NUM   16
#define MAX_CANDIDATE_BYTES   16
#define MAX_NUMBERING_BYTES   4
#define MAX_COMMIT_BYTES   16

Typedefs

typedef struct _TUserPreference TUserPreference

Enumerations

enum  {
  LANG_NONE = 0, LANG_ZHCN = ENCODE_GB18030, LANG_ZHTW_BIG5 = ENCODE_BIG5, LANG_ZHTW_BIG5HKSCS = ENCODE_BIG5HKSCS,
  LANG_ZHTW_EUCTW = ENCODE_EUCTW
}

Functions

ImeResult neima_Initialize (ImeInfo ime_info)
ImeResult neima_Destroy (ImeInfo ime_info)
ImeResult neima_Create_Session (ImeInputContext ic)
ImeResult neima_Destroy_Session (ImeInputContext ic)
ImeResult neima_Process_Key_Event (ImeInputContext ic, ImeKey key_event)
ImeResult neima_FocusIn (ImeInputContext ic)
ImeResult neima_FocusOut (ImeInputContext ic)
ImeResult neima_Create_User (ImeInputContext ic)
ImeResult neima_Destroy_User (ImeInputContext ic)
ImeResult neima_Create_Desktop (ImeInputContext ic)
ImeResult neima_Destroy_Desktop (ImeInputContext ic)
ImeResult RegisterIME (ImmServices srvs, ImeInfo *ppinfo, ImeMethods *pmthds, int argc, char **argv)
static int get_ime_language (ImeInputContext ic)
static ImHandle get_candidate_aux (ImeInputContext ic)
static ImeResult my_update_candidates (ImeInputContext ic, ImeBufferRec *ime_buffer)

Variables

ImeMethodsRec neima_methods
ImmServices imm_services = NULL

Class Documentation

struct _TUserPreference

Definition at line 53 of file neima_interface.c.

Class Members
int show_unicode_value
int show_utf8_value

Define Documentation

#define MAX_CANDIDATE_BYTES   16

Definition at line 201 of file neima_interface.c.

#define MAX_CANDIDATES_NUM   16

Definition at line 200 of file neima_interface.c.

#define MAX_COMMIT_BYTES   16

Definition at line 203 of file neima_interface.c.

#define MAX_NUMBERING_BYTES   4

Definition at line 202 of file neima_interface.c.

#define MAX_PREEDIT_BYTES   16

Definition at line 199 of file neima_interface.c.


Typedef Documentation


Enumeration Type Documentation

anonymous enum
Enumerator:
LANG_NONE 
LANG_ZHCN 
LANG_ZHTW_BIG5 
LANG_ZHTW_BIG5HKSCS 
LANG_ZHTW_EUCTW 

Definition at line 59 of file neima_interface.c.


Function Documentation

static ImHandle get_candidate_aux ( ImeInputContext  ic) [static]

Definition at line 139 of file neima_interface.c.

Here is the caller graph for this function:

static int get_ime_language ( ImeInputContext  ic) [static]

Definition at line 132 of file neima_interface.c.

{
    ImeInfo ime_info = imm_services->ImmGetImeInfo(ic);
    return (ime_info)?((int)ime_info->specific_data):(LANG_NONE);
}

Here is the caller graph for this function:

static ImeResult my_update_candidates ( ImeInputContext  ic,
ImeBufferRec ime_buffer 
) [static]

Definition at line 162 of file neima_interface.c.

{
    int sz = 0;
    ImeEventRec         event;

    ime_buffer->candidates.horizental = 0;

    event.any_event.ic = ic;
    event.any_event.peer = get_candidate_aux(ic);
    if (ime_buffer) sz = ime_buffer->candidates.count;
    if ((get_ime_language(ic) == LANG_ZHCN) && (event.any_event.peer != 0)) { //make sure the aux start successfully
        if (sz == 0) {
            event.type = IME_EVENT_EXPOSE;
            event.any_event.param = 0;    //hide candidates
            imm_services->ImmSendUiMessage(&event);
        } else {
            event.type = IME_EVENT_EXPOSE;
            event.any_event.param = IMUI_STATE_SHOW;    //show candidates
            imm_services->ImmSendUiMessage(&event);
            event.type = IME_EVENT_CANDI_DATA;
            event.any_event.param = ENCODE_GB18030;
            event.candidate_data_event.candidates = &(ime_buffer->candidates);
            imm_services->ImmSendUiMessage(&event);
        }
    } else {
        if (sz == 0)
            imm_services->ImmHideCandidates(ic);
        else {
            imm_services->ImmShowCandidates(ic);
            imm_services->ImmUpdateCandidates(ic, &ime_buffer->candidates);
        }
    }

    return IME_OK;
}

Here is the call graph for this function:

ImeResult RegisterIME ( ImmServices  srvs,
ImeInfo ppinfo,
ImeMethods pmthds,
int  argc,
char **  argv 
)

Definition at line 71 of file neima_interface.c.

{
    int enc, lang = LANG_NONE;
    ImeInfoRec *ime_info = NULL;

    DEBUG_printf("    ====>Register NeiMa IM: argc: %d\n", argc);
    if (argc == 1) { // IMM should not load it twice for same parameter
        if (strcmp(argv[0], "zh_CN") == 0) {
            lang = LANG_ZHCN;
        } else if (strcmp(argv[0], "BIG5") == 0) {
            lang = LANG_ZHTW_BIG5;
        } else if (strcmp(argv[0], "BIG5HKSCS") == 0) {
            lang = LANG_ZHTW_BIG5HKSCS;
        } else if (strcmp(argv[0], "EUCTW") == 0) {
            lang = LANG_ZHTW_EUCTW;
        }
    }
    if (argc != 1 || lang == LANG_NONE){
        DEBUG_printf("        ====>Please using argument [zh_CN|BIG5|BIG5HKSCS|EUCTW]\n");
        return IME_FAIL;
    }

    ime_info = (ImeInfoRec *)malloc(sizeof(ImeInfoRec)); //suppose success

    ime_info->version             = 100;
    ime_info->mt_safe             = 0;
    ime_info->encoding            = lang;
    ime_info->uuid                = "neima-1d76e189-9a54-4a24-8cf7-5d611f3d555f";
    ime_info->author              = "Phill Zhang <Phill.Zhang@sun.com>";
    ime_info->copyright           = "Copyright (c) 2005 Sun Microsystems";;
    ime_info->icon_file           = "neima.xpm";
    ime_info->pl                  = NULL;
    ime_info->specific_data       = (void*)lang;
    ime_info->hinting             = NULL;

    switch (lang) {
    case LANG_ZHCN:
        ime_info->name       = "";
        ime_info->support_locales = "zh,zh_CN,zh_CN.GB2312,zh_CN.GBK,zh_CN.UTF-8,zh_CN.GB18030";
        break;
    case LANG_ZHTW_BIG5:
        ime_info->name       = "BIG5X";
        ime_info->support_locales = "zh_TW,zh_TW.BIG5,zh_TW.UTF-8";
        break;
    case LANG_ZHTW_BIG5HKSCS:
        ime_info->name       = "BIG5HKSCSX";
        ime_info->support_locales = "zh_HK,zh_HK.BIG5HKSCS,zh_HK.UTF-8";
        break;
    case LANG_ZHTW_EUCTW:
        ime_info->name       = "EUC";
        ime_info->support_locales = "zh_TW.EUCTW,zh_TW.UTF-8";
        break;
    }
    *ppinfo = ime_info;
    *pmthds = &neima_methods;
    imm_services = srvs;

    return (IME_OK);
}

Variable Documentation

Definition at line 49 of file neima_interface.c.