home *** CD-ROM | disk | FTP | other *** search
- /**********************************************************************
- *
- * CustomGetFile Dialog Demo
- *
- * Setup.c
- *
- * Written in CodeWarrior Gold 5.5
- * August 31, 1995
- *
- * Copyright © 1995 Carl B. Constantine
- * Some portions Copyright © 1995 MetroWerks, Inc.
- * Some portions Copyright © 1995 Apple Computer, Inc.
- *
- **********************************************************************/
-
- /*------------------------------------------------------------------
- #
- # File History
- #
- # Date Description of Change
- # ---- ---------------------
- # Aug 31/93 — Original creation of file
- #
- #
- -------------------------------------------------------------------*/
-
- #include <Traps.h>
-
- #include "AppConstants.h"
- #include "AppGlobals.h"
- #include "ErrUtils.h"
- #include "Setup.h"
- #include "TrapUtils.h"
-
- /*======================== Procedures & Functions =======================*/
-
- void Initialize( void )
- {
- short count;
- Handle menuBar;
- EventRecord event;
-
- gInBackground = FALSE;
- gQuitting = FALSE;
-
- /* Allocate more master pointers for the application early in the heap
- to reduce fragmentation of the heap. */
-
- for ( count = 1; count <= 10; count++ )
- MoreMasters();
-
- FlushEvents( everyEvent, 0); /* get rid of extra Finder Events */
-
- InitGraf( &qd.thePort );
- InitFonts();
- InitWindows();
- InitMenus();
- TEInit();
- InitDialogs( NIL );
- InitCursor();
-
- /* This next bit of code waits until MultiFinder brings the application
- to the front. This gives a better effect if a window is opened at
- startup. */
-
- for (count = 1; count <= 5; count++ )
- EventAvail( everyEvent, &event );
-
- SystemCheck();
-
- TEFromScrap(); /* Collect anything on the clipboard */
-
- menuBar = GetNewMBar( rMenuBar );
- if ( menuBar )
- {
- SetMenuBar( menuBar );
- DisposeHandle( menuBar );
- AddResMenu( GetMHandle( mApple), 'DRVR' ); /* Add Apple Menu Items */
- DrawMenuBar();
- }
- else
- ExitToShell();
-
-
- }
-
- /*----------------------------------------------------------------------------*/
-
- /* I use this routine to do the extra system checking. Things like what system
- version we are running, what type of Mac we are running on, etc. I am not
- allowing any System less than System 7.
- */
-
- void SystemCheck( void )
- {
- long machineType, qdVersion;
-
-
- if ( !GestaltAvailable() || !System7Available() )
- DeathAlert( errWimpySystem );
-
- if ( !TrapAvailable( _WaitNextEvent ) )
- DeathAlert( errWeirdSystem );
-
- }
-
-
- /*============================= End of File ==============================*/