home *** CD-ROM | disk | FTP | other *** search
- /*
- macmain.c
- -- Macintosh initializations, then call real main
-
- //Note: compile this segment as Main for generic 68000 processor, so it won't
- // fail on generic mac
-
- */
-
-
- #pragma segment Main
-
- #include <Types.h>
- #include <stdio.h>
- #include <ctype.h>
- #include <string.h>
-
- #include <Quickdraw.h>
- #include <Memory.h>
- #include <OSUtils.h>
- #include <ToolUtils.h>
- #include <Windows.h>
- #include <Palettes.h>
- #include <dialogs.h>
- #include <StandardFile.h>
- #include <Events.h>
- //#include <Menus.h>
- //#include <Fonts.h>
-
- extern _DataInit();
-
- //#define VERSION curSysEnvVers
- #define nocolorID 130
- #define no68020 133
- #define no68881 132
- #define no256 134
- #define nosys6 135
-
- void MacInit()
- {
- SysEnvRec theWorld;
- OSErr OSys;
- DialogPtr crashDia;
- long tick;
-
- UnloadSeg(_DataInit);
-
- InitGraf((Ptr)&qd.thePort);
- //InitFonts();
- InitWindows();
- //InitMenus();
- //TEInit();
- InitDialogs(nil);
- InitCursor();
-
- /*______________________________________________________*/
- /* If not right Machine then stop */
- /*______________________________________________________*/
- OSys = SysEnvirons( curSysEnvVers,&theWorld);
- if(!theWorld.hasColorQD) {
- crashDia = GetNewDialog (nocolorID, nil, (WindowPtr) -1);
- DrawDialog (crashDia);
- Delay (300, &tick);
- ExitToShell();
- }
- if(theWorld.processor < env68020) {
- crashDia = GetNewDialog (no68020, nil, (WindowPtr) -1);
- DrawDialog (crashDia);
- Delay (300, &tick);
- ExitToShell();
- }
- /*if(!theWorld.hasFPU) {
- crashDia = GetNewDialog (no68881, nil, (WindowPtr) -1);
- DrawDialog (crashDia);
- Delay (300, &tick);
- ExitToShell();
- }
- if(theWorld.systemVersion < 0x0600) {
- crashDia = GetNewDialog (nosys6, nil, (WindowPtr) -1);
- DrawDialog (crashDia);
- Delay (300, &tick);
- ExitToShell();
- }*/
-
- #ifdef UnDeFineD
- /*______________________________________________________*/
- /* Set Rects */
- /*______________________________________________________*/
- screenRect = qd.screenBits.bounds;
- offLeft = 0;
- offTop = 0;
- offRight = screenRect.right;
- offBottom = screenRect.bottom;
- SetRect(&BaseRect, 40, 60, 472, 282);
- tempRgn = GetGrayRgn();
- HLock ((Handle) tempRgn);
- TotalRect = (**tempRgn).rgnBBox;
- SetRect(&minRect, 80, 80, (**tempRgn).rgnBBox.right - 40,
- (**tempRgn).rgnBBox.bottom - 40);
- HUnlock ((Handle) tempRgn);
-
- /*______________________________________________________*/
- /* Open Window & set Palette & Picture */
- /*______________________________________________________*/
- theGDevice = GetMainDevice();
- HLock ((Handle) theGDevice);
- mycolors = (**(**theGDevice).gdPMap).pmTable;
- numcolor = (**(**theGDevice).gdPMap).pixelSize;
- HUnlock((Handle) theGDevice);
- switch (numcolor) {
- case 1:
- numcolor = 2;
- break;
- case 2:
- numcolor = 4;
- break;
- case 4:
- numcolor = 16;
- break;
- case 8:
- numcolor = 256;
- break;
- }
-
- myWindow = NewCWindow(nil, &BaseRect, "", TRUE, zoomDocProc,
- (WindowPtr) -1, TRUE, 150);
- SetPort((WindowPtr) myWindow);
- DrawGrowIcon (myWindow);
-
- srcPalette = NewPalette (numcolor, mycolors, pmCourteous, 0);
- SetPalette ((WindowPtr) myWindow, srcPalette, TRUE);
-
- /*______________________________________________________*/
- /* Set menus */
- /*______________________________________________________*/
- mymenu0 = GetMenu(appleID);
- AddResMenu(mymenu0, 'DRVR');
- InsertMenu(mymenu0,0);
- mymenu1 = newmenu(129,"File");
- appendmenu(mymenu1,"Start;Quit");
- InsertMenu(mymenu1,0);
- mymenu2 = newmenu(130,"Edit");
- InsertMenu(mymenu2,0);
- DrawMenuBar();
-
- /*______________________________________________________*/
- /* Init variables */
- /*______________________________________________________*/
- DoneFlag = FALSE;
- yieldTime = 0;
- return;
- #endif
-
- }
-
-
- real_main(int argc, char *argv[]);
-
- main(int argc, char *argv[])
- {
- MacInit();
- real_main(argc, argv);
- }
-
-