home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1992 June: ROMin Holiday / ADC Developer CD (1992-06) (''ROMin Holiday'')_iso / Developer Connection - 06-1992.iso / Development Platforms / Apple II / Apple II Sample Code / APW.SC / SC01Shell / Rez.Shell / Shell.rez
Encoding:
Text File  |  1990-06-23  |  16.4 KB  |  400 lines  |  [TEXT/pdos]

  1. #include "types.rez"
  2.  
  3. /* Shell Application Resources - v3.0 Deatherage, Strnad, Luther
  4.    Copyright 1988-1990 Apple Computer, Inc.
  5.    All shell resources are in the range 0x0000nnnn, the lowest allowable 64K
  6.    range of application resource IDs. */
  7.  
  8. /* for clarity and ease of distinguishing between IDs of resources and IDs of
  9.    toolbox entities, identifiers for resource IDs are suffixed with RID and
  10.    identifiers for other toolbox entities such as menu and window controls are
  11.    suffixed with ID */
  12.        
  13. #define BaseResID 0x0           /* starting offset for shell resources */
  14. #define MenuBarIDShift 0x1000   /* multiplier for menu numbers in */
  15.                                 /* resource IDs */
  16. #define MenuIDShift 0x100       /* multiplier for menu bar numbers in */
  17.                                 /* resource IDs */
  18.  
  19. /* The menu resource IDs are in the form 0x0000wxyy calculated as
  20.    ID = BaseResID + (w*MenuBarIDShift) + (x*MenuIDShift) + yy, where w is the
  21.    menu bar number in the range $1 to $F, x is the number of the menu in the
  22.    range $0 to $F and yy is the number of the item number in that menu in the
  23.    range $01 to $FF. The shell program uses the conventions that:
  24.    
  25.    1. the resource id of a menu is that of the zeroth item within it,
  26.    
  27.    2. the resource id of a menu bar is that of the zeroth item in the zeroth
  28.       menu contained within that menu bar, and
  29.    
  30.    3. values of zero for w and x correspond to the 16th menubar or menu in a
  31.       menu bar.
  32.    
  33.    For example, the 2nd item from the 3rd menu in the 5th menu bar has resource
  34.    ID 0x00005302 when BaseResID is 0x0, MenuIDShift is 0x100, and
  35.    MenuBarIDShift is 0x1000. The resource id of the menu containing this item
  36.    is that of the zeroth item in the 3rd menu of the 5th menu bar, 0x00005300.
  37.    The resource id of the menu bar containing this menu and menu item is that
  38.    of the zeroth item in the zeroth menu, 0x00005000.
  39.    
  40.    An exception to the menu resource id being of the form 0x0000wxyy is any
  41.    menu possibly containing more than 256 items. Font menus built using the
  42.    Font Manager FixFontMenu call are an example of this. Menus built using
  43.    FixFontMenu will contain more than 256 items if the user has installed more
  44.    than 256 fonts in the fonts folder. To anticipate this case, and to preserve
  45.    the correspondence inherent in these conventions between resource ids and
  46.    control or menu item ids, the resource id would be formulated differently.
  47.    One approach would be to to have the resource id of this menu be of the form
  48.    0x0000wnnn where w would be any number $0 to $F, not assigned to a menu bar
  49.    (also not assigned to pop-up menu per discussion below). Another approach,
  50.    that still uses the conventions being described, would be to have the 
  51.    resource id of this menu be of the form 0x0000wxyy where x would be the 
  52.    lowest number $0 to $F not used by another menu in that menu bar.
  53.  
  54.     Further conventions used by the shell program are:
  55.    
  56.    4. control and item IDs and resource IDs for controls and items are the same
  57.       and resource IDs for their title strings are also the same, and 
  58.           
  59.    5. since the title string resource IDs are the same as the menu resource
  60.       IDs, resource IDs for other resources of type rPString are assumed to be
  61.       of the form 0x0000wnnn where w is any number $0 to $F not assigned to a
  62.       menu bar; as a suggestion, this value w can be distinct for each kind of
  63.       window using resources within the program, if the number of menu bars
  64.       plus the number of distinct kinds of resource-using windows is 16 or
  65.       less.
  66.  
  67.    Note that structuring the menu resource IDs in this form 0x0000wxyy avoids a
  68.    bug in the system version 5.0 of NewMenuBar2 where it cannot release
  69.    resources unless the high word of the resource ID is zero. These conventions
  70.    also allow for easy processing of resource IDs entirely represented in the
  71.    low word of the ID, for easy editing of menus, menu bars, and menu items, as
  72.    shown below, and for a reference when debugging. These conventions are
  73.    suggested for programming convenience only, programmers may wish to devise
  74.    other conventions for assigning resource IDs differently.
  75.    
  76.    For instance:
  77.    
  78.    1. programmers may want to utilize the high word of resource IDs,
  79.    
  80.    2. programmers may want to consolidate the RID, title RID, and ID
  81.       identifiers in their programs if these will always be defined to be the
  82.       same.
  83.    
  84.    3. pop-up menus could be assigned using a form similar to that used above
  85.       for menus except that w would be any number $0 to $F, not assigned to a
  86.       menu bar, designating a window in which the pop-up was used.
  87.    
  88.    4. resource IDs for the other various resource types, in general, may be
  89.       assigned so that the low word of the resource ID is of approximate form
  90.       0x0000abcc where a is any number $0 to $F, not assigned to a menu bar,
  91.       designating a window in which the resource is used, b is any nine bit
  92.       wide zero value, and cc is a number $0 to $7F distinguishing the resource
  93.       from others of the same type used in a particular window. For programs
  94.       not using suggestion (2) above and having windows using a large number of
  95.       resources, the value for b could be a nine bit value designating the
  96.       resource type with the high order bit in the least significant position.
  97.    
  98.    Again, these are only illustrations of how programmers may adopt resource ID
  99.    conventions suitable within a particular program.
  100.    
  101.    CAUTION: Resource IDs must be distinct within each resource type and must
  102.    not be > 0x07FEFFFF.   
  103.        */
  104.        
  105. #define AboutAlertStringRID BaseResID + 1
  106. #define MenuAlertStringRID BaseResID + 2
  107.  
  108. #define MenuBarOneRID BaseResID + (1 * MenuBarIDShift)
  109.  
  110. #define AppleMenuRID MenuBarOneRID + (1 * MenuIDShift)
  111. #define FileMenuRID MenuBarOneRID + (2 * MenuIDShift)
  112. #define EditMenuRID MenuBarOneRID + (3 * MenuIDShift)
  113.  
  114. #define AboutRID AppleMenuRID + 1
  115.  
  116. #define QuitRID FileMenuRID + 2
  117.  
  118. /* The edit menu item IDs are by convention defined with the values below,
  119.    starting at 250. Since this program uses the same values for the
  120.    corresponding resource IDs, be careful not to attempt to reuse these
  121.    resource IDs items and title strings in particular */
  122.    
  123. #define UndoRID 250
  124. #define CutRID 251
  125. #define CopyRID 252
  126. #define PasteRID 253
  127. #define ClearRID 254
  128. #define CloseRID 255
  129.  
  130. #define AppleMenuTitleRID MenuBarOneRID + (1 * MenuIDShift)
  131. #define FileMenuTitleRID MenuBarOneRID + (2 * MenuIDShift)
  132. #define EditMenuTitleRID MenuBarOneRID + (3 * MenuIDShift)
  133.  
  134. #define AboutTitleRID AppleMenuRID + 1
  135.  
  136. #define QuitTitleRID FileMenuRID + 2
  137.  
  138. #define UndoTitleRID 250
  139. #define CutTitleRID 251
  140. #define CopyTitleRID 252
  141. #define PasteTitleRID 253
  142. #define ClearTitleRID 254
  143. #define CloseTitleRID 255
  144.  
  145. #define MenuBarOneID BaseResID + (1 * MenuBarIDShift)
  146.  
  147. #define AppleMenuID MenuBarOneID + (1 * MenuIDShift)
  148. #define FileMenuID MenuBarOneID + (2 * MenuIDShift)
  149. #define EditMenuID MenuBarOneID + (3 * MenuIDShift)
  150.  
  151. #define AboutID AppleMenuID + 1
  152.  
  153. #define QuitID FileMenuID + 2
  154.  
  155. #define UndoID 250
  156. #define CutID 251
  157. #define CopyID 252
  158. #define PasteID 253
  159. #define ClearID 254
  160. #define CloseID 255
  161.  
  162. #define MainToolStartupRID BaseResID+1
  163.  
  164. resource rAlertString (AboutAlertStringRID) {
  165.     "7"
  166.     "3/"
  167.     TBCenterJust
  168.     "Apple IIGS Shell Application, Version 3.0"
  169.     TBEndOfLine
  170.     "By Apple II Developer Technical Support"
  171.     TBEndOfLine
  172.     "Copyright 1988-1990 Apple Computer, Inc."
  173.     TBEndOfLine
  174.     "/^#0\000"
  175. };
  176.  
  177. resource rAlertString (MenuAlertStringRID)  {
  178.     "2"
  179.     "0/"
  180.     TBCenterJust
  181.     "This menu item is under construction."
  182.     TBEndOfLine
  183.     "Please add some code."
  184.     TBEndOfLine
  185.     "/^#0\000"
  186. };
  187.  
  188. resource rMenuBar (MenuBarOneRID)   {
  189.     
  190. /* Note: The form of this resource ID $0000wxyy where w is the menu bar number
  191.          avoids a bug in NewMenuBar2 - it can't release resources unless the
  192.          high word of the ID is zero.  --MD */
  193.            
  194. /* 1.1B1 - Changed the Apple Menu to properly use Color Replace highlighting,
  195.    to avoid the "Green Apple" when the menu is pulled down.  --MD */
  196.     
  197.     {
  198.     AppleMenuRID,                                       /* Apple menu */
  199.     FileMenuRID,                                        /* File menu */
  200.     EditMenuRID                                         /* Edit menu */
  201.     }
  202. };
  203.  
  204. resource rMenu (AppleMenuRID)   {
  205.     AppleMenuID,                                        /* Menu ID */
  206.     RefIsResource*MenuTitleRefShift+RefIsResource*ItemRefShift+fAllowCache,
  207.                                                         /* flags */
  208.     AppleMenuTitleRID,                                  /* Title reference */
  209.     {AboutID}                                       /* Menu item reference */
  210. };
  211.  
  212. resource rMenu (FileMenuRID)    {
  213.     FileMenuID,                                         /* Menu ID */
  214.     RefIsResource*MenuTitleRefShift+RefIsResource*ItemRefShift+fAllowCache,
  215.                                                         /* flags */
  216.     FileMenuTitleRID,                                   /* Title reference */
  217.     {CloseID,
  218.     QuitID}                                         /* Menu item references */
  219. };
  220.  
  221. resource rMenu (EditMenuRID)    {
  222.     EditMenuID,                                         /* Menu ID */
  223.     RefIsResource*MenuTitleRefShift+RefIsResource*ItemRefShift+fAllowCache+
  224.         rmDisabled,
  225.                                                         /* flags */
  226.     EditMenuTitleRID,                                   /* Title reference */
  227.     {UndoID,
  228.     CutID,
  229.     CopyID,
  230.     PasteID,
  231.     ClearID}                                        /* Menu item references */
  232. };
  233.  
  234. resource rMenuItem (AboutRID,nocrossbank)   {
  235.     AboutID,                                            /* Item ID */
  236.     "","",                                              /* Item characters */
  237.     NIL,                                                /* Item check */
  238.     RefIsResource*ItemTitleRefShift+rMIDivider,         /* Item flags */
  239.     AboutTitleRID                                       /* Title reference */
  240. };
  241.  
  242. resource rMenuItem (CloseRID,nocrossbank)   {
  243.     CloseID,                                            /* Item ID */
  244.     "","",                                              /* Item characters */
  245.     NIL,                                                /* Item check */
  246.     RefIsResource*ItemTitleRefShift+rMIDivider+rMIDisabled,
  247.                                                         /* Item flags */
  248.     CloseTitleRID                                       /* Title reference */
  249. };
  250.  
  251. resource rMenuItem (QuitRID,nocrossbank)    {
  252.     QuitID,                                             /* Item ID */
  253.     "Q","q",                                            /* Item characters */
  254.     NIL,                                                /* Item check */
  255.     RefIsResource*ItemTitleRefShift,                    /* Item flags */
  256.     QuitTitleRID                                        /* Title reference */
  257. };
  258.  
  259. resource rMenuItem (UndoRID,nocrossbank)    {
  260.     UndoID,                                             /* Item ID */
  261.     "Z","z",                                            /* Item characters */
  262.     NIL,                                                /* Item check */
  263.     RefIsResource*ItemTitleRefShift+rMIDivider+rMIDisabled,
  264.                                                         /* Item flags */
  265.     UndoTitleRID                                        /* Title reference */
  266. };
  267.  
  268. resource rMenuItem (CutRID,nocrossbank) {
  269.     CutID,                                              /* Item ID */
  270.     "X","x",                                            /* Item characters */
  271.     NIL,                                                /* Item check */
  272.     RefIsResource*ItemTitleRefShift+rMIDisabled,        /* Item flags */
  273.     CutTitleRID                                     /* Title reference */
  274. };
  275.  
  276. resource rMenuItem (CopyRID,nocrossbank)    {
  277.     CopyID,                                             /* Item ID */
  278.     "C","c",                                            /* Item characters */
  279.     NIL,                                                /* Item check */
  280.     RefIsResource*ItemTitleRefShift+rMIDisabled,        /* Item flags */
  281.     CopyTitleRID                                        /* Title reference */
  282. };
  283.  
  284. resource rMenuItem (PasteRID,nocrossbank)   {
  285.     PasteID,                                            /* Item ID */
  286.     "V","v",                                            /* Item characters */
  287.     NIL,                                                /* Item check */
  288.     RefIsResource*ItemTitleRefShift+rMIDisabled,        /* Item flags */
  289.     PasteTitleRID                                       /* Title reference */
  290. };
  291.  
  292. resource rMenuItem (ClearRID,nocrossbank)   {
  293.     ClearID,                                            /* Item ID */
  294.     "","",                                              /* Item characters */
  295.     NIL,                                                /* Item check */
  296.     RefIsResource*ItemTitleRefShift+rMIDisabled,        /* Item flags */
  297.     ClearTitleRID                                       /* Title reference */
  298. };
  299.  
  300.  
  301. /* The following PStrings are our menu titles and IDs.  1.1B1 changes the menu
  302.    titles to use two spaces on either side, as recommended for 640 mode in
  303.    IIgs TN #5.  --MD */
  304.    
  305. resource rPString (AppleMenuTitleRID,nocrossbank)   {
  306.     "@"
  307. };
  308.  
  309. resource rPString (AboutTitleRID,nocrossbank)   {
  310.     "About the Shell..."
  311. };
  312.  
  313. resource rPString (FileMenuTitleRID,nocrossbank)    {
  314.     "  File  "
  315. };
  316.  
  317. resource rPString (CloseTitleRID,nocrossbank)   {
  318.     "Close"
  319. };
  320.  
  321. resource rPString (QuitTitleRID,nocrossbank)    {
  322.     "Quit"
  323. };
  324.  
  325. resource rPString (EditMenuTitleRID,nocrossbank)    {
  326.     "  Edit  "
  327. };
  328.  
  329. resource rPString (UndoTitleRID,nocrossbank)    {
  330.     "Undo"
  331. };
  332.  
  333. resource rPString (CutTitleRID,nocrossbank) {
  334.     "Cut"
  335. };
  336.  
  337. resource rPString (CopyTitleRID,nocrossbank)    {
  338.     "Copy"
  339. };
  340.  
  341. resource rPString (PasteTitleRID,nocrossbank)   {
  342.     "Paste"
  343. };
  344.  
  345. resource rPString (ClearTitleRID,nocrossbank)   {
  346.     "Clear"
  347. };
  348.  
  349. resource rToolStartup (MainToolStartupRID,nocrossbank)  {
  350.     
  351. /* We've expanded this list over the original 1.0 Shell list to include more
  352.    tools for desk accessories to use, as described in Apple IIgs Technical
  353.    Note #53, "Desk Accessories and Tools."  The table is also longer because
  354.    the previous version of the shell didn't load ROM-based tools it started
  355.    (like QuickDraw).
  356.    
  357.    As a suggestion, maintain a complete list of the tools as shown below. This
  358.    way it is easy to edit tools in and out of the list by inserting or deleting
  359.    the comment symbols, and it is clear which tools are loaded and which tools
  360.    are not loaded.
  361.    
  362.    The Resource Manager (#30) is automatically taken care of by StartUpTools
  363.    (or else it couldn't read this resource!) The Tool Locator and Memory
  364.    Manager are started up seperately, prior to StartUpTools and shut down after
  365.    ShutDownTools. */
  366.    
  367.     $4080,                                      /* 640 mode + fastport aware */
  368.     {
  369.         3,$0300,                        /* misc tools */
  370.         4,$0301,                        /* quickdraw */
  371.         5,$0302,                        /* desk manager */
  372.         6,$0300,                        /* eventMgr */
  373.         7,$0200,                        /* scheduler */
  374. /*      8,$0301,                        /* sound tools */
  375. /*      9,$0201,                        /* ADB tools */
  376. /*      10,$0202,                       /* SANE */
  377.         11,$0200,                       /* int math */
  378. /*      12,$0201,                       /* Text Tool set */
  379.         14,$0301,                       /* Window Manager */
  380.         15,$0301,                       /* Menu Manager */
  381.         16,$0301,                       /* Control Manager */
  382. /*      17,$0300,                       /* System Loader */
  383.         18,$0301,                       /* QD Aux */
  384.         19,$0300,                       /* print manager */
  385.         20,$0301,                       /* LineEdit tool set */
  386.         21,$0302,                       /* Dialog Manager */
  387.         22,$0300,                       /* Scrap manager */
  388.         23,$0301,                       /* standard file */
  389. /*      25,$0104,                       /* NoteSynth */
  390. /*      26,$0104,                       /* Note Seq */
  391.         27,$0301,                       /* Font manager */
  392.         28,$0301,                       /* list manager */
  393. /*      29,$0101,                       /* ACE */
  394. /*      32,$0103,                       /* Midi Tools */
  395. /*      34,$0101                        /* text edit */
  396.     }
  397. };
  398.  
  399. /*  Application-specific resources  */
  400.