home *** CD-ROM | disk | FTP | other *** search
/ Garbo / Garbo.cdr / mac / source / macify13.shr / macify.hqx / Source / P / PDoMenuMacify.c < prev    next >
Text File  |  1991-03-15  |  6KB  |  223 lines

  1. /*  PDoMenuMacify                                                          Handle a selection of the menu bar */
  2.  
  3. /* Unit name:  PDoMenuMacify.c   */
  4. /* Function:  This module calls the appropiate menu list */
  5. /*      handler routine. */
  6. /* History: 3/15/91 Original by Prototyper 3.0   */
  7.  
  8.  
  9. #include "PCommonMacify.h"    /* Common */
  10. #include "Common_Macify.h"    /* Common */
  11. #include "PUtils_Macify.h"    /* General Utilities */
  12. #include "Utils_Macify.h"    /* General Utilities */
  13.  
  14. #include "AppleMenu.h"    /* Menu handlers */
  15. #include "FileMenu.h"    /* Menu handlers */
  16. #include "EditMenu.h"    /* Menu handlers */
  17. #include "PD_About_Dialog.h"    /* Modal Dialog */
  18. #include "DoMenuMacify.h"    /* Extra menu handler */
  19.  
  20. #include "PDoMenuMacify.h"    /* This file */
  21.  
  22.  
  23.  
  24.  
  25. /* ======================================================= */
  26.  
  27. void DoMenuApple(short theItem);                                        /* Handle this menu list */
  28. void DoMenuFile(short theItem);                                          /* Handle this menu list */
  29. void DoMenuEdit(short theItem);                                          /* Handle this menu list */
  30.  
  31. /* ======================================================= */
  32.  
  33.  
  34. /* ======================================================= */
  35.  
  36.  
  37. /* Routine: DoMenuApple */
  38. /* Purpose: Handle all menu items in this list */
  39.  
  40. void DoMenuApple( theItem)                                               /* Handle this menu selection */
  41. short        theItem;
  42. {
  43. Boolean    SkipProcessing;                                                 /* TRUE says skip processing */
  44. short    DNA;                                                                 /* For opening DAs */
  45. Str255    DAName;                                                          /* For getting DA name */
  46. GrafPtr    SavePort;                                                        /* Save current port when opening DAs */
  47.  
  48.  
  49.  
  50. SkipProcessing = FALSE;                                                   /* Set to not skip the processing of this menu item */
  51.  
  52. Do_AppleMenu(TRUE,theItem,&SkipProcessing);                       /* Pre menu handler */
  53.  
  54. if (SkipProcessing == FALSE)                                             /* See if process the menu list */
  55.     {
  56.  
  57.     switch (theItem) {                                                        /* Handle all commands in this menu list */
  58.  
  59.         case MItem_About_MACIFY:
  60.             PD_About_Dialog();                                                /* Call a modal dialog */
  61.             break;
  62.  
  63.         default:                                                                 /* Handle the DAs */
  64.             GetPort(&SavePort);                                             /* Save the current port */
  65.             GetItem(Menu_Apple, theItem, DAName);                     /* Get the name of the DA selected */
  66.             DNA = OpenDeskAcc(DAName);                                  /* Open the DA selected */
  67.             SetPort(SavePort);                                                /* Restore to the saved port */
  68.             break;
  69.  
  70.         }                                                                         /* End of item case */
  71.  
  72.     }                                                                             /* End of not SkipProcessing */
  73.  
  74. Do_AppleMenu(FALSE,theItem,&SkipProcessing);                     /* Post menu handler */
  75.  
  76. }                                                                                /* End of procedure */
  77.  
  78. /* ======================================================= */
  79.  
  80.  
  81. /* Routine: DoMenuFile */
  82. /* Purpose: Handle all menu items in this list */
  83.  
  84. void DoMenuFile( theItem)                                                 /* Handle this menu selection */
  85. short        theItem;
  86. {
  87. Boolean    SkipProcessing;                                                 /* TRUE says skip processing */
  88.  
  89.  
  90.  
  91. SkipProcessing = FALSE;                                                   /* Set to not skip the processing of this menu item */
  92.  
  93. Do_FileMenu(TRUE,theItem,&SkipProcessing);                         /* Pre menu handler */
  94.  
  95. if (SkipProcessing == FALSE)                                             /* See if process the menu list */
  96.     {
  97.  
  98.     switch (theItem) {                                                        /* Handle all commands in this menu list */
  99.  
  100.         case MItem_Mac____UNIX:
  101.             call_macify(2);
  102. /*            Open_The_File();            /* Open a file */
  103. /*            Save_The_File();  */
  104.             break;
  105.  
  106.         case MItem_UNIX____Mac:
  107.             call_macify(1);
  108. /*            Open_The_File();                                                   /* Open a file */
  109. /*            Save_The_File();    */
  110.             break;
  111.  
  112.         case MItem_Quit:
  113.             doneFlag = TRUE;
  114.             break;
  115.  
  116.         default:
  117.             break;
  118.  
  119.         }                                                                         /* End of item case */
  120.  
  121.     }                                                                             /* End of not SkipProcessing */
  122.  
  123. Do_FileMenu(FALSE,theItem,&SkipProcessing);                        /* Post menu handler */
  124.  
  125. }                                                                                /* End of procedure */
  126.  
  127. /* ======================================================= */
  128.  
  129.  
  130. /* Routine: DoMenuEdit */
  131. /* Purpose: Handle all menu items in this list */
  132.  
  133. void DoMenuEdit( theItem)                                                 /* Handle this menu selection */
  134. short        theItem;
  135. {
  136. Boolean    SkipProcessing;                                                 /* TRUE says skip processing */
  137. Boolean    BoolHolder;                                                       /* For SystemEdit result */
  138.  
  139.  
  140.  
  141. SkipProcessing = FALSE;                                                   /* Set to not skip the processing of this menu item */
  142.  
  143. Do_EditMenu(TRUE,theItem,&SkipProcessing);                         /* Pre menu handler */
  144.  
  145. if (SkipProcessing == FALSE)                                             /* See if process the menu list */
  146.     {
  147.  
  148.     BoolHolder = SystemEdit ( theItem - 1 );                             /* Let the DA do the edit to itself */
  149.  
  150.     if  (BoolHolder == FALSE)                                               /* If not a DA then we get it */
  151.         {                                                                         /* Handle by using a Case statment */
  152.  
  153.         switch (theItem) {                                                     /* Handle all commands in this menu list */
  154.  
  155.             case MItem_Undo:
  156.                 break;
  157.  
  158.             case MItem_Cut:
  159.                 break;
  160.  
  161.             case MItem_Copy:
  162.                 break;
  163.  
  164.             case MItem_Paste:
  165.                 break;
  166.  
  167.             case MItem_Clear:
  168.                 break;
  169.  
  170.             case MItem_Select_All:
  171.                 break;
  172.  
  173.             case MItem_Show_Clipboard:
  174.                 break;
  175.  
  176.             default:                                                              /* Send to a DA */
  177.                 break;
  178.  
  179.             }                                                                      /* End of item case */
  180.         }                                                                         /* End of not BoolHolder */
  181.  
  182.     }                                                                             /* End of not SkipProcessing */
  183.  
  184. Do_EditMenu(FALSE,theItem,&SkipProcessing);                        /* Post menu handler */
  185.  
  186. }                                                                                /* End of procedure */
  187.  
  188. /* ======================================================= */
  189.  
  190. /* Routine: Handle_My_Menu */
  191. /* Purpose: Vector off to the appropiate menu list handler */
  192.  
  193. void Handle_My_Menu(  theMenu, theItem)
  194. short    theMenu;
  195. short    theItem;
  196. {
  197.  
  198.  
  199. switch (theMenu)                                                            /* Do selected menu list */
  200.     {
  201.  
  202.     case Res_Menu_Apple:
  203.         DoMenuApple(theItem);                                              /* Go handle this menu list */
  204.         break;
  205.  
  206.     case Res_Menu_File:
  207.         DoMenuFile(theItem);                                                 /* Go handle this menu list */
  208.         break;
  209.  
  210.     case Res_Menu_Edit:
  211.         DoMenuEdit(theItem);                                                 /* Go handle this menu list */
  212.         break;
  213.  
  214.     default:
  215.         Handle_Other_Menus(theMenu,theItem);                          /* Handle other special menus */
  216.         break;
  217.  
  218.     }                                                                             /* End for the Lists */
  219.  
  220. HiliteMenu(0);                                                                /* Turn menu selection off */
  221. }                                                                                /* End of procedure Handle_My_Menu */
  222.  
  223.