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.

113 lines
3.2 KiB

  1. /************************************************************/
  2. /* Windows Write, Copyright 1985-1992 Microsoft Corporation */
  3. /************************************************************/
  4. /* The file contains the message handler for the ruler. */
  5. #define NOGDICAPMASKS
  6. #define NOVIRTUALKEYCODES
  7. #define NOWINSTYLES
  8. #define NOSYSMETRICS
  9. #define NOCLIPBOARD
  10. #define NOMENUS
  11. #define NOCTLMGR
  12. #include <windows.h>
  13. extern HBITMAP hbmNull;
  14. extern HWND vhWndRuler;
  15. extern HDC vhDCRuler;
  16. extern HDC hMDCBitmap;
  17. extern HDC hMDCScreen;
  18. extern HBITMAP hbmBtn;
  19. extern HBITMAP hbmMark;
  20. extern HBITMAP hbmNullRuler;
  21. extern int dxpRuler;
  22. extern int dypRuler;
  23. long FAR PASCAL RulerWndProc(hWnd, message, wParam, lParam)
  24. HWND hWnd;
  25. unsigned message;
  26. WORD wParam;
  27. LONG lParam;
  28. {
  29. /* This routine processes the messages sent to the ruler window. */
  30. extern vfCloseFilesInDialog;
  31. PAINTSTRUCT ps;
  32. switch (message)
  33. {
  34. case WM_PAINT:
  35. /* Time for the ruler to draw itself. */
  36. ResetRuler();
  37. BeginPaint(hWnd, (LPPAINTSTRUCT)&ps);
  38. RulerPaint(FALSE, TRUE, TRUE);
  39. EndPaint(hWnd, (LPPAINTSTRUCT)&ps);
  40. RulerPaint(TRUE, FALSE, FALSE);
  41. break;
  42. case WM_SIZE:
  43. /* We are saving the length of the ruler; we already know it's
  44. height. */
  45. dxpRuler = MAKEPOINT(lParam).x;
  46. break;
  47. case WM_DESTROY:
  48. /* Destroy the ruler window. */
  49. if (hMDCBitmap != NULL)
  50. {
  51. DeleteDC(hMDCBitmap);
  52. }
  53. if (hMDCScreen != NULL)
  54. {
  55. DeleteObject(SelectObject(hMDCScreen, hbmNull));
  56. DeleteDC(hMDCScreen);
  57. }
  58. if (vhDCRuler != NULL)
  59. {
  60. DeleteObject(SelectObject(vhDCRuler,
  61. GetStockObject(SYSTEM_FONT)));
  62. SelectObject(vhDCRuler, GetStockObject(WHITE_BRUSH));
  63. DeleteObject(SelectObject(vhDCRuler,
  64. GetStockObject(BLACK_PEN)));
  65. ReleaseDC(vhWndRuler, vhDCRuler);
  66. }
  67. if (hbmNullRuler != NULL)
  68. {
  69. DeleteObject(hbmNullRuler);
  70. hbmNullRuler = NULL;
  71. }
  72. vhDCRuler = hMDCScreen = hMDCBitmap = NULL;
  73. break;
  74. case WM_LBUTTONDOWN:
  75. case WM_LBUTTONDBLCLK:
  76. /* Process mouse events on the ruler. */
  77. RulerMouse(MAKEPOINT(lParam));
  78. break;
  79. #ifdef DEBUG
  80. case WM_RBUTTONDBLCLK:
  81. /* This the trap door that displays the "marquee" message. */
  82. if (wParam & MK_SHIFT && wParam & MK_CONTROL)
  83. {
  84. RulerMarquee();
  85. break;
  86. }
  87. #endif
  88. default:
  89. /* All of the messages we are not interested in. */
  90. return (DefWindowProc(hWnd, message, wParam, lParam));
  91. break;
  92. }
  93. if (vfCloseFilesInDialog)
  94. CloseEveryRfn( FALSE );
  95. /* A window procedure should always return something. */
  96. return (0L);
  97. }
  98.