ImeDefs.pas
资源名称:Wingb_Mz.rar [点击查看]
上传用户:wen198501
上传日期:2013-04-01
资源大小:335k
文件大小:12k
源码类别:
输入法编程
开发平台:
Delphi
- {*************************************************}
- { }
- { Copyright (C) 1995-1999 Microsoft Inc. }
- { }
- { Module Name: ImeDefs.h ->> ImeDefs.pas }
- { }
- { Translator: Liu_mazi@126.com, 2005-11-15 }
- { }
- {*************************************************}
- unit ImeDefs;
- {$I Define.Inc}
- interface
- uses Windows, Messages, ImmDev;
- const
- NATIVE_CHARSET = GB2312_CHARSET;
- // resource ID
- const
- IDI_IME = $0100;
- IDS_STATUSERR = $0200;
- IDS_CHICHAR = $0201;
- IDS_EUDC = $0202;
- IDS_USRDIC_FILTER = $0210;
- IDS_FILE_OPEN_ERR = $0220;
- IDS_MEM_LESS_ERR = $0221;
- IDS_SETFILE = $0300;
- IDS_IMENAME = $0320;
- IDS_IMEUICLASS = $0321;
- IDS_IMECOMPCLASS = $0322;
- IDS_IMECANDCLASS = $0323;
- IDS_IMESTATUSCLASS = $0324;
- IDS_IMECMENUCLASS = $0325;
- IDS_IMESOFTKEYMENUCLASS = $0326;
- IDS_IMEREGNAME = $0327;
- IDS_IMENAME_QW = $0328;
- IDS_IMENAME_NM = $0329;
- IDS_IMENAME_UNI = $0330;
- IDS_WARN_OPENREG = $0602;
- IDM_HLP = $0400;
- IDM_OPTGUD = $0403;
- IDM_IMEGUD = $0405;
- IDM_VER = $0401;
- IDM_PROP = $0402;
- IDM_IME = $0450;
- IDM_SKL1 = $0500;
- IDM_SKL2 = $0501;
- IDM_SKL3 = $0502;
- IDM_SKL4 = $0503;
- IDM_SKL5 = $0504;
- IDM_SKL6 = $0505;
- IDM_SKL7 = $0506;
- IDM_SKL8 = $0507;
- IDM_SKL9 = $0508;
- IDM_SKL10 = $0509;
- IDM_SKL11 = $050a;
- IDM_SKL12 = $050b;
- IDM_SKL13 = $050c;
- DlgPROP = 101;
- DlgUIMODE = 102;
- IDC_UIMODE1 = 1001;
- IDC_UIMODE2 = 1002;
- IDC_USER1 = 1003;
- IDC_TRACE = 1000;
- // state of composition
- const
- CST_INIT = 0;
- CST_INPUT = 1;
- CST_CHOOSE = 2;
- CST_SYMBOL = 3;
- CST_SOFTKB = 4; // not in iImeState
- CST_TOGGLE_PHRASEWORD = 5; // not in iImeState
- CST_ALPHABET = 6; // not in iImeState
- CST_ALPHANUMERIC = 7; // not in iImeState
- CST_INVALID = 8; // not in iImeState
- CST_INVALID_INPUT = 9; // not in iImeState
- CST_ONLINE_CZ = 10;
- CST_CAPITAL = 11;
- // state engin
- const
- ENGINE_COMP = 0;
- ENGINE_ASCII = 1;
- ENGINE_RESAULT = 2;
- ENGINE_CHCAND = 3;
- ENGINE_BKSPC = 4;
- ENGINE_MULTISEL = 5;
- ENGINE_ESC = 6;
- const
- CANDPERPAGE = 9;
- MAXSTRLEN = 40;
- MAXCAND = 256;
- IME_MAXCAND = 94;
- IME_XGB_MAXCAND = 190;
- MAXCODE = 12;
- MAXSOFTKEYS = 48;
- // set ime character
- const
- SIC_INIT = 0;
- SIC_SAVE2 = 1;
- SIC_READY = 2;
- SIC_MODIFY = 3;
- SIC_SAVE1 = 4;
- // Candidates 界面风格
- const
- BOX_UI = 0; // 多行方框
- LIN_UI = 1; // 单行长条
- // border for UI
- const
- UI_MARGIN = 4;
- COMP_TEXT_Y = 17;
- const
- UI_CANDINF = 20;
- UI_CANDBTW = 13;
- UI_CANDBTH = 13;
- UI_CANDICON = 16;
- UI_CANDSTR = 300;
- const
- STATUS_DIM_X = 20;
- STATUS_DIM_Y = 20;
- STATUS_NAME_MARGIN = 15; // **
- // if UI_MOVE_OFFSET == WINDOW_NOTDRAG, not in drag operation
- const
- WINDOW_NOT_DRAG = LongInt($FFFFFFFF);
- // window extra for composition window
- const
- UI_MOVE_OFFSET = 0;
- UI_MOVE_XY = 4;
- // the start number of candidate list
- const
- CAND_START = 1;
- uCandHome = 0;
- uCandUp = 1;
- uCandDown = 2;
- uCandEnd = 3;
- CandGBinfoLen = 64;
- // the flag for an opened or start UI
- const
- IMN_PRIVATE_UPDATE_STATUS = $0001;
- IMN_PRIVATE_COMPOSITION_SIZE = $0002;
- IMN_PRIVATE_UPDATE_QUICK_KEY = $0004;
- IMN_PRIVATE_UPDATE_SOFTKBD = $0005;
- IMN_PRIVATE_DESTROYCANDWIN = $0006;
- IMN_PRIVATE_CMENUDESTROYED = $0007;
- IMN_PRIVATE_SOFTKEYMENUDESTROYED = $0008;
- const
- MSG_ALREADY_OPEN = $000001;
- MSG_ALREADY_OPEN2 = $000002;
- MSG_OPEN_CANDIDATE = $000010;
- MSG_OPEN_CANDIDATE2 = $000020;
- MSG_CLOSE_CANDIDATE = $000100;
- MSG_CLOSE_CANDIDATE2 = $000200;
- MSG_CHANGE_CANDIDATE = $001000;
- MSG_CHANGE_CANDIDATE2 = $002000;
- MSG_ALREADY_START = $010000;
- MSG_START_COMPOSITION = $020000;
- MSG_END_COMPOSITION = $040000;
- MSG_COMPOSITION = $080000;
- MSG_IMN_COMPOSITIONPOS = $100000;
- MSG_IMN_UPDATE_SOFTKBD = $200000;
- MSG_IMN_UPDATE_STATUS = $000400;
- MSG_GUIDELINE = $400000;
- MSG_IN_IMETOASCIIEX = $800000;
- MSG_IMN_DESTROYCAND = $004000;
- MSG_BACKSPACE = $000800;
- // this constant is depend on TranslateImeMessage
- const
- GEN_MSG_MAX = 6;
- // the flag for set context
- const
- SC_SHOW_UI = $0001;
- SC_HIDE_UI = $0002;
- SC_ALREADY_SHOW_STATUS = $0004;
- SC_WANT_SHOW_STATUS = $0008;
- SC_HIDE_STATUS = $0010;
- // the new flag for set context
- const
- ISC_SHOWUICANDIDATEWINDOW = $00000001;
- ISC_SHOWUICOMPOSITIONWINDOW = $80000000;
- ISC_SHOWUIGUIDELINE = $40000000;
- ISC_SHOWUIALLCANDIDATEWINDOW = $0000000F;
- ISC_SHOWUIALL = $C000000F;
- ISC_SHOW_SOFTKBD = $02000000;
- ISC_OPEN_STATUS_WINDOW = $04000000;
- ISC_OFF_CARET_UI = $08000000;
- ISC_SHOW_UI_ALL = (ISC_SHOWUIALL or ISC_SHOW_SOFTKBD or ISC_OPEN_STATUS_WINDOW);
- ISC_SETCONTEXT_UI = (ISC_SHOWUIALL or ISC_SHOW_SOFTKBD);
- ISC_HIDE_COMP_WINDOW = $00400000;
- ISC_HIDE_CAND_WINDOW = $00800000;
- ISC_HIDE_SOFTKBD = $01000000;
- // the flag for composition string show status
- const
- IME_STR_SHOWED = $0001;
- IME_STR_ERROR = $0002;
- // the mode configuration for an IME
- const
- MODE_CONFIG_QUICK_KEY = $0001;
- MODE_CONFIG_WORD_PREDICT = $0002;
- MODE_CONFIG_PREDICT = $0004;
- // the virtual key value
- const
- VK_OEM_SEMICLN = $ba; // ; :
- VK_OEM_EQUAL = $bb; // = +
- VK_OEM_SLASH = $bf; // / ?
- VK_OEM_LBRACKET = $db; // [ {
- VK_OEM_BSLASH = $dc; // |
- VK_OEM_RBRACKET = $dd; // ] }
- VK_OEM_QUOTE = $de; // ' "
- const
- MAXMBNUMS = 40;
- // for ime property info
- const
- MAXNUMCODES = 48;
- LINE_LEN = 80;
- CLASS_LEN = 24;
- NumsSK = 13;
- // mb file for create word
- const
- ID_LENGTH = 28;
- NUMTABLES = 7;
- TAG_DESCRIPTION = $00000001;
- TAG_RULER = $00000002;
- TAG_CRTWORDCODE = $00000004;
- // window extra for context menu owner
- const
- CMENU_HUIWND = 0;
- CMENU_MENU = 4;
- SOFTKEYMENU_HUIWND = 0;
- SOFTKEYMENU_MENU = 4;
- const
- WM_USER_DESTROY = (WM_USER + $0400);
- // the flags for GetNearCaretPosition
- const
- NEAR_CARET_FIRST_TIME = $0001;
- NEAR_CARET_CANDIDATE = $0002;
- type
- PUnaDWord = ^DWord;
- PUnaWord = ^Word;
- // local structure, per IME structure
- type
- tagImeL = record
- dwSKState: array[0..NumsSK-1] of DWord;
- dwSKWant: DWord;
- hSKMenu: hMenu; // SoftKeyboard Menu
- hPropMenu: hMenu; // Property Menu
- xCompWi: Integer; // width
- yCompHi: Integer; // height
- ptDefComp: TPoint; // default composition window position
- cxCompBorder: Integer; // border width of composition window
- cyCompBorder: Integer; // border height of composition window
- rcCompText: TRect; // text position relative to composition window key related data
- fModeConfig: Word; // quick key/prediction mode
- nMaxKey: Word; // max key of compsiton str
- end;
- TImeL = tagImeL;
- PImeL = ^tagImeL;
- const
- NFULLABC = 95;
- // match with the IMEG
- type
- tagFullABC = record
- wFullABC: array[0..NFULLABC-1] of Word;
- end;
- TFullABC = tagFullABC;
- PFullABC = ^tagFullABC;
- // global sturcture for ime init data.
- // global structure, can be share by all IMEs,
- // the seperation (IMEL and IMEG) is only
- // useful in UNI-IME, other IME can use one
- type
- tagImeG = record
- fDiffSysCharSet: Bool; // the system charset is not NATIVE_CHARSET
- UsedCodes: array[0..17] of Char;// IME Charact
- wNumCodes: Word;
- IC_Enter: DWord;
- IC_Trace: DWord;
- rcWorkArea: TRect; // the work area of applications
- xChiCharWi: Integer; // Chinese char width & height
- yChiCharHi: Integer;
- // candidate list of composition
- xCandWi: Integer; // width of candidate list
- yCandHi: Integer; // high of candidate list
- cxCandBorder: Integer; // border width of candidate list
- cyCandBorder: Integer; // border height of candidate list
- rcCandText: TRect; // text position relative to candidate window
- rcCandBTD: TRect;
- rcCandBTU: TRect;
- rcCandBTE: TRect;
- rcCandBTH: TRect;
- rcCandInf: TRect;
- rcCandIcon: TRect;
- // status window
- xStatusWi: Integer; // width of status window
- yStatusHi: Integer; // high of status window
- rcStatusText: TRect; // text position relative to status window
- rcImeIcon: TRect; // ImeIcon position relative to status window
- rcImeName: TRect; // ImeName position relative to status window
- rcShapeText: TRect; // shape text relative to status window
- rcSymbol: TRect; // symbol relative to status window
- rcSKText: TRect; // SK text relative to status window
- wFullSpace: Word; // full shape space (reversed internal code)
- wFullABC: array[0..NFULLABC-1] of Word; // full shape chars (internal code)
- szStatusErr: array[0..8] of Char; // error string
- cbStatusErr: Integer;
- iCandStart: Integer; // candidate string start from 0 or 1
- iPara: Integer; // setting of UI
- iPerp: Integer;
- iParaTol: Integer;
- iPerpTol: Integer;
- end;
- TImeG = tagImeG;
- PImeG = ^tagImeG;
- const
- IME_SELECT_GB = $0001;
- IME_SELECT_XGB = $0002;
- IME_SELECT_AREA = $0004;
- // IME private data for each context
- type
- tagPRIVCONTEXT = record
- iImeState: Integer; // the composition state - input, choose, or
- fdwImeMsg: DWord; // what messages should be generated
- dwCompChar: DWord; // wParam of WM_IME_COMPOSITION
- fdwGcsFlag: DWord; // lParam for WM_IME_COMPOSITION
- uSYHFlg: uInt;
- uDYHFlg: uInt;
- uDSMHCount: uInt;
- uDSMHFlg: uInt;
- // input data
- bSeq: array[0..12] of Char; // sequence code of input char
- fdwGB: DWord;
- end;
- TPrivContext = tagPRIVCONTEXT;
- PPrivContext = ^tagPRIVCONTEXT;
- // IME private UI data
- type
- tagUIPRIV = record
- hCompWnd: hWnd; // composition window
- nShowCompCmd: Integer;
- hCandWnd: hWnd; // candidate window for composition
- nShowCandCmd: Integer;
- hSoftKbdWnd: hWnd; // soft keyboard window
- nShowSoftKbdCmd: Integer;
- hStatusWnd: hWnd; // status window
- nShowStatusCmd: Integer;
- fdwSetContext: DWord; // the actions to take at set context time
- hIMC: HImc; // the recent selected hIMC
- hCMenuWnd: hWnd; // a window owner for context menu
- hSoftkeyMenuWnd: hWnd; // a window owner for softkeyboard menu
- end;
- TUIPriv = tagUIPRIV;
- PUIPriv = ^tagUIPRIV;
- // for near caret offset calculatation
- type
- tagNEARCARET = record
- iLogFontFacX: Integer;
- iLogFontFacY: Integer;
- iParaFacX: Integer;
- iPerpFacX: Integer;
- iParaFacY: Integer;
- iPerpFacY: Integer;
- end;
- TNearCaret = tagNEARCARET;
- PNearCaret = ^tagNEARCARET;
- // Other ..
- const
- REGSTR_PATH_SETUP = 'SoftwareMicrosoftWindowsCurrentVersion';
- implementation
- end.