home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 4 / Apprentice-Release4.iso / Source Code / Libraries / BSP Tree 1.2 / Sources / Core / source / main.cp < prev    next >
Encoding:
Text File  |  1995-03-19  |  3.8 KB  |  75 lines  |  [TEXT/MMCC]

  1. //------------------------------------------------------------------------------
  2. //    File:                    main.cp
  3. //    Date:                    7/7/94
  4. //    Author:                Bretton Wade
  5. //
  6. //    Description:    this file contains the main function, and associated
  7. //                                initialization and shutdown functions
  8. //
  9. //    Copyright:        this program, and all the code modules comprising it,
  10. //                                are ©1994 Bretton Wade. All rights reserved. No part
  11. //                                may be used without the author's expressed written
  12. //                                consent.
  13. //
  14. //------------------------------------------------------------------------------
  15.  
  16. #include    "menu.h"
  17. #include    "apple event.h"
  18. #include    "event.h"
  19. #include    "colors.h"
  20. #include    "minimum system.h"
  21. #include    "config.h"
  22.  
  23. //------------------------------------------------------------------------------
  24. //    variables
  25. //------------------------------------------------------------------------------
  26. bool    gFinished = FALSE;                                                                                                                //    execution control
  27.  
  28. //------------------------------------------------------------------------------
  29. //    external functions
  30. //------------------------------------------------------------------------------
  31. void    InitializeApplication (void);                                                                                            //    declare the external function to call
  32.  
  33. //------------------------------------------------------------------------------
  34. //    StartUp
  35. //------------------------------------------------------------------------------
  36. static    void    StartUp (void)                                                                                                        //    startup/initialization
  37. {                                                                                                                                                                //    begin
  38.     MaxApplZone ();                                                                                                                                //    initalize the heap zone
  39.     InitGraf (&qd.thePort);                                                                                                                //    initialize quickdraw
  40.     InitFonts ();                                                                                                                                    //    initialize fonts
  41.     InitWindows ();                                                                                                                                //    initialize windows
  42.     InitMenus ();                                                                                                                                    //    initialize menus
  43.     TEInit ();                                                                                                                                        //    initialize text editing
  44.     InitDialogs (0);                                                                                                                            //    initialize dialogs
  45.     InitCursor ();                                                                                                                                //    make the cursor visible, and make it an arrow
  46.     MinimumSystem ();                                                                                                                            //    be sure I have some minimum requirements
  47.     gMouseRgn = NewRgn ();                                                                                                                //    create the mouse region handle, leave it empty
  48.     InitAppMenus ();                                                                                                                            //    set up the menu bar
  49.     InstallAppleEvents ();                                                                                                                //    install my apple event handlers
  50.     Configure ();                                                                                                                                    //    get the application configuration
  51.     GetHiliteColors ();                                                                                                                        //    get the system hilite colors
  52.     InitializeApplication ();                                                                                                            //    call the function that initializes the aplication
  53. }                                                                                                                                                                //    end
  54.  
  55. //------------------------------------------------------------------------------
  56. //    shutdown
  57. //------------------------------------------------------------------------------
  58. static    void    ShutDown (void)                                                                                                        //    cleanup
  59. {                                                                                                                                                                //    begin
  60.     ExitToShell ();                                                                                                                                //    leave the application
  61. }                                                                                                                                                                //    end
  62.  
  63. //------------------------------------------------------------------------------
  64. //    main
  65. //------------------------------------------------------------------------------
  66. void    core_main (void)                                                                                                                    //    main, of course
  67. {                                                                                                                                                                //    begin
  68.     StartUp ();                                                                                                                                        //    initlaize the application
  69.     while (!gFinished)                                                                                                                        //    until the application is finished
  70.         ProcessOneEvent ();                                                                                                                    //    process events
  71.     ShutDown ();                                                                                                                                    //    cleanup after the application
  72. }                                                                                                                                                                //    end
  73.  
  74. //------------------------------------------------------------------------------
  75.