00001
00002
00003
00004
00005
00006
00007
#if DBG==1
00008
00009
00010
00011
#endif
00012
00013
00014
00015
00016
00017 #define WINDOWMENU 1
00018 #define ID_CONSOLEIME_ICON 2
00019
00020
00021
00022
00023 #define MM_ABOUT 8001
00024 #define MM_EXIT 8002
00025 #define MM_ACCESS_VIOLATION 8003
00026
00027
00028
00029 #define errTitle 0
00030 #define IDS_MENUNAME 12
00031 #define IDS_APPNAME 13
00032 #define IDS_CLASSNAME 14
00033 #define IDS_TITLE 15
00034
00035 #define IDS_LAST 15 // Put New Strings Before this one
00036
00037
00038
00039
00040
#ifdef DEBUG_PRINT
00041
#define DBGPRINT(_params_) DbgPrint _params_
00042
#else
00043 #define DBGPRINT(_params_)
00044
#endif
00045
00046 #define CONSOLE_INITIAL_TABLE 10
00047 #define CONSOLE_CONSOLE_TABLE_INCREMENT 5
00048 #define HKL_INITIAL_TABLE 1
00049 #define HKL_TABLE_INCREMENT 1
00050
00051 #define CVMAX 2048
00052 #define NUMMAX 100
00053 #define CMAX 160
00054 #define MAXROW 1
00055 #define MAXCOL 80
00056 #define FIRSTROW 0
00057 #define FIRSTCOL 0
00058 #define LASTROW (MAXROW-1)
00059 #define LASTCOL (MAXCOL-1)
00060 #define TABSTOP 8
00061 #define MAX_LISTCAND 32
00062 #define MAX_CHARS_PER_LINE 10
00063 #define MAX_COMP_STRING_LEN 10
00064 #define DEFAULT_CAND_NUM_PER_PAGE 5
00065 #define X_INDENT 10
00066 #define Y_INDENT 10
00067 #define DELIMITERWIDTH 3 // 1:xxx 2:xxx
00068 #define DEFAULTCANDTABLE 100
00069 #define DISPCHANGELIMIT 188
00070 #define CODEDISPLEN 7 // '[F040] '
00071 #define DEFAULT_TEMP_WIDTH 80
00072
00073 #define KEY_TOGGLED 0x01
00074
00075 #define MaxBufSize 256
00076 #define KBDLAYOUT TEXT("SYSTEM\\CurrentControlSet\\Control\\Keyboard Layouts")
00077 #define KBDLAYOUTTEXT TEXT("layout text")
00078 #define KBDSEPALATER TEXT("\\")
00079
00080 #define LANG_ID_TAIWAN MAKELANGID(LANG_CHINESE,SUBLANG_CHINESE_TRADITIONAL) // 0x0404
00081 #define LANG_ID_JAPAN MAKELANGID(LANG_JAPANESE,SUBLANG_DEFAULT) // 0x0411
00082 #define LANG_ID_KOREA MAKELANGID(LANG_KOREAN,SUBLANG_DEFAULT) // 0x0412
00083 #define LANG_ID_PRC MAKELANGID(LANG_CHINESE,SUBLANG_CHINESE_SIMPLIFIED) // 0x0804
00084
00085 typedef struct _HKL_TABLE {
00086 HKL
hkl;
00087 DWORD dwConversion;
00088 }
HKL_TABLE, *
LPHKL_TABLE;
00089
00090 typedef struct _CONSOLE_TABLE {
00091
00092
00093
00094 HANDLE
hConsole;
00095 HWND
hWndCon;
00096 COORD
ScreenBufferSize;
00097
00098
00099
00100 HKL
hklActive;
00101 HIMC
hIMC_Current;
00102 HIMC
hIMC_Original;
00103 BOOL fOpen;
00104 DWORD dwConversion;
00105 DWORD dwSentence;
00106 WORD
ConsoleCP;
00107 WORD
ConsoleOutputCP;
00108 WCHAR
LayoutName[
MaxBufSize];
00109 WCHAR
GuideLine[10];
00110
00111
00112
00113 BOOL fInComposition;
00114 LPCONIME_UICOMPMESSAGE lpCompStrMem;
00115 WORD
CompAttrColor[8];
00116
00117
00118
00119 BOOL fInCandidate;
00120 LPCANDIDATELIST
lpCandListMem[
MAX_LISTCAND ];
00121 LPCONIME_CANDMESSAGE SystemLine;
00122 DWORD SystemLineSize;
00123 DWORD CandListMemAllocSize[
MAX_LISTCAND ];
00124 DWORD CandOff;
00125 DWORD CandMax;
00126 LPDWORD
CandSep;
00127 DWORD CandSepAllocSize;
00128 BOOL fNestCandidate;
00129 DWORD ImmGetProperty;
00130
00131
00132
00133 BOOL Enable;
00134 BOOL LateRemove;
00135 INT hklListMax;
00136 LPHKL_TABLE lphklList;
00137
#ifdef DEBUG_MODE
00138
DWORD ImeCandNum;
00139
DWORD CandidateCount;
00140 HWND hListCand[
MAX_LISTCAND ];
00141 WCHAR DispBuf[
CMAX];
00142
#endif
00143
}
CONSOLE_TABLE, *
PCONSOLE_TABLE;
00144
00145 #define IPHK_HOTKEY 0x0001 //
00146 #define IPHK_PROCESSBYIME 0x0002 //
00147 #define IPHK_CHECKCTRL 0x0004 //
00148
00149 #define IS_IME_KBDLAYOUT(hkl) ((HIWORD(HandleToUlong(hkl)) & 0xf000) == 0xe000)
00150 #define HKL_TO_LANGID(hkl) (LOWORD(HandleToUlong(hkl)))
00151
00152
DWORD
00153
ImmCallImeConsoleIME(
00154 HWND hWnd,
00155 UINT Message,
00156 WPARAM wParam,
00157 LPARAM lParam,
00158 PUINT puVKey
00159 );
00160
00161
BOOL
00162
ImmTranslateMessage(
00163 HWND hwnd,
00164 UINT message,
00165 WPARAM wParam,
00166 LPARAM lParam
00167 );
00168
00169
BOOL
00170
ImmSetActiveContextConsoleIME(
00171 HWND hWnd,
00172 BOOL fFlag
00173 );
00174
00175 #define UNICODE_BACKSPACE ((WCHAR)0x08)
00176 #define UNICODE_BACKSPACE2 ((WCHAR)0x25d8)
00177 #define UNICODE_CARRIAGERETURN ((WCHAR)0x0d)
00178 #define UNICODE_LINEFEED ((WCHAR)0x0a)
00179 #define UNICODE_BELL ((WCHAR)0x07)
00180 #define UNICODE_TAB ((WCHAR)0x09)
00181 #define UNICODE_SPACE ((WCHAR)0x20)
00182 #define UNICODE_ZERO ((WCHAR)'0')
00183 #define UNICODE_SLASH ((WCHAR)'/')
00184 #define UNICODE_COLON ((WCHAR)':')
00185 #define UNICODE_LEFT ((WCHAR)'[')
00186 #define UNICODE_RIGHT ((WCHAR)']')
00187 #define UNICODE_HEXBASE ((WCHAR)'7')
00188
00189 #define JAPAN_CODEPAGE 932
00190 #define PRC_CODEPAGE 936
00191 #define KOREA_CODEPAGE 949
00192 #define TAIWAN_CODEPAGE 950
00193
00194 #define PRCCOMPWIDTH 10
00195
00196 #define MODEDISP_NONE 0
00197 #define MODEDISP_PLAURAL 1
00198 #define MODEDISP_SINGLE 2
00199 #define MODEDISP_AUTO 3
00200 #define MODEDISP_PHRASE 4
00201
00202
00203 #define IMECModeRomanLen 4
00204 #define IMECModeKanaLen 4
00205 #define IMECModeAHANLen 3
00206 #define IMECModeAZENLen 2
00207 #define IMECModeHHANLen 3
00208 #define IMECModeHZENLen 2
00209 #define IMECModeKHANLen 3
00210 #define IMECModeKZENLen 2
00211
00212
00213 #define IMECModeFullShapeLen 1
00214 #define IMECModeHalfShapeLen 1
00215 #define IMECModeKeyboardLen 2
00216 #define IMECModeSymbolLen 2
00217 #define IMECGuideLen 5
00218 #define IMECNameLength 4
00219
00220
00221
00222
00223
00224
00225
00226
00227
00228
BOOL
00229
InitConsoleIME(
00230 HINSTANCE hInstance
00231 );
00232
00233 LRESULT
FAR PASCAL
00234
WndProc(
00235 HWND hWnd,
00236 UINT Message,
00237 WPARAM wParam,
00238 LPARAM lParam
00239 );
00240
00241
VOID
00242
ExitList(
00243 HWND hWnd
00244 );
00245
00246
BOOL
00247
InsertConsole(
00248 HWND hWnd,
00249 HANDLE hConsole,
00250 HWND hWndConsole
00251 );
00252
00253
BOOL
00254
GrowConsoleTable(
00255 VOID
00256 );
00257
00258
00259
PCONSOLE_TABLE
00260
SearchConsole(
00261 HANDLE hConsole
00262 );
00263
00264
BOOL
00265
RemoveConsole(
00266 HWND hwnd,
00267 HANDLE hConsole
00268 );
00269
00270
BOOL
00271
RemoveConsoleWorker(
00272 HWND hwnd,
00273 PCONSOLE_TABLE ConTbl
00274 );
00275
00276
BOOL
00277
InsertNewConsole(
00278 HWND hWnd,
00279 HANDLE hConsole,
00280 HWND hWndConsole
00281 );
00282
00283
00284
BOOL
00285
ConsoleSetFocus(
00286 HWND hWnd,
00287 HANDLE hConsole,
00288 HKL hKL
00289 );
00290
00291
BOOL
00292
ConsoleKillFocus(
00293 HWND hWnd,
00294 HANDLE hConsole
00295 );
00296
00297
BOOL
00298
ConsoleScreenBufferSize(
00299 HWND hWnd,
00300 HANDLE hConsolewParam,
00301 COORD ScreenBufferSize
00302 );
00303
00304
BOOL
00305
ConImeInputLangchangeRequest(
00306 HWND hWnd,
00307 HANDLE hConsole,
00308 HKL hkl,
00309
int Direction
00310 );
00311
00312
BOOL
00313
ConImeInputLangchange(
00314 HWND hWnd,
00315 HANDLE hConsole,
00316 HKL hkl
00317 );
00318
00319 LRESULT
00320
ConsoleImeSendMessage(
00321 HWND hWndConsoleIME,
00322 WPARAM wParam,
00323 LPARAM lParam
00324 );
00325
00326
BOOL
00327
InputLangchange(
00328 HWND hWnd,
00329 DWORD CharSet,
00330 HKL hkl );
00331
00332
#ifdef DEBUG_MODE
00333
00334
VOID
00335 DisplayConvInformation(
00336 HWND hWnd
00337 );
00338
00339
VOID
00340 DisplayInformation(
00341 HWND hWnd,
00342 HANDLE hConsole
00343 );
00344
00345
VOID
00346 RealReDraw(
00347 HDC r_hdc
00348 );
00349
00350
VOID
00351 ReDraw(
00352 HWND hWnd
00353 );
00354
#endif
00355
00356
00357
00358
00359
00360
INT
00361
Create(
00362 HWND hWnd
00363 );
00364
00365
void
00366
ImeUIStartComposition(
00367 HWND hwnd
00368 );
00369
00370
void
00371
ImeUIEndComposition(
00372 HWND hwnd
00373 );
00374
00375
void
00376
ImeUIComposition(
00377 HWND hwnd,
00378 WPARAM wParam,
00379 LPARAM CompFlag
00380 );
00381
00382
void
00383
DisplayCompString(
00384 HWND hwnd,
00385
int Length,
00386 PWCHAR CharBuf,
00387 PUCHAR AttrBuf
00388 );
00389
00390
void
00391
DisplayResultString(
00392 HWND hwnd,
00393 LPWSTR lpStr
00394 );
00395
00396
BOOL
00397
ImeUINotify(
00398 HWND hwnd,
00399 WPARAM wParam,
00400 LPARAM lParam
00401 );
00402
00403
BOOL
00404
IsUnicodeFullWidth(
00405 IN WCHAR wch
00406 );
00407
00408
00409
BOOL
00410
ImeUIOpenStatusWindow(
00411 HWND hwnd
00412 );
00413
00414
BOOL
00415
ImeUIChangeCandidate(
00416 HWND hwnd,
00417 DWORD lParam
00418 );
00419
00420
BOOL
00421
ImeUISetOpenStatus(
00422 HWND hwnd
00423 );
00424
00425
BOOL
00426
ImeUISetConversionMode(
00427 HWND hwnd
00428 );
00429
00430
BOOL
00431
ImeUIGuideLine(
00432 HWND hwnd
00433 );
00434
00435
DWORD
00436
GetNLSMode(
00437 HWND hWnd,
00438 HANDLE hConsole
00439 );
00440
00441
BOOL
00442
SetNLSMode(
00443 HWND hWnd,
00444 HANDLE hConsole,
00445 DWORD fdwConversion
00446 );
00447
00448
00449
VOID
00450
CopyDataProcess(
00451 HWND hWnd,
00452 PCOPYDATASTRUCT CopyData
00453 );
00454
00455
BOOL
00456
ImeSysPropertyWindow(
00457 HWND hWnd,
00458 WPARAM wParam,
00459 LPARAM lParam
00460 );
00461
00462
00463
00464
00465
VOID
00466
ImeOpenClose(
00467 HWND hWnd,
00468 BOOL fFlag
00469 );
00470
00471
VOID
00472
VirtualKeyHandler(
00473 HWND hWnd,
00474 UINT wParam,
00475 UINT lParam
00476 );
00477
00478
VOID
00479
CharHandlerFromConsole(
00480 HWND hWnd,
00481 UINT Message,
00482 ULONG wParam,
00483 ULONG lParam
00484 );
00485
00486
VOID
00487
CharHandlerToConsole(
00488 HWND hWnd,
00489 UINT Message,
00490 ULONG wParam,
00491 ULONG lParam
00492 );
00493
00494
#ifdef DEBUG_MODE
00495
VOID
00496 ImeUIMoveCandWin(
00497 HWND hwnd
00498 );
00499
#endif
00500
00501
BOOL
00502
IsDBCSTrailByte(
00503
char *base,
00504
char *p
00505 );
00506
00507
#ifdef DEBUG_MODE
00508
VOID
00509 ResetCaret(
00510 HWND hWnd
00511 );
00512
00513
BOOL
00514 MoveCaret(
00515 HWND hwnd
00516 );
00517
#endif
00518
00519
#ifdef DEBUG_MODE
00520
VOID
00521 StoreChar(
00522 HWND hWnd,
00523 WORD ch,
00524 UCHAR atr
00525 );
00526
#endif
00527
00528
BOOL
00529
ConsoleCodepageChange(
00530 HWND hWnd,
00531 HANDLE hConsole,
00532 BOOL Output,
00533 WORD CodePage
00534 );
00535
00536
00537
00538
00539
00540
00541
00542
BOOL
00543
ConimeHotkey(
00544 HWND hWnd,
00545 HANDLE hConsole,
00546 DWORD HotkeyID
00547 );
00548
00549
BOOL
00550
GetIMEName(
00551 PCONSOLE_TABLE ConTbl
00552 );
00553
00554
BOOL
00555
GetOpenStatusByCodepage(
00556 HIMC hIMC,
00557 PCONSOLE_TABLE ConTbl
00558 );
00559
00560
BOOL
00561
ImeUIMakeInfoString(
00562 PCONSOLE_TABLE ConTbl,
00563
LPCONIME_UIMODEINFO lpModeInfo
00564 );
00565
00566
BOOL
00567
MakeInfoStringJapan(
00568 PCONSOLE_TABLE ConTbl,
00569
LPCONIME_UIMODEINFO lpModeInfo
00570 );
00571
00572
BOOL
00573
MakeInfoStringTaiwan(
00574 PCONSOLE_TABLE ConTbl,
00575
LPCONIME_UIMODEINFO lpModeInfo
00576 );
00577
00578
DWORD
00579
MakeStatusStrTaiwan1(
00580 PCONSOLE_TABLE ConTbl,
00581
LPCONIME_UIMODEINFO lpModeInfo,
00582 DWORD ModeInfoPtr
00583 );
00584
00585
DWORD
00586
MakeStatusStrTaiwan2(
00587 PCONSOLE_TABLE ConTbl,
00588
LPCONIME_UIMODEINFO lpModeInfo,
00589 DWORD ModeInfoPtr
00590 );
00591
00592
DWORD
00593
IncludeCompositionT(
00594 PCONSOLE_TABLE ConTbl,
00595
LPCONIME_UIMODEINFO lpModeInfo,
00596 DWORD ModeInfoPtr
00597 );
00598
00599
DWORD
00600
IncludeCandidateT(
00601 PCONSOLE_TABLE ConTbl,
00602
LPCONIME_UIMODEINFO lpModeInfo,
00603 DWORD ModeInfoPtr
00604 );
00605
00606
DWORD
00607
DispLenStructedUnicode(
00608 PCHAR_INFO lpString,
00609 DWORD SrcLength
00610 );
00611
00612
BOOL
00613
MakeInfoStringPRC(
00614 PCONSOLE_TABLE ConTbl,
00615
LPCONIME_UIMODEINFO lpModeInfo
00616 );
00617
00618
DWORD
00619
MakeStatusStrPRC1(
00620 PCONSOLE_TABLE ConTbl,
00621
LPCONIME_UIMODEINFO lpModeInfo,
00622 DWORD ModeInfoPtr
00623 );
00624
00625
DWORD
00626
MakeStatusStrPRC2(
00627 PCONSOLE_TABLE ConTbl,
00628
LPCONIME_UIMODEINFO lpModeInfo,
00629 DWORD ModeInfoPtr
00630 );
00631
00632
DWORD
00633
IncludeCompositionP(
00634 PCONSOLE_TABLE ConTbl,
00635
LPCONIME_UIMODEINFO lpModeInfo,
00636 DWORD ModeInfoPtr
00637 );
00638
00639
DWORD
00640
IncludeCandidateP(
00641 PCONSOLE_TABLE ConTbl,
00642
LPCONIME_UIMODEINFO lpModeInfo,
00643 DWORD ModeInfoPtr
00644 );
00645
00646
BOOL
00647
MakeInfoStringKorea(
00648 PCONSOLE_TABLE ConTbl,
00649
LPCONIME_UIMODEINFO lpModeInfo
00650 );
00651
00652
00653
00654
00655
00656
00657
00658
BOOL
00659
ImeUIOpenCandidate(
00660 HWND hwnd,
00661 DWORD lParam,
00662 BOOL OpenFlag
00663 );
00664
00665
BOOL
00666
OpenCandidateJapan(
00667 HWND hwnd,
00668 HIMC hIMC,
00669 PCONSOLE_TABLE ConTbl,
00670 DWORD CandList,
00671 BOOL OpenFlag
00672 );
00673
00674
BOOL
00675
OpenCandidateTaiwan(
00676 HWND hwnd,
00677 HIMC hIMC ,
00678 PCONSOLE_TABLE ConTbl,
00679 DWORD CandList,
00680 BOOL OpenFlag
00681 );
00682
00683
BOOL
00684
OpenCandidatePRC(
00685 HWND hwnd,
00686 HIMC hIMC ,
00687 PCONSOLE_TABLE ConTbl,
00688 DWORD CandList,
00689 BOOL OpenFlag
00690 );
00691
00692
BOOL
00693
OpenCandidateKorea(
00694 HWND hwnd,
00695 HIMC hIMC ,
00696 PCONSOLE_TABLE ConTbl,
00697 DWORD CandList,
00698 BOOL OpenFlag
00699 );
00700
00701
DWORD
00702
DispLenUnicode(
00703 LPWSTR lpString
00704 );
00705
00706
DWORD
00707
GetSystemLineJ(
00708 LPCANDIDATELIST lpCandList ,
00709 LPWSTR String,
00710 LPSTR Attr,
00711 DWORD dwLength,
00712 DWORD CountDispWidth,
00713 PCONSOLE_TABLE FocusedConsole,
00714 BOOL EnableCodePoint
00715 );
00716
00717
DWORD
00718
GetSystemLineT(
00719 LPCANDIDATELIST lpCandList ,
00720 LPWSTR String,
00721 LPSTR Attr,
00722 DWORD dwLength,
00723 DWORD CountDispWidth,
00724 PCONSOLE_TABLE FocusedConsole
00725 );
00726
00727
DWORD
00728
GetSystemLineP(
00729 LPCANDIDATELIST lpCandList ,
00730 LPWSTR String,
00731 LPSTR Attr,
00732 DWORD dwLength,
00733 DWORD CountDispWidth,
00734 PCONSOLE_TABLE FocusedConsole
00735 );
00736
00737
VOID
00738
NumString(
00739 LPWSTR StrToWrite,
00740 DWORD NumToDisp,
00741 DWORD CountDispWidth
00742 );
00743
00744
BOOL
00745
ImeUICloseCandidate(
00746 HWND hwnd,
00747 DWORD lParam
00748 );
00749
00750
BOOL
00751
CloseCandidateJapan(
00752 HWND hwnd,
00753 HIMC hIMC,
00754 PCONSOLE_TABLE ConTbl,
00755 DWORD CandList
00756 );
00757
00758
BOOL
00759
CloseCandidateTaiwan(
00760 HWND hwnd,
00761 HIMC hIMC,
00762 PCONSOLE_TABLE ConTbl,
00763 DWORD CandList
00764 );
00765
00766
BOOL
00767
CloseCandidatePRC(
00768 HWND hwnd,
00769 HIMC hIMC,
00770 PCONSOLE_TABLE ConTbl,
00771 DWORD CandList
00772 );
00773
00774
BOOL
00775
CloseCandidateKorea(
00776 HWND hwnd,
00777 HIMC hIMC,
00778 PCONSOLE_TABLE ConTbl,
00779 DWORD CandList
00780 );
00781
00782
00783
00784
00785
00786
00787
00788
void
00789
GetCompositionStr(
00790 HWND hwnd,
00791 LPARAM CompFlag,
00792 WPARAM CompChar
00793 );
00794
00795
void
00796
GetCompStrJapan(
00797 HWND hwnd,
00798 PCONSOLE_TABLE ConTbl,
00799 LPARAM CompFlag
00800 );
00801
00802
void
00803
GetCompStrTaiwan(
00804 HWND hwnd,
00805 PCONSOLE_TABLE ConTbl,
00806 LPARAM CompFlag
00807 );
00808
00809
void
00810
GetCompStrPRC(
00811 HWND hwnd,
00812 PCONSOLE_TABLE ConTbl,
00813 LPARAM CompFlag
00814 );
00815
00816
void
00817
GetCompStrKorea(
00818 HWND hwnd,
00819 PCONSOLE_TABLE ConTbl,
00820 LPARAM CompFlag,
00821 WPARAM CompChar
00822 );
00823
00824
VOID
00825
ReDisplayCompositionStr (
00826 HWND hwnd
00827 );
00828
00829
VOID
00830
ReDisplayCompStrJapan(
00831 HWND hwnd,
00832 PCONSOLE_TABLE ConTbl
00833 );
00834
00835
VOID
00836
ReDisplayCompStrTaiwan(
00837 HWND hwnd,
00838 PCONSOLE_TABLE ConTbl
00839 );
00840
00841
VOID
00842
ReDisplayCompStrPRC(
00843 HWND hwnd,
00844 PCONSOLE_TABLE ConTbl
00845 );
00846
00847
VOID
00848
ReDisplayCompStrKorea(
00849 HWND hwnd,
00850 PCONSOLE_TABLE ConTbl
00851 );