MCPcopy Create free account
hub / github.com/CruiserOne/Astrolog / WndProc

Function WndProc

wdriver.cpp:739–1127  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

737// input or other message, do the appropriate action and updates.
738
739LRESULT 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:

Callers

nothing calls this directly

Calls 7

NWmCommandFunction · 0.85
ProcessStateFunction · 0.85
FRedrawFunction · 0.85
ModFunction · 0.85
DoPopupFunction · 0.85
AnimateFunction · 0.85
PrintWarningFunction · 0.85

Tested by

no test coverage detected