Leaked source code of windows server 2003
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.

711 lines
24 KiB

  1. /*++
  2. Copyright (c) 1990-1998 Microsoft Corporation, All Rights Reserved
  3. Module Name:
  4. UICOMP.C
  5. ++*/
  6. /**********************************************************************/
  7. #include "windows.h"
  8. #include "immdev.h"
  9. #include "fakeime.h"
  10. /**********************************************************************/
  11. /* */
  12. /* CompStrWndProc() */
  13. /* */
  14. /* IME UI window procedure */
  15. /* */
  16. /**********************************************************************/
  17. LRESULT CALLBACK CompStrWndProc( hWnd, message, wParam, lParam )
  18. HWND hWnd;
  19. UINT message;
  20. WPARAM wParam;
  21. LPARAM lParam;
  22. {
  23. HWND hUIWnd;
  24. switch (message)
  25. {
  26. case WM_PAINT:
  27. PaintCompWindow( hWnd);
  28. break;
  29. case WM_SETCURSOR:
  30. case WM_MOUSEMOVE:
  31. case WM_LBUTTONUP:
  32. case WM_RBUTTONUP:
  33. DragUI(hWnd,message,wParam,lParam);
  34. if ((message == WM_SETCURSOR) &&
  35. (HIWORD(lParam) != WM_LBUTTONDOWN) &&
  36. (HIWORD(lParam) != WM_RBUTTONDOWN))
  37. return DefWindowProc(hWnd,message,wParam,lParam);
  38. if ((message == WM_LBUTTONUP) || (message == WM_RBUTTONUP))
  39. SetWindowLong(hWnd,FIGWL_MOUSE,0L);
  40. break;
  41. case WM_MOVE:
  42. hUIWnd = (HWND)GetWindowLongPtr(hWnd,FIGWL_SVRWND);
  43. if (IsWindow(hUIWnd))
  44. SendMessage(hUIWnd,WM_UI_DEFCOMPMOVE,wParam,lParam);
  45. break;
  46. default:
  47. if (!MyIsIMEMessage(message))
  48. return DefWindowProc(hWnd,message,wParam,lParam);
  49. break;
  50. }
  51. return 0;
  52. }
  53. /**********************************************************************/
  54. /* */
  55. /* CreateCompWindow() */
  56. /* */
  57. /**********************************************************************/
  58. void PASCAL CreateCompWindow( HWND hUIWnd, LPUIEXTRA lpUIExtra,LPINPUTCONTEXT lpIMC )
  59. {
  60. int i;
  61. RECT rc;
  62. lpUIExtra->dwCompStyle = lpIMC->cfCompForm.dwStyle;
  63. for (i=0; i < MAXCOMPWND ; i++)
  64. {
  65. if (!IsWindow(lpUIExtra->uiComp[i].hWnd))
  66. {
  67. lpUIExtra->uiComp[i].hWnd =
  68. CreateWindowEx(0,
  69. (LPTSTR)szCompStrClassName,NULL,
  70. WS_COMPNODEFAULT,
  71. 0,0,1,1,
  72. hUIWnd,NULL,hInst,NULL);
  73. }
  74. lpUIExtra->uiComp[i].rc.left = 0;
  75. lpUIExtra->uiComp[i].rc.top = 0;
  76. lpUIExtra->uiComp[i].rc.right = 1;
  77. lpUIExtra->uiComp[i].rc.bottom = 1;
  78. SetWindowLongPtr(lpUIExtra->uiComp[i].hWnd,FIGWL_FONT,(LONG_PTR)lpUIExtra->hFont);
  79. SetWindowLongPtr(lpUIExtra->uiComp[i].hWnd,FIGWL_SVRWND,(LONG_PTR)hUIWnd);
  80. ShowWindow(lpUIExtra->uiComp[i].hWnd,SW_HIDE);
  81. lpUIExtra->uiComp[i].bShow = FALSE;
  82. }
  83. if (lpUIExtra->uiDefComp.pt.x == -1)
  84. {
  85. GetWindowRect(lpIMC->hWnd,&rc);
  86. lpUIExtra->uiDefComp.pt.x = rc.left;
  87. lpUIExtra->uiDefComp.pt.y = rc.bottom + 1;
  88. }
  89. if (!IsWindow(lpUIExtra->uiDefComp.hWnd))
  90. {
  91. lpUIExtra->uiDefComp.hWnd =
  92. CreateWindowEx( WS_EX_WINDOWEDGE,
  93. (LPTSTR)szCompStrClassName,NULL,
  94. WS_COMPDEFAULT | WS_DLGFRAME,
  95. lpUIExtra->uiDefComp.pt.x,
  96. lpUIExtra->uiDefComp.pt.y,
  97. 1,1,
  98. hUIWnd,NULL,hInst,NULL);
  99. }
  100. //SetWindowLong(lpUIExtra->uiDefComp.hWnd,FIGWL_FONT,(DWORD)lpUIExtra->hFont);
  101. SetWindowLongPtr(lpUIExtra->uiDefComp.hWnd,FIGWL_SVRWND,(LONG_PTR)hUIWnd);
  102. ShowWindow(lpUIExtra->uiDefComp.hWnd,SW_HIDE);
  103. lpUIExtra->uiDefComp.bShow = FALSE;
  104. return;
  105. }
  106. /**********************************************************************/
  107. /* */
  108. /* NumCharInDX() */
  109. /* */
  110. /* Count how may the char can be arranged in DX. */
  111. /* */
  112. /**********************************************************************/
  113. int PASCAL NumCharInDX(HDC hDC,LPMYSTR lp,int dx)
  114. {
  115. SIZE sz;
  116. int width = 0;
  117. int num = 0;
  118. int numT = 0;
  119. if (!*lp)
  120. return 0;
  121. while ((width < dx) && *(lp + numT))
  122. {
  123. num = numT;
  124. #if defined(FAKEIMEM) || defined(UNICODE)
  125. numT++;
  126. GetTextExtentPointW(hDC,lp,numT,&sz);
  127. #else
  128. if (IsDBCSLeadByte(*(lp + numT)))
  129. numT += 2;
  130. else
  131. numT++;
  132. GetTextExtentPoint(hDC,lp,numT,&sz);
  133. #endif
  134. width = sz.cx;
  135. }
  136. if (width < dx)
  137. num = numT;
  138. return num;
  139. }
  140. /**********************************************************************/
  141. /* */
  142. /* NumCharInDY() */
  143. /* */
  144. /* Count how may the char can be arranged in DY. */
  145. /* */
  146. /**********************************************************************/
  147. int PASCAL NumCharInDY(HDC hDC,LPMYSTR lp,int dy)
  148. {
  149. SIZE sz;
  150. int width = 0;
  151. int num;
  152. int numT = 0;
  153. if (!*lp)
  154. return 0;
  155. while ((width < dy) && *(lp + numT))
  156. {
  157. num = numT;
  158. #if defined(FAKEIMEM) || defined(UNICODE)
  159. numT++;
  160. GetTextExtentPointW(hDC,lp,numT,&sz);
  161. #else
  162. if (IsDBCSLeadByte(*(lp + numT)))
  163. numT += 2;
  164. else
  165. numT++;
  166. GetTextExtentPoint(hDC,lp,numT,&sz);
  167. #endif
  168. width = sz.cy;
  169. }
  170. return num;
  171. }
  172. /**********************************************************************/
  173. /* */
  174. /* MoveCompWindow() */
  175. /* */
  176. /* Calc the position of composition windows and move them. */
  177. /* */
  178. /**********************************************************************/
  179. void PASCAL MoveCompWindow( LPUIEXTRA lpUIExtra,LPINPUTCONTEXT lpIMC )
  180. {
  181. HDC hDC;
  182. HFONT hFont = (HFONT)NULL;
  183. HFONT hOldFont = (HFONT)NULL;
  184. LPCOMPOSITIONSTRING lpCompStr;
  185. LPMYSTR lpstr;
  186. RECT rc;
  187. RECT oldrc;
  188. SIZE sz;
  189. int width;
  190. int height;
  191. int i;
  192. //
  193. // Save the composition form style into lpUIExtra.
  194. //
  195. lpUIExtra->dwCompStyle = lpIMC->cfCompForm.dwStyle;
  196. if (lpIMC->cfCompForm.dwStyle) // Style is not DEFAULT.
  197. {
  198. POINT ptSrc = lpIMC->cfCompForm.ptCurrentPos;
  199. RECT rcSrc;
  200. LPMYSTR lpt;
  201. int dx;
  202. int dy;
  203. int num;
  204. int curx;
  205. int cury;
  206. //
  207. // Lock the COMPOSITIONSTRING structure.
  208. //
  209. if (!(lpCompStr = (LPCOMPOSITIONSTRING)ImmLockIMCC(lpIMC->hCompStr)))
  210. return;
  211. //
  212. // If there is no composition string, don't display anything.
  213. //
  214. if ((lpCompStr->dwSize <= sizeof(COMPOSITIONSTRING))
  215. || (lpCompStr->dwCompStrLen == 0))
  216. {
  217. ImmUnlockIMCC(lpIMC->hCompStr);
  218. return;
  219. }
  220. //
  221. // Set the rectangle for the composition string.
  222. //
  223. if (lpIMC->cfCompForm.dwStyle & CFS_RECT)
  224. rcSrc = lpIMC->cfCompForm.rcArea;
  225. else
  226. GetClientRect(lpIMC->hWnd,(LPRECT)&rcSrc);
  227. ClientToScreen(lpIMC->hWnd, &ptSrc);
  228. ClientToScreen(lpIMC->hWnd, (LPPOINT)&rcSrc.left);
  229. ClientToScreen(lpIMC->hWnd, (LPPOINT)&rcSrc.right);
  230. //
  231. // Check the start position.
  232. //
  233. if (!PtInRect((LPRECT)&rcSrc,ptSrc))
  234. {
  235. ImmUnlockIMCC(lpIMC->hCompStr);
  236. return;
  237. }
  238. //
  239. // Hide the default composition window.
  240. //
  241. if (IsWindow(lpUIExtra->uiDefComp.hWnd))
  242. {
  243. ShowWindow(lpUIExtra->uiDefComp.hWnd,SW_HIDE);
  244. lpUIExtra->uiDefComp.bShow = FALSE;
  245. }
  246. lpt = lpstr = GETLPCOMPSTR(lpCompStr);
  247. #if defined(FAKEIMEM) || defined(UNICODE)
  248. num = 1;
  249. #else
  250. if (IsDBCSLeadByte(*lpt))
  251. num = 2;
  252. else
  253. num = 1;
  254. #endif
  255. if (!lpUIExtra->bVertical)
  256. {
  257. dx = rcSrc.right - ptSrc.x;
  258. curx = ptSrc.x;
  259. cury = ptSrc.y;
  260. //
  261. // Set the composition string to each composition window.
  262. // The composition windows that are given the compostion string
  263. // will be moved and shown.
  264. //
  265. for (i = 0; i < MAXCOMPWND; i++)
  266. {
  267. if (IsWindow(lpUIExtra->uiComp[i].hWnd))
  268. {
  269. hDC = GetDC(lpUIExtra->uiComp[i].hWnd);
  270. if (hFont = (HFONT)GetWindowLongPtr(lpUIExtra->uiComp[i].hWnd,FIGWL_FONT))
  271. hOldFont = SelectObject(hDC,hFont);
  272. sz.cy = 0;
  273. oldrc = lpUIExtra->uiComp[i].rc;
  274. if (num = NumCharInDX(hDC,lpt,dx))
  275. {
  276. #ifdef FAKEIMEM
  277. GetTextExtentPointW(hDC,lpt,num,&sz);
  278. #else
  279. GetTextExtentPoint(hDC,lpt,num,&sz);
  280. #endif
  281. lpUIExtra->uiComp[i].rc.left = curx;
  282. lpUIExtra->uiComp[i].rc.top = cury;
  283. lpUIExtra->uiComp[i].rc.right = sz.cx;
  284. lpUIExtra->uiComp[i].rc.bottom = sz.cy;
  285. SetWindowLong(lpUIExtra->uiComp[i].hWnd,FIGWL_COMPSTARTSTR,
  286. (DWORD) (lpt - lpstr));
  287. SetWindowLong(lpUIExtra->uiComp[i].hWnd,FIGWL_COMPSTARTNUM,
  288. num);
  289. MoveWindow(lpUIExtra->uiComp[i].hWnd,
  290. curx,cury,sz.cx,sz.cy,TRUE);
  291. ShowWindow(lpUIExtra->uiComp[i].hWnd, SW_SHOWNOACTIVATE);
  292. lpUIExtra->uiComp[i].bShow = TRUE;
  293. lpt+=num;
  294. }
  295. else
  296. {
  297. lpUIExtra->uiComp[i].rc.left = 0;
  298. lpUIExtra->uiComp[i].rc.top = 0;
  299. lpUIExtra->uiComp[i].rc.right = 0;
  300. lpUIExtra->uiComp[i].rc.bottom = 0;
  301. SetWindowLong(lpUIExtra->uiComp[i].hWnd,FIGWL_COMPSTARTSTR,
  302. 0L);
  303. SetWindowLong(lpUIExtra->uiComp[i].hWnd,FIGWL_COMPSTARTNUM,
  304. 0L);
  305. ShowWindow(lpUIExtra->uiComp[i].hWnd, SW_HIDE);
  306. lpUIExtra->uiComp[i].bShow = FALSE;
  307. }
  308. InvalidateRect(lpUIExtra->uiComp[i].hWnd,NULL,FALSE);
  309. dx = rcSrc.right - rcSrc.left;
  310. curx = rcSrc.left;
  311. cury += sz.cy;
  312. if (hOldFont)
  313. SelectObject(hDC,hOldFont);
  314. ReleaseDC(lpUIExtra->uiComp[i].hWnd,hDC);
  315. }
  316. }
  317. }
  318. else // when it is vertical fonts.
  319. {
  320. dy = rcSrc.bottom - ptSrc.y;
  321. curx = ptSrc.x;
  322. cury = ptSrc.y;
  323. for (i = 0; i < MAXCOMPWND; i++)
  324. {
  325. if (IsWindow(lpUIExtra->uiComp[i].hWnd))
  326. {
  327. hDC = GetDC(lpUIExtra->uiComp[i].hWnd);
  328. if (hFont = (HFONT)GetWindowLongPtr(lpUIExtra->uiComp[i].hWnd,FIGWL_FONT))
  329. hOldFont = SelectObject(hDC,hFont);
  330. sz.cy = 0;
  331. if (num = NumCharInDY(hDC,lpt,dy))
  332. {
  333. #ifdef FAKEIMEM
  334. GetTextExtentPointW(hDC,lpt,num,&sz);
  335. #else
  336. GetTextExtentPoint(hDC,lpt,num,&sz);
  337. #endif
  338. lpUIExtra->uiComp[i].rc.left = curx - sz.cy;
  339. lpUIExtra->uiComp[i].rc.top = cury;
  340. lpUIExtra->uiComp[i].rc.right = sz.cy;
  341. lpUIExtra->uiComp[i].rc.bottom = sz.cx;
  342. SetWindowLong(lpUIExtra->uiComp[i].hWnd,FIGWL_COMPSTARTSTR,
  343. (DWORD) (lpt - lpstr));
  344. SetWindowLong(lpUIExtra->uiComp[i].hWnd,FIGWL_COMPSTARTNUM,
  345. num);
  346. MoveWindow(lpUIExtra->uiComp[i].hWnd,
  347. curx,cury,sz.cy,sz.cx,TRUE);
  348. ShowWindow(lpUIExtra->uiComp[i].hWnd, SW_SHOWNOACTIVATE);
  349. lpUIExtra->uiComp[i].bShow = TRUE;
  350. lpt+=num;
  351. }
  352. else
  353. {
  354. lpUIExtra->uiComp[i].rc.left = 0;
  355. lpUIExtra->uiComp[i].rc.top = 0;
  356. lpUIExtra->uiComp[i].rc.right = 0;
  357. lpUIExtra->uiComp[i].rc.bottom = 0;
  358. SetWindowLong(lpUIExtra->uiComp[i].hWnd,FIGWL_COMPSTARTSTR,
  359. 0L);
  360. SetWindowLong(lpUIExtra->uiComp[i].hWnd,FIGWL_COMPSTARTNUM,
  361. 0L);
  362. ShowWindow(lpUIExtra->uiComp[i].hWnd, SW_HIDE);
  363. lpUIExtra->uiComp[i].bShow = FALSE;
  364. }
  365. InvalidateRect(lpUIExtra->uiComp[i].hWnd,NULL,FALSE);
  366. dy = rcSrc.bottom - rcSrc.top;
  367. cury = rcSrc.top;
  368. curx -= sz.cy;
  369. if (hOldFont)
  370. SelectObject(hDC,hOldFont);
  371. ReleaseDC(lpUIExtra->uiComp[i].hWnd,hDC);
  372. }
  373. }
  374. }
  375. ImmUnlockIMCC(lpIMC->hCompStr);
  376. }
  377. else
  378. {
  379. //
  380. // When the style is DEFAULT, show the default composition window.
  381. //
  382. if (IsWindow(lpUIExtra->uiDefComp.hWnd))
  383. {
  384. for (i = 0; i < MAXCOMPWND; i++)
  385. {
  386. if (IsWindow(lpUIExtra->uiComp[i].hWnd))
  387. {
  388. ShowWindow(lpUIExtra->uiComp[i].hWnd,SW_HIDE);
  389. lpUIExtra->uiComp[i].bShow = FALSE;
  390. }
  391. }
  392. hDC = GetDC(lpUIExtra->uiDefComp.hWnd);
  393. if (lpCompStr = (LPCOMPOSITIONSTRING)ImmLockIMCC(lpIMC->hCompStr))
  394. {
  395. if ((lpCompStr->dwSize > sizeof(COMPOSITIONSTRING))
  396. && (lpCompStr->dwCompStrLen > 0))
  397. {
  398. lpstr = GETLPCOMPSTR(lpCompStr);
  399. #ifdef FAKEIMEM
  400. GetTextExtentPointW(hDC,lpstr,lstrlenW(lpstr),&sz);
  401. #else
  402. GetTextExtentPoint(hDC,lpstr,lstrlen(lpstr),&sz);
  403. #endif
  404. width = sz.cx;
  405. height = sz.cy;
  406. }
  407. ImmUnlockIMCC(lpIMC->hCompStr);
  408. }
  409. ReleaseDC(lpUIExtra->uiDefComp.hWnd,hDC);
  410. GetWindowRect(lpUIExtra->uiDefComp.hWnd,&rc);
  411. lpUIExtra->uiDefComp.pt.x = rc.left;
  412. lpUIExtra->uiDefComp.pt.y = rc.top;
  413. MoveWindow(lpUIExtra->uiDefComp.hWnd,
  414. rc.left,
  415. rc.top,
  416. width+ 2 * GetSystemMetrics(SM_CXEDGE),
  417. height+ 2 * GetSystemMetrics(SM_CYEDGE),
  418. TRUE);
  419. ShowWindow(lpUIExtra->uiDefComp.hWnd, SW_SHOWNOACTIVATE);
  420. lpUIExtra->uiDefComp.bShow = TRUE;
  421. InvalidateRect(lpUIExtra->uiDefComp.hWnd,NULL,FALSE);
  422. }
  423. }
  424. }
  425. /**********************************************************************/
  426. /* */
  427. /* DrawTextOneLine(hDC, lpstr, lpattr, num) */
  428. /* */
  429. /**********************************************************************/
  430. void PASCAL DrawTextOneLine( HWND hCompWnd, HDC hDC, LPMYSTR lpstr, LPBYTE lpattr, int num, BOOL fVert)
  431. {
  432. LPMYSTR lpStart = lpstr;
  433. LPMYSTR lpEnd = lpstr + num - 1;
  434. int x,y;
  435. RECT rc;
  436. if (num == 0)
  437. return;
  438. GetClientRect (hCompWnd,&rc);
  439. if (!fVert)
  440. {
  441. x = 0;
  442. y = 0;
  443. }
  444. else
  445. {
  446. x = rc.right;
  447. y = 0;
  448. }
  449. while (lpstr <= lpEnd)
  450. {
  451. int cnt = 0;
  452. BYTE bAttr = *lpattr;
  453. SIZE sz;
  454. while ((bAttr == *lpattr) || (cnt <= num))
  455. {
  456. lpattr++;
  457. cnt++;
  458. }
  459. switch (bAttr)
  460. {
  461. case ATTR_INPUT:
  462. break;
  463. case ATTR_TARGET_CONVERTED:
  464. SetTextColor(hDC,RGB(127,127,127));
  465. #ifdef FAKEIMEM
  466. if (!fVert)
  467. TextOutW(hDC,x + 1,y + 1,lpstr,cnt);
  468. else
  469. TextOutW(hDC,x - 1,y + 1,lpstr,cnt);
  470. #else
  471. if (!fVert)
  472. TextOut(hDC,x + 1,y + 1,lpstr,cnt);
  473. else
  474. TextOut(hDC,x - 1,y + 1,lpstr,cnt);
  475. #endif
  476. SetTextColor(hDC,RGB(0,0,0));
  477. SetBkMode(hDC,TRANSPARENT);
  478. break;
  479. case ATTR_CONVERTED:
  480. SetTextColor(hDC,RGB(127,127,127));
  481. #ifdef FAKEIMEM
  482. if (!fVert)
  483. TextOutW(hDC,x + 1,y + 1,lpstr,cnt);
  484. else
  485. TextOutW(hDC,x - 1,y + 1,lpstr,cnt);
  486. #else
  487. if (!fVert)
  488. TextOut(hDC,x + 1,y + 1,lpstr,cnt);
  489. else
  490. TextOut(hDC,x - 1,y + 1,lpstr,cnt);
  491. #endif
  492. SetTextColor(hDC,RGB(0,0,255));
  493. SetBkMode(hDC,TRANSPARENT);
  494. break;
  495. case ATTR_TARGET_NOTCONVERTED:
  496. break;
  497. }
  498. #ifdef FAKEIMEM
  499. TextOutW(hDC,x,y,lpstr,cnt);
  500. GetTextExtentPointW(hDC,lpstr,cnt,&sz);
  501. #else
  502. TextOut(hDC,x,y,lpstr,cnt);
  503. GetTextExtentPoint(hDC,lpstr,cnt,&sz);
  504. #endif
  505. lpstr += cnt;
  506. if (!fVert)
  507. x += sz.cx;
  508. else
  509. y += sz.cx;
  510. }
  511. }
  512. /**********************************************************************/
  513. /* */
  514. /* PaintCompWindow(hCompWnd) */
  515. /* */
  516. /**********************************************************************/
  517. void PASCAL PaintCompWindow( HWND hCompWnd)
  518. {
  519. PAINTSTRUCT ps;
  520. HIMC hIMC;
  521. LPINPUTCONTEXT lpIMC;
  522. LPCOMPOSITIONSTRING lpCompStr;
  523. HDC hDC;
  524. RECT rc;
  525. HFONT hFont = (HFONT)NULL;
  526. HFONT hOldFont = (HFONT)NULL;
  527. HWND hSvrWnd;
  528. hDC = BeginPaint(hCompWnd,&ps);
  529. if (hFont = (HFONT)GetWindowLongPtr(hCompWnd,FIGWL_FONT))
  530. hOldFont = SelectObject(hDC,hFont);
  531. hSvrWnd = (HWND)GetWindowLongPtr(hCompWnd,FIGWL_SVRWND);
  532. if (hIMC = (HIMC)GetWindowLongPtr(hSvrWnd,IMMGWLP_IMC))
  533. {
  534. lpIMC = ImmLockIMC(hIMC);
  535. if (lpCompStr = (LPCOMPOSITIONSTRING)ImmLockIMCC(lpIMC->hCompStr))
  536. {
  537. if ((lpCompStr->dwSize > sizeof(COMPOSITIONSTRING))
  538. && (lpCompStr->dwCompStrLen > 0))
  539. {
  540. LPMYSTR lpstr;
  541. LPBYTE lpattr;
  542. LONG lstart;
  543. LONG num;
  544. BOOL fVert = FALSE;
  545. if (hFont)
  546. fVert = (lpIMC->lfFont.A.lfEscapement == 2700);
  547. lpstr = GETLPCOMPSTR(lpCompStr);
  548. lpattr = GETLPCOMPATTR(lpCompStr);
  549. SetBkMode(hDC,TRANSPARENT);
  550. if (lpIMC->cfCompForm.dwStyle)
  551. {
  552. HDC hPDC;
  553. hPDC = GetDC(GetParent(hCompWnd));
  554. GetClientRect (hCompWnd,&rc);
  555. SetBkColor(hDC,GetBkColor(hPDC));
  556. SetBkMode(hDC,OPAQUE);
  557. lstart = GetWindowLong(hCompWnd,FIGWL_COMPSTARTSTR);
  558. num = GetWindowLong(hCompWnd,FIGWL_COMPSTARTNUM);
  559. if (!num || ((lstart + num) > Mylstrlen(lpstr)))
  560. goto end_pcw;
  561. lpstr+=lstart;
  562. lpattr+=lstart;
  563. DrawTextOneLine(hCompWnd, hDC, lpstr, lpattr, num, fVert);
  564. ReleaseDC(GetParent(hCompWnd),hPDC);
  565. }
  566. else
  567. {
  568. num = Mylstrlen(lpstr);
  569. DrawTextOneLine(hCompWnd, hDC, lpstr, lpattr, num, fVert);
  570. }
  571. }
  572. end_pcw:
  573. ImmUnlockIMCC(lpIMC->hCompStr);
  574. }
  575. ImmUnlockIMC(hIMC);
  576. }
  577. if (hFont && hOldFont)
  578. SelectObject(hDC,hOldFont);
  579. EndPaint(hCompWnd,&ps);
  580. }
  581. /**********************************************************************/
  582. /* */
  583. /* HideCompWindow(lpUIExtra) */
  584. /* */
  585. /**********************************************************************/
  586. void PASCAL HideCompWindow(LPUIEXTRA lpUIExtra)
  587. {
  588. int i;
  589. RECT rc;
  590. if (IsWindow(lpUIExtra->uiDefComp.hWnd))
  591. {
  592. if (!lpUIExtra->dwCompStyle)
  593. GetWindowRect(lpUIExtra->uiDefComp.hWnd,(LPRECT)&rc);
  594. ShowWindow(lpUIExtra->uiDefComp.hWnd, SW_HIDE);
  595. lpUIExtra->uiDefComp.bShow = FALSE;
  596. }
  597. for (i=0;i<MAXCOMPWND;i++)
  598. {
  599. if (IsWindow(lpUIExtra->uiComp[i].hWnd))
  600. {
  601. ShowWindow(lpUIExtra->uiComp[i].hWnd, SW_HIDE);
  602. lpUIExtra->uiComp[i].bShow = FALSE;
  603. }
  604. }
  605. }
  606. /**********************************************************************/
  607. /* */
  608. /* SetFontCompWindow(lpUIExtra) */
  609. /* */
  610. /**********************************************************************/
  611. void PASCAL SetFontCompWindow(LPUIEXTRA lpUIExtra)
  612. {
  613. int i;
  614. for (i=0;i<MAXCOMPWND;i++)
  615. if (IsWindow(lpUIExtra->uiComp[i].hWnd))
  616. SetWindowLongPtr(lpUIExtra->uiComp[i].hWnd,FIGWL_FONT,(LONG_PTR)lpUIExtra->hFont);
  617. }