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.

169 lines
6.2 KiB

  1. /*************************************************
  2. * data.c *
  3. * *
  4. * Copyright (C) 1999 Microsoft Inc. *
  5. * *
  6. *************************************************/
  7. #include <windows.h>
  8. #include <regstr.h>
  9. #include <immdev.h>
  10. #include "imeattr.h"
  11. #include "imedefs.h"
  12. #pragma data_seg("INSTDATA")
  13. HINSTANCE hInst = NULL;
  14. LPIMEL lpImeL = NULL; // per instance pointer to &sImeL
  15. INSTDATAL sInstL = {0};
  16. LPINSTDATAL lpInstL = NULL;
  17. #pragma data_seg()
  18. IMEG sImeG;
  19. IMEL sImeL;
  20. int iDx[3 * CANDPERPAGE];
  21. const TCHAR szDigit[] = TEXT("01234567890");
  22. // convert char to upper case
  23. const BYTE bUpper[] = {
  24. // 0x20 - 0x27
  25. 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27,
  26. // 0x28 - 0x2F
  27. 0x28, 0x29, 0x2A, 0x2B, 0x2C, 0x2D, 0x2E, 0x2F,
  28. // 0x30 - 0x37
  29. 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37,
  30. // 0x38 - 0x3F
  31. 0x38, 0x39, 0x3A, 0x3B, 0x3C, 0x3D, 0x3E, 0x3F,
  32. // 0x40 - 0x47
  33. 0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47,
  34. // 0x48 - 0x4F
  35. 0x48, 0x49, 0x4A, 0x4B, 0x4C, 0x4D, 0x4E, 0x4F,
  36. // 0x50 - 0x57
  37. 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57,
  38. // 0x58 - 0x5F
  39. 0x58, 0x59, 0x5A, 0x5B, 0x5C, 0x5D, 0x5E, 0x5F,
  40. // ` a b c d e f g
  41. '`', 'A', 'B', 'C', 'D', 'E', 'F', 'G',
  42. // h i j k l m n o
  43. 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O',
  44. // p q r s t u v w
  45. 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W',
  46. // x y z { | } ~
  47. 'X', 'Y', 'Z', '{', '|', '}', '~'
  48. };
  49. const WORD fMask[] = { // offset of bitfield
  50. 0x0001, 0x0002, 0x0004, 0x0008, 0x0010, 0x0020, 0x0040, 0x0080,
  51. 0x0100, 0x0200, 0x0400, 0x0800, 0x1000, 0x2000, 0x4000, 0x8000
  52. };
  53. const TCHAR szRegNearCaret[] = TEXT("Control Panel\\Input Method");
  54. const TCHAR szPara[] = TEXT("Parallel Distance");
  55. const TCHAR szPerp[] = TEXT("Perpendicular Distance");
  56. const TCHAR szParaTol[] = TEXT("Parallel Tolerance");
  57. const TCHAR szPerpTol[] = TEXT("Perpendicular Tolerance");
  58. // 0
  59. // |
  60. // Parallel Dist should on x, Penpendicular Dist should on y
  61. // LofFontHi also need to be considered as the distance
  62. // *-----------+
  63. // 1 * LogFontHi | |
  64. // +-----------+
  65. // 1 * LogFontWi
  66. // 900 1 * LogFontWi
  67. // +------------+
  68. // -1 * LogFontHi | |
  69. // *------------+
  70. // Parallel Dist should on y, Penpendicular Dist should on x
  71. // LofFontHi also need be considered as distance
  72. // -
  73. // 1800
  74. // |
  75. // Parallel Dist should on (- x), Penpendicular Dist should on y
  76. // LofFontHi do not need be considered as distance
  77. // *------------+
  78. // 1 * LogFontHi | |
  79. // +------------+
  80. // 1 * LogFontWi
  81. // 2700
  82. // _
  83. // Parallel Dist should on (- y), Penpendicular Dist should on (- x)
  84. // LofFontHi also need to be considered as the distance
  85. // +------------*
  86. // 1 * LogFontHi | |
  87. // +------------+
  88. // -1 * LogFontWi
  89. // decide UI offset base on escapement
  90. const NEARCARET ncUIEsc[] = {
  91. // LogFontX LogFontY ParaX PerpX ParaY PerpY
  92. { 0, 1, 1, 0, 0, 1}, // 0
  93. { 1, 0, 0, 1, 1, 0}, // 900
  94. { 0, 0, -1, 0, 0, 1}, // 1800
  95. {-1, 0, 0, -1, -1, 0} // 2700
  96. };
  97. // decide input rectangle base on escapement
  98. const POINT ptInputEsc[] = {
  99. // LogFontWi LogFontHi
  100. {1, 1}, // 0
  101. {1, -1}, // 900
  102. {1, 1}, // 1800
  103. {-1, 1} // 2700
  104. };
  105. // decide another UI offset base on escapement
  106. const NEARCARET ncAltUIEsc[] = {
  107. // LogFontX LogFontY ParaX PerpX ParaY PerpY
  108. { 0, 0, 1, 0, 0, -1}, // 0
  109. { 0, 0, 0, -1, 1, 0}, // 900
  110. { 0, 0, -1, 0, 0, -1}, // 1800
  111. { 0, 0, 0, 1, -1, 0} // 2700
  112. };
  113. // decide another input rectangle base on escapement
  114. const POINT ptAltInputEsc[] = {
  115. // LogFontWi LogFontHi
  116. {1, -1}, // 0
  117. {-1, -1}, // 900
  118. {1, -1}, // 1800
  119. {1, 1} // 2700
  120. };
  121. const TCHAR szRegRevKL[] = TEXT("Reverse Layout");
  122. const TCHAR szRegUserDic[] = TEXT("User Dictionary");
  123. // per user setting for
  124. const TCHAR szRegAppUser[] = REGSTR_PATH_SETUP;
  125. const TCHAR szRegModeConfig[] = TEXT("Mode Configuration");
  126. // all shift keys are not for typing reading characters
  127. const BYTE bChar2VirtKey[] = {
  128. // ' ' ! " # $ % & '
  129. 0, 0, 0, 0, 0, 0, 0, VK_OEM_QUOTE,
  130. // ( ) * + , - . /
  131. 0, 0, 0, 0, VK_OEM_COMMA, VK_OEM_MINUS, VK_OEM_PERIOD, VK_OEM_SLASH,
  132. // 0 1 2 3 4 5 6 7
  133. '0', '1', '2', '3', '4', '5', '6', '7',
  134. // 8 9 : ; < = > ?
  135. '8', '9', 0, VK_OEM_SEMICLN, 0, VK_OEM_EQUAL, 0, 0,
  136. // @ A B C D E F G
  137. 0, 'A', 'B', 'C', 'D', 'E', 'F', 'G',
  138. // H I J K L M N O
  139. 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O',
  140. // P Q R S T U V W
  141. 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W',
  142. // X Y Z [ \ ] ^ _
  143. 'X', 'Y', 'Z', VK_OEM_LBRACKET, VK_OEM_BSLASH, VK_OEM_RBRACKET, 0, 0
  144. };