home *** CD-ROM | disk | FTP | other *** search
- /*
- DARKINIT - the initialization routines to Dark,
- a simple screen saver application for the
- "Darkness Multifinder Screen Saver System"
- written by Lunarmobiscuit Copyright 1989
- */
-
- /* PROTOTYPES */
- void InitMacintosh(void);
- void SetUpMenus(void);
- int SetUpBigWindow(void);
- extern void update_big(void);
-
-
- extern MenuHandle appleMenu;
- extern WindowPtr bigWindow;
-
- /* initialize mac managers */
- void InitMacintosh(void)
- {
- MaxApplZone();
-
- InitGraf(&thePort);
- InitFonts();
- FlushEvents(everyEvent, 0);
- InitWindows();
- InitMenus();
- TEInit();
- InitDialogs(0L);
- InitCursor();
- PenNormal();
- return;
- }
-
-
- /* create a "File" menu with a "Quit" item to keep Multifinder happy */
- void SetUpMenus(void)
- {
- InsertMenu(appleMenu = GetMenu(0), 0);
- DrawMenuBar();
- return;
- }
-
-
- /* create a BIG window, covering the entire screen(s) and menu bar */
- int SetUpBigWindow(void)
- {
- register int i;
- EventRecord theEvent;
- RgnHandle theGrayRgn,mBarRgn;
- Rect theRect,mBarRect;
-
- /* make sure the window comes up on the top layer */
- for (i=0;i<10;i++) EventAvail(everyEvent,&theEvent);
-
- /* First, determine the size for the window */
- theGrayRgn = GetGrayRgn();
- theRect = (**theGrayRgn).rgnBBox;
-
- /* Add on screenbits.bounds, as it includes the menu bar and grayrgn doesn't */
- UnionRect(&theRect, &screenBits.bounds, &theRect);
-
- /* Open big window */
- bigWindow = NewWindow(0L,&theRect,"\p",TRUE,0,-1L,FALSE,0L);
- if (!bigWindow) return(FALSE);
- SetPort(bigWindow);
-
- /* At this point, the new window is the correct size, but the visRgn
- doesn't include the menu bar */
- mBarRgn = NewRgn();
- if (!mBarRgn) return(FALSE);
- mBarRect = screenBits.bounds;
- mBarRect.bottom = mBarRect.top + MBarHeight;
- MBarHeight = 0; /* shrink the menu bar to avoid Multifinder's small icons */
-
- /* Screenbits is global, but visrgn is local */
- GlobalToLocal(&topLeft(mBarRect));
- GlobalToLocal(&botRight(mBarRect));
-
- /* Make region out of menu bar area */
- RectRgn(mBarRgn, &mBarRect);
-
- /* Tack this onto the windows visRgn */
- UnionRgn(bigWindow->visRgn, mBarRgn, bigWindow->visRgn);
-
- /* Get rid of the temp region */
- DisposeRgn(mBarRgn);
-
- /* draw the window */
- update_big();
- return(TRUE);
- }
-