|
|
1.1 root 1: /****************************************************************************
2: *
1.1.1.2 ! root 3: * lfinit.c -- Initialization portion of LineFractal Application.
1.1 root 4: *
1.1.1.2 ! root 5: * Created by Microsoft Corporation, 1989
1.1 root 6: *
7: ****************************************************************************/
8:
1.1.1.2 ! root 9: #define INCL_WIN
! 10: #define INCL_GPI
1.1 root 11: #include <os2.h>
1.1.1.2 ! root 12:
! 13: #define INCL_GLOBALS
1.1 root 14: #include "linefrac.h"
15:
1.1.1.2 ! root 16: #define INCL_LFINIT
! 17: #define INCL_LFMAIN
! 18: #include "lffuncs.h"
! 19:
! 20:
! 21:
! 22:
! 23: /************************************************************************
! 24: *
! 25: * Global Variables
! 26: *
! 27: ************************************************************************/
! 28:
! 29: extern GLOBALDATA global;
! 30: extern ULONG aulRops[];
1.1 root 31:
32:
33:
34:
35: /****************************************************************************
36: *
1.1.1.2 ! root 37: * LfInitApp
1.1 root 38: *
39: * Register application window class and creates standard window.
40: *
41: ****************************************************************************/
42:
43: BOOL FAR
1.1.1.2 ! root 44: LfInitApp(VOID)
1.1 root 45: {
46: char szTitle[24];
47: ULONG ctldata;
1.1.1.2 ! root 48: PID pid;
! 49: TID tid;
! 50: HSWITCH hsw;
! 51: static SWCNTRL swctl = { 0, 0, 0, 0, 0, SWL_VISIBLE,
! 52: SWL_JUMPABLE, "LineFractal", 0 };
! 53:
1.1 root 54:
55: /* Register Application Window Class */
56:
1.1.1.2 ! root 57: WinLoadString( global.hab, NULL, IDS_TITLE, sizeof(szTitle), (PCH)szTitle );
! 58: if ( !WinRegisterClass( global.hab, (PCH)szTitle, (PFNWP)LineFracWndProc,
1.1 root 59: CS_SIZEREDRAW, 0 ))
60: return FALSE;
61:
62:
1.1.1.2 ! root 63: /* Load the window's default pointer. */
! 64: if (!((global.hptr)[0] = WinLoadPointer( HWND_DESKTOP, NULL, IDR_KOCH0 )))
! 65: return FALSE;
! 66: if (!((global.hptr)[1] = WinLoadPointer( HWND_DESKTOP, NULL, IDR_KOCH1 )))
! 67: return FALSE;
! 68: if (!((global.hptr)[2] = WinLoadPointer( HWND_DESKTOP, NULL, IDR_KOCH2 )))
! 69: return FALSE;
! 70: if (!((global.hptr)[3] = WinLoadPointer( HWND_DESKTOP, NULL, IDR_KOCH3 )))
! 71: return FALSE;
! 72: if (!(global.hptrTrack = WinLoadPointer( HWND_DESKTOP, NULL, IDR_TRACKINGPTR )))
! 73: return FALSE;
! 74: if (!(global.hptrPaste = WinLoadPointer( HWND_DESKTOP, NULL, IDR_PASTINGPTR )))
! 75: return FALSE;
! 76: if (!(global.hptrWait = WinQuerySysPointer(HWND_DESKTOP,SPTR_WAIT,FALSE)))
! 77: return FALSE;
! 78:
! 79:
! 80:
1.1 root 81: /* Create a window instance of class "LineFractal" */
82:
1.1.1.2 ! root 83: ctldata = FCF_STANDARD &
! 84: ~(ULONG)(FCF_ICON | FCF_ACCELTABLE | FCF_TASKLIST);
1.1 root 85:
1.1.1.2 ! root 86: if (global.hwndFrame = WinCreateStdWindow(
1.1 root 87: HWND_DESKTOP, /* specify desktop as parent window */
88: WS_VISIBLE, /* window styles */
89: &ctldata, /* frame creation flags */
1.1.1.2 ! root 90: (PCH)szTitle, /* window class name */
1.1 root 91: (PCH)szTitle, /* name appearing in window caption */
92: 0L, /* */
93: (HMODULE)NULL, /* use current executable module id */
1.1.1.2 ! root 94: IDR_LINEFRACTAL, /* menu id */
! 95: (HWND FAR *)&global.hwnd /* window handle */
1.1 root 96: ))
1.1.1.2 ! root 97: {
! 98: global.fFirstThread = TRUE;
1.1 root 99:
1.1.1.2 ! root 100: global.fAutoSwitch = FALSE;
! 101: global.usSwitchDelay = 1 * 1000; /* 1 sec */
! 102: global.fThreadInheritance = TRUE;
! 103: global.fUpdateMenusOnThreadSwitch = TRUE;
! 104: global.fTimerOn = FALSE;
! 105: global.usMinTimerDelay = 1 * 1000; /* 1 sec */
! 106: global.usMaxTimerDelay = 5 * 1000; /* 5 sec */
! 107:
! 108: global.usRopIndex = 0;
! 109: global.ulPasteROP = aulRops[global.usRopIndex];
! 110: global.usPtrIncr = 1;
! 111: global.usPtrCounter = 1;
! 112: global.usUserPtr = 2;
! 113: global.usCurPtr = global.usUserPtr;
! 114: global.usPtrThreshold = 5;
! 115: global.fUseClipbrd = FALSE;
! 116: global.fTracking = FALSE;
! 117: global.fSelecting = FALSE;
! 118: global.fPasting = FALSE;
! 119: global.fMouseChangesRecursion = TRUE;
! 120: global.fAnimatePtr = TRUE;
! 121: global.fTempSelect = FALSE;
! 122: global.fShowSelectRc = FALSE;
! 123: global.fHaveSelectRc = FALSE;
! 124: global.fHaveCutCopyDC = FALSE;
! 125:
! 126: global.fUpdateAttrs = FALSE;
! 127: global.flLineAttrs = 0L;
! 128: global.flMarkerAttrs = 0L;
! 129: global.flAreaAttrs = 0L;
! 130: global.flImageAttrs = 0L;
! 131: global.flMiscAttrs = 0L;
! 132:
! 133:
! 134: WinQueryWindowRect(global.hwnd, &global.rcl);
! 135:
! 136: global.cThr = 0; /* start with no active threads */
! 137: global.pThrTop = NULL; /* make sure this guy's invalid */
! 138:
! 139:
! 140: #define INIT_MENU_ITEM(val, var) \
! 141: TOGGLE_MENU_ITEM(global.hwndFrame, (val), (var))
! 142:
! 143: /* Check boolean menu items if they are set to true. */
! 144:
! 145: INIT_MENU_ITEM(IDM_AUTOSWITCH, global.fAutoSwitch);
! 146: INIT_MENU_ITEM(IDM_UPDATEMENUS, global.fUpdateMenusOnThreadSwitch);
! 147: INIT_MENU_ITEM(IDM_THREADINHERITANCE, global.fThreadInheritance);
! 148: INIT_MENU_ITEM(IDM_USECLIPBRD, global.fUseClipbrd);
! 149: INIT_MENU_ITEM(IDM_MOUSECHANGESRECURSION, global.fMouseChangesRecursion);
! 150: INIT_MENU_ITEM(IDM_ANIMATEPTR, global.fAnimatePtr);
! 151:
! 152: CHECK_MENU_ITEM(global.hwndFrame, IDM_PASTES+global.usRopIndex);
! 153:
! 154:
! 155: /* Add ourselves to the switch list. */
! 156:
! 157: WinQueryWindowProcess(global.hwndFrame, &pid, &tid);
! 158: swctl.hwnd = global.hwndFrame;
! 159: swctl.idProcess = pid;
! 160: hsw = WinAddSwitchEntry(&swctl);
1.1 root 161:
1.1.1.2 ! root 162: return TRUE;
! 163: }
1.1 root 164: return FALSE;
165: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.