Main Page | Class Hierarchy | Class List | File List | Class Members | File Members

consubs.c File Reference

#include "precomp.h"

Go to the source code of this file.

Functions

INT Create (HWND hWnd)
void ImeUIStartComposition (HWND hwnd)
void ImeUIEndComposition (HWND hwnd)
void ImeUIComposition (HWND hwnd, WPARAM CompChar, LPARAM CompFlag)
BOOL ImeUINotify (HWND hwnd, WPARAM wParam, LPARAM lParam)
BOOL IsUnicodeFullWidth (IN WCHAR wch)
BOOL ImeUIOpenStatusWindow (HWND hwnd)
BOOL ImeUIChangeCandidate (HWND hwnd, DWORD lParam)
BOOL ImeUISetOpenStatus (HWND hwnd)
BOOL ImeUISetConversionMode (HWND hwnd)
BOOL ImeUIGuideLine (HWND hwnd)
DWORD GetNLSMode (HWND hWnd, HANDLE hConsole)
BOOL SetNLSMode (HWND hWnd, HANDLE hConsole, DWORD fdwConversion)
BOOL ConsoleCodepageChange (HWND hWnd, HANDLE hConsole, BOOL Output, WORD CodePage)
BOOL ImeSysPropertyWindow (HWND hWnd, WPARAM wParam, LPARAM lParam)


Function Documentation

BOOL ConsoleCodepageChange HWND  hWnd,
HANDLE  hConsole,
BOOL  Output,
WORD  CodePage
 

Definition at line 720 of file consubs.c.

References _CONSOLE_TABLE::ConsoleCP, _CONSOLE_TABLE::ConsoleOutputCP, DBGPRINT, FALSE, NULL, SearchConsole(), and TRUE.

Referenced by WndProc().

00726 { 00727 PCONSOLE_TABLE ConTbl; 00728 00729 ConTbl = SearchConsole(hConsole); 00730 if (ConTbl == NULL) { 00731 DBGPRINT(("CONIME: Error! Cannot found registed Console\n")); 00732 return FALSE; 00733 } 00734 00735 if (Output) 00736 { 00737 ConTbl->ConsoleOutputCP = CodePage ; 00738 } 00739 else 00740 { 00741 ConTbl->ConsoleCP = CodePage ; 00742 } 00743 return (TRUE) ; 00744 }

INT Create HWND  hWnd  ) 
 

Definition at line 23 of file consubs.c.

References GetDC, GetSystemMetrics(), ghDefaultIMC, hWnd, ImmGetContext(), ReleaseDC(), and UINT.

Referenced by CmpOpenRegKey(), ExCreateCallback(), IopAppendStringToValueKey(), IopOpenCurrentHwProfileDeviceInstanceKey(), IopOpenOrCreateDeviceInterfaceSubKeys(), IopOpenRegistryKey(), IopOpenRegistryKeyPersist(), and WndProc().

00024 { 00025 ghDefaultIMC = ImmGetContext(hWnd) ; 00026 00027 #ifdef DEBUG_MODE 00028 { 00029 // 00030 // Select fixed pitch system font and get its text metrics 00031 // 00032 00033 HDC hdc; 00034 TEXTMETRIC tm; 00035 WORD patern = 0xA4A4; 00036 SIZE size; 00037 HFONT hfntFixed; // fixed-pitch font 00038 HFONT hfntOld; // default font holder 00039 00040 hdc = GetDC( hWnd ); 00041 hfntFixed = GetStockObject( SYSTEM_FIXED_FONT ); 00042 hfntOld = SelectObject( hdc, hfntFixed ); 00043 GetTextMetrics( hdc, &tm ); 00044 00045 GetTextExtentPoint32( hdc, (LPWSTR)&patern, sizeof(WORD), (LPSIZE) &size ); 00046 cxMetrics = (UINT) size.cx / 2; 00047 cyMetrics = (UINT) size.cy; 00048 ReleaseDC( hWnd, hdc ); 00049 00050 xPos = 0 ; 00051 CaretWidth = GetSystemMetrics( SM_CXBORDER ); 00052 } 00053 #endif 00054 00055 return 0; 00056 00057 }

DWORD GetNLSMode HWND  hWnd,
HANDLE  hConsole
 

Definition at line 640 of file consubs.c.

References DBGPRINT, _CONSOLE_TABLE::dwConversion, _CONSOLE_TABLE::dwSentence, _CONSOLE_TABLE::fOpen, GetOpenStatusByCodepage(), hWnd, IME_CMODE_DISABLE, IME_CMODE_OPEN, ImmGetContext(), ImmGetConversionStatus(), ImmReleaseContext(), NULL, and SearchConsole().

Referenced by WndProc().

00644 { 00645 PCONSOLE_TABLE ConTbl; 00646 HIMC hIMC; 00647 00648 ConTbl = SearchConsole(hConsole); 00649 if (ConTbl == NULL) { 00650 DBGPRINT(("CONIME: Error! Cannot found registed Console\n")); 00651 return 0; 00652 } 00653 00654 hIMC = ImmGetContext( hWnd ) ; 00655 if ( hIMC == (HIMC)NULL ) 00656 return IME_CMODE_DISABLE; 00657 00658 ImmGetConversionStatus(hIMC, 00659 &ConTbl->dwConversion, 00660 &ConTbl->dwSentence); 00661 ConTbl->fOpen = GetOpenStatusByCodepage( hIMC, ConTbl ) ; 00662 00663 ImmReleaseContext( hWnd, hIMC ); 00664 00665 00666 return ((ConTbl->fOpen ? IME_CMODE_OPEN : 0) + ConTbl->dwConversion); 00667 }

BOOL ImeSysPropertyWindow HWND  hWnd,
WPARAM  wParam,
LPARAM  lParam
 

Definition at line 747 of file consubs.c.

References CI_CONIMEPROPERTYINFO, ConsoleImeSendMessage(), DBGPRINT, FALSE, hWnd, _CONSOLE_TABLE::hWndCon, LastConsole, NULL, SearchConsole(), and TRUE.

Referenced by WndProc().

00752 { 00753 PCONSOLE_TABLE ConTbl; 00754 COPYDATASTRUCT CopyData; 00755 00756 ConTbl = SearchConsole(LastConsole); 00757 if (ConTbl == NULL) { 00758 DBGPRINT(("CONIME: Error! Cannot found registed Console\n")); 00759 return FALSE; 00760 } 00761 00762 CopyData.dwData = CI_CONIMEPROPERTYINFO; 00763 CopyData.cbData = sizeof(WPARAM); 00764 CopyData.lpData = &wParam; 00765 00766 ConsoleImeSendMessage( ConTbl->hWndCon, 00767 (WPARAM)hWnd, 00768 (LPARAM)&CopyData 00769 ); 00770 00771 return TRUE; 00772 }

BOOL ImeUIChangeCandidate HWND  hwnd,
DWORD  lParam
 

Definition at line 458 of file consubs.c.

References FALSE, and ImeUIOpenCandidate().

Referenced by ImeUINotify().

00462 { 00463 return ImeUIOpenCandidate( hwnd, lParam, FALSE) ; 00464 }

void ImeUIComposition HWND  hwnd,
WPARAM  CompChar,
LPARAM  CompFlag
 

Definition at line 160 of file consubs.c.

References DBGPRINT, FIRSTCOL, GetCompositionStr(), MAXCOL, and UNICODE_SPACE.

Referenced by WndProc().

00161 { 00162 00163 DBGPRINT(("CONIME: WM_IME_COMPOSITION %08x %08x\n",CompChar,CompFlag)); 00164 00165 #ifdef DEBUG_MODE 00166 { 00167 int i ; 00168 for (i = FIRSTCOL ; i < MAXCOL ; i++) { 00169 ConvertLine[i] = UNICODE_SPACE ; 00170 ConvertLineAtr[i] = 0 ; 00171 } 00172 xPos = FIRSTCOL; 00173 xPosLast = FIRSTCOL; 00174 } 00175 #endif 00176 00177 if ( CompFlag == 0 ) { 00178 DBGPRINT((" None\n")); 00179 GetCompositionStr( hwnd, CompFlag, CompChar); 00180 } 00181 if ( CompFlag & GCS_RESULTSTR ) { 00182 DBGPRINT((" GCS_RESULTSTR\n")); 00183 GetCompositionStr( hwnd, ( CompFlag & GCS_RESULTSTR ), CompChar ); 00184 } 00185 if ( CompFlag & GCS_COMPSTR ) { 00186 DBGPRINT((" GCS_COMPSTR\n")); 00187 GetCompositionStr( hwnd, ( CompFlag & (GCS_COMPSTR|GCS_COMPATTR)), CompChar); 00188 } 00189 if ( CompFlag & CS_INSERTCHAR ) { 00190 DBGPRINT((" CS_INSERTCHAR\n")); 00191 GetCompositionStr( hwnd, ( CompFlag & (CS_INSERTCHAR|GCS_COMPATTR)), CompChar); 00192 } 00193 if ( CompFlag & CS_NOMOVECARET ) { 00194 DBGPRINT((" CS_NOMOVECARET\n")); 00195 GetCompositionStr( hwnd, ( CompFlag & (CS_NOMOVECARET|GCS_COMPATTR)), CompChar); 00196 } 00197 }

void ImeUIEndComposition HWND  hwnd  ) 
 

Definition at line 108 of file consubs.c.

References DBGPRINT, FALSE, _CONSOLE_TABLE::fInComposition, FIRSTCOL, LastConsole, _CONSOLE_TABLE::lpCompStrMem, MAXCOL, NULL, SearchConsole(), and UNICODE_SPACE.

Referenced by WndProc().

00109 { 00110 PCONSOLE_TABLE ConTbl; 00111 00112 ConTbl = SearchConsole(LastConsole); 00113 if (ConTbl == NULL) { 00114 DBGPRINT(("CONIME: Error! Cannot found registed Console\n")); 00115 return; 00116 } 00117 00118 // 00119 // Reset fInComposition variables. 00120 // 00121 ConTbl->fInComposition = FALSE; 00122 00123 if (ConTbl->lpCompStrMem) 00124 LocalFree( ConTbl->lpCompStrMem ); 00125 ConTbl->lpCompStrMem = NULL ; 00126 00127 #ifdef DEBUG_MODE 00128 { 00129 int i ; 00130 // 00131 // Reset the length of composition string to zero. 00132 // 00133 for (i = FIRSTCOL ; i < MAXCOL ; i++) { 00134 ConvertLine[i] = UNICODE_SPACE ; 00135 ConvertLineAtr[i] = 0 ; 00136 } 00137 } 00138 #endif 00139 #ifdef DEBUG_INFO 00140 xPos = FIRSTCOL; 00141 xPosLast = FIRSTCOL; 00142 HideCaret( hwnd ); 00143 DisplayConvInformation( hwnd ) ; 00144 ResetCaret( hwnd ); 00145 #endif 00146 }

BOOL ImeUIGuideLine HWND  hwnd  ) 
 

Definition at line 576 of file consubs.c.

References CI_CONIMESYSINFO, ConsoleImeSendMessage(), DBGPRINT, DWORD, FALSE, _CONSOLE_TABLE::hWndCon, ImmGetContext(), ImmReleaseContext(), Index, LastConsole, NULL, SearchConsole(), _CONIME_UIMESSAGE::String, and TRUE.

Referenced by ImeUINotify().

00579 { 00580 PCONSOLE_TABLE ConTbl; 00581 HIMC hIMC ; // Input context handle. 00582 DWORD Level ; 00583 DWORD Index ; 00584 DWORD Length ; 00585 LPCONIME_UIMESSAGE GuideLine ; 00586 COPYDATASTRUCT CopyData ; 00587 00588 DBGPRINT(("CONIME: Get IMN_GUIDELINE Message ")); 00589 00590 ConTbl = SearchConsole(LastConsole); 00591 if (ConTbl == NULL) { 00592 DBGPRINT(("CONIME: Error! Cannot found registed Console\n")); 00593 return FALSE; 00594 } 00595 00596 hIMC = ImmGetContext( hwnd ) ; 00597 if ( hIMC == 0 ) 00598 return FALSE; 00599 00600 Level = ImmGetGuideLine(hIMC, GGL_LEVEL, NULL, 0) ; 00601 Index = ImmGetGuideLine(hIMC, GGL_INDEX, NULL, 0) ; 00602 Length = ImmGetGuideLine(hIMC, GGL_STRING, NULL, 0) ; 00603 DBGPRINT(("Level=%d Index=%d Length=%d",Level,Index,Length)); 00604 if (Length == 0) { 00605 CopyData.dwData = CI_CONIMESYSINFO ; 00606 CopyData.cbData = Length ; 00607 CopyData.lpData = NULL ; 00608 00609 ConsoleImeSendMessage( ConTbl->hWndCon, 00610 (WPARAM)hwnd, 00611 (LPARAM)&CopyData 00612 ) ; 00613 } 00614 else{ 00615 GuideLine = (LPCONIME_UIMESSAGE)LocalAlloc(LPTR, Length + sizeof(WCHAR)) ; 00616 if (GuideLine == NULL) { 00617 ImmReleaseContext( hwnd, hIMC ); 00618 return FALSE; 00619 } 00620 00621 CopyData.dwData = CI_CONIMESYSINFO ; 00622 CopyData.cbData = Length + sizeof(WCHAR) ; 00623 CopyData.lpData = GuideLine ; 00624 Length = ImmGetGuideLine(hIMC, GGL_STRING, GuideLine->String, Length) ; 00625 00626 ConsoleImeSendMessage( ConTbl->hWndCon, 00627 (WPARAM)hwnd, 00628 (LPARAM)&CopyData 00629 ) ; 00630 00631 LocalFree( GuideLine ) ; 00632 } 00633 ImmReleaseContext( hwnd, hIMC ); 00634 DBGPRINT(("\n")); 00635 00636 return TRUE ; 00637 }

BOOL ImeUINotify HWND  hwnd,
WPARAM  wParam,
LPARAM  lParam
 

Definition at line 261 of file consubs.c.

References BOOL, DWORD, FALSE, ImeUIChangeCandidate(), ImeUICloseCandidate(), ImeUIGuideLine(), ImeUIOpenCandidate(), ImeUIOpenStatusWindow(), ImeUISetConversionMode(), ImeUISetOpenStatus(), and TRUE.

Referenced by WndProc().

00262 { 00263 switch (wParam ) 00264 { 00265 case IMN_OPENSTATUSWINDOW: 00266 ImeUIOpenStatusWindow(hwnd) ; 00267 break; 00268 case IMN_CHANGECANDIDATE: 00269 ImeUIChangeCandidate( hwnd, (DWORD)lParam ); 00270 break; 00271 case IMN_CLOSECANDIDATE: 00272 ImeUICloseCandidate( hwnd, (DWORD)lParam ); 00273 break; 00274 case IMN_OPENCANDIDATE: 00275 ImeUIOpenCandidate( hwnd, (DWORD)lParam, TRUE); 00276 break; 00277 case IMN_SETCONVERSIONMODE: 00278 ImeUISetConversionMode(hwnd) ; 00279 // IMN_SETCONVERSIONMODE should be pass to DefWindowProc 00280 // becuase ImeNotifyHandler in User32 does notify to shell and keyboard. 00281 return FALSE; 00282 case IMN_SETOPENSTATUS: 00283 ImeUISetOpenStatus( hwnd ); 00284 // IMN_SETOPENSTATUS should be pass to DefWindowProc 00285 // becuase ImeNotifyHandler in User32 does notify to shell and keyboard. 00286 return FALSE; 00287 case IMN_GUIDELINE: 00288 ImeUIGuideLine(hwnd) ; 00289 break; 00290 default: 00291 return FALSE; 00292 00293 } 00294 return TRUE; 00295 }

BOOL ImeUIOpenStatusWindow HWND  hwnd  ) 
 

Definition at line 406 of file consubs.c.

References CI_CONIMEMODEINFO, CONIME_UIMODEINFO, ConsoleImeSendMessage(), DBGPRINT, _CONSOLE_TABLE::dwConversion, _CONSOLE_TABLE::dwSentence, FALSE, _CONSOLE_TABLE::hWndCon, ImeUIMakeInfoString(), ImmGetContext(), ImmGetConversionStatus(), ImmReleaseContext(), LastConsole, NULL, SearchConsole(), and TRUE.

Referenced by ConImeInputLangchange(), ImeUINotify(), and InputLangchange().

00409 { 00410 PCONSOLE_TABLE ConTbl; 00411 HIMC hIMC; // Input context handle. 00412 LPCONIME_UIMODEINFO lpModeInfo ; 00413 COPYDATASTRUCT CopyData ; 00414 00415 DBGPRINT(("CONIME: Get IMN_OPENSTATUSWINDOW Message\n")); 00416 00417 ConTbl = SearchConsole(LastConsole); 00418 if (ConTbl == NULL) { 00419 DBGPRINT(("CONIME: Error! Cannot found registed Console\n")); 00420 return FALSE; 00421 } 00422 00423 hIMC = ImmGetContext( hwnd ) ; 00424 if ( hIMC == 0 ) 00425 return FALSE; 00426 00427 lpModeInfo = (LPCONIME_UIMODEINFO)LocalAlloc( LPTR, sizeof(CONIME_UIMODEINFO) ) ; 00428 if ( lpModeInfo == NULL) { 00429 ImmReleaseContext( hwnd, hIMC ); 00430 return FALSE; 00431 } 00432 00433 ImmGetConversionStatus(hIMC, 00434 (LPDWORD)&ConTbl->dwConversion, 00435 (LPDWORD)&ConTbl->dwSentence) ; 00436 00437 CopyData.dwData = CI_CONIMEMODEINFO ; 00438 CopyData.cbData = sizeof(CONIME_UIMODEINFO) ; 00439 CopyData.lpData = lpModeInfo ; 00440 if (ImeUIMakeInfoString(ConTbl, 00441 lpModeInfo)) 00442 { 00443 ConsoleImeSendMessage( ConTbl->hWndCon, 00444 (WPARAM)hwnd, 00445 (LPARAM)&CopyData 00446 ) ; 00447 } 00448 00449 LocalFree( lpModeInfo ); 00450 00451 ImmReleaseContext( hwnd, hIMC ); 00452 00453 return TRUE ; 00454 }

BOOL ImeUISetConversionMode HWND  hwnd  ) 
 

Definition at line 522 of file consubs.c.

References CI_CONIMEMODEINFO, CONIME_UIMODEINFO, ConsoleImeSendMessage(), DBGPRINT, _CONSOLE_TABLE::dwConversion, DWORD, _CONSOLE_TABLE::dwSentence, FALSE, _CONSOLE_TABLE::hWndCon, ImeUIMakeInfoString(), ImmGetContext(), ImmGetConversionStatus(), ImmReleaseContext(), LastConsole, NULL, SearchConsole(), and TRUE.

Referenced by ImeUINotify(), and WndProc().

00525 { 00526 PCONSOLE_TABLE ConTbl; 00527 HIMC hIMC; // Input context handle. 00528 LPCONIME_UIMODEINFO lpModeInfo ; 00529 COPYDATASTRUCT CopyData ; 00530 DWORD OldConversion ; 00531 00532 00533 DBGPRINT(("CONIME: Get IMN_SETCONVERSIONMODE Message\n")); 00534 00535 ConTbl = SearchConsole(LastConsole); 00536 if (ConTbl == NULL) { 00537 DBGPRINT(("CONIME: Error! Cannot found registed Console\n")); 00538 return FALSE; 00539 } 00540 00541 hIMC = ImmGetContext( hwnd ) ; 00542 if ( hIMC == 0 ) 00543 return FALSE; 00544 00545 lpModeInfo = (LPCONIME_UIMODEINFO)LocalAlloc(LPTR, sizeof(CONIME_UIMODEINFO) ) ; 00546 if ( lpModeInfo == NULL) { 00547 ImmReleaseContext( hwnd, hIMC ); 00548 return FALSE; 00549 } 00550 00551 OldConversion = ConTbl->dwConversion ; 00552 00553 ImmGetConversionStatus(hIMC, 00554 (LPDWORD)&ConTbl->dwConversion, 00555 (LPDWORD)&ConTbl->dwSentence) ; 00556 00557 CopyData.dwData = CI_CONIMEMODEINFO ; 00558 CopyData.cbData = sizeof(CONIME_UIMODEINFO) ; 00559 CopyData.lpData = lpModeInfo ; 00560 if (ImeUIMakeInfoString(ConTbl, 00561 lpModeInfo)) 00562 { 00563 ConsoleImeSendMessage( ConTbl->hWndCon, 00564 (WPARAM)hwnd, 00565 (LPARAM)&CopyData 00566 ) ; 00567 } 00568 00569 LocalFree( lpModeInfo ); 00570 ImmReleaseContext( hwnd, hIMC ); 00571 return TRUE ; 00572 00573 }

BOOL ImeUISetOpenStatus HWND  hwnd  ) 
 

Definition at line 468 of file consubs.c.

References CI_CONIMEMODEINFO, CONIME_UIMODEINFO, ConsoleImeSendMessage(), DBGPRINT, _CONSOLE_TABLE::dwConversion, _CONSOLE_TABLE::dwSentence, FALSE, _CONSOLE_TABLE::fOpen, GetOpenStatusByCodepage(), _CONSOLE_TABLE::hWndCon, ImeUIMakeInfoString(), ImmGetContext(), ImmGetConversionStatus(), ImmReleaseContext(), LastConsole, NULL, _CONSOLE_TABLE::ScreenBufferSize, SearchConsole(), and TRUE.

Referenced by ConsoleSetFocus(), ImeUINotify(), and InsertNewConsole().

00471 { 00472 PCONSOLE_TABLE ConTbl; 00473 HIMC hIMC; // Input context handle. 00474 LPCONIME_UIMODEINFO lpModeInfo ; 00475 COPYDATASTRUCT CopyData ; 00476 00477 DBGPRINT(("CONIME: Get IMN_SETOPENSTATUS Message\n")); 00478 00479 ConTbl = SearchConsole(LastConsole); 00480 if (ConTbl == NULL) { 00481 DBGPRINT(("CONIME: Error! Cannot found registed Console\n")); 00482 return FALSE; 00483 } 00484 00485 hIMC = ImmGetContext( hwnd ) ; 00486 if ( hIMC == 0 ) 00487 return FALSE; 00488 00489 ConTbl->fOpen = GetOpenStatusByCodepage( hIMC, ConTbl ) ; 00490 00491 ImmGetConversionStatus(hIMC, 00492 (LPDWORD)&ConTbl->dwConversion, 00493 (LPDWORD)&ConTbl->dwSentence) ; 00494 00495 if (ConTbl->ScreenBufferSize.X != 0) { 00496 00497 lpModeInfo = (LPCONIME_UIMODEINFO)LocalAlloc( LPTR, sizeof(CONIME_UIMODEINFO)) ; 00498 if ( lpModeInfo == NULL) { 00499 ImmReleaseContext( hwnd, hIMC ); 00500 return FALSE; 00501 } 00502 00503 CopyData.dwData = CI_CONIMEMODEINFO ; 00504 CopyData.cbData = sizeof(CONIME_UIMODEINFO) ; 00505 CopyData.lpData = lpModeInfo ; 00506 if (ImeUIMakeInfoString(ConTbl, 00507 lpModeInfo)) 00508 { 00509 ConsoleImeSendMessage( ConTbl->hWndCon, 00510 (WPARAM)hwnd, 00511 (LPARAM)&CopyData 00512 ) ; 00513 } 00514 LocalFree( lpModeInfo ); 00515 } 00516 ImmReleaseContext( hwnd, hIMC ); 00517 00518 return TRUE ; 00519 }

void ImeUIStartComposition HWND  hwnd  ) 
 

Definition at line 67 of file consubs.c.

References DBGPRINT, _CONSOLE_TABLE::fInComposition, FIRSTCOL, LastConsole, MAXCOL, NULL, SearchConsole(), TRUE, and UNICODE_SPACE.

Referenced by WndProc().

00068 { 00069 PCONSOLE_TABLE ConTbl; 00070 00071 ConTbl = SearchConsole(LastConsole); 00072 if (ConTbl == NULL) { 00073 DBGPRINT(("CONIME: Error! Cannot found registed Console\n")); 00074 return; 00075 } 00076 00077 // 00078 // Set fInComposition variables. 00079 // 00080 ConTbl->fInComposition = TRUE; 00081 00082 #ifdef DEBUG_MODE 00083 { 00084 int i ; 00085 for (i = FIRSTCOL ; i < MAXCOL ; i++) { 00086 ConvertLine[i] = UNICODE_SPACE ; 00087 ConvertLineAtr[i] = 0 ; 00088 } 00089 } 00090 #endif 00091 #ifdef DEBUG_INFO 00092 xPos = FIRSTCOL; 00093 xPosLast = FIRSTCOL; 00094 HideCaret( hwnd ); 00095 DisplayConvInformation( hwnd ) ; 00096 ResetCaret( hwnd ); 00097 #endif 00098 }

BOOL IsUnicodeFullWidth IN WCHAR  wch  ) 
 

Definition at line 312 of file consubs.c.

References ASSERT, BOOL, FALSE, INT, RtlUnicodeToMultiByteSize(), and TRUE.

Referenced by DispLenStructedUnicode(), DispLenUnicode(), GetSystemLineJ(), GetSystemLineP(), GetSystemLineT(), IncludeCandidateP(), MakeStatusStrPRC1(), MakeStatusStrPRC2(), MakeStatusStrTaiwan1(), MakeStatusStrTaiwan2(), and WndProc().

00315 { 00316 if (0x20 <= wch && wch <= 0x7e) 00317 /* ASCII */ 00318 return FALSE; 00319 else if (0x3041 <= wch && wch <= 0x3094) 00320 /* Hiragana */ 00321 return TRUE; 00322 else if (0x30a1 <= wch && wch <= 0x30f6) 00323 /* Katakana */ 00324 return TRUE; 00325 else if (0x3105 <= wch && wch <= 0x312c) 00326 /* Bopomofo */ 00327 return TRUE; 00328 else if (0x3131 <= wch && wch <= 0x318e) 00329 /* Hangul Elements */ 00330 return TRUE; 00331 else if (0xac00 <= wch && wch <= 0xd7a3) 00332 /* Korean Hangul Syllables */ 00333 return TRUE; 00334 else if (0xff01 <= wch && wch <= 0xff5e) 00335 /* Fullwidth ASCII variants */ 00336 return TRUE; 00337 else if (0xff61 <= wch && wch <= 0xff9f) 00338 /* Halfwidth Katakana variants */ 00339 return FALSE; 00340 else if ( (0xffa0 <= wch && wch <= 0xffbe) || 00341 (0xffc2 <= wch && wch <= 0xffc7) || 00342 (0xffca <= wch && wch <= 0xffcf) || 00343 (0xffd2 <= wch && wch <= 0xffd7) || 00344 (0xffda <= wch && wch <= 0xffdc) ) 00345 /* Halfwidth Hangule variants */ 00346 return FALSE; 00347 else if (0xffe0 <= wch && wch <= 0xffe6) 00348 /* Fullwidth symbol variants */ 00349 return TRUE; 00350 else if (0x4e00 <= wch && wch <= 0x9fa5) 00351 /* Han Ideographic */ 00352 return TRUE; 00353 else if (0xf900 <= wch && wch <= 0xfa2d) 00354 /* Han Ideographic Compatibility */ 00355 return TRUE; 00356 else 00357 { 00358 #if 0 00359 /* 00360 * Hack this block for I don't know FONT of Console Window. 00361 * 00362 * If you would like perfect result from IsUnicodeFullWidth routine, 00363 * then you should enable this block and 00364 * you should know FONT of Console Window. 00365 */ 00366 00367 INT Width; 00368 TEXTMETRIC tmi; 00369 00370 /* Unknown character */ 00371 00372 GetTextMetricsW(hDC, &tmi); 00373 if (IS_ANY_DBCS_CHARSET(tmi.tmCharSet)) 00374 tmi.tmMaxCharWidth /= 2; 00375 00376 GetCharWidth32(hDC, wch, wch, &Width); 00377 if (Width == tmi.tmMaxCharWidth) 00378 return FALSE; 00379 else if (Width == tmi.tmMaxCharWidth*2) 00380 return TRUE; 00381 #else 00382 ULONG MultiByteSize; 00383 00384 RtlUnicodeToMultiByteSize(&MultiByteSize, &wch, sizeof(WCHAR)); 00385 if (MultiByteSize == 2) 00386 return TRUE ; 00387 else 00388 return FALSE ; 00389 #endif 00390 } 00391 ASSERT(FALSE); 00392 return FALSE; 00393 #if 0 00394 ULONG MultiByteSize; 00395 00396 RtlUnicodeToMultiByteSize(&MultiByteSize, &wch, sizeof(WCHAR)); 00397 if (MultiByteSize == 2) 00398 return TRUE ; 00399 else 00400 return FALSE ; 00401 #endif 00402 }

BOOL SetNLSMode HWND  hWnd,
HANDLE  hConsole,
DWORD  fdwConversion
 

Definition at line 670 of file consubs.c.

References DBGPRINT, _CONSOLE_TABLE::dwConversion, _CONSOLE_TABLE::dwSentence, FALSE, _CONSOLE_TABLE::fOpen, _CONSOLE_TABLE::hIMC_Current, _CONSOLE_TABLE::hIMC_Original, hWnd, IME_CMODE_DISABLE, IME_CMODE_OPEN, ImmAssociateContext(), ImmGetContext(), ImmReleaseContext(), ImmSetActiveContextConsoleIME(), ImmSetConversionStatus(), ImmSetOpenStatus(), NULL, SearchConsole(), and TRUE.

Referenced by ConImeInputLangchange(), and WndProc().

00675 { 00676 PCONSOLE_TABLE ConTbl; 00677 HIMC hIMC; 00678 00679 ConTbl = SearchConsole(hConsole); 00680 if (ConTbl == NULL) { 00681 DBGPRINT(("CONIME: Error! Cannot found registed Console\n")); 00682 return FALSE; 00683 } 00684 00685 if (fdwConversion & IME_CMODE_DISABLE) 00686 { 00687 ImmSetActiveContextConsoleIME(hWnd, FALSE) ; 00688 ImmAssociateContext(hWnd, (HIMC)NULL); 00689 ConTbl->hIMC_Current = (HIMC)NULL; 00690 } 00691 else 00692 { 00693 ImmAssociateContext(hWnd, ConTbl->hIMC_Original); 00694 ImmSetActiveContextConsoleIME(hWnd, TRUE) ; 00695 ConTbl->hIMC_Current = ConTbl->hIMC_Original; 00696 } 00697 00698 hIMC = ImmGetContext( hWnd ) ; 00699 if ( hIMC == (HIMC)NULL ) 00700 return TRUE; 00701 00702 ConTbl->fOpen =(fdwConversion & IME_CMODE_OPEN) ? TRUE : FALSE ; 00703 ImmSetOpenStatus(hIMC, ConTbl->fOpen); 00704 00705 fdwConversion &= ~(IME_CMODE_DISABLE | IME_CMODE_OPEN); 00706 if (ConTbl->dwConversion != fdwConversion) 00707 { 00708 ConTbl->dwConversion = fdwConversion; 00709 ImmSetConversionStatus(hIMC, 00710 ConTbl->dwConversion, 00711 ConTbl->dwSentence ); 00712 } 00713 00714 ImmReleaseContext( hWnd, hIMC ); 00715 00716 return TRUE; 00717 }


Generated on Sat May 15 19:43:16 2004 for test by doxygen 1.3.7