Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

283 lines
8.0 KiB

  1. /******************************************************************************
  2. *
  3. * File Name: wansung.h
  4. *
  5. * - Global Header file for IME of Chicago-H.
  6. *
  7. * Author: Beomseok Oh (BeomOh)
  8. *
  9. * Copyright (C) Microsoft Corp 1993-1994. All rights reserved.
  10. *
  11. ******************************************************************************/
  12. #ifndef _INC_WANSUNG
  13. #define _INC_WANSUNG // #defined if WANSUNG.H has been included.
  14. #ifdef __cplusplus
  15. extern "C" { // Assume C declarations for C++.
  16. #endif // __cplusplus
  17. #include <imm.h>
  18. #include <ime.h>
  19. #include <immp.h>
  20. #include <prsht.h>
  21. #include <winuserp.h>
  22. #define MDB_LOG 0x0000
  23. #define MDB_ERROR 0x0001
  24. #define MDB_SUPPRESS 0x8000
  25. #define MDB_FUNCLOG (MDB_SUPPRESS | MDB_LOG)
  26. #ifdef DEBUG
  27. void _cdecl _MyDebugOut(UINT, LPCSTR, ...);
  28. #define MyDebugOut _MyDebugOut
  29. #define FUNCTIONLOG(sz) MyDebugOut(MDB_FUNCLOG, sz"().")
  30. #define TRAP(cond) { if (cond) _asm int 3 }
  31. #else
  32. #define MyDebugOut 1 ? (void)0 : (void)
  33. #define FUNCTIONLOG(sz)
  34. #define TRAP(cond)
  35. #endif // DEBUG
  36. #define HANDLE_DUMMYMSG(message) case (message): return 0
  37. #define CFILL 1 // Fill code for Consonant
  38. #define VFILL 2 // Fill code for Vowel
  39. enum { NUL, CHO, JUNG, JONG }; // Type of States.
  40. // Constant definitions
  41. #define HANGEUL_LPARAM 0xFFF10001L
  42. #define HANJA_LPARAM 0xFFF20001L
  43. #define VKBACK_LPARAM 0x000E0001L
  44. // For Dialog Box
  45. #define IDD_2BEOL 100
  46. #define IDD_3BEOL1 101
  47. #define IDD_3BEOL2 102
  48. #define IDD_COMPDEL 103
  49. #define IDD_UHCCHAR 104
  50. // For Track Popup Menu
  51. #define IDM_ABOUT 200
  52. #define IDM_CONFIG 201
  53. #define IDS_ABOUT 202
  54. #define IDS_CONFIG 203
  55. // For Property Sheet
  56. #define IDS_PROGRAM 300
  57. #define DLG_GENERAL 301
  58. // For User Interface
  59. #define COMP_WINDOW 0
  60. #define STATE_WINDOW 1
  61. #define CAND_WINDOW 2
  62. #define STATEXSIZE 67
  63. #define STATEYSIZE 23
  64. #define COMPSIZE 22
  65. #define CANDXSIZE 320
  66. #define CANDYSIZE 30
  67. #define GAPX 10
  68. #define GAPY 0
  69. // Data structure definitions
  70. typedef struct tagUIINSTANCE
  71. {
  72. HWND rghWnd[3];
  73. } UIINSTANCE;
  74. typedef UIINSTANCE NEAR *PUIINSTANCE;
  75. typedef UIINSTANCE FAR *LPUIINSTANCE;
  76. typedef struct tagJOHABCODE // For components of Johab code
  77. {
  78. WORD jong :5;
  79. WORD jung :5;
  80. WORD cho :5;
  81. WORD flag :1;
  82. } JOHABCODE;
  83. typedef struct tagHIGH_LOW // For high byte and low byte
  84. {
  85. BYTE low, high;
  86. } HIGH_LOW;
  87. typedef union tagJOHAB // For Johab character code
  88. {
  89. JOHABCODE h;
  90. WORD w;
  91. } JOHAB;
  92. typedef union tagWANSUNG // For Wansung character code
  93. {
  94. HIGH_LOW e;
  95. WORD w;
  96. } WANSUNG;
  97. typedef struct tagIMESTRUCT32
  98. {
  99. WORD fnc; // function code
  100. WORD wParam; // word parameter
  101. WORD wCount; // word counter
  102. WORD dchSource; // offset to Source from top of memory object
  103. WORD dchDest; // offset to Desrination from top of memory object
  104. DWORD lParam1;
  105. DWORD lParam2;
  106. DWORD lParam3;
  107. } IMESTRUCT32;
  108. typedef IMESTRUCT32 *PIMESTRUCT32;
  109. typedef IMESTRUCT32 NEAR *NPIMESTRUCT32;
  110. typedef IMESTRUCT32 FAR *LPIMESTRUCT32;
  111. #define lpSource(lpks) (LPTSTR)((LPSTR)(lpks)+(lpks)->dchSource)
  112. #define lpDest(lpks) (LPTSTR)((LPSTR)(lpks)+(lpks)->dchDest)
  113. // ESCAPE.C
  114. int EscAutomata(HIMC, LPIMESTRUCT32, BOOL);
  115. int EscGetOpen(HIMC, LPIMESTRUCT32);
  116. int EscHanjaMode(HIMC, LPIMESTRUCT32, BOOL);
  117. int EscSetOpen(HIMC, LPIMESTRUCT32);
  118. int EscMoveIMEWindow(HIMC, LPIMESTRUCT32);
  119. // HATMT.C
  120. BOOL HangeulAutomata(BYTE, LPDWORD, LPCOMPOSITIONSTRING);
  121. BOOL MakeInterim(LPCOMPOSITIONSTRING);
  122. void MakeFinal(BOOL, LPDWORD, BOOL, LPCOMPOSITIONSTRING);
  123. void MakeFinalMsgBuf(HIMC, WPARAM);
  124. void Banja2Junja(BYTE, LPDWORD, LPCOMPOSITIONSTRING);
  125. BOOL CheckMCho(BYTE);
  126. BOOL CheckMJung(BYTE);
  127. BOOL CheckMJong(BYTE);
  128. #ifndef JOHAB_IME
  129. WORD Johab2Wansung(WORD);
  130. WORD Wansung2Johab(WORD);
  131. #endif
  132. #ifdef XWANSUNG_IME
  133. //PTHREADINFO PtiCurrent(VOID);
  134. BOOL IsPossibleToUseUHC();
  135. BOOL UseXWansung(void);
  136. #endif
  137. void Code2Automata(void);
  138. void UpdateOpenCloseState(HIMC);
  139. int SearchHanjaIndex(WORD);
  140. // HKEYTBL.C
  141. extern JOHAB JohabChar;
  142. extern WANSUNG WansungChar;
  143. extern UINT uCurrentInputMethod;
  144. extern BOOL fCurrentCompDel;
  145. extern BOOL fComplete;
  146. #ifdef XWANSUNG_IME
  147. extern BOOL fCurrentUseXW;
  148. #endif
  149. extern BYTE bState;
  150. extern BYTE Cho1, Cho2, mCho;
  151. extern BYTE Jung1, Jung2, mJung;
  152. extern BYTE Jong1, Jong2, mJong;
  153. extern const TCHAR szIMEKey[];
  154. #ifdef XWANSUNG_IME
  155. extern const TCHAR szUseXW[];
  156. #endif
  157. extern const TCHAR szInputMethod[];
  158. extern const TCHAR szCompDel[];
  159. extern const TCHAR szStatePos[];
  160. extern const TCHAR szCandPos[];
  161. extern const BYTE Cho2Jong[21];
  162. extern const BYTE Jong2Cho[30];
  163. extern const BYTE rgbMChoTbl[][3];
  164. extern const BYTE rgbMJungTbl[][3];
  165. extern const BYTE rgbMJongTbl[][3];
  166. extern const BYTE bHTable[3][256][4];
  167. #ifndef JOHAB_IME
  168. extern const WORD wKSCompCode[51];
  169. extern const WORD wKSCompCode2[30];
  170. #ifdef XWANSUNG_IME
  171. extern const WORD iTailFirst[];
  172. extern const WORD iTailFirstX[];
  173. extern const BYTE iLeadMap[];
  174. extern const BYTE iLeadMapX[];
  175. extern const BYTE iTailOff[];
  176. extern const BYTE iTailOffX[];
  177. extern const BYTE bTailTable[];
  178. #else
  179. extern const WORD wKSCharCode[2350];
  180. #endif
  181. #endif
  182. extern const WORD wHanjaMap[491];
  183. extern const WORD wHanjaIndex[492];
  184. extern const WORD wHanja[];
  185. // IMEUI.C
  186. extern const TCHAR szUIClassName[], szStateWndName[], szCompWndName[], szCandWndName[];
  187. extern HBITMAP hBMClient, hBMComp, hBMCand, hBMCandNum, hBMCandArr[2];
  188. extern HBITMAP hBMEng, hBMHan, hBMBan, hBMJun, hBMChi[2];
  189. extern HCURSOR hIMECursor;
  190. extern HFONT hFontFix;
  191. extern RECT rcScreen;
  192. extern POINT ptDefPos[3];
  193. extern POINT ptState;
  194. extern POINT ptComp;
  195. extern POINT ptCand;
  196. BOOL InitializeResource(HANDLE);
  197. BOOL RegisterUIClass(HANDLE);
  198. BOOL UnregisterUIClass(HANDLE);
  199. void DrawBitmap(HDC, long, long, HBITMAP);
  200. void ShowWindowBorder(RECT);
  201. void ShowHideUIWnd(HIMC, LPUIINSTANCE, BOOL, LPARAM);
  202. LRESULT CALLBACK UIWndProc(HWND, UINT, WPARAM, LPARAM);
  203. LRESULT CALLBACK StateWndProc(HWND, UINT, WPARAM, LPARAM);
  204. LRESULT CALLBACK CompWndProc(HWND, UINT, WPARAM, LPARAM);
  205. LRESULT CALLBACK CandWndProc(HWND, UINT, WPARAM, LPARAM);
  206. LRESULT DoIMEControl(HWND, WPARAM, LPARAM);
  207. LRESULT DoIMENotify(HWND, WPARAM, LPARAM);
  208. BOOL State_OnSetCursor(HWND, HWND, UINT, UINT);
  209. void State_OnMouseMove(HWND, int, int, UINT);
  210. void State_OnLButtonDown(HWND, BOOL, int, int, UINT);
  211. void State_OnLButtonUp(HWND, int, int, UINT);
  212. void State_OnRButtonDown(HWND, BOOL, int, int, UINT);
  213. void State_OnRButtonUp(HWND, int, int, UINT);
  214. HBITMAP MyCreateMappedBitmap(HINSTANCE, LPTSTR);
  215. void GetSysColorsAndMappedBitmap(void);
  216. void State_OnPaint(HWND);
  217. void State_OnCommand(HWND, int, HWND, UINT);
  218. void State_OnMyMenu(HWND);
  219. void State_OnMyConfig(HWND);
  220. void State_OnMyAbout(HWND);
  221. BOOL Comp_OnSetCursor(HWND, HWND, UINT, UINT);
  222. void Comp_OnMouseMove(HWND, int, int, UINT);
  223. void Comp_OnLButtonDown(HWND, BOOL, int, int, UINT);
  224. void Comp_OnLButtonUp(HWND, int, int, UINT);
  225. void Comp_OnRButtonDown(HWND, BOOL, int, int, UINT);
  226. void Comp_OnRButtonUp(HWND, int, int, UINT);
  227. void Comp_OnPaint(HWND);
  228. BOOL Cand_OnSetCursor(HWND, HWND, UINT, UINT);
  229. void Cand_OnMouseMove(HWND, int, int, UINT);
  230. void Cand_OnLButtonDown(HWND, BOOL, int, int, UINT);
  231. void Cand_OnLButtonUp(HWND, int, int, UINT);
  232. void Cand_OnRButtonDown(HWND, BOOL, int, int, UINT);
  233. void Cand_OnRButtonUp(HWND, int, int, UINT);
  234. void Cand_OnPaint(HWND);
  235. // MAIN.C
  236. extern HINSTANCE hInst;
  237. extern int iTotalNumMsg;
  238. BOOL GenerateCandidateList(HIMC);
  239. void AddPage(LPPROPSHEETHEADER, UINT, DLGPROC);
  240. BOOL CALLBACK GeneralDlgProc(HWND, UINT, WPARAM, LPARAM);
  241. #ifdef __cplusplus
  242. } // End of extern "C" {.
  243. #endif // __cplusplus
  244. #endif // _INC_WANSUNG