home *** CD-ROM | disk | FTP | other *** search
/ Otherware / Otherware_1_SB_Development.iso / mac / developm / scnote / gzonelst.011 / GetZoneList.r < prev    next >
Encoding:
Text File  |  1989-10-01  |  6.7 KB  |  309 lines

  1. /*-----------------------------------------------------------------------------
  2. #
  3. #    Apple Macintosh Developer Technical Support
  4. #
  5. #    AppleTalk GetZoneList Sample Application
  6. #
  7. #    GetZoneList
  8. #
  9. #    GetZoneList.r    -    Rez Source
  10. #
  11. #    Copyright ⌐ 1988 Apple Computer, Inc.
  12. #    All rights reserved.
  13. #
  14. #    Versions:    1.0                    11/88
  15. #                1.1                    10/89
  16. #
  17. #    Components:    GetZoneList.p        October 1, 1989
  18. #                GetZoneList.c        October 1, 1989
  19. #                GetZoneList.r        October 1, 1989
  20. #                PGetZoneList.make    October 1, 1989
  21. #                CGetZoneList.make    October 1, 1989
  22. #
  23. #    Requirements:
  24. #                UFailure.p            November 1, 1988
  25. #                UFailure.inc1.p        November 1, 1988
  26. #                UFailure.a            November 1, 1988
  27. #
  28. #    GetZoneList is a sample application that uses
  29. #    AppleTalk ATP and ZIP to obtain a list of zones
  30. #    on an AppleTalk internet.
  31. #
  32. #    GetZoneList also demonstrates using a signal, or
  33. #    failure-catching mechanism to recover from error
  34. #    situations.
  35. #
  36. #    GetZoneList is based on MACDTS Sample.p. For more
  37. #    description and explanantion of the non-example
  38. #    specific areas of this application, please refer to
  39. #    either Sample.p or TESample.p.
  40. #
  41. -----------------------------------------------------------------------------*/
  42.  
  43. #include "SysTypes.r"
  44. #include "Types.r"
  45.  
  46.  
  47. #define kMinSize    62        /* application's minimum size (in K) */
  48. #define kPrefSize    66        /* application's preferred size (in K) */
  49.  
  50. #define    rAboutAlert    128        /* about alert */
  51. #define rZoneDialog    129        /* zone list dialog */
  52. #define rUserAlert    130        /* error alert */
  53.  
  54. #define    sErrStrings    128        /* error strings STR# ID */
  55.  
  56. #define    rMenuBar    128        /* application's menu bar */
  57.  
  58. #define    mApple        128        /* Apple menu */
  59.  
  60. #define    mFile        129        /* File menu */
  61.  
  62. #define    mEdit        130        /* Edit menu */
  63.  
  64. /* these #defines are used to set enable/disable flags of a menu */
  65.  
  66. #define AllItems    0b1111111111111111111111111111111    /* 31 flags */
  67. #define NoItems        0b0000000000000000000000000000000
  68. #define MenuItem1    0b0000000000000000000000000000001
  69. #define MenuItem2    0b0000000000000000000000000000010
  70. #define MenuItem3    0b0000000000000000000000000000100
  71. #define MenuItem4    0b0000000000000000000000000001000
  72. #define MenuItem5    0b0000000000000000000000000010000
  73. #define MenuItem6    0b0000000000000000000000000100000
  74. #define MenuItem7    0b0000000000000000000000001000000
  75. #define MenuItem8    0b0000000000000000000000010000000
  76. #define MenuItem9    0b0000000000000000000000100000000
  77. #define MenuItem10    0b0000000000000000000001000000000
  78. #define MenuItem11    0b0000000000000000000010000000000
  79. #define MenuItem12    0b0000000000000000000100000000000
  80.  
  81.  
  82. resource 'vers' (1) {
  83.     0x01, 0x10, release, 0x00, verUS,
  84.     "1.10",
  85.     "1.10, Copyright ⌐ 1989 Apple Computer, Inc."
  86. };
  87.  
  88. /* we use an MBAR resource to conveniently load all the menus */
  89.  
  90. resource 'MBAR' (rMenuBar, preload) {
  91.     { mApple, mFile, mEdit };    /* three menus */    
  92. };
  93.  
  94.  
  95. resource 'MENU' (mApple, preload) {
  96.     mApple, textMenuProc,
  97.     AllItems & ~MenuItem2,        /* Disable dashed line, enable About and DAs */
  98.     enabled, apple,
  99.     {
  100.         "About GetZoneList╔",
  101.             noicon, nokey, nomark, plain;
  102.         "-",
  103.             noicon, nokey, nomark, plain
  104.     }
  105. };
  106.  
  107. resource 'MENU' (mFile, preload) {
  108.     mFile, textMenuProc,
  109.     MenuItem1 | MenuItem12,        /* enable Quit and New only, program enables others */
  110.     enabled, "File",
  111.     {
  112.         "New",
  113.             noicon, "N", nomark, plain;
  114.         "Open",
  115.             noicon, "O", nomark, plain;
  116.         "-",
  117.             noicon, nokey, nomark, plain;
  118.         "Close",
  119.             noicon, "W", nomark, plain;
  120.         "Save",
  121.             noicon, "S", nomark, plain;
  122.         "Save As╔",
  123.             noicon, nokey, nomark, plain;
  124.         "Revert",
  125.             noicon, nokey, nomark, plain;
  126.         "-",
  127.             noicon, nokey, nomark, plain;
  128.         "Page Setup╔",
  129.             noicon, nokey, nomark, plain;
  130.         "Print╔",
  131.             noicon, nokey, nomark, plain;
  132.         "-",
  133.             noicon, nokey, nomark, plain;
  134.         "Quit",
  135.             noicon, "Q", nomark, plain
  136.     }
  137. };
  138.  
  139. resource 'MENU' (mEdit, preload) {
  140.     mEdit, textMenuProc,
  141.     NoItems,                    /* disable everything, program does the enabling */
  142.     enabled, "Edit",
  143.      {
  144.         "Undo",
  145.             noicon, "Z", nomark, plain;
  146.         "-",
  147.             noicon, nokey, nomark, plain;
  148.         "Cut",
  149.             noicon, "X", nomark, plain;
  150.         "Copy",
  151.             noicon, "C", nomark, plain;
  152.         "Paste",
  153.             noicon, "V", nomark, plain;
  154.         "Clear",
  155.             noicon, nokey, nomark, plain
  156.     }
  157. };
  158.  
  159. /* this ALRT and DITL are used as an About screen */
  160.  
  161. resource 'ALRT' (rAboutAlert) {
  162.     {40, 20, 160, 292}, rAboutAlert, {
  163.         OK, visible, silent;
  164.         OK, visible, silent;
  165.         OK, visible, silent;
  166.         OK, visible, silent
  167.     };
  168. };
  169.  
  170. resource 'DITL' (rAboutAlert) {
  171.      {
  172.         {88, 180, 108, 260},
  173.         Button {
  174.             enabled,    "OK"
  175.         };
  176.         {8, 8, 24, 214},
  177.         StaticText {
  178.             disabled,    "GetZoneList"
  179.         };
  180.         {32, 8, 48, 237},
  181.         StaticText {
  182.             disabled,    "Copyright ⌐ 1989 Apple Computer"
  183.         };
  184.         {56, 8, 72, 136},
  185.         StaticText {
  186.             disabled,    "Brought to you by:"
  187.         };
  188.         {80, 24, 112, 167},
  189.         StaticText {
  190.             disabled,    "Macintosh Developer Technical Support"
  191.         }
  192.     }
  193. };
  194.  
  195.  
  196. /* this DLOG and DITL are used for the Zone List dialog */
  197.  
  198. resource 'DLOG' (rZoneDialog) {
  199.     {100, 200, 290, 400},
  200.     dBoxProc,
  201.     invisible,
  202.     noGoAway,
  203.     0x0,
  204.     rZoneDialog,
  205.     ""
  206. };
  207.  
  208. resource 'DITL' (rZoneDialog) {
  209.     {
  210.         {160, 120, 180, 180},
  211.         Button {
  212.             enabled,
  213.             "OK"
  214.         },
  215.         {20, 20, 148, 180},
  216.         UserItem {
  217.             enabled
  218.         },
  219.         {160, 120, 180, 180},
  220.         UserItem {
  221.             disabled
  222.         }
  223.     }
  224. };
  225.  
  226.  
  227. /* this ALRT and DITL are used as an error screen */
  228.  
  229. resource 'ALRT' (rUserAlert, purgeable) {
  230.     {40, 20, 180, 260},
  231.     rUserAlert,
  232.     { /* array: 4 elements */
  233.         /* [1] */
  234.         OK, visible, silent,
  235.         /* [2] */
  236.         OK, visible, silent,
  237.         /* [3] */
  238.         OK, visible, silent,
  239.         /* [4] */
  240.         OK, visible, silent
  241.     }
  242. };
  243.  
  244.  
  245. resource 'DITL' (rUserAlert, purgeable) {
  246.     { /* array DITLarray: 4 elements */
  247.         /* [1] */
  248.         {110, 150, 130, 230},
  249.         Button {
  250.             enabled,
  251.             "OK"
  252.         },
  253.         /* [2] */
  254.         {10, 60, 60, 230},
  255.         StaticText {
  256.             disabled,
  257.             "Error. ^0."
  258.         },
  259.         /* [3] */
  260.         {70, 60, 90, 230},
  261.         StaticText {
  262.             disabled,
  263.             "^1"
  264.         },
  265.         /* [4] */
  266.         {8, 8, 40, 40},
  267.         Icon {
  268.             disabled,
  269.             2
  270.         }
  271.     }
  272. };
  273.  
  274.  
  275. resource 'STR#' (sErrStrings, purgeable) {
  276.     {
  277.     "An error occurred. The error number is: ";
  278.     "You must run on 512Ke or later";
  279.     "Application Memory Size is too small";
  280.     "Not enough memory to run GetZoneList";
  281.     "An AppleTalk-related error occurred";
  282.     "There are no zones"
  283.     }
  284. };
  285.  
  286. /* here is the quintessential MultiFinder friendliness device, the SIZE resource */
  287.  
  288. resource 'SIZE' (-1) {
  289.     dontSaveScreen,
  290.     acceptSuspendResumeEvents,
  291.     enableOptionSwitch,
  292.     canBackground,                /* we can background; we don't currently, but our sleep value */
  293.                                 /* guarantees we don't hog the Mac while we are in the background */
  294.     multiFinderAware,            /* this says we do our own activate/deactivate; don't fake us out */
  295.     backgroundAndForeground,    /* this is definitely not a background-only application! */
  296.     dontGetFrontClicks,            /* change this is if you want "do first click" behavior like the Finder */
  297.     ignoreChildDiedEvents,
  298.     is32BitCompatible,
  299.     reserved,
  300.     reserved,
  301.     reserved,
  302.     reserved,
  303.     reserved,
  304.     reserved,
  305.     reserved,
  306.     kPrefSize * 1024,
  307.     kMinSize * 1024
  308. };
  309.