home *** CD-ROM | disk | FTP | other *** search
/ Mac-Source 1994 July / Mac-Source_July_1994.iso / C and C++ / Utilities / Winter Shell 1.0d2 / Source / Special / main.c next >
Encoding:
C/C++ Source or Header  |  1994-01-16  |  3.6 KB  |  140 lines  |  [TEXT/KAHL]

  1. #include "ApplicationLib.h"
  2. #include "EventLib.h"
  3. #include "MenuLib.h"
  4. #include "ResourceConstantsLib.h"
  5.  
  6. /* associate commands with menu items */
  7. static MenuPickType menus[64] = {
  8.     { RLM_APPLE, 0, CMD_APPLE, NULL },
  9.     { RLM_APPLE, 1, CMD_ABOUT, NULL },
  10.     { RLM_APPLE, 2, CMD_HELP, NULL },
  11.     { RLM_FILE, 0, CMD_FILE, NULL },
  12.     { RLM_FILE, 1, CMD_NEW, NULL },
  13.     { RLM_FILE, 2, CMD_OPEN, NULL },
  14.     { RLM_FILE, 4, CMD_CLOSE, NULL },
  15.     { RLM_FILE, 5, CMD_SAVE, NULL },
  16.     { RLM_FILE, 6, CMD_SAVE_AS, NULL },
  17.     { RLM_FILE, 7, CMD_REVERT, NULL },
  18.     { RLM_FILE, 9, CMD_PAGE_SETUP, NULL },
  19.     { RLM_FILE, 10, CMD_PRINT, NULL },
  20.     { RLM_FILE, 12, CMD_QUIT, NULL },
  21.     { RLM_EDIT, 0, CMD_EDIT, NULL },
  22.     { RLM_EDIT, 1, CMD_UNDO, NULL },
  23.     { RLM_EDIT, 3, CMD_CUT, NULL },
  24.     { RLM_EDIT, 4, CMD_COPY, NULL },
  25.     { RLM_EDIT, 5, CMD_PASTE, NULL },
  26.     { RLM_EDIT, 6, CMD_CLEAR, NULL },
  27.     { RLM_EDIT, 7, CMD_SELECT_ALL, NULL },
  28.     { RLM_EDIT, 9, CMD_CLIPBOARD, NULL },
  29.     { RLM_EDIT, 10, CMD_PREFERENCES, NULL },    
  30.     { RLM_FONT, 0, CMD_FONT, NULL },
  31.     { RLM_SIZE, 0, CMD_SIZE, NULL },
  32.     { RLM_STYLE, 0, CMD_STYLE, NULL },
  33.     { RLM_JUST, 0, CMD_JUST, NULL },
  34.     { RLM_JUST, 1, CMD_JUSTIFY_LEFT, NULL },
  35.     { RLM_JUST, 2, CMD_JUSTIFY_CENTER, NULL },
  36.     { RLM_JUST, 3, CMD_JUSTIFY_RIGHT, NULL },
  37.     { RLM_TEXT, 0, CMD_TEXT, NULL },
  38.     { RLM_TEXT, 5, CMD_MARGIN, NULL },
  39.     { RLM_WINDOWS, 0, CMD_WINDOW, NULL },
  40.     { RLM_DEBUG, 0, CMD_DEBUG, NULL },
  41.     { RLM_DEBUG, 1, CMD_DEBUG_DEBUGGER, NULL },
  42.     { RLM_DEBUG, 2, CMD_DEBUG_WINDOW, NULL },
  43.     { RLM_DEBUG, 3, CMD_DEBUG_MEMORY, NULL },
  44.     { RLM_DEBUG, 5, CMD_DEBUG_ASSERT_ALL, NULL },
  45.     { RLM_DEBUG, 6, CMD_DEBUG_ASSERT_REQUIRE, NULL },
  46.     { RLM_DEBUG, 7, CMD_DEBUG_ASSERT_ENSURE, NULL },
  47.     { RLM_DEBUG, 8, CMD_DEBUG_ASSERT_CHECK, NULL },
  48.     { RLM_DEBUG, 10, CMD_DEBUG_ASSERT_BREAK, NULL },
  49.     { RLM_DEBUG, 11, CMD_DEBUG_ASSERT_RAISE, NULL },
  50.     { RLM_DEBUG, 12, CMD_DEBUG_ASSERT_TRACE, NULL },
  51.     { RLM_DEBUG, 13, CMD_DEBUG_ASSERT_STACK, NULL },
  52.     { RLM_DEBUG, 15, CMD_DEBUG_PROFILE, NULL },
  53.     { RLM_DEBUG, 16, CMD_DEBUG_TRACE, NULL },
  54.     { 0, 0, CMD_NONE, NULL },
  55. };
  56.  
  57. #pragma options(!require_protos, infer_protos)
  58.  
  59. // debug_note
  60. #include "PatchLib.h"
  61.  
  62. // debug_note
  63. pascal Boolean PatchSystemEvent(PatchType *patch, EventRecord *event)
  64. {
  65.     /* do nothing */
  66.     return(false);
  67. }
  68.  
  69. static void init(void)
  70. {
  71.     TRY {
  72.  
  73.         // debug_note
  74.         (void) PatchBegin(PatchSystemEvent, _SystemEvent, sizeof(EventRecord *),
  75.             sizeof(PatchBooleanParameter), NULL);
  76.         
  77.         /* minimal event tables */
  78.         ApplicationEventTableRegister();
  79.         CtlEventTableRegister();
  80.         DlgModalEventTableRegister();
  81.         WinEventTableRegister();
  82.         TxEventTableRegister();
  83.  
  84.         /* next tier of event tables */
  85.         RadioEventTableRegister();
  86.         FloatMenuEventTableRegister();
  87.         FrameEventTableRegister();
  88.         ListEventTableRegister();
  89.         SBarEventTableRegister();
  90.  
  91.         /* next tier of event tables */
  92.         AboutEventTableRegister();
  93.         ClipboardEventTableRegister();
  94.         HelpEventTableRegister();
  95.         ProgressEventTableRegister();
  96.  
  97.         /* application event tables */
  98.         AppPrefsEventTableRegister();
  99.         IconListEventTableRegister();
  100.         TxScrlEventTableRegister();
  101.         WinMenuEventTableRegister();
  102.         
  103.         DocEventTableRegister();
  104.         DocHLEInstall();
  105.         TxDocTableRegister();
  106.         
  107.         //ConcatenateTextFoldersHLEInstall();//debug_note
  108.         
  109.         /* specific application event tables */
  110.         TestEventTableRegister();
  111.         
  112.         /* debugging event tables */
  113.         #ifndef NDEBUG
  114.             DebugEventTableRegister();
  115.             MemoryWindowEventTableRegister();
  116.         #endif
  117.         
  118.         /* attach commands to menu items */
  119.         MenuTableAppend(menus);
  120.         
  121.     } CATCH {
  122.         AppFailed();
  123.     } ENDTRY;
  124. }
  125.  
  126. #pragma options(require_protos, !infer_protos)
  127.  
  128. void main(void)
  129. {
  130.     TRY {
  131.         AppBegin();
  132.         init();
  133.         AppRun();
  134.         AppEnd();
  135.     } CATCH {
  136.         NOPROPAGATE;
  137.     } ENDTRY;
  138.     ExitToShell(); /* also removes all of our patches */
  139. }
  140.