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.

164 lines
4.5 KiB

  1. /************************************************************/
  2. /* Windows Write, Copyright 1985-1992 Microsoft Corporation */
  3. /************************************************************/
  4. /* This file contains the window proc for the page info window. */
  5. #include <windows.h>
  6. #include "mw.h"
  7. #include "cmddefs.h"
  8. #include "fmtdefs.h"
  9. #include "wwdefs.h"
  10. #ifdef DBCS
  11. #include "kanji.h"
  12. #endif
  13. /* D R A W M O D E */
  14. DrawMode()
  15. {
  16. /* This routine forces the repainting of the page info window. */
  17. extern HWND vhWndPageInfo;
  18. InvalidateRect(vhWndPageInfo, (LPRECT)NULL, FALSE);
  19. UpdateWindow(vhWndPageInfo);
  20. }
  21. long FAR PASCAL PageInfoWndProc(hWnd, message, wParam, lParam)
  22. HWND hWnd;
  23. unsigned message;
  24. WORD wParam;
  25. LONG lParam;
  26. {
  27. extern HFONT vhfPageInfo;
  28. extern int ypszPageInfo;
  29. extern CHAR szMode[];
  30. extern int dypScrlBar;
  31. extern struct FLI vfli;
  32. extern struct WWD rgwwd[];
  33. if (message == WM_PAINT)
  34. {
  35. PAINTSTRUCT ps;
  36. /* Initialize the DC. */
  37. BeginPaint(hWnd, (LPPAINTSTRUCT)&ps);
  38. if (vhfPageInfo == NULL)
  39. {
  40. extern char szSystem[];
  41. LOGFONT lf;
  42. TEXTMETRIC tm;
  43. /* Load a font that will fit in the info "window". */
  44. bltbc(&lf, 0, sizeof(LOGFONT));
  45. #ifdef WIN30
  46. /* Don't default to ANY ol' typeface ..pault */
  47. bltsz(szSystem, lf.lfFaceName);
  48. #ifdef DBCS /* was in JAPAN; KenjiK ' 90-10-25 */
  49. /* We use Double Byte Character string,so using font must be
  50. able to show them. */
  51. lf.lfCharSet = NATIVE_CHARSET;
  52. // What this is for ? Teminal Font is not so good ! -- WJPARK
  53. // bltbyte ( "Terminal", lf.lfFaceName, LF_FACESIZE);
  54. #endif /* DBCS */
  55. #endif
  56. lf.lfHeight = -(dypScrlBar - (GetSystemMetrics(SM_CYBORDER) << 1));
  57. if ((vhfPageInfo = CreateFontIndirect((LPLOGFONT)&lf)) == NULL)
  58. {
  59. goto BailOut;
  60. }
  61. if (SelectObject(ps.hdc, vhfPageInfo) == NULL)
  62. {
  63. DeleteObject(vhfPageInfo);
  64. vhfPageInfo = NULL;
  65. goto BailOut;
  66. }
  67. /* Figure out where to draw the string. */
  68. GetTextMetrics(ps.hdc, (LPTEXTMETRIC)&tm);
  69. #ifdef KOREA // jinwoo: 92, 9, 28
  70. // It looks better in Hangeul Windows -- WJPark
  71. ypszPageInfo = (dypScrlBar - (tm.tmHeight - tm.tmInternalLeading) +
  72. 1) >> 1;
  73. #else
  74. ypszPageInfo = ((dypScrlBar - (tm.tmHeight - tm.tmInternalLeading) +
  75. 1) >> 1) - tm.tmInternalLeading;
  76. #endif // KOREA
  77. }
  78. /* Draw the "Page nnn" (no longer at the VERY left) */
  79. PatBlt(ps.hdc, ps.rcPaint.left, ps.rcPaint.top, ps.rcPaint.right -
  80. ps.rcPaint.left, ps.rcPaint.bottom - ps.rcPaint.top, PATCOPY);
  81. TextOut(ps.hdc, GetSystemMetrics(SM_CXBORDER)+5, ypszPageInfo,
  82. (LPSTR)szMode, CchSz(szMode) - 1);
  83. BailOut:
  84. EndPaint(hWnd, (LPPAINTSTRUCT)&ps);
  85. return(0L);
  86. }
  87. else if (message == WM_RBUTTONDOWN && vfli.rgdxp[1] == 0xFFFE &&
  88. wParam & MK_CONTROL )
  89. {
  90. (vfli.rgdxp[1])--;
  91. return(0L);
  92. }
  93. else
  94. {
  95. /* All we are interested in here are paint messages. */
  96. return(DefWindowProc(hWnd, message, wParam, lParam));
  97. }
  98. }
  99. #ifdef SPECIAL
  100. fnSpecial(hWnd, hDC, rgfp, sz)
  101. HWND hWnd;
  102. HDC hDC;
  103. FARPROC rgfp[];
  104. CHAR sz[];
  105. {
  106. RECT rc;
  107. RECT rcText;
  108. int dxpLine;
  109. int dypLine;
  110. {
  111. register CHAR *pch = &sz[0];
  112. while (*pch != '\0')
  113. {
  114. *pch = *pch ^ 0x13;
  115. pch++;
  116. }
  117. }
  118. (*rgfp[0])(hWnd, (LPRECT)&rc);
  119. rc.right &= 0xFF80;
  120. rc.bottom &= 0xFF80;
  121. rcText.right = rc.right - (rcText.left = (rc.right >> 2) + (rc.right >> 3));
  122. rcText.bottom = rc.bottom - (rcText.top = rc.bottom >> 2);
  123. (*rgfp[1])(hDC, (LPSTR)sz, -1, (LPRECT)&rcText, DT_CENTER | DT_WORDBREAK);
  124. dxpLine = rc.right >> 1;
  125. dypLine = rc.bottom >> 1;
  126. {
  127. register int dxp;
  128. register int dyp;
  129. for (dxp = dyp = 0; dxp <= dxpLine; dxp += rc.right >> 6, dyp +=
  130. rc.bottom
  131. >> 6)
  132. {
  133. (*rgfp[2])(hDC, dxpLine - dxp, dyp);
  134. (*rgfp[3])(hDC, dxp, dyp + dypLine);
  135. (*rgfp[2])(hDC, dxpLine + dxp, dyp);
  136. (*rgfp[3])(hDC, rc.right - dxp, dyp + dypLine);
  137. }
  138. }
  139. }
  140. #endif /* SPECIAL */