| 737 | // input or other message, do the appropriate action and updates. |
| 738 | |
| 739 | LRESULT API WndProc(HWND hwnd, UINT wMsg, WPARAM wParam, LPARAM lParam) |
| 740 | { |
| 741 | HDC hdc; |
| 742 | HPEN hpen, hpenOld; |
| 743 | HBRUSH hbr; |
| 744 | RECT rc; |
| 745 | int iParam, x, y; |
| 746 | |
| 747 | wi.hwnd = hwnd; |
| 748 | switch (wMsg) { |
| 749 | |
| 750 | // A command, most likely a menu option, was given. |
| 751 | |
| 752 | case WM_COMMAND: |
| 753 | if (wi.fSaverRun) |
| 754 | goto LClose; |
| 755 | switch (NWmCommand((WORD)wParam)) { |
| 756 | case 1: |
| 757 | goto LClose; |
| 758 | case -1: |
| 759 | return DefWindowProc(hwnd, wMsg, wParam, lParam); |
| 760 | default: |
| 761 | iParam = (int)wParam & 0xffff; |
| 762 | wi.fSkipSystem = (iParam == cmdMacro10/*F10*/ || iParam == |
| 763 | cmdMacro22/*Shift+F10*/ || iParam == cmdMacro34/*Ctrl+F10*/ || |
| 764 | iParam == cmdMacro40/*Alt+F4*/); |
| 765 | ProcessState(); |
| 766 | } |
| 767 | break; |
| 768 | |
| 769 | // A special system command was given. Suppress its action if it was |
| 770 | // invoked by a hotkey which ran a macro, to avoid both effects happening. |
| 771 | |
| 772 | case WM_SYSCOMMAND: |
| 773 | iParam = (int)wParam & 0xfff0; |
| 774 | if (wi.fSkipSystem && (iParam == SC_KEYMENU || iParam == SC_CLOSE)) { |
| 775 | wi.fSkipSystem = fFalse; |
| 776 | break; |
| 777 | } |
| 778 | return DefWindowProc(hwnd, wMsg, wParam, lParam); |
| 779 | |
| 780 | // When a part of a window is uncovered, Windows quickly blanks it out, |
| 781 | // usually with white, before having the app redraw that section. Most |
| 782 | // apps don't do anything here, however Astrolog can quickly draw with |
| 783 | // a more appropriate color since we know our chart's background color. |
| 784 | |
| 785 | case WM_ERASEBKGND: |
| 786 | if (!(wi.fNoUpdate & 1) && !wi.fBuffer) { |
| 787 | GetClipBox((HDC)wParam, &rc); |
| 788 | hbr = CreateSolidBrush(KvFromKi(gi.kiOff)); |
| 789 | FillRect((HDC)wParam, &rc, hbr); |
| 790 | DeleteObject(hbr); |
| 791 | } |
| 792 | return fTrue; |
| 793 | |
| 794 | // The window was just created. Setup the scrollbars. |
| 795 | |
| 796 | case WM_CREATE: |
nothing calls this directly
no test coverage detected